@cimplify/cli 0.7.7 → 0.7.9

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 (60) hide show
  1. package/dist/{add-DOQ5GETC.mjs → add-VVHQBW36.mjs} +1 -1
  2. package/dist/{chunk-LWOQXLWB.mjs → chunk-STSY4IG3.mjs} +1 -1
  3. package/dist/{chunk-NGOWIBLQ.mjs → chunk-UE4YMNDU.mjs} +389 -21
  4. package/dist/{chunk-5JVYR3DF.mjs → chunk-YSUPIC6B.mjs} +2 -2
  5. package/dist/dispatcher.mjs +9 -9
  6. package/dist/{doctor-5K4P5FS2.mjs → doctor-TCI6VXGG.mjs} +2 -2
  7. package/dist/{explain-LQPPHQLD.mjs → explain-VCSTQ54F.mjs} +1 -1
  8. package/dist/{introspect-ZY3XWWKN.mjs → introspect-GQVDSF7A.mjs} +2 -2
  9. package/dist/{list-OJPCXLXZ.mjs → list-IYNO5OV6.mjs} +1 -1
  10. package/dist/{update-KLETFFES.mjs → update-ORQGRL6E.mjs} +1 -1
  11. package/package.json +2 -2
  12. package/templates/manifest.json +26 -26
  13. package/templates/storefront-auto/app/auth/callback/route.ts +3 -3
  14. package/templates/storefront-auto/app/auth/session/route.ts +2 -2
  15. package/templates/storefront-auto/components/auth-error-toast.tsx +46 -0
  16. package/templates/storefront-auto/components/providers.tsx +5 -1
  17. package/templates/storefront-auto/lib/auth.ts +2 -2
  18. package/templates/storefront-auto/package.json +1 -1
  19. package/templates/storefront-bakery/app/auth/callback/route.ts +3 -3
  20. package/templates/storefront-bakery/app/auth/session/route.ts +2 -2
  21. package/templates/storefront-bakery/components/auth-error-toast.tsx +46 -0
  22. package/templates/storefront-bakery/components/providers.tsx +5 -1
  23. package/templates/storefront-bakery/lib/auth.ts +2 -2
  24. package/templates/storefront-bakery/package.json +1 -1
  25. package/templates/storefront-fashion/app/auth/callback/route.ts +3 -3
  26. package/templates/storefront-fashion/app/auth/session/route.ts +2 -2
  27. package/templates/storefront-fashion/components/auth-error-toast.tsx +46 -0
  28. package/templates/storefront-fashion/components/providers.tsx +5 -1
  29. package/templates/storefront-fashion/lib/auth.ts +2 -2
  30. package/templates/storefront-fashion/package.json +1 -1
  31. package/templates/storefront-grocery/app/auth/callback/route.ts +3 -3
  32. package/templates/storefront-grocery/app/auth/session/route.ts +2 -2
  33. package/templates/storefront-grocery/components/auth-error-toast.tsx +46 -0
  34. package/templates/storefront-grocery/components/providers.tsx +5 -1
  35. package/templates/storefront-grocery/lib/auth.ts +2 -2
  36. package/templates/storefront-grocery/package.json +1 -1
  37. package/templates/storefront-pharmacy/app/auth/callback/route.ts +3 -3
  38. package/templates/storefront-pharmacy/app/auth/session/route.ts +2 -2
  39. package/templates/storefront-pharmacy/components/auth-error-toast.tsx +46 -0
  40. package/templates/storefront-pharmacy/components/providers.tsx +5 -1
  41. package/templates/storefront-pharmacy/lib/auth.ts +2 -2
  42. package/templates/storefront-pharmacy/package.json +1 -1
  43. package/templates/storefront-restaurant/app/auth/callback/route.ts +3 -3
  44. package/templates/storefront-restaurant/app/auth/session/route.ts +2 -2
  45. package/templates/storefront-restaurant/components/auth-error-toast.tsx +46 -0
  46. package/templates/storefront-restaurant/components/providers.tsx +5 -1
  47. package/templates/storefront-restaurant/lib/auth.ts +2 -2
  48. package/templates/storefront-restaurant/package.json +1 -1
  49. package/templates/storefront-retail/app/auth/callback/route.ts +3 -3
  50. package/templates/storefront-retail/app/auth/session/route.ts +2 -2
  51. package/templates/storefront-retail/components/auth-error-toast.tsx +46 -0
  52. package/templates/storefront-retail/components/providers.tsx +5 -1
  53. package/templates/storefront-retail/lib/auth.ts +2 -2
  54. package/templates/storefront-retail/package.json +1 -1
  55. package/templates/storefront-services/app/auth/callback/route.ts +3 -3
  56. package/templates/storefront-services/app/auth/session/route.ts +2 -2
  57. package/templates/storefront-services/components/auth-error-toast.tsx +46 -0
  58. package/templates/storefront-services/components/providers.tsx +5 -1
  59. package/templates/storefront-services/lib/auth.ts +2 -2
  60. package/templates/storefront-services/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import { handleSessionRequest } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
 
