@graphcommerce/magento-review 3.2.17 → 3.2.20

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,38 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.2.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`fe4baa42d`](https://github.com/graphcommerce-org/graphcommerce/commit/fe4baa42db0081ed960d62aef688bd36a7ac974f)]:
8
+ - @graphcommerce/magento-customer@4.6.3
9
+ - @graphcommerce/next-ui@4.11.2
10
+ - @graphcommerce/magento-product@4.4.12
11
+ - @graphcommerce/magento-store@4.2.14
12
+
13
+ ## 3.2.19
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`11bca2d2f`](https://github.com/graphcommerce-org/graphcommerce/commit/11bca2d2f7dbb7c5e2827c04eb0db43d4099f2fd)]:
18
+ - @graphcommerce/next-ui@4.11.1
19
+ - @graphcommerce/magento-customer@4.6.2
20
+ - @graphcommerce/magento-product@4.4.11
21
+ - @graphcommerce/magento-store@4.2.13
22
+
23
+ ## 3.2.18
24
+
25
+ ### Patch Changes
26
+
27
+ - [#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.
28
+
29
+ - Updated dependencies [[`9ec0338df`](https://github.com/graphcommerce-org/graphcommerce/commit/9ec0338dfe34d37b0f2c24e36ffa6ed13ea1145e), [`735b78672`](https://github.com/graphcommerce-org/graphcommerce/commit/735b786724d5401cbe6e88f2515e121a1a0945b2)]:
30
+ - @graphcommerce/next-ui@4.11.0
31
+ - @graphcommerce/magento-product@4.4.10
32
+ - @graphcommerce/magento-store@4.2.12
33
+ - @graphcommerce/graphql@3.3.0
34
+ - @graphcommerce/magento-customer@4.6.1
35
+
3
36
  ## 3.2.17
4
37
 
5
38
  ### Patch Changes
@@ -1,9 +1,6 @@
1
- import { useQuery } from '@graphcommerce/graphql'
2
1
  import { Image } from '@graphcommerce/image'
3
- import { StoreConfigDocument } from '@graphcommerce/magento-store'
4
- import { responsiveVal, extendableComponent } from '@graphcommerce/next-ui'
2
+ import { responsiveVal, extendableComponent, useDateTimeFormat } from '@graphcommerce/next-ui'
5
3
  import { Box, SxProps, Theme } from '@mui/material'
6
- import { useMemo } from 'react'
7
4
  import { CustomerReviewFragment } from './CustomerReview.gql'
8
5
  import filledStar from './review_star_filled.svg'
9
6
  import outlinedStar from './review_star_outlined.svg'
@@ -27,13 +24,7 @@ export function CustomerReview(props: CustomerReviewProps) {
27
24
  const valuePerStar = maxAverageRating / totalStars
28
25
  const totalFilledStars = (average_rating / maxAverageRating / valuePerStar) * 100
29
26
 
30
- const { data: config } = useQuery(StoreConfigDocument)
31
- const locale = config?.storeConfig?.locale?.replace('_', '-')
32
-
33
- const dateFormatter = useMemo(
34
- () => new Intl.DateTimeFormat(locale, { year: 'numeric', month: 'long', day: 'numeric' }),
35
- [locale],
36
- )
27
+ const dateFormatter = useDateTimeFormat({ year: 'numeric', month: 'long', day: 'numeric' })
37
28
 
38
29
  return (
39
30
  <Box
@@ -4,6 +4,7 @@ import {
4
4
  responsiveVal,
5
5
  StarRatingField,
6
6
  extendableComponent,
7
+ useDateTimeFormat,
7
8
  } from '@graphcommerce/next-ui'
8
9
  import { Trans } from '@lingui/react'
9
10
  import { Typography, Button, Box, SxProps, Theme, Link } from '@mui/material'
@@ -34,8 +35,6 @@ const { classes } = extendableComponent(name, parts)
34
35
 
35
36
  export function ProductReviews(props: ProductReviewsProps) {
36
37
  const { reviews, url_key, sx = [] } = props
37
- const config = 'en_US'
38
- const locale = config.replace('_', '-')
39
38
  const router = useRouter()
40
39
 
41
40
  const [reviewPage, setPage] = useState<number>(1)
@@ -53,7 +52,7 @@ export function ProductReviews(props: ProductReviewsProps) {
53
52
 
54
53
  const { current_page, total_pages } = myReviews.page_info
55
54
 
56
- const formatter = new Intl.DateTimeFormat(locale, {
55
+ const formatter = useDateTimeFormat({
57
56
  year: 'numeric',
58
57
  month: 'long',
59
58
  day: 'numeric',
package/next-env.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/types/global" />
3
+ /// <reference types="next/image-types/global" />
4
+ /// <reference types="@graphcommerce/next-ui/types" />
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-review",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "3.2.17",
5
+ "version": "3.2.20",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -18,13 +18,13 @@
18
18
  "@playwright/test": "^1.21.1"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/graphql": "3.2.1",
21
+ "@graphcommerce/graphql": "3.3.0",
22
22
  "@graphcommerce/graphql-mesh": "4.1.4",
23
23
  "@graphcommerce/image": "3.1.7",
24
- "@graphcommerce/magento-customer": "4.6.0",
25
- "@graphcommerce/magento-product": "4.4.9",
26
- "@graphcommerce/magento-store": "4.2.11",
27
- "@graphcommerce/next-ui": "4.10.0",
24
+ "@graphcommerce/magento-customer": "4.6.3",
25
+ "@graphcommerce/magento-product": "4.4.12",
26
+ "@graphcommerce/magento-store": "4.2.14",
27
+ "@graphcommerce/next-ui": "4.11.2",
28
28
  "@graphcommerce/react-hook-form": "3.2.2",
29
29
  "schema-dts": "^1.1.0"
30
30
  },