@ultrst-armada/floks 1.2.9 → 1.4.0
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/.krusbl-release-attestation.json +3 -3
- package/package.json +1 -1
- package/packages/ui/dist/chunk-CUQ7R3H2.js +353 -0
- package/packages/ui/dist/{chunk-X67KXI3H.js → chunk-QRSVZE4C.js} +183 -17
- package/packages/ui/dist/components/auth/index.d.ts +12 -1
- package/packages/ui/dist/components/auth/index.js +3 -1
- package/packages/ui/dist/components/workspace/index.d.ts +63 -12
- package/packages/ui/dist/components/workspace/index.js +5 -1
- package/packages/ui/dist/index.d.ts +2 -2
- package/packages/ui/dist/index.js +20 -14
- package/packages/ui/dist/chunk-KQAFKNQH.js +0 -276
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"packageName": "@ultrst-armada/floks",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"sourceCommit": "
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"sourceCommit": "f5694262a7ac70965397c1bc69e93e460cecd913",
|
|
6
6
|
"releaseWorkflow": "npm Release",
|
|
7
|
-
"workflowRunId": "
|
|
7
|
+
"workflowRunId": "40208603605"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import {
|
|
2
|
+
frnlButton,
|
|
3
|
+
frnlTextInput
|
|
4
|
+
} from "./chunk-YVWJ4SW7.js";
|
|
5
|
+
import {
|
|
6
|
+
useFloksFrnlStore
|
|
7
|
+
} from "./chunk-X4B3EBMY.js";
|
|
8
|
+
import {
|
|
9
|
+
BaseInput
|
|
10
|
+
} from "./chunk-W42SJGOJ.js";
|
|
11
|
+
import {
|
|
12
|
+
BaseButton
|
|
13
|
+
} from "./chunk-A2CDQISJ.js";
|
|
14
|
+
|
|
15
|
+
// src/components/auth/AuthPage.tsx
|
|
16
|
+
import React, { useId, useMemo, useState } from "react";
|
|
17
|
+
import { LogIn, UserPlus, Eye, EyeOff, Shield, ArrowRight, AlertCircle } from "lucide-react";
|
|
18
|
+
|
|
19
|
+
// src/components/auth/GoogleSignInButton.tsx
|
|
20
|
+
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
var GoogleSignInButton = ({
|
|
22
|
+
onSignIn,
|
|
23
|
+
disabled = false,
|
|
24
|
+
loading = false,
|
|
25
|
+
label = "CONTINUE WITH GOOGLE"
|
|
26
|
+
}) => /* @__PURE__ */ jsx(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
type: "button",
|
|
30
|
+
onClick: () => void onSignIn(),
|
|
31
|
+
disabled: disabled || loading,
|
|
32
|
+
className: "w-full py-2.5 text-[10px] font-black border-2 border-[var(--skipo-border-color)] bg-[var(--skipo-bg)] flex items-center justify-center gap-2 disabled:opacity-50",
|
|
33
|
+
"aria-label": label,
|
|
34
|
+
children: loading ? "CONNECTING GOOGLE..." : label
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// src/components/auth/AuthPage.tsx
|
|
39
|
+
import { defineFrnlComponent } from "@ultrst-armada/frnlts";
|
|
40
|
+
import { useFrnlComponent } from "@ultrst-armada/frnlts/react";
|
|
41
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
42
|
+
var AUTH_PAGE_REQUIRED_SERVICES = ["auth"];
|
|
43
|
+
var authPageDefinition = defineFrnlComponent({
|
|
44
|
+
name: "AuthPage",
|
|
45
|
+
states: {
|
|
46
|
+
idle: { name: "idle", events: { login: { functionId: "AuthPage.idle.login" }, register: { functionId: "AuthPage.idle.register" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
|
|
47
|
+
loading: { name: "loading", events: {}, visualParameters: { opacity: 0.75 }, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
|
|
48
|
+
error: { name: "error", events: { retry: { functionId: "AuthPage.error.retry" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } }
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
var AuthPage = ({
|
|
52
|
+
appName = "SKIPO",
|
|
53
|
+
appSubtitle = "WORKSPACE",
|
|
54
|
+
footerText,
|
|
55
|
+
appIcon,
|
|
56
|
+
onLogin,
|
|
57
|
+
onRegister,
|
|
58
|
+
onSuccess,
|
|
59
|
+
onGoogleSignIn,
|
|
60
|
+
onSwitchToAdmin
|
|
61
|
+
}) => {
|
|
62
|
+
const store = useFloksFrnlStore();
|
|
63
|
+
const generated = useId().replace(/[:/]/g, "");
|
|
64
|
+
const componentId = `AuthPage.${generated}`;
|
|
65
|
+
const [mode, setMode] = useState("login");
|
|
66
|
+
const [name, setName] = useState("");
|
|
67
|
+
const [email, setEmail] = useState("");
|
|
68
|
+
const [password, setPassword] = useState("");
|
|
69
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
70
|
+
const [error, setError] = useState(null);
|
|
71
|
+
const [loading, setLoading] = useState(false);
|
|
72
|
+
const [googleLoading, setGoogleLoading] = useState(false);
|
|
73
|
+
const [iconError, setIconError] = useState(false);
|
|
74
|
+
const iconSrc = typeof appIcon === "string" ? appIcon : "/src/frontend/assets/app-icon.svg";
|
|
75
|
+
const emailValid = email.trim() === "" || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim());
|
|
76
|
+
const handlers = useMemo(() => ({
|
|
77
|
+
"AuthPage.idle.login": () => {
|
|
78
|
+
},
|
|
79
|
+
"AuthPage.idle.register": () => {
|
|
80
|
+
},
|
|
81
|
+
"AuthPage.error.retry": () => setError(null)
|
|
82
|
+
}), []);
|
|
83
|
+
const frnl = useFrnlComponent({
|
|
84
|
+
id: componentId,
|
|
85
|
+
definition: authPageDefinition,
|
|
86
|
+
store,
|
|
87
|
+
state: error ? "error" : loading ? "loading" : "idle",
|
|
88
|
+
properties: { mode, appName },
|
|
89
|
+
handlers
|
|
90
|
+
});
|
|
91
|
+
const submit = async (e) => {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
const cleanEmail = email.trim();
|
|
94
|
+
if (!cleanEmail) return setError("Email address is required.");
|
|
95
|
+
if (!emailValid) return setError("Enter a valid email address.");
|
|
96
|
+
if (!password) return setError("Password is required.");
|
|
97
|
+
if (mode === "register" && !name.trim()) return setError("Display name is required.");
|
|
98
|
+
setLoading(true);
|
|
99
|
+
setError(null);
|
|
100
|
+
try {
|
|
101
|
+
const result = mode === "login" ? await onLogin(cleanEmail, password) : await onRegister({ name: name.trim(), email: cleanEmail, password });
|
|
102
|
+
if (!result.success) throw new Error(result.error || "Authentication failed.");
|
|
103
|
+
onSuccess?.(result);
|
|
104
|
+
} catch (e2) {
|
|
105
|
+
setError(e2 instanceof Error ? e2.message : "Authentication failed.");
|
|
106
|
+
} finally {
|
|
107
|
+
setLoading(false);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return /* @__PURE__ */ jsxs(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
id: componentId,
|
|
114
|
+
"data-frnl-component": "AuthPage",
|
|
115
|
+
"data-frnl-state": frnl.state,
|
|
116
|
+
className: "min-h-screen h-screen w-screen bg-[var(--skipo-bg)] text-[var(--skipo-text)] font-mono flex flex-col justify-between overflow-hidden",
|
|
117
|
+
style: { minHeight: "100vh", height: "100vh", width: "100vw" },
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsxs("header", { className: "border-b-2 border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] px-6 py-3.5 flex items-center justify-between shrink-0", children: [
|
|
120
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
121
|
+
appIcon && typeof appIcon !== "string" ? /* @__PURE__ */ jsx2("div", { className: "w-8 h-8 shrink-0 flex items-center justify-center", children: appIcon }) : !iconError ? /* @__PURE__ */ jsx2("div", { className: "w-8 h-8 shrink-0 flex items-center justify-center overflow-hidden rounded bg-[var(--skipo-surface)] border border-[var(--skipo-border-color)]", children: /* @__PURE__ */ jsx2(
|
|
122
|
+
"img",
|
|
123
|
+
{
|
|
124
|
+
src: iconSrc,
|
|
125
|
+
alt: appName,
|
|
126
|
+
className: "w-6 h-6 object-contain shrink-0",
|
|
127
|
+
onError: () => setIconError(true)
|
|
128
|
+
}
|
|
129
|
+
) }) : /* @__PURE__ */ jsx2("div", { className: "w-8 h-8 shrink-0 bg-[var(--skipo-accent)] text-black font-black flex items-center justify-center text-xs rounded select-none", children: "\u25B2" }),
|
|
130
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
131
|
+
/* @__PURE__ */ jsx2("span", { className: "text-sm font-black uppercase tracking-wider", children: appName }),
|
|
132
|
+
/* @__PURE__ */ jsx2("span", { className: "ml-2 text-[10px] text-[var(--skipo-text-muted)] tracking-tight", children: appSubtitle })
|
|
133
|
+
] })
|
|
134
|
+
] }),
|
|
135
|
+
onSwitchToAdmin && /* @__PURE__ */ jsxs("button", { type: "button", onClick: onSwitchToAdmin, className: "px-3 py-1.5 text-[10px] font-black border-2 border-[var(--skipo-accent)] text-[var(--skipo-accent)] flex items-center gap-1.5", children: [
|
|
136
|
+
/* @__PURE__ */ jsx2(Shield, { size: 13 }),
|
|
137
|
+
" ADMIN ",
|
|
138
|
+
/* @__PURE__ */ jsx2(ArrowRight, { size: 13 })
|
|
139
|
+
] })
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ jsx2("main", { className: "flex-1 flex items-center justify-center p-4 overflow-auto", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md border-2 border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] shadow-[6px_6px_0px_var(--skipo-border-color)] p-6 my-auto", children: [
|
|
142
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 mb-5", children: [
|
|
143
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
|
|
144
|
+
setMode("login");
|
|
145
|
+
setError(null);
|
|
146
|
+
}, className: `py-2 text-[10px] font-black border ${mode === "login" ? "bg-[var(--skipo-accent)] text-black" : "bg-[var(--skipo-bg)]"}`, children: [
|
|
147
|
+
/* @__PURE__ */ jsx2(LogIn, { size: 13, className: "inline mr-1" }),
|
|
148
|
+
" SIGN IN"
|
|
149
|
+
] }),
|
|
150
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
|
|
151
|
+
setMode("register");
|
|
152
|
+
setError(null);
|
|
153
|
+
}, className: `py-2 text-[10px] font-black border ${mode === "register" ? "bg-[var(--skipo-accent)] text-black" : "bg-[var(--skipo-bg)]"}`, children: [
|
|
154
|
+
/* @__PURE__ */ jsx2(UserPlus, { size: 13, className: "inline mr-1" }),
|
|
155
|
+
" CREATE ACCOUNT"
|
|
156
|
+
] })
|
|
157
|
+
] }),
|
|
158
|
+
error && /* @__PURE__ */ jsxs("div", { className: "mb-4 p-3 border-2 border-red-500/80 bg-red-950/30 text-red-300 text-xs flex items-center gap-2", children: [
|
|
159
|
+
/* @__PURE__ */ jsx2(AlertCircle, { size: 14 }),
|
|
160
|
+
error
|
|
161
|
+
] }),
|
|
162
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: submit, className: "space-y-3", children: [
|
|
163
|
+
mode === "register" && React.createElement(frnlTextInput, { id: componentId + ".name", label: "Full Name", value: name, onChange: (e) => setName(e.target.value) }),
|
|
164
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
165
|
+
React.createElement(frnlTextInput, { id: componentId + ".email", label: "Email Address", value: email, onChange: (e) => setEmail(e.target.value), type: "email", autoComplete: "username" }),
|
|
166
|
+
!emailValid && /* @__PURE__ */ jsx2("div", { className: "mt-1 text-[10px] text-red-400", children: "Enter a valid email address." })
|
|
167
|
+
] }),
|
|
168
|
+
/* @__PURE__ */ jsx2("div", { children: React.createElement(frnlTextInput, { id: componentId + ".password", label: "Password", value: password, onChange: (e) => setPassword(e.target.value), type: showPassword ? "text" : "password", autoComplete: mode === "login" ? "current-password" : "new-password", trailingIcon: /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": "Toggle password visibility", onClick: () => setShowPassword((v) => !v), children: showPassword ? /* @__PURE__ */ jsx2(EyeOff, { size: 13 }) : /* @__PURE__ */ jsx2(Eye, { size: 13 }) }) }) }),
|
|
169
|
+
React.createElement(frnlButton, { type: "submit", disabled: loading, loading, variant: "accent", size: "lg", className: "w-full", icon: /* @__PURE__ */ jsx2(ArrowRight, { size: 13 }) }, mode === "login" ? "SIGN IN TO WORKSPACE" : "CREATE ACCOUNT")
|
|
170
|
+
] }),
|
|
171
|
+
onGoogleSignIn && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
172
|
+
/* @__PURE__ */ jsxs("div", { className: "my-4 flex items-center gap-2 text-[9px] text-[var(--skipo-text-muted)]", children: [
|
|
173
|
+
/* @__PURE__ */ jsx2("span", { className: "h-px flex-1 bg-[var(--skipo-border-color)]" }),
|
|
174
|
+
" OR ",
|
|
175
|
+
/* @__PURE__ */ jsx2("span", { className: "h-px flex-1 bg-[var(--skipo-border-color)]" })
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ jsx2(
|
|
178
|
+
GoogleSignInButton,
|
|
179
|
+
{
|
|
180
|
+
onSignIn: async () => {
|
|
181
|
+
setGoogleLoading(true);
|
|
182
|
+
setError(null);
|
|
183
|
+
try {
|
|
184
|
+
const result = await onGoogleSignIn();
|
|
185
|
+
if (!result.success) throw new Error(result.error || "Google sign-in failed.");
|
|
186
|
+
onSuccess?.(result);
|
|
187
|
+
} catch (error2) {
|
|
188
|
+
setError(error2 instanceof Error ? error2.message : "Google sign-in failed.");
|
|
189
|
+
} finally {
|
|
190
|
+
setGoogleLoading(false);
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
disabled: loading,
|
|
194
|
+
loading: googleLoading
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-5 pt-3 border-t border-[var(--skipo-border-color)] text-center text-[10px] text-[var(--skipo-text-muted)]", children: footerText || `${appName} WORKSPACE SYSTEM` })
|
|
199
|
+
] }) })
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// src/components/auth/LoginModal.tsx
|
|
206
|
+
import { useState as useState2 } from "react";
|
|
207
|
+
import { ArrowRight as ArrowRight2, ShieldCheck, AlertCircle as AlertCircle2 } from "lucide-react";
|
|
208
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
209
|
+
var LoginModal = ({
|
|
210
|
+
appName = "Ecosystem App",
|
|
211
|
+
onSuccess,
|
|
212
|
+
defaultEmail = ""
|
|
213
|
+
}) => {
|
|
214
|
+
const [email, setEmail] = useState2(defaultEmail);
|
|
215
|
+
const [password, setPassword] = useState2("");
|
|
216
|
+
const [isRegister, setIsRegister] = useState2(false);
|
|
217
|
+
const [name, setName] = useState2("");
|
|
218
|
+
const [loading, setLoading] = useState2(false);
|
|
219
|
+
const [error, setError] = useState2(null);
|
|
220
|
+
const handleSubmit = async (e) => {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
setError(null);
|
|
223
|
+
setLoading(true);
|
|
224
|
+
try {
|
|
225
|
+
const endpoint = isRegister ? "/api/auth/register" : "/api/auth/login";
|
|
226
|
+
const payload = isRegister ? { email, password, name } : { email, password };
|
|
227
|
+
const res = await fetch(endpoint, {
|
|
228
|
+
method: "POST",
|
|
229
|
+
headers: { "Content-Type": "application/json" },
|
|
230
|
+
body: JSON.stringify(payload)
|
|
231
|
+
});
|
|
232
|
+
const data = await res.json().catch(() => ({}));
|
|
233
|
+
if (!res.ok || !data.success || !data.user) {
|
|
234
|
+
throw new Error(data.error || "Authentication failed. Please verify credentials.");
|
|
235
|
+
}
|
|
236
|
+
const token = data.token || `usr_${Date.now()}`;
|
|
237
|
+
if (typeof window !== "undefined") {
|
|
238
|
+
localStorage.setItem("skipo_auth_token", token);
|
|
239
|
+
localStorage.setItem("skipo_user", JSON.stringify(data.user));
|
|
240
|
+
}
|
|
241
|
+
onSuccess(data.user, token);
|
|
242
|
+
} catch (err) {
|
|
243
|
+
setError(err.message || "Server error. Authentication failed.");
|
|
244
|
+
} finally {
|
|
245
|
+
setLoading(false);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
return /* @__PURE__ */ jsx3(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-xs font-mono p-4",
|
|
252
|
+
onWheel: (e) => e.stopPropagation(),
|
|
253
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
254
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "w-full max-w-md p-6 border-2 border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] text-[var(--skipo-text)] shadow-2xl rounded-lg space-y-4", children: [
|
|
255
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between pb-3 border-b border-[var(--skipo-border-color)]", children: [
|
|
256
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
257
|
+
/* @__PURE__ */ jsx3("div", { className: "w-7 h-7 bg-[var(--skipo-accent)] text-black font-black flex items-center justify-center text-xs rounded", children: "\u25B2" }),
|
|
258
|
+
/* @__PURE__ */ jsxs2("span", { className: "font-black text-sm tracking-wider uppercase text-[var(--skipo-text)]", children: [
|
|
259
|
+
appName,
|
|
260
|
+
" Authentication"
|
|
261
|
+
] })
|
|
262
|
+
] }),
|
|
263
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-[9px] px-2 py-0.5 border border-emerald-500/50 bg-emerald-500/10 text-emerald-300 font-bold rounded flex items-center gap-1", children: [
|
|
264
|
+
/* @__PURE__ */ jsx3(ShieldCheck, { size: 10 }),
|
|
265
|
+
" SYSTEM DB"
|
|
266
|
+
] })
|
|
267
|
+
] }),
|
|
268
|
+
error && /* @__PURE__ */ jsxs2("div", { className: "p-3 border border-red-500/60 bg-red-500/10 text-red-300 text-xs rounded flex items-start gap-2", children: [
|
|
269
|
+
/* @__PURE__ */ jsx3(AlertCircle2, { size: 14, className: "shrink-0 mt-0.5" }),
|
|
270
|
+
/* @__PURE__ */ jsx3("span", { children: error })
|
|
271
|
+
] }),
|
|
272
|
+
/* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-3", children: [
|
|
273
|
+
isRegister && /* @__PURE__ */ jsxs2("div", { children: [
|
|
274
|
+
/* @__PURE__ */ jsx3("label", { className: "block text-[10px] font-black uppercase mb-1", children: "Full Name *" }),
|
|
275
|
+
/* @__PURE__ */ jsx3(
|
|
276
|
+
BaseInput,
|
|
277
|
+
{
|
|
278
|
+
type: "text",
|
|
279
|
+
value: name,
|
|
280
|
+
onChange: (e) => setName(e.target.value),
|
|
281
|
+
placeholder: "Developer Name",
|
|
282
|
+
required: isRegister
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] }),
|
|
286
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
287
|
+
/* @__PURE__ */ jsx3("label", { className: "block text-[10px] font-black uppercase mb-1", children: "Email Address *" }),
|
|
288
|
+
/* @__PURE__ */ jsx3(
|
|
289
|
+
BaseInput,
|
|
290
|
+
{
|
|
291
|
+
type: "email",
|
|
292
|
+
value: email,
|
|
293
|
+
onChange: (e) => setEmail(e.target.value),
|
|
294
|
+
placeholder: "user@example.com",
|
|
295
|
+
required: true
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] }),
|
|
299
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
300
|
+
/* @__PURE__ */ jsx3("label", { className: "block text-[10px] font-black uppercase mb-1", children: "Password *" }),
|
|
301
|
+
/* @__PURE__ */ jsx3(
|
|
302
|
+
BaseInput,
|
|
303
|
+
{
|
|
304
|
+
type: "password",
|
|
305
|
+
value: password,
|
|
306
|
+
onChange: (e) => setPassword(e.target.value),
|
|
307
|
+
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
308
|
+
required: true
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ jsx3("div", { className: "pt-2", children: /* @__PURE__ */ jsxs2(
|
|
313
|
+
BaseButton,
|
|
314
|
+
{
|
|
315
|
+
variant: "accent",
|
|
316
|
+
size: "md",
|
|
317
|
+
type: "submit",
|
|
318
|
+
disabled: loading,
|
|
319
|
+
className: "w-full flex items-center justify-center gap-2",
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ jsx3("span", { children: loading ? "AUTHENTICATING..." : isRegister ? "REGISTER & ENTER" : "SIGN IN" }),
|
|
322
|
+
/* @__PURE__ */ jsx3(ArrowRight2, { size: 14 })
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
) })
|
|
326
|
+
] }),
|
|
327
|
+
/* @__PURE__ */ jsxs2("div", { className: "pt-2 border-t border-[var(--skipo-border-color)]/60 flex items-center justify-between text-[11px]", children: [
|
|
328
|
+
/* @__PURE__ */ jsx3(
|
|
329
|
+
"button",
|
|
330
|
+
{
|
|
331
|
+
type: "button",
|
|
332
|
+
onClick: () => {
|
|
333
|
+
setIsRegister(!isRegister);
|
|
334
|
+
setError(null);
|
|
335
|
+
},
|
|
336
|
+
className: "text-[var(--skipo-accent)] hover:underline cursor-pointer",
|
|
337
|
+
children: isRegister ? "Already have an account? Sign In" : "Create new account"
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
/* @__PURE__ */ jsx3("span", { className: "text-[10px] text-[var(--skipo-text-muted)]", children: "ULTRST Identity" })
|
|
341
|
+
] })
|
|
342
|
+
] })
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
export {
|
|
348
|
+
GoogleSignInButton,
|
|
349
|
+
AUTH_PAGE_REQUIRED_SERVICES,
|
|
350
|
+
authPageDefinition,
|
|
351
|
+
AuthPage,
|
|
352
|
+
LoginModal
|
|
353
|
+
};
|
|
@@ -44,13 +44,21 @@ var SrklBackblazeTile = ({
|
|
|
44
44
|
selectedBucketName,
|
|
45
45
|
isSelectedAccount,
|
|
46
46
|
onSelectBucket,
|
|
47
|
-
userId
|
|
47
|
+
userId,
|
|
48
|
+
storageService
|
|
48
49
|
}) => {
|
|
49
50
|
const [buckets, setBuckets] = useState([]);
|
|
50
51
|
const [loading, setLoading] = useState(false);
|
|
51
52
|
const fetchBuckets = async () => {
|
|
52
53
|
setLoading(true);
|
|
53
54
|
try {
|
|
55
|
+
if (storageService?.listBackblazeBuckets) {
|
|
56
|
+
const res2 = await storageService.listBackblazeBuckets(account.id, userId || "");
|
|
57
|
+
if (Array.isArray(res2) && res2.length > 0) {
|
|
58
|
+
setBuckets(res2);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
54
62
|
const creds = account.credentials || account.metadata?.credentials || {};
|
|
55
63
|
const keyId = creds.keyId || creds.b2KeyId || "";
|
|
56
64
|
const applicationKey = creds.applicationKey || creds.b2ApplicationKey || "";
|
|
@@ -58,7 +66,7 @@ var SrklBackblazeTile = ({
|
|
|
58
66
|
const res = await fetch("/api/srkl/backblaze/buckets", {
|
|
59
67
|
method: "POST",
|
|
60
68
|
headers: { "Content-Type": "application/json" },
|
|
61
|
-
body: JSON.stringify({ keyId, applicationKey, userId, bucketName: defaultBucket })
|
|
69
|
+
body: JSON.stringify({ accountId: account.id, keyId, applicationKey, userId, bucketName: defaultBucket })
|
|
62
70
|
});
|
|
63
71
|
const data = await res.json().catch(() => ({}));
|
|
64
72
|
if (data.success && Array.isArray(data.buckets)) {
|
|
@@ -122,18 +130,28 @@ import { HardDrive as HardDrive2, Cloud as Cloud2, RefreshCw as RefreshCw2 } fro
|
|
|
122
130
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
123
131
|
var StorageOptionTiles = ({
|
|
124
132
|
currentUser,
|
|
133
|
+
userId,
|
|
125
134
|
selectedConnectionId,
|
|
135
|
+
storageService,
|
|
126
136
|
onSelectStorage
|
|
127
137
|
}) => {
|
|
128
138
|
const [activeId, setActiveId] = useState2(selectedConnectionId || "local_default");
|
|
129
139
|
const [selectedBucket, setSelectedBucket] = useState2("");
|
|
130
140
|
const [srklAccounts, setSrklAccounts] = useState2([]);
|
|
131
141
|
const [loadingSrkl, setLoadingSrkl] = useState2(false);
|
|
142
|
+
const effectiveUserId = currentUser?.id || userId || "";
|
|
132
143
|
const fetchSrklAccounts = useCallback(async () => {
|
|
133
|
-
if (!
|
|
144
|
+
if (!effectiveUserId) return;
|
|
134
145
|
setLoadingSrkl(true);
|
|
135
146
|
try {
|
|
136
|
-
|
|
147
|
+
if (storageService?.listBackblazeAccounts) {
|
|
148
|
+
const accs = await storageService.listBackblazeAccounts(effectiveUserId);
|
|
149
|
+
if (Array.isArray(accs) && accs.length > 0) {
|
|
150
|
+
setSrklAccounts(accs);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const uId = encodeURIComponent(effectiveUserId);
|
|
137
155
|
const res = await fetch(`/api/srkl/accounts?service=backblaze&userId=${uId}`);
|
|
138
156
|
const data = await res.json().catch(() => ({}));
|
|
139
157
|
if (data.success && Array.isArray(data.accounts)) {
|
|
@@ -143,7 +161,7 @@ var StorageOptionTiles = ({
|
|
|
143
161
|
} finally {
|
|
144
162
|
setLoadingSrkl(false);
|
|
145
163
|
}
|
|
146
|
-
}, [
|
|
164
|
+
}, [effectiveUserId, storageService]);
|
|
147
165
|
useEffect2(() => {
|
|
148
166
|
fetchSrklAccounts();
|
|
149
167
|
}, [fetchSrklAccounts]);
|
|
@@ -216,7 +234,8 @@ var StorageOptionTiles = ({
|
|
|
216
234
|
selectedBucketName: selectedBucket,
|
|
217
235
|
isSelectedAccount: account.id === activeId,
|
|
218
236
|
onSelectBucket: handleSelectSrklBucket,
|
|
219
|
-
userId:
|
|
237
|
+
userId: effectiveUserId,
|
|
238
|
+
storageService
|
|
220
239
|
},
|
|
221
240
|
account.id
|
|
222
241
|
))
|
|
@@ -425,6 +444,31 @@ import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
|
425
444
|
import { Cloud as Cloud5, HardDrive as HardDrive5, Loader2 } from "lucide-react";
|
|
426
445
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
427
446
|
var WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES = ["workspace", "storage", "srkl"];
|
|
447
|
+
var defaultWorkspaceStorageService = {
|
|
448
|
+
listBackblazeAccounts: async (userId) => {
|
|
449
|
+
try {
|
|
450
|
+
const uId = encodeURIComponent(userId);
|
|
451
|
+
const res = await fetch(`/api/srkl/accounts?service=backblaze&userId=${uId}`);
|
|
452
|
+
const data = await res.json().catch(() => ({}));
|
|
453
|
+
return Array.isArray(data?.accounts) ? data.accounts : [];
|
|
454
|
+
} catch {
|
|
455
|
+
return [];
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
listBackblazeBuckets: async (accountId, userId) => {
|
|
459
|
+
try {
|
|
460
|
+
const res = await fetch("/api/srkl/backblaze/buckets", {
|
|
461
|
+
method: "POST",
|
|
462
|
+
headers: { "Content-Type": "application/json" },
|
|
463
|
+
body: JSON.stringify({ accountId, userId })
|
|
464
|
+
});
|
|
465
|
+
const data = await res.json().catch(() => ({}));
|
|
466
|
+
return Array.isArray(data?.buckets) ? data.buckets : [];
|
|
467
|
+
} catch {
|
|
468
|
+
return [];
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
};
|
|
428
472
|
function createKloksWorkspaceStorageService(invoker) {
|
|
429
473
|
return {
|
|
430
474
|
listBackblazeAccounts: async (userId) => {
|
|
@@ -437,7 +481,14 @@ function createKloksWorkspaceStorageService(invoker) {
|
|
|
437
481
|
}
|
|
438
482
|
};
|
|
439
483
|
}
|
|
440
|
-
function WorkspaceCreateDialog({
|
|
484
|
+
function WorkspaceCreateDialog({
|
|
485
|
+
open,
|
|
486
|
+
userId = "system",
|
|
487
|
+
currentUser,
|
|
488
|
+
storageService = defaultWorkspaceStorageService,
|
|
489
|
+
onClose,
|
|
490
|
+
onSubmit
|
|
491
|
+
}) {
|
|
441
492
|
const [name, setName] = useState5("");
|
|
442
493
|
const [description, setDescription] = useState5("");
|
|
443
494
|
const [provider, setProvider] = useState5("local_fs");
|
|
@@ -448,19 +499,20 @@ function WorkspaceCreateDialog({ open, userId, storageService, onClose, onSubmit
|
|
|
448
499
|
const [loading, setLoading] = useState5(false);
|
|
449
500
|
const [loadingBuckets, setLoadingBuckets] = useState5(false);
|
|
450
501
|
const [error, setError] = useState5(null);
|
|
502
|
+
const effectiveUserId = userId || currentUser?.id || "system";
|
|
451
503
|
useEffect3(() => {
|
|
452
|
-
if (!open || !
|
|
504
|
+
if (!open || !effectiveUserId) return;
|
|
453
505
|
setError(null);
|
|
454
|
-
storageService.listBackblazeAccounts(
|
|
455
|
-
}, [open,
|
|
506
|
+
storageService.listBackblazeAccounts(effectiveUserId).then(setAccounts).catch((e) => setError(e instanceof Error ? e.message : "Failed to load SRKL accounts."));
|
|
507
|
+
}, [open, effectiveUserId, storageService]);
|
|
456
508
|
useEffect3(() => {
|
|
457
509
|
if (provider !== "backblaze_b2" || !accountId) return;
|
|
458
510
|
setLoadingBuckets(true);
|
|
459
|
-
storageService.listBackblazeBuckets(accountId,
|
|
511
|
+
storageService.listBackblazeBuckets(accountId, effectiveUserId).then((items) => {
|
|
460
512
|
setBuckets(items);
|
|
461
513
|
setBucketName("");
|
|
462
514
|
}).catch((e) => setError(e instanceof Error ? e.message : "Failed to load Backblaze buckets.")).finally(() => setLoadingBuckets(false));
|
|
463
|
-
}, [provider, accountId, storageService]);
|
|
515
|
+
}, [provider, accountId, effectiveUserId, storageService]);
|
|
464
516
|
if (!open) return null;
|
|
465
517
|
const submit = async (e) => {
|
|
466
518
|
e.preventDefault();
|
|
@@ -469,9 +521,18 @@ function WorkspaceCreateDialog({ open, userId, storageService, onClose, onSubmit
|
|
|
469
521
|
setLoading(true);
|
|
470
522
|
try {
|
|
471
523
|
const account = accounts.find((a) => a.id === accountId);
|
|
524
|
+
const storageObj = {
|
|
525
|
+
provider,
|
|
526
|
+
connectionId: accountId || void 0,
|
|
527
|
+
b2BucketName: provider === "backblaze_b2" ? bucketName : void 0,
|
|
528
|
+
b2Endpoint: account?.credentials?.endpoint,
|
|
529
|
+
b2Region: account?.credentials?.region,
|
|
530
|
+
localFolderName: provider === "local_fs" ? name.trim() : void 0
|
|
531
|
+
};
|
|
472
532
|
await onSubmit({
|
|
473
533
|
name: name.trim(),
|
|
474
534
|
description: description.trim() || void 0,
|
|
535
|
+
storage: storageObj,
|
|
475
536
|
storageProvider: provider,
|
|
476
537
|
storageConnectionId: accountId || void 0,
|
|
477
538
|
localFolderName: provider === "local_fs" ? name.trim() : void 0,
|
|
@@ -550,8 +611,10 @@ var workspaceTilesMenuDefinition = defineFrnlComponent({
|
|
|
550
611
|
function WorkspaceTilesMenu({
|
|
551
612
|
workspaces,
|
|
552
613
|
userId,
|
|
614
|
+
currentUser,
|
|
553
615
|
activeWorkspaceId = null,
|
|
554
|
-
|
|
616
|
+
appName = "Workspaces",
|
|
617
|
+
storageService = defaultWorkspaceStorageService,
|
|
555
618
|
onSelectWorkspace,
|
|
556
619
|
onCreateWorkspace,
|
|
557
620
|
onUpdateWorkspace: _onUpdateWorkspace,
|
|
@@ -561,6 +624,7 @@ function WorkspaceTilesMenu({
|
|
|
561
624
|
error = null
|
|
562
625
|
}) {
|
|
563
626
|
const store = useFloksFrnlStore();
|
|
627
|
+
const effectiveUserId = userId || currentUser?.id || "system";
|
|
564
628
|
const generated = useId().replace(/[:/]/g, "");
|
|
565
629
|
const componentId = `workspaceTilesMenu.${generated}`;
|
|
566
630
|
const [creating, setCreating] = useState6(false);
|
|
@@ -597,20 +661,120 @@ function WorkspaceTilesMenu({
|
|
|
597
661
|
renderTile: (ws, selected) => /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
598
662
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 text-xs font-black uppercase", children: [
|
|
599
663
|
ws.storageProvider === "backblaze_b2" ? /* @__PURE__ */ jsx7(Cloud6, { size: 14 }) : /* @__PURE__ */ jsx7(HardDrive6, { size: 14 }),
|
|
600
|
-
ws.title
|
|
664
|
+
ws.title || ws.name || "Workspace"
|
|
601
665
|
] }),
|
|
602
666
|
/* @__PURE__ */ jsx7("p", { className: "mt-2 text-[11px] text-[var(--skipo-text-muted)]", children: ws.description }),
|
|
603
667
|
/* @__PURE__ */ jsxs7("div", { className: `mt-2 text-[10px] ${selected || ws.id === activeWorkspaceId ? "text-[var(--skipo-accent)]" : "text-[var(--skipo-text-muted)]"}`, children: [
|
|
604
668
|
/* @__PURE__ */ jsx7(FolderOpen, { size: 11, className: "inline mr-1" }),
|
|
605
|
-
ws.workspacePath ?? ws.b2BucketName ?? ws.id
|
|
669
|
+
ws.workspacePath ?? ws.b2BucketName ?? ws.localFolderName ?? ws.id
|
|
606
670
|
] })
|
|
607
671
|
] })
|
|
608
672
|
}
|
|
609
673
|
),
|
|
610
|
-
/* @__PURE__ */ jsx7(WorkspaceCreateDialog, { open: creating, userId, storageService, onClose: () => setCreating(false), onSubmit: onCreateWorkspace })
|
|
674
|
+
/* @__PURE__ */ jsx7(WorkspaceCreateDialog, { open: creating, userId: effectiveUserId, currentUser, storageService, onClose: () => setCreating(false), onSubmit: onCreateWorkspace })
|
|
611
675
|
] });
|
|
612
676
|
}
|
|
613
677
|
|
|
678
|
+
// src/components/workspace/WorkspaceGate.tsx
|
|
679
|
+
import { useMemo as useMemo2 } from "react";
|
|
680
|
+
import { LogOut as LogOut2, ArrowLeft } from "lucide-react";
|
|
681
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
682
|
+
var WorkspaceGate = ({
|
|
683
|
+
workspaces,
|
|
684
|
+
activeWorkspaceId,
|
|
685
|
+
userId,
|
|
686
|
+
currentUser,
|
|
687
|
+
appName = "Workspaces",
|
|
688
|
+
appSubtitle = "WORKSPACE VAULT GATEWAY \u2022 ISOLATION ENFORCED (LAW L6)",
|
|
689
|
+
storageService,
|
|
690
|
+
onSelectWorkspace,
|
|
691
|
+
onCreateWorkspace,
|
|
692
|
+
onUpdateWorkspace,
|
|
693
|
+
onDeleteWorkspace,
|
|
694
|
+
onLogout,
|
|
695
|
+
canClose,
|
|
696
|
+
onClose,
|
|
697
|
+
loading = false,
|
|
698
|
+
error = null
|
|
699
|
+
}) => {
|
|
700
|
+
const normalizedWorkspaces = useMemo2(() => {
|
|
701
|
+
return (workspaces || []).map((w) => ({
|
|
702
|
+
id: w.id,
|
|
703
|
+
title: w.title || w.name || "Workspace",
|
|
704
|
+
name: w.name || w.title || "Workspace",
|
|
705
|
+
description: w.description || "Workspace vault for workflows and graph state",
|
|
706
|
+
workspacePath: w.workspacePath || "./projects",
|
|
707
|
+
storageProvider: w.storageProvider || w.storage?.provider || "local_fs",
|
|
708
|
+
storageConnectionId: w.storageConnectionId || w.storage?.storageConnectionId,
|
|
709
|
+
b2BucketName: w.b2BucketName || w.storage?.b2BucketName,
|
|
710
|
+
b2Endpoint: w.b2Endpoint || w.storage?.b2Endpoint,
|
|
711
|
+
b2Region: w.b2Region || w.storage?.b2Region,
|
|
712
|
+
localFolderName: w.localFolderName || w.storage?.localFolderName,
|
|
713
|
+
metadata: w.metadata
|
|
714
|
+
}));
|
|
715
|
+
}, [workspaces]);
|
|
716
|
+
const effectiveUserId = userId || currentUser?.id || "system";
|
|
717
|
+
return /* @__PURE__ */ jsx8(
|
|
718
|
+
"div",
|
|
719
|
+
{
|
|
720
|
+
className: "min-h-screen h-screen w-screen bg-[var(--skipo-bg,#0b0e17)] text-[var(--skipo-text,#f8fafc)] font-mono p-6 sm:p-8 flex flex-col items-center justify-center overflow-auto",
|
|
721
|
+
style: { minHeight: "100vh", height: "100vh", width: "100vw" },
|
|
722
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "w-full max-w-4xl my-auto", children: [
|
|
723
|
+
/* @__PURE__ */ jsxs8("header", { className: "mb-6 flex items-center justify-between border-b border-[var(--skipo-border-color,#1e293b)] pb-4", children: [
|
|
724
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
725
|
+
/* @__PURE__ */ jsx8("h1", { className: "text-2xl font-black tracking-wider text-[var(--skipo-accent,#f59e0b)] uppercase", children: appName }),
|
|
726
|
+
/* @__PURE__ */ jsx8("p", { className: "text-xs text-[var(--skipo-text-muted,#94a3b8)] font-mono tracking-tight mt-0.5", children: appSubtitle })
|
|
727
|
+
] }),
|
|
728
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
729
|
+
canClose && onClose && /* @__PURE__ */ jsxs8(
|
|
730
|
+
"button",
|
|
731
|
+
{
|
|
732
|
+
type: "button",
|
|
733
|
+
onClick: onClose,
|
|
734
|
+
className: "h-8 px-3 border border-[var(--skipo-border-color,#1e293b)] hover:border-[var(--skipo-accent,#f59e0b)] text-[var(--skipo-text-muted)] hover:text-[var(--skipo-text)] text-[10px] font-black flex items-center gap-1.5 transition-colors",
|
|
735
|
+
children: [
|
|
736
|
+
/* @__PURE__ */ jsx8(ArrowLeft, { size: 13 }),
|
|
737
|
+
" BACK TO APP"
|
|
738
|
+
]
|
|
739
|
+
}
|
|
740
|
+
),
|
|
741
|
+
onLogout && /* @__PURE__ */ jsxs8(
|
|
742
|
+
"button",
|
|
743
|
+
{
|
|
744
|
+
type: "button",
|
|
745
|
+
onClick: onLogout,
|
|
746
|
+
className: "h-8 px-3 border border-red-500/60 hover:bg-red-950/20 text-red-300 text-[10px] font-black flex items-center gap-1.5 transition-colors",
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ jsx8(LogOut2, { size: 12 }),
|
|
749
|
+
" LOGOUT"
|
|
750
|
+
]
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
] })
|
|
754
|
+
] }),
|
|
755
|
+
/* @__PURE__ */ jsx8(
|
|
756
|
+
WorkspaceTilesMenu,
|
|
757
|
+
{
|
|
758
|
+
workspaces: normalizedWorkspaces,
|
|
759
|
+
activeWorkspaceId,
|
|
760
|
+
userId: effectiveUserId,
|
|
761
|
+
currentUser,
|
|
762
|
+
appName,
|
|
763
|
+
storageService,
|
|
764
|
+
onSelectWorkspace,
|
|
765
|
+
onCreateWorkspace: onCreateWorkspace || (() => {
|
|
766
|
+
}),
|
|
767
|
+
onUpdateWorkspace,
|
|
768
|
+
onDeleteWorkspace,
|
|
769
|
+
loading,
|
|
770
|
+
error
|
|
771
|
+
}
|
|
772
|
+
)
|
|
773
|
+
] })
|
|
774
|
+
}
|
|
775
|
+
);
|
|
776
|
+
};
|
|
777
|
+
|
|
614
778
|
export {
|
|
615
779
|
StoragePresetTile,
|
|
616
780
|
SrklBackblazeTile,
|
|
@@ -618,9 +782,11 @@ export {
|
|
|
618
782
|
WorkspaceStorageReadonlyPanel,
|
|
619
783
|
WorkspaceSecondaryClonesPanel,
|
|
620
784
|
WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES,
|
|
785
|
+
defaultWorkspaceStorageService,
|
|
621
786
|
createKloksWorkspaceStorageService,
|
|
622
787
|
WorkspaceCreateDialog,
|
|
623
788
|
WORKSPACE_TILES_MENU_REQUIRED_SERVICES,
|
|
624
789
|
workspaceTilesMenuDefinition,
|
|
625
|
-
WorkspaceTilesMenu
|
|
790
|
+
WorkspaceTilesMenu,
|
|
791
|
+
WorkspaceGate
|
|
626
792
|
};
|
|
@@ -6,11 +6,13 @@ interface AuthResult {
|
|
|
6
6
|
error?: string;
|
|
7
7
|
user?: unknown;
|
|
8
8
|
token?: string;
|
|
9
|
+
redirectUrl?: string;
|
|
9
10
|
}
|
|
10
11
|
interface AuthPageProps {
|
|
11
12
|
appName?: string;
|
|
12
13
|
appSubtitle?: string;
|
|
13
14
|
footerText?: string;
|
|
15
|
+
appIcon?: string | React__default.ReactNode;
|
|
14
16
|
onLogin: (email: string, password: string) => Promise<AuthResult>;
|
|
15
17
|
onRegister: (input: {
|
|
16
18
|
name: string;
|
|
@@ -18,6 +20,7 @@ interface AuthPageProps {
|
|
|
18
20
|
password: string;
|
|
19
21
|
}) => Promise<AuthResult>;
|
|
20
22
|
onSuccess?: (result: AuthResult) => void;
|
|
23
|
+
onGoogleSignIn?: () => Promise<AuthResult>;
|
|
21
24
|
onSwitchToAdmin?: () => void;
|
|
22
25
|
}
|
|
23
26
|
declare const authPageDefinition: {
|
|
@@ -83,4 +86,12 @@ interface LoginModalProps {
|
|
|
83
86
|
}
|
|
84
87
|
declare const LoginModal: React__default.FC<LoginModalProps>;
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
interface GoogleSignInButtonProps {
|
|
90
|
+
onSignIn: () => Promise<void> | void;
|
|
91
|
+
disabled?: boolean;
|
|
92
|
+
loading?: boolean;
|
|
93
|
+
label?: string;
|
|
94
|
+
}
|
|
95
|
+
declare const GoogleSignInButton: React__default.FC<GoogleSignInButtonProps>;
|
|
96
|
+
|
|
97
|
+
export { AUTH_PAGE_REQUIRED_SERVICES, AuthPage, type AuthPageProps, type AuthResult, GoogleSignInButton, type GoogleSignInButtonProps, LoginModal, type LoginModalProps, authPageDefinition };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AUTH_PAGE_REQUIRED_SERVICES,
|
|
3
3
|
AuthPage,
|
|
4
|
+
GoogleSignInButton,
|
|
4
5
|
LoginModal,
|
|
5
6
|
authPageDefinition
|
|
6
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-CUQ7R3H2.js";
|
|
7
8
|
import "../../chunk-YVWJ4SW7.js";
|
|
8
9
|
import "../../chunk-5ZMXFCD4.js";
|
|
9
10
|
import "../../chunk-C3L53YN4.js";
|
|
@@ -14,6 +15,7 @@ import "../../chunk-A2CDQISJ.js";
|
|
|
14
15
|
export {
|
|
15
16
|
AUTH_PAGE_REQUIRED_SERVICES,
|
|
16
17
|
AuthPage,
|
|
18
|
+
GoogleSignInButton,
|
|
17
19
|
LoginModal,
|
|
18
20
|
authPageDefinition
|
|
19
21
|
};
|
|
@@ -27,6 +27,9 @@ interface Props$3 {
|
|
|
27
27
|
isSelectedAccount: boolean;
|
|
28
28
|
onSelectBucket: (account: SrklBackblazeAccount, bucketName: string) => void;
|
|
29
29
|
userId?: string;
|
|
30
|
+
storageService?: {
|
|
31
|
+
listBackblazeBuckets?: (accountId: string, userId: string) => Promise<any[]>;
|
|
32
|
+
};
|
|
30
33
|
}
|
|
31
34
|
declare const SrklBackblazeTile: React__default.FC<Props$3>;
|
|
32
35
|
|
|
@@ -45,8 +48,13 @@ interface Props$2 {
|
|
|
45
48
|
email: string;
|
|
46
49
|
name?: string;
|
|
47
50
|
} | null;
|
|
51
|
+
userId?: string;
|
|
48
52
|
selectedProvider?: string;
|
|
49
53
|
selectedConnectionId?: string;
|
|
54
|
+
storageService?: {
|
|
55
|
+
listBackblazeAccounts?: (userId: string) => Promise<any[]>;
|
|
56
|
+
listBackblazeBuckets?: (accountId: string, userId: string) => Promise<any[]>;
|
|
57
|
+
};
|
|
50
58
|
onSelectStorage: (selection: StorageSelection) => void;
|
|
51
59
|
}
|
|
52
60
|
declare const StorageOptionTiles: React__default.FC<Props$2>;
|
|
@@ -90,8 +98,9 @@ interface BackblazeAccount {
|
|
|
90
98
|
}
|
|
91
99
|
interface WorkspaceStorageService {
|
|
92
100
|
listBackblazeAccounts: (userId: string) => Promise<BackblazeAccount[]>;
|
|
93
|
-
listBackblazeBuckets: (accountId: string, userId
|
|
101
|
+
listBackblazeBuckets: (accountId: string, userId?: string) => Promise<BackblazeBucket[]>;
|
|
94
102
|
}
|
|
103
|
+
declare const defaultWorkspaceStorageService: WorkspaceStorageService;
|
|
95
104
|
interface KloksServiceInvoker {
|
|
96
105
|
invoke: (serviceId: string, operation: string, input: Record<string, unknown>) => Promise<unknown>;
|
|
97
106
|
}
|
|
@@ -99,6 +108,7 @@ declare function createKloksWorkspaceStorageService(invoker: KloksServiceInvoker
|
|
|
99
108
|
interface WorkspaceCreateInput {
|
|
100
109
|
name: string;
|
|
101
110
|
description?: string;
|
|
111
|
+
storage?: Record<string, unknown>;
|
|
102
112
|
storageProvider: 'local_fs' | 'backblaze_b2';
|
|
103
113
|
storageConnectionId?: string;
|
|
104
114
|
localFolderName?: string;
|
|
@@ -108,17 +118,23 @@ interface WorkspaceCreateInput {
|
|
|
108
118
|
}
|
|
109
119
|
interface WorkspaceCreateDialogProps {
|
|
110
120
|
open: boolean;
|
|
111
|
-
userId
|
|
112
|
-
|
|
121
|
+
userId?: string;
|
|
122
|
+
currentUser?: {
|
|
123
|
+
id: string;
|
|
124
|
+
email: string;
|
|
125
|
+
name?: string;
|
|
126
|
+
} | null;
|
|
127
|
+
storageService?: WorkspaceStorageService;
|
|
113
128
|
onClose: () => void;
|
|
114
|
-
onSubmit: (input: WorkspaceCreateInput) => Promise<void
|
|
129
|
+
onSubmit: (input: WorkspaceCreateInput) => Promise<void> | void;
|
|
115
130
|
}
|
|
116
|
-
declare function WorkspaceCreateDialog({ open, userId, storageService, onClose, onSubmit }: WorkspaceCreateDialogProps): React__default.JSX.Element;
|
|
131
|
+
declare function WorkspaceCreateDialog({ open, userId, currentUser, storageService, onClose, onSubmit, }: WorkspaceCreateDialogProps): React__default.JSX.Element;
|
|
117
132
|
|
|
118
133
|
declare const WORKSPACE_TILES_MENU_REQUIRED_SERVICES: readonly ["auth", "workspace", "storage", "srkl"];
|
|
119
134
|
interface WorkspaceRecord {
|
|
120
135
|
id: string;
|
|
121
136
|
title: string;
|
|
137
|
+
name?: string;
|
|
122
138
|
description?: string;
|
|
123
139
|
workspacePath?: string;
|
|
124
140
|
storageProvider?: string;
|
|
@@ -126,20 +142,27 @@ interface WorkspaceRecord {
|
|
|
126
142
|
b2BucketName?: string;
|
|
127
143
|
b2Endpoint?: string;
|
|
128
144
|
b2Region?: string;
|
|
145
|
+
localFolderName?: string;
|
|
129
146
|
metadata?: React__default.ReactNode;
|
|
130
147
|
}
|
|
131
148
|
interface WorkspaceTilesMenuProps {
|
|
132
149
|
workspaces: WorkspaceRecord[];
|
|
133
|
-
userId
|
|
150
|
+
userId?: string;
|
|
151
|
+
currentUser?: {
|
|
152
|
+
id: string;
|
|
153
|
+
email: string;
|
|
154
|
+
name?: string;
|
|
155
|
+
} | null;
|
|
134
156
|
activeWorkspaceId?: string | null;
|
|
135
|
-
|
|
157
|
+
appName?: string;
|
|
158
|
+
storageService?: WorkspaceStorageService;
|
|
136
159
|
onSelectWorkspace: (workspace: WorkspaceRecord) => void;
|
|
137
|
-
onCreateWorkspace: (input: WorkspaceCreateInput) => Promise<void
|
|
160
|
+
onCreateWorkspace: (input: WorkspaceCreateInput | any) => Promise<void> | void;
|
|
138
161
|
onUpdateWorkspace?: (workspaceId: string, patch: {
|
|
139
162
|
name: string;
|
|
140
163
|
description?: string;
|
|
141
|
-
}) => Promise<void
|
|
142
|
-
onDeleteWorkspace?: (workspaceId: string) => Promise<void
|
|
164
|
+
}) => Promise<void> | void;
|
|
165
|
+
onDeleteWorkspace?: (workspaceId: string) => Promise<void> | void;
|
|
143
166
|
onLogout?: () => void;
|
|
144
167
|
loading?: boolean;
|
|
145
168
|
error?: string | null;
|
|
@@ -197,6 +220,34 @@ declare const workspaceTilesMenuDefinition: {
|
|
|
197
220
|
};
|
|
198
221
|
};
|
|
199
222
|
};
|
|
200
|
-
declare function WorkspaceTilesMenu({ workspaces, userId, activeWorkspaceId, storageService, onSelectWorkspace, onCreateWorkspace, onUpdateWorkspace: _onUpdateWorkspace, onDeleteWorkspace: _onDeleteWorkspace, onLogout, loading, error, }: WorkspaceTilesMenuProps): React__default.JSX.Element;
|
|
223
|
+
declare function WorkspaceTilesMenu({ workspaces, userId, currentUser, activeWorkspaceId, appName, storageService, onSelectWorkspace, onCreateWorkspace, onUpdateWorkspace: _onUpdateWorkspace, onDeleteWorkspace: _onDeleteWorkspace, onLogout, loading, error, }: WorkspaceTilesMenuProps): React__default.JSX.Element;
|
|
224
|
+
|
|
225
|
+
interface WorkspaceGateProps {
|
|
226
|
+
workspaces: WorkspaceRecord[] | any[];
|
|
227
|
+
activeWorkspaceId?: string | null;
|
|
228
|
+
userId?: string;
|
|
229
|
+
currentUser?: {
|
|
230
|
+
id: string;
|
|
231
|
+
email: string;
|
|
232
|
+
name?: string;
|
|
233
|
+
role?: string;
|
|
234
|
+
} | null;
|
|
235
|
+
appName?: string;
|
|
236
|
+
appSubtitle?: string;
|
|
237
|
+
storageService?: WorkspaceStorageService;
|
|
238
|
+
onSelectWorkspace: (workspace: WorkspaceRecord) => void;
|
|
239
|
+
onCreateWorkspace?: (input: WorkspaceCreateInput | any) => Promise<void> | void;
|
|
240
|
+
onUpdateWorkspace?: (workspaceId: string, patch: {
|
|
241
|
+
name: string;
|
|
242
|
+
description?: string;
|
|
243
|
+
}) => Promise<void> | void;
|
|
244
|
+
onDeleteWorkspace?: (workspaceId: string) => Promise<void> | void;
|
|
245
|
+
onLogout?: () => void;
|
|
246
|
+
canClose?: boolean;
|
|
247
|
+
onClose?: () => void;
|
|
248
|
+
loading?: boolean;
|
|
249
|
+
error?: string | null;
|
|
250
|
+
}
|
|
251
|
+
declare const WorkspaceGate: React__default.FC<WorkspaceGateProps>;
|
|
201
252
|
|
|
202
|
-
export { type BackblazeAccount, type BackblazeBucket, type KloksServiceInvoker, type SrklBackblazeAccount, SrklBackblazeTile, StorageOptionTiles, StoragePresetTile, type StorageSelection, WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES, WORKSPACE_TILES_MENU_REQUIRED_SERVICES, WorkspaceCreateDialog, type WorkspaceCreateDialogProps, type WorkspaceCreateInput, type WorkspaceRecord, type WorkspaceSecondaryClone, WorkspaceSecondaryClonesPanel, WorkspaceStorageReadonlyPanel, type WorkspaceStorageService, WorkspaceTilesMenu, type WorkspaceTilesMenuProps, createKloksWorkspaceStorageService, workspaceTilesMenuDefinition };
|
|
253
|
+
export { type BackblazeAccount, type BackblazeBucket, type KloksServiceInvoker, type SrklBackblazeAccount, SrklBackblazeTile, StorageOptionTiles, StoragePresetTile, type StorageSelection, WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES, WORKSPACE_TILES_MENU_REQUIRED_SERVICES, WorkspaceCreateDialog, type WorkspaceCreateDialogProps, type WorkspaceCreateInput, WorkspaceGate, type WorkspaceGateProps, type WorkspaceRecord, type WorkspaceSecondaryClone, WorkspaceSecondaryClonesPanel, WorkspaceStorageReadonlyPanel, type WorkspaceStorageService, WorkspaceTilesMenu, type WorkspaceTilesMenuProps, createKloksWorkspaceStorageService, defaultWorkspaceStorageService, workspaceTilesMenuDefinition };
|
|
@@ -5,12 +5,14 @@ import {
|
|
|
5
5
|
WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES,
|
|
6
6
|
WORKSPACE_TILES_MENU_REQUIRED_SERVICES,
|
|
7
7
|
WorkspaceCreateDialog,
|
|
8
|
+
WorkspaceGate,
|
|
8
9
|
WorkspaceSecondaryClonesPanel,
|
|
9
10
|
WorkspaceStorageReadonlyPanel,
|
|
10
11
|
WorkspaceTilesMenu,
|
|
11
12
|
createKloksWorkspaceStorageService,
|
|
13
|
+
defaultWorkspaceStorageService,
|
|
12
14
|
workspaceTilesMenuDefinition
|
|
13
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-QRSVZE4C.js";
|
|
14
16
|
import "../../chunk-PH4NEHWR.js";
|
|
15
17
|
import "../../chunk-X4B3EBMY.js";
|
|
16
18
|
export {
|
|
@@ -20,9 +22,11 @@ export {
|
|
|
20
22
|
WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES,
|
|
21
23
|
WORKSPACE_TILES_MENU_REQUIRED_SERVICES,
|
|
22
24
|
WorkspaceCreateDialog,
|
|
25
|
+
WorkspaceGate,
|
|
23
26
|
WorkspaceSecondaryClonesPanel,
|
|
24
27
|
WorkspaceStorageReadonlyPanel,
|
|
25
28
|
WorkspaceTilesMenu,
|
|
26
29
|
createKloksWorkspaceStorageService,
|
|
30
|
+
defaultWorkspaceStorageService,
|
|
27
31
|
workspaceTilesMenuDefinition
|
|
28
32
|
};
|
|
@@ -7,10 +7,10 @@ export { AppShell, AppShellProps, BreadcrumbNav, BreadcrumbNavProps, HeaderBar,
|
|
|
7
7
|
export { ApiCallIndicator, ApiCallIndicatorProps, AutoSaveStatus, AutoSaveToggle, AutoSaveToggleProps, BottomStripContextValue, BottomStripProvider, BottomStripProviderProps, StatusLight, StatusLightProps, SystemMessage, SystemMessageDisplay, SystemMessageDisplayProps, SystemMessageType, useBottomStrip } from './components/bottom-strip/index.js';
|
|
8
8
|
export { B as BottomStrip, a as BottomStripProps } from './BottomStrip-DYhAUQR4.js';
|
|
9
9
|
export { AccountsSettingsSection, AccountsSettingsSectionProps, SettingsTab, SettingsTabProps, ThemeSettingsSection } from './components/settings/index.js';
|
|
10
|
-
export { AUTH_PAGE_REQUIRED_SERVICES, AuthPage, AuthPageProps, AuthResult, LoginModal, LoginModalProps, authPageDefinition } from './components/auth/index.js';
|
|
10
|
+
export { AUTH_PAGE_REQUIRED_SERVICES, AuthPage, AuthPageProps, AuthResult, GoogleSignInButton, GoogleSignInButtonProps, LoginModal, LoginModalProps, authPageDefinition } from './components/auth/index.js';
|
|
11
11
|
export { FrnlTileRecord, TilesMenu, TilesMenuProps, tilesMenuDefinition } from './components/tiles/index.js';
|
|
12
12
|
export { GRAPHS_MENU_REQUIRED_SERVICES, GraphRecord, GraphsMenu, GraphsMenuProps } from './components/graph/index.js';
|
|
13
|
-
export { BackblazeAccount, BackblazeBucket, KloksServiceInvoker, SrklBackblazeAccount, SrklBackblazeTile, StorageOptionTiles, StoragePresetTile, StorageSelection, WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES, WORKSPACE_TILES_MENU_REQUIRED_SERVICES, WorkspaceCreateDialog, WorkspaceCreateDialogProps, WorkspaceCreateInput, WorkspaceRecord, WorkspaceSecondaryClone, WorkspaceSecondaryClonesPanel, WorkspaceStorageReadonlyPanel, WorkspaceStorageService, WorkspaceTilesMenu, WorkspaceTilesMenuProps, createKloksWorkspaceStorageService, workspaceTilesMenuDefinition } from './components/workspace/index.js';
|
|
13
|
+
export { BackblazeAccount, BackblazeBucket, KloksServiceInvoker, SrklBackblazeAccount, SrklBackblazeTile, StorageOptionTiles, StoragePresetTile, StorageSelection, WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES, WORKSPACE_TILES_MENU_REQUIRED_SERVICES, WorkspaceCreateDialog, WorkspaceCreateDialogProps, WorkspaceCreateInput, WorkspaceGate, WorkspaceGateProps, WorkspaceRecord, WorkspaceSecondaryClone, WorkspaceSecondaryClonesPanel, WorkspaceStorageReadonlyPanel, WorkspaceStorageService, WorkspaceTilesMenu, WorkspaceTilesMenuProps, createKloksWorkspaceStorageService, defaultWorkspaceStorageService, workspaceTilesMenuDefinition } from './components/workspace/index.js';
|
|
14
14
|
export { DEFAULT_PALETTE_ID, THEME_STORAGE_KEY, ThemeContextValue, ThemeProvider, ThemeProviderProps, applyPaletteToDocument, getActivePalette, paletteToSkipoThemePack, subscribeToPalette, usePalette, useTheme } from './palette/index.js';
|
|
15
15
|
export { ActionButton, Badge, BadgeProps, BadgeTone, ButtonParent, ButtonParentProps, ButtonProps, ButtonSize, ButtonVariant, CardPanel, CategoryCardTile, ChannelStripTile, ClipCardTile, DangerButton, GhostButton, IconButton, InspectorPanel, ModalPanel, PanelParent, PanelParentProps, PanelProps, PanelVariant, SelectInput, SelectInputProps, SliderInput, SliderInputProps, SpawnOptionTile, SplitButton, SplitButtonProps, StatusDot, StatusDotProps, TelemetryPill, TelemetryPillProps, TextInput, TextInputProps, TileParent, TileParentProps, TileVariant, ToggleButton, ToggleInput, ToggleInputProps, ToolbarPanel, TooltipDirection, UIBaseProps, UIInteractionState, UIParent, UIParentProps, UIProps, UIRole, UISize, UIStyleTokens, UIVariant } from './hierarchy/index.js';
|
|
16
16
|
export { FrnlStoreProvider, FrnlStoreProviderProps, floksFrnlStore, getFloksFrnlStore, useFloksFrnlStore } from './frnl/store.js';
|
|
@@ -52,28 +52,18 @@ import {
|
|
|
52
52
|
WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES,
|
|
53
53
|
WORKSPACE_TILES_MENU_REQUIRED_SERVICES,
|
|
54
54
|
WorkspaceCreateDialog,
|
|
55
|
+
WorkspaceGate,
|
|
55
56
|
WorkspaceSecondaryClonesPanel,
|
|
56
57
|
WorkspaceStorageReadonlyPanel,
|
|
57
58
|
WorkspaceTilesMenu,
|
|
58
59
|
createKloksWorkspaceStorageService,
|
|
60
|
+
defaultWorkspaceStorageService,
|
|
59
61
|
workspaceTilesMenuDefinition
|
|
60
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-QRSVZE4C.js";
|
|
61
63
|
import {
|
|
62
64
|
TilesMenu,
|
|
63
65
|
tilesMenuDefinition
|
|
64
66
|
} from "./chunk-PH4NEHWR.js";
|
|
65
|
-
import {
|
|
66
|
-
frnlBadge,
|
|
67
|
-
frnlBottomBar,
|
|
68
|
-
frnlPage,
|
|
69
|
-
frnlSelect,
|
|
70
|
-
frnlSelectDefinition,
|
|
71
|
-
frnlSlider,
|
|
72
|
-
frnlTabWindow,
|
|
73
|
-
frnlToggle,
|
|
74
|
-
frnlToggleDefinition,
|
|
75
|
-
frnlTopBar
|
|
76
|
-
} from "./chunk-DGZBP3ND.js";
|
|
77
67
|
import {
|
|
78
68
|
ActionButton,
|
|
79
69
|
Badge,
|
|
@@ -113,6 +103,18 @@ import {
|
|
|
113
103
|
usePalette,
|
|
114
104
|
useTheme
|
|
115
105
|
} from "./chunk-ZQK5I5ZL.js";
|
|
106
|
+
import {
|
|
107
|
+
frnlBadge,
|
|
108
|
+
frnlBottomBar,
|
|
109
|
+
frnlPage,
|
|
110
|
+
frnlSelect,
|
|
111
|
+
frnlSelectDefinition,
|
|
112
|
+
frnlSlider,
|
|
113
|
+
frnlTabWindow,
|
|
114
|
+
frnlToggle,
|
|
115
|
+
frnlToggleDefinition,
|
|
116
|
+
frnlTopBar
|
|
117
|
+
} from "./chunk-DGZBP3ND.js";
|
|
116
118
|
import {
|
|
117
119
|
BlockquoteStyleSchema,
|
|
118
120
|
CodeStyleSchema,
|
|
@@ -166,9 +168,10 @@ import {
|
|
|
166
168
|
import {
|
|
167
169
|
AUTH_PAGE_REQUIRED_SERVICES,
|
|
168
170
|
AuthPage,
|
|
171
|
+
GoogleSignInButton,
|
|
169
172
|
LoginModal,
|
|
170
173
|
authPageDefinition
|
|
171
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-CUQ7R3H2.js";
|
|
172
175
|
import {
|
|
173
176
|
frnlButton,
|
|
174
177
|
frnlButtonDefinition,
|
|
@@ -264,6 +267,7 @@ export {
|
|
|
264
267
|
FrnlStoreProvider,
|
|
265
268
|
GRAPHS_MENU_REQUIRED_SERVICES,
|
|
266
269
|
GhostButton,
|
|
270
|
+
GoogleSignInButton,
|
|
267
271
|
GraphsMenu,
|
|
268
272
|
HeaderBar,
|
|
269
273
|
HeadingLevelSchema,
|
|
@@ -326,6 +330,7 @@ export {
|
|
|
326
330
|
WORKSPACE_CREATE_DIALOG_REQUIRED_SERVICES,
|
|
327
331
|
WORKSPACE_TILES_MENU_REQUIRED_SERVICES,
|
|
328
332
|
WorkspaceCreateDialog,
|
|
333
|
+
WorkspaceGate,
|
|
329
334
|
WorkspaceSecondaryClonesPanel,
|
|
330
335
|
WorkspaceStorageReadonlyPanel,
|
|
331
336
|
WorkspaceTilesMenu,
|
|
@@ -336,6 +341,7 @@ export {
|
|
|
336
341
|
centralLedger,
|
|
337
342
|
createAppThemeSocket,
|
|
338
343
|
createKloksWorkspaceStorageService,
|
|
344
|
+
defaultWorkspaceStorageService,
|
|
339
345
|
depmThemeSocket,
|
|
340
346
|
floksFrnlStore,
|
|
341
347
|
frnlBadge,
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
frnlButton,
|
|
3
|
-
frnlTextInput
|
|
4
|
-
} from "./chunk-YVWJ4SW7.js";
|
|
5
|
-
import {
|
|
6
|
-
useFloksFrnlStore
|
|
7
|
-
} from "./chunk-X4B3EBMY.js";
|
|
8
|
-
import {
|
|
9
|
-
BaseInput
|
|
10
|
-
} from "./chunk-W42SJGOJ.js";
|
|
11
|
-
import {
|
|
12
|
-
BaseButton
|
|
13
|
-
} from "./chunk-A2CDQISJ.js";
|
|
14
|
-
|
|
15
|
-
// src/components/auth/AuthPage.tsx
|
|
16
|
-
import React, { useId, useMemo, useState } from "react";
|
|
17
|
-
import { LogIn, UserPlus, Eye, EyeOff, Shield, ArrowRight, AlertCircle } from "lucide-react";
|
|
18
|
-
import { defineFrnlComponent } from "@ultrst-armada/frnlts";
|
|
19
|
-
import { useFrnlComponent } from "@ultrst-armada/frnlts/react";
|
|
20
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
var AUTH_PAGE_REQUIRED_SERVICES = ["auth"];
|
|
22
|
-
var authPageDefinition = defineFrnlComponent({
|
|
23
|
-
name: "AuthPage",
|
|
24
|
-
states: {
|
|
25
|
-
idle: { name: "idle", events: { login: { functionId: "AuthPage.idle.login" }, register: { functionId: "AuthPage.idle.register" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
|
|
26
|
-
loading: { name: "loading", events: {}, visualParameters: { opacity: 0.75 }, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } },
|
|
27
|
-
error: { name: "error", events: { retry: { functionId: "AuthPage.error.retry" } }, visualParameters: {}, phases: { sustainPhase: { visualDefinition: { parameters: {} } } } }
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
var AuthPage = ({
|
|
31
|
-
appName = "SKIPO",
|
|
32
|
-
appSubtitle = "WORKSPACE",
|
|
33
|
-
footerText,
|
|
34
|
-
onLogin,
|
|
35
|
-
onRegister,
|
|
36
|
-
onSuccess,
|
|
37
|
-
onSwitchToAdmin
|
|
38
|
-
}) => {
|
|
39
|
-
const store = useFloksFrnlStore();
|
|
40
|
-
const generated = useId().replace(/[:/]/g, "");
|
|
41
|
-
const componentId = `AuthPage.${generated}`;
|
|
42
|
-
const [mode, setMode] = useState("login");
|
|
43
|
-
const [name, setName] = useState("");
|
|
44
|
-
const [email, setEmail] = useState("");
|
|
45
|
-
const [password, setPassword] = useState("");
|
|
46
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
47
|
-
const [error, setError] = useState(null);
|
|
48
|
-
const [loading, setLoading] = useState(false);
|
|
49
|
-
const handlers = useMemo(() => ({
|
|
50
|
-
"AuthPage.idle.login": () => {
|
|
51
|
-
},
|
|
52
|
-
"AuthPage.idle.register": () => {
|
|
53
|
-
},
|
|
54
|
-
"AuthPage.error.retry": () => setError(null)
|
|
55
|
-
}), []);
|
|
56
|
-
const frnl = useFrnlComponent({
|
|
57
|
-
id: componentId,
|
|
58
|
-
definition: authPageDefinition,
|
|
59
|
-
store,
|
|
60
|
-
state: error ? "error" : loading ? "loading" : "idle",
|
|
61
|
-
properties: { mode, appName },
|
|
62
|
-
handlers
|
|
63
|
-
});
|
|
64
|
-
const submit = async (e) => {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
const cleanEmail = email.trim();
|
|
67
|
-
if (!cleanEmail) return setError("Email address is required.");
|
|
68
|
-
if (!password) return setError("Password is required.");
|
|
69
|
-
if (mode === "register" && !name.trim()) return setError("Display name is required.");
|
|
70
|
-
setLoading(true);
|
|
71
|
-
setError(null);
|
|
72
|
-
try {
|
|
73
|
-
const result = mode === "login" ? await onLogin(cleanEmail, password) : await onRegister({ name: name.trim(), email: cleanEmail, password });
|
|
74
|
-
if (!result.success) throw new Error(result.error || "Authentication failed.");
|
|
75
|
-
onSuccess?.(result);
|
|
76
|
-
} catch (e2) {
|
|
77
|
-
setError(e2 instanceof Error ? e2.message : "Authentication failed.");
|
|
78
|
-
} finally {
|
|
79
|
-
setLoading(false);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
return /* @__PURE__ */ jsxs("div", { id: componentId, "data-frnl-component": "AuthPage", "data-frnl-state": frnl.state, className: "min-h-screen w-full bg-[var(--skipo-bg)] text-[var(--skipo-text)] font-mono flex flex-col justify-between", children: [
|
|
83
|
-
/* @__PURE__ */ jsxs("header", { className: "border-b-2 border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] px-6 py-3.5 flex items-center justify-between", children: [
|
|
84
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
85
|
-
/* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-[var(--skipo-accent)] text-black font-black flex items-center justify-center", children: "\u25B2" }),
|
|
86
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
87
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-black uppercase", children: appName }),
|
|
88
|
-
/* @__PURE__ */ jsx("span", { className: "ml-2 text-[10px] text-[var(--skipo-text-muted)]", children: appSubtitle })
|
|
89
|
-
] })
|
|
90
|
-
] }),
|
|
91
|
-
onSwitchToAdmin && /* @__PURE__ */ jsxs("button", { type: "button", onClick: onSwitchToAdmin, className: "px-3 py-1.5 text-[10px] font-black border-2 border-[var(--skipo-accent)] text-[var(--skipo-accent)] flex items-center gap-1.5", children: [
|
|
92
|
-
/* @__PURE__ */ jsx(Shield, { size: 13 }),
|
|
93
|
-
" ADMIN ",
|
|
94
|
-
/* @__PURE__ */ jsx(ArrowRight, { size: 13 })
|
|
95
|
-
] })
|
|
96
|
-
] }),
|
|
97
|
-
/* @__PURE__ */ jsx("main", { className: "flex-1 flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md border-2 border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] shadow-[6px_6px_0px_var(--skipo-border-color)] p-6", children: [
|
|
98
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 mb-5", children: [
|
|
99
|
-
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
|
|
100
|
-
setMode("login");
|
|
101
|
-
setError(null);
|
|
102
|
-
}, className: `py-2 text-[10px] font-black border ${mode === "login" ? "bg-[var(--skipo-accent)] text-black" : "bg-[var(--skipo-bg)]"}`, children: [
|
|
103
|
-
/* @__PURE__ */ jsx(LogIn, { size: 13, className: "inline mr-1" }),
|
|
104
|
-
" SIGN IN"
|
|
105
|
-
] }),
|
|
106
|
-
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
|
|
107
|
-
setMode("register");
|
|
108
|
-
setError(null);
|
|
109
|
-
}, className: `py-2 text-[10px] font-black border ${mode === "register" ? "bg-[var(--skipo-accent)] text-black" : "bg-[var(--skipo-bg)]"}`, children: [
|
|
110
|
-
/* @__PURE__ */ jsx(UserPlus, { size: 13, className: "inline mr-1" }),
|
|
111
|
-
" CREATE ACCOUNT"
|
|
112
|
-
] })
|
|
113
|
-
] }),
|
|
114
|
-
error && /* @__PURE__ */ jsxs("div", { className: "mb-4 p-3 border-2 border-red-500/80 bg-red-950/30 text-red-300 text-xs flex items-center gap-2", children: [
|
|
115
|
-
/* @__PURE__ */ jsx(AlertCircle, { size: 14 }),
|
|
116
|
-
error
|
|
117
|
-
] }),
|
|
118
|
-
/* @__PURE__ */ jsxs("form", { onSubmit: submit, className: "space-y-3", children: [
|
|
119
|
-
mode === "register" && React.createElement(frnlTextInput, { id: componentId + ".name", label: "Full Name", value: name, onChange: (e) => setName(e.target.value) }),
|
|
120
|
-
React.createElement(frnlTextInput, { id: componentId + ".email", label: "Email Address", value: email, onChange: (e) => setEmail(e.target.value), type: "email", autoComplete: "username" }),
|
|
121
|
-
/* @__PURE__ */ jsx("div", { children: React.createElement(frnlTextInput, { id: componentId + ".password", label: "Password", value: password, onChange: (e) => setPassword(e.target.value), type: showPassword ? "text" : "password", autoComplete: mode === "login" ? "current-password" : "new-password", trailingIcon: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Toggle password visibility", onClick: () => setShowPassword((v) => !v), children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 13 }) : /* @__PURE__ */ jsx(Eye, { size: 13 }) }) }) }),
|
|
122
|
-
React.createElement(frnlButton, { type: "submit", disabled: loading, loading, variant: "accent", size: "lg", className: "w-full", icon: /* @__PURE__ */ jsx(ArrowRight, { size: 13 }) }, mode === "login" ? "SIGN IN TO WORKSPACE" : "CREATE ACCOUNT")
|
|
123
|
-
] }),
|
|
124
|
-
/* @__PURE__ */ jsx("p", { className: "mt-5 pt-3 border-t border-[var(--skipo-border-color)] text-center text-[10px] text-[var(--skipo-text-muted)]", children: footerText || `${appName} WORKSPACE SYSTEM` })
|
|
125
|
-
] }) })
|
|
126
|
-
] });
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// src/components/auth/LoginModal.tsx
|
|
130
|
-
import { useState as useState2 } from "react";
|
|
131
|
-
import { ArrowRight as ArrowRight2, ShieldCheck, AlertCircle as AlertCircle2 } from "lucide-react";
|
|
132
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
133
|
-
var LoginModal = ({
|
|
134
|
-
appName = "Ecosystem App",
|
|
135
|
-
onSuccess,
|
|
136
|
-
defaultEmail = ""
|
|
137
|
-
}) => {
|
|
138
|
-
const [email, setEmail] = useState2(defaultEmail);
|
|
139
|
-
const [password, setPassword] = useState2("");
|
|
140
|
-
const [isRegister, setIsRegister] = useState2(false);
|
|
141
|
-
const [name, setName] = useState2("");
|
|
142
|
-
const [loading, setLoading] = useState2(false);
|
|
143
|
-
const [error, setError] = useState2(null);
|
|
144
|
-
const handleSubmit = async (e) => {
|
|
145
|
-
e.preventDefault();
|
|
146
|
-
setError(null);
|
|
147
|
-
setLoading(true);
|
|
148
|
-
try {
|
|
149
|
-
const endpoint = isRegister ? "/api/auth/register" : "/api/auth/login";
|
|
150
|
-
const payload = isRegister ? { email, password, name } : { email, password };
|
|
151
|
-
const res = await fetch(endpoint, {
|
|
152
|
-
method: "POST",
|
|
153
|
-
headers: { "Content-Type": "application/json" },
|
|
154
|
-
body: JSON.stringify(payload)
|
|
155
|
-
});
|
|
156
|
-
const data = await res.json().catch(() => ({}));
|
|
157
|
-
if (!res.ok || !data.success || !data.user) {
|
|
158
|
-
throw new Error(data.error || "Authentication failed. Please verify credentials.");
|
|
159
|
-
}
|
|
160
|
-
const token = data.token || `usr_${Date.now()}`;
|
|
161
|
-
if (typeof window !== "undefined") {
|
|
162
|
-
localStorage.setItem("skipo_auth_token", token);
|
|
163
|
-
localStorage.setItem("skipo_user", JSON.stringify(data.user));
|
|
164
|
-
}
|
|
165
|
-
onSuccess(data.user, token);
|
|
166
|
-
} catch (err) {
|
|
167
|
-
setError(err.message || "Server error. Authentication failed.");
|
|
168
|
-
} finally {
|
|
169
|
-
setLoading(false);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
return /* @__PURE__ */ jsx2(
|
|
173
|
-
"div",
|
|
174
|
-
{
|
|
175
|
-
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-xs font-mono p-4",
|
|
176
|
-
onWheel: (e) => e.stopPropagation(),
|
|
177
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
178
|
-
children: /* @__PURE__ */ jsxs2("div", { className: "w-full max-w-md p-6 border-2 border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] text-[var(--skipo-text)] shadow-2xl rounded-lg space-y-4", children: [
|
|
179
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between pb-3 border-b border-[var(--skipo-border-color)]", children: [
|
|
180
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
181
|
-
/* @__PURE__ */ jsx2("div", { className: "w-7 h-7 bg-[var(--skipo-accent)] text-black font-black flex items-center justify-center text-xs rounded", children: "\u25B2" }),
|
|
182
|
-
/* @__PURE__ */ jsxs2("span", { className: "font-black text-sm tracking-wider uppercase text-[var(--skipo-text)]", children: [
|
|
183
|
-
appName,
|
|
184
|
-
" Authentication"
|
|
185
|
-
] })
|
|
186
|
-
] }),
|
|
187
|
-
/* @__PURE__ */ jsxs2("span", { className: "text-[9px] px-2 py-0.5 border border-emerald-500/50 bg-emerald-500/10 text-emerald-300 font-bold rounded flex items-center gap-1", children: [
|
|
188
|
-
/* @__PURE__ */ jsx2(ShieldCheck, { size: 10 }),
|
|
189
|
-
" SYSTEM DB"
|
|
190
|
-
] })
|
|
191
|
-
] }),
|
|
192
|
-
error && /* @__PURE__ */ jsxs2("div", { className: "p-3 border border-red-500/60 bg-red-500/10 text-red-300 text-xs rounded flex items-start gap-2", children: [
|
|
193
|
-
/* @__PURE__ */ jsx2(AlertCircle2, { size: 14, className: "shrink-0 mt-0.5" }),
|
|
194
|
-
/* @__PURE__ */ jsx2("span", { children: error })
|
|
195
|
-
] }),
|
|
196
|
-
/* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-3", children: [
|
|
197
|
-
isRegister && /* @__PURE__ */ jsxs2("div", { children: [
|
|
198
|
-
/* @__PURE__ */ jsx2("label", { className: "block text-[10px] font-black uppercase mb-1", children: "Full Name *" }),
|
|
199
|
-
/* @__PURE__ */ jsx2(
|
|
200
|
-
BaseInput,
|
|
201
|
-
{
|
|
202
|
-
type: "text",
|
|
203
|
-
value: name,
|
|
204
|
-
onChange: (e) => setName(e.target.value),
|
|
205
|
-
placeholder: "Developer Name",
|
|
206
|
-
required: isRegister
|
|
207
|
-
}
|
|
208
|
-
)
|
|
209
|
-
] }),
|
|
210
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
|
211
|
-
/* @__PURE__ */ jsx2("label", { className: "block text-[10px] font-black uppercase mb-1", children: "Email Address *" }),
|
|
212
|
-
/* @__PURE__ */ jsx2(
|
|
213
|
-
BaseInput,
|
|
214
|
-
{
|
|
215
|
-
type: "email",
|
|
216
|
-
value: email,
|
|
217
|
-
onChange: (e) => setEmail(e.target.value),
|
|
218
|
-
placeholder: "user@example.com",
|
|
219
|
-
required: true
|
|
220
|
-
}
|
|
221
|
-
)
|
|
222
|
-
] }),
|
|
223
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
|
224
|
-
/* @__PURE__ */ jsx2("label", { className: "block text-[10px] font-black uppercase mb-1", children: "Password *" }),
|
|
225
|
-
/* @__PURE__ */ jsx2(
|
|
226
|
-
BaseInput,
|
|
227
|
-
{
|
|
228
|
-
type: "password",
|
|
229
|
-
value: password,
|
|
230
|
-
onChange: (e) => setPassword(e.target.value),
|
|
231
|
-
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
232
|
-
required: true
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
] }),
|
|
236
|
-
/* @__PURE__ */ jsx2("div", { className: "pt-2", children: /* @__PURE__ */ jsxs2(
|
|
237
|
-
BaseButton,
|
|
238
|
-
{
|
|
239
|
-
variant: "accent",
|
|
240
|
-
size: "md",
|
|
241
|
-
type: "submit",
|
|
242
|
-
disabled: loading,
|
|
243
|
-
className: "w-full flex items-center justify-center gap-2",
|
|
244
|
-
children: [
|
|
245
|
-
/* @__PURE__ */ jsx2("span", { children: loading ? "AUTHENTICATING..." : isRegister ? "REGISTER & ENTER" : "SIGN IN" }),
|
|
246
|
-
/* @__PURE__ */ jsx2(ArrowRight2, { size: 14 })
|
|
247
|
-
]
|
|
248
|
-
}
|
|
249
|
-
) })
|
|
250
|
-
] }),
|
|
251
|
-
/* @__PURE__ */ jsxs2("div", { className: "pt-2 border-t border-[var(--skipo-border-color)]/60 flex items-center justify-between text-[11px]", children: [
|
|
252
|
-
/* @__PURE__ */ jsx2(
|
|
253
|
-
"button",
|
|
254
|
-
{
|
|
255
|
-
type: "button",
|
|
256
|
-
onClick: () => {
|
|
257
|
-
setIsRegister(!isRegister);
|
|
258
|
-
setError(null);
|
|
259
|
-
},
|
|
260
|
-
className: "text-[var(--skipo-accent)] hover:underline cursor-pointer",
|
|
261
|
-
children: isRegister ? "Already have an account? Sign In" : "Create new account"
|
|
262
|
-
}
|
|
263
|
-
),
|
|
264
|
-
/* @__PURE__ */ jsx2("span", { className: "text-[10px] text-[var(--skipo-text-muted)]", children: "ULTRST Identity" })
|
|
265
|
-
] })
|
|
266
|
-
] })
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
export {
|
|
272
|
-
AUTH_PAGE_REQUIRED_SERVICES,
|
|
273
|
-
authPageDefinition,
|
|
274
|
-
AuthPage,
|
|
275
|
-
LoginModal
|
|
276
|
-
};
|