@graphcommerce/magento-store 4.2.9 → 4.2.12

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 CHANGED
@@ -1,5 +1,34 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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.
8
+
9
+ - Updated dependencies [[`9ec0338df`](https://github.com/graphcommerce-org/graphcommerce/commit/9ec0338dfe34d37b0f2c24e36ffa6ed13ea1145e), [`735b78672`](https://github.com/graphcommerce-org/graphcommerce/commit/735b786724d5401cbe6e88f2515e121a1a0945b2)]:
10
+ - @graphcommerce/next-ui@4.11.0
11
+ - @graphcommerce/graphql@3.3.0
12
+
13
+ ## 4.2.11
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`371e6cf52`](https://github.com/graphcommerce-org/graphcommerce/commit/371e6cf52916a3b6c44192bd40cc8271bd608832), [`4143483f3`](https://github.com/graphcommerce-org/graphcommerce/commit/4143483f37c038d2bbf218be2685e27a31a35745)]:
18
+ - @graphcommerce/next-ui@4.10.0
19
+
20
+ ## 4.2.10
21
+
22
+ ### Patch Changes
23
+
24
+ - [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
25
+
26
+ - Updated dependencies [[`a9213f1f5`](https://github.com/graphcommerce-org/graphcommerce/commit/a9213f1f5a410d217768386ccb6d9b5ce7bd5782), [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb)]:
27
+ - @graphcommerce/next-ui@4.9.0
28
+ - @graphcommerce/graphql@3.2.1
29
+ - @graphcommerce/graphql-mesh@4.1.4
30
+ - @graphcommerce/image@3.1.7
31
+
3
32
  ## 4.2.9
4
33
 
5
34
  ### 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 numberFormatter = useMemo(() => {
36
- if (!locale) return undefined
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
- }, [config?.storeConfig?.base_currency_code, currency, digits, formatOptions, locale, round])
42
+ }),
43
+ [config?.storeConfig?.base_currency_code, currency, digits, formatOptions, round],
44
+ )
45
+ const numberFormatter = useNumberFormat(options)
47
46
 
48
- if (!numberFormatter || !value) return null
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.9",
5
+ "version": "4.2.12",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,24 +12,24 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^4.1.7",
15
+ "@graphcommerce/eslint-config-pwa": "^4.1.8",
16
16
  "@graphcommerce/prettier-config-pwa": "^4.0.6",
17
17
  "@graphcommerce/typescript-config-pwa": "^4.0.3",
18
18
  "@playwright/test": "^1.21.1",
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/graphql": "3.2.0",
23
- "@graphcommerce/graphql-mesh": "4.1.3",
24
- "@graphcommerce/image": "3.1.6",
25
- "@graphcommerce/next-ui": "4.8.4"
22
+ "@graphcommerce/graphql": "3.3.0",
23
+ "@graphcommerce/graphql-mesh": "4.1.4",
24
+ "@graphcommerce/image": "3.1.7",
25
+ "@graphcommerce/next-ui": "4.11.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@lingui/react": "^3.13.2",
29
29
  "@lingui/core": "^3.13.2",
30
30
  "@mui/material": "5.5.3",
31
- "next": "12.1.2",
32
- "react": "^17.0.2",
33
- "react-dom": "^17.0.2"
31
+ "next": "^12.1.2",
32
+ "react": "^18.0.0",
33
+ "react-dom": "^18.0.0"
34
34
  }
35
35
  }