@stigg/react-sdk 5.23.0 → 5.23.1

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.23.0",
2
+ "version": "5.23.1",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -7,6 +7,7 @@ import { map } from 'lodash';
7
7
  import React from 'react';
8
8
  import { Typography } from './Typography';
9
9
  import { TiersSelectContainerProps } from './TiersSelectContainer';
10
+ import { formatNumber } from '../utils/formatNumber';
10
11
 
11
12
  const TierSelect = styled(Select)`
12
13
  border-radius: 10px;
@@ -62,7 +63,7 @@ export function VolumeBulkSelect({
62
63
  {map(tiers, (tier: PriceTierFragment) => (
63
64
  <MenuItem className="stigg-price-tier-menu-item-text" key={tier.upTo} value={tier.upTo?.toString()}>
64
65
  <Typography variant="body1" color="primary" style={{ lineHeight: 'unset' }}>
65
- {tier.upTo} {tierUnits}
66
+ {formatNumber(tier.upTo)} {tierUnits}
66
67
  </Typography>
67
68
  </MenuItem>
68
69
  ))}
@@ -3,6 +3,7 @@ import styled from '@emotion/styled/macro';
3
3
  import { EntitlementResetPeriod } from '@stigg/js-client-sdk';
4
4
  import CheckUrl from '../../assets/check-stigg.svg';
5
5
  import { calculateUnitQuantityText } from './utils/calculateUnitQuantityText';
6
+ import { formatNumber } from '../utils/formatNumber';
6
7
  import { Typography } from '../common/Typography';
7
8
 
8
9
  const EntitlementName = styled(Typography)`
@@ -29,12 +30,6 @@ const EntitlementCheckIcon = styled(CheckUrl)`
29
30
  }
30
31
  `;
31
32
 
32
- function formatUsageNumber(usageLimit: number) {
33
- return usageLimit.toLocaleString('en-US', {
34
- maximumFractionDigits: 0,
35
- });
36
- }
37
-
38
33
  type EntitlementRowProps = {
39
34
  hasUnlimitedUsage?: boolean | null;
40
35
  isCustom?: boolean | null;
@@ -100,7 +95,7 @@ function getEntitlementDisplay({
100
95
 
101
96
  if (usageLimit) {
102
97
  const featureUnits = usageLimit === 1 ? feature?.units : feature?.unitsPlural;
103
- return `${formatUsageNumber(usageLimit)} ${featureUnits} ${resetPeriodSuffix}`;
98
+ return `${formatNumber(usageLimit)} ${featureUnits} ${resetPeriodSuffix}`;
104
99
  }
105
100
 
106
101
  if (unitBasedEntitlement) {
@@ -0,0 +1,5 @@
1
+ export function formatNumber(usageLimit: number | null | undefined) {
2
+ return usageLimit?.toLocaleString('en-US', {
3
+ maximumFractionDigits: 0,
4
+ });
5
+ }