6
6
  export async function GET(req: Request): Promise<Response> {
7
7
  if (!CLIENT_ID) {
8
8
  return Response.json({ sub: null }, { status: 200 });
9
9
  }
10
- return handleSessionRequest(req, { clientId: CLIENT_ID, authUrl: AUTH_URL });
10
+ return handleSessionRequest(req, { clientId: CLIENT_ID, issuer: ISSUER });
11
11
  }
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
4
+
5
+ const MESSAGES: Record<string, string> = {
6
+ state_mismatch: "Sign-in didn't complete. Please try again.",
7
+ exchange_failed: "We couldn't finish signing you in. Please try again.",
8
+ missing_code: "Sign-in didn't complete. Please try again.",
9
+ missing_id_token: "Sign-in didn't complete. Please try again.",
10
+ id_token_invalid: "Sign-in didn't complete. Please try again.",
11
+ access_denied: "Sign-in was cancelled.",
12
+ login_required: "Please sign in to continue.",
13
+ };
14
+
15
+ export function AuthErrorToast() {
16
+ const [message, setMessage] = useState<string | null>(null);
17
+
18
+ useEffect(() => {
19
+ const url = new URL(window.location.href);
20
+ const err = url.searchParams.get("cimplify_auth_error");
21
+ if (!err) return;
22
+ setMessage(MESSAGES[err] ?? "Sign-in didn't complete. Please try again.");
23
+ url.searchParams.delete("cimplify_auth_error");
24
+ window.history.replaceState(null, "", url.toString());
25
+ }, []);
26
+
27
+ if (!message) return null;
28
+
29
+ return (
30
+ <div
31
+ role="status"
32
+ aria-live="polite"
33
+ className="fixed bottom-4 left-1/2 -translate-x-1/2 z-50 max-w-sm rounded-lg bg-zinc-900 text-white px-4 py-3 text-sm shadow-lg flex items-center gap-3"
34
+ >
35
+ <span>{message}</span>
36
+ <button
37
+ type="button"
38
+ onClick={() => setMessage(null)}
39
+ aria-label="Dismiss"
40
+ className="text-zinc-400 hover:text-white transition-colors text-base leading-none"
41
+ >
42
+ ×
43
+ </button>
44
+ </div>
45
+ );
46
+ }
@@ -3,6 +3,7 @@
3
3
  import { useMemo, type ReactNode } from "react";
4
4
  import { createCimplifyClient } from "@cimplify/sdk";
5
5
  import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
6
+ import { AuthErrorToast } from "@/components/auth-error-toast";
6
7
 
7
8
  // Same-origin client — every request goes through the Next.js rewrite in
8
9
  // next.config.ts, so no CORS preflight ever hits the browser.
@@ -20,7 +21,10 @@ export function Providers({ children }: { children: ReactNode }) {
20
21
 
21
22
  return (
22
23
  <CimplifyProvider client={client}>
23
- <CartDrawerProvider>{children}</CartDrawerProvider>
24
+ <CartDrawerProvider>
25
+ {children}
26
+ <AuthErrorToast />
27
+ </CartDrawerProvider>
24
28
  </CimplifyProvider>
25
29
  );
26
30
  }
