@graphcommerce/magento-store 4.2.11 → 4.2.14
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 +24 -0
- package/Money.tsx +8 -9
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.2.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`fe4baa42d`](https://github.com/graphcommerce-org/graphcommerce/commit/fe4baa42db0081ed960d62aef688bd36a7ac974f)]:
|
|
8
|
+
- @graphcommerce/next-ui@4.11.2
|
|
9
|
+
|
|
10
|
+
## 4.2.13
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`11bca2d2f`](https://github.com/graphcommerce-org/graphcommerce/commit/11bca2d2f7dbb7c5e2827c04eb0db43d4099f2fd)]:
|
|
15
|
+
- @graphcommerce/next-ui@4.11.1
|
|
16
|
+
|
|
17
|
+
## 4.2.12
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#1524](https://github.com/graphcommerce-org/graphcommerce/pull/1524) [`9ec0338df`](https://github.com/graphcommerce-org/graphcommerce/commit/9ec0338dfe34d37b0f2c24e36ffa6ed13ea1145e) Thanks [@paales](https://github.com/paales)! - feat: Added useDateTimeFormat and useNumberFormat which automatically use the locales from nextjs.
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`9ec0338df`](https://github.com/graphcommerce-org/graphcommerce/commit/9ec0338dfe34d37b0f2c24e36ffa6ed13ea1145e), [`735b78672`](https://github.com/graphcommerce-org/graphcommerce/commit/735b786724d5401cbe6e88f2515e121a1a0945b2)]:
|
|
24
|
+
- @graphcommerce/next-ui@4.11.0
|
|
25
|
+
- @graphcommerce/graphql@3.3.0
|
|
26
|
+
|
|
3
27
|
## 4.2.11
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/Money.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery } from '@graphcommerce/graphql'
|
|
2
|
-
import { ExtendableComponent } from '@graphcommerce/next-ui'
|
|
2
|
+
import { ExtendableComponent, useNumberFormat } from '@graphcommerce/next-ui'
|
|
3
3
|
import { useThemeProps } from '@mui/material'
|
|
4
4
|
import { useMemo } from 'react'
|
|
5
5
|
import { MoneyFragment } from './Money.gql'
|
|
@@ -28,24 +28,23 @@ export function Money(props: MoneyProps) {
|
|
|
28
28
|
const { currency, value, round = false, formatOptions } = useThemeProps({ name, props })
|
|
29
29
|
|
|
30
30
|
const { data: config } = useQuery(StoreConfigDocument)
|
|
31
|
-
const locale = config?.storeConfig?.locale
|
|
32
31
|
|
|
33
32
|
const digits = (value ?? 0) % 1 !== 0
|
|
34
33
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return new Intl.NumberFormat(locale.replace('_', '-'), {
|
|
34
|
+
const options: Intl.NumberFormatOptions = useMemo(
|
|
35
|
+
() => ({
|
|
39
36
|
style: 'currency',
|
|
40
37
|
currency: currency ?? config?.storeConfig?.base_currency_code ?? '',
|
|
41
38
|
...(round && !digits && { minimumFractionDigits: 0 }),
|
|
42
39
|
...(round && digits && { minimumFractionDigits: 2 }),
|
|
43
40
|
...(!round && { minimumFractionDigits: 2 }),
|
|
44
41
|
...formatOptions,
|
|
45
|
-
})
|
|
46
|
-
|
|
42
|
+
}),
|
|
43
|
+
[config?.storeConfig?.base_currency_code, currency, digits, formatOptions, round],
|
|
44
|
+
)
|
|
45
|
+
const numberFormatter = useNumberFormat(options)
|
|
47
46
|
|
|
48
|
-
if (!
|
|
47
|
+
if (!value) return null
|
|
49
48
|
|
|
50
49
|
return <>{numberFormatter.format(value)}</>
|
|
51
50
|
}
|
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": "4.2.
|
|
5
|
+
"version": "4.2.14",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"type-fest": "^2.12.2"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@graphcommerce/graphql": "3.
|
|
22
|
+
"@graphcommerce/graphql": "3.3.0",
|
|
23
23
|
"@graphcommerce/graphql-mesh": "4.1.4",
|
|
24
24
|
"@graphcommerce/image": "3.1.7",
|
|
25
|
-
"@graphcommerce/next-ui": "4.
|
|
25
|
+
"@graphcommerce/next-ui": "4.11.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@lingui/react": "^3.13.2",
|