Commit 811bb55
refactor: improve auth handling and type safety in godaddy hooks (#1209)
* Add auth context and update API calls to use authentication
Amp-Thread-ID: https://ampcode.com/threads/T-4a30d115-a4ed-4fb6-94c8-a93f2875611d
Co-authored-by: Amp <[email protected]>
* refactor: improve auth handling and type safety in godaddy hooks
- Remove blocking early returns that prevented JWT-only auth flows
- Add explicit type generics to all useMutation calls
- Simplify auth pattern to match godaddy.ts overload structure
- Use direct ternary for jwt vs session auth selection
- Remove unnecessary wrapper functions for cleaner code
- Let React Query handle error throwing automatically
Amp-Thread-ID: https://ampcode.com/threads/T-2469796c-8d8e-4450-be09-b8dfe01f101a
Co-authored-by: Amp <[email protected]>
* Fix JWT session scoping to prevent reuse across different checkout sessions
Amp-Thread-ID: https://ampcode.com/threads/T-65c39e0f-21b4-4900-a6a6-35c262cb3ec0
Co-authored-by: Amp <[email protected]>
* Add legacy flow fallback when JWT exchange fails
Amp-Thread-ID: https://ampcode.com/threads/T-65c39e0f-21b4-4900-a6a6-35c262cb3ec0
Co-authored-by: Amp <[email protected]>
* Fix JWT type to use undefined instead of null for consistency
Amp-Thread-ID: https://ampcode.com/threads/T-65c39e0f-21b4-4900-a6a6-35c262cb3ec0
Co-authored-by: Amp <[email protected]>
* chore: format code with consistent style
- Convert double quotes to single quotes
- Standardize indentation (2 spaces)
- Apply formatting across React components and utilities
Amp-Thread-ID: https://ampcode.com/threads/T-1d878f81-bcc4-4acd-a1d8-11f31b88ecee
Co-authored-by: Amp <[email protected]>
* fix: handle exchangeFailed state correctly when token exchange fails
- Return early after clearing mismatched JWT to avoid race condition
- Check for missing JWT before cancelled flag to ensure failure is captured
- Guard exchangeFailed state updates with cancelled check to prevent updates after unmount
Amp-Thread-ID: https://ampcode.com/threads/T-77963656-ab13-4782-b5fb-efcf2be4696a
Co-authored-by: Amp <[email protected]>
* Fix the draft order query
* Format
* Format changes
* update types
* use GODADDY_API_HOST to derive all env states
* remove unused getEnvVar import
* fix: set isLoading to false when JWT already exists for session
Amp-Thread-ID: https://ampcode.com/threads/T-36b2320b-3465-4c05-9b20-dc79416c2e8a
Co-authored-by: Amp <[email protected]>
* update fulfillment logic for delivery method
* Add sessionId to confirmCheckout auth overload
Amp-Thread-ID: https://ampcode.com/threads/T-d1b8d98c-ded2-42d5-b59b-25e20b4d1f02
Co-authored-by: Amp <[email protected]>
* add back redirect if order not found
* Format files
* Update order of accessing session
* fix create session input types and fix delivery method logic
* add appearance data to checkout session query
* modify viewable sections
* add changeset for version change
---------
Co-authored-by: Amp <[email protected]>
Co-authored-by: Phil Bennett <[email protected]>1 parent 141f287 commit 811bb55
File tree
53 files changed
+10824
-8864
lines changed- .changeset
- examples/nextjs
- app
- c
- [sessionId]
- packages/react
- src
- components/checkout
- address/utils
- delivery
- utils
- discount/utils
- form
- order
- payment
- payment-methods/credit-card
- utils
- shipping/utils
- target
- taxes/utils
- utils
- hooks
- lib
- godaddy
- tracking
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
53 files changed
+10824
-8864
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| |||
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
16 | | - | |
17 | | - | |
18 | 14 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
43 | 36 | | |
44 | 37 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
0 commit comments