Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9882faf
Add auth context and update API calls to use authentication
wcole1-godaddy Nov 4, 2025
4c4e221
refactor: improve auth handling and type safety in godaddy hooks
wcole1-godaddy Nov 4, 2025
0c03f66
Fix JWT session scoping to prevent reuse across different checkout se…
wcole1-godaddy Nov 4, 2025
e849de8
Add legacy flow fallback when JWT exchange fails
wcole1-godaddy Nov 4, 2025
b3da7b5
Fix JWT type to use undefined instead of null for consistency
wcole1-godaddy Nov 4, 2025
6af82d3
chore: format code with consistent style
wcole1-godaddy Nov 5, 2025
e0fbd79
fix: handle exchangeFailed state correctly when token exchange fails
wcole1-godaddy Nov 5, 2025
f1e832d
Fix the draft order query
wcole1-godaddy Nov 5, 2025
5888cae
Format
wcole1-godaddy Nov 5, 2025
e9210ce
Format changes
wcole1-godaddy Nov 5, 2025
76a9ce1
update types
wcole1-godaddy Nov 5, 2025
d7bdbe2
use GODADDY_API_HOST to derive all env states
pbennett1-godaddy Nov 6, 2025
49b0b72
remove unused getEnvVar import
pbennett1-godaddy Nov 6, 2025
7540a5a
fix: set isLoading to false when JWT already exists for session
wcole1-godaddy Nov 6, 2025
06eba3f
update fulfillment logic for delivery method
pbennett1-godaddy Nov 6, 2025
9ef43a4
Add sessionId to confirmCheckout auth overload
wcole1-godaddy Nov 6, 2025
93efe44
add back redirect if order not found
wcole1-godaddy Nov 6, 2025
2c600cf
Format files
wcole1-godaddy Nov 6, 2025
62f6c6b
Merge branch 'main' into auth-updates
wcole1-godaddy Nov 6, 2025
641d4a3
Update order of accessing session
wcole1-godaddy Nov 6, 2025
82713a5
fix create session input types and fix delivery method logic
pbennett1-godaddy Nov 6, 2025
0575b72
add appearance data to checkout session query
pbennett1-godaddy Nov 6, 2025
f27f2a6
modify viewable sections
pbennett1-godaddy Nov 6, 2025
975459a
add changeset for version change
pbennett1-godaddy Nov 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/loose-taxis-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godaddy/react": patch
---

Add auth-token exchange
18 changes: 18 additions & 0 deletions examples/nextjs/app/c/[sessionId]/HostedCheckout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use client';

import { Checkout, GoDaddyProvider } from '@godaddy/react';

