@stigg/react-sdk 4.5.0 → 4.5.2

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 (24) hide show
  1. package/dist/components/checkout/CheckoutContainer.style.d.ts +4 -14
  2. package/dist/components/checkout/components/DowngradeToFreeContainer.d.ts +2 -7
  3. package/dist/components/checkout/components/InputField.d.ts +4 -6
  4. package/dist/components/checkout/components/Skeletons.style.d.ts +6 -75
  5. package/dist/components/checkout/progressBar/CheckoutProgressBar.style.d.ts +1 -31
  6. package/dist/components/checkout/steps/addons/CheckoutAddonsStep.style.d.ts +8 -82
  7. package/dist/components/checkout/steps/payment/PaymentMethods.style.d.ts +8 -100
  8. package/dist/components/checkout/steps/plan/BillingPeriodPicker.style.d.ts +6 -30
  9. package/dist/components/checkout/steps/plan/CheckoutPlanStep.style.d.ts +2 -7
  10. package/dist/components/checkout/summary/CheckoutSummary.d.ts +4 -16
  11. package/dist/components/customerPortal/common/StyledButton.d.ts +2 -32
  12. package/dist/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.style.d.ts +5 -31
  13. package/dist/components/customerPortal/usage/featureUsage/FeatureUsageProgressBar.d.ts +1 -11
  14. package/dist/react-sdk.cjs.development.js +18 -14
  15. package/dist/react-sdk.cjs.development.js.map +1 -1
  16. package/dist/react-sdk.cjs.production.min.js +1 -1
  17. package/dist/react-sdk.cjs.production.min.js.map +1 -1
  18. package/dist/react-sdk.esm.js +19 -15
  19. package/dist/react-sdk.esm.js.map +1 -1
  20. package/package.json +3 -3
  21. package/src/components/checkout/configurations/theme.ts +2 -1
  22. package/src/components/checkout/summary/CheckoutSummary.tsx +4 -2
  23. package/src/stories/mocks/checkout/mockCheckoutPreview.ts +1 -0
  24. package/src/theme/Theme.tsx +3 -2
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.5.0",
2
+ "version": "4.5.2",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -108,8 +108,8 @@
108
108
  "dependencies": {
109
109
  "@emotion/react": "^11.10.5",
110
110
  "@emotion/styled": "^11.10.5",
111
- "@mui/material": "^5.10.13",
112
- "@stigg/js-client-sdk": "2.24.0",
111
+ "@mui/material": "^5.12.0",
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",
115
115
  "@types/styled-components": "^5.1.26",
@@ -21,7 +21,8 @@ const defaultCheckoutTheme: CheckoutTheme = {
21
21
  export function getResolvedCheckoutTheme(
22
22
  globalTheme: StiggTheme,
23
23
  themeOverride?: DeepPartial<CheckoutTheme>,
24
- _remoteConfiguration?: CheckoutConfiguration | null, // all the remote colors override theme colors, no need to use them here
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
 
@@ -157,7 +157,7 @@ export const CheckoutSummary = ({
157
157
  const checkoutHasChanges =
158
158
  !!subscriptionPreview && (!!immediateInvoice?.proration || !!subscriptionPreview.hasScheduledUpdates);
159
159
  const showPromotionCodeLine = !disablePromotionCode && !isFreeDowngrade;
160
- const showDiscountLine = !!recurringInvoice && !!recurringInvoice?.discountDetails && !isFreeDowngrade;
160
+ const showDiscountLine = !!recurringInvoice?.discountDetails && !isFreeDowngrade;
161
161
  const hasDiscounts = showPromotionCodeLine || showDiscountLine;
162
162
 
163
163
  const hasPayAsYouGoCharges = usageCharges.some((price) => price.pricingModel === BillingModel.UsageBased);
@@ -311,7 +311,9 @@ export const CheckoutSummary = ({
311
311
  </>
312
312
  ) : null}
313
313
 
314
- {immediateInvoice?.subTotal && immediateInvoice?.subTotal.amount > 0 ? (
314
+ {immediateInvoice?.proration?.hasProrations &&
315
+ immediateInvoice?.subTotal &&
316
+ immediateInvoice?.subTotal.amount > 0 ? (
315
317
  <LineItemContainer>
316
318
  <LineItemRow>
317
319
  <Typography variant="body1" color="secondary">
@@ -140,6 +140,7 @@ export function mockPreviewSubscription(input: PreviewSubscription): Subscriptio
140
140
  credit: total.total,
141
141
  debit: total.total,
142
142
  netAmount: total.total,
143
+ hasProrations: false,
143
144
  },
144
145
  },
145
146
 
@@ -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={createTheme({ palette: muiPalette, stigg: 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} />