@stigg/react-sdk 5.28.1 → 5.28.3
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/utils/currencyUtils.d.ts +2 -1
- package/dist/react-sdk.cjs.development.js +15 -9
- 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 +16 -10
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/checkout/summary/components/CheckoutCaptions.tsx +6 -5
- package/src/components/utils/currencyUtils.ts +4 -3
- package/src/components/utils/getPaidPriceText.ts +7 -1
package/package.json
CHANGED
|
@@ -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
|
}
|
|
@@ -7,12 +7,14 @@ export const currencyPriceFormatter = ({
|
|
|
7
7
|
locale,
|
|
8
8
|
maximumFractionDigits = 5,
|
|
9
9
|
minimumFractionDigits = 0,
|
|
10
|
+
removeTrailingZero,
|
|
10
11
|
}: {
|
|
11
12
|
amount: number;
|
|
12
13
|
currency?: Currency | string;
|
|
13
14
|
locale?: string;
|
|
14
15
|
maximumFractionDigits?: number;
|
|
15
16
|
minimumFractionDigits?: number;
|
|
17
|
+
removeTrailingZero?: boolean;
|
|
16
18
|
}) => {
|
|
17
19
|
const currencyString = currency.toString();
|
|
18
20
|
const currencySymbol = getSymbolFromCurrency(currencyString);
|
|
@@ -21,10 +23,9 @@ export const currencyPriceFormatter = ({
|
|
|
21
23
|
minimumFractionDigits,
|
|
22
24
|
style: 'currency',
|
|
23
25
|
currency: currencyString,
|
|
24
|
-
|
|
25
|
-
trailingZeroDisplay: 'stripIfInteger',
|
|
26
|
+
trailingZeroDisplay: removeTrailingZero ? 'stripIfInteger' : 'auto',
|
|
26
27
|
...(currencySymbol ? { currencyDisplay: 'code' } : {}),
|
|
27
|
-
}).format(amount || 0);
|
|
28
|
+
} as Intl.NumberFormatOptions).format(amount || 0);
|
|
28
29
|
|
|
29
30
|
if (currencySymbol) {
|
|
30
31
|
formattedPrice = formattedPrice.replace(currencyString, currencySymbol);
|
|
@@ -63,7 +63,13 @@ export function getPaidPriceText({
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return {
|
|
66
|
-
price: currencyPriceFormatter({
|
|
66
|
+
price: currencyPriceFormatter({
|
|
67
|
+
amount: priceNumber,
|
|
68
|
+
currency,
|
|
69
|
+
locale,
|
|
70
|
+
minimumFractionDigits: 2,
|
|
71
|
+
removeTrailingZero: true,
|
|
72
|
+
}),
|
|
67
73
|
unit,
|
|
68
74
|
tiers,
|
|
69
75
|
tierUnits,
|