export default function HostedCheckout() {
return (
<div>
<GoDaddyProvider apiHost={process.env.NEXT_PUBLIC_GODADDY_API_HOST}>
<Checkout
godaddyPaymentsConfig={{
businessId: process.env.NEXT_PUBLIC_GODADDY_BUSINESS_ID || '',
appId: process.env.NEXT_PUBLIC_GODADDY_APP_ID || '',
}}
/>
</GoDaddyProvider>
</div>
);
}
7 changes: 7 additions & 0 deletions examples/nextjs/app/c/[sessionId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import HostedCheckout from './HostedCheckout';

export const dynamic = 'force-dynamic';

export default async function HostedCheckoutPage() {
return <HostedCheckout />;
}
5 changes: 5 additions & 0 deletions examples/nextjs/app/c/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const dynamic = 'force-dynamic';

export default async function HostedCheckout() {
return <div>Test</div>;
}
49 changes: 21 additions & 28 deletions examples/nextjs/app/checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import type { CheckoutFormSchema, CheckoutSession } from '@godaddy/react';
import { Checkout, GoDaddyProvider } from '@godaddy/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { useState } from 'react';
import { z } from 'zod';

/* Override the checkout form schema to make shippingPhone required */
Expand All @@ -13,32 +11,27 @@ const customSchema: CheckoutFormSchema = {
};

export function CheckoutPage({ session }: { session: CheckoutSession }) {
const [queryClient] = useState(() => new QueryClient());

return (
<QueryClientProvider client={queryClient}>
<GoDaddyProvider>
<Checkout
session={session}
checkoutFormSchema={customSchema}
squareConfig={{
appId: process.env.NEXT_PUBLIC_SQUARE_APP_ID || '',
locationId: process.env.NEXT_PUBLIC_SQUARE_LOCATION_ID || '',
}}
stripeConfig={{
publishableKey:
process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || '',
}}
godaddyPaymentsConfig={{
businessId: process.env.NEXT_PUBLIC_GODADDY_BUSINESS_ID || '',
appId: process.env.NEXT_PUBLIC_GODADDY_APP_ID || '',
}}
paypalConfig={{
clientId: process.env.NEXT_PUBLIC_PAYPAL_CLIENT_ID || '',
}}
/>
<ReactQueryDevtools initialIsOpen={false} />
</GoDaddyProvider>
</QueryClientProvider>
<GoDaddyProvider apiHost={process.env.NEXT_PUBLIC_GODADDY_API_HOST}>
<Checkout
session={session}
checkoutFormSchema={customSchema}
squareConfig={{
appId: process.env.NEXT_PUBLIC_SQUARE_APP_ID || '',
locationId: process.env.NEXT_PUBLIC_SQUARE_LOCATION_ID || '',
}}
stripeConfig={{
publishableKey: process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || '',
}}
godaddyPaymentsConfig={{
businessId: process.env.NEXT_PUBLIC_GODADDY_BUSINESS_ID || '',
appId: process.env.NEXT_PUBLIC_GODADDY_APP_ID || '',
}}
paypalConfig={{
clientId: process.env.NEXT_PUBLIC_PAYPAL_CLIENT_ID || '',
}}
/>
<ReactQueryDevtools initialIsOpen={false} />
</GoDaddyProvider>
);
}
3 changes: 2 additions & 1 deletion examples/nextjs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Metadata } from 'next';
import { Geist, Geist_Mono } from 'next/font/google';
import './globals.css';
import '@godaddy/react/styles.css';
import { Providers } from './providers';

const geistSans = Geist({
variable: '--font-geist-sans',
Expand All @@ -28,7 +29,7 @@ export default function RootLayout({
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
<Providers>{children}</Providers>
</body>
</html>
);
Expand Down
12 changes: 12 additions & 0 deletions examples/nextjs/app/providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use client';

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useState } from 'react';

export function Providers({ children }: { children: React.ReactNode }) {
const [queryClient] = useState(() => new QueryClient());

return (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
}
36 changes: 18 additions & 18 deletions examples/nextjs/biome.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.2/schema.json",
"extends": ["biome-config-godaddy/biome.json"],
"css": {
"parser": {
"cssModules": true,
"tailwindDirectives": true
}
},
"files": {
"includes": ["**/*", "!!**/src/globals.css"]
},
"linter": {
"rules": {
"correctness": {
"useUniqueElementIds": "off"
}
}
}
"$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
"extends": ["biome-config-godaddy/biome.json"],
"css": {
"parser": {
"cssModules": true,
"tailwindDirectives": true
}
},
"files": {
"includes": ["**/*", "!!**/src/globals.css"]
},
"linter": {
"rules": {
"correctness": {
"useUniqueElementIds": "off"
}
}
}
}
60 changes: 30 additions & 30 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"name": "nextjs",
"version": "0.1.1",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "biome check .",
"lint:fix": "biome check --write --unsafe ."
},
"dependencies": {
"@godaddy/localizations": "workspace:*",
"@godaddy/react": "workspace:*",
"@tanstack/react-query": "^5.66.0",
"@tanstack/react-query-devtools": "^5.76.1",
"next": "16.0.1",
"react": "19.2.0",
"react-dom": "19.2.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@biomejs/biome": "^2",
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"biome-config-godaddy": "workspace:*",
"tailwindcss": "^4",
"typescript": "^5"
}
"name": "nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "biome check .",
"lint:fix": "biome check --write --unsafe ."
},
"dependencies": {
"@godaddy/localizations": "workspace:*",
"@godaddy/react": "workspace:*",
"@tanstack/react-query": "^5.66.0",
"@tanstack/react-query-devtools": "^5.76.1",
"next": "16.0.1",
"react": "19.2.0",
"react-dom": "19.2.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@biomejs/biome": "^2",
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"biome-config-godaddy": "workspace:*",
"tailwindcss": "^4",
"typescript": "^5"
}
}
Loading