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

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,208 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.101
4
+
5
+ ## 9.0.0-canary.100
6
+
7
+ ## 9.0.0-canary.99
8
+
9
+ ## 9.0.0-canary.98
10
+
11
+ ## 9.0.0-canary.97
12
+
13
+ ## 9.0.0-canary.96
14
+
15
+ ## 9.0.0-canary.95
16
+
17
+ ## 9.0.0-canary.94
18
+
19
+ ## 9.0.0-canary.93
20
+
21
+ ## 9.0.0-canary.92
22
+
23
+ ## 9.0.0-canary.91
24
+
25
+ ## 9.0.0-canary.90
26
+
27
+ ## 9.0.0-canary.89
28
+
29
+ ## 9.0.0-canary.88
30
+
31
+ ## 9.0.0-canary.87
32
+
33
+ ## 9.0.0-canary.86
34
+
35
+ ## 9.0.0-canary.85
36
+
37
+ ## 9.0.0-canary.84
38
+
39
+ ## 9.0.0-canary.83
40
+
41
+ ## 9.0.0-canary.82
42
+
43
+ ## 9.0.0-canary.81
44
+
45
+ ## 9.0.0-canary.80
46
+
47
+ ## 9.0.0-canary.79
48
+
49
+ ## 9.0.0-canary.78
50
+
51
+ ## 9.0.0-canary.77
52
+
53
+ ## 9.0.0-canary.76
54
+
55
+ ## 9.0.0-canary.75
56
+
57
+ ## 9.0.0-canary.74
58
+
59
+ ## 9.0.0-canary.73
60
+
61
+ ## 9.0.0-canary.72
62
+
63
+ ## 9.0.0-canary.71
64
+
65
+ ## 9.0.0-canary.70
66
+
67
+ ## 9.0.0-canary.69
68
+
69
+ ## 9.0.0-canary.68
70
+
71
+ ## 9.0.0-canary.67
72
+
73
+ ## 9.0.0-canary.66
74
+
75
+ ## 9.0.0-canary.65
76
+
77
+ ## 9.0.0-canary.64
78
+
79
+ ## 9.0.0-canary.63
80
+
81
+ ## 9.0.0-canary.62
82
+
83
+ ## 9.0.0-canary.61
84
+
85
+ ## 9.0.0-canary.60
86
+
87
+ ## 9.0.0-canary.59
88
+
89
+ ## 9.0.0-canary.58
90
+
91
+ ## 9.0.0-canary.57
92
+
93
+ ## 9.0.0-canary.56
94
+
95
+ ## 9.0.0-canary.55
96
+
97
+ ## 9.0.0-canary.54
98
+
99
+ ## 8.1.0-canary.53
100
+
101
+ ## 8.1.0-canary.52
102
+
103
+ ## 8.1.0-canary.51
104
+
105
+ ## 8.1.0-canary.50
106
+
107
+ ## 8.1.0-canary.49
108
+
109
+ ## 8.1.0-canary.48
110
+
111
+ ## 8.1.0-canary.47
112
+
113
+ ## 8.1.0-canary.46
114
+
115
+ ## 8.1.0-canary.45
116
+
117
+ ## 8.1.0-canary.44
118
+
119
+ ## 8.1.0-canary.43
120
+
121
+ ## 8.1.0-canary.42
122
+
123
+ ## 8.1.0-canary.41
124
+
125
+ ## 8.1.0-canary.40
126
+
127
+ ## 8.1.0-canary.39
128
+
129
+ ## 8.1.0-canary.38
130
+
131
+ ### Patch Changes
132
+
133
+ - [#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))
134
+
135
+ ## 8.1.0-canary.37
136
+
137
+ ## 8.1.0-canary.36
138
+
139
+ ## 8.1.0-canary.35
140
+
141
+ ## 8.1.0-canary.34
142
+
143
+ ## 8.1.0-canary.33
144
+
145
+ ## 8.1.0-canary.32
146
+
147
+ ## 8.1.0-canary.31
148
+
149
+ ## 8.1.0-canary.30
150
+
151
+ ## 8.1.0-canary.29
152
+
153
+ ## 8.1.0-canary.28
154
+
155
+ ## 8.1.0-canary.27
156
+
157
+ ## 8.1.0-canary.26
158
+
159
+ ## 8.1.0-canary.25
160
+
161
+ ## 8.1.0-canary.24
162
+
163
+ ## 8.1.0-canary.23
164
+
165
+ ## 8.1.0-canary.22
166
+
167
+ ## 8.1.0-canary.21
168
+
169
+ ## 8.1.0-canary.20
170
+
171
+ ## 8.1.0-canary.19
172
+
173
+ ## 8.1.0-canary.18
174
+
175
+ ### Patch Changes
176
+
177
+ - [#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))
178
+
179
+ ## 8.1.0-canary.17
180
+
181
+ ## 8.1.0-canary.16
182
+
183
+ ## 8.1.0-canary.15
184
+
185
+ ## 8.1.0-canary.14
186
+
187
+ ### Patch Changes
188
+
189
+ - [`831d7cd`](https://github.com/graphcommerce-org/graphcommerce/commit/831d7cd64a40b7b58748fd9637199b88938e75b7) - Compatibility with Magento 2.4.7 ([@paales](https://github.com/paales))
190
+
191
+ ## 8.1.0-canary.13
192
+
193
+ ## 8.1.0-canary.12
194
+
195
+ ## 8.1.0-canary.11
196
+
197
+ ## 8.1.0-canary.10
198
+
3
199
  ## 8.1.0-canary.9
4
200
 
5
201
  ## 8.1.0-canary.8
6
202
 
7
203
  ### Patch Changes
8
204
 
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))
205
+ - [#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
206
 
12
207
  ## 8.1.0-canary.7
13
208
 
@@ -23,14 +218,11 @@
23
218
 
24
219
  ### Patch Changes
25
220
 
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))
221
+ - [#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
222
 
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))
223
+ - [#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
224
 
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))
225
+ - [#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
226
 
35
227
  ## 8.0.6-canary.1
36
228
 
@@ -108,8 +300,7 @@
108
300
 
109
301
  ### Patch Changes
110
302
 
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))
303
+ - [#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
304
 
114
305
  ## 8.0.0-canary.100
115
306
 
@@ -1442,31 +1633,31 @@
1442
1633
  All occurences of `<Trans>` and `t` need to be replaced:
1443
1634
 
1444
1635
  ```tsx
1445
- import { Trans, t } from "@lingui/macro";
1636
+ import { Trans, t } from '@lingui/macro'
1446
1637
 
1447
1638
  function MyComponent() {
1448
- const foo = "bar";
1639
+ const foo = 'bar'
1449
1640
  return (
1450
1641
  <div aria-label={t`Account ${foo}`}>
1451
1642
  <Trans>My Translation {foo}</Trans>
1452
1643
  </div>
1453
- );
1644
+ )
1454
1645
  }
1455
1646
  ```
1456
1647
 
1457
1648
  Needs to be replaced with:
1458
1649
 
1459
1650
  ```tsx
1460
- import { Trans } from "@lingui/react";
1461
- import { i18n } from "@lingui/core";
1651
+ import { Trans } from '@lingui/react'
1652
+ import { i18n } from '@lingui/core'
1462
1653
 
1463
1654
  function MyComponent() {
1464
- const foo = "bar";
1655
+ const foo = 'bar'
1465
1656
  return (
1466
1657
  <div aria-label={i18n._(/* i18n */ `Account {foo}`, { foo })}>
1467
- <Trans key="My Translation {foo}" values={{ foo }}></Trans>
1658
+ <Trans key='My Translation {foo}' values={{ foo }}></Trans>
1468
1659
  </div>
1469
- );
1660
+ )
1470
1661
  }
1471
1662
  ```
1472
1663
 
@@ -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.101",
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.101",
16
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.101",
17
+ "@graphcommerce/framer-scroller": "^9.0.0-canary.101",
18
+ "@graphcommerce/graphql": "^9.0.0-canary.101",
19
+ "@graphcommerce/image": "^9.0.0-canary.101",
20
+ "@graphcommerce/magento-cart": "^9.0.0-canary.101",
21
+ "@graphcommerce/magento-cart-shipping-address": "^9.0.0-canary.101",
22
+ "@graphcommerce/magento-store": "^9.0.0-canary.101",
23
+ "@graphcommerce/next-ui": "^9.0.0-canary.101",
24
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.101",
25
+ "@graphcommerce/react-hook-form": "^9.0.0-canary.101",
26
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.101",
26
27
  "@lingui/core": "^4.2.1",
27
28
  "@lingui/macro": "^4.2.1",
28
29
  "@lingui/react": "^4.2.1",