@@ -8,9 +8,9 @@ import {
8
8
  } from "@cimplify/sdk/server";
9
9
 
10
10
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
11
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
11
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
12
12
 
13
- const oidcConfig = { clientId: CLIENT_ID, authUrl: AUTH_URL };
13
+ const oidcConfig = { clientId: CLIENT_ID, issuer: ISSUER };
14
14
 
15
15
  export async function getSession(): Promise<CimplifySession | null> {
16
16
  if (!CLIENT_ID) return null;
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.59.0",
20
+ "@cimplify/sdk": "^0.60.0",
21
21
  "next": "^16.2.6",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -1,7 +1,7 @@
1
1
  import { handleOidcCallback, handleRedirectCallback } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
  const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
6
6
 
7
7
  // Redirect sign-in: the browser lands here via a top-level GET carrying ?code.
@@ -11,7 +11,7 @@ export async function GET(req: Request): Promise<Response> {
11
11
  }
12
12
  return handleRedirectCallback(req, {
13
13
  clientId: CLIENT_ID,
14
- authUrl: AUTH_URL,
14
+ issuer: ISSUER,
15
15
  redirectUri: REDIRECT_URI,
16
16
  defaultReturnTo: "/account",
17
17
  });
@@ -24,7 +24,7 @@ export async function POST(req: Request): Promise<Response> {
24
24
  }
25
25
  return handleOidcCallback(req, {
26
26
  clientId: CLIENT_ID,
27
- authUrl: AUTH_URL,
27
+ issuer: ISSUER,
28
28
  redirectUri: REDIRECT_URI,
29
29
  });
30
30
  }
@@ -1,11 +1,11 @@
1
1
  import { handleSessionRequest } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
 
6
6
  export async function GET(req: Request): Promise<Response> {
7
7
  if (!CLIENT_ID) {
8
8
  return Response.json({ sub: null }, { status: 200 });
9
9
  }
10
- return handleSessionRequest(req, { clientId: CLIENT_ID, authUrl: AUTH_URL });
10
+ return handleSessionRequest(req, { clientId: CLIENT_ID, issuer: ISSUER });
11
11
  }
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
4
+
5
+ const MESSAGES: Record<string, string> = {
6
+ state_mismatch: "Sign-in didn't complete. Please try again.",
7
+ exchange_failed: "We couldn't finish signing you in. Please try again.",
8
+ missing_code: "Sign-in didn't complete. Please try again.",
9
+ missing_id_token: "Sign-in didn't complete. Please try again.",
10
+ id_token_invalid: "Sign-in didn't complete. Please try again.",
11
+ access_denied: "Sign-in was cancelled.",
12
+ login_required: "Please sign in to continue.",
13
+ };
14
+
15
+ export function AuthErrorToast() {
16
+ const [message, setMessage] = useState<string | null>(null);
17
+
18
+ useEffect(() => {
19
+ const url = new URL(window.location.href);
20
+ const err = url.searchParams.get("cimplify_auth_error");
21
+ if (!err) return;
22
+ setMessage(MESSAGES[err] ?? "Sign-in didn't complete. Please try again.");
23
+ url.searchParams.delete("cimplify_auth_error");
24
+ window.history.replaceState(null, "", url.toString());
25
+ }, []);
26
+
27
+ if (!message) return null;
28
+
29
+ return (
30
+ <div
31
+ role="status"
32
+ aria-live="polite"
33
+ className="fixed bottom-4 left-1/2 -translate-x-1/2 z-50 max-w-sm rounded-lg bg-zinc-900 text-white px-4 py-3 text-sm shadow-lg flex items-center gap-3"
34
+ >
35
+ <span>{message}</span>
36
+ <button
37
+ type="button"
38
+ onClick={() => setMessage(null)}
39
+ aria-label="Dismiss"
40
+ className="text-zinc-400 hover:text-white transition-colors text-base leading-none"
41
+ >
42
+ ×
43
+ </button>
44
+ </div>
45
+ );
46
+ }
@@ -3,6 +3,7 @@
3
3
  import { useMemo, type ReactNode } from "react";
