@vaultix.ai/react 0.2.3 → 0.3.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/dist/index.js +70 -33
- package/dist/index.mjs +70 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -170,21 +170,22 @@ function VaultixProvider({
|
|
|
170
170
|
}
|
|
171
171
|
jwtRef.current = jwt;
|
|
172
172
|
}
|
|
173
|
+
if (!jwt) {
|
|
174
|
+
if (!cancelled) setIsLoaded(true);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
173
177
|
try {
|
|
174
178
|
const headers = {
|
|
179
|
+
"Authorization": `Bearer ${jwt}`,
|
|
175
180
|
"X-Vaultix-Publishable-Key": publishableKey
|
|
176
181
|
};
|
|
177
|
-
if (jwt) headers["Authorization"] = `Bearer ${jwt}`;
|
|
178
182
|
const res = await fetch(`${apiOrigin}/api/v1/me`, {
|
|
179
|
-
|
|
180
|
-
credentials: jwt ? "omit" : "include",
|
|
183
|
+
credentials: "omit",
|
|
181
184
|
headers
|
|
182
185
|
});
|
|
183
186
|
if (!res.ok) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
jwtRef.current = null;
|
|
187
|
-
}
|
|
187
|
+
clearJwt();
|
|
188
|
+
jwtRef.current = null;
|
|
188
189
|
if (!cancelled) setIsLoaded(true);
|
|
189
190
|
return;
|
|
190
191
|
}
|
|
@@ -236,6 +237,7 @@ function VaultixProvider({
|
|
|
236
237
|
"data-vaultix-after-sign-in": afterSignInUrl ?? "",
|
|
237
238
|
"data-vaultix-after-sign-up": afterSignUpUrl ?? "",
|
|
238
239
|
"data-vaultix-api": apiOrigin,
|
|
240
|
+
"data-vaultix-pk": publishableKey,
|
|
239
241
|
style: { display: "contents" },
|
|
240
242
|
children
|
|
241
243
|
}
|
|
@@ -295,6 +297,13 @@ function resolveApiOrigin2(prop) {
|
|
|
295
297
|
}
|
|
296
298
|
return "";
|
|
297
299
|
}
|
|
300
|
+
function resolvePk() {
|
|
301
|
+
if (typeof document !== "undefined") {
|
|
302
|
+
const el = document.querySelector("[data-vaultix-pk]");
|
|
303
|
+
if (el) return el.getAttribute("data-vaultix-pk") ?? "";
|
|
304
|
+
}
|
|
305
|
+
return "";
|
|
306
|
+
}
|
|
298
307
|
function resolveAfterSignInUrl(redirectUrlProp) {
|
|
299
308
|
if (redirectUrlProp) return redirectUrlProp;
|
|
300
309
|
if (typeof document !== "undefined") {
|
|
@@ -336,20 +345,18 @@ function SignIn({
|
|
|
336
345
|
url.searchParams.set("__vaultix_handshake", handshakeToken);
|
|
337
346
|
window.location.href = url.toString();
|
|
338
347
|
}
|
|
339
|
-
|
|
348
|
+
function oauthRedirect(provider) {
|
|
340
349
|
const target = resolveAfterSignInUrl(redirectUrl);
|
|
350
|
+
const pk = resolvePk();
|
|
341
351
|
const params = new URLSearchParams({ redirect_url: target });
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
const res = await fetch(url, { method: "HEAD", redirect: "manual" });
|
|
345
|
-
if (res.status === 503 || res.status === 0) {
|
|
346
|
-
setErr("Google login is not configured. Please sign in with email.");
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
} catch {
|
|
350
|
-
}
|
|
351
|
-
window.location.href = url;
|
|
352
|
+
if (pk) params.set("pk", pk);
|
|
353
|
+
window.location.href = `${apiOrigin}/api/v1/auth/oauth/${provider}?${params}`;
|
|
352
354
|
}
|
|
355
|
+
const handleGoogleSignIn = () => oauthRedirect("google");
|
|
356
|
+
const handleMetaSignIn = () => oauthRedirect("meta");
|
|
357
|
+
const handleLinkedInSignIn = () => oauthRedirect("linkedin");
|
|
358
|
+
const handleXSignIn = () => oauthRedirect("x");
|
|
359
|
+
const handleGitHubSignIn = () => oauthRedirect("github");
|
|
353
360
|
async function handleEmailSubmit(e) {
|
|
354
361
|
e.preventDefault();
|
|
355
362
|
setError(null);
|
|
@@ -378,10 +385,14 @@ function SignIn({
|
|
|
378
385
|
setError(null);
|
|
379
386
|
setLoading(true);
|
|
380
387
|
try {
|
|
388
|
+
const pk = resolvePk();
|
|
381
389
|
const res = await fetch(`${apiOrigin}/api/v1/auth/sign-in`, {
|
|
382
390
|
method: "POST",
|
|
383
391
|
credentials: "include",
|
|
384
|
-
headers: {
|
|
392
|
+
headers: {
|
|
393
|
+
"Content-Type": "application/json",
|
|
394
|
+
...pk ? { "x-vaultix-pk": pk } : {}
|
|
395
|
+
},
|
|
385
396
|
body: JSON.stringify({ email, password })
|
|
386
397
|
});
|
|
387
398
|
const data = await res.json();
|
|
@@ -570,6 +581,10 @@ function SignIn({
|
|
|
570
581
|
info && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "rounded-lg bg-blue-500/10 border border-blue-500/30 px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-blue-400", children: info }) }),
|
|
571
582
|
step === "email" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-3", children: [
|
|
572
583
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(GoogleButton, { onClick: handleGoogleSignIn }),
|
|
584
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(GitHubButton, { onClick: handleGitHubSignIn }),
|
|
585
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MetaButton, { onClick: handleMetaSignIn }),
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LinkedInButton, { onClick: handleLinkedInSignIn }),
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(XButton, { onClick: handleXSignIn }),
|
|
573
588
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Divider, {}),
|
|
574
589
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { onSubmit: handleEmailSubmit, className: "space-y-3", children: [
|
|
575
590
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -735,7 +750,11 @@ function GhostButton({ children, onClick }) {
|
|
|
735
750
|
}
|
|
736
751
|
);
|
|
737
752
|
}
|
|
738
|
-
function
|
|
753
|
+
function OAuthButton({
|
|
754
|
+
icon,
|
|
755
|
+
label,
|
|
756
|
+
onClick
|
|
757
|
+
}) {
|
|
739
758
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
740
759
|
"button",
|
|
741
760
|
{
|
|
@@ -749,12 +768,27 @@ function GoogleButton({ onClick }) {
|
|
|
749
768
|
"transition-all duration-150"
|
|
750
769
|
),
|
|
751
770
|
children: [
|
|
752
|
-
|
|
753
|
-
|
|
771
|
+
icon,
|
|
772
|
+
label
|
|
754
773
|
]
|
|
755
774
|
}
|
|
756
775
|
);
|
|
757
776
|
}
|
|
777
|
+
function GoogleButton({ onClick }) {
|
|
778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OAuthButton, { icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(GoogleIcon, {}), label: "Continue with Google", onClick });
|
|
779
|
+
}
|
|
780
|
+
function MetaButton({ onClick }) {
|
|
781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OAuthButton, { icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MetaIcon, {}), label: "Continue with Facebook", onClick });
|
|
782
|
+
}
|
|
783
|
+
function LinkedInButton({ onClick }) {
|
|
784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OAuthButton, { icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LinkedInIcon, {}), label: "Continue with LinkedIn", onClick });
|
|
785
|
+
}
|
|
786
|
+
function GitHubButton({ onClick }) {
|
|
787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OAuthButton, { icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(GitHubIcon, {}), label: "Continue with GitHub", onClick });
|
|
788
|
+
}
|
|
789
|
+
function XButton({ onClick }) {
|
|
790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OAuthButton, { icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(XIcon, {}), label: "Continue with X", onClick });
|
|
791
|
+
}
|
|
758
792
|
function Divider() {
|
|
759
793
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
760
794
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex-1 h-px bg-white/8" }),
|
|
@@ -816,6 +850,18 @@ function GoogleIcon() {
|
|
|
816
850
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z", fill: "#EA4335" })
|
|
817
851
|
] });
|
|
818
852
|
}
|
|
853
|
+
function MetaIcon() {
|
|
854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "#1877F2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" }) });
|
|
855
|
+
}
|
|
856
|
+
function LinkedInIcon() {
|
|
857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "#0A66C2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.063 2.063 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" }) });
|
|
858
|
+
}
|
|
859
|
+
function GitHubIcon() {
|
|
860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "white", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.02 10.02 0 0 0 22 12.017C22 6.484 17.522 2 12 2z" }) });
|
|
861
|
+
}
|
|
862
|
+
function XIcon() {
|
|
863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "white", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.744l7.737-8.835L1.254 2.25H8.08l4.253 5.622 5.911-5.622zm-1.161 17.52h1.833L7.084 4.126H5.117z" }) });
|
|
864
|
+
}
|
|
819
865
|
|
|
820
866
|
// src/components/SignUp.tsx
|
|
821
867
|
var import_clsx2 = require("clsx");
|
|
@@ -867,19 +913,10 @@ function SignUp({
|
|
|
867
913
|
url.searchParams.set("__vaultix_handshake", handshakeToken);
|
|
868
914
|
window.location.href = url.toString();
|
|
869
915
|
}
|
|
870
|
-
|
|
916
|
+
function handleGoogleSignUp() {
|
|
871
917
|
const target = resolveAfterSignUpUrl(redirectUrl);
|
|
872
918
|
const params = new URLSearchParams({ redirect_url: target });
|
|
873
|
-
|
|
874
|
-
try {
|
|
875
|
-
const res = await fetch(url, { method: "HEAD", redirect: "manual" });
|
|
876
|
-
if (res.status === 503 || res.status === 0) {
|
|
877
|
-
setErr("Google login is not configured. Please sign in with email.");
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
} catch {
|
|
881
|
-
}
|
|
882
|
-
window.location.href = url;
|
|
919
|
+
window.location.href = `${apiOrigin}/api/v1/auth/oauth/google?${params}`;
|
|
883
920
|
}
|
|
884
921
|
async function handleEmailPassword(e) {
|
|
885
922
|
e.preventDefault();
|
package/dist/index.mjs
CHANGED
|
@@ -138,21 +138,22 @@ function VaultixProvider({
|
|
|
138
138
|
}
|
|
139
139
|
jwtRef.current = jwt;
|
|
140
140
|
}
|
|
141
|
+
if (!jwt) {
|
|
142
|
+
if (!cancelled) setIsLoaded(true);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
141
145
|
try {
|
|
142
146
|
const headers = {
|
|
147
|
+
"Authorization": `Bearer ${jwt}`,
|
|
143
148
|
"X-Vaultix-Publishable-Key": publishableKey
|
|
144
149
|
};
|
|
145
|
-
if (jwt) headers["Authorization"] = `Bearer ${jwt}`;
|
|
146
150
|
const res = await fetch(`${apiOrigin}/api/v1/me`, {
|
|
147
|
-
|
|
148
|
-
credentials: jwt ? "omit" : "include",
|
|
151
|
+
credentials: "omit",
|
|
149
152
|
headers
|
|
150
153
|
});
|
|
151
154
|
if (!res.ok) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
jwtRef.current = null;
|
|
155
|
-
}
|
|
155
|
+
clearJwt();
|
|
156
|
+
jwtRef.current = null;
|
|
156
157
|
if (!cancelled) setIsLoaded(true);
|
|
157
158
|
return;
|
|
158
159
|
}
|
|
@@ -204,6 +205,7 @@ function VaultixProvider({
|
|
|
204
205
|
"data-vaultix-after-sign-in": afterSignInUrl ?? "",
|
|
205
206
|
"data-vaultix-after-sign-up": afterSignUpUrl ?? "",
|
|
206
207
|
"data-vaultix-api": apiOrigin,
|
|
208
|
+
"data-vaultix-pk": publishableKey,
|
|
207
209
|
style: { display: "contents" },
|
|
208
210
|
children
|
|
209
211
|
}
|
|
@@ -263,6 +265,13 @@ function resolveApiOrigin2(prop) {
|
|
|
263
265
|
}
|
|
264
266
|
return "";
|
|
265
267
|
}
|
|
268
|
+
function resolvePk() {
|
|
269
|
+
if (typeof document !== "undefined") {
|
|
270
|
+
const el = document.querySelector("[data-vaultix-pk]");
|
|
271
|
+
if (el) return el.getAttribute("data-vaultix-pk") ?? "";
|
|
272
|
+
}
|
|
273
|
+
return "";
|
|
274
|
+
}
|
|
266
275
|
function resolveAfterSignInUrl(redirectUrlProp) {
|
|
267
276
|
if (redirectUrlProp) return redirectUrlProp;
|
|
268
277
|
if (typeof document !== "undefined") {
|
|
@@ -304,20 +313,18 @@ function SignIn({
|
|
|
304
313
|
url.searchParams.set("__vaultix_handshake", handshakeToken);
|
|
305
314
|
window.location.href = url.toString();
|
|
306
315
|
}
|
|
307
|
-
|
|
316
|
+
function oauthRedirect(provider) {
|
|
308
317
|
const target = resolveAfterSignInUrl(redirectUrl);
|
|
318
|
+
const pk = resolvePk();
|
|
309
319
|
const params = new URLSearchParams({ redirect_url: target });
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
const res = await fetch(url, { method: "HEAD", redirect: "manual" });
|
|
313
|
-
if (res.status === 503 || res.status === 0) {
|
|
314
|
-
setErr("Google login is not configured. Please sign in with email.");
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
} catch {
|
|
318
|
-
}
|
|
319
|
-
window.location.href = url;
|
|
320
|
+
if (pk) params.set("pk", pk);
|
|
321
|
+
window.location.href = `${apiOrigin}/api/v1/auth/oauth/${provider}?${params}`;
|
|
320
322
|
}
|
|
323
|
+
const handleGoogleSignIn = () => oauthRedirect("google");
|
|
324
|
+
const handleMetaSignIn = () => oauthRedirect("meta");
|
|
325
|
+
const handleLinkedInSignIn = () => oauthRedirect("linkedin");
|
|
326
|
+
const handleXSignIn = () => oauthRedirect("x");
|
|
327
|
+
const handleGitHubSignIn = () => oauthRedirect("github");
|
|
321
328
|
async function handleEmailSubmit(e) {
|
|
322
329
|
e.preventDefault();
|
|
323
330
|
setError(null);
|
|
@@ -346,10 +353,14 @@ function SignIn({
|
|
|
346
353
|
setError(null);
|
|
347
354
|
setLoading(true);
|
|
348
355
|
try {
|
|
356
|
+
const pk = resolvePk();
|
|
349
357
|
const res = await fetch(`${apiOrigin}/api/v1/auth/sign-in`, {
|
|
350
358
|
method: "POST",
|
|
351
359
|
credentials: "include",
|
|
352
|
-
headers: {
|
|
360
|
+
headers: {
|
|
361
|
+
"Content-Type": "application/json",
|
|
362
|
+
...pk ? { "x-vaultix-pk": pk } : {}
|
|
363
|
+
},
|
|
353
364
|
body: JSON.stringify({ email, password })
|
|
354
365
|
});
|
|
355
366
|
const data = await res.json();
|
|
@@ -538,6 +549,10 @@ function SignIn({
|
|
|
538
549
|
info && /* @__PURE__ */ jsx2("div", { className: "rounded-lg bg-blue-500/10 border border-blue-500/30 px-3 py-2", children: /* @__PURE__ */ jsx2("p", { className: "text-xs text-blue-400", children: info }) }),
|
|
539
550
|
step === "email" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
540
551
|
/* @__PURE__ */ jsx2(GoogleButton, { onClick: handleGoogleSignIn }),
|
|
552
|
+
/* @__PURE__ */ jsx2(GitHubButton, { onClick: handleGitHubSignIn }),
|
|
553
|
+
/* @__PURE__ */ jsx2(MetaButton, { onClick: handleMetaSignIn }),
|
|
554
|
+
/* @__PURE__ */ jsx2(LinkedInButton, { onClick: handleLinkedInSignIn }),
|
|
555
|
+
/* @__PURE__ */ jsx2(XButton, { onClick: handleXSignIn }),
|
|
541
556
|
/* @__PURE__ */ jsx2(Divider, {}),
|
|
542
557
|
/* @__PURE__ */ jsxs("form", { onSubmit: handleEmailSubmit, className: "space-y-3", children: [
|
|
543
558
|
/* @__PURE__ */ jsx2(
|
|
@@ -703,7 +718,11 @@ function GhostButton({ children, onClick }) {
|
|
|
703
718
|
}
|
|
704
719
|
);
|
|
705
720
|
}
|
|
706
|
-
function
|
|
721
|
+
function OAuthButton({
|
|
722
|
+
icon,
|
|
723
|
+
label,
|
|
724
|
+
onClick
|
|
725
|
+
}) {
|
|
707
726
|
return /* @__PURE__ */ jsxs(
|
|
708
727
|
"button",
|
|
709
728
|
{
|
|
@@ -717,12 +736,27 @@ function GoogleButton({ onClick }) {
|
|
|
717
736
|
"transition-all duration-150"
|
|
718
737
|
),
|
|
719
738
|
children: [
|
|
720
|
-
|
|
721
|
-
|
|
739
|
+
icon,
|
|
740
|
+
label
|
|
722
741
|
]
|
|
723
742
|
}
|
|
724
743
|
);
|
|
725
744
|
}
|
|
745
|
+
function GoogleButton({ onClick }) {
|
|
746
|
+
return /* @__PURE__ */ jsx2(OAuthButton, { icon: /* @__PURE__ */ jsx2(GoogleIcon, {}), label: "Continue with Google", onClick });
|
|
747
|
+
}
|
|
748
|
+
function MetaButton({ onClick }) {
|
|
749
|
+
return /* @__PURE__ */ jsx2(OAuthButton, { icon: /* @__PURE__ */ jsx2(MetaIcon, {}), label: "Continue with Facebook", onClick });
|
|
750
|
+
}
|
|
751
|
+
function LinkedInButton({ onClick }) {
|
|
752
|
+
return /* @__PURE__ */ jsx2(OAuthButton, { icon: /* @__PURE__ */ jsx2(LinkedInIcon, {}), label: "Continue with LinkedIn", onClick });
|
|
753
|
+
}
|
|
754
|
+
function GitHubButton({ onClick }) {
|
|
755
|
+
return /* @__PURE__ */ jsx2(OAuthButton, { icon: /* @__PURE__ */ jsx2(GitHubIcon, {}), label: "Continue with GitHub", onClick });
|
|
756
|
+
}
|
|
757
|
+
function XButton({ onClick }) {
|
|
758
|
+
return /* @__PURE__ */ jsx2(OAuthButton, { icon: /* @__PURE__ */ jsx2(XIcon, {}), label: "Continue with X", onClick });
|
|
759
|
+
}
|
|
726
760
|
function Divider() {
|
|
727
761
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
728
762
|
/* @__PURE__ */ jsx2("div", { className: "flex-1 h-px bg-white/8" }),
|
|
@@ -784,6 +818,18 @@ function GoogleIcon() {
|
|
|
784
818
|
/* @__PURE__ */ jsx2("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z", fill: "#EA4335" })
|
|
785
819
|
] });
|
|
786
820
|
}
|
|
821
|
+
function MetaIcon() {
|
|
822
|
+
return /* @__PURE__ */ jsx2("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "#1877F2", children: /* @__PURE__ */ jsx2("path", { d: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" }) });
|
|
823
|
+
}
|
|
824
|
+
function LinkedInIcon() {
|
|
825
|
+
return /* @__PURE__ */ jsx2("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "#0A66C2", children: /* @__PURE__ */ jsx2("path", { d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.063 2.063 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" }) });
|
|
826
|
+
}
|
|
827
|
+
function GitHubIcon() {
|
|
828
|
+
return /* @__PURE__ */ jsx2("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "white", children: /* @__PURE__ */ jsx2("path", { d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.02 10.02 0 0 0 22 12.017C22 6.484 17.522 2 12 2z" }) });
|
|
829
|
+
}
|
|
830
|
+
function XIcon() {
|
|
831
|
+
return /* @__PURE__ */ jsx2("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "white", children: /* @__PURE__ */ jsx2("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.744l7.737-8.835L1.254 2.25H8.08l4.253 5.622 5.911-5.622zm-1.161 17.52h1.833L7.084 4.126H5.117z" }) });
|
|
832
|
+
}
|
|
787
833
|
|
|
788
834
|
// src/components/SignUp.tsx
|
|
789
835
|
import { clsx as clsx2 } from "clsx";
|
|
@@ -835,19 +881,10 @@ function SignUp({
|
|
|
835
881
|
url.searchParams.set("__vaultix_handshake", handshakeToken);
|
|
836
882
|
window.location.href = url.toString();
|
|
837
883
|
}
|
|
838
|
-
|
|
884
|
+
function handleGoogleSignUp() {
|
|
839
885
|
const target = resolveAfterSignUpUrl(redirectUrl);
|
|
840
886
|
const params = new URLSearchParams({ redirect_url: target });
|
|
841
|
-
|
|
842
|
-
try {
|
|
843
|
-
const res = await fetch(url, { method: "HEAD", redirect: "manual" });
|
|
844
|
-
if (res.status === 503 || res.status === 0) {
|
|
845
|
-
setErr("Google login is not configured. Please sign in with email.");
|
|
846
|
-
return;
|
|
847
|
-
}
|
|
848
|
-
} catch {
|
|
849
|
-
}
|
|
850
|
-
window.location.href = url;
|
|
887
|
+
window.location.href = `${apiOrigin}/api/v1/auth/oauth/google?${params}`;
|
|
851
888
|
}
|
|
852
889
|
async function handleEmailPassword(e) {
|
|
853
890
|
e.preventDefault();
|