@graphcommerce/ecommerce-ui 9.1.0-canary.55 → 10.0.0-canary.56

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,85 @@
1
1
  # @graphcommerce/ecommerce-ui
2
2
 
3
+ ## 10.0.0-canary.56
4
+
5
+ ### Major Changes
6
+
7
+ - [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
8
+
9
+ This major release brings full Turbopack compatibility, dramatically improving development speed.
10
+
11
+ ### 🚀 Turbopack-Compatible Interceptor System
12
+
13
+ The entire plugin/interceptor system has been rewritten to work with Turbopack:
14
+
15
+ - **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
16
+ - **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
17
+ - **Direct imports** - Interceptors import from `.original` files instead of embedding source
18
+ - **New CLI commands**:
19
+ - `graphcommerce codegen-interceptors` - Generate interceptor files
20
+ - `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
21
+ - **Stable file hashing** - Deterministic interceptor generation for better caching
22
+
23
+ ### ⚙️ Treeshakable Configuration System
24
+
25
+ Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
26
+
27
+ - **New `codegen-config-values` command** - Generates TypeScript files with precise typing
28
+ - **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
29
+ - **Fully treeshakable** - Unused config values are eliminated from the bundle
30
+ - **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
31
+ - **Separate files for nested objects** - Optimal treeshaking for complex configurations
32
+
33
+ ### 🔧 withGraphCommerce Changes
34
+
35
+ - **Removed** `InterceptorPlugin` - No longer needed with file-based interception
36
+ - **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
37
+ - **Removed** `@mui/*` alias rewrites - No longer required
38
+ - **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
39
+ - **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
40
+ - **Added** `optimizePackageImports` for better bundle optimization
41
+ - **Added** `images.qualities: [52, 75]` for Next.js image optimization
42
+
43
+ ### 📦 Lingui Configuration
44
+
45
+ - **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
46
+ - **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
47
+ - **Simplified** formatter options
48
+
49
+ ### ⚛️ React 19 & Next.js 16 Compatibility
50
+
51
+ - Updated `RefObject<T>` types for React 19 (now includes `null` by default)
52
+ - Replaced deprecated `React.VFC` with `React.FC`
53
+ - Fixed `useRef` calls to require explicit initial values
54
+ - Updated `MutableRefObject` usage in `framer-scroller`
55
+
56
+ ### 📋 ESLint 9 Flat Config
57
+
58
+ - Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
59
+ - Updated `@typescript-eslint/*` packages to v8
60
+ - Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
61
+
62
+ ### 🔄 Apollo Client
63
+
64
+ - Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
65
+ - Updated error handling types to accept `ApolloError | null | undefined`
66
+
67
+ ### ⚠️ Breaking Changes
68
+
69
+ - **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
70
+ - **Interceptor files changed** - Original components now at `.original.tsx`
71
+ - **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
72
+ - **ESLint config format** - Must use flat config (`eslint.config.mjs`)
73
+ - **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
74
+
75
+ ### 🗑️ Removed
76
+
77
+ - `InterceptorPlugin` webpack plugin
78
+ - `configToImportMeta` utility
79
+ - Webpack `DefinePlugin` usage for config
80
+ - `@mui/*` modern alias rewrites
81
+ - Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
82
+
3
83
  ## 9.1.0-canary.55
4
84
 
5
85
  ## 9.1.0-canary.54
@@ -7,7 +7,7 @@ import { maskNetworkError } from './maskNetworkError'
7
7
  const { classes, selectors } = extendableComponent('ApolloErrorAlert', ['root', 'alert'] as const)
8
8
 
9
9
  export type ApolloErrorAlertProps = {
10
- error?: ApolloError
10
+ error?: ApolloError | null
11
11
  graphqlErrorAlertProps?: Omit<AlertProps, 'severity'>
12
12
  networkErrorAlertProps?: Omit<AlertProps, 'severity'>
13
13
  sx?: SxProps<Theme>
@@ -1,7 +1,7 @@
1
1
  import type { ApolloError } from '@graphcommerce/graphql'
2
2
  import type { FullPageMessageProps } from '@graphcommerce/next-ui'
3
3
  import { FullPageMessage } from '@graphcommerce/next-ui'
4
- import { Trans } from '@lingui/react'
4
+ import { Trans } from '@lingui/react/macro'
5
5
  import type { AlertProps } from '@mui/material'
6
6
  import { ApolloErrorAlert } from './ApolloErrorAlert'
7
7
  import { maskNetworkError } from './maskNetworkError'
@@ -37,7 +37,7 @@ export function ApolloErrorFullPage(props: ApolloErrorFullPageProps) {
37
37
  }
38
38
 
39
39
  return (
40
- <FullPageMessage title={<Trans id='Several errors occured' />} {...fullPageMessageProps}>
40
+ <FullPageMessage title={<Trans>Several errors occured</Trans>} {...fullPageMessageProps}>
41
41
  <ApolloErrorAlert error={error} />
42
42
  </FullPageMessage>
43
43
  )
@@ -4,7 +4,7 @@ import { ErrorSnackbar } from '@graphcommerce/next-ui'
4
4
  import { maskNetworkError } from './maskNetworkError'
5
5
 
6
6
  export type ApolloErrorSnackbarProps = {
7
- error?: ApolloError
7
+ error?: ApolloError | null
8
8
  } & Pick<ErrorSnackbarProps, 'action' | 'onClose'>
9
9
 
10
10
  export function ApolloErrorSnackbar(props: ApolloErrorSnackbarProps) {
@@ -1,5 +1,5 @@
1
1
  import type { ServerError, ServerParseError } from '@graphcommerce/graphql'
2
- import { Trans } from '@lingui/react'
2
+ import { Trans } from '@lingui/react/macro'
3
3
 
4
4
  function isServerError(error: Error | ServerParseError | ServerError | null): error is ServerError {
5
5
  return 'name' in (error as ServerError)
@@ -19,12 +19,12 @@ export function maskNetworkError(networkError: Error | ServerParseError | Server
19
19
  }
20
20
 
21
21
  if (isServerParseError(networkError) || isServerError(networkError)) {
22
- return <Trans id='Something went wrong on the server, please try again later.' />
22
+ return <Trans>Something went wrong on the server, please try again later.</Trans>
23
23
  }
24
24
 
25
25
  if (globalThis.navigator && !globalThis.navigator?.onLine) {
26
- return <Trans id='It appears you are offline, please try again later.' />
26
+ return <Trans>It appears you are offline, please try again later.</Trans>
27
27
  }
28
28
 
29
- return <Trans id='Something went wrong' />
29
+ return <Trans>Something went wrong</Trans>
30
30
  }
@@ -79,7 +79,7 @@ export function ActionCardListForm<
79
79
  {...other}
80
80
  multiple={multiple}
81
81
  required={required}
82
- value={value}
82
+ value={value ?? null}
83
83
  ref={ref}
84
84
  onChange={(_, incoming) => onChange(incoming)}
85
85
  error={formState.isSubmitted && !!fieldState.error}
@@ -1,6 +1,6 @@
1
1
  import type { FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { useController } from '@graphcommerce/react-hook-form'
3
- import { i18n } from '@lingui/core'
3
+ import { t } from '@lingui/core/macro'
4
4
  import type { CheckboxProps } from '@mui/material'
5
5
  import {
6
6
  Checkbox,
@@ -61,7 +61,7 @@ function CheckboxButtonGroupBase(props: CheckboxButtonGroupProps) {
61
61
  fieldState: { invalid, error },
62
62
  } = useController({
63
63
  name,
64
- rules: required ? { required: i18n._(/* i18n */ 'This field is required') } : undefined,
64
+ rules: required ? { required: t`This field is required` } : undefined,
65
65
  control,
