@graphcommerce/magento-product 4.4.7 → 4.4.10

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,35 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.4.10
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 [[`d140fca34`](https://github.com/graphcommerce-org/graphcommerce/commit/d140fca3463b73e761e23fd1d9216305727f0c1a), [`9ec0338df`](https://github.com/graphcommerce-org/graphcommerce/commit/9ec0338dfe34d37b0f2c24e36ffa6ed13ea1145e), [`735b78672`](https://github.com/graphcommerce-org/graphcommerce/commit/735b786724d5401cbe6e88f2515e121a1a0945b2)]:
10
+ - @graphcommerce/magento-cart@4.4.6
11
+ - @graphcommerce/next-ui@4.11.0
12
+ - @graphcommerce/magento-store@4.2.12
13
+ - @graphcommerce/graphql@3.3.0
14
+ - @graphcommerce/framer-scroller@2.1.18
15
+
16
+ ## 4.4.9
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies []:
21
+ - @graphcommerce/magento-cart@4.4.5
22
+
23
+ ## 4.4.8
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [[`371e6cf52`](https://github.com/graphcommerce-org/graphcommerce/commit/371e6cf52916a3b6c44192bd40cc8271bd608832), [`4143483f3`](https://github.com/graphcommerce-org/graphcommerce/commit/4143483f37c038d2bbf218be2685e27a31a35745)]:
28
+ - @graphcommerce/next-ui@4.10.0
29
+ - @graphcommerce/magento-cart@4.4.4
30
+ - @graphcommerce/framer-scroller@2.1.17
31
+ - @graphcommerce/magento-store@4.2.11
32
+
3
33
  ## 4.4.7
4
34
 
5
35
  ### Patch Changes
@@ -1,10 +1,9 @@
1
1
  import { Image, ImageProps } from '@graphcommerce/image'
2
- import { responsiveVal, extendableComponent } from '@graphcommerce/next-ui'
2
+ import { responsiveVal, extendableComponent, useNumberFormat } from '@graphcommerce/next-ui'
3
3
  import { Trans } from '@lingui/react'
4
4
  import { ButtonBase, Typography, Box, styled, SxProps, Theme } from '@mui/material'
5
5
  import PageLink from 'next/link'
6
- import { useRouter } from 'next/router'
7
- import React, { PropsWithChildren, useMemo } from 'react'
6
+ import React, { PropsWithChildren } from 'react'
8
7
  import { ProductListItemFragment } from '../../Api/ProductListItem.gql'
9
8
  import { useProductLink } from '../../hooks/useProductLink'
10
9
  import { ProductListPrice } from '../ProductListPrice/ProductListPrice'
@@ -72,12 +71,8 @@ export function ProductListItem(props: ProductListItemProps) {
72
71
 
73
72
  const productLink = useProductLink(props)
74
73
  const discount = Math.floor(price_range.minimum_price.discount?.percent_off ?? 0)
75
- const { locale } = useRouter()
76
74
 
77
- const formatter = useMemo(
78
- () => new Intl.NumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 }),
79
- [locale],
80
- )
75
+ const formatter = useNumberFormat({ style: 'percent', maximumFractionDigits: 1 })
81
76
 
82
77
  return (
83
78
  <PageLink href={productLink} passHref>
@@ -1,25 +1,14 @@
1
1
  import { useQuery } from '@graphcommerce/graphql'
2
2
  import { StoreConfigDocument } from '@graphcommerce/magento-store'
3
- import { useMemo } from 'react'
3
+ import { useNumberFormat } from '@graphcommerce/next-ui'
4
4
  import { ProductWeightFragment } from './ProductWeight.gql'
5
5
 
6
6
  export function ProductWeight(props: ProductWeightFragment) {
7
7
  const { weight } = props
8
8
  const { data: conf } = useQuery(StoreConfigDocument)
9
9
  const unit = conf?.storeConfig?.weight_unit ?? ''
10
- const locale = conf?.storeConfig?.locale
11
10
 
12
- const numberFormatter = useMemo(() => {
13
- if (!locale) return undefined
14
- /**
15
- * Todo: upgrade to browser native unit rendering when:
16
- *
17
- * - Node 14 is supported upstream
18
- * - Webkit/Safari supports the unit and unitDisplay option
19
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat#Using_style_and_unit
20
- */
21
- return new Intl.NumberFormat(locale.replace('_', '-'))
22
- }, [locale])
11
+ const numberFormatter = useNumberFormat()
23
12
 
24
13
  if (!numberFormatter || !weight) return null
25
14
  return (
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-product",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.4.7",
5
+ "version": "4.4.10",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,13 +19,13 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/framer-scroller": "2.1.16",
23
- "@graphcommerce/graphql": "3.2.1",
22
+ "@graphcommerce/framer-scroller": "2.1.18",
23
+ "@graphcommerce/graphql": "3.3.0",
24
24
  "@graphcommerce/graphql-mesh": "4.1.4",
25
25
  "@graphcommerce/image": "3.1.7",
26
- "@graphcommerce/magento-cart": "4.4.3",
27
- "@graphcommerce/magento-store": "4.2.10",
28
- "@graphcommerce/next-ui": "4.9.0",
26
+ "@graphcommerce/magento-cart": "4.4.6",
27
+ "@graphcommerce/magento-store": "4.2.12",
28
+ "@graphcommerce/next-ui": "4.11.0",
29
29
  "schema-dts": "^1.1.0"
30
30
  },
31
31
  "peerDependencies": {