@graphcommerce/magento-cart-payment-method 10.0.0-canary.68 → 10.0.0
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/Api/PaymentMethod.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type PaymentOptionsProps = PaymentMethod & PaymentMethodOptionsProps
|
|
|
22
22
|
export type PaymentHandlerProps = { code: string }
|
|
23
23
|
|
|
24
24
|
export type ExpandPaymentMethodsContext = Partial<PaymentMethodContextFragment> & {
|
|
25
|
-
client: ApolloClient
|
|
25
|
+
client: ApolloClient
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export type ExpandPaymentMethods = (
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,103 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.0.0
|
|
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
|
+
- [#2565](https://github.com/graphcommerce-org/graphcommerce/pull/2565) [`c96dfcd`](https://github.com/graphcommerce-org/graphcommerce/commit/c96dfcdca981baca387c270ad9e2b9515cdd00cc) - Updated to Apollo Client 4 ([@paales](https://github.com/paales))
|
|
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
|
+
|
|
89
|
+
## 10.0.0-canary.72
|
|
90
|
+
|
|
91
|
+
## 10.0.0-canary.71
|
|
92
|
+
|
|
93
|
+
## 10.0.0-canary.70
|
|
94
|
+
|
|
95
|
+
### Major Changes
|
|
96
|
+
|
|
97
|
+
- [#2565](https://github.com/graphcommerce-org/graphcommerce/pull/2565) [`c96dfcd`](https://github.com/graphcommerce-org/graphcommerce/commit/c96dfcdca981baca387c270ad9e2b9515cdd00cc) - Updated to Apollo Client 4 ([@paales](https://github.com/paales))
|
|
98
|
+
|
|
99
|
+
## 10.0.0-canary.69
|
|
100
|
+
|
|
3
101
|
## 10.0.0-canary.68
|
|
4
102
|
|
|
5
103
|
## 10.0.0-canary.67
|
|
@@ -12,7 +12,10 @@ export function PaymentMethodPlaceOrderNoop(props: PaymentPlaceOrderProps) {
|
|
|
12
12
|
const form = useFormGqlMutationCart(PaymentMethodPlaceOrderNoopDocument, {
|
|
13
13
|
onComplete: async (result) => {
|
|
14
14
|
assertOrderPlaced(result)
|
|
15
|
-
|
|
15
|
+
// After assertOrderPlaced, result.data.placeOrder.order.order_number is guaranteed
|
|
16
|
+
const orderNumber = (result.data as { placeOrder: { order: { order_number: string } } })
|
|
17
|
+
.placeOrder.order.order_number
|
|
18
|
+
await onSuccess(orderNumber)
|
|
16
19
|
},
|
|
17
20
|
submitWhileLocked: true,
|
|
18
21
|
})
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { ApolloLink } from '@graphcommerce/graphql'
|
|
2
|
+
import { CombinedGraphQLErrors } from '@apollo/client/errors'
|
|
3
3
|
import { t } from '@lingui/core/macro'
|
|
4
4
|
import type { PaymentMethodPlaceOrderNoopMutation } from './PaymentMethodPlaceOrderNoop.gql'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
NonNullable<NonNullable<T['data']>['placeOrder']>['order']
|
|
8
|
-
>
|
|
6
|
+
type PlaceOrderResult = ApolloLink.Result<PaymentMethodPlaceOrderNoopMutation>
|
|
9
7
|
|
|
10
|
-
export type
|
|
8
|
+
export type PlacedOrder = {
|
|
9
|
+
order_number: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type AssertedOrderPlaced = PlaceOrderResult & {
|
|
11
13
|
data: {
|
|
12
|
-
placeOrder: { order: PlacedOrder
|
|
14
|
+
placeOrder: { order: PlacedOrder }
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
export function throwGenericPlaceOrderError() {
|
|
17
|
-
throw new
|
|
18
|
-
|
|
18
|
+
export function throwGenericPlaceOrderError(): never {
|
|
19
|
+
throw new CombinedGraphQLErrors({
|
|
20
|
+
errors: [
|
|
19
21
|
{
|
|
20
22
|
message: t`An error occurred while processing your payment. Please contact the store owner`,
|
|
21
23
|
},
|
|
@@ -24,20 +26,26 @@ export function throwGenericPlaceOrderError() {
|
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/** Assert that the order was place successfully. */
|
|
27
|
-
export function assertOrderPlaced
|
|
28
|
-
result
|
|
29
|
-
): asserts result is AssertedOrderPlaced<T> {
|
|
29
|
+
export function assertOrderPlaced(result: PlaceOrderResult): asserts result is AssertedOrderPlaced {
|
|
30
|
+
// Check for GraphQL errors in the result
|
|
30
31
|
if (result.errors && result.errors.length > 0) {
|
|
31
|
-
|
|
32
|
-
throw new ApolloError({ graphQLErrors })
|
|
32
|
+
throw new CombinedGraphQLErrors(result)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
// Check for place order specific errors
|
|
36
|
+
const placeOrderData = result.data?.placeOrder as
|
|
37
|
+
| { errors?: { message: string }[] | null; order?: { order_number?: string } | null }
|
|
38
|
+
| null
|
|
39
|
+
| undefined
|
|
40
|
+
|
|
41
|
+
if (placeOrderData?.errors && placeOrderData.errors.length > 0) {
|
|
42
|
+
throw new CombinedGraphQLErrors({
|
|
43
|
+
errors: placeOrderData.errors.filter((e) => e !== null),
|
|
44
|
+
})
|
|
38
45
|
}
|
|
39
46
|
|
|
40
|
-
|
|
47
|
+
const orderNumber = placeOrderData?.order?.order_number
|
|
48
|
+
if (!orderNumber) {
|
|
41
49
|
console.info('Error while placing order', result)
|
|
42
50
|
throwGenericPlaceOrderError()
|
|
43
51
|
}
|
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": "10.0.0
|
|
5
|
+
"version": "10.0.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
"./PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop": "./PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop.tsx"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@graphcommerce/ecommerce-ui": "^10.0.0
|
|
22
|
-
"@graphcommerce/eslint-config-pwa": "^10.0.0
|
|
23
|
-
"@graphcommerce/framer-scroller": "^10.0.0
|
|
24
|
-
"@graphcommerce/graphql": "^10.0.0
|
|
25
|
-
"@graphcommerce/image": "^10.0.0
|
|
26
|
-
"@graphcommerce/magento-cart": "^10.0.0
|
|
27
|
-
"@graphcommerce/magento-cart-shipping-address": "^10.0.0
|
|
28
|
-
"@graphcommerce/magento-store": "^10.0.0
|
|
29
|
-
"@graphcommerce/next-ui": "^10.0.0
|
|
30
|
-
"@graphcommerce/prettier-config-pwa": "^10.0.0
|
|
31
|
-
"@graphcommerce/react-hook-form": "^10.0.0
|
|
32
|
-
"@graphcommerce/typescript-config-pwa": "^10.0.0
|
|
21
|
+
"@graphcommerce/ecommerce-ui": "^10.0.0",
|
|
22
|
+
"@graphcommerce/eslint-config-pwa": "^10.0.0",
|
|
23
|
+
"@graphcommerce/framer-scroller": "^10.0.0",
|
|
24
|
+
"@graphcommerce/graphql": "^10.0.0",
|
|
25
|
+
"@graphcommerce/image": "^10.0.0",
|
|
26
|
+
"@graphcommerce/magento-cart": "^10.0.0",
|
|
27
|
+
"@graphcommerce/magento-cart-shipping-address": "^10.0.0",
|
|
28
|
+
"@graphcommerce/magento-store": "^10.0.0",
|
|
29
|
+
"@graphcommerce/next-ui": "^10.0.0",
|
|
30
|
+
"@graphcommerce/prettier-config-pwa": "^10.0.0",
|
|
31
|
+
"@graphcommerce/react-hook-form": "^10.0.0",
|
|
32
|
+
"@graphcommerce/typescript-config-pwa": "^10.0.0",
|
|
33
33
|
"@lingui/core": "^5",
|
|
34
34
|
"@lingui/macro": "^5",
|
|
35
35
|
"@lingui/react": "^5",
|
package/test/goToPayment.ts
CHANGED
|
@@ -4,10 +4,7 @@ import { fillShippingAddressForm } from '@graphcommerce/magento-cart-shipping-ad
|
|
|
4
4
|
import { fillCartAgreementsForm } from '@graphcommerce/magento-cart/test/fillCartAgreementsForm'
|
|
5
5
|
import type { Page } from '@playwright/test'
|
|
6
6
|
|
|
7
|
-
export const goToPayment = async (
|
|
8
|
-
page: Page,
|
|
9
|
-
apolloClient: ApolloClient<NormalizedCacheObject>,
|
|
10
|
-
) => {
|
|
7
|
+
export const goToPayment = async (page: Page, apolloClient: ApolloClient) => {
|
|
11
8
|
await page.locator('#view-shopping-cart-button').click()
|
|
12
9
|
await page.locator('#cart-start-checkout').click()
|
|
13
10
|
|