@graphcommerce/magento-cart-payment-method 8.1.0-canary.9 → 9.0.0-canary.100

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.
@@ -1,4 +1,4 @@
1
- fragment AvailablePaymentMethod on AvailablePaymentMethod @injectable {
1
+ fragment AvailablePaymentMethod on AvailablePaymentMethod {
2
2
  code
3
3
  title
4
4
  }
@@ -1,4 +1,4 @@
1
- fragment PaymentMethodContext on Cart @injectable {
1
+ fragment PaymentMethodContext on Cart {
2
2
  id
3
3
  available_payment_methods {
4
4
  ...AvailablePaymentMethod
@@ -1,4 +1,4 @@
1
- fragment PaymentMethodUpdated on Cart @injectable {
1
+ fragment PaymentMethodUpdated on Cart {
2
2
  id
3
3
  selected_payment_method {
4
4
  ...SelectedPaymentMethod
@@ -1,4 +1,4 @@
1
- fragment SelectedPaymentMethod on SelectedPaymentMethod @injectable {
1
+ fragment SelectedPaymentMethod on SelectedPaymentMethod {
2
2
  code
3
3
  title
4
4
  }
package/CHANGELOG.md CHANGED
@@ -1,13 +1,206 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.100
4
+
5
+ ## 9.0.0-canary.99
6
+
7
+ ## 9.0.0-canary.98
8
+
9
+ ## 9.0.0-canary.97
10
+
11
+ ## 9.0.0-canary.96
12
+
13
+ ## 9.0.0-canary.95
14
+
15
+ ## 9.0.0-canary.94
16
+
17
+ ## 9.0.0-canary.93
18
+
19
+ ## 9.0.0-canary.92
20
+
21
+ ## 9.0.0-canary.91
22
+
23
+ ## 9.0.0-canary.90
24
+
25
+ ## 9.0.0-canary.89
26
+
27
+ ## 9.0.0-canary.88
28
+
29
+ ## 9.0.0-canary.87
30
+
31
+ ## 9.0.0-canary.86
32
+
33
+ ## 9.0.0-canary.85
34
+
35
+ ## 9.0.0-canary.84
36
+
37
+ ## 9.0.0-canary.83
38
+
39
+ ## 9.0.0-canary.82
40
+
41
+ ## 9.0.0-canary.81
42
+
43
+ ## 9.0.0-canary.80
44
+
45
+ ## 9.0.0-canary.79
46
+
47
+ ## 9.0.0-canary.78
48
+
49
+ ## 9.0.0-canary.77
50
+
51
+ ## 9.0.0-canary.76
52
+
53
+ ## 9.0.0-canary.75
54
+
55
+ ## 9.0.0-canary.74
56
+
57
+ ## 9.0.0-canary.73
58
+
59
+ ## 9.0.0-canary.72
60
+
61
+ ## 9.0.0-canary.71
62
+
63
+ ## 9.0.0-canary.70
64
+
65
+ ## 9.0.0-canary.69
66
+
67
+ ## 9.0.0-canary.68
68
+
69
+ ## 9.0.0-canary.67
70
+
71
+ ## 9.0.0-canary.66
72
+
73
+ ## 9.0.0-canary.65
74
+
75
+ ## 9.0.0-canary.64
76
+
77
+ ## 9.0.0-canary.63
78
+
79
+ ## 9.0.0-canary.62
80
+
81
+ ## 9.0.0-canary.61
82
+
83
+ ## 9.0.0-canary.60
84
+
85
+ ## 9.0.0-canary.59
86
+
87
+ ## 9.0.0-canary.58
88
+
89
+ ## 9.0.0-canary.57
90
+
91
+ ## 9.0.0-canary.56
92
+
93
+ ## 9.0.0-canary.55
94
+
95
+ ## 9.0.0-canary.54
96
+
97
+ ## 8.1.0-canary.53
98
+
99
+ ## 8.1.0-canary.52
100
+
101
+ ## 8.1.0-canary.51
102
+
103
+ ## 8.1.0-canary.50
104
+
105
+ ## 8.1.0-canary.49
106
+
107
+ ## 8.1.0-canary.48
108
+
109
+ ## 8.1.0-canary.47
110
+
111
+ ## 8.1.0-canary.46
112
+
113
+ ## 8.1.0-canary.45
114
+
115
+ ## 8.1.0-canary.44
116
+
117
+ ## 8.1.0-canary.43
118
+
119
+ ## 8.1.0-canary.42
120
+
121
+ ## 8.1.0-canary.41
122
+
123
+ ## 8.1.0-canary.40
124
+
125
+ ## 8.1.0-canary.39
126
+
127
+ ## 8.1.0-canary.38
128
+
129
+ ### Patch Changes
130
+
131
+ - [#2305](https://github.com/graphcommerce-org/graphcommerce/pull/2305) [`77e8297`](https://github.com/graphcommerce-org/graphcommerce/commit/77e82976816994336c616208a651cb18ce9ea270) - Fix bug with persist not applying saved changes by moving <FromPersist/> below the form components ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
132
+
133
+ ## 8.1.0-canary.37
134
+
135
+ ## 8.1.0-canary.36
136
+
137
+ ## 8.1.0-canary.35
138
+
139
+ ## 8.1.0-canary.34
140
+
141
+ ## 8.1.0-canary.33
142
+
143
+ ## 8.1.0-canary.32
144
+
145
+ ## 8.1.0-canary.31
146
+
147
+ ## 8.1.0-canary.30
148
+
149
+ ## 8.1.0-canary.29
150
+
151
+ ## 8.1.0-canary.28
152
+
153
+ ## 8.1.0-canary.27
154
+
155
+ ## 8.1.0-canary.26
156
+
157
+ ## 8.1.0-canary.25
158
+
159
+ ## 8.1.0-canary.24
160
+
161
+ ## 8.1.0-canary.23
162
+
163
+ ## 8.1.0-canary.22
164
+
165
+ ## 8.1.0-canary.21
166
+
167
+ ## 8.1.0-canary.20
168
+
169
+ ## 8.1.0-canary.19
170
+
171
+ ## 8.1.0-canary.18
172
+
173
+ ### Patch Changes
174
+
175
+ - [#2277](https://github.com/graphcommerce-org/graphcommerce/pull/2277) [`f9199f7`](https://github.com/graphcommerce-org/graphcommerce/commit/f9199f798583138a68dd641ea6637375c487f29b) - Solve issue where Braintree wouldn't place the order after successfully validating a Credit Card. ([@paales](https://github.com/paales))
176
+
177
+ ## 8.1.0-canary.17
178
+
179
+ ## 8.1.0-canary.16
180
+
181
+ ## 8.1.0-canary.15
182
+
183
+ ## 8.1.0-canary.14
184
+
185
+ ### Patch Changes
186
+
187
+ - [`831d7cd`](https://github.com/graphcommerce-org/graphcommerce/commit/831d7cd64a40b7b58748fd9637199b88938e75b7) - Compatibility with Magento 2.4.7 ([@paales](https://github.com/paales))
188
+
189
+ ## 8.1.0-canary.13
190
+
191
+ ## 8.1.0-canary.12
192
+
193
+ ## 8.1.0-canary.11
194
+
195
+ ## 8.1.0-canary.10
196
+
3
197
  ## 8.1.0-canary.9
4
198
 
5
199
  ## 8.1.0-canary.8
6
200
 
7
201
  ### Patch Changes
8
202
 
9
- - [#2247](https://github.com/graphcommerce-org/graphcommerce/pull/2247) [`d345474`](https://github.com/graphcommerce-org/graphcommerce/commit/d345474fb190d158629cd5fd5e68a78724fa2fb6) - Due to a cyclic dependency the actual PaymentMethodPlaceOrder button would sometimes be undefined.
10
- ([@paales](https://github.com/paales))
203
+ - [#2247](https://github.com/graphcommerce-org/graphcommerce/pull/2247) [`d345474`](https://github.com/graphcommerce-org/graphcommerce/commit/d345474fb190d158629cd5fd5e68a78724fa2fb6) - Due to a cyclic dependency the actual PaymentMethodPlaceOrder button would sometimes be undefined. ([@paales](https://github.com/paales))
11
204
 
12
205
  ## 8.1.0-canary.7
13
206
 
@@ -23,14 +216,11 @@
23
216
 
24
217
  ### Patch Changes
25
218
 
26
- - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`43bd04a`](https://github.com/graphcommerce-org/graphcommerce/commit/43bd04a777c5800cc7e01bee1e123a5aad82f194) - Use the non resolved payment methods as a placeholder for the actual payment methods
27
- ([@FrankHarland](https://github.com/FrankHarland))
219
+ - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`43bd04a`](https://github.com/graphcommerce-org/graphcommerce/commit/43bd04a777c5800cc7e01bee1e123a5aad82f194) - Use the non resolved payment methods as a placeholder for the actual payment methods ([@FrankHarland](https://github.com/FrankHarland))
28
220
 
29
- - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`530076e`](https://github.com/graphcommerce-org/graphcommerce/commit/530076e3664703cb8b577b7fcf1998a420819f60) - Moved all usages of useFormPersist to the <FormPersist/> component to prevent rerenders.
30
- ([@FrankHarland](https://github.com/FrankHarland))
221
+ - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`530076e`](https://github.com/graphcommerce-org/graphcommerce/commit/530076e3664703cb8b577b7fcf1998a420819f60) - Moved all usages of useFormPersist to the <FormPersist/> component to prevent rerenders. ([@FrankHarland](https://github.com/FrankHarland))
31
222
 
32
- - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`43bd04a`](https://github.com/graphcommerce-org/graphcommerce/commit/43bd04a777c5800cc7e01bee1e123a5aad82f194) - Prevent BillingPage query from rerunning on each mutation
33
- ([@FrankHarland](https://github.com/FrankHarland))
223
+ - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`43bd04a`](https://github.com/graphcommerce-org/graphcommerce/commit/43bd04a777c5800cc7e01bee1e123a5aad82f194) - Prevent BillingPage query from rerunning on each mutation ([@FrankHarland](https://github.com/FrankHarland))
34
224
 
35
225
  ## 8.0.6-canary.1
36
226
 
@@ -108,8 +298,7 @@
108
298
 
109
299
  ### Patch Changes
110
300
 
111
- - [#2115](https://github.com/graphcommerce-org/graphcommerce/pull/2115) [`105a1af`](https://github.com/graphcommerce-org/graphcommerce/commit/105a1af8b820de8873e430ae398f1922d39a9110) - Disabled ripple animations on all ActionCard ‘Select’ and ‘Change’ so the rendering is more subtle during checkout.
112
- ([@Jessevdpoel](https://github.com/Jessevdpoel))
301
+ - [#2115](https://github.com/graphcommerce-org/graphcommerce/pull/2115) [`105a1af`](https://github.com/graphcommerce-org/graphcommerce/commit/105a1af8b820de8873e430ae398f1922d39a9110) - Disabled ripple animations on all ActionCard ‘Select’ and ‘Change’ so the rendering is more subtle during checkout. ([@Jessevdpoel](https://github.com/Jessevdpoel))
113
302
 
114
303
  ## 8.0.0-canary.100
115
304
 
@@ -1442,31 +1631,31 @@
1442
1631
  All occurences of `<Trans>` and `t` need to be replaced:
1443
1632
 
1444
1633
  ```tsx
1445
- import { Trans, t } from "@lingui/macro";
1634
+ import { Trans, t } from '@lingui/macro'
1446
1635
 
1447
1636
  function MyComponent() {
1448
- const foo = "bar";
1637
+ const foo = 'bar'
1449
1638
  return (
1450
1639
  <div aria-label={t`Account ${foo}`}>
1451
1640
  <Trans>My Translation {foo}</Trans>
1452
1641
  </div>
1453
- );
1642
+ )
1454
1643
  }
1455
1644
  ```
1456
1645
 
1457
1646
  Needs to be replaced with:
1458
1647
 
1459
1648
  ```tsx
1460
- import { Trans } from "@lingui/react";
1461
- import { i18n } from "@lingui/core";
1649
+ import { Trans } from '@lingui/react'
1650
+ import { i18n } from '@lingui/core'
1462
1651
 
1463
1652
  function MyComponent() {
1464
- const foo = "bar";
1653
+ const foo = 'bar'
1465
1654
  return (
1466
1655
  <div aria-label={i18n._(/* i18n */ `Account {foo}`, { foo })}>
1467
- <Trans key="My Translation {foo}" values={{ foo }}></Trans>
1656
+ <Trans key='My Translation {foo}' values={{ foo }}></Trans>
1468
1657
  </div>
1469
- );
1658
+ )
1470
1659
  }
1471
1660
  ```
1472
1661
 
@@ -1,11 +1,5 @@
1
- import {
2
- ActionCard,
3
- Button,
4
- FormDiv,
5
- ActionCardItemRenderProps,
6
- ActionCardListForm,
7
- ActionCardProps,
8
- } from '@graphcommerce/next-ui'
1
+ import { ActionCardItemRenderProps, ActionCardListForm } from '@graphcommerce/ecommerce-ui'
2
+ import { ActionCard, ActionCardProps, Button, FormDiv } from '@graphcommerce/next-ui'
9
3
  import {
10
4
  FormPersist,
11
5
  useForm,
@@ -75,15 +69,17 @@ export function PaymentMethodActionCardListForm(props: PaymentMethodActionCardLi
75
69
  const [lockState] = useCartLock()
76
70
 
77
71
  type FormFields = { code: string | null; paymentMethod?: string }
78
- const form = useForm<FormFields>({
79
- defaultValues: { code: lockState.method },
80
- })
72
+ const form = useForm<FormFields>({})
81
73
 
82
74
  const { control, handleSubmit, watch, setValue } = form
83
75
  const submit = handleSubmit(() => {})
84
76
 
85
77
  const paymentMethod = watch('paymentMethod')
86
78
 
79
+ useEffect(() => {
80
+ if (lockState.method) setValue('code', lockState.method)
81
+ }, [lockState.method, setValue])
82
+
87
83
  useFormCompose({ form, step: 1, submit, key: 'PaymentMethodActionCardList' })
88
84
 
89
85
  // todo: Do not useEffect to set value, usePaymentMethodContext should calculate these values.
@@ -109,7 +105,6 @@ export function PaymentMethodActionCardListForm(props: PaymentMethodActionCardLi
109
105
 
110
106
  return (
111
107
  <>
112
- <FormPersist form={form} name='PaymentMethodActionCardList' />
113
108
  <ActionCardListForm<PaymentOptionsProps & ActionCardProps, FormFields>
114
109
  control={control}
115
110
  name='paymentMethod'
@@ -117,6 +112,7 @@ export function PaymentMethodActionCardListForm(props: PaymentMethodActionCardLi
117
112
  collapse
118
113
  size='large'
119
114
  color='secondary'
115
+ required
120
116
  items={methods.map((method) => ({
121
117
  ...method,
122
118
  value: `${method.code}___${method.child}`,
@@ -126,6 +122,7 @@ export function PaymentMethodActionCardListForm(props: PaymentMethodActionCardLi
126
122
  }))}
127
123
  render={PaymentMethodActionCard}
128
124
  />
125
+ <FormPersist form={form} name='PaymentMethodActionCardList' />
129
126
  </>
130
127
  )
131
128
  }
@@ -52,6 +52,7 @@ export function PaymentMethodButton(props: PaymentMethodButtonProps) {
52
52
  onSubmitSuccessful={onSubmitSuccessful}
53
53
  render={({ submit, buttonState, error }) => {
54
54
  const errorVal = buttonState.isSubmitting ? undefined : error
55
+
55
56
  const button = (
56
57
  <PaymentMethodButtonRenderer
57
58
  buttonProps={buttonProps}
@@ -1,5 +1,6 @@
1
1
  import { useFormGqlMutationCart } from '@graphcommerce/magento-cart'
2
2
  import { useFormCompose } from '@graphcommerce/react-hook-form'
3
+ import { t } from '@lingui/macro'
3
4
  import { PaymentPlaceOrderProps } from '../Api/PaymentMethod'
4
5
  import { usePaymentMethodContext } from '../PaymentMethodContext/paymentMethodContextType'
5
6
  import { PaymentMethodPlaceOrderNoopDocument } from './PaymentMethodPlaceOrderNoop.gql'
@@ -10,9 +11,14 @@ export function PaymentMethodPlaceOrderNoop(props: PaymentPlaceOrderProps) {
10
11
 
11
12
  const form = useFormGqlMutationCart(PaymentMethodPlaceOrderNoopDocument, {
12
13
  onComplete: async (result) => {
13
- if (!result.data?.placeOrder) return
14
+ if (!result.data?.placeOrder?.order)
15
+ throw Error(
16
+ t`An error occurred while processing your payment. Please contact the store owner`,
17
+ )
18
+
14
19
  await onSuccess(result.data.placeOrder.order.order_number)
15
20
  },
21
+ submitWhileLocked: true,
16
22
  })
17
23
 
18
24
  const { handleSubmit } = form
@@ -90,7 +90,6 @@ export function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
90
90
  ...(Array.isArray(sx) ? sx : [sx]),
91
91
  ]}
92
92
  >
93
- <FormPersist form={form} name='PaymentMethodToggles' />
94
93
  <input type='hidden' {...register('code', { required: true })} required />
95
94
  <FormRow className={classes.root} sx={{ position: 'relative', padding: 0 }}>
96
95
  <ScrollerProvider scrollSnapAlign='center'>
@@ -215,6 +214,7 @@ export function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
215
214
  </Box>
216
215
  </ScrollerProvider>
217
216
  </FormRow>
217
+ <FormPersist form={form} name='PaymentMethodToggles' />
218
218
  </Form>
219
219
  )
220
220
  }
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": "8.1.0-canary.9",
5
+ "version": "9.0.0-canary.100",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,17 +12,18 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.9",
16
- "@graphcommerce/framer-scroller": "^8.1.0-canary.9",
17
- "@graphcommerce/graphql": "^8.1.0-canary.9",
18
- "@graphcommerce/image": "^8.1.0-canary.9",
19
- "@graphcommerce/magento-cart": "^8.1.0-canary.9",
20
- "@graphcommerce/magento-cart-shipping-address": "^8.1.0-canary.9",
21
- "@graphcommerce/magento-store": "^8.1.0-canary.9",
22
- "@graphcommerce/next-ui": "^8.1.0-canary.9",
23
- "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.9",
24
- "@graphcommerce/react-hook-form": "^8.1.0-canary.9",
25
- "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.9",
15
+ "@graphcommerce/ecommerce-ui": "^9.0.0-canary.100",
16
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.100",
17
+ "@graphcommerce/framer-scroller": "^9.0.0-canary.100",
18
+ "@graphcommerce/graphql": "^9.0.0-canary.100",
19
+ "@graphcommerce/image": "^9.0.0-canary.100",
20
+ "@graphcommerce/magento-cart": "^9.0.0-canary.100",
21
+ "@graphcommerce/magento-cart-shipping-address": "^9.0.0-canary.100",
22
+ "@graphcommerce/magento-store": "^9.0.0-canary.100",
23
+ "@graphcommerce/next-ui": "^9.0.0-canary.100",
24
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.100",
25
+ "@graphcommerce/react-hook-form": "^9.0.0-canary.100",
26
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.100",
26
27
  "@lingui/core": "^4.2.1",
27
28
  "@lingui/macro": "^4.2.1",
28
29
  "@lingui/react": "^4.2.1",