66
66
  defaultValue,
67
67
  shouldUnregister,
@@ -1,6 +1,6 @@
1
1
  import type { FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { useController } from '@graphcommerce/react-hook-form'
3
- import { i18n } from '@lingui/core'
3
+ import { t } from '@lingui/core/macro'
4
4
  import type {
5
5
  CheckboxProps,
6
6
  FormControlLabelProps,
@@ -32,7 +32,7 @@ type CheckboxElementComponent = <TFieldValues extends FieldValues>(
32
32
  props: CheckboxElementProps<TFieldValues>,
33
33
  ) => React.ReactNode
34
34
 
35
- function CheckboxElementBase(props: CheckboxElementProps): JSX.Element {
35
+ function CheckboxElementBase(props: CheckboxElementProps): React.ReactNode {
36
36
  const {
37
37
  name,
38
38
  rules = {},
@@ -48,7 +48,7 @@ function CheckboxElementBase(props: CheckboxElementProps): JSX.Element {
48
48
  } = props
49
49
 
50
50
  if (required && !rules.required) {
51
- rules.required = i18n._(/* i18n */ 'This field is required')
51
+ rules.required = t`This field is required`
52
52
  }
53
53
 
54
54
  const {
@@ -1,7 +1,7 @@
1
1
  import type { FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { emailPattern } from '@graphcommerce/react-hook-form'
3
- import { i18n } from '@lingui/core'
4
- import { Trans } from '@lingui/react'
3
+ import { t } from '@lingui/core/macro'
4
+ import { Trans } from '@lingui/react/macro'
5
5
  import type { TextFieldElementProps } from './TextFieldElement'
6
6
  import { TextFieldElement } from './TextFieldElement'
7
7
 
@@ -10,17 +10,17 @@ export type EmailElementProps<T extends FieldValues> = TextFieldElementProps<T>
10
10
  /** @public */
11
11
  export function EmailElement<TFieldValues extends FieldValues>(
12
12
  props: EmailElementProps<TFieldValues>,
13
- ): JSX.Element {
13
+ ): React.ReactNode {
14
14
  const { rules, ...rest } = props
15
15
  return (
16
16
  <TextFieldElement
17
17
  type='email'
18
- label={<Trans id='Email address' />}
18
+ label={<Trans>Email address</Trans>}
19
19
  autoComplete='email'
20
20
  rules={{
21
21
  pattern: {
22
22
  value: emailPattern,
23
- message: i18n._(/* i18n */ 'Please enter a valid email address'),
23
+ message: t`Please enter a valid email address`,
24
24
  },
25
25
  ...rules,
26
26
  }}
@@ -1,6 +1,6 @@
1
1
  import type { FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { useController } from '@graphcommerce/react-hook-form'
3
- import { i18n } from '@lingui/core'
3
+ import { t } from '@lingui/core/macro'
4
4
  import type { InputBaseProps } from '@mui/material'
5
5
  import { InputBase, useForkRef } from '@mui/material'
6
6
  import React from 'react'
@@ -15,7 +15,7 @@ type InputBaseElementComponent = <TFieldValues extends FieldValues>(
15
15
 
16
16
  function InputBaseElementBase(
17
17
  props: InputBaseElementProps & { ref?: React.Ref<HTMLInputElement> },
18
- ): JSX.Element {
18
+ ): React.ReactElement {
19
19
  const {
20
20
  type,
21
21
  required,
@@ -31,7 +31,7 @@ function InputBaseElementBase(
31
31
  } = props
32
32
 
33
33
  if (required && !rules.required) {
34
- rules.required = i18n._(/* i18n */ 'This field is required')
34
+ rules.required = t`This field is required`
35
35
  }
36
36
 
37
37
  const {
@@ -2,7 +2,7 @@
2
2
  import { iconClose, IconSvg } from '@graphcommerce/next-ui'
3
3
  import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
4
4
  import { useController } from '@graphcommerce/react-hook-form'
5
- import { i18n } from '@lingui/core'
5
+ import { t } from '@lingui/core/macro'
6
6
  import type { FormControlProps, SelectProps } from '@mui/material'
7
7
  import {
8
8
  Checkbox,
@@ -38,7 +38,7 @@ const ITEM_PADDING_TOP = 8
38
38
  /** @public */
39
39
  export function MultiSelectElement<TFieldValues extends FieldValues>(
40
40
  props: MultiSelectElementProps<TFieldValues>,
41
- ): JSX.Element {
41
+ ): React.ReactNode {
42
42
  const {
43
43
  options,
44
44
  label = '',
@@ -61,7 +61,7 @@ export function MultiSelectElement<TFieldValues extends FieldValues>(
61
61
  ...rest
62
62
  } = props
63
63
  if (required && !rules.required) {
64
- rules.required = i18n._(/* i18n */ 'This field is required')
64
+ rules.required = t`This field is required`
65
65
  }
66
66
 
67
67
  const {
@@ -7,7 +7,7 @@ import {
7
7
  } from '@graphcommerce/next-ui'
8
8
  import type { FieldValues } from '@graphcommerce/react-hook-form'
9
9
  import { useController } from '@graphcommerce/react-hook-form'
10
- import { i18n } from '@lingui/core'
10
+ import { t } from '@lingui/core/macro'
11
11
  import type { IconButtonProps, SxProps, TextFieldProps, Theme } from '@mui/material'
12
12
  import { Fab, TextField, useForkRef } from '@mui/material'
13
13
  import React from 'react'
@@ -70,7 +70,7 @@ function NumberFieldElementBase(props: NumberFieldElementProps) {
70
70
  }
71
71
 
72
72
  if (required && !rules.required) {
73
- rules.required = i18n._(/* i18n */ 'This field is required')
73
+ rules.required = t`This field is required`
74
74
  }
75
75
 
76
76
  const {
@@ -134,7 +134,7 @@ function NumberFieldElementBase(props: NumberFieldElementProps) {
134
134
  ...InputPropsFiltered,
135
135
  startAdornment: (
136
136
  <Fab
137
- aria-label={i18n._(/* i18n */ 'Decrease')}
137
+ aria-label={t`Decrease`}
138
138
  size='smaller'
139
139
  onClick={() => {
140
140
  if (
@@ -160,7 +160,7 @@ function NumberFieldElementBase(props: NumberFieldElementProps) {
160
160
  ),
161
161
  endAdornment: (
162
162
  <Fab
163
- aria-label={i18n._(/* i18n */ 'Increase')}
163
+ aria-label={t`Increase`}
164
164
  size='smaller'
165
165
  onClick={() => {
166
166
  if (valueAsNumber >= (inputProps.max ?? Infinity)) return
@@ -182,7 +182,7 @@ function NumberFieldElementBase(props: NumberFieldElementProps) {
182
182
  ),
183
183
  }}
184
184
  inputProps={{
185
- 'aria-label': i18n._(/* i18n */ 'Number'),
185
+ 'aria-label': t`Number`,
186
186
  ...inputProps,
187
187
  className: `${inputProps?.className ?? ''} ${classes.quantityInput}`,
188
188
  sx: {
@@ -14,7 +14,7 @@ export type PasswordElementProps<T extends FieldValues> = TextFieldElementProps<
14
14
  /** @public */
15
15
  export function PasswordElement<TFieldValues extends FieldValues>(
16
16
  props: PasswordElementProps<TFieldValues>,
17
- ): JSX.Element {
17
+ ): React.ReactNode {
18
18
  const { iconColor, ...textFieldProps } = props
19
19
  const [password, setPassword] = useState<boolean>(true)
20
20
  return (
@@ -1,6 +1,6 @@
1
1
  import type { FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { useWatch } from '@graphcommerce/react-hook-form'
3
- import { i18n } from '@lingui/core'
3
+ import { t } from '@lingui/core/macro'
4
4
  import type { PasswordElementProps } from './PasswordElement'
5
5
  import { PasswordElement } from './PasswordElement'
6
6
 
@@ -18,8 +18,7 @@ export function PasswordRepeatElement<TFieldValues extends FieldValues>({
18
18
  <PasswordElement
19
19
  {...rest}
20
20
  rules={{
21
- validate: (value: string) =>
22
- value === pwValue || i18n._(/* i18n */ "Passwords don't match"),
21
+ validate: (value: string) => value === pwValue || t`Passwords don't match`,
23
22
  }}
24
23
  />
25
24
  )
@@ -1,6 +1,6 @@
1
1
  import type { FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { useController } from '@graphcommerce/react-hook-form'
3
- import { i18n } from '@lingui/core'
3
+ import { t } from '@lingui/core/macro'
4
4
  import {
5
5
  FormControl,
6
6
  FormControlLabel,
@@ -37,7 +37,7 @@ type RadioButtonGroupComponent = <TFieldValues extends FieldValues>(
37
37
  props: RadioButtonGroupProps<TFieldValues>,
38
38
  ) => React.ReactNode
39
39
 
40
- function RadioButtonGroupBase(props: RadioButtonGroupProps): JSX.Element {
40
+ function RadioButtonGroupBase(props: RadioButtonGroupProps): React.ReactNode {
41
41
  const {
42
42
  helperText,
43
43
  options,
@@ -61,7 +61,7 @@ function RadioButtonGroupBase(props: RadioButtonGroupProps): JSX.Element {
61
61
  fieldState: { invalid, error },
62
62
  } = useController({
63
63
  name,
64
- rules: required ? { required: i18n._(/* i18n */ 'This field is required') } : undefined,
64
+ rules: required ? { required: t`This field is required` } : undefined,
65
65
  control,
66
66
  defaultValue,
67
67
  shouldUnregister,
@@ -17,7 +17,7 @@ type SelectElementComponent = <TFieldValues extends FieldValues>(
17
17
  ) => React.ReactNode
18
18
 
19
19
  /** @public */
20
- function SelectElementBase(props: SelectElementProps): JSX.Element {
20
+ function SelectElementBase(props: SelectElementProps): React.ReactNode {
21
21
  const { options } = props as AdditionalProps
22
22
  const { SelectProps } = props as TextFieldProps
23
23
 
@@ -1,6 +1,6 @@
1
1
  import type { FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { useController } from '@graphcommerce/react-hook-form'
3
- import { i18n } from '@lingui/core'
3
+ import { t } from '@lingui/core/macro'
4
4
  import type { FormControlProps, SliderProps } from '@mui/material'
5
5
  import { FormControl, FormHelperText, FormLabel, Slider } from '@mui/material'
6
6
  import React from 'react'
@@ -22,7 +22,7 @@ type SliderElementComponent = <TFieldValues extends FieldValues>(
22
22
  props: SliderElementProps<TFieldValues>,
23
23
  ) => React.ReactNode
24
24
 
25
- function SliderElementBase(props: SliderElementProps): JSX.Element {
25
+ function SliderElementBase(props: SliderElementProps): React.ReactNode {
26
26
  const {
27
27
  name,
28
28
  control,
@@ -37,7 +37,7 @@ function SliderElementBase(props: SliderElementProps): JSX.Element {
37
37
  } = props
38
38
 
39
39
  if (required && !rules.required) {
40
- rules.required = i18n._(/* i18n */ 'This field is required')
40
+ rules.required = t`This field is required`
41
41
  }
42
42
 
43
43
  const {
@@ -17,7 +17,7 @@ type SwitchElementComponent = <TFieldValues extends FieldValues>(
17
17
  props: SwitchElementProps<TFieldValues>,
18
18
  ) => React.ReactNode
19
19
 
20
- function SwitchElementBase(props: SwitchElementProps): JSX.Element {
20
+ function SwitchElementBase(props: SwitchElementProps): React.ReactNode {
21
21
  const { name, control, defaultValue, shouldUnregister, rules, disabled, ...other } = props
22
22
 
23
23
  const { field } = useController({
@@ -1,6 +1,7 @@
1
1
  import type { FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { phonePattern } from '@graphcommerce/react-hook-form'
3
- import { t, Trans } from '@lingui/macro'
3
+ import { t } from '@lingui/core/macro'
4
+ import { Trans } from '@lingui/react/macro'
4
5
  import type { TextFieldElementProps } from './TextFieldElement'
5
6
  import { TextFieldElement } from './TextFieldElement'
6
7
 
@@ -9,7 +10,7 @@ export type TelephoneElementProps<T extends FieldValues> = TextFieldElementProps
9
10
  /** @public */
10
11
  export function TelephoneElement<TFieldValues extends FieldValues>(
11
12
  props: TelephoneElementProps<TFieldValues>,
12
- ): JSX.Element {
13
+ ): React.ReactNode {
13
14
  const { rules, ...rest } = props
14
15
  return (
15
16
  <TextFieldElement
@@ -2,7 +2,7 @@
2
2
  import { InputCheckmark } from '@graphcommerce/next-ui'
3
3
  import type { FieldValues } from '@graphcommerce/react-hook-form'
4
4
  import { emailPattern, useController } from '@graphcommerce/react-hook-form'
5
- import { i18n } from '@lingui/core'
5
+ import { t } from '@lingui/core/macro'
6
6
  import type { TextFieldProps } from '@mui/material'
7
7
  import { TextField, useForkRef } from '@mui/material'
8
8
  import React, { useState } from 'react'
@@ -46,7 +46,7 @@ function toValue(incomingValue: unknown, type: React.HTMLInputTypeAttribute) {
46
46
  }
47
47
 
48
48
  /** @public */
49
- function TextFieldElementBase(props: TextFieldElementProps): JSX.Element {
49
+ function TextFieldElementBase(props: TextFieldElementProps): React.ReactNode {
50
50
  const {
51
51
  name,
52
52
  control,
@@ -61,13 +61,13 @@ function TextFieldElementBase(props: TextFieldElementProps): JSX.Element {
61
61
  } = props as TextFieldProps & InternalProps & BaseControllerProps
62
62
 
63
63
  if (required && !rules.required) {
64
- rules.required = i18n._(/* i18n */ 'This field is required')
64
+ rules.required = t`This field is required`
65
65
  }
66
66
 
67
67
  if (type === 'email' && !rules.pattern) {
68
68
  rules.pattern = {
69
69
  value: emailPattern,
70
- message: i18n._(/* i18n */ 'Please enter a valid email address'),
70
+ message: t`Please enter a valid email address`,
71
71
  }
72
72
  }
73
73
 
@@ -1,6 +1,6 @@
1
1
  import type { ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
2
2
  import { useController } from '@graphcommerce/react-hook-form'
3
- import { i18n } from '@lingui/core'
3
+ import { t } from '@lingui/core/macro'
4
4
  import type { FormLabelProps, ToggleButtonGroupProps, ToggleButtonProps } from '@mui/material'
5
5
  import {
6
6
  FormControl,
@@ -39,7 +39,7 @@ export function ToggleButtonGroupElement<TFieldValues extends FieldValues = Fiel
39
39
  ...toggleButtonGroupProps
40
40
  }: ToggleButtonGroupElementProps<TFieldValues>) {
41
41
  if (required && !rules.required) {
42
- rules.required = i18n._(/* i18n */ 'This field is required')
42
+ rules.required = t`This field is required`
43
43
  }
44
44
 
45
45
  const isRequired = required || !!rules?.required
@@ -1,3 +1,4 @@
1
+ import { previewSecret } from '@graphcommerce/next-config/config'
1
2
  import { iconChevronRight, iconContrast, IconSvg, MessageSnackbar } from '@graphcommerce/next-ui'
2
3
  import { FormPersist, FormProvider, useForm } from '@graphcommerce/react-hook-form'
3
4
  import { Box, IconButton } from '@mui/material'
@@ -10,8 +11,7 @@ function getPreviewUrl() {
10
11
  return url
11
12
  }
12
13
 
13
- const secret =
14
- process.env.NODE_ENV === 'development' ? (import.meta.graphCommerce.previewSecret ?? '') : ''
14
+ const secret = process.env.NODE_ENV === 'development' ? (previewSecret ?? '') : ''
15
15
 
16
16
  type FormValues = { secret: string }
17
17
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/ecommerce-ui",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.1.0-canary.55",
5
+ "version": "10.0.0-canary.56",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,19 +12,24 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.55",
16
- "@graphcommerce/graphql": "^9.1.0-canary.55",
17
- "@graphcommerce/next-ui": "^9.1.0-canary.55",
18
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.55",
19
- "@graphcommerce/react-hook-form": "^9.1.0-canary.55",
20
- "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.55",
21
- "@lingui/core": "^4.2.1",
22
- "@lingui/macro": "^4.2.1",
23
- "@lingui/react": "^4.2.1",
15
+ "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.56",
16
+ "@graphcommerce/graphql": "^10.0.0-canary.56",
17
+ "@graphcommerce/next-ui": "^10.0.0-canary.56",
18
+ "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.56",
19
+ "@graphcommerce/react-hook-form": "^10.0.0-canary.56",
20
+ "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.56",
21
+ "@lingui/core": "^5",
22
+ "@lingui/macro": "^5",
23
+ "@lingui/react": "^5",
24
24
  "@mui/material": "^5.10.16",
25
25
  "framer-motion": "^11.0.0",
26
26
  "next": "*",
27
- "react": "^18.2.0",
28
- "react-dom": "^18.2.0"
27
+ "react": "^19.2.0",
28
+ "react-dom": "^19.2.0"
29
+ },
30
+ "exports": {
31
+ ".": "./index.ts",
32
+ "./route/preview": "./route/preview.ts",
33
+ "./plugins/PreviewModeFramerNextPages": "./plugins/PreviewModeFramerNextPages.tsx"
29
34
  }
30
35
  }
package/route/preview.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { PreviewData } from '@graphcommerce/graphql'
2
+ import { previewSecret } from '@graphcommerce/next-config/config'
2
3
  import type { NextApiRequest, NextApiResponse } from 'next'
3
4
  import { previewModeDefaults } from '../components/PreviewMode/previewModeDefaults'
4
5
 
@@ -18,7 +19,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
18
19
  }
19
20
 
20
21
  if (action === 'enable' && req.query.secret) {
21
- if (req.query.secret !== import.meta.graphCommerce.previewSecret) {
22
+ if (req.query.secret !== previewSecret) {
22
23
  // This secret should only be known to this API route and the CMS
23
24
  res.status(401).json({ message: 'Invalid token' })
24
25
  res.end()