@cimplify/cli 0.7.8 → 0.7.10
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/dist/{add-BMHJY65N.mjs → add-SMWNH54I.mjs} +1 -1
- package/dist/{chunk-WO2KN3QD.mjs → chunk-AGJ3GDM5.mjs} +1 -1
- package/dist/{chunk-LH7Y27BQ.mjs → chunk-DTKRN5WC.mjs} +2 -2
- package/dist/{chunk-7ULQCWYD.mjs → chunk-YFLBC6BL.mjs} +410 -22
- package/dist/dispatcher.mjs +9 -9
- package/dist/{doctor-U7QRYEFG.mjs → doctor-DD2HRC43.mjs} +2 -2
- package/dist/{explain-ZPBYGQWC.mjs → explain-H46SCM2M.mjs} +1 -1
- package/dist/{introspect-JFJOCF5M.mjs → introspect-YKAWUZ6D.mjs} +2 -2
- package/dist/{list-LOKEBW5S.mjs → list-6FF2UPH2.mjs} +1 -1
- package/dist/{update-EJGLLHRW.mjs → update-STXI3CS4.mjs} +1 -1
- package/package.json +2 -2
- package/templates/manifest.json +26 -26
- package/templates/storefront-auto/components/auth-error-toast.tsx +46 -0
- package/templates/storefront-auto/components/providers.tsx +5 -1
- package/templates/storefront-auto/package.json +1 -1
- package/templates/storefront-bakery/components/auth-error-toast.tsx +46 -0
- package/templates/storefront-bakery/components/providers.tsx +5 -1
- package/templates/storefront-bakery/package.json +1 -1
- package/templates/storefront-fashion/components/auth-error-toast.tsx +46 -0
- package/templates/storefront-fashion/components/providers.tsx +5 -1
- package/templates/storefront-fashion/package.json +1 -1
- package/templates/storefront-grocery/components/auth-error-toast.tsx +46 -0
- package/templates/storefront-grocery/components/providers.tsx +5 -1
- package/templates/storefront-grocery/package.json +1 -1
- package/templates/storefront-pharmacy/components/auth-error-toast.tsx +46 -0
- package/templates/storefront-pharmacy/components/providers.tsx +5 -1
- package/templates/storefront-pharmacy/package.json +1 -1
- package/templates/storefront-restaurant/components/auth-error-toast.tsx +46 -0
- package/templates/storefront-restaurant/components/providers.tsx +5 -1
- package/templates/storefront-restaurant/package.json +1 -1
- package/templates/storefront-retail/components/auth-error-toast.tsx +46 -0
- package/templates/storefront-retail/components/providers.tsx +5 -1
- package/templates/storefront-retail/package.json +1 -1
- package/templates/storefront-services/components/auth-error-toast.tsx +46 -0
- package/templates/storefront-services/components/providers.tsx +5 -1
- package/templates/storefront-services/package.json +1 -1
package/dist/dispatcher.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { TEMPLATES } from './chunk-
|
|
3
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { TEMPLATES } from './chunk-YFLBC6BL.mjs';
|
|
3
|
+
import { package_default } from './chunk-DTKRN5WC.mjs';
|
|
4
4
|
|
|
5
5
|
// src/dispatcher.ts
|
|
6
6
|
var VERSION = package_default.version ?? "unknown";
|
|
@@ -138,16 +138,16 @@ var COMMANDS = {
|
|
|
138
138
|
logs: () => import('./logs-YNN2PQ24.mjs'),
|
|
139
139
|
status: () => import('./status-JSYXM5RT.mjs'),
|
|
140
140
|
dev: () => import('./dev-ONW2S77K.mjs'),
|
|
141
|
-
introspect: () => import('./introspect-
|
|
141
|
+
introspect: () => import('./introspect-YKAWUZ6D.mjs'),
|
|
142
142
|
inspect: () => import('./inspect-CGYX4DDF.mjs'),
|
|
143
|
-
doctor: () => import('./doctor-
|
|
144
|
-
explain: () => import('./explain-
|
|
143
|
+
doctor: () => import('./doctor-DD2HRC43.mjs'),
|
|
144
|
+
explain: () => import('./explain-H46SCM2M.mjs'),
|
|
145
145
|
assets: () => import('./assets-74SK63TR.mjs'),
|
|
146
146
|
repo: () => import('./repo-KNQMSPVV.mjs'),
|
|
147
|
-
list: () => import('./list-
|
|
148
|
-
add: () => import('./add-
|
|
149
|
-
update: () => import('./update-
|
|
150
|
-
upgrade: () => import('./update-
|
|
147
|
+
list: () => import('./list-6FF2UPH2.mjs'),
|
|
148
|
+
add: () => import('./add-SMWNH54I.mjs'),
|
|
149
|
+
update: () => import('./update-STXI3CS4.mjs'),
|
|
150
|
+
upgrade: () => import('./update-STXI3CS4.mjs'),
|
|
151
151
|
"auth-step-up": () => import('./auth-step-up-BIUYQJP6.mjs')
|
|
152
152
|
};
|
|
153
153
|
var COMMAND_PREFIXES = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { gatherIntrospection } from './chunk-
|
|
2
|
+
import { gatherIntrospection } from './chunk-AGJ3GDM5.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-DTKRN5WC.mjs';
|
|
6
6
|
import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import { ApiClient } from './chunk-MAOO6ZZ5.mjs';
|
|
8
8
|
import { readAuthOrNull } from './chunk-UBAI443T.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-DTKRN5WC.mjs';
|
|
3
3
|
import { parseArgs } from './chunk-C4M3DXKC.mjs';
|
|
4
4
|
import { bold, dim, info, result, CliError, CLI_ERROR_CODE } from './chunk-E2T2SBP5.mjs';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-
|
|
2
|
+
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-AGJ3GDM5.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-DTKRN5WC.mjs';
|
|
6
6
|
import './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import './chunk-UBAI443T.mjs';
|
|
8
8
|
import './chunk-E2T2SBP5.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { REGISTRY_INDEX } from './chunk-
|
|
2
|
+
import { REGISTRY_INDEX } from './chunk-YFLBC6BL.mjs';
|
|
3
3
|
import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
4
4
|
import { CliError, CLI_ERROR_CODE, info, bold, dim, green, result } from './chunk-E2T2SBP5.mjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-DTKRN5WC.mjs';
|
|
3
3
|
import { promptYesNo } from './chunk-ITAFAORS.mjs';
|
|
4
4
|
import { parseArgs, flagBool, flagString } from './chunk-C4M3DXKC.mjs';
|
|
5
5
|
import { success, bold, info, dim, result, failure, CliError, CLI_ERROR_CODE, step, isJsonMode } from './chunk-E2T2SBP5.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cimplify/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"description": "Cimplify CLI — deploy, manage env vars, link projects, and scaffold storefronts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cimplify",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"vitest": "^4.1.5"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@cimplify/sdk": "^0.
|
|
48
|
+
"@cimplify/sdk": "^0.64.1"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/templates/manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cliVersion": "0.7.
|
|
3
|
-
"generatedAt": "2026-05-
|
|
2
|
+
"cliVersion": "0.7.9",
|
|
3
|
+
"generatedAt": "2026-05-30T06:25:45.125Z",
|
|
4
4
|
"templates": [
|
|
5
5
|
{
|
|
6
6
|
"id": "bakery",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"seedName": "default",
|
|
19
19
|
"seedBusinessId": "bus_default_akua_bakery"
|
|
20
20
|
},
|
|
21
|
-
"objectKey": "templates/bakery-v0.7.
|
|
22
|
-
"sha256": "
|
|
23
|
-
"sizeBytes":
|
|
21
|
+
"objectKey": "templates/bakery-v0.7.9.tar.gz",
|
|
22
|
+
"sha256": "b82c6c4167db7a2e16d238441931eba02cf3f3bf78959df7ad5e7610a2c9b24d",
|
|
23
|
+
"sizeBytes": 77900
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"id": "restaurant",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"seedName": "restaurant",
|
|
39
39
|
"seedBusinessId": "bus_mamas_kitchen"
|
|
40
40
|
},
|
|
41
|
-
"objectKey": "templates/restaurant-v0.7.
|
|
42
|
-
"sha256": "
|
|
43
|
-
"sizeBytes":
|
|
41
|
+
"objectKey": "templates/restaurant-v0.7.9.tar.gz",
|
|
42
|
+
"sha256": "5258a2189d1252068ec028ad3308dafe0cd4cf4f0a38587955e6c0b523690229",
|
|
43
|
+
"sizeBytes": 144756
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"id": "retail",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"seedName": "retail",
|
|
59
59
|
"seedBusinessId": "bus_currents_electronics"
|
|
60
60
|
},
|
|
61
|
-
"objectKey": "templates/retail-v0.7.
|
|
62
|
-
"sha256": "
|
|
63
|
-
"sizeBytes":
|
|
61
|
+
"objectKey": "templates/retail-v0.7.9.tar.gz",
|
|
62
|
+
"sha256": "f9d7b06f11d78101186f5a54931fa5f5493dd61e18d1edfd8d3c190cc0ac9c12",
|
|
63
|
+
"sizeBytes": 155330
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"id": "services",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
"seedName": "services",
|
|
79
79
|
"seedBusinessId": "bus_serene_spa"
|
|
80
80
|
},
|
|
81
|
-
"objectKey": "templates/services-v0.7.
|
|
82
|
-
"sha256": "
|
|
83
|
-
"sizeBytes":
|
|
81
|
+
"objectKey": "templates/services-v0.7.9.tar.gz",
|
|
82
|
+
"sha256": "cf86eb081ecd8a79ce3cc9a4f0b267dc08af5936a88679e9815db48dd759265f",
|
|
83
|
+
"sizeBytes": 77555
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
"id": "grocery",
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"seedName": "grocery",
|
|
99
99
|
"seedBusinessId": "bus_freshmart"
|
|
100
100
|
},
|
|
101
|
-
"objectKey": "templates/grocery-v0.7.
|
|
102
|
-
"sha256": "
|
|
103
|
-
"sizeBytes":
|
|
101
|
+
"objectKey": "templates/grocery-v0.7.9.tar.gz",
|
|
102
|
+
"sha256": "14d60546272a849cbed181ac5fd01ffecc1dc857615140a6a43c6e04133944f5",
|
|
103
|
+
"sizeBytes": 75037
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"id": "fashion",
|
|
@@ -118,9 +118,9 @@
|
|
|
118
118
|
"seedName": "fashion",
|
|
119
119
|
"seedBusinessId": "bus_studio_frx"
|
|
120
120
|
},
|
|
121
|
-
"objectKey": "templates/fashion-v0.7.
|
|
122
|
-
"sha256": "
|
|
123
|
-
"sizeBytes":
|
|
121
|
+
"objectKey": "templates/fashion-v0.7.9.tar.gz",
|
|
122
|
+
"sha256": "9950e7b2d6d5c5814d989c4050c4533ba8b46d887ae73bff7749b7b376b87213",
|
|
123
|
+
"sizeBytes": 163095
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
"id": "pharmacy",
|
|
@@ -138,9 +138,9 @@
|
|
|
138
138
|
"seedName": "pharmacy",
|
|
139
139
|
"seedBusinessId": "bus_wellspring_pharmacy"
|
|
140
140
|
},
|
|
141
|
-
"objectKey": "templates/pharmacy-v0.7.
|
|
142
|
-
"sha256": "
|
|
143
|
-
"sizeBytes":
|
|
141
|
+
"objectKey": "templates/pharmacy-v0.7.9.tar.gz",
|
|
142
|
+
"sha256": "753b7413abde2597d534e4d1598ca604e51c209931f89ef73e7acd0da45d7b23",
|
|
143
|
+
"sizeBytes": 159598
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
"id": "auto",
|
|
@@ -158,9 +158,9 @@
|
|
|
158
158
|
"seedName": "auto",
|
|
159
159
|
"seedBusinessId": "bus_driveline_auto"
|
|
160
160
|
},
|
|
161
|
-
"objectKey": "templates/auto-v0.7.
|
|
162
|
-
"sha256": "
|
|
163
|
-
"sizeBytes":
|
|
161
|
+
"objectKey": "templates/auto-v0.7.9.tar.gz",
|
|
162
|
+
"sha256": "28ae007267cd96793f553d77447d355dd6e10f6ea3afbe7173d41aa4e0b1f303",
|
|
163
|
+
"sizeBytes": 191829916
|
|
164
164
|
}
|
|
165
165
|
]
|
|
166
166
|
}
|
|
@@ -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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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
|
+
}
|