@cimplify/cli 0.7.8 → 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 (28) hide show
  1. package/dist/{add-BMHJY65N.mjs → add-VVHQBW36.mjs} +1 -1
  2. package/dist/{chunk-WO2KN3QD.mjs → chunk-STSY4IG3.mjs} +1 -1
  3. package/dist/{chunk-7ULQCWYD.mjs → chunk-UE4YMNDU.mjs} +380 -12
  4. package/dist/{chunk-LH7Y27BQ.mjs → chunk-YSUPIC6B.mjs} +1 -1
  5. package/dist/dispatcher.mjs +9 -9
  6. package/dist/{doctor-U7QRYEFG.mjs → doctor-TCI6VXGG.mjs} +2 -2
  7. package/dist/{explain-ZPBYGQWC.mjs → explain-VCSTQ54F.mjs} +1 -1
  8. package/dist/{introspect-JFJOCF5M.mjs → introspect-GQVDSF7A.mjs} +2 -2
  9. package/dist/{list-LOKEBW5S.mjs → list-IYNO5OV6.mjs} +1 -1
  10. package/dist/{update-EJGLLHRW.mjs → update-ORQGRL6E.mjs} +1 -1
  11. package/package.json +1 -1
  12. package/templates/manifest.json +26 -26
  13. package/templates/storefront-auto/components/auth-error-toast.tsx +46 -0
  14. package/templates/storefront-auto/components/providers.tsx +5 -1
  15. package/templates/storefront-bakery/components/auth-error-toast.tsx +46 -0
  16. package/templates/storefront-bakery/components/providers.tsx +5 -1
  17. package/templates/storefront-fashion/components/auth-error-toast.tsx +46 -0
  18. package/templates/storefront-fashion/components/providers.tsx +5 -1
  19. package/templates/storefront-grocery/components/auth-error-toast.tsx +46 -0
  20. package/templates/storefront-grocery/components/providers.tsx +5 -1
  21. package/templates/storefront-pharmacy/components/auth-error-toast.tsx +46 -0
  22. package/templates/storefront-pharmacy/components/providers.tsx +5 -1
  23. package/templates/storefront-restaurant/components/auth-error-toast.tsx +46 -0
  24. package/templates/storefront-restaurant/components/providers.tsx +5 -1
  25. package/templates/storefront-retail/components/auth-error-toast.tsx +46 -0
  26. package/templates/storefront-retail/components/providers.tsx +5 -1
  27. package/templates/storefront-services/components/auth-error-toast.tsx +46 -0
  28. package/templates/storefront-services/components/providers.tsx +5 -1
@@ -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
  }
@@ -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
  }