4
4
  import { createCimplifyClient } from "@cimplify/sdk";
5
5
  import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
6
+ import { AuthErrorToast } from "@/components/auth-error-toast";
6
7
 
7
8
  // Same-origin client — every request goes through the Next.js rewrite in
8
9
  // next.config.ts, so no CORS preflight ever hits the browser.
@@ -20,7 +21,10 @@ export function Providers({ children }: { children: ReactNode }) {
20
21
 
21
22
  return (
22
23
  <CimplifyProvider client={client}>
23
- <CartDrawerProvider>{children}</CartDrawerProvider>
24
+ <CartDrawerProvider>
25
+ {children}
26
+ <AuthErrorToast />
27
+ </CartDrawerProvider>
24
28
  </CimplifyProvider>
25
29
  );
26
30
  }
@@ -8,9 +8,9 @@ import {
8
8
  } from "@cimplify/sdk/server";
9
9
 
10
10
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
11
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
11
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
12
12
 
13
- const oidcConfig = { clientId: CLIENT_ID, authUrl: AUTH_URL };
13
+ const oidcConfig = { clientId: CLIENT_ID, issuer: ISSUER };
14
14
 
15
15
  export async function getSession(): Promise<CimplifySession | null> {
16
16
  if (!CLIENT_ID) return null;
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.59.0",
20
+ "@cimplify/sdk": "^0.60.0",
21
21
  "next": "^16.2.6",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -1,7 +1,7 @@
1
1
  import { handleOidcCallback, handleRedirectCallback } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
  const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
6
6
 
7
7
  // Redirect sign-in: the browser lands here via a top-level GET carrying ?code.
@@ -11,7 +11,7 @@ export async function GET(req: Request): Promise<Response> {
11
11
  }
12
12
  return handleRedirectCallback(req, {
13
13
  clientId: CLIENT_ID,
14
- authUrl: AUTH_URL,
14
+ issuer: ISSUER,
15
15
  redirectUri: REDIRECT_URI,
16
16
  defaultReturnTo: "/account",
17
17
  });
@@ -24,7 +24,7 @@ export async function POST(req: Request): Promise<Response> {
24
24
  }
25
25
  return handleOidcCallback(req, {
26
26
  clientId: CLIENT_ID,
27
- authUrl: AUTH_URL,
27
+ issuer: ISSUER,
28
28
  redirectUri: REDIRECT_URI,
29
29
  });
30
30
  }
@@ -1,11 +1,11 @@
1
1
  import { handleSessionRequest } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
 
6
6
  export async function GET(req: Request): Promise<Response> {
7
7
  if (!CLIENT_ID) {
8
8
  return Response.json({ sub: null }, { status: 200 });
9
9
  }
10
- return handleSessionRequest(req, { clientId: CLIENT_ID, authUrl: AUTH_URL });
10
+ return handleSessionRequest(req, { clientId: CLIENT_ID, issuer: ISSUER });
11
11
  }
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
4
+
5
+ const MESSAGES: Record<string, string> = {
6
+ state_mismatch: "Sign-in didn't complete. Please try again.",
7
+ exchange_failed: "We couldn't finish signing you in. Please try again.",
8
+ missing_code: "Sign-in didn't complete. Please try again.",
9
+ missing_id_token: "Sign-in didn't complete. Please try again.",
10
+ id_token_invalid: "Sign-in didn't complete. Please try again.",
11
+ access_denied: "Sign-in was cancelled.",
12
+ login_required: "Please sign in to continue.",
13
+ };
14
+
15
+ export function AuthErrorToast() {
16
+ const [message, setMessage] = useState<string | null>(null);
17
+
18
+ useEffect(() => {
19
+ const url = new URL(window.location.href);
20
+ const err = url.searchParams.get("cimplify_auth_error");
21
+ if (!err) return;
22
+ setMessage(MESSAGES[err] ?? "Sign-in didn't complete. Please try again.");
23
+ url.searchParams.delete("cimplify_auth_error");
24
+ window.history.replaceState(null, "", url.toString());
25
+ }, []);
26
+
27
+ if (!message) return null;
28
+
29
+ return (
30
+ <div
31
+ role="status"
32
+ aria-live="polite"
33
+ className="fixed bottom-4 left-1/2 -translate-x-1/2 z-50 max-w-sm rounded-lg bg-zinc-900 text-white px-4 py-3 text-sm shadow-lg flex items-center gap-3"
34
+ >
35
+ <span>{message}</span>
36
+ <button
37
+ type="button"
38
+ onClick={() => setMessage(null)}
39
+ aria-label="Dismiss"
40
+ className="text-zinc-400 hover:text-white transition-colors text-base leading-none"
41
+ >
42
+ ×
43
+ </button>
44
+ </div>
45
+ );
46
+ }
@@ -3,6 +3,7 @@
3
3
  import { useMemo, type ReactNode } from "react";
