@graphcommerce/magento-customer 10.0.0 → 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.
- package/CHANGELOG.md +8 -288
- package/components/AccountSignInUpForm/AccountSignInUpForm.tsx +3 -2
- package/components/SignInForm/SignInForm.tsx +0 -2
- package/components/UpdateCustomerEmailForm/UpdateCustomerEmailForm.tsx +3 -3
- package/hooks/useAccountSignInUpForm.tsx +4 -3
- package/link/customerLink.ts +4 -8
- package/link/xMagentoCacheIdHeader.ts +4 -3
- package/package.json +15 -15
- package/typePolicies.ts +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.0.1-canary.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2568](https://github.com/graphcommerce-org/graphcommerce/pull/2568) [`dc57da4`](https://github.com/graphcommerce-org/graphcommerce/commit/dc57da4897365ddb2b779eab3ad2b3a350ed115c) - Moved from form.watch to useWatch everywhere which works even if the fields are later initialized. ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
9
|
+
- [#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))
|
|
10
|
+
|
|
3
11
|
## 10.0.0
|
|
4
12
|
|
|
5
13
|
### Major Changes
|
|
@@ -126,294 +134,6 @@
|
|
|
126
134
|
|
|
127
135
|
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`623e993`](https://github.com/graphcommerce-org/graphcommerce/commit/623e993579b05e053d2d2f29684649cd4f4586de) - `<WaitForCustomer />` now accepts all props of the FullPageMessage ([@paales](https://github.com/paales))
|
|
128
136
|
|
|
129
|
-
## 10.0.0-canary.72
|
|
130
|
-
|
|
131
|
-
## 10.0.0-canary.71
|
|
132
|
-
|
|
133
|
-
## 10.0.0-canary.70
|
|
134
|
-
|
|
135
|
-
### Major Changes
|
|
136
|
-
|
|
137
|
-
- [#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))
|
|
138
|
-
|
|
139
|
-
## 10.0.0-canary.69
|
|
140
|
-
|
|
141
|
-
## 10.0.0-canary.68
|
|
142
|
-
|
|
143
|
-
### Major Changes
|
|
144
|
-
|
|
145
|
-
- [#2557](https://github.com/graphcommerce-org/graphcommerce/pull/2557) [`ceaadd8`](https://github.com/graphcommerce-org/graphcommerce/commit/ceaadd87f0648982a068a3b07b1fa149c9127f49) - ## Material UI v5 → v7 Migration
|
|
146
|
-
|
|
147
|
-
This release upgrades Material UI from v5 to v7 with full CSS variables support. ([@paales](https://github.com/paales))
|
|
148
|
-
|
|
149
|
-
## 10.0.0-canary.67
|
|
150
|
-
|
|
151
|
-
### Patch Changes
|
|
152
|
-
|
|
153
|
-
- [#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))
|
|
154
|
-
|
|
155
|
-
## 10.0.0-canary.66
|
|
156
|
-
|
|
157
|
-
## 10.0.0-canary.65
|
|
158
|
-
|
|
159
|
-
## 10.0.0-canary.64
|
|
160
|
-
|
|
161
|
-
## 10.0.0-canary.63
|
|
162
|
-
|
|
163
|
-
## 10.0.0-canary.62
|
|
164
|
-
|
|
165
|
-
### Patch Changes
|
|
166
|
-
|
|
167
|
-
- [#2553](https://github.com/graphcommerce-org/graphcommerce/pull/2553) [`66ba029`](https://github.com/graphcommerce-org/graphcommerce/commit/66ba029d2cc9dee6f8ff8c92a628d4fc0cf4d309) - Unset token when on magento 248 to prevent repeated graphql-authentication errors ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
168
|
-
|
|
169
|
-
## 10.0.0-canary.61
|
|
170
|
-
|
|
171
|
-
## 10.0.0-canary.60
|
|
172
|
-
|
|
173
|
-
## 10.0.0-canary.59
|
|
174
|
-
|
|
175
|
-
## 10.0.0-canary.58
|
|
176
|
-
|
|
177
|
-
## 10.0.0-canary.57
|
|
178
|
-
|
|
179
|
-
## 10.0.0-canary.56
|
|
180
|
-
|
|
181
|
-
### Major Changes
|
|
182
|
-
|
|
183
|
-
- [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
|
|
184
|
-
|
|
185
|
-
This major release brings full Turbopack compatibility, dramatically improving development speed.
|
|
186
|
-
|
|
187
|
-
### 🚀 Turbopack-Compatible Interceptor System
|
|
188
|
-
|
|
189
|
-
The entire plugin/interceptor system has been rewritten to work with Turbopack:
|
|
190
|
-
|
|
191
|
-
- **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
|
|
192
|
-
- **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
|
|
193
|
-
- **Direct imports** - Interceptors import from `.original` files instead of embedding source
|
|
194
|
-
- **New CLI commands**:
|
|
195
|
-
- `graphcommerce codegen-interceptors` - Generate interceptor files
|
|
196
|
-
- `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
|
|
197
|
-
- **Stable file hashing** - Deterministic interceptor generation for better caching
|
|
198
|
-
|
|
199
|
-
### ⚙️ Treeshakable Configuration System
|
|
200
|
-
|
|
201
|
-
Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
|
|
202
|
-
|
|
203
|
-
- **New `codegen-config-values` command** - Generates TypeScript files with precise typing
|
|
204
|
-
- **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
|
|
205
|
-
- **Fully treeshakable** - Unused config values are eliminated from the bundle
|
|
206
|
-
- **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
|
|
207
|
-
- **Separate files for nested objects** - Optimal treeshaking for complex configurations
|
|
208
|
-
|
|
209
|
-
### 🔧 withGraphCommerce Changes
|
|
210
|
-
|
|
211
|
-
- **Removed** `InterceptorPlugin` - No longer needed with file-based interception
|
|
212
|
-
- **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
|
|
213
|
-
- **Removed** `@mui/*` alias rewrites - No longer required
|
|
214
|
-
- **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
|
|
215
|
-
- **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
|
|
216
|
-
- **Added** `optimizePackageImports` for better bundle optimization
|
|
217
|
-
- **Added** `images.qualities: [52, 75]` for Next.js image optimization
|
|
218
|
-
|
|
219
|
-
### 📦 Lingui Configuration
|
|
220
|
-
|
|
221
|
-
- **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
|
|
222
|
-
- **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
|
|
223
|
-
- **Simplified** formatter options
|
|
224
|
-
|
|
225
|
-
### ⚛️ React 19 & Next.js 16 Compatibility
|
|
226
|
-
|
|
227
|
-
- Updated `RefObject<T>` types for React 19 (now includes `null` by default)
|
|
228
|
-
- Replaced deprecated `React.VFC` with `React.FC`
|
|
229
|
-
- Fixed `useRef` calls to require explicit initial values
|
|
230
|
-
- Updated `MutableRefObject` usage in `framer-scroller`
|
|
231
|
-
|
|
232
|
-
### 📋 ESLint 9 Flat Config
|
|
233
|
-
|
|
234
|
-
- Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
|
|
235
|
-
- Updated `@typescript-eslint/*` packages to v8
|
|
236
|
-
- Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
|
|
237
|
-
|
|
238
|
-
### 🔄 Apollo Client
|
|
239
|
-
|
|
240
|
-
- Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
|
|
241
|
-
- Updated error handling types to accept `ApolloError | null | undefined`
|
|
242
|
-
|
|
243
|
-
### ⚠️ Breaking Changes
|
|
244
|
-
|
|
245
|
-
- **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
|
|
246
|
-
- **Interceptor files changed** - Original components now at `.original.tsx`
|
|
247
|
-
- **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
|
|
248
|
-
- **ESLint config format** - Must use flat config (`eslint.config.mjs`)
|
|
249
|
-
- **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
|
|
250
|
-
|
|
251
|
-
### 🗑️ Removed
|
|
252
|
-
|
|
253
|
-
- `InterceptorPlugin` webpack plugin
|
|
254
|
-
- `configToImportMeta` utility
|
|
255
|
-
- Webpack `DefinePlugin` usage for config
|
|
256
|
-
- `@mui/*` modern alias rewrites
|
|
257
|
-
- Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
|
|
258
|
-
|
|
259
|
-
## 9.1.0-canary.55
|
|
260
|
-
|
|
261
|
-
### Patch Changes
|
|
262
|
-
|
|
263
|
-
- [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`427833d`](https://github.com/graphcommerce-org/graphcommerce/commit/427833d3fa46ec6096853bdc3dfd81321df6e63b) - Forward address field props ([@paales](https://github.com/paales))
|
|
264
|
-
|
|
265
|
-
- [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`183d8dd`](https://github.com/graphcommerce-org/graphcommerce/commit/183d8ddef6059f07ffe585b0f05a51731b12b371) - Remove odd nonNullable that is also available in @graphcommmerce/next-ui ([@paales](https://github.com/paales))
|
|
266
|
-
|
|
267
|
-
## 9.1.0-canary.54
|
|
268
|
-
|
|
269
|
-
## 9.1.0-canary.53
|
|
270
|
-
|
|
271
|
-
## 9.1.0-canary.52
|
|
272
|
-
|
|
273
|
-
## 9.1.0-canary.51
|
|
274
|
-
|
|
275
|
-
## 9.1.0-canary.50
|
|
276
|
-
|
|
277
|
-
## 9.1.0-canary.49
|
|
278
|
-
|
|
279
|
-
## 9.1.0-canary.48
|
|
280
|
-
|
|
281
|
-
## 9.1.0-canary.47
|
|
282
|
-
|
|
283
|
-
## 9.1.0-canary.46
|
|
284
|
-
|
|
285
|
-
## 9.1.0-canary.45
|
|
286
|
-
|
|
287
|
-
## 9.1.0-canary.44
|
|
288
|
-
|
|
289
|
-
## 9.1.0-canary.43
|
|
290
|
-
|
|
291
|
-
## 9.1.0-canary.42
|
|
292
|
-
|
|
293
|
-
## 9.1.0-canary.41
|
|
294
|
-
|
|
295
|
-
## 9.1.0-canary.40
|
|
296
|
-
|
|
297
|
-
### Patch Changes
|
|
298
|
-
|
|
299
|
-
- [#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))
|
|
300
|
-
|
|
301
|
-
## 9.1.0-canary.39
|
|
302
|
-
|
|
303
|
-
## 9.1.0-canary.38
|
|
304
|
-
|
|
305
|
-
## 9.1.0-canary.37
|
|
306
|
-
|
|
307
|
-
## 9.1.0-canary.36
|
|
308
|
-
|
|
309
|
-
## 9.1.0-canary.35
|
|
310
|
-
|
|
311
|
-
## 9.1.0-canary.34
|
|
312
|
-
|
|
313
|
-
## 9.1.0-canary.33
|
|
314
|
-
|
|
315
|
-
## 9.1.0-canary.32
|
|
316
|
-
|
|
317
|
-
## 9.1.0-canary.31
|
|
318
|
-
|
|
319
|
-
### Patch Changes
|
|
320
|
-
|
|
321
|
-
- [#2524](https://github.com/graphcommerce-org/graphcommerce/pull/2524) [`dcc46aa`](https://github.com/graphcommerce-org/graphcommerce/commit/dcc46aae34f5eda6a633f472289ac4488ac96492) - Solve issue where the user is getting a 400 error when logging in because the password is not being sent. The password field was disabled before the form was submitted, causing the password not to be sent. ([@paales](https://github.com/paales))
|
|
322
|
-
|
|
323
|
-
## 9.1.0-canary.30
|
|
324
|
-
|
|
325
|
-
## 9.1.0-canary.29
|
|
326
|
-
|
|
327
|
-
## 9.1.0-canary.28
|
|
328
|
-
|
|
329
|
-
## 9.1.0-canary.27
|
|
330
|
-
|
|
331
|
-
## 9.1.0-canary.26
|
|
332
|
-
|
|
333
|
-
## 9.1.0-canary.25
|
|
334
|
-
|
|
335
|
-
## 9.1.0-canary.24
|
|
336
|
-
|
|
337
|
-
## 9.1.0-canary.23
|
|
338
|
-
|
|
339
|
-
## 9.1.0-canary.22
|
|
340
|
-
|
|
341
|
-
## 9.1.0-canary.21
|
|
342
|
-
|
|
343
|
-
## 9.1.0-canary.20
|
|
344
|
-
|
|
345
|
-
## 9.1.0-canary.19
|
|
346
|
-
|
|
347
|
-
### Minor Changes
|
|
348
|
-
|
|
349
|
-
- [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`20703bc`](https://github.com/graphcommerce-org/graphcommerce/commit/20703bc5c453fb7ee61eb4350e207e84a749bf5e) - Magento 2.4.7: Implemented the `customer_account_create` and `customer_account_edit` forms using the `attributeForm` query for the registration page and customer information form. The forms respect the settings configured in the 'Customer Configuration section'. It allows configuration for `prefix`, `middlename`, `suffix`,`dob`, `gender` and other fields. This also makes the frontend compatible with Adobe Commerce's Customer Attributes module. ([@paales](https://github.com/paales))
|
|
350
|
-
|
|
351
|
-
- [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`30f9371`](https://github.com/graphcommerce-org/graphcommerce/commit/30f9371503959b990c65058a88be6f61b4859140) - Added support for viewing Invoices/Shipments and Credit Memo's ([@paales](https://github.com/paales))
|
|
352
|
-
|
|
353
|
-
### Patch Changes
|
|
354
|
-
|
|
355
|
-
- [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`6cb4815`](https://github.com/graphcommerce-org/graphcommerce/commit/6cb4815a0faf4cc2f60c13d9384e3a96b6bdb2bb) - Deleting an account will now require reauthentication and moved the menu item to the Authentication section ([@paales](https://github.com/paales))
|
|
356
|
-
|
|
357
|
-
- [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`2409514`](https://github.com/graphcommerce-org/graphcommerce/commit/240951428ac0bdc11649f4190b6d51c004680b34) - Order/Invoice/CreditMemo and Shipment views ([@paales](https://github.com/paales))
|
|
358
|
-
|
|
359
|
-
## 9.1.0-canary.18
|
|
360
|
-
|
|
361
|
-
## 9.1.0-canary.17
|
|
362
|
-
|
|
363
|
-
## 9.1.0-canary.16
|
|
364
|
-
|
|
365
|
-
## 9.1.0-canary.15
|
|
366
|
-
|
|
367
|
-
### Patch Changes
|
|
368
|
-
|
|
369
|
-
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`0cb3ace`](https://github.com/graphcommerce-org/graphcommerce/commit/0cb3aceb09967493ecdd5040446447ff32cc3f43) - Created a AccountDashboardQueryFragment instead of only a query to allow for adding customerDownloadableProducts to the dashboard query ([@paales](https://github.com/paales))
|
|
370
|
-
|
|
371
|
-
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`c1f04dc`](https://github.com/graphcommerce-org/graphcommerce/commit/c1f04dcb4ddd621361e6c930fb42afae0aabe9f9) - Migrate to default OrderItem resolver and remove useOrderCardItemImages as OrderItem now returns a product. Add a custom resolver for 2.4.5 and 2.4.6 that implements the functionality for older versions. ([@paales](https://github.com/paales))
|
|
372
|
-
|
|
373
|
-
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`c1f04dc`](https://github.com/graphcommerce-org/graphcommerce/commit/c1f04dcb4ddd621361e6c930fb42afae0aabe9f9) - Created a refactored the AccountOrders page and refactored the OrderCard. ([@paales](https://github.com/paales))
|
|
374
|
-
|
|
375
|
-
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`db56933`](https://github.com/graphcommerce-org/graphcommerce/commit/db569336dddd3e955ff0b5b00cafa25079f1adee) - Implemented order sorting for account overview and account list and implement custom resolver for Magento 2.4.5 (which is slow but works). ([@paales](https://github.com/paales))
|
|
376
|
-
|
|
377
|
-
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`db56933`](https://github.com/graphcommerce-org/graphcommerce/commit/db569336dddd3e955ff0b5b00cafa25079f1adee) - Use OrderStateLabel in my account instead of OrderStateLabelInline and deprecate that one. ([@paales](https://github.com/paales))
|
|
378
|
-
|
|
379
|
-
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`dc387da`](https://github.com/graphcommerce-org/graphcommerce/commit/dc387da4c32585c251fe9dec90aa010e2a435df5) - OrderTotals/OrderDetails now only renders addres information if available ([@paales](https://github.com/paales))
|
|
380
|
-
|
|
381
|
-
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`623e993`](https://github.com/graphcommerce-org/graphcommerce/commit/623e993579b05e053d2d2f29684649cd4f4586de) - `<WaitForCustomer />` now accepts all props of the FullPageMessage ([@paales](https://github.com/paales))
|
|
382
|
-
|
|
383
|
-
## 9.0.4-canary.14
|
|
384
|
-
|
|
385
|
-
## 9.0.4-canary.13
|
|
386
|
-
|
|
387
|
-
## 9.0.4-canary.12
|
|
388
|
-
|
|
389
|
-
## 9.0.4-canary.11
|
|
390
|
-
|
|
391
|
-
## 9.0.4-canary.10
|
|
392
|
-
|
|
393
|
-
## 9.0.4-canary.9
|
|
394
|
-
|
|
395
|
-
## 9.0.4-canary.8
|
|
396
|
-
|
|
397
|
-
## 9.0.4-canary.7
|
|
398
|
-
|
|
399
|
-
## 9.0.4-canary.6
|
|
400
|
-
|
|
401
|
-
## 9.0.4-canary.5
|
|
402
|
-
|
|
403
|
-
## 9.0.4-canary.4
|
|
404
|
-
|
|
405
|
-
### Patch Changes
|
|
406
|
-
|
|
407
|
-
- [`5ca6fb9`](https://github.com/graphcommerce-org/graphcommerce/commit/5ca6fb94f6f275210c77493d05bad7c1620ff5a3) - When a user reorders their cart without interacting with their cart previously a new cart wouldn't be created. ([@paales](https://github.com/paales))
|
|
408
|
-
|
|
409
|
-
## 9.0.4-canary.3
|
|
410
|
-
|
|
411
|
-
## 9.0.4-canary.2
|
|
412
|
-
|
|
413
|
-
## 9.0.4-canary.1
|
|
414
|
-
|
|
415
|
-
## 9.0.4-canary.0
|
|
416
|
-
|
|
417
137
|
## 9.0.0
|
|
418
138
|
|
|
419
139
|
### Major Changes
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
FormRow,
|
|
11
11
|
LayoutTitle,
|
|
12
12
|
} from '@graphcommerce/next-ui'
|
|
13
|
+
import { useWatch } from '@graphcommerce/react-hook-form'
|
|
13
14
|
import { Trans } from '@lingui/react/macro'
|
|
14
15
|
import type { SxProps, Theme } from '@mui/material'
|
|
15
16
|
import { Alert, Box, CircularProgress, Link, Typography } from '@mui/material'
|
|
@@ -43,7 +44,7 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
|
|
|
43
44
|
const { firstname = '' } = customerQuery.data?.customer ?? {}
|
|
44
45
|
|
|
45
46
|
const { mode, form, submit } = useAccountSignInUpForm()
|
|
46
|
-
const { formState, control, error, setError, clearErrors
|
|
47
|
+
const { formState, control, error, setError, clearErrors } = form
|
|
47
48
|
const router = useRouter()
|
|
48
49
|
|
|
49
50
|
const client = useApolloClient()
|
|
@@ -57,7 +58,7 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
|
|
|
57
58
|
mode === 'signin' ||
|
|
58
59
|
(mode === 'signup' && canSignUp)
|
|
59
60
|
|
|
60
|
-
const emailValue =
|
|
61
|
+
const emailValue = useWatch({ control, name: 'email' })
|
|
61
62
|
|
|
62
63
|
return (
|
|
63
64
|
<FormDiv sx={sx} className={classes.root}>
|
|
@@ -23,11 +23,9 @@ export function SignInForm(props: SignInFormProps) {
|
|
|
23
23
|
email,
|
|
24
24
|
onBeforeSubmit(variables) {
|
|
25
25
|
if (!email) {
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
27
26
|
setError('email', { message: t`Please enter a valid email address` })
|
|
28
27
|
return false
|
|
29
28
|
}
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
31
29
|
clearErrors()
|
|
32
30
|
return variables
|
|
33
31
|
},
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
FormRow,
|
|
10
10
|
MessageSnackbar,
|
|
11
11
|
} from '@graphcommerce/next-ui'
|
|
12
|
-
import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
12
|
+
import { emailPattern, useFormGqlMutation, useWatch } from '@graphcommerce/react-hook-form'
|
|
13
13
|
import { t } from '@lingui/core/macro'
|
|
14
14
|
import { Trans } from '@lingui/react/macro'
|
|
15
15
|
import { ApolloCustomerErrorSnackbar } from '../ApolloCustomerError'
|
|
@@ -41,7 +41,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
|
|
|
41
41
|
},
|
|
42
42
|
)
|
|
43
43
|
|
|
44
|
-
const { handleSubmit, error, required, formState,
|
|
44
|
+
const { handleSubmit, error, required, formState, reset, control } = form
|
|
45
45
|
const [remainingError, authenticationError] = graphqlErrorByCategory({
|
|
46
46
|
category: 'graphql-authentication',
|
|
47
47
|
error,
|
|
@@ -49,7 +49,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
|
|
|
49
49
|
const submit = handleSubmit(() => {
|
|
50
50
|
reset()
|
|
51
51
|
})
|
|
52
|
-
const watchNewEmail =
|
|
52
|
+
const watchNewEmail = useWatch({ control, name: 'email' })
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
55
|
<Form onSubmit={submit} noValidate>
|
|
@@ -2,7 +2,7 @@ import { usePageContext } from '@graphcommerce/framer-next-pages'
|
|
|
2
2
|
import { useQuery } from '@graphcommerce/graphql'
|
|
3
3
|
import { enableGuestCheckoutLogin } from '@graphcommerce/next-config/config'
|
|
4
4
|
import { useUrlQuery } from '@graphcommerce/next-ui'
|
|
5
|
-
import { useFormGqlQuery } from '@graphcommerce/react-hook-form'
|
|
5
|
+
import { useFormGqlQuery, useWatch } from '@graphcommerce/react-hook-form'
|
|
6
6
|
import { useEffect } from 'react'
|
|
7
7
|
import type { IsEmailAvailableQuery, IsEmailAvailableQueryVariables } from './IsEmailAvailable.gql'
|
|
8
8
|
import { IsEmailAvailableDocument } from './IsEmailAvailable.gql'
|
|
@@ -40,8 +40,9 @@ export function useAccountSignInUpForm(props: UseFormIsEmailAvailableProps = {})
|
|
|
40
40
|
},
|
|
41
41
|
{ fetchPolicy: 'cache-and-network' },
|
|
42
42
|
)
|
|
43
|
-
const { formState, data, handleSubmit, setValue, trigger } = form
|
|
43
|
+
const { formState, data, handleSubmit, setValue, trigger, control } = form
|
|
44
44
|
const { isSubmitSuccessful, isValid } = formState
|
|
45
|
+
const requestedMode = useWatch({ control, name: 'requestedMode' })
|
|
45
46
|
|
|
46
47
|
useEffect(() => {
|
|
47
48
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
@@ -68,7 +69,7 @@ export function useAccountSignInUpForm(props: UseFormIsEmailAvailableProps = {})
|
|
|
68
69
|
if (token && valid) mode = 'signedin'
|
|
69
70
|
else if (token && !valid) mode = 'session-expired'
|
|
70
71
|
else if (isToggleMethod) {
|
|
71
|
-
mode =
|
|
72
|
+
mode = requestedMode ?? 'signin'
|
|
72
73
|
} else {
|
|
73
74
|
// 1. Nothing is entered
|
|
74
75
|
mode = 'email'
|
package/link/customerLink.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { globalApolloClient } from '@graphcommerce/graphql'
|
|
2
|
-
import type { ApolloCache } from '@graphcommerce/graphql/apollo'
|
|
3
1
|
import {
|
|
4
2
|
ApolloLink,
|
|
5
3
|
CombinedGraphQLErrors,
|
|
@@ -17,7 +15,6 @@ export type PushRouter = Pick<NextRouter, 'push' | 'events' | 'locale'>
|
|
|
17
15
|
|
|
18
16
|
declare module '@apollo/client' {
|
|
19
17
|
interface DefaultContext {
|
|
20
|
-
cache?: ApolloCache
|
|
21
18
|
headers?: Record<string, string>
|
|
22
19
|
}
|
|
23
20
|
}
|
|
@@ -51,25 +48,24 @@ export async function pushWithPromise(router: Pick<NextRouter, 'push' | 'events'
|
|
|
51
48
|
})
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
const addTokenHeader = new SetContextLink((prevContext) => {
|
|
51
|
+
const addTokenHeader = new SetContextLink((prevContext, operation) => {
|
|
55
52
|
const headers: Record<string, string> = { ...prevContext.headers }
|
|
56
53
|
|
|
57
54
|
try {
|
|
58
|
-
const query =
|
|
55
|
+
const query = operation.client.cache.readQuery({ query: CustomerTokenDocument })
|
|
59
56
|
|
|
60
57
|
if (query?.customerToken?.token && query?.customerToken?.valid !== false) {
|
|
61
58
|
headers.authorization = `Bearer ${query?.customerToken?.token}`
|
|
62
59
|
}
|
|
63
60
|
return { headers }
|
|
64
|
-
} catch
|
|
61
|
+
} catch {
|
|
65
62
|
return { headers }
|
|
66
63
|
}
|
|
67
64
|
})
|
|
68
65
|
|
|
69
66
|
const customerErrorLink = (router: PushRouter) =>
|
|
70
67
|
new ErrorLink(({ error, operation, forward }) => {
|
|
71
|
-
const client =
|
|
72
|
-
if (!client) return undefined
|
|
68
|
+
const { client } = operation
|
|
73
69
|
|
|
74
70
|
// Check if this is a GraphQL error
|
|
75
71
|
if (!CombinedGraphQLErrors.is(error)) return undefined
|
|
@@ -4,9 +4,11 @@ import { map } from '@graphcommerce/graphql/rxjs'
|
|
|
4
4
|
import { CustomerTokenDocument } from '../hooks'
|
|
5
5
|
|
|
6
6
|
export const xMagentoCacheIdHeader = new ApolloLink((operation, forward) => {
|
|
7
|
+
const { cache } = operation.client
|
|
8
|
+
|
|
7
9
|
operation.setContext((context: DefaultContext) => {
|
|
8
|
-
const xMagentoCacheId =
|
|
9
|
-
?.
|
|
10
|
+
const xMagentoCacheId = cache?.readQuery({ query: CustomerTokenDocument })?.customerToken
|
|
11
|
+
?.xMagentoCacheId
|
|
10
12
|
if (!xMagentoCacheId) return context
|
|
11
13
|
|
|
12
14
|
return { ...context, headers: { ...context.headers, 'x-magento-cache-id': xMagentoCacheId } }
|
|
@@ -14,7 +16,6 @@ export const xMagentoCacheIdHeader = new ApolloLink((operation, forward) => {
|
|
|
14
16
|
|
|
15
17
|
return forward(operation).pipe(
|
|
16
18
|
map((data) => {
|
|
17
|
-
const { cache } = operation.getContext()
|
|
18
19
|
if (!cache) return data
|
|
19
20
|
|
|
20
21
|
const xMagentoCacheId = (
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-customer",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "10.0.0",
|
|
5
|
+
"version": "10.0.1-canary.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"./plugins/magentoCustomerPrivateQueryContext": "./plugins/magentoCustomerPrivateQueryContext.ts"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@graphcommerce/ecommerce-ui": "^10.0.0",
|
|
25
|
-
"@graphcommerce/eslint-config-pwa": "^10.0.0",
|
|
26
|
-
"@graphcommerce/framer-next-pages": "^10.0.0",
|
|
27
|
-
"@graphcommerce/framer-utils": "^10.0.0",
|
|
28
|
-
"@graphcommerce/graphql": "^10.0.0",
|
|
29
|
-
"@graphcommerce/graphql-mesh": "^10.0.0",
|
|
30
|
-
"@graphcommerce/image": "^10.0.0",
|
|
31
|
-
"@graphcommerce/magento-graphql": "^10.0.0",
|
|
32
|
-
"@graphcommerce/magento-store": "^10.0.0",
|
|
33
|
-
"@graphcommerce/next-config": "^10.0.0",
|
|
34
|
-
"@graphcommerce/next-ui": "^10.0.0",
|
|
35
|
-
"@graphcommerce/prettier-config-pwa": "^10.0.0",
|
|
36
|
-
"@graphcommerce/react-hook-form": "^10.0.0",
|
|
37
|
-
"@graphcommerce/typescript-config-pwa": "^10.0.0",
|
|
24
|
+
"@graphcommerce/ecommerce-ui": "^10.0.1-canary.0",
|
|
25
|
+
"@graphcommerce/eslint-config-pwa": "^10.0.1-canary.0",
|
|
26
|
+
"@graphcommerce/framer-next-pages": "^10.0.1-canary.0",
|
|
27
|
+
"@graphcommerce/framer-utils": "^10.0.1-canary.0",
|
|
28
|
+
"@graphcommerce/graphql": "^10.0.1-canary.0",
|
|
29
|
+
"@graphcommerce/graphql-mesh": "^10.0.1-canary.0",
|
|
30
|
+
"@graphcommerce/image": "^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-config": "^10.0.1-canary.0",
|
|
34
|
+
"@graphcommerce/next-ui": "^10.0.1-canary.0",
|
|
35
|
+
"@graphcommerce/prettier-config-pwa": "^10.0.1-canary.0",
|
|
36
|
+
"@graphcommerce/react-hook-form": "^10.0.1-canary.0",
|
|
37
|
+
"@graphcommerce/typescript-config-pwa": "^10.0.1-canary.0",
|
|
38
38
|
"@lingui/core": "^5",
|
|
39
39
|
"@lingui/macro": "^5",
|
|
40
40
|
"@lingui/react": "^5",
|
package/typePolicies.ts
CHANGED
|
@@ -5,15 +5,22 @@ import { CustomerTokenDocument } from './hooks/CustomerToken.gql'
|
|
|
5
5
|
const generateCustomerToken: FieldPolicy<Mutation['generateCustomerToken']> = {
|
|
6
6
|
keyArgs: () => '',
|
|
7
7
|
merge(_existing, incoming, options) {
|
|
8
|
+
console.log('[generateCustomerToken] merge called', {
|
|
9
|
+
isReference: options.isReference(incoming),
|
|
10
|
+
incoming,
|
|
11
|
+
})
|
|
8
12
|
if (!options.isReference(incoming)) return incoming
|
|
9
13
|
|
|
14
|
+
const token = options.readField('token', incoming) as string
|
|
15
|
+
console.log('[generateCustomerToken] Writing token to cache:', token?.substring(0, 20))
|
|
16
|
+
|
|
10
17
|
options.cache.writeQuery({
|
|
11
18
|
query: CustomerTokenDocument,
|
|
12
19
|
broadcast: true,
|
|
13
20
|
data: {
|
|
14
21
|
customerToken: {
|
|
15
22
|
__typename: 'CustomerToken',
|
|
16
|
-
token
|
|
23
|
+
token,
|
|
17
24
|
createdAt: new Date().toUTCString(),
|
|
18
25
|
valid: true,
|
|
19
26
|
xMagentoCacheId: null,
|
|
@@ -21,6 +28,10 @@ const generateCustomerToken: FieldPolicy<Mutation['generateCustomerToken']> = {
|
|
|
21
28
|
},
|
|
22
29
|
})
|
|
23
30
|
|
|
31
|
+
// Verify write
|
|
32
|
+
const verify = options.cache.readQuery({ query: CustomerTokenDocument })
|
|
33
|
+
console.log('[generateCustomerToken] Verify after write:', verify)
|
|
34
|
+
|
|
24
35
|
return incoming
|
|
25
36
|
},
|
|
26
37
|
}
|