@vaultix.ai/react 0.2.2 → 0.2.3
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 +32 -14
- package/dist/index.mjs +32 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -336,17 +336,26 @@ function SignIn({
|
|
|
336
336
|
url.searchParams.set("__vaultix_handshake", handshakeToken);
|
|
337
337
|
window.location.href = url.toString();
|
|
338
338
|
}
|
|
339
|
-
function handleGoogleSignIn() {
|
|
339
|
+
async function handleGoogleSignIn() {
|
|
340
340
|
const target = resolveAfterSignInUrl(redirectUrl);
|
|
341
341
|
const params = new URLSearchParams({ redirect_url: target });
|
|
342
|
-
|
|
342
|
+
const url = `${apiOrigin}/api/v1/auth/oauth/google?${params}`;
|
|
343
|
+
try {
|
|
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;
|
|
343
352
|
}
|
|
344
353
|
async function handleEmailSubmit(e) {
|
|
345
354
|
e.preventDefault();
|
|
346
355
|
setError(null);
|
|
347
356
|
setLoading(true);
|
|
348
357
|
try {
|
|
349
|
-
const res = await fetch(`${apiOrigin}/v1/auth/lookup`, {
|
|
358
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/lookup`, {
|
|
350
359
|
method: "POST",
|
|
351
360
|
credentials: "include",
|
|
352
361
|
headers: { "Content-Type": "application/json" },
|
|
@@ -369,7 +378,7 @@ function SignIn({
|
|
|
369
378
|
setError(null);
|
|
370
379
|
setLoading(true);
|
|
371
380
|
try {
|
|
372
|
-
const res = await fetch(`${apiOrigin}/v1/auth/sign-in`, {
|
|
381
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/sign-in`, {
|
|
373
382
|
method: "POST",
|
|
374
383
|
credentials: "include",
|
|
375
384
|
headers: { "Content-Type": "application/json" },
|
|
@@ -397,7 +406,7 @@ function SignIn({
|
|
|
397
406
|
setLoading(true);
|
|
398
407
|
try {
|
|
399
408
|
const optRes = await fetch(
|
|
400
|
-
`${apiOrigin}/v1/auth/passkey/authenticate/options`,
|
|
409
|
+
`${apiOrigin}/api/v1/auth/passkey/authenticate/options`,
|
|
401
410
|
{
|
|
402
411
|
method: "POST",
|
|
403
412
|
credentials: "include",
|
|
@@ -414,7 +423,7 @@ function SignIn({
|
|
|
414
423
|
publicKey: options
|
|
415
424
|
});
|
|
416
425
|
const verifyRes = await fetch(
|
|
417
|
-
`${apiOrigin}/v1/auth/passkey/authenticate/verify`,
|
|
426
|
+
`${apiOrigin}/api/v1/auth/passkey/authenticate/verify`,
|
|
418
427
|
{
|
|
419
428
|
method: "POST",
|
|
420
429
|
credentials: "include",
|
|
@@ -457,7 +466,7 @@ function SignIn({
|
|
|
457
466
|
setError(null);
|
|
458
467
|
setLoading(true);
|
|
459
468
|
try {
|
|
460
|
-
const res = await fetch(`${apiOrigin}/v1/auth/totp/verify`, {
|
|
469
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/totp/verify`, {
|
|
461
470
|
method: "POST",
|
|
462
471
|
credentials: "include",
|
|
463
472
|
headers: { "Content-Type": "application/json" },
|
|
@@ -480,7 +489,7 @@ function SignIn({
|
|
|
480
489
|
setError(null);
|
|
481
490
|
setLoading(true);
|
|
482
491
|
try {
|
|
483
|
-
await fetch(`${apiOrigin}/v1/auth/forgot-password`, {
|
|
492
|
+
await fetch(`${apiOrigin}/api/v1/auth/forgot-password`, {
|
|
484
493
|
method: "POST",
|
|
485
494
|
credentials: "include",
|
|
486
495
|
headers: { "Content-Type": "application/json" },
|
|
@@ -505,7 +514,7 @@ function SignIn({
|
|
|
505
514
|
setError(null);
|
|
506
515
|
setLoading(true);
|
|
507
516
|
try {
|
|
508
|
-
const res = await fetch(`${apiOrigin}/v1/auth/reset-password`, {
|
|
517
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/reset-password`, {
|
|
509
518
|
method: "POST",
|
|
510
519
|
credentials: "include",
|
|
511
520
|
headers: { "Content-Type": "application/json" },
|
|
@@ -858,17 +867,26 @@ function SignUp({
|
|
|
858
867
|
url.searchParams.set("__vaultix_handshake", handshakeToken);
|
|
859
868
|
window.location.href = url.toString();
|
|
860
869
|
}
|
|
861
|
-
function handleGoogleSignUp() {
|
|
870
|
+
async function handleGoogleSignUp() {
|
|
862
871
|
const target = resolveAfterSignUpUrl(redirectUrl);
|
|
863
872
|
const params = new URLSearchParams({ redirect_url: target });
|
|
864
|
-
|
|
873
|
+
const url = `${apiOrigin}/api/v1/auth/oauth/google?${params}`;
|
|
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;
|
|
865
883
|
}
|
|
866
884
|
async function handleEmailPassword(e) {
|
|
867
885
|
e.preventDefault();
|
|
868
886
|
setError(null);
|
|
869
887
|
setLoading(true);
|
|
870
888
|
try {
|
|
871
|
-
const res = await fetch(`${apiOrigin}/v1/auth/sign-up`, {
|
|
889
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/sign-up`, {
|
|
872
890
|
method: "POST",
|
|
873
891
|
credentials: "include",
|
|
874
892
|
headers: { "Content-Type": "application/json" },
|
|
@@ -892,7 +910,7 @@ function SignUp({
|
|
|
892
910
|
setError(null);
|
|
893
911
|
setLoading(true);
|
|
894
912
|
try {
|
|
895
|
-
const res = await fetch(`${apiOrigin}/v1/auth/email/verify`, {
|
|
913
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/email/verify`, {
|
|
896
914
|
method: "POST",
|
|
897
915
|
credentials: "include",
|
|
898
916
|
headers: { "Content-Type": "application/json" },
|
|
@@ -916,7 +934,7 @@ function SignUp({
|
|
|
916
934
|
async function resendCode() {
|
|
917
935
|
if (!registrationId) return;
|
|
918
936
|
try {
|
|
919
|
-
await fetch(`${apiOrigin}/v1/auth/email/resend`, {
|
|
937
|
+
await fetch(`${apiOrigin}/api/v1/auth/email/resend`, {
|
|
920
938
|
method: "POST",
|
|
921
939
|
credentials: "include",
|
|
922
940
|
headers: { "Content-Type": "application/json" },
|
package/dist/index.mjs
CHANGED
|
@@ -304,17 +304,26 @@ function SignIn({
|
|
|
304
304
|
url.searchParams.set("__vaultix_handshake", handshakeToken);
|
|
305
305
|
window.location.href = url.toString();
|
|
306
306
|
}
|
|
307
|
-
function handleGoogleSignIn() {
|
|
307
|
+
async function handleGoogleSignIn() {
|
|
308
308
|
const target = resolveAfterSignInUrl(redirectUrl);
|
|
309
309
|
const params = new URLSearchParams({ redirect_url: target });
|
|
310
|
-
|
|
310
|
+
const url = `${apiOrigin}/api/v1/auth/oauth/google?${params}`;
|
|
311
|
+
try {
|
|
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;
|
|
311
320
|
}
|
|
312
321
|
async function handleEmailSubmit(e) {
|
|
313
322
|
e.preventDefault();
|
|
314
323
|
setError(null);
|
|
315
324
|
setLoading(true);
|
|
316
325
|
try {
|
|
317
|
-
const res = await fetch(`${apiOrigin}/v1/auth/lookup`, {
|
|
326
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/lookup`, {
|
|
318
327
|
method: "POST",
|
|
319
328
|
credentials: "include",
|
|
320
329
|
headers: { "Content-Type": "application/json" },
|
|
@@ -337,7 +346,7 @@ function SignIn({
|
|
|
337
346
|
setError(null);
|
|
338
347
|
setLoading(true);
|
|
339
348
|
try {
|
|
340
|
-
const res = await fetch(`${apiOrigin}/v1/auth/sign-in`, {
|
|
349
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/sign-in`, {
|
|
341
350
|
method: "POST",
|
|
342
351
|
credentials: "include",
|
|
343
352
|
headers: { "Content-Type": "application/json" },
|
|
@@ -365,7 +374,7 @@ function SignIn({
|
|
|
365
374
|
setLoading(true);
|
|
366
375
|
try {
|
|
367
376
|
const optRes = await fetch(
|
|
368
|
-
`${apiOrigin}/v1/auth/passkey/authenticate/options`,
|
|
377
|
+
`${apiOrigin}/api/v1/auth/passkey/authenticate/options`,
|
|
369
378
|
{
|
|
370
379
|
method: "POST",
|
|
371
380
|
credentials: "include",
|
|
@@ -382,7 +391,7 @@ function SignIn({
|
|
|
382
391
|
publicKey: options
|
|
383
392
|
});
|
|
384
393
|
const verifyRes = await fetch(
|
|
385
|
-
`${apiOrigin}/v1/auth/passkey/authenticate/verify`,
|
|
394
|
+
`${apiOrigin}/api/v1/auth/passkey/authenticate/verify`,
|
|
386
395
|
{
|
|
387
396
|
method: "POST",
|
|
388
397
|
credentials: "include",
|
|
@@ -425,7 +434,7 @@ function SignIn({
|
|
|
425
434
|
setError(null);
|
|
426
435
|
setLoading(true);
|
|
427
436
|
try {
|
|
428
|
-
const res = await fetch(`${apiOrigin}/v1/auth/totp/verify`, {
|
|
437
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/totp/verify`, {
|
|
429
438
|
method: "POST",
|
|
430
439
|
credentials: "include",
|
|
431
440
|
headers: { "Content-Type": "application/json" },
|
|
@@ -448,7 +457,7 @@ function SignIn({
|
|
|
448
457
|
setError(null);
|
|
449
458
|
setLoading(true);
|
|
450
459
|
try {
|
|
451
|
-
await fetch(`${apiOrigin}/v1/auth/forgot-password`, {
|
|
460
|
+
await fetch(`${apiOrigin}/api/v1/auth/forgot-password`, {
|
|
452
461
|
method: "POST",
|
|
453
462
|
credentials: "include",
|
|
454
463
|
headers: { "Content-Type": "application/json" },
|
|
@@ -473,7 +482,7 @@ function SignIn({
|
|
|
473
482
|
setError(null);
|
|
474
483
|
setLoading(true);
|
|
475
484
|
try {
|
|
476
|
-
const res = await fetch(`${apiOrigin}/v1/auth/reset-password`, {
|
|
485
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/reset-password`, {
|
|
477
486
|
method: "POST",
|
|
478
487
|
credentials: "include",
|
|
479
488
|
headers: { "Content-Type": "application/json" },
|
|
@@ -826,17 +835,26 @@ function SignUp({
|
|
|
826
835
|
url.searchParams.set("__vaultix_handshake", handshakeToken);
|
|
827
836
|
window.location.href = url.toString();
|
|
828
837
|
}
|
|
829
|
-
function handleGoogleSignUp() {
|
|
838
|
+
async function handleGoogleSignUp() {
|
|
830
839
|
const target = resolveAfterSignUpUrl(redirectUrl);
|
|
831
840
|
const params = new URLSearchParams({ redirect_url: target });
|
|
832
|
-
|
|
841
|
+
const url = `${apiOrigin}/api/v1/auth/oauth/google?${params}`;
|
|
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;
|
|
833
851
|
}
|
|
834
852
|
async function handleEmailPassword(e) {
|
|
835
853
|
e.preventDefault();
|
|
836
854
|
setError(null);
|
|
837
855
|
setLoading(true);
|
|
838
856
|
try {
|
|
839
|
-
const res = await fetch(`${apiOrigin}/v1/auth/sign-up`, {
|
|
857
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/sign-up`, {
|
|
840
858
|
method: "POST",
|
|
841
859
|
credentials: "include",
|
|
842
860
|
headers: { "Content-Type": "application/json" },
|
|
@@ -860,7 +878,7 @@ function SignUp({
|
|
|
860
878
|
setError(null);
|
|
861
879
|
setLoading(true);
|
|
862
880
|
try {
|
|
863
|
-
const res = await fetch(`${apiOrigin}/v1/auth/email/verify`, {
|
|
881
|
+
const res = await fetch(`${apiOrigin}/api/v1/auth/email/verify`, {
|
|
864
882
|
method: "POST",
|
|
865
883
|
credentials: "include",
|
|
866
884
|
headers: { "Content-Type": "application/json" },
|
|
@@ -884,7 +902,7 @@ function SignUp({
|
|
|
884
902
|
async function resendCode() {
|
|
885
903
|
if (!registrationId) return;
|
|
886
904
|
try {
|
|
887
|
-
await fetch(`${apiOrigin}/v1/auth/email/resend`, {
|
|
905
|
+
await fetch(`${apiOrigin}/api/v1/auth/email/resend`, {
|
|
888
906
|
method: "POST",
|
|
889
907
|
credentials: "include",
|
|
890
908
|
headers: { "Content-Type": "application/json" },
|