@stigg/react-sdk 4.4.3 → 4.4.5

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.
Files changed (46) hide show
  1. package/dist/components/checkout/CheckoutProvider.d.ts +2 -2
  2. package/dist/components/checkout/components/ChangePlanButton.d.ts +1 -1
  3. package/dist/components/checkout/components/DowngradeToFreeContainer.d.ts +1 -1
  4. package/dist/components/checkout/{textOverrides.d.ts → configurations/textOverrides.d.ts} +1 -1
  5. package/dist/components/checkout/{theme.d.ts → configurations/theme.d.ts} +2 -2
  6. package/dist/components/checkout/configurations/typography.d.ts +2 -0
  7. package/dist/components/checkout/index.d.ts +2 -2
  8. package/dist/components/checkout/promotionCode/AddPromotionCodeButton.d.ts +1 -1
  9. package/dist/components/checkout/promotionCode/PromotionCodeSection.d.ts +1 -1
  10. package/dist/components/checkout/steps/payment/PaymentMethods.d.ts +1 -1
  11. package/dist/components/checkout/steps/plan/BillingPeriodPicker.d.ts +1 -1
  12. package/dist/components/checkout/summary/CheckoutSuccess.d.ts +1 -1
  13. package/dist/components/checkout/summary/CheckoutSummary.d.ts +12 -2
  14. package/dist/components/checkout/summary/components/CheckoutCaptions.d.ts +1 -1
  15. package/dist/components/checkout/summary/components/LineItems.d.ts +1 -1
  16. package/dist/components/common/mapExternalTheme.d.ts +2 -1
  17. package/dist/react-sdk.cjs.development.js +73 -46
  18. package/dist/react-sdk.cjs.development.js.map +1 -1
  19. package/dist/react-sdk.cjs.production.min.js +1 -1
  20. package/dist/react-sdk.cjs.production.min.js.map +1 -1
  21. package/dist/react-sdk.esm.js +80 -48
  22. package/dist/react-sdk.esm.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/components/checkout/CheckoutContainer.tsx +1 -0
  25. package/src/components/checkout/CheckoutProvider.tsx +6 -5
  26. package/src/components/checkout/components/ChangePlanButton.tsx +4 -4
  27. package/src/components/checkout/components/DowngradeToFreeContainer.tsx +1 -1
  28. package/src/components/checkout/{textOverrides.ts → configurations/textOverrides.ts} +2 -2
  29. package/src/components/checkout/{theme.ts → configurations/theme.ts} +2 -2
  30. package/src/components/checkout/configurations/typography.ts +20 -0
  31. package/src/components/checkout/index.ts +2 -2
  32. package/src/components/checkout/planHeader/PlanHeader.tsx +1 -3
  33. package/src/components/checkout/promotionCode/AddPromotionCodeButton.tsx +3 -2
  34. package/src/components/checkout/promotionCode/PromotionCodeSection.tsx +1 -1
  35. package/src/components/checkout/steps/addons/CheckoutAddonsStep.tsx +1 -1
  36. package/src/components/checkout/steps/payment/PaymentMethods.tsx +1 -1
  37. package/src/components/checkout/steps/plan/BillingPeriodPicker.style.tsx +2 -1
  38. package/src/components/checkout/steps/plan/BillingPeriodPicker.tsx +2 -2
  39. package/src/components/checkout/summary/CheckoutSuccess.tsx +1 -1
  40. package/src/components/checkout/summary/CheckoutSummary.tsx +17 -8
  41. package/src/components/checkout/summary/CheckoutSummarySkeleton.tsx +3 -4
  42. package/src/components/checkout/summary/components/CheckoutCaptions.tsx +3 -3
  43. package/src/components/checkout/summary/components/LineItems.tsx +2 -2
  44. package/src/components/common/mapExternalTheme.ts +14 -10
  45. package/src/components/paywall/BillingPeriodPicker.tsx +3 -5
  46. package/src/theme/getResolvedTheme.ts +1 -1
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.4.3",
2
+ "version": "4.4.5",
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,
@@ -3,7 +3,7 @@ import React, { useCallback, useContext, useEffect, useMemo, useState } from 're
3
3
  import { BillableFeature, BillingPeriod, GetCheckoutStateResults } from '@stigg/js-client-sdk';
