@graphcommerce/magento-cart-payment-method 3.0.3 β†’ 3.0.6

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,5 @@
1
- fragment PaymentMethodContext on Cart @injectable {
1
+ fragment PaymentMethodContext on Cart @injectable @inject(into: ["ShippingMethodSelected"]) {
2
+ id
2
3
  available_payment_methods {
3
4
  ...AvailablePaymentMethod
4
5
  }
package/CHANGELOG.md CHANGED
@@ -1,21 +1,58 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1369](https://github.com/graphcommerce-org/graphcommerce/pull/1369) [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
8
+
9
+ * [#1368](https://github.com/graphcommerce-org/graphcommerce/pull/1368) [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a) Thanks [@paales](https://github.com/paales)! - Fix issue where the cart couldn't be properly restored when a payment was cancelled
10
+
11
+ * Updated dependencies [[`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a)]:
12
+ - @graphcommerce/graphql@3.0.6
13
+ - @graphcommerce/next-ui@4.5.0
14
+ - @graphcommerce/framer-scroller@2.1.3
15
+ - @graphcommerce/image@3.1.2
16
+ - @graphcommerce/magento-cart@4.2.2
17
+ - @graphcommerce/magento-store@4.1.4
18
+ - @graphcommerce/react-hook-form@3.0.6
19
+
20
+ ## 3.0.5
21
+
22
+ ### Patch Changes
23
+
24
+ - [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655) Thanks [@paales](https://github.com/paales)! - All default exports are now named exports internally and all `index.tsx` are renamed to the component name.
25
+
26
+ * [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef) Thanks [@paales](https://github.com/paales)! - upgrade dependencies
27
+
28
+ * Updated dependencies [[`3d63b39f7`](https://github.com/ho-nl/m2-pwa/commit/3d63b39f7e330d1827a32dba782667d7b21adaba), [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655), [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef)]:
29
+ - @graphcommerce/next-ui@4.2.4
30
+ - @graphcommerce/framer-scroller@2.0.6
31
+ - @graphcommerce/graphql@3.0.4
32
+ - @graphcommerce/image@3.1.1
33
+ - @graphcommerce/magento-cart@4.1.4
34
+ - @graphcommerce/magento-store@4.1.2
35
+ - @graphcommerce/react-hook-form@3.0.4
36
+
37
+ ## 3.0.4
38
+
39
+ ### Patch Changes
40
+
41
+ - [#1292](https://github.com/ho-nl/m2-pwa/pull/1292) [`5a1ba9e66`](https://github.com/ho-nl/m2-pwa/commit/5a1ba9e664abbac89c4f5f71f7d6d6ed1aefa5c0) Thanks [@paales](https://github.com/paales)! - Renamed SvgIcon to IconSvg to prevent collisions with MUI
42
+
43
+ - Updated dependencies [[`5a1ba9e66`](https://github.com/ho-nl/m2-pwa/commit/5a1ba9e664abbac89c4f5f71f7d6d6ed1aefa5c0), [`990df655b`](https://github.com/ho-nl/m2-pwa/commit/990df655b73b469718d6cb5837ee65dfe2ad6a1d), [`63f9b56eb`](https://github.com/ho-nl/m2-pwa/commit/63f9b56eb68ba790567ff1427e599fd2c3c8f1ee)]:
44
+ - @graphcommerce/magento-cart@4.1.3
45
+ - @graphcommerce/next-ui@4.2.0
46
+
3
47
  ## 3.0.3
4
48
 
5
49
  ### Patch Changes
6
50
 
7
- - [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)
8
- Thanks [@paales](https://github.com/paales)! - made packages public
51
+ - [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96) Thanks [@paales](https://github.com/paales)! - made packages public
9
52
 
10
- * [#1278](https://github.com/ho-nl/m2-pwa/pull/1278)
11
- [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20)
12
- Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Upgraded dependencies to the latest version
53
+ * [#1278](https://github.com/ho-nl/m2-pwa/pull/1278) [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Upgraded dependencies to the latest version
13
54
 
14
- * Updated dependencies
15
- [[`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96),
16
- [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20),
17
- [`3a719c88c`](https://github.com/ho-nl/m2-pwa/commit/3a719c88cad1eab58602de28c41adc0fc4827e1d),
18
- [`5ffcb56bf`](https://github.com/ho-nl/m2-pwa/commit/5ffcb56bfcbe49ebeaf24f9341e819a145ab9a14)]:
55
+ * Updated dependencies [[`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96), [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20), [`3a719c88c`](https://github.com/ho-nl/m2-pwa/commit/3a719c88cad1eab58602de28c41adc0fc4827e1d), [`5ffcb56bf`](https://github.com/ho-nl/m2-pwa/commit/5ffcb56bfcbe49ebeaf24f9341e819a145ab9a14)]:
19
56
  - @graphcommerce/framer-scroller@2.0.3
20
57
  - @graphcommerce/graphql@3.0.3
21
58
  - @graphcommerce/image@3.1.0
@@ -28,47 +65,23 @@
28
65
 
29
66
  ### Patch Changes
30
67
 
31
- - [#1274](https://github.com/ho-nl/m2-pwa/pull/1274)
32
- [`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7)
33
- Thanks [@paales](https://github.com/paales)! - Moved `ApolloErrorAlert`, `ApolloErrorFullPage` and
34
- `ApolloErrorSnackbar` to the ecommerce-ui package.
68
+ - [#1274](https://github.com/ho-nl/m2-pwa/pull/1274) [`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7) Thanks [@paales](https://github.com/paales)! - Moved `ApolloErrorAlert`, `ApolloErrorFullPage` and `ApolloErrorSnackbar` to the ecommerce-ui package.
35
69
 
36
- Created `ComposedSubmitButton` and `ComposedSubmitLinkOrButton` to reduce complexity from
37
- `magento-graphcms` example.
70
+ Created `ComposedSubmitButton` and `ComposedSubmitLinkOrButton` to reduce complexity from `magento-graphcms` example.
38
71
 
39
72
  Removed dependency an `@graphcommerce/react-hook-form` from `magento-graphcms` example.
40
73
 
41
74
  Added dependency `@graphcommerce/ecommerce-ui` from `magento-graphcms` example.
42
75
 
43
- * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
44
- [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2)
45
- Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from
46
- `dependencies` to `peerDependencies`. The result of this is that there will be significantly less
47
- duplicate packages in the node_modules folders.
48
-
49
- - [#1274](https://github.com/ho-nl/m2-pwa/pull/1274)
50
- [`b08a8eb1d`](https://github.com/ho-nl/m2-pwa/commit/b08a8eb1d024b9d3e7712ef034029151670db275)
51
- Thanks [@paales](https://github.com/paales)! - Fixed extraction of translations and updated
52
- various translations for english πŸ‡ΊπŸ‡ΈπŸ‡¬πŸ‡§ and dutch πŸ‡³πŸ‡±
53
-
54
- * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
55
- [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)
56
- Thanks [@paales](https://github.com/paales)! - Upgraded to
57
- [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be
58
- implementing
59
- [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
60
- soon.
61
-
62
- This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the
63
- frontend to be able to revalidate pages manually.
64
-
65
- * Updated dependencies
66
- [[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7),
67
- [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2),
68
- [`e7c8e2756`](https://github.com/ho-nl/m2-pwa/commit/e7c8e2756d637cbcd2e793d62ef5721d35d9fa7b),
69
- [`b08a8eb1d`](https://github.com/ho-nl/m2-pwa/commit/b08a8eb1d024b9d3e7712ef034029151670db275),
70
- [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d),
71
- [`5a4809b1a`](https://github.com/ho-nl/m2-pwa/commit/5a4809b1a705aa32f620f520085df48ee25f9949)]:
76
+ * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2) Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from `dependencies` to `peerDependencies`. The result of this is that there will be significantly less duplicate packages in the node_modules folders.
77
+
78
+ - [#1274](https://github.com/ho-nl/m2-pwa/pull/1274) [`b08a8eb1d`](https://github.com/ho-nl/m2-pwa/commit/b08a8eb1d024b9d3e7712ef034029151670db275) Thanks [@paales](https://github.com/paales)! - Fixed extraction of translations and updated various translations for english πŸ‡ΊπŸ‡ΈπŸ‡¬πŸ‡§ and dutch πŸ‡³πŸ‡±
79
+
80
+ * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d) Thanks [@paales](https://github.com/paales)! - Upgraded to [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be implementing [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta) soon.
81
+
82
+ This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the frontend to be able to revalidate pages manually.
83
+
84
+ * Updated dependencies [[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7), [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2), [`e7c8e2756`](https://github.com/ho-nl/m2-pwa/commit/e7c8e2756d637cbcd2e793d62ef5721d35d9fa7b), [`b08a8eb1d`](https://github.com/ho-nl/m2-pwa/commit/b08a8eb1d024b9d3e7712ef034029151670db275), [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d), [`5a4809b1a`](https://github.com/ho-nl/m2-pwa/commit/5a4809b1a705aa32f620f520085df48ee25f9949)]:
72
85
  - @graphcommerce/magento-cart@4.1.1
73
86
  - @graphcommerce/next-ui@4.1.1
74
87
  - @graphcommerce/react-hook-form@3.0.2
@@ -81,11 +94,8 @@
81
94
 
82
95
  ### Patch Changes
83
96
 
84
- - [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)
85
- Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files,
86
- so that the packages link to back to the website and repository
87
- - Updated dependencies
88
- [[`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)]:
97
+ - [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514) Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files, so that the packages link to back to the website and repository
98
+ - Updated dependencies [[`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)]:
89
99
  - @graphcommerce/framer-scroller@2.0.1
90
100
  - @graphcommerce/graphql@3.0.1
91
101
  - @graphcommerce/image@3.0.1
@@ -98,14 +108,11 @@
98
108
 
99
109
  ### Major Changes
100
110
 
101
- - [#1258](https://github.com/ho-nl/m2-pwa/pull/1258)
102
- [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05)
103
- Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
111
+ - [#1258](https://github.com/ho-nl/m2-pwa/pull/1258) [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05) Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
104
112
 
105
113
  ### Patch Changes
106
114
 
107
- - Updated dependencies
108
- [[`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05)]:
115
+ - Updated dependencies [[`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05)]:
109
116
  - @graphcommerce/framer-scroller@2.0.0
110
117
  - @graphcommerce/graphql@3.0.0
111
118
  - @graphcommerce/image@3.0.0
@@ -114,90 +121,77 @@
114
121
  - @graphcommerce/next-ui@4.0.0
115
122
  - @graphcommerce/react-hook-form@3.0.0
116
123
 
117
- All notable changes to this project will be documented in this file. See
118
- [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
124
+ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
119
125
 
120
126
  # [2.111.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.110.20...@graphcommerce/magento-cart-payment-method@2.111.0) (2021-11-12)
121
127
 
122
128
  ### Bug Fixes
123
129
 
124
- - even more translations
125
- ([1a1f988](https://github.com/ho-nl/m2-pwa/commit/1a1f98837c704b978f6b42b619d9c52f540b2d48))
130
+ - even more translations ([1a1f988](https://github.com/ho-nl/m2-pwa/commit/1a1f98837c704b978f6b42b619d9c52f540b2d48))
126
131
 
127
132
  ### Features
128
133
 
129
- - added tons of translations
130
- ([9bb0ac7](https://github.com/ho-nl/m2-pwa/commit/9bb0ac709b58df6ea6141e92e4923a5ca9ae2963))
134
+ - added tons of translations ([9bb0ac7](https://github.com/ho-nl/m2-pwa/commit/9bb0ac709b58df6ea6141e92e4923a5ca9ae2963))
131
135
 
132
136
  ## [2.110.7](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.110.6...@graphcommerce/magento-cart-payment-method@2.110.7) (2021-11-04)
133
137
 
134
138
  ### Bug Fixes
135
139
 
136
- - remove hardcoded fontSize
137
- ([e4e09e1](https://github.com/ho-nl/m2-pwa/commit/e4e09e11baeb8edeff634550b8cdb88571d96911))
140
+ - remove hardcoded fontSize ([e4e09e1](https://github.com/ho-nl/m2-pwa/commit/e4e09e11baeb8edeff634550b8cdb88571d96911))
138
141
 
139
142
  # [2.110.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.109.1...@graphcommerce/magento-cart-payment-method@2.110.0) (2021-11-02)
140
143
 
141
144
  ### Features
142
145
 
143
- - shipping methods scroller
144
- ([3cc4413](https://github.com/ho-nl/m2-pwa/commit/3cc441320d2a3dd003c499be358a118a17e528c3))
146
+ - shipping methods scroller ([3cc4413](https://github.com/ho-nl/m2-pwa/commit/3cc441320d2a3dd003c499be358a118a17e528c3))
145
147
 
146
148
  # [2.109.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.108.8...@graphcommerce/magento-cart-payment-method@2.109.0) (2021-11-02)
147
149
 
148
150
  ### Features
149
151
 
150
- - darkTheme
151
- ([968f4f1](https://github.com/ho-nl/m2-pwa/commit/968f4f1360417bf7daa36454c19e6bc5cf53ae90))
152
+ - darkTheme ([968f4f1](https://github.com/ho-nl/m2-pwa/commit/968f4f1360417bf7daa36454c19e6bc5cf53ae90))
152
153
 
153
154
  ## [2.108.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.108.3...@graphcommerce/magento-cart-payment-method@2.108.4) (2021-10-28)
154
155
 
155
156
  ### Bug Fixes
156
157
 
157
- - External SVG's can't have alt tags
158
- ([1b1414a](https://github.com/ho-nl/m2-pwa/commit/1b1414a782d55d3acf7b0e6bcaa50f2ad5f18f39))
158
+ - External SVG's can't have alt tags ([1b1414a](https://github.com/ho-nl/m2-pwa/commit/1b1414a782d55d3acf7b0e6bcaa50f2ad5f18f39))
159
159
 
160
160
  ## [2.108.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.108.2...@graphcommerce/magento-cart-payment-method@2.108.3) (2021-10-28)
161
161
 
162
162
  ### Bug Fixes
163
163
 
164
- - update SvgImage to SvgImageSimple
165
- ([f116543](https://github.com/ho-nl/m2-pwa/commit/f116543730853fa9782abff0ccacee7032e85789))
164
+ - update SvgImage to SvgImageSimple ([f116543](https://github.com/ho-nl/m2-pwa/commit/f116543730853fa9782abff0ccacee7032e85789))
166
165
 
167
166
  # [2.108.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.107.6...@graphcommerce/magento-cart-payment-method@2.108.0) (2021-10-27)
168
167
 
169
168
  ### Features
170
169
 
171
- - **nextjs:** upgraded to nextjs 12
172
- ([9331bc8](https://github.com/ho-nl/m2-pwa/commit/9331bc801f6419522115cc47d291d49d608d5a90))
170
+ - **nextjs:** upgraded to nextjs 12 ([9331bc8](https://github.com/ho-nl/m2-pwa/commit/9331bc801f6419522115cc47d291d49d608d5a90))
173
171
 
174
172
  # [2.107.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.106.16...@graphcommerce/magento-cart-payment-method@2.107.0) (2021-10-19)
175
173
 
176
174
  ### Features
177
175
 
178
- - **framer-scroller:** better defaults so the Scroller doesn't look broken when providing no props
179
- ([b177ce9](https://github.com/ho-nl/m2-pwa/commit/b177ce9570abb9ccfd4eb5cc34e43d157bb4e81a))
176
+ - **framer-scroller:** better defaults so the Scroller doesn't look broken when providing no props ([b177ce9](https://github.com/ho-nl/m2-pwa/commit/b177ce9570abb9ccfd4eb5cc34e43d157bb4e81a))
180
177
 
181
178
  ## [2.106.5](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.106.4...@graphcommerce/magento-cart-payment-method@2.106.5) (2021-10-08)
182
179
 
183
180
  ### Bug Fixes
184
181
 
185
- - make sure we can useCartLock on the success page
186
- ([139349a](https://github.com/ho-nl/m2-pwa/commit/139349a73836c0c58c5d8000a801c912dbe23b3b))
182
+ - make sure we can useCartLock on the success page ([139349a](https://github.com/ho-nl/m2-pwa/commit/139349a73836c0c58c5d8000a801c912dbe23b3b))
187
183
 
188
184
  ## [2.106.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.106.3...@graphcommerce/magento-cart-payment-method@2.106.4) (2021-10-07)
189
185
 
190
186
  ### Bug Fixes
191
187
 
192
- - make sure if no payment method is filled in we get an error shown
193
- ([a203e57](https://github.com/ho-nl/m2-pwa/commit/a203e570caad0732427a178e8e8b10b4a15d676b))
188
+ - make sure if no payment method is filled in we get an error shown ([a203e57](https://github.com/ho-nl/m2-pwa/commit/a203e570caad0732427a178e8e8b10b4a15d676b))
194
189
 
195
190
  # [2.106.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.105.11...@graphcommerce/magento-cart-payment-method@2.106.0) (2021-10-04)
196
191
 
197
192
  ### Features
198
193
 
199
- - sort payment methods by availability
200
- ([52f5d45](https://github.com/ho-nl/m2-pwa/commit/52f5d450a7a2fdec0c7eea9cd5d48336cb304138))
194
+ - sort payment methods by availability ([52f5d45](https://github.com/ho-nl/m2-pwa/commit/52f5d450a7a2fdec0c7eea9cd5d48336cb304138))
201
195
 
202
196
  ## [2.105.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.105.0...@graphcommerce/magento-cart-payment-method@2.105.1) (2021-09-27)
203
197
 
@@ -207,81 +201,50 @@ All notable changes to this project will be documented in this file. See
207
201
 
208
202
  ### Bug Fixes
209
203
 
210
- - **checkout:** purchaseorder and other build in methods wouldnt properly submit
211
- ([331cb8e](https://github.com/ho-nl/m2-pwa/commit/331cb8e2bed58c14cd41fceeab03e2cdfbe7e6a9))
212
- - do not use ToggleButtonGroup, only use the ToggleButton
213
- ([5172f70](https://github.com/ho-nl/m2-pwa/commit/5172f709ee26122b0a8700afb4325f23cb9ba9b9))
214
- - ignore md files from triggering version updates
215
- ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
216
- - implement next-ui barrel imports
217
- ([75bea70](https://github.com/ho-nl/m2-pwa/commit/75bea703dba898f18a2a1dfa3243ebd0a4e6f0e1))
218
- - paymentDone removed in favor of a more simple clearCart method
219
- ([5314f77](https://github.com/ho-nl/m2-pwa/commit/5314f7752c2f75a55dcd926bfc26607124561e5d))
220
- - playwright can't find the place order button
221
- ([b1fda5b](https://github.com/ho-nl/m2-pwa/commit/b1fda5b3e403dad621aba8ed895427f2166bc985))
222
- - **playwright:** checkout button was renamed
223
- ([09e5b79](https://github.com/ho-nl/m2-pwa/commit/09e5b79333708cfac04232d8071d1dad72968297))
224
- - rename NextButton to Button, change imports
225
- ([976adb0](https://github.com/ho-nl/m2-pwa/commit/976adb0bf906310d1efce888dcc9be1e28ce0f1b))
204
+ - **checkout:** purchaseorder and other build in methods wouldnt properly submit ([331cb8e](https://github.com/ho-nl/m2-pwa/commit/331cb8e2bed58c14cd41fceeab03e2cdfbe7e6a9))
205
+ - do not use ToggleButtonGroup, only use the ToggleButton ([5172f70](https://github.com/ho-nl/m2-pwa/commit/5172f709ee26122b0a8700afb4325f23cb9ba9b9))
206
+ - ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
207
+ - implement next-ui barrel imports ([75bea70](https://github.com/ho-nl/m2-pwa/commit/75bea703dba898f18a2a1dfa3243ebd0a4e6f0e1))
208
+ - paymentDone removed in favor of a more simple clearCart method ([5314f77](https://github.com/ho-nl/m2-pwa/commit/5314f7752c2f75a55dcd926bfc26607124561e5d))
209
+ - playwright can't find the place order button ([b1fda5b](https://github.com/ho-nl/m2-pwa/commit/b1fda5b3e403dad621aba8ed895427f2166bc985))
210
+ - **playwright:** checkout button was renamed ([09e5b79](https://github.com/ho-nl/m2-pwa/commit/09e5b79333708cfac04232d8071d1dad72968297))
211
+ - rename NextButton to Button, change imports ([976adb0](https://github.com/ho-nl/m2-pwa/commit/976adb0bf906310d1efce888dcc9be1e28ce0f1b))
226
212
 
227
213
  ### Features
228
214
 
229
- - **cart:** when a cart is not active anymore show a clear cart button
230
- ([5d04a14](https://github.com/ho-nl/m2-pwa/commit/5d04a14726c040b20b34c0b88f923aee1dff22e5))
231
- - coupon form on payment page
232
- ([a163961](https://github.com/ho-nl/m2-pwa/commit/a1639617be756b357177fcce255cf662c5314499))
233
- - **graphql:** introduced new graphql package that holds all generated files
234
- ([a3e7aa0](https://github.com/ho-nl/m2-pwa/commit/a3e7aa05540540533b5ced9a95f1f802ecbe499f))
235
- - **image:** introduced completely rewritten Image component
236
- ([e3413b3](https://github.com/ho-nl/m2-pwa/commit/e3413b3a57392d6571ea64cb8d9c8dca05ea31df))
237
- - implemented checkmo payment method
238
- ([18525b2](https://github.com/ho-nl/m2-pwa/commit/18525b2f4efe9bd0eea12a7a992d284f341e0c68))
239
- - implemented purchase order
240
- ([3a40033](https://github.com/ho-nl/m2-pwa/commit/3a40033cd4d6712a17bb9c41a8841ebf7aa2f025))
241
- - implemented the new mollie payment api
242
- ([a8b38a9](https://github.com/ho-nl/m2-pwa/commit/a8b38a9a45207e180f795e81bf5ac759f01a583d))
243
- - **mollie:** first version of mollie payment methods
244
- ([e2f7d78](https://github.com/ho-nl/m2-pwa/commit/e2f7d78e50a9afe928f1d8c478f946e03c63b0f2))
245
- - **mollie:** pay with credit card made working
246
- ([5cda84e](https://github.com/ho-nl/m2-pwa/commit/5cda84e0b9c54238ae6adaa34f9e2ad77a708508))
247
- - next.js 11
248
- ([7d61407](https://github.com/ho-nl/m2-pwa/commit/7d614075a778f488045034f74be4f75b93f63c43))
249
- - only show free payment method when zero subtotal quote
250
- ([fd3ba86](https://github.com/ho-nl/m2-pwa/commit/fd3ba86d3060ebe7dc72ce27fca21464b46b4392))
251
- - **payment-agreements-form:** checkout agreements checkboxes
252
- ([13c8164](https://github.com/ho-nl/m2-pwa/commit/13c816499d220a2ce940672a95beca508b78ddc9))
253
- - **payments:** make PaymentMethodContext injectable
254
- ([68c664a](https://github.com/ho-nl/m2-pwa/commit/68c664adb7eb6eb86d7a819213deb87152392347))
255
- - **playwright:** added new playwright package to enable browser testing
256
- ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
257
- - **react-hook-form:** added buttonState to ComposedSubmit
258
- ([57e77c2](https://github.com/ho-nl/m2-pwa/commit/57e77c29f17720f7f3ee3b63be82779c0e5d8714))
259
- - renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of
260
- [@reachdigital](https://github.com/reachdigital)
261
- ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
262
- - solve issue where the order couldn’t be submitted
263
- ([ec0d357](https://github.com/ho-nl/m2-pwa/commit/ec0d3579a1277976e2dc515f420996cf716f83a6))
264
- - upgraded to nextjs 11
265
- ([0053beb](https://github.com/ho-nl/m2-pwa/commit/0053beb7ef597c190add7264256a0eaec35868da))
266
- - useFormMutationCart and simpler imports
267
- ([012f090](https://github.com/ho-nl/m2-pwa/commit/012f090e8f54d09f35d393c61ad1e2319f5a90ff))
215
+ - **cart:** when a cart is not active anymore show a clear cart button ([5d04a14](https://github.com/ho-nl/m2-pwa/commit/5d04a14726c040b20b34c0b88f923aee1dff22e5))
216
+ - coupon form on payment page ([a163961](https://github.com/ho-nl/m2-pwa/commit/a1639617be756b357177fcce255cf662c5314499))
217
+ - **graphql:** introduced new graphql package that holds all generated files ([a3e7aa0](https://github.com/ho-nl/m2-pwa/commit/a3e7aa05540540533b5ced9a95f1f802ecbe499f))
218
+ - **image:** introduced completely rewritten Image component ([e3413b3](https://github.com/ho-nl/m2-pwa/commit/e3413b3a57392d6571ea64cb8d9c8dca05ea31df))
219
+ - implemented checkmo payment method ([18525b2](https://github.com/ho-nl/m2-pwa/commit/18525b2f4efe9bd0eea12a7a992d284f341e0c68))
220
+ - implemented purchase order ([3a40033](https://github.com/ho-nl/m2-pwa/commit/3a40033cd4d6712a17bb9c41a8841ebf7aa2f025))
221
+ - implemented the new mollie payment api ([a8b38a9](https://github.com/ho-nl/m2-pwa/commit/a8b38a9a45207e180f795e81bf5ac759f01a583d))
222
+ - **mollie:** first version of mollie payment methods ([e2f7d78](https://github.com/ho-nl/m2-pwa/commit/e2f7d78e50a9afe928f1d8c478f946e03c63b0f2))
223
+ - **mollie:** pay with credit card made working ([5cda84e](https://github.com/ho-nl/m2-pwa/commit/5cda84e0b9c54238ae6adaa34f9e2ad77a708508))
224
+ - next.js 11 ([7d61407](https://github.com/ho-nl/m2-pwa/commit/7d614075a778f488045034f74be4f75b93f63c43))
225
+ - only show free payment method when zero subtotal quote ([fd3ba86](https://github.com/ho-nl/m2-pwa/commit/fd3ba86d3060ebe7dc72ce27fca21464b46b4392))
226
+ - **payment-agreements-form:** checkout agreements checkboxes ([13c8164](https://github.com/ho-nl/m2-pwa/commit/13c816499d220a2ce940672a95beca508b78ddc9))
227
+ - **payments:** make PaymentMethodContext injectable ([68c664a](https://github.com/ho-nl/m2-pwa/commit/68c664adb7eb6eb86d7a819213deb87152392347))
228
+ - **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
229
+ - **react-hook-form:** added buttonState to ComposedSubmit ([57e77c2](https://github.com/ho-nl/m2-pwa/commit/57e77c29f17720f7f3ee3b63be82779c0e5d8714))
230
+ - renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of [@reachdigital](https://github.com/reachdigital) ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
231
+ - solve issue where the order couldn’t be submitted ([ec0d357](https://github.com/ho-nl/m2-pwa/commit/ec0d3579a1277976e2dc515f420996cf716f83a6))
232
+ - upgraded to nextjs 11 ([0053beb](https://github.com/ho-nl/m2-pwa/commit/0053beb7ef597c190add7264256a0eaec35868da))
233
+ - useFormMutationCart and simpler imports ([012f090](https://github.com/ho-nl/m2-pwa/commit/012f090e8f54d09f35d393c61ad1e2319f5a90ff))
268
234
 
269
235
  ### Reverts
270
236
 
271
- - Revert "chore: upgrade @apollo/client"
272
- ([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
237
+ - Revert "chore: upgrade @apollo/client" ([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
273
238
 
274
239
  # Change Log
275
240
 
276
- All notable changes to this project will be documented in this file. See
277
- [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
241
+ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
278
242
 
279
243
  # [2.104.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.103.18...@graphcommerce/magento-cart-payment-method@2.104.0) (2021-09-24)
280
244
 
281
245
  ### Features
282
246
 
283
- - **payment-agreements-form:** checkout agreements checkboxes
284
- ([13c8164](https://github.com/ho-nl/m2-pwa/commit/13c816499d220a2ce940672a95beca508b78ddc9))
247
+ - **payment-agreements-form:** checkout agreements checkboxes ([13c8164](https://github.com/ho-nl/m2-pwa/commit/13c816499d220a2ce940672a95beca508b78ddc9))
285
248
 
286
249
  ## [2.103.15](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.103.14...@graphcommerce/magento-cart-payment-method@2.103.15) (2021-09-23)
287
250
 
@@ -289,61 +252,52 @@ All notable changes to this project will be documented in this file. See
289
252
 
290
253
  ### Bug Fixes
291
254
 
292
- - do not use ToggleButtonGroup, only use the ToggleButton
293
- ([5172f70](https://github.com/ho-nl/m2-pwa/commit/5172f709ee26122b0a8700afb4325f23cb9ba9b9))
255
+ - do not use ToggleButtonGroup, only use the ToggleButton ([5172f70](https://github.com/ho-nl/m2-pwa/commit/5172f709ee26122b0a8700afb4325f23cb9ba9b9))
294
256
 
295
257
  ## [2.103.12](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.103.11...@graphcommerce/magento-cart-payment-method@2.103.12) (2021-09-01)
296
258
 
297
259
  ### Bug Fixes
298
260
 
299
- - playwright can't find the place order button
300
- ([b1fda5b](https://github.com/ho-nl/m2-pwa/commit/b1fda5b3e403dad621aba8ed895427f2166bc985))
261
+ - playwright can't find the place order button ([b1fda5b](https://github.com/ho-nl/m2-pwa/commit/b1fda5b3e403dad621aba8ed895427f2166bc985))
301
262
 
302
263
  ## [2.103.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.103.3...@graphcommerce/magento-cart-payment-method@2.103.4) (2021-08-17)
303
264
 
304
265
  ### Bug Fixes
305
266
 
306
- - **playwright:** checkout button was renamed
307
- ([09e5b79](https://github.com/ho-nl/m2-pwa/commit/09e5b79333708cfac04232d8071d1dad72968297))
267
+ - **playwright:** checkout button was renamed ([09e5b79](https://github.com/ho-nl/m2-pwa/commit/09e5b79333708cfac04232d8071d1dad72968297))
308
268
 
309
269
  # [2.103.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.102.2...@graphcommerce/magento-cart-payment-method@2.103.0) (2021-08-13)
310
270
 
311
271
  ### Features
312
272
 
313
- - coupon form on payment page
314
- ([a163961](https://github.com/ho-nl/m2-pwa/commit/a1639617be756b357177fcce255cf662c5314499))
273
+ - coupon form on payment page ([a163961](https://github.com/ho-nl/m2-pwa/commit/a1639617be756b357177fcce255cf662c5314499))
315
274
 
316
275
  # [2.102.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.101.10...@graphcommerce/magento-cart-payment-method@2.102.0) (2021-08-12)
317
276
 
318
277
  ### Features
319
278
 
320
- - upgraded to nextjs 11
321
- ([0053beb](https://github.com/ho-nl/m2-pwa/commit/0053beb7ef597c190add7264256a0eaec35868da))
279
+ - upgraded to nextjs 11 ([0053beb](https://github.com/ho-nl/m2-pwa/commit/0053beb7ef597c190add7264256a0eaec35868da))
322
280
 
323
281
  ## [2.101.9](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.101.8...@graphcommerce/magento-cart-payment-method@2.101.9) (2021-08-09)
324
282
 
325
283
  ### Reverts
326
284
 
327
- - Revert "chore: upgrade @apollo/client"
328
- ([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
285
+ - Revert "chore: upgrade @apollo/client" ([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
329
286
 
330
287
  ## [2.101.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.101.2...@graphcommerce/magento-cart-payment-method@2.101.3) (2021-07-29)
331
288
 
332
289
  ### Bug Fixes
333
290
 
334
- - paymentDone removed in favor of a more simple clearCart method
335
- ([5314f77](https://github.com/ho-nl/m2-pwa/commit/5314f7752c2f75a55dcd926bfc26607124561e5d))
291
+ - paymentDone removed in favor of a more simple clearCart method ([5314f77](https://github.com/ho-nl/m2-pwa/commit/5314f7752c2f75a55dcd926bfc26607124561e5d))
336
292
 
337
293
  # [2.101.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.100.19...@graphcommerce/magento-cart-payment-method@2.101.0) (2021-07-26)
338
294
 
339
295
  ### Features
340
296
 
341
- - **playwright:** added new playwright package to enable browser testing
342
- ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
297
+ - **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
343
298
 
344
299
  ## [2.100.11](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart-payment-method@2.100.10...@graphcommerce/magento-cart-payment-method@2.100.11) (2021-07-20)
345
300
 
346
301
  ### Bug Fixes
347
302
 
348
- - ignore md files from triggering version updates
349
- ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
303
+ - ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
@@ -1,29 +1,27 @@
1
- import { ApolloCartErrorAlert } from '@graphcommerce/magento-cart'
2
- import { Button, ButtonProps, LinkOrButton, LinkOrButtonProps } from '@graphcommerce/next-ui'
1
+ import { ApolloCartErrorSnackbar } from '@graphcommerce/magento-cart'
2
+ import { LinkOrButton, LinkOrButtonProps } from '@graphcommerce/next-ui'
3
3
  import { ComposedSubmit, ComposedSubmitRenderComponentProps } from '@graphcommerce/react-hook-form'
4
4
  import { usePaymentMethodContext } from '../PaymentMethodContext/PaymentMethodContext'
5
5
 
6
6
  export type PaymentMethodButtonProps = LinkOrButtonProps & { display?: 'inline' | 'block' }
7
7
 
8
- export function PaymentMethodButtonRenderer(
8
+ function PaymentMethodButtonRenderer(
9
9
  props: { buttonProps: LinkOrButtonProps } & ComposedSubmitRenderComponentProps,
10
10
  ) {
11
11
  const { buttonProps, error, buttonState, submit } = props
12
12
  const { selectedMethod, selectedModule } = usePaymentMethodContext()
13
13
 
14
- const btnProps = { ...buttonProps, name: 'placeOrder' }
15
-
16
14
  const PaymentButton = selectedModule?.PaymentButton
17
15
 
18
16
  return (
19
17
  <>
20
18
  {!PaymentButton || !selectedMethod?.code ? (
21
19
  <LinkOrButton
22
- {...btnProps}
20
+ {...buttonProps}
23
21
  onClick={submit}
24
22
  loading={buttonState.isSubmitting || (buttonState.isSubmitSuccessful && !error)}
25
23
  >
26
- {btnProps.children}
24
+ {buttonProps.children}
27
25
  {selectedMethod?.title && (
28
26
  <>
29
27
  {' '}
@@ -35,7 +33,7 @@ export function PaymentMethodButtonRenderer(
35
33
  <PaymentButton
36
34
  {...selectedMethod}
37
35
  buttonProps={{
38
- ...btnProps,
36
+ ...buttonProps,
39
37
  onClick: submit,
40
38
  loading: buttonState.isSubmitting || (buttonState.isSubmitSuccessful && !error),
41
39
  }}
@@ -45,7 +43,7 @@ export function PaymentMethodButtonRenderer(
45
43
  )
46
44
  }
47
45
 
48
- export default function PaymentMethodButton(props: PaymentMethodButtonProps) {
46
+ export function PaymentMethodButton(props: PaymentMethodButtonProps) {
49
47
  const { display, ...buttonProps } = props
50
48
 
51
49
  return (
@@ -65,7 +63,7 @@ export default function PaymentMethodButton(props: PaymentMethodButtonProps) {
65
63
  ) : (
66
64
  <>
67
65
  {button}
68
- <ApolloCartErrorAlert key='error' error={errorVal} />
66
+ <ApolloCartErrorSnackbar key='error' error={errorVal} />
69
67
  </>
70
68
  )
71
69
  }}
@@ -1,15 +1,15 @@
1
1
  import { useCartQuery } from '@graphcommerce/magento-cart'
2
- import React, { PropsWithChildren, useContext, useEffect, useState } from 'react'
2
+ import React, { PropsWithChildren, useContext, useEffect, useMemo, useState } from 'react'
3
3
  import { PaymentMethod, PaymentMethodModules, PaymentModule } from '../Api/PaymentMethod'
4
4
  import { GetPaymentMethodContextDocument } from './GetPaymentMethodContext.gql'
5
5
 
6
6
  type PaymentMethodContextProps = {
7
7
  methods: PaymentMethod[]
8
8
  selectedMethod?: PaymentMethod
9
- setSelectedMethod(method: PaymentMethod | undefined): void
9
+ setSelectedMethod: (method: PaymentMethod | undefined) => void
10
10
  modules: PaymentMethodModules
11
11
  selectedModule?: PaymentModule
12
- setSelectedModule(module: PaymentModule | undefined): void
12
+ setSelectedModule: (module: PaymentModule | undefined) => void
13
13
  }
14
14
 
15
15
  const paymentMethodContext = React.createContext<PaymentMethodContextProps>({
@@ -22,7 +22,7 @@ paymentMethodContext.displayName = 'PaymentMethodContext'
22
22
 
23
23
  type PaymentMethodContextProviderProps = PropsWithChildren<{ modules: PaymentMethodModules }>
24
24
 
25
- export default function PaymentMethodContextProvider(props: PaymentMethodContextProviderProps) {
25
+ export function PaymentMethodContextProvider(props: PaymentMethodContextProviderProps) {
26
26
  const { modules, children } = props
27
27
 
28
28
  const context = useCartQuery(GetPaymentMethodContextDocument)
@@ -53,25 +53,30 @@ export default function PaymentMethodContextProvider(props: PaymentMethodContext
53
53
  ) ?? []
54
54
 
55
55
  const loaded = (await Promise.all(promises)).flat(1).sort((a) => (a.preferred ? 1 : 0))
56
- const sortedMethods = loaded.sort((a, b) =>
57
- !modules?.[a?.code] ? 0 : !modules?.[b?.code] ? -1 : 1,
58
- )
56
+ const sortedMethods = loaded.sort((a, b) => {
57
+ if (!modules?.[a?.code]) return 0
58
+ if (!modules?.[b?.code]) return -1
59
+ return 1
60
+ })
59
61
 
60
62
  setMethods(sortedMethods)
61
63
  })()
62
64
  }, [cartContext, modules])
63
65
 
66
+ const value = useMemo(
67
+ () => ({
68
+ methods,
69
+ selectedMethod,
70
+ setSelectedMethod,
71
+ modules,
72
+ selectedModule,
73
+ setSelectedModule,
74
+ }),
75
+ [methods, modules, selectedMethod, selectedModule],
76
+ )
77
+
64
78
  return (
65
- <paymentMethodContext.Provider
66
- value={{
67
- methods,
68
- selectedMethod,
69
- setSelectedMethod,
70
- modules,
71
- selectedModule,
72
- setSelectedModule,
73
- }}
74
- >
79
+ <paymentMethodContext.Provider value={value}>
75
80
  {Object.entries(modules).map(([method, module]) => {
76
81
  const { PaymentHandler } = module
77
82
  if (!PaymentHandler) return null
@@ -8,9 +8,7 @@ const name = 'PaymentMethodOptions' as const
8
8
  const parts = ['root'] as const
9
9
  const { classes } = extendableComponent(name, parts)
10
10
 
11
- export default function PaymentMethodOptions(
12
- props: PaymentMethodOptionsProps & { sx?: SxProps<Theme> },
13
- ) {
11
+ export function PaymentMethodOptions(props: PaymentMethodOptionsProps & { sx?: SxProps<Theme> }) {
14
12
  const { sx = [], ...optionsProps } = props
15
13
  const { selectedMethod, selectedModule } = usePaymentMethodContext()
16
14
 
@@ -4,7 +4,7 @@ import { PaymentOptionsProps } from '../Api/PaymentMethod'
4
4
  import { PaymentMethodOptionsNoopDocument } from './PaymentMethodOptionsNoop.gql'
5
5
 
6
6
  /** It sets the selected payment method on the cart. */
7
- function PaymentMethodOptionsNoop(props: PaymentOptionsProps) {
7
+ export function PaymentMethodOptionsNoop(props: PaymentOptionsProps) {
8
8
  const { code, step } = props
9
9
 
10
10
  /**
@@ -26,5 +26,3 @@ function PaymentMethodOptionsNoop(props: PaymentOptionsProps) {
26
26
  </form>
27
27
  )
28
28
  }
29
-
30
- export default PaymentMethodOptionsNoop
@@ -3,7 +3,7 @@ import { usePaymentMethodContext } from '../PaymentMethodContext/PaymentMethodCo
3
3
 
4
4
  export type PaymentMethodPlaceOrderProps = Pick<UseFormComposeOptions, 'step'>
5
5
 
6
- export default function PaymentMethodPlaceOrder(props: PaymentMethodPlaceOrderProps) {
6
+ export function PaymentMethodPlaceOrder(props: PaymentMethodPlaceOrderProps) {
7
7
  const { step } = props
8
8
  const { selectedMethod, selectedModule } = usePaymentMethodContext()
9
9
 
@@ -9,7 +9,7 @@ import { useEffect } from 'react'
9
9
  import { PaymentPlaceOrderProps } from '../Api/PaymentMethod'
10
10
  import { PaymentMethodPlaceOrderNoopDocument } from './PaymentMethodPlaceOrderNoop.gql'
11
11
 
12
- export default function PaymentMethodPlaceOrderNoop(props: PaymentPlaceOrderProps) {
12
+ export function PaymentMethodPlaceOrderNoop(props: PaymentPlaceOrderProps) {
13
13
  const { step, code } = props
14
14
  const clearCurrentCartId = useClearCurrentCartId()
15
15
 
@@ -23,7 +23,7 @@ export default function PaymentMethodPlaceOrderNoop(props: PaymentPlaceOrderProp
23
23
  if (!data?.placeOrder?.order || error || !cartId) return
24
24
  clearCurrentCartId()
25
25
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
26
- push({ pathname: '/checkout/success', query: { cartId } })
26
+ push({ pathname: '/checkout/success', query: { cart_id: cartId } })
27
27
  }, [cartId, clearCurrentCartId, data?.placeOrder?.order, error, push])
28
28
 
29
29
  const submit = handleSubmit(() => {})
@@ -5,7 +5,7 @@ import {
5
5
  iconChevronLeft,
6
6
  iconChevronRight,
7
7
  responsiveVal,
8
- SvgIcon,
8
+ IconSvg,
9
9
  ToggleButton,
10
10
  extendableComponent,
11
11
  } from '@graphcommerce/next-ui'
@@ -47,7 +47,7 @@ const parts = [
47
47
  ] as const
48
48
  const { classes } = extendableComponent(cmpName, parts)
49
49
 
50
- export default function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
50
+ export function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
51
51
  const { step, sx = [] } = props
52
52
  const { methods, selectedMethod, setSelectedMethod, setSelectedModule, modules } =
53
53
  usePaymentMethodContext()
@@ -117,7 +117,7 @@ export default function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
117
117
  borderBottomLeftRadius: 4,
118
118
  })}
119
119
  >
120
- <SvgIcon src={iconChevronLeft} size='small' />
120
+ <IconSvg src={iconChevronLeft} size='small' />
121
121
  </ScrollerButton>
122
122
  </Box>
123
123
 
@@ -141,7 +141,7 @@ export default function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
141
141
  }}
142
142
  >
143
143
  {methods?.map((pm) => {
144
- const buttonValue = `${pm.code}___${pm.child}`
144
+ const buttonValue = pm.child ? `${pm.code}___${pm.child}` : pm.code
145
145
  return (
146
146
  <ToggleButton
147
147
  name={name}
@@ -209,7 +209,7 @@ export default function PaymentMethodToggles(props: PaymentMethodTogglesProps) {
209
209
  borderBottomRightRadius: 4,
210
210
  })}
211
211
  >
212
- <SvgIcon src={iconChevronRight} size='small' />
212
+ <IconSvg src={iconChevronRight} size='small' />
213
213
  </ScrollerButton>
214
214
  </Box>
215
215
  </ScrollerProvider>
@@ -1,7 +1,10 @@
1
- import { useApolloClient } from '@graphcommerce/graphql'
2
- import { useCartQuery, useCurrentCartId } from '@graphcommerce/magento-cart'
3
- import { useCallback } from 'react'
4
- import { UseCartLockDocument } from './UseCartLock.gql'
1
+ import { useCurrentCartId } from '@graphcommerce/magento-cart'
2
+ import { useUrlQuery } from '@graphcommerce/next-ui'
3
+
4
+ export type CartLockState = {
5
+ cart_id?: string
6
+ locked?: string
7
+ }
5
8
 
6
9
  /**
7
10
  * Locking a cart might is usefull in the following cases: We want to disable cart modifications
@@ -9,25 +12,15 @@ import { UseCartLockDocument } from './UseCartLock.gql'
9
12
  *
10
13
  * Todo: Block all operations on the cart while the cart is being blocked.
11
14
  */
12
- export function useCartLock() {
13
- const { cache } = useApolloClient()
14
- const cartId = useCurrentCartId()
15
-
16
- const locked = useCartQuery(UseCartLockDocument, { allowUrl: true }).data?.cart?.locked ?? false
15
+ export function useCartLock<E extends Record<string, string | undefined>>() {
16
+ const currentCartId = useCurrentCartId()
17
17
 
18
- const lock = useCallback(
19
- (locking: boolean) => {
20
- if (!cartId) return
18
+ const [queryState, setRouterQuery] = useUrlQuery<CartLockState & E>((params) => params)
21
19
 
22
- cache.writeQuery({
23
- query: UseCartLockDocument,
24
- data: { cart: { __typename: 'Cart', id: cartId, locked: locking } },
25
- variables: { cartId },
26
- broadcast: true,
27
- })
28
- },
29
- [cache, cartId],
30
- )
20
+ const lock = (params: CartLockState & E) => {
21
+ if (!currentCartId) return
22
+ setRouterQuery({ locked: '1', cart_id: currentCartId, ...params })
23
+ }
31
24
 
32
- return { locked, lock }
25
+ return [queryState, lock] as const
33
26
  }
package/index.ts CHANGED
@@ -1,19 +1,10 @@
1
1
  export * from './Api/PaymentMethod'
2
2
  export * from './hooks'
3
-
4
- export * from './PaymentMethodContext/PaymentMethodContext'
5
- export { default as PaymentMethodContextProvider } from './PaymentMethodContext/PaymentMethodContext'
6
-
7
3
  export * from './PaymentMethodButton/PaymentMethodButton'
8
- export { default as PaymentMethodButton } from './PaymentMethodButton/PaymentMethodButton'
9
-
10
- export { default as PaymentMethodOptions } from './PaymentMethodOptions/PaymentMethodOptions'
11
-
4
+ export * from './PaymentMethodContext/PaymentMethodContext'
5
+ export * from './PaymentMethodOptions/PaymentMethodOptions'
6
+ export * from './PaymentMethodOptionsNoop/PaymentMethodOptionsNoop'
12
7
  export * from './PaymentMethodOptionsNoop/PaymentMethodOptionsNoop.gql'
13
- export { default as PaymentMethodOptionsNoop } from './PaymentMethodOptionsNoop/PaymentMethodOptionsNoop'
14
-
15
- export { default as PaymentMethodPlaceOrder } from './PaymentMethodPlaceOrder/PaymentMethodPlaceOrder'
16
- export { default as PaymentMethodPlaceOrderNoop } from './PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop'
17
-
8
+ export * from './PaymentMethodPlaceOrder/PaymentMethodPlaceOrder'
9
+ export * from './PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop'
18
10
  export * from './PaymentMethodToggles/PaymentMethodToggles'
19
- export { default as PaymentMethodToggles } from './PaymentMethodToggles/PaymentMethodToggles'
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": "3.0.3",
5
+ "version": "3.0.6",
6
6
  "sideEffects": false,
7
7
  "engines": {
8
8
  "node": "14.x"
@@ -15,20 +15,20 @@
15
15
  }
16
16
  },
17
17
  "devDependencies": {
18
- "@graphcommerce/eslint-config-pwa": "^4.0.3",
19
- "@graphcommerce/prettier-config-pwa": "^4.0.2",
18
+ "@graphcommerce/eslint-config-pwa": "^4.1.3",
19
+ "@graphcommerce/prettier-config-pwa": "^4.0.5",
20
20
  "@graphcommerce/typescript-config-pwa": "^4.0.2",
21
- "@playwright/test": "^1.19.1"
21
+ "@playwright/test": "^1.20.1",
22
+ "type-fest": "2.12.1"
22
23
  },
23
24
  "dependencies": {
24
- "@graphcommerce/framer-scroller": "^2.0.3",
25
- "@graphcommerce/graphql": "^3.0.3",
26
- "@graphcommerce/image": "^3.1.0",
27
- "@graphcommerce/magento-cart": "^4.1.2",
28
- "@graphcommerce/magento-store": "^4.0.3",
29
- "@graphcommerce/next-ui": "^4.1.2",
30
- "@graphcommerce/react-hook-form": "^3.0.3",
31
- "type-fest": "^2.12.0"
25
+ "@graphcommerce/framer-scroller": "^2.1.3",
26
+ "@graphcommerce/graphql": "^3.0.6",
27
+ "@graphcommerce/image": "^3.1.2",
28
+ "@graphcommerce/magento-cart": "^4.2.2",
29
+ "@graphcommerce/magento-store": "^4.1.4",
30
+ "@graphcommerce/next-ui": "^4.5.0",
31
+ "@graphcommerce/react-hook-form": "^3.0.6"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@lingui/macro": "^3.13.2",
@@ -0,0 +1,25 @@
1
+ import { ApolloClient, NormalizedCacheObject } from '@graphcommerce/graphql'
2
+ import { fillShippingAddressForm } from '@graphcommerce/magento-cart-shipping-address/test/fillShippingAddressForm'
3
+ import { fillCartAgreementsForm } from '@graphcommerce/magento-cart/test/fillCartAgreementsForm'
4
+ import { Page } from '@playwright/test'
5
+
6
+ export const goToPayment = async (
7
+ page: Page,
8
+ apolloClient: ApolloClient<NormalizedCacheObject>,
9
+ ) => {
10
+ await page.locator('a:has-text("View shopping cart")').click()
11
+
12
+ await page.locator('text=Start Checkout').click()
13
+
14
+ const email = page.locator('input[name="email"]')
15
+ await email.click()
16
+ await email.fill('test@test.com')
17
+
18
+ await fillShippingAddressForm(page)
19
+
20
+ await page.click('button[value=flatrate-flatrate]')
21
+ await page.click('#next')
22
+
23
+ // Fill in the agreements
24
+ await fillCartAgreementsForm(page, apolloClient)
25
+ }
@@ -1,7 +0,0 @@
1
- query UseCartLock($cartId: String!) {
2
- cart(cart_id: $cartId) @client {
3
- __typename
4
- id
5
- locked
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- extend type Mutation {
2
- lockCart(lock: Boolean): Boolean
3
- }
4
-
5
- extend type Cart {
6
- locked: Boolean!
7
- }