4
4
  import { createCimplifyClient } from "@cimplify/sdk";
5
5
  import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
6
+ import { AuthErrorToast } from "@/components/auth-error-toast";
6
7
 
7
8
  // Same-origin client — every request goes through the Next.js rewrite in
8
9
  // next.config.ts, so no CORS preflight ever hits the browser.
@@ -20,7 +21,10 @@ export function Providers({ children }: { children: ReactNode }) {
20
21
 
21
22
  return (
22
23
  <CimplifyProvider client={client}>
23
- <CartDrawerProvider>{children}</CartDrawerProvider>
24
+ <CartDrawerProvider>
25
+ {children}
26
+ <AuthErrorToast />
27
+ </CartDrawerProvider>
24
28
  </CimplifyProvider>
25
29
  );
26
30
  }
@@ -8,9 +8,9 @@ import {
8
8
  } from "@cimplify/sdk/server";
9
9
 
10
10
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
11
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
11
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
12
12
 
13
- const oidcConfig = { clientId: CLIENT_ID, authUrl: AUTH_URL };
13
+ const oidcConfig = { clientId: CLIENT_ID, issuer: ISSUER };
14
14
 
15
15
  export async function getSession(): Promise<CimplifySession | null> {
16
16
  if (!CLIENT_ID) return null;
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.59.0",
20
+ "@cimplify/sdk": "^0.60.0",
21
21
  "next": "^16.2.6",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -1,7 +1,7 @@
1
1
  import { handleOidcCallback, handleRedirectCallback } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
  const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
6
6
 
7
7
  // Redirect sign-in: the browser lands here via a top-level GET carrying ?code.
@@ -11,7 +11,7 @@ export async function GET(req: Request): Promise<Response> {
11
11
  }
12
12
  return handleRedirectCallback(req, {
13
13
  clientId: CLIENT_ID,
14
- authUrl: AUTH_URL,
14
+ issuer: ISSUER,
15
15
  redirectUri: REDIRECT_URI,
16
16
  defaultReturnTo: "/account",
17
17
  });
@@ -24,7 +24,7 @@ export async function POST(req: Request): Promise<Response> {
24
24
  }
25
25
  return handleOidcCallback(req, {
26
26
  clientId: CLIENT_ID,
27
- authUrl: AUTH_URL,
27
+ issuer: ISSUER,
28
28
  redirectUri: REDIRECT_URI,
29
29
  });
30
30
  }
@@ -1,11 +1,11 @@
1
1
  import { handleSessionRequest } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
 
