@stigg/react-sdk 4.1.0 → 4.1.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.
- package/dist/components/paywall/PlanOffering.d.ts +2 -1
- package/dist/react-sdk.cjs.development.js +30 -18
- 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 +30 -18
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/paywall/Paywall.tsx +6 -0
- package/src/components/paywall/PlanOffering.tsx +18 -11
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import { PoweredByStigg } from '../common/PoweredByStigg';
|
|
|
10
10
|
import { useStiggContext } from '../..';
|
|
11
11
|
import { hasPricePointsForPlans } from './utils/hasPricePoints';
|
|
12
12
|
import { getPlansToDisplay } from './utils/getPlansToDisplay';
|
|
13
|
+
import { getPlanPrice } from '../utils/getPlanPrice';
|
|
13
14
|
|
|
14
15
|
const PaywallPlansContainer = styled.div`
|
|
15
16
|
color: ${({ theme }) => theme.stigg.palette.text.primary};
|
|
@@ -93,6 +94,10 @@ export const Paywall = ({
|
|
|
93
94
|
return planPrices.length > 1 && !!paywallCalculatedPrice?.additionalChargesMayApply;
|
|
94
95
|
});
|
|
95
96
|
|
|
97
|
+
const withUnitPriceRow = plansToShow.some(plan => {
|
|
98
|
+
return !!getPlanPrice(plan, selectedBillingPeriod, paywallLocale, locale, hasMonthlyPrice).unit;
|
|
99
|
+
});
|
|
100
|
+
|
|
96
101
|
return (
|
|
97
102
|
<PaywallContainer className="stigg-paywall-container">
|
|
98
103
|
<PaywallLayout className="stigg-paywall-layout">
|
|
@@ -106,6 +111,7 @@ export const Paywall = ({
|
|
|
106
111
|
<PaywallPlansContainer className="stigg-paywall-plans-layout">
|
|
107
112
|
{plansToShow.map(plan => (
|
|
108
113
|
<PlanOffering
|
|
114
|
+
withUnitPriceRow={withUnitPriceRow}
|
|
109
115
|
key={plan.id}
|
|
110
116
|
shouldShowDescriptionSection={shouldShowDescriptionSection}
|
|
111
117
|
hasMonthlyPrice={hasMonthlyPrice}
|
|
@@ -50,6 +50,7 @@ const PriceSpan = styled(Typography)`
|
|
|
50
50
|
|
|
51
51
|
function PlanPrice({
|
|
52
52
|
showStartingAt,
|
|
53
|
+
withUnitPriceRow,
|
|
53
54
|
withStartingAtRow,
|
|
54
55
|
plan,
|
|
55
56
|
billingPeriod,
|
|
@@ -59,6 +60,7 @@ function PlanPrice({
|
|
|
59
60
|
hasAnnuallyPrice,
|
|
60
61
|
}: {
|
|
61
62
|
showStartingAt: boolean;
|
|
63
|
+
withUnitPriceRow: boolean;
|
|
62
64
|
withStartingAtRow: boolean;
|
|
63
65
|
plan: PaywallPlan;
|
|
64
66
|
billingPeriod: BillingPeriod;
|
|
@@ -85,18 +87,20 @@ function PlanPrice({
|
|
|
85
87
|
|
|
86
88
|
<PriceSpan variant="h1">{price}</PriceSpan>
|
|
87
89
|
|
|
88
|
-
{
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
{withUnitPriceRow && (
|
|
91
|
+
<Typography className="stigg-price-unit-and-billing-period-text" style={{ minHeight: '48px' }}>
|
|
92
|
+
<UnitSpan span variant="h6" color="secondary">
|
|
93
|
+
{unit}
|
|
94
|
+
</UnitSpan>
|
|
95
|
+
|
|
96
|
+
<PriceBillingPeriod
|
|
97
|
+
plan={plan}
|
|
98
|
+
billingPeriod={billingPeriod}
|
|
99
|
+
hasAnnuallyPrice={hasAnnuallyPrice}
|
|
100
|
+
hasMonthlyPrice={hasMonthlyPrice}
|
|
101
|
+
/>
|
|
102
|
+
</Typography>
|
|
92
103
|
)}
|
|
93
|
-
|
|
94
|
-
<PriceBillingPeriod
|
|
95
|
-
plan={plan}
|
|
96
|
-
billingPeriod={billingPeriod}
|
|
97
|
-
hasAnnuallyPrice={hasAnnuallyPrice}
|
|
98
|
-
hasMonthlyPrice={hasMonthlyPrice}
|
|
99
|
-
/>
|
|
100
104
|
</>
|
|
101
105
|
</PlanPriceContainer>
|
|
102
106
|
);
|
|
@@ -156,6 +160,7 @@ const HeaderWrapper = styled.div`
|
|
|
156
160
|
`;
|
|
157
161
|
|
|
158
162
|
type PlanOfferingProps = {
|
|
163
|
+
withUnitPriceRow: boolean;
|
|
159
164
|
customer: Customer | null;
|
|
160
165
|
plan: PaywallPlan;
|
|
161
166
|
billingPeriod: BillingPeriod;
|
|
@@ -203,6 +208,7 @@ function UpcomingChangeTag({ text = 'Next', iconsColor }: { text?: string; icons
|
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
export function PlanOffering({
|
|
211
|
+
withUnitPriceRow,
|
|
206
212
|
customer,
|
|
207
213
|
plan,
|
|
208
214
|
billingPeriod,
|
|
@@ -260,6 +266,7 @@ export function PlanOffering({
|
|
|
260
266
|
|
|
261
267
|
<PlanPrice
|
|
262
268
|
showStartingAt={showStartingAt}
|
|
269
|
+
withUnitPriceRow={!!withUnitPriceRow}
|
|
263
270
|
withStartingAtRow={!!withStartingAtRow}
|
|
264
271
|
plan={plan}
|
|
265
272
|
billingPeriod={billingPeriod}
|