@graphcommerce/magento-cart-payment-method 9.1.0-canary.54 → 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,91 @@
1
1
  # Change Log
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
+
83
+ ## 9.1.0-canary.55
84
+
85
+ ### Patch Changes
86
+
87
+ - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`59d91cc`](https://github.com/graphcommerce-org/graphcommerce/commit/59d91cc4b04b6d37e5fb6b09401c079de488bc29) - Solve issue where the Place order button would remain in a loading state because the back/forward cache of chrome started working for the checkout and thus React's state would not be reset, thinking we were still exiting the page. ([@paales](https://github.com/paales))
88
+
3
89
  ## 9.1.0-canary.54
4
90
 
5
91
  ## 9.1.0-canary.53
@@ -4,8 +4,8 @@ import type { ActionCardProps } from '@graphcommerce/next-ui'
4
4
  import { ActionCard, Button, FormDiv } from '@graphcommerce/next-ui'
5
5
  import type { UseFormComposeOptions } from '@graphcommerce/react-hook-form'
6
6
  import { FormPersist, useForm, useFormCompose } from '@graphcommerce/react-hook-form'
7
- import { i18n } from '@lingui/core'
8
- import { Trans } from '@lingui/react'
7
+ import { t } from '@lingui/core/macro'
8
+ import { Trans } from '@lingui/react/macro'
9
9
  import type { SxProps, Theme } from '@mui/material'
10
10
  import { useEffect } from 'react'
11
11
  import type { PaymentOptionsProps } from '../Api/PaymentMethod'
@@ -41,12 +41,12 @@ function PaymentMethodActionCard(
41
41
  ]}
42
42
  action={
43
43
  <Button disableRipple variant='inline' color='secondary' tabIndex={-1}>
44
- <Trans id='Select' />
44
+ <Trans>Select</Trans>
45
45
  </Button>
46
46
  }
47
47
  reset={
48
48
  <Button disableRipple variant='inline' color='secondary' onClick={onReset}>
49
- <Trans id='Change' />
49
+ <Trans>Change</Trans>
50
50
  </Button>
51
51
  }
52
52
  after={
@@ -108,7 +108,7 @@ export function PaymentMethodActionCardListForm(props: PaymentMethodActionCardLi
108
108
  <ActionCardListForm<PaymentOptionsProps & ActionCardProps, FormFields>
109
109
  control={control}
110
110
  name='paymentMethod'
111
- errorMessage={i18n._(/* i18n */ 'Please select a payment method')}
111
+ errorMessage={t`Please select a payment method`}
112
112
  collapse
113
113
  size='large'
114
114
  color='secondary'
@@ -1,5 +1,6 @@
1
1
  import { useCartQuery, useFormGqlMutationCart } from '@graphcommerce/magento-cart'
2
2
  import { useFormAutoSubmit, useFormCompose } from '@graphcommerce/react-hook-form'
3
+ import { useEffect } from 'react'
3
4
  import type { PaymentOptionsProps } from '../Api/PaymentMethod'
4
5
  import { GetPaymentMethodContextDocument } from '../PaymentMethodContext/GetPaymentMethodContext.gql'
5
6
  import { PaymentMethodOptionsNoopDocument } from './PaymentMethodOptionsNoop.gql'
@@ -31,6 +32,13 @@ export function PaymentMethodOptionsNoop(props: PaymentOptionsProps) {
31
32
  /** To use an external Pay button we register the current form to be handled there as well. */
32
33
  useFormCompose({ form, step, submit, key: `PaymentMethodOptions_${code}` })
33
34
 
35
+ useEffect(() => {
36
+ window.onunload = () => {
37
+ // Break the backforwardcache
38
+ console.log('Unload event triggered, to prevent the backforward cache from working.')
39
+ }
40
+ }, [])
41
+
34
42
  /**
35
43
  * This is the form that the user can fill in. In this case we don't wat the user to fill in
36
44
  * anything.
@@ -1,6 +1,6 @@
1
1
  import type { FetchResult } from '@graphcommerce/graphql'
2
2
  import { ApolloError } from '@graphcommerce/graphql'
3
- import { t } from '@lingui/macro'
3
+ import { t } from '@lingui/core/macro'
4
4
  import type { PaymentMethodPlaceOrderNoopMutation } from './PaymentMethodPlaceOrderNoop.gql'
5
5
 
6
6
  export type PlacedOrder<T extends FetchResult<PaymentMethodPlaceOrderNoopMutation>> = NonNullable<
@@ -11,7 +11,7 @@ import {
11
11
  } from '@graphcommerce/next-ui'
12
12
  import type { UseFormComposeOptions } from '@graphcommerce/react-hook-form'
13
13
  import { Controller, FormPersist, useForm, useFormCompose } from '@graphcommerce/react-hook-form'
14
- import { i18n } from '@lingui/core'
14
+ import { t } from '@lingui/core/macro'
15
15
  import type { SxProps, Theme } from '@mui/material'
16
16
  import { Box, FormControl, FormHelperText } from '@mui/material'
17
17
  import { useEffect } from 'react'
@@ -123,7 +123,7 @@ export function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
123
123
  defaultValue=''
124
124
  control={control}
125
125
  name='paymentMethod'
126
- rules={{ required: i18n._(/* i18n */ 'Please select a payment method') }}
126
+ rules={{ required: t`Please select a payment method` }}
127
127
  render={({ field: { onChange, value, name, onBlur } }) => (
128
128
  <Scroller
129
129
  className={classes.scrollerRoot}
package/README.md CHANGED
@@ -11,8 +11,8 @@ A Magento Payment Method module must implement
11
11
 
12
12
  ```tsx
13
13
  export interface PaymentModule {
14
- PaymentOptions: React.VFC<PaymentOptionsProps>
15
- PaymentButton?: React.VFC<PaymentButtonProps>
14
+ PaymentOptions: React.FC<PaymentOptionsProps>
15
+ PaymentButton?: React.FC<PaymentButtonProps>
16
16
  expandMethods?: ExpandPaymentMethods
17
17
  }
18
18
  ```
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-cart-payment-method",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.1.0-canary.54",
5
+ "version": "10.0.0-canary.56",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -11,26 +11,32 @@
11
11
  "project": "./tsconfig.json"
12
12
  }
13
13
  },