6
6
  export async function GET(req: Request): Promise<Response> {
7
7
  if (!CLIENT_ID) {
8
8
  return Response.json({ sub: null }, { status: 200 });
9
9
  }
10
- return handleSessionRequest(req, { clientId: CLIENT_ID, authUrl: AUTH_URL });
10
+ return handleSessionRequest(req, { clientId: CLIENT_ID, issuer: ISSUER });
11
11
  }
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
4
+
5
+ const MESSAGES: Record<string, string> = {
6
+ state_mismatch: "Sign-in didn't complete. Please try again.",
7
+ exchange_failed: "We couldn't finish signing you in. Please try again.",
8
+ missing_code: "Sign-in didn't complete. Please try again.",
9
+ missing_id_token: "Sign-in didn't complete. Please try again.",
10
+ id_token_invalid: "Sign-in didn't complete. Please try again.",
11
+ access_denied: "Sign-in was cancelled.",
12
+ login_required: "Please sign in to continue.",
13
+ };
14
+
15
+ export function AuthErrorToast() {
16
+ const [message, setMessage] = useState<string | null>(null);
17
+
18
+ useEffect(() => {
19
+ const url = new URL(window.location.href);
20
+ const err = url.searchParams.get("cimplify_auth_error");
21
+ if (!err) return;
22
+ setMessage(MESSAGES[err] ?? "Sign-in didn't complete. Please try again.");
23
+ url.searchParams.delete("cimplify_auth_error");
24
+ window.history.replaceState(null, "", url.toString());
25
+ }, []);
26
+
27
+ if (!message) return null;
28
+
29
+ return (
30
+ <div
31
+ role="status"
32
+ aria-live="polite"
33
+ className="fixed bottom-4 left-1/2 -translate-x-1/2 z-50 max-w-sm rounded-lg bg-zinc-900 text-white px-4 py-3 text-sm shadow-lg flex items-center gap-3"
34
+ >
35
+ <span>{message}</span>
36
+ <button
37
+ type="button"
38
+ onClick={() => setMessage(null)}
39
+ aria-label="Dismiss"
40
+ className="text-zinc-400 hover:text-white transition-colors text-base leading-none"
41
+ >
42
+ ×
43
+ </button>
44
+ </div>
45
+ );
46
+ }
@@ -3,6 +3,7 @@
3
3
  import { useMemo, type ReactNode } from "react";
4
4
  import { createCimplifyClient } from "@cimplify/sdk";
5
5
  import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
6
+ import { AuthErrorToast } from "@/components/auth-error-toast";
6
7
 
7
8
  // Same-origin client — every request goes through the Next.js rewrite in
8
9
  // next.config.ts, so no CORS preflight ever hits the browser.
@@ -20,7 +21,10 @@ export function Providers({ children }: { children: ReactNode }) {
20
21
 
21
22
  return (
22
23
  <CimplifyProvider client={client}>
23
- <CartDrawerProvider>{children}</CartDrawerProvider>
24
+ <CartDrawerProvider>
25
+ {children}
26
+ <AuthErrorToast />
27
+ </CartDrawerProvider>
24
28
  </CimplifyProvider>
25
29
  );
26
30
  }
@@ -8,9 +8,9 @@ import {
8
8
  } from "@cimplify/sdk/server";
9
9
 
10
10
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
11
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
11
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
12
12
 
13
- const oidcConfig = { clientId: CLIENT_ID, authUrl: AUTH_URL };
13
+ const oidcConfig = { clientId: CLIENT_ID, issuer: ISSUER };
14
14
 
15
15
  export async function getSession(): Promise<CimplifySession | null> {
16
16
  if (!CLIENT_ID) return null;
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.59.0",
20
+ "@cimplify/sdk": "^0.60.0",
21
21
  "next": "^16.2.6",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -1,7 +1,7 @@
1
1
  import { handleOidcCallback, handleRedirectCallback } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
  const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
6
6
 
7
7
  // Redirect sign-in: the browser lands here via a top-level GET carrying ?code.
@@ -11,7 +11,7 @@ export async function GET(req: Request): Promise<Response> {
11
11
  }
12
12
  return handleRedirectCallback(req, {
13
13
  clientId: CLIENT_ID,
14
- authUrl: AUTH_URL,
14
+ issuer: ISSUER,
15
15
  redirectUri: REDIRECT_URI,
16
16
  defaultReturnTo: "/account",
17
17
  });
@@ -24,7 +24,7 @@ export async function POST(req: Request): Promise<Response> {
24
24
  }
25
25
  return handleOidcCallback(req, {
26
26
  clientId: CLIENT_ID,
27
- authUrl: AUTH_URL,
27
+ issuer: ISSUER,
28
28
  redirectUri: REDIRECT_URI,
29
29
  });
30
30
  }
@@ -1,11 +1,11 @@
1
1
  import { handleSessionRequest } from "@cimplify/sdk/server";
