@stigg/react-sdk 5.28.2 → 5.28.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": "5.28.2",
2
+ "version": "5.28.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -83,7 +83,7 @@ export function CheckoutContainer({
83
83
  onMockCheckoutPreview,
84
84
  }: CheckoutContainerProps) {
85
85
  const { stripePromise, setupIntentClientSecret } = useStripeIntegration();
86
- const [{ stiggTheme, widgetState, theme }] = useCheckoutContext();
86
+ const [{ stiggTheme, widgetState, theme, isWidgetWatermarkEnabled }] = useCheckoutContext();
87
87
  const { currentStep } = useProgressBarModel();
88
88
 
89
89
  const { isLoadingCheckoutData } = widgetState;
@@ -151,7 +151,7 @@ export function CheckoutContainer({
151
151
  <CheckoutContent>
152
152
  <CheckoutPanel>{isLoadingCheckoutData ? <ContentLoadingSkeleton /> : checkoutContent}</CheckoutPanel>
153
153
  {isLoadingCheckoutData ? (
154
- <CheckoutSummarySkeleton />
154
+ <CheckoutSummarySkeleton isWidgetWatermarkEnabled={isWidgetWatermarkEnabled} />
155
155
  ) : (
156
156
  <CheckoutSummary
157
157
  disablePromotionCode={disablePromotionCode}
@@ -160,6 +160,7 @@ export function CheckoutContainer({
160
160
  onCheckoutCompleted={onCheckoutCompleted}
161
161
  isFreeDowngrade={isFreeDowngrade}
162
162
  onMockCheckoutPreview={onMockCheckoutPreview}
163
+ isWidgetWatermarkEnabled={isWidgetWatermarkEnabled}
163
164
  />
164
165
  )}
165
166
  </CheckoutContent>
@@ -35,6 +35,7 @@ export interface CheckoutContextState {
35
35
  addonsStep: AddonsStepState;
36
36
  paymentStep: PaymentStepState;
37
37
  widgetState: WidgetState;
38
+ isWidgetWatermarkEnabled: boolean;
38
39
  }
39
40
 
40
41
  export const CheckoutContext = React.createContext<
@@ -101,7 +102,12 @@ export function CheckoutProvider({
101
102
  }: {
102
103
  children: React.ReactNode;
103
104
  } & CheckoutProviderProps) {
104
- const { checkout, isLoading } = useLoadCheckout({ resourceId, planId, billingCountryCode, onMockCheckoutState });
105
+ const { checkout, isLoading, isWidgetWatermarkEnabled } = useLoadCheckout({
106
+ resourceId,
107
+ planId,
108
+ billingCountryCode,
109
+ onMockCheckoutState,
110
+ });
105
111
  const configuration: CustomizedTheme = checkout?.configuration
106
112
  ? mapCheckoutConfiguration(checkout.configuration)
107
113
  : { typography: mapTypography(defaultCheckoutTypography) };
@@ -147,6 +153,7 @@ export function CheckoutProvider({
147
153
  paymentStep,
148
154
  resourceId: checkout?.resource?.id,
149
155
  widgetState: { readOnly: false, isValid: true, isLoadingCheckoutData: isLoading },
156
+ isWidgetWatermarkEnabled,
150
157
  };
151
158
 
152
159
  return initialState;
@@ -43,5 +43,6 @@ export function useLoadCheckout({ planId, resourceId, billingCountryCode, onMock
43
43
  return {
44
44
  checkout,
45
45
  isLoading,
46
+ isWidgetWatermarkEnabled: stigg.isWidgetWatermarkEnabled,
46
47
  };
47
48
  }
@@ -110,7 +110,8 @@ export const CheckoutSummary = ({
110
110
  disableSuccessAnimation,
111
111
  isFreeDowngrade,
112
112
  onMockCheckoutPreview,
113
- }: CheckoutContainerProps & { isFreeDowngrade: boolean }) => {
113
+ isWidgetWatermarkEnabled,
114
+ }: CheckoutContainerProps & { isFreeDowngrade: boolean; isWidgetWatermarkEnabled: boolean }) => {
114
115
  const [isCheckoutCompletedSuccessfully, setIsCheckoutCompletedSuccessfully] = useState(false);
115
116
  const { setErrorMessage } = usePaymentStepModel();
116
117
  const progressBar = useProgressBarModel();
@@ -415,7 +416,7 @@ export const CheckoutSummary = ({
415
416
  </SummaryCard>
416
417
  <PoweredByStigg
417
418
  source="checkout"
418
- showWatermark
419
+ showWatermark={isWidgetWatermarkEnabled}
419
420
  style={{ marginTop: 8, display: 'flex', justifyContent: 'center' }}
420
421
  />
421
422
  {!disableSuccessAnimation && isCheckoutCompletedSuccessfully && (
@@ -3,7 +3,7 @@ import { PoweredByStigg } from '../../common/PoweredByStigg';
3
3
  import { SummaryCard, SummaryContainer } from './CheckoutSummary';
4
4
  import { FlexedSkeleton, Skeleton, SkeletonsContainer } from '../components/Skeletons.style';
5
5
 
6
- export const CheckoutSummarySkeleton = () => {
6
+ export const CheckoutSummarySkeleton = ({ isWidgetWatermarkEnabled }: { isWidgetWatermarkEnabled: boolean }) => {
7
7
  return (
8
8
  <SummaryContainer>
9
9
  <SummaryCard>
@@ -31,7 +31,7 @@ export const CheckoutSummarySkeleton = () => {
31
31
  </SummaryCard>
32
32
  <PoweredByStigg
33
33
  source="checkout"
34
- showWatermark
34
+ showWatermark={isWidgetWatermarkEnabled}
35
35
  style={{ marginTop: 8, display: 'flex', justifyContent: 'center' }}
36
36
  />
37
37
  </SummaryContainer>
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable react/no-unused-prop-types */
2
2
  import React from 'react';
3
3
  import moment from 'moment';
4
+ import { Box } from '@mui/material';
4
5
  import { BillingModel, BillingPeriod, Plan, Subscription, SubscriptionPreviewV2 } from '@stigg/js-client-sdk';
5
6
  import { Typography } from '../../../common/Typography';
6
7
  import { currencyPriceFormatter } from '../../../utils/currencyUtils';
@@ -35,7 +36,7 @@ const RemainingCreditsCaption = ({
35
36
  });
36
37
 
37
38
  return (
38
- <Typography variant="body1" style={{ marginTop: 14 }}>
39
+ <Typography variant="body1" style={{ marginTop: 14 }} className="stigg-checkout-summary-captions-remaining-credits">
39
40
  <WithSkeleton isLoading={isFetchingSubscriptionPreview} width="100%">
40
41
  {checkoutLocalization.summary.creditsForUnusedTimeText({ credits })}
41
42
  </WithSkeleton>
@@ -60,7 +61,7 @@ const ScheduledUpdatesCaption = ({
60
61
  : checkoutLocalization.summary.changesWillApplyAtEndOfBillingPeriod;
61
62
 
62
63
  return (
63
- <Typography variant="body1" style={{ marginTop: 14 }}>
64
+ <Typography variant="body1" style={{ marginTop: 14 }} className="stigg-checkout-summary-captions-scheduled-updates">
64
65
  <WithSkeleton isLoading={isFetchingSubscriptionPreview} width="100%">
65
66
  {changesWillApplyText}
66
67
  </WithSkeleton>
@@ -125,7 +126,7 @@ const NextBillingCaption = ({
125
126
  text += `${totalAmountText}for this subscription every ${billingPeriodText} on ${nextBillingDate}, unless you cancel.`;
126
127
 
127
128
  return (
128
- <Typography variant="body1" style={{ marginTop: 14 }}>
129
+ <Typography variant="body1" style={{ marginTop: 14 }} className="stigg-checkout-summary-captions-next-billing">
129
130
  <WithSkeleton isLoading={isFetchingSubscriptionPreview} width="100%">
130
131
  {text}
131
132
  </WithSkeleton>
@@ -135,12 +136,12 @@ const NextBillingCaption = ({
135
136
 
136
137
  export function CheckoutCaptions(props: CheckoutCaptionProps) {
137
138
  return (
138
- <>
139
+ <Box className="stigg-checkout-summary-captions">
139
140
  <RemainingCreditsCaption {...props} />
140
141
 
141
142
  <ScheduledUpdatesCaption {...props} />
142
143
 
143
144
  <NextBillingCaption {...props} />
144
- </>
145
+ </Box>
145
146
  );
146
147
  }