@graphcommerce/magento-cart 10.0.0-canary.72 → 10.0.1-canary.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +17 -177
  2. package/link/cartLink.ts +4 -11
  3. package/package.json +15 -15
package/CHANGELOG.md CHANGED
@@ -1,56 +1,12 @@
1
1
  # Change Log
2
2
 
3
- ## 10.0.0-canary.72
4
-
5
- ## 10.0.0-canary.71
6
-
7
- ## 10.0.0-canary.70
8
-
9
- ### Major Changes
10
-
11
- - [#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))
12
-
13
- ## 10.0.0-canary.69
14
-
15
- ## 10.0.0-canary.68
16
-
17
- ### Major Changes
18
-
19
- - [#2557](https://github.com/graphcommerce-org/graphcommerce/pull/2557) [`ceaadd8`](https://github.com/graphcommerce-org/graphcommerce/commit/ceaadd87f0648982a068a3b07b1fa149c9127f49) - ## Material UI v5 → v7 Migration
20
-
21
- This release upgrades Material UI from v5 to v7 with full CSS variables support. ([@paales](https://github.com/paales))
22
-
23
- ## 10.0.0-canary.67
3
+ ## 10.0.1-canary.0
24
4
 
25
5
  ### Patch Changes
26
6
 
27
- - [#2540](https://github.com/graphcommerce-org/graphcommerce/pull/2540) [`36e2bac`](https://github.com/graphcommerce-org/graphcommerce/commit/36e2bacb4fe765ce1fcd24dc36736e90bb17a7dc) - Add billingAddress permission (EDITABLE | READONLY) that controls whether the end user can update their billing address in the account section and checkout. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
28
-
29
- ## 10.0.0-canary.66
30
-
31
- ## 10.0.0-canary.65
32
-
33
- ## 10.0.0-canary.64
34
-
35
- ## 10.0.0-canary.63
36
-
37
- ## 10.0.0-canary.62
38
-
39
- ## 10.0.0-canary.61
40
-
41
- ## 10.0.0-canary.60
42
-
43
- ## 10.0.0-canary.59
44
-
45
- ## 10.0.0-canary.58
46
-
47
- ### Patch Changes
48
-
49
- - [`d7ad6a3`](https://github.com/graphcommerce-org/graphcommerce/commit/d7ad6a32acdd0c9540656feae9fbb1d5f5f3dbf9) - Additional export for GetCartTotals ([@paales](https://github.com/paales))
50
-
51
- ## 10.0.0-canary.57
7
+ - [#2568](https://github.com/graphcommerce-org/graphcommerce/pull/2568) [`f1b60ac`](https://github.com/graphcommerce-org/graphcommerce/commit/f1b60accf5e8fdbcba15b7567dce7ff68f37db88) - Solve issue where the cache wasn't available from the context anymore in @apollo/client@4 now uses the operation.client.cache ([@paales](https://github.com/paales))
52
8
 
53
- ## 10.0.0-canary.56
9
+ ## 10.0.0
54
10
 
55
11
  ### Major Changes
56
12
 
@@ -130,121 +86,43 @@
130
86
  - `@mui/*` modern alias rewrites
131
87
  - Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
132
88
 
133
- ## 9.1.0-canary.55
89
+ - [#2557](https://github.com/graphcommerce-org/graphcommerce/pull/2557) [`ceaadd8`](https://github.com/graphcommerce-org/graphcommerce/commit/ceaadd87f0648982a068a3b07b1fa149c9127f49) - ## Material UI v5 → v7 Migration
90
+
91
+ This release upgrades Material UI from v5 to v7 with full CSS variables support. ([@paales](https://github.com/paales))
92
+
93
+ - [#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))
134
94
 
135
95
  ### Patch Changes
136
96
 
137
97
  - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`cf44b1f`](https://github.com/graphcommerce-org/graphcommerce/commit/cf44b1f723b7f2073a21abd6821768427cb95315) - Added hideTotals to MultiCartStartCheckout ([@paales](https://github.com/paales))
138
98
 
99
+ - [`d7ad6a3`](https://github.com/graphcommerce-org/graphcommerce/commit/d7ad6a32acdd0c9540656feae9fbb1d5f5f3dbf9) - Additional export for GetCartTotals ([@paales](https://github.com/paales))
100
+
139
101
  - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`af4463d`](https://github.com/graphcommerce-org/graphcommerce/commit/af4463dcbc6903241c8804ffba2f43b2b8e1a00b) - When running a cart mutation and the cartId is already passed to the form we use that value instead of retrieving the current cart again. ([@paales](https://github.com/paales))
140
102
 
103
+ - [#2540](https://github.com/graphcommerce-org/graphcommerce/pull/2540) [`36e2bac`](https://github.com/graphcommerce-org/graphcommerce/commit/36e2bacb4fe765ce1fcd24dc36736e90bb17a7dc) - Add billingAddress permission (EDITABLE | READONLY) that controls whether the end user can update their billing address in the account section and checkout. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
104
+
141
105
  - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`415f9fb`](https://github.com/graphcommerce-org/graphcommerce/commit/415f9fb50454fb20cb533235969dd9ab4ffc134b) - Allow setting the cartId in the form for useFormGqlMutationCart by setting the cartId in the form AND allow setting the cartId for a whole context by wrapping with CartIdProvider ([@paales](https://github.com/paales))
142
106
 
143
107
  - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`4e3f3f2`](https://github.com/graphcommerce-org/graphcommerce/commit/4e3f3f2df58638ba8ffc68ee9f274cdd6c45d6d4) - Allow setting the redirect value in the AddProductsToCartForm as a form value. ([@paales](https://github.com/paales))
144
108
 
145
- - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`af4463d`](https://github.com/graphcommerce-org/graphcommerce/commit/af4463dcbc6903241c8804ffba2f43b2b8e1a00b) - Solve issue where if the onBeforeSubmit would return false, it would still error if submitted while the cart is locked. ([@paales](https://github.com/paales))
146
-
147
- - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`1a06135`](https://github.com/graphcommerce-org/graphcommerce/commit/1a061357f4ccb430dd13194f755815474e140520) - Allow awaitable async requests for onStart on checkout button ([@paales](https://github.com/paales))
148
-
149
- ## 9.1.0-canary.54
150
-
151
- ## 9.1.0-canary.53
152
-
153
- ## 9.1.0-canary.52
154
-
155
- ## 9.1.0-canary.51
156
-
157
- ### Patch Changes
158
-
159
109
  - [#2537](https://github.com/graphcommerce-org/graphcommerce/pull/2537) [`1f37f05`](https://github.com/graphcommerce-org/graphcommerce/commit/1f37f05200e3015bf36d450bffff40c5d551ec54) - Forwarded ref to AddProductsToCartButton ([@paales](https://github.com/paales))
160
110
 
161
- ## 9.1.0-canary.50
162
-
163
- ## 9.1.0-canary.49
164
-
165
- ## 9.1.0-canary.48
166
-
167
- ## 9.1.0-canary.47
168
-
169
- ## 9.1.0-canary.46
170
-
171
- ## 9.1.0-canary.45
172
-
173
- ## 9.1.0-canary.44
174
-
175
- ## 9.1.0-canary.43
176
-
177
- ## 9.1.0-canary.42
178
-
179
- ## 9.1.0-canary.41
180
-
181
- ## 9.1.0-canary.40
182
-
183
- ### Patch Changes
111
+ - [#2479](https://github.com/graphcommerce-org/graphcommerce/pull/2479) [`ae5e72c`](https://github.com/graphcommerce-org/graphcommerce/commit/ae5e72ccf1c8218ace3cca1c4e52ec8d46821a27) - Solve issue where the total of the cart was zero due to discount or store credit the user couldn't proceed to the checkout. We now check for items and errors instead of the total. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
184
112
 
185
113
  - [#2529](https://github.com/graphcommerce-org/graphcommerce/pull/2529) [`b331f4d`](https://github.com/graphcommerce-org/graphcommerce/commit/b331f4d060c1385569fbbe1592ac245832de55bc) - Remove all usages of the NoSsr component as the GraphQL layer already handles this. ([@paales](https://github.com/paales))
186
114
 
187
- ## 9.1.0-canary.39
188
-
189
- ## 9.1.0-canary.38
190
-
191
- ## 9.1.0-canary.37
192
-
193
- ## 9.1.0-canary.36
194
-
195
- ## 9.1.0-canary.35
196
-
197
- ## 9.1.0-canary.34
198
-
199
- ## 9.1.0-canary.33
200
-
201
- ## 9.1.0-canary.32
202
-
203
- ## 9.1.0-canary.31
204
-
205
- ## 9.1.0-canary.30
206
-
207
- ## 9.1.0-canary.29
208
-
209
- ## 9.1.0-canary.28
210
-
211
- ## 9.1.0-canary.27
212
-
213
- ## 9.1.0-canary.26
214
-
215
- ## 9.1.0-canary.25
216
-
217
- ## 9.1.0-canary.24
218
-
219
- ## 9.1.0-canary.23
220
-
221
- ### Patch Changes
222
-
223
115
  - [#2521](https://github.com/graphcommerce-org/graphcommerce/pull/2521) [`6847259`](https://github.com/graphcommerce-org/graphcommerce/commit/6847259715b0cebcc3f7415ed06cc38814663811) - Solve typescript issue were product types were added incorrectly. ([@paales](https://github.com/paales))
224
116
 
225
- ## 9.1.0-canary.22
226
-
227
- ## 9.1.0-canary.21
228
-
229
- ## 9.1.0-canary.20
230
-
231
- ## 9.1.0-canary.19
232
-
233
- ### Patch Changes
234
-
235
117
  - [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`35fdadd`](https://github.com/graphcommerce-org/graphcommerce/commit/35fdadd8896619a2c84e91e39279f5928c0c9007) - Removed deprecated fields from AddProductsToCartForm ([@paales](https://github.com/paales))
236
118
 
237
- - [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`b26f573`](https://github.com/graphcommerce-org/graphcommerce/commit/b26f57307ab1d08f628183dd86e487ec9aa1e5cf) - Moved all functionality from the @graphcommerce/magento-cart-billing-address package to the @graphcommerce/magento-cart package. All occurences of @graphcommerce/magento-cart-billing-address should be removed for your codebase. ([@paales](https://github.com/paales))
238
-
239
- ## 9.1.0-canary.18
240
-
241
- ## 9.1.0-canary.17
119
+ - [#2485](https://github.com/graphcommerce-org/graphcommerce/pull/2485) [`6533728`](https://github.com/graphcommerce-org/graphcommerce/commit/65337280c6f4291cf4354e6ed9659f03388ca8d4) - When ordering a virtual product the checkout would still reference a Track & Trace ([@paales](https://github.com/paales))
242
120
 
243
- ## 9.1.0-canary.16
121
+ - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`af4463d`](https://github.com/graphcommerce-org/graphcommerce/commit/af4463dcbc6903241c8804ffba2f43b2b8e1a00b) - Solve issue where if the onBeforeSubmit would return false, it would still error if submitted while the cart is locked. ([@paales](https://github.com/paales))
244
122
 
245
- ## 9.1.0-canary.15
123
+ - [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`b26f573`](https://github.com/graphcommerce-org/graphcommerce/commit/b26f57307ab1d08f628183dd86e487ec9aa1e5cf) - Moved all functionality from the @graphcommerce/magento-cart-billing-address package to the @graphcommerce/magento-cart package. All occurences of @graphcommerce/magento-cart-billing-address should be removed for your codebase. ([@paales](https://github.com/paales))
246
124
 
247
- ### Patch Changes
125
+ - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`1a06135`](https://github.com/graphcommerce-org/graphcommerce/commit/1a061357f4ccb430dd13194f755815474e140520) - Allow awaitable async requests for onStart on checkout button ([@paales](https://github.com/paales))
248
126
 
249
127
  - [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`4cde990`](https://github.com/graphcommerce-org/graphcommerce/commit/4cde990dbeecdba8a00d0e34a1095fb14d8a0ad6) - When the cart totals are updated via a mutation, make sure to also fetch the id when the query is used so that automatically updates. ([@paales](https://github.com/paales))
250
128
 
@@ -252,44 +130,6 @@
252
130
 
253
131
  - [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`b6f76b6`](https://github.com/graphcommerce-org/graphcommerce/commit/b6f76b61f235d3336d8d296f1bed61c9f5daf325) - Solve issue where available_payment_methods would give an apollo client error that it couldn’t be properly merged ([@paales](https://github.com/paales))
254
132
 
255
- ## 9.0.4-canary.14
256
-
257
- ## 9.0.4-canary.13
258
-
259
- ## 9.0.4-canary.12
260
-
261
- ## 9.0.4-canary.11
262
-
263
- ### Patch Changes
264
-
265
- - [#2485](https://github.com/graphcommerce-org/graphcommerce/pull/2485) [`6533728`](https://github.com/graphcommerce-org/graphcommerce/commit/65337280c6f4291cf4354e6ed9659f03388ca8d4) - When ordering a virtual product the checkout would still reference a Track & Trace ([@paales](https://github.com/paales))
266
-
267
- ## 9.0.4-canary.10
268
-
269
- ## 9.0.4-canary.9
270
-
271
- ## 9.0.4-canary.8
272
-
273
- ## 9.0.4-canary.7
274
-
275
- ### Patch Changes
276
-
277
- - [#2479](https://github.com/graphcommerce-org/graphcommerce/pull/2479) [`ae5e72c`](https://github.com/graphcommerce-org/graphcommerce/commit/ae5e72ccf1c8218ace3cca1c4e52ec8d46821a27) - Solve issue where the total of the cart was zero due to discount or store credit the user couldn't proceed to the checkout. We now check for items and errors instead of the total. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
278
-
279
- ## 9.0.4-canary.6
280
-
281
- ## 9.0.4-canary.5
282
-
283
- ## 9.0.4-canary.4
284
-
285
- ## 9.0.4-canary.3
286
-
287
- ## 9.0.4-canary.2
288
-
289
- ## 9.0.4-canary.1
290
-
291
- ## 9.0.4-canary.0
292
-
293
133
  ## 9.0.0
294
134
 
295
135
  ### Major Changes
package/link/cartLink.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { globalApolloClient } from '@graphcommerce/graphql'
2
1
  import { ApolloLink, CombinedGraphQLErrors, ErrorLink } from '@graphcommerce/graphql/apollo'
3
2
  import { filter, from, of, switchMap } from '@graphcommerce/graphql/rxjs'
4
3
  import { CustomerTokenDocument, getCustomerAccountCanSignIn } from '@graphcommerce/magento-customer'
@@ -25,11 +24,6 @@ function errorIsIncluded(errorPath: readonly (string | number)[] | undefined, ke
25
24
  }
26
25
 
27
26
  const cartErrorLink = new ErrorLink(({ error, operation, forward }) => {
28
- if (!globalApolloClient.current) return undefined
29
-
30
- const client = globalApolloClient.current
31
- const { cache } = client
32
-
33
27
  // Check if this is a GraphQL error
34
28
  if (!CombinedGraphQLErrors.is(error)) return undefined
35
29
 
@@ -66,13 +60,13 @@ const cartErrorLink = new ErrorLink(({ error, operation, forward }) => {
66
60
  if (urlParams.get('cart_id')) return forward(operation)
67
61
  }
68
62
 
69
- return from(client?.mutate({ mutation: CreateEmptyCartDocument })).pipe(
63
+ return from(operation.client.mutate({ mutation: CreateEmptyCartDocument })).pipe(
70
64
  filter((value) => Boolean(value)),
71
65
  switchMap((cartData) => {
72
66
  const cartId = cartData.data?.createEmptyCart
73
67
  if (!cartId) return forward(operation)
74
68
 
75
- writeCartId(cache, cartId)
69
+ writeCartId(operation.client.cache, cartId)
76
70
  operation.variables = { ...operation.variables, cartId }
77
71
 
78
72
  // retry the request, returning the new observable
@@ -84,11 +78,10 @@ const cartErrorLink = new ErrorLink(({ error, operation, forward }) => {
84
78
  const cartPermissionLink = (router: PushRouter) =>
85
79
  new ApolloLink((operation, forward) => {
86
80
  const { locale } = router
87
- const { cache } = operation.getContext()
88
81
 
89
82
  if (!isProtectedCartOperation(operation.operationName ?? '')) return forward(operation)
90
83
 
91
- const check = () => Boolean(cache?.readQuery({ query: CustomerTokenDocument }))
84
+ const check = () => Boolean(operation.client.cache.readQuery({ query: CustomerTokenDocument }))
92
85
  if (getCartEnabledForUser(locale, check)) return forward(operation)
93
86
 
94
87
  if (!getCustomerAccountCanSignIn(locale))
@@ -101,7 +94,7 @@ const cartPermissionLink = (router: PushRouter) =>
101
94
 
102
95
  return from(signInAgainPromise).pipe(
103
96
  switchMap(() => {
104
- const tokenQuery = cache?.readQuery({ query: CustomerTokenDocument })
97
+ const tokenQuery = operation.client.cache.readQuery({ query: CustomerTokenDocument })
105
98
 
106
99
  if (tokenQuery?.customerToken?.valid) {
107
100
  // Customer is authenticated, retrying request.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-cart",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "10.0.0-canary.72",
5
+ "version": "10.0.1-canary.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -20,20 +20,20 @@
20
20
  "./plugins/useSignInFormMergeCart": "./plugins/useSignInFormMergeCart.ts"
21
21
  },
22
22
  "peerDependencies": {
23
- "@graphcommerce/ecommerce-ui": "^10.0.0-canary.72",
24
- "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.72",
25
- "@graphcommerce/framer-next-pages": "^10.0.0-canary.72",
26
- "@graphcommerce/framer-scroller": "^10.0.0-canary.72",
27
- "@graphcommerce/framer-utils": "^10.0.0-canary.72",
28
- "@graphcommerce/graphql": "^10.0.0-canary.72",
29
- "@graphcommerce/image": "^10.0.0-canary.72",
30
- "@graphcommerce/magento-customer": "^10.0.0-canary.72",
31
- "@graphcommerce/magento-graphql": "^10.0.0-canary.72",
32
- "@graphcommerce/magento-store": "^10.0.0-canary.72",
33
- "@graphcommerce/next-ui": "^10.0.0-canary.72",
34
- "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.72",
35
- "@graphcommerce/react-hook-form": "^10.0.0-canary.72",
36
- "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.72",
23
+ "@graphcommerce/ecommerce-ui": "^10.0.1-canary.0",
24
+ "@graphcommerce/eslint-config-pwa": "^10.0.1-canary.0",
25
+ "@graphcommerce/framer-next-pages": "^10.0.1-canary.0",
26
+ "@graphcommerce/framer-scroller": "^10.0.1-canary.0",
27
+ "@graphcommerce/framer-utils": "^10.0.1-canary.0",
28
+ "@graphcommerce/graphql": "^10.0.1-canary.0",
29
+ "@graphcommerce/image": "^10.0.1-canary.0",
30
+ "@graphcommerce/magento-customer": "^10.0.1-canary.0",
31
+ "@graphcommerce/magento-graphql": "^10.0.1-canary.0",
32
+ "@graphcommerce/magento-store": "^10.0.1-canary.0",
33
+ "@graphcommerce/next-ui": "^10.0.1-canary.0",
34
+ "@graphcommerce/prettier-config-pwa": "^10.0.1-canary.0",
35
+ "@graphcommerce/react-hook-form": "^10.0.1-canary.0",
36
+ "@graphcommerce/typescript-config-pwa": "^10.0.1-canary.0",
37
37
  "@lingui/core": "^5",
38
38
  "@lingui/macro": "^5",
39
39
  "@lingui/react": "^5",