@graphcommerce/magento-store 9.1.0-canary.40 → 9.1.0-canary.42
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/CHANGELOG.md +8 -0
- package/components/Money/Money.tsx +14 -2
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.1.0-canary.42
|
|
4
|
+
|
|
5
|
+
## 9.1.0-canary.41
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- [#2530](https://github.com/graphcommerce-org/graphcommerce/pull/2530) [`2075f33`](https://github.com/graphcommerce-org/graphcommerce/commit/2075f331eec38e894722d8ba4539d865f2db5507) - Support asNumber for Money component to easily render all prices as number ([@paales](https://github.com/paales))
|
|
10
|
+
|
|
3
11
|
## 9.1.0-canary.40
|
|
4
12
|
|
|
5
13
|
## 9.1.0-canary.39
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { format } from 'path'
|
|
1
2
|
import { useQuery } from '@graphcommerce/graphql'
|
|
2
3
|
import type { CurrencyFormatProps } from '@graphcommerce/next-ui'
|
|
3
|
-
import { CurrencyFormat } from '@graphcommerce/next-ui'
|
|
4
|
+
import { CurrencyFormat, NumberFormat } from '@graphcommerce/next-ui'
|
|
4
5
|
import type { SxProps, Theme } from '@mui/material'
|
|
5
6
|
import type { MoneyFragment } from '../../graphql'
|
|
6
7
|
import { StoreConfigDocument } from '../../graphql'
|
|
@@ -9,12 +10,13 @@ type OverridableProps = {
|
|
|
9
10
|
round?: boolean
|
|
10
11
|
formatOptions?: Omit<CurrencyFormatProps, 'currency'>
|
|
11
12
|
sx?: SxProps<Theme>
|
|
13
|
+
asNumber?: boolean
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export type MoneyProps = MoneyFragment & OverridableProps
|
|
15
17
|
|
|
16
18
|
export function Money(props: MoneyProps) {
|
|
17
|
-
const { currency, value, round = false, formatOptions,
|
|
19
|
+
const { currency, value, round = false, sx, formatOptions, asNumber } = props
|
|
18
20
|
const baseCurrencyCode =
|
|
19
21
|
useQuery(StoreConfigDocument).data?.storeConfig?.default_display_currency_code
|
|
20
22
|
const digits = (value ?? 0) % 1 !== 0
|
|
@@ -23,6 +25,16 @@ export function Money(props: MoneyProps) {
|
|
|
23
25
|
|
|
24
26
|
if (typeof value === 'undefined' || value === null) return null
|
|
25
27
|
|
|
28
|
+
if (asNumber)
|
|
29
|
+
return (
|
|
30
|
+
<NumberFormat
|
|
31
|
+
minimumFractionDigits={2}
|
|
32
|
+
maximumFractionDigits={maximumFractionDigits}
|
|
33
|
+
value={value}
|
|
34
|
+
{...formatOptions}
|
|
35
|
+
numberStyle='decimal'
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
26
38
|
return (
|
|
27
39
|
<CurrencyFormat
|
|
28
40
|
currency={currencyCode}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-store",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.1.0-canary.
|
|
5
|
+
"version": "9.1.0-canary.42",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/ecommerce-ui": "^9.1.0-canary.
|
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.
|
|
17
|
-
"@graphcommerce/framer-utils": "^9.1.0-canary.
|
|
18
|
-
"@graphcommerce/graphql": "^9.1.0-canary.
|
|
19
|
-
"@graphcommerce/graphql-mesh": "^9.1.0-canary.
|
|
20
|
-
"@graphcommerce/image": "^9.1.0-canary.
|
|
21
|
-
"@graphcommerce/next-ui": "^9.1.0-canary.
|
|
22
|
-
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.
|
|
23
|
-
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.
|
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.1.0-canary.42",
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.42",
|
|
17
|
+
"@graphcommerce/framer-utils": "^9.1.0-canary.42",
|
|
18
|
+
"@graphcommerce/graphql": "^9.1.0-canary.42",
|
|
19
|
+
"@graphcommerce/graphql-mesh": "^9.1.0-canary.42",
|
|
20
|
+
"@graphcommerce/image": "^9.1.0-canary.42",
|
|
21
|
+
"@graphcommerce/next-ui": "^9.1.0-canary.42",
|
|
22
|
+
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.42",
|
|
23
|
+
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.42",
|
|
24
24
|
"@lingui/core": "^4.2.1",
|
|
25
25
|
"@lingui/macro": "^4.2.1",
|
|
26
26
|
"@lingui/react": "^4.2.1",
|