4
4
  import { CustomizedTheme, SdkThemeProvider, useStiggTheme } from '../../theme/Theme';
5
5
  import { DeepPartial } from '../../types';
6
- import { mapCheckoutConfiguration } from '../common/mapExternalTheme';
6
+ import { mapCheckoutConfiguration, mapTypography } from '../common/mapExternalTheme';
7
7
  import {
8
8
  AddonsStepState,
9
9
  getAddonsStepInitialState,
@@ -16,10 +16,11 @@ import {
16
16
  useLoadCheckout,
17
17
  WidgetState,
18
18
  } from './hooks';
19
- import { CheckoutLocalization, getResolvedCheckoutLocalize } from './textOverrides';
20
- import { CheckoutTheme, getResolvedCheckoutTheme } from './theme';
19
+ import { CheckoutLocalization, getResolvedCheckoutLocalize } from './configurations/textOverrides';
20
+ import { CheckoutTheme, getResolvedCheckoutTheme } from './configurations/theme';
21
21
  import { StiggTheme } from '../../theme/types';
22
22
  import { BillingInformation, MockCheckoutStateCallback } from './types';
23
+ import { defaultCheckoutTypography } from './configurations/typography';
23
24
 
24
25
  export interface CheckoutContextState {
25
26
  checkout?: GetCheckoutStateResults | null;
@@ -98,9 +99,9 @@ export function CheckoutProvider({
98
99
  children: React.ReactNode;
99
100
  } & CheckoutProviderProps) {
100
101
  const { checkout, isLoading } = useLoadCheckout({ resourceId, planId, billingCountryCode, onMockCheckoutState });
101
- const configuration: CustomizedTheme | undefined = checkout?.configuration
102
+ const configuration: CustomizedTheme = checkout?.configuration
102
103
  ? mapCheckoutConfiguration(checkout.configuration)
103
- : undefined;
104
+ : { typography: mapTypography(defaultCheckoutTypography) };
104
105
  const globalTheme: StiggTheme = useStiggTheme(configuration);
105
106
 
106
107
  const initialState = useMemo(() => {
@@ -1,8 +1,8 @@
1
- import { Button } from '@mui/material';
2
- import { Typography } from '../../common/Typography';
3
1
  import React from 'react';
4
- import { CheckoutLocalization } from '../textOverrides';
5
2
  import { ButtonProps } from '@mui/material/Button';
3
+ import { Button } from '@mui/material';
4
+ import { Typography } from '../../common/Typography';
5
+ import { CheckoutLocalization } from '../configurations/textOverrides';
6
6
 
7
7
  export const ChangePlanButton = ({
8
8
  onClick,
@@ -23,7 +23,7 @@ export const ChangePlanButton = ({
23
23
  <Typography
24
24
  className="stigg-checkout-change-plan-button-text"
25
25
  color="primary.main"
26
- variant="body1"
26
+ variant="h3"
27
27
  style={{ lineHeight: '24px' }}>
28
28
  {checkoutLocalization.changePlan}
29
29
  </Typography>
@@ -4,7 +4,7 @@ import { Alert, Box } from '@mui/material';
4
4
  import { CheckoutStatePlan, Subscription } from '@stigg/js-client-sdk';
5
5
  import { StyledArrowRightIcon } from './StyledArrow';
6
6
  import { Typography } from '../../common/Typography';
7
- import { CheckoutLocalization } from '../textOverrides';
7
+ import { CheckoutLocalization } from '../configurations/textOverrides';
8
8
  import { CheckoutContainerProps } from '../CheckoutContainer';
9
9
  import { ChangePlanButton } from './ChangePlanButton';
10
10
 
@@ -8,8 +8,8 @@ import {
8
8
  } from '@stigg/js-client-sdk';
9
9
  import moment from 'moment';
10
10
  import merge from 'lodash/merge';
11
- import { DeepPartial } from '../../types';
12
- import { currencyPriceFormatter } from '../utils/currencyUtils';
11
+ import { DeepPartial } from '../../../types';
12
+ import { currencyPriceFormatter } from '../../utils/currencyUtils';
13
13
 
14
14
  export type CheckoutLocalization = {
15
15
  changePlan: string;
@@ -1,6 +1,6 @@
1
1
  import { CheckoutConfiguration } from '@stigg/js-client-sdk';
2
- import { StiggTheme } from '../../theme/types';
3
- import { DeepPartial } from '../../types';
2
+ import { StiggTheme } from '../../../theme/types';
3
+ import { DeepPartial } from '../../../types';
4
4
 
5
5
  export type CheckoutTheme = {
6
6
  primary: string;
@@ -0,0 +1,20 @@
1
+ import { FontWeight, TypographyConfiguration } from '@stigg/js-client-sdk';
2
+
3
+ export const defaultCheckoutTypography: TypographyConfiguration = {
4
+ h1: {
5
+ fontSize: 24,
6
+ fontWeight: FontWeight.Bold,
7
+ },
8
+ h2: {
9
+ fontSize: 16,
10
+ fontWeight: FontWeight.Normal,
11
+ },
12
+ h3: {
13
+ fontSize: 16,
14
+ fontWeight: FontWeight.Normal,
15
+ },
16
+ body: {
17
+ fontSize: 14,
18
+ fontWeight: FontWeight.Normal,
19
+ },
20
+ };
@@ -1,4 +1,4 @@
1
- export { CheckoutTheme } from './theme';
1
+ export { CheckoutTheme } from './configurations/theme';
2
2
  export {
3
3
  OnCheckoutCompletedParams,
4
4
  OnCheckoutParams,
@@ -6,6 +6,6 @@ export {
6
6
  CheckoutContainerProps,
7
7
  } from './CheckoutContainer';
8
8
  export { CheckoutProviderProps } from './CheckoutProvider';
9
- export { CheckoutLocalization } from './textOverrides';
9
+ export { CheckoutLocalization } from './configurations/textOverrides';
10
10
  export { Checkout, CheckoutProps } from './Checkout';
11
11
  export * from './types';
@@ -23,9 +23,7 @@ export function PlanHeader({ allowChangePlan = false, onChangePlan }: PlanHeader
23
23
  </Typography>
24
24
 
25
25
  <Box sx={{ display: 'flex', justifyContent: 'space-between' }}>
26
- <Typography variant="h3" bold>
27
- {plan?.displayName}
28
- </Typography>
26
+ <Typography variant="h1">{plan?.displayName}</Typography>
29
27
 
30
28
  {allowChangePlan && onChangePlan && (
31
29
  <ChangePlanButton
@@ -4,9 +4,10 @@ import styled from '@emotion/styled/macro';
4
4
  import PlusIcon from '../../../assets/plus-icon.svg';
5
5
  import { Typography } from '../../common/Typography';
6
6
  import { Button } from '../components';
7
- import { CheckoutLocalization } from '../textOverrides';
7
+ import { CheckoutLocalization } from '../configurations/textOverrides';
8
8
 
9
9
  const StyledPlusIcon = styled(PlusIcon, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{ $disabled: boolean }>`
10
+ margin-right: 8px;
10
11
  path {
11
12
  stroke: ${({ theme, $disabled }) => ($disabled ? theme.stigg.palette.text.disabled : theme.stigg.palette.primary)};
12
13
  }
@@ -36,7 +37,7 @@ export const AddPromotionCodeButton = ({ onAddClick, checkoutLocalization, disab
36
37
  className="stigg-checkout-change-plan-button-text"
37
38
  color={disabled ? 'disabled' : 'primary.main'}
38
39
  style={{ lineHeight: '24px' }}
39
- variant="body1">
40
+ variant="h3">
40
41
  {checkoutLocalization.summary.addCouponCodeText}
41
42
  </Typography>
42
43
  </Button>
@@ -3,7 +3,7 @@ import styled from '@emotion/styled/macro';
3
3
  import { usePromotionCodeModel } from '../hooks/useCouponModel';
4
4
  import { AddPromotionCode } from './AddPromotionCode';
5
5
  import { AppliedPromotionCode } from './AppliedPromotionCode';
6
- import { CheckoutLocalization } from '../textOverrides';
6
+ import { CheckoutLocalization } from '../configurations/textOverrides';
7
7
  import { MockCheckoutPreviewCallback } from '../types';
8
8
 
9
9
  const PromotionCodeSectionContainer = styled.div`
@@ -10,7 +10,7 @@ import { Button, InputField } from '../../components';
10
10
  import { useAddonsStepModel } from '../../hooks/useAddonsStepModel';
11
11
  import { usePlanStepModel } from '../../hooks/usePlanStepModel';
12
12
  import { AddonListItemContainer, CheckoutAddonsContainer, TrashButton } from './CheckoutAddonsStep.style';
13
- import { CheckoutLocalization } from '../../textOverrides';
13
+ import { CheckoutLocalization } from '../../configurations/textOverrides';
14
14
  import { useCheckoutModel, useProgressBarModel } from '../../hooks';
15
15
 
16
16
  type UseAddonsStepModel = ReturnType<typeof useAddonsStepModel>;
@@ -12,7 +12,7 @@ import {
12
12
  PaymentMethodTextContainer,
13
13
  } from './PaymentMethods.style';
14
14
  import { StripePaymentForm } from './stripe';
15
- import { CheckoutLocalization } from '../../textOverrides';
15
+ import { CheckoutLocalization } from '../../configurations/textOverrides';
16
16
  import { CheckoutContainerProps } from '../../CheckoutContainer';
17
17
 
18
18
  export type PaymentMethodLayoutProps = {
@@ -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
  }};
@@ -9,7 +9,7 @@ import { Typography } from '../../../common/Typography';
9
9
  import { formatBillingPeriod } from '../../formatting';
10
10
  import { usePlanStepModel } from '../../hooks/usePlanStepModel';
11
11
  import { BillingPeriodButton, BillingPeriodOptions, BillingPeriodPickerContainer } from './BillingPeriodPicker.style';
12
- import { CheckoutLocalization } from '../../textOverrides';
12
+ import { CheckoutLocalization } from '../../configurations/textOverrides';
13
13
 
14
14
  const BillingPeriodOption = ({
15
15
  billingPeriod,
@@ -36,7 +36,7 @@ const BillingPeriodOption = ({
36
36
  />
37
37
 
38
38
  <Box>
39
- <Typography variant="body1" color="primary">
39
+ <Typography variant="h3" color="primary">
40
40
  {formatBillingPeriod(billingPeriod)}
41
41
  </Typography>
42
42
  </Box>
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  import Lottie from 'react-lottie';
6
6
  import animationData from '../../../assets/lottie/checkout-success.json';
7
7
  import { Typography } from '../../common/Typography';
8
- import { CheckoutLocalization } from '../textOverrides';
8
+ import { CheckoutLocalization } from '../configurations/textOverrides';
9
9
 
10
10
  export const ANIMATION_DURATION = 5000;
11
11
 
@@ -30,10 +30,15 @@ import {
30
30
  } from './components/LineItems';
31
31
  import { WithSkeleton } from './components/WithSkeleton';
32
32
  import { Icon } from '../../common/Icon';
33
- import { CheckoutLocalization } from '../textOverrides';
33
+ import { CheckoutLocalization } from '../configurations/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,12 +174,12 @@ export const CheckoutSummary = ({
169
174
  : checkoutLocalization.summary.baseChargeText;
170
175
 
171
176
  return (
172
- <Box flex={1}>
177
+ <SummaryContainer>
173
178
  <SummaryCard>
174
- <SummaryTitle variant="h6">{checkoutLocalization.summary.title}</SummaryTitle>
179
+ <SummaryTitle variant="h3">{checkoutLocalization.summary.title}</SummaryTitle>
175
180
 
176
181
  <Grid display="flex" flexDirection="row" alignItems="center" marginY={2}>
177
- <Typography variant="body1" color="primary" style={{ paddingRight: '8px' }}>
182
+ <Typography variant="h6" color="primary" style={{ paddingRight: '8px' }}>
178
183
  {checkoutLocalization.summary.planName({ plan: plan! })}
179
184
  </Typography>
180
185
  <StyledDivider className="stigg-checkout-summary-divider" sx={{ flex: 1, margin: '0 !important' }} />
@@ -213,7 +218,7 @@ export const CheckoutSummary = ({
213
218
  {!!subscription.addons?.length && (
214
219
  <>
215
220
  <Grid display="flex" flexDirection="row" alignItems="center" marginY={2}>
216
- <Typography variant="body1" color="primary" style={{ paddingRight: '8px' }}>
221
+ <Typography variant="h6" color="primary" style={{ paddingRight: '8px' }}>
217
222
  {checkoutLocalization.summary.addonsSectionTitle}
218
223
  </Typography>
219
224
  <StyledDivider className="stigg-checkout-summary-divider" sx={{ flex: 1, margin: '0 !important' }} />
@@ -243,7 +248,7 @@ export const CheckoutSummary = ({
243
248
  {!hasDiscounts && <StyledDivider className="stigg-checkout-summary-divider" />}
244
249
  {hasDiscounts && (
245
250
  <Grid display="flex" flexDirection="row" alignItems="center" marginY={2}>
246
- <Typography variant="body1" color="primary" style={{ paddingRight: '8px' }}>
251
+ <Typography variant="h6" color="primary" style={{ paddingRight: '8px' }}>
247
252
  {checkoutLocalization.summary.discountsSectionTitle}
248
253
  </Typography>
249
254
  <StyledDivider className="stigg-checkout-summary-divider" sx={{ flex: 1, margin: '0 !important' }} />
@@ -370,7 +375,11 @@ export const CheckoutSummary = ({
370
375
  void onCheckoutClick(e);
371
376
  }}
372
377
  fullWidth>
373
- <Typography className="stigg-checkout-summary-cta-button-text" color="white" style={{ display: 'flex' }}>
378
+ <Typography
379
+ className="stigg-checkout-summary-cta-button-text"
380
+ variant="h3"
381
+ color="white"
382
+ style={{ display: 'flex' }}>
374
383
  {isCheckoutCompletedSuccessfully ? (
375
384
  <Icon icon="Check" style={{ display: 'contents' }} />
376
385
  ) : isLoading || isFetchingSubscriptionPreview ? (
@@ -395,6 +404,6 @@ export const CheckoutSummary = ({
395
404
  {!disableSuccessAnimation && isCheckoutCompletedSuccessfully && (
396
405
  <CheckoutSuccess checkoutLocalization={checkoutLocalization} />
397
406
  )}
398
- </Box>
407
+ </SummaryContainer>
399
408
  );
400
409
  };
@@ -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
  };
@@ -4,7 +4,7 @@ import moment from 'moment';
4
4
  import { BillingModel, BillingPeriod, Plan, Subscription, SubscriptionPreviewV2 } from '@stigg/js-client-sdk';
5
5
  import { Typography } from '../../../common/Typography';
6
6
  import { currencyPriceFormatter } from '../../../utils/currencyUtils';
7
- import { CheckoutLocalization } from '../../textOverrides';
7
+ import { CheckoutLocalization } from '../../configurations/textOverrides';
8
8
  import { WithSkeleton } from './WithSkeleton';
9
9
 
10
10
  export type CheckoutCaptionProps = {
@@ -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
 
@@ -123,7 +123,7 @@ const NextBillingCaption = ({
123
123
  text += `${totalAmountText}for this subscription every ${billingPeriodText} on ${nextBillingDate}, unless you cancel.`;
124
124
 
125
125
  return (
126
- <Typography variant="caption" style={{ marginTop: 14 }}>
126
+ <Typography variant="body1" style={{ marginTop: 14 }}>
127
127
  <WithSkeleton isLoading={isFetchingSubscriptionPreview} width="100%">
128
128
  {text}
129
129
  </WithSkeleton>
@@ -7,7 +7,7 @@ import { currencyPriceFormatter } from '../../../utils/currencyUtils';
7
7
  import { getTierByQuantity } from '../../../utils/priceTierUtils';
8
8
  import { WithSkeleton } from './WithSkeleton';
9
9
  import { Skeleton } from '../../components/Skeletons.style';
10
- import { CheckoutLocalization } from '../../textOverrides';
10
+ import { CheckoutLocalization } from '../../configurations/textOverrides';
11
11
  import { Icon } from '../../../common/Icon';
12
12
  import { InformationTooltip } from '../../../common/InformationTooltip';
13
13
 
@@ -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}
@@ -8,6 +8,7 @@ import {
8
8
  } from '@stigg/js-client-sdk';
9
9
  import { CustomizedTheme } from '../../theme/Theme';
10
10
  import { HorizontalAlignment, FontWeight } from '../../theme/types';
11
+ import { defaultCheckoutTypography } from '../checkout/configurations/typography';
11
12
 
12
13
  function addCssUnits(value?: number | null, unit = 'px') {
13
14
  if (!value) {
@@ -31,24 +32,27 @@ function mapFontWeight(defaultValue: FontWeight, fontWeight?: JSFontWeight | nul
31
32
  }
32
33
  }
33
34
 
34
- function mapTypography(typography?: TypographyConfiguration | null): CustomizedTheme['typography'] {
35
+ export function mapTypography(
36
+ typography?: TypographyConfiguration | null,
37
+ defaultTypography?: TypographyConfiguration | null,
38
+ ): CustomizedTheme['typography'] {
35
39
  return {
36
40
  fontFamilyUrl: typography?.fontFamily || undefined,
37
41
  h1: {
38
- fontSize: addCssUnits(typography?.h1?.fontSize),
39
- fontWeight: mapFontWeight('bold', typography?.h1?.fontWeight),
42
+ fontSize: addCssUnits(typography?.h1?.fontSize || defaultTypography?.h1?.fontSize),
43
+ fontWeight: mapFontWeight('bold', typography?.h1?.fontWeight || defaultTypography?.h1?.fontWeight),
40
44
  },
41
45
  h2: {
42
- fontSize: addCssUnits(typography?.h2?.fontSize),
43
- fontWeight: mapFontWeight('normal', typography?.h2?.fontWeight),
46
+ fontSize: addCssUnits(typography?.h2?.fontSize || defaultTypography?.h2?.fontSize),
47
+ fontWeight: mapFontWeight('normal', defaultTypography?.h2?.fontWeight),
44
48
  },
45
49
  h3: {
46
- fontSize: addCssUnits(typography?.h3?.fontSize),
47
- fontWeight: mapFontWeight('normal', typography?.h3?.fontWeight),
50
+ fontSize: addCssUnits(typography?.h3?.fontSize || defaultTypography?.h3?.fontSize),
51
+ fontWeight: mapFontWeight('normal', typography?.h3?.fontWeight || defaultTypography?.h3?.fontWeight),
48
52
  },
49
53
  body: {
50
- fontSize: addCssUnits(typography?.body?.fontSize),
51
- fontWeight: mapFontWeight('normal', typography?.body?.fontWeight),
54
+ fontSize: addCssUnits(typography?.body?.fontSize || defaultTypography?.body?.fontSize),
55
+ fontWeight: mapFontWeight('normal', typography?.body?.fontWeight || defaultTypography?.body?.fontWeight),
52
56
  },
53
57
  };
54
58
  }
@@ -125,6 +129,6 @@ export function mapCheckoutConfiguration(configuration: CheckoutConfiguration):
125
129
  },
126
130
  backgroundHighlight: palette?.summaryBackgroundColor || undefined,
127
131
  },
128
- typography: mapTypography(typography),
132
+ typography: mapTypography(typography, defaultCheckoutTypography),
129
133
  };
130
134
  }
@@ -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} />}
@@ -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(),