14
+ "exports": {
15
+ ".": "./index.ts",
16
+ "./PaymentMethodContext/GetPaymentMethodContext.gql": "./PaymentMethodContext/GetPaymentMethodContext.gql.ts",
17
+ "./PaymentMethodOptionsNoop/PaymentMethodOptionsNoop": "./PaymentMethodOptionsNoop/PaymentMethodOptionsNoop.tsx",
18
+ "./PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop": "./PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop.tsx"
19
+ },
14
20
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^9.1.0-canary.54",
16
- "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.54",
17
- "@graphcommerce/framer-scroller": "^9.1.0-canary.54",
18
- "@graphcommerce/graphql": "^9.1.0-canary.54",
19
- "@graphcommerce/image": "^9.1.0-canary.54",
20
- "@graphcommerce/magento-cart": "^9.1.0-canary.54",
21
- "@graphcommerce/magento-cart-shipping-address": "^9.1.0-canary.54",
22
- "@graphcommerce/magento-store": "^9.1.0-canary.54",
23
- "@graphcommerce/next-ui": "^9.1.0-canary.54",
24
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.54",
25
- "@graphcommerce/react-hook-form": "^9.1.0-canary.54",
26
- "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.54",
27
- "@lingui/core": "^4.2.1",
28
- "@lingui/macro": "^4.2.1",
29
- "@lingui/react": "^4.2.1",
21
+ "@graphcommerce/ecommerce-ui": "^10.0.0-canary.56",
22
+ "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.56",
23
+ "@graphcommerce/framer-scroller": "^10.0.0-canary.56",
24
+ "@graphcommerce/graphql": "^10.0.0-canary.56",
25
+ "@graphcommerce/image": "^10.0.0-canary.56",
26
+ "@graphcommerce/magento-cart": "^10.0.0-canary.56",
27
+ "@graphcommerce/magento-cart-shipping-address": "^10.0.0-canary.56",
28
+ "@graphcommerce/magento-store": "^10.0.0-canary.56",
29
+ "@graphcommerce/next-ui": "^10.0.0-canary.56",
30
+ "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.56",
31
+ "@graphcommerce/react-hook-form": "^10.0.0-canary.56",
32
+ "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.56",
33
+ "@lingui/core": "^5",
34
+ "@lingui/macro": "^5",
35
+ "@lingui/react": "^5",
30
36
  "@mui/material": "^5.10.16",
31
37
  "framer-motion": "^11.0.0",
32
38
  "next": "*",
33
- "react": "^18.2.0",
34
- "react-dom": "^18.2.0"
39
+ "react": "^19.2.0",
40
+ "react-dom": "^19.2.0"
35
41
  }
36
42
  }