@stigg/react-sdk 4.6.0 → 4.7.0
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/react-sdk.cjs.development.js +41 -22
- 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 +47 -26
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/paywall/EntitlementRow.tsx +25 -7
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import CheckUrl from '../../assets/check-stigg.svg';
|
|
3
2
|
import styled from '@emotion/styled/macro';
|
|
4
|
-
import { calculateUnitQuantityText } from './utils/calculateUnitQuantityText';
|
|
5
3
|
import { EntitlementResetPeriod } from '@stigg/js-client-sdk';
|
|
4
|
+
import CheckUrl from '../../assets/check-stigg.svg';
|
|
5
|
+
import { calculateUnitQuantityText } from './utils/calculateUnitQuantityText';
|
|
6
6
|
import { Typography } from '../common/Typography';
|
|
7
7
|
|
|
8
8
|
const EntitlementName = styled(Typography)`
|
|
@@ -10,12 +10,19 @@ const EntitlementName = styled(Typography)`
|
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
12
|
const EntitlementRowContainer = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: baseline;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const EntitlementIconContainer = styled.div`
|
|
13
18
|
display: flex;
|
|
14
19
|
align-items: center;
|
|
20
|
+
margin-right: 16px;
|
|
21
|
+
height: ${({ theme }) => theme.stigg.typography.h3.fontSize};
|
|
22
|
+
flex-shrink: 0;
|
|
15
23
|
`;
|
|
16
24
|
|
|
17
25
|
const EntitlementCheckIcon = styled(CheckUrl)`
|
|
18
|
-
margin-right: 16px;
|
|
19
26
|
flex-shrink: 0;
|
|
20
27
|
* {
|
|
21
28
|
fill: ${({ theme }) => theme.stigg.palette.text.disabled};
|
|
@@ -62,6 +69,9 @@ function getResetPeriodText(resetPeriod?: EntitlementResetPeriod) {
|
|
|
62
69
|
case EntitlementResetPeriod.Month: {
|
|
63
70
|
return 'per month';
|
|
64
71
|
}
|
|
72
|
+
default: {
|
|
73
|
+
return '';
|
|
74
|
+
}
|
|
65
75
|
}
|
|
66
76
|
}
|
|
67
77
|
|
|
@@ -79,12 +89,18 @@ function getEntitlementDisplay({
|
|
|
79
89
|
|
|
80
90
|
if (hasUnlimitedUsage) {
|
|
81
91
|
return `Unlimited ${feature?.unitsPlural}`;
|
|
82
|
-
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (isCustom) {
|
|
83
95
|
return `Custom ${feature?.unitsPlural}`;
|
|
84
|
-
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (usageLimit) {
|
|
85
99
|
const featureUnits = usageLimit === 1 ? feature?.units : feature?.unitsPlural;
|
|
86
100
|
return `${formatUsageNumber(usageLimit)} ${featureUnits} ${resetPeriodSuffix}`;
|
|
87
|
-
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (unitBasedEntitlement) {
|
|
88
104
|
return calculateUnitQuantityText(minUnitQuantity, maxUnitQuantity, feature?.unitsPlural);
|
|
89
105
|
}
|
|
90
106
|
|
|
@@ -97,7 +113,9 @@ export function EntitlementRow(props: EntitlementRowProps) {
|
|
|
97
113
|
|
|
98
114
|
return (
|
|
99
115
|
<EntitlementRowContainer className="stigg-entitlement-row-container">
|
|
100
|
-
<
|
|
116
|
+
<EntitlementIconContainer>
|
|
117
|
+
<EntitlementCheckIcon className="stigg-entitlement-row-icon" />
|
|
118
|
+
</EntitlementIconContainer>
|
|
101
119
|
<EntitlementName className="stigg-entitlement-name" variant="h6" color="secondary">
|
|
102
120
|
{displayNameOverride || displayName}
|
|
103
121
|
</EntitlementName>
|