2
2
 
3
3
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
4
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
4
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
5
5
 
6
6
  export async function GET(req: Request): Promise<Response> {
7
7
  if (!CLIENT_ID) {
8
8
  return Response.json({ sub: null }, { status: 200 });
9
9
  }
10
- return handleSessionRequest(req, { clientId: CLIENT_ID, authUrl: AUTH_URL });
10
+ return handleSessionRequest(req, { clientId: CLIENT_ID, issuer: ISSUER });
11
11
  }
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
4
+
5
+ const MESSAGES: Record<string, string> = {
6
+ state_mismatch: "Sign-in didn't complete. Please try again.",
7
+ exchange_failed: "We couldn't finish signing you in. Please try again.",
8
+ missing_code: "Sign-in didn't complete. Please try again.",
9
+ missing_id_token: "Sign-in didn't complete. Please try again.",
10
+ id_token_invalid: "Sign-in didn't complete. Please try again.",
11
+ access_denied: "Sign-in was cancelled.",
12
+ login_required: "Please sign in to continue.",
13
+ };
14
+
15
+ export function AuthErrorToast() {
16
+ const [message, setMessage] = useState<string | null>(null);
17
+
18
+ useEffect(() => {
19
+ const url = new URL(window.location.href);
20
+ const err = url.searchParams.get("cimplify_auth_error");
21
+ if (!err) return;
22
+ setMessage(MESSAGES[err] ?? "Sign-in didn't complete. Please try again.");
23
+ url.searchParams.delete("cimplify_auth_error");
24
+ window.history.replaceState(null, "", url.toString());
25
+ }, []);
26
+
27
+ if (!message) return null;
28
+
29
+ return (
30
+ <div
31
+ role="status"
32
+ aria-live="polite"
33
+ className="fixed bottom-4 left-1/2 -translate-x-1/2 z-50 max-w-sm rounded-lg bg-zinc-900 text-white px-4 py-3 text-sm shadow-lg flex items-center gap-3"
34
+ >
35
+ <span>{message}</span>
36
+ <button
37
+ type="button"
38
+ onClick={() => setMessage(null)}
39
+ aria-label="Dismiss"
40
+ className="text-zinc-400 hover:text-white transition-colors text-base leading-none"
41
+ >
42
+ ×
43
+ </button>
44
+ </div>
45
+ );
46
+ }
@@ -3,6 +3,7 @@
3
3
  import { useMemo, type ReactNode } from "react";
4
4
  import { createCimplifyClient } from "@cimplify/sdk";
5
5
  import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
6
+ import { AuthErrorToast } from "@/components/auth-error-toast";
6
7
 
7
8
  // Same-origin client — every request goes through the Next.js rewrite in
8
9
  // next.config.ts, so no CORS preflight ever hits the browser.
@@ -20,7 +21,10 @@ export function Providers({ children }: { children: ReactNode }) {
20
21
 
21
22
  return (
22
23
  <CimplifyProvider client={client}>
23
- <CartDrawerProvider>{children}</CartDrawerProvider>
24
+ <CartDrawerProvider>
25
+ {children}
26
+ <AuthErrorToast />
27
+ </CartDrawerProvider>
24
28
  </CimplifyProvider>
25
29
  );
26
30
  }
@@ -8,9 +8,9 @@ import {
8
8
  } from "@cimplify/sdk/server";
9
9
 
10
10
  const CLIENT_ID = process.env.CIMPLIFY_CLIENT_ID ?? "";
11
- const AUTH_URL = process.env.CIMPLIFY_AUTH_URL;
11
+ const ISSUER = process.env.CIMPLIFY_ISSUER;
12
12
 
13
- const oidcConfig = { clientId: CLIENT_ID, authUrl: AUTH_URL };
13
+ const oidcConfig = { clientId: CLIENT_ID, issuer: ISSUER };
14
14
 
15
15
  export async function getSession(): Promise<CimplifySession | null> {
16
16
  if (!CLIENT_ID) return null;
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.59.0",
20
+ "@cimplify/sdk": "^0.60.0",
21
21
  "next": "^16.2.6",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"