@insforge/sdk 1.0.8 → 1.1.0-dev.1

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.mjs CHANGED
@@ -540,46 +540,6 @@ var Auth = class {
540
540
  };
541
541
  }
542
542
  }
543
- /**
544
- * Get the current user with full profile information
545
- * Returns both auth info (id, email, role) and profile data (dynamic fields from users table)
546
- */
547
- async getCurrentUser() {
548
- try {
549
- const user = this.tokenManager.getUser();
550
- if (user) {
551
- return { data: { user }, error: null };
552
- }
553
- const accessToken = this.tokenManager.getAccessToken();
554
- if (!accessToken) {
555
- return { data: null, error: null };
556
- }
557
- this.http.setAuthToken(accessToken);
558
- const authResponse = await this.http.get("/api/auth/sessions/current");
559
- return {
560
- data: {
561
- user: authResponse.user
562
- },
563
- error: null
564
- };
565
- } catch (error) {
566
- if (error instanceof InsForgeError && error.statusCode === 401) {
567
- await this.signOut();
568
- return { data: null, error: null };
569
- }
570
- if (error instanceof InsForgeError) {
571
- return { data: null, error };
572
- }
573
- return {
574
- data: null,
575
- error: new InsForgeError(
576
- "An unexpected error occurred while fetching user",
577
- 500,
578
- "UNEXPECTED_ERROR"
579
- )
580
- };
581
- }
582
- }
583
543
  /**
584
544
  * Get any user's profile by ID
585
545
  * Returns profile information from the users table
@@ -610,6 +570,9 @@ var Auth = class {
610
570
  * Returns the stored JWT token and basic user info from local storage
611
571
  */
612
572
  async getCurrentSession() {
573
+ if (isHostedAuthEnvironment()) {
574
+ return { data: { session: null }, error: null };
575
+ }
613
576
  try {
614
577
  const session = this.tokenManager.getSession();
615
578
  if (session) {
@@ -708,13 +671,14 @@ var Auth = class {
708
671
  }
709
672
  }
710
673
  /**
711
- * Send email verification (code or link based on config)
674
+ * Resend email verification (code or link based on config)
712
675
  *
713
- * Send email verification using the method configured in auth settings (verifyEmailMethod).
676
+ * Resend email verification when the previous OTP has expired or was not received.
677
+ * Uses the method configured in auth settings (verifyEmailMethod).
714
678
  * When method is 'code', sends a 6-digit numeric code. When method is 'link', sends a magic link.
715
679
  * Prevents user enumeration by returning success even if email doesn't exist.
716
680
  */
717
- async sendVerificationEmail(request) {
681
+ async resendVerificationEmail(request) {
718
682
  try {
719
683
  const response = await this.http.post(
720
684
  "/api/auth/email/send-verification",
@@ -738,6 +702,12 @@ var Auth = class {
738
702
  };
739
703
  }
740
704
  }
705
+ /**
706
+ * @deprecated Use `resendVerificationEmail` instead. This method will be removed in a future version.
707
+ */
708
+ async sendVerificationEmail(request) {
709
+ return this.resendVerificationEmail(request);
710
+ }
741
711
  /**
742
712
  * Send password reset (code or link based on config)
743
713
  *