@graphcommerce/next-ui 8.0.0-canary.77 → 8.0.0-canary.79
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 +14 -0
- package/PageMeta/PageMeta.tsx +19 -12
- package/hooks/useDateTimeFormat.ts +3 -5
- package/hooks/useNumberFormat.ts +3 -5
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 8.0.0-canary.79
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2137](https://github.com/graphcommerce-org/graphcommerce/pull/2137) [`df507b1`](https://github.com/graphcommerce-org/graphcommerce/commit/df507b194c67eef7b02df858c07938bb308b5397) - Don't render pseudo-locale in HTML lang attribute
|
|
8
|
+
([@hnsr](https://github.com/hnsr))
|
|
9
|
+
|
|
10
|
+
## 8.0.0-canary.78
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#2135](https://github.com/graphcommerce-org/graphcommerce/pull/2135) [`7b017f5`](https://github.com/graphcommerce-org/graphcommerce/commit/7b017f58ba3be587d20a7f52c84b2907d52fe201) - Fix incorrect canonical URLs when i18n domain routing is used
|
|
15
|
+
([@hnsr](https://github.com/hnsr))
|
|
16
|
+
|
|
3
17
|
## 8.0.0-canary.77
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/PageMeta/PageMeta.tsx
CHANGED
|
@@ -60,18 +60,25 @@ export function canonicalize(router: PartialNextRouter, incoming?: Canonical) {
|
|
|
60
60
|
const curLocale = router.locale
|
|
61
61
|
|
|
62
62
|
// Copied from here https://github.com/vercel/next.js/blob/213c42f446874d29d07fa2cca6e6b11fc9c3b711/packages/next/client/link.tsx#L512
|
|
63
|
-
const localeDomain =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
const localeDomain = getDomainLocale(
|
|
64
|
+
as,
|
|
65
|
+
curLocale,
|
|
66
|
+
router && router.locales,
|
|
67
|
+
router.domainLocales,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
if (localeDomain) {
|
|
71
|
+
canonical = localeDomain
|
|
72
|
+
} else {
|
|
73
|
+
href = addBasePath(addLocale(as, curLocale, router.defaultLocale))
|
|
74
|
+
|
|
75
|
+
let siteUrl =
|
|
76
|
+
storefrontConfig(router.locale)?.canonicalBaseUrl ||
|
|
77
|
+
import.meta.graphCommerce.canonicalBaseUrl
|
|
78
|
+
if (siteUrl.endsWith('/')) siteUrl = siteUrl.slice(0, -1)
|
|
79
|
+
|
|
80
|
+
canonical = `${siteUrl}${href}`
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
if (!canonical.startsWith('http')) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeLocale } from '@graphcommerce/lingui-next'
|
|
1
2
|
import { useRouter } from 'next/router'
|
|
2
3
|
import { useMemo } from 'react'
|
|
3
4
|
|
|
@@ -6,12 +7,9 @@ export type DateTimeFormatProps = Intl.DateTimeFormatOptions
|
|
|
6
7
|
export function useDateTimeFormat(props?: DateTimeFormatProps) {
|
|
7
8
|
const { locale } = useRouter()
|
|
8
9
|
|
|
9
|
-
// Remove optional dialect from locale, which Intl.NumberFormat does not support.
|
|
10
|
-
const strippedLocale = locale?.split('-', 2).join('-')
|
|
11
|
-
|
|
12
10
|
const formatter = useMemo(
|
|
13
|
-
() => new Intl.DateTimeFormat(
|
|
14
|
-
[
|
|
11
|
+
() => new Intl.DateTimeFormat(normalizeLocale(locale), props),
|
|
12
|
+
[locale, props],
|
|
15
13
|
)
|
|
16
14
|
return formatter
|
|
17
15
|
}
|
package/hooks/useNumberFormat.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeLocale } from '@graphcommerce/lingui-next'
|
|
1
2
|
import { useRouter } from 'next/router'
|
|
2
3
|
import { useMemo } from 'react'
|
|
3
4
|
|
|
@@ -6,12 +7,9 @@ export type NumberFormatProps = Intl.NumberFormatOptions
|
|
|
6
7
|
export function useNumberFormat(props?: NumberFormatProps) {
|
|
7
8
|
const { locale } = useRouter()
|
|
8
9
|
|
|
9
|
-
// Remove optional dialect from locale, which Intl.NumberFormat does not support.
|
|
10
|
-
const strippedLocale = locale?.split('-', 2).join('-')
|
|
11
|
-
|
|
12
10
|
const formatter = useMemo(
|
|
13
|
-
() => new Intl.NumberFormat(
|
|
14
|
-
[
|
|
11
|
+
() => new Intl.NumberFormat(normalizeLocale(locale), props),
|
|
12
|
+
[locale, props],
|
|
15
13
|
)
|
|
16
14
|
return formatter
|
|
17
15
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/next-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "8.0.0-canary.
|
|
5
|
+
"version": "8.0.0-canary.79",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -26,13 +26,14 @@
|
|
|
26
26
|
"typescript": "5.3.3"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@graphcommerce/eslint-config-pwa": "^8.0.0-canary.
|
|
30
|
-
"@graphcommerce/framer-next-pages": "^8.0.0-canary.
|
|
31
|
-
"@graphcommerce/framer-scroller": "^8.0.0-canary.
|
|
32
|
-
"@graphcommerce/framer-utils": "^8.0.0-canary.
|
|
33
|
-
"@graphcommerce/image": "^8.0.0-canary.
|
|
34
|
-
"@graphcommerce/
|
|
35
|
-
"@graphcommerce/
|
|
29
|
+
"@graphcommerce/eslint-config-pwa": "^8.0.0-canary.79",
|
|
30
|
+
"@graphcommerce/framer-next-pages": "^8.0.0-canary.79",
|
|
31
|
+
"@graphcommerce/framer-scroller": "^8.0.0-canary.79",
|
|
32
|
+
"@graphcommerce/framer-utils": "^8.0.0-canary.79",
|
|
33
|
+
"@graphcommerce/image": "^8.0.0-canary.79",
|
|
34
|
+
"@graphcommerce/lingui-next": "^8.0.0-canary.79",
|
|
35
|
+
"@graphcommerce/prettier-config-pwa": "^8.0.0-canary.79",
|
|
36
|
+
"@graphcommerce/typescript-config-pwa": "^8.0.0-canary.79",
|
|
36
37
|
"@lingui/core": "^4.2.1",
|
|
37
38
|
"@lingui/macro": "^4.2.1",
|
|
38
39
|
"@lingui/react": "^4.2.1",
|