@digilogiclabs/saas-factory-auth 0.4.1 → 0.4.2

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.d.mts CHANGED
@@ -1,5 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
1
+ import React from 'react';
3
2
  import * as _supabase_supabase_js from '@supabase/supabase-js';
4
3
  import { NextRequest, NextResponse } from 'next/server.js';
5
4
  import { ReadonlyRequestCookies } from 'next/dist/server/web/spec-extension/adapters/request-cookies';
@@ -87,17 +86,17 @@ interface AuthFormProps {
87
86
  allowMagicLink?: boolean;
88
87
  className?: string;
89
88
  }
90
- /**
91
- * Zustand store interface for authentication state and actions
92
- * This represents the actual store hook that components will use
93
- */
89
+
94
90
  interface AuthStore {
95
91
  user: User | null;
92
+ session: AuthSession | null;
96
93
  loading: boolean;
97
- error: string | null;
98
- updateUser: (user: User | null) => void;
94
+ error: Error | null;
95
+ setUser: (user: User | null) => void;
96
+ setSession: (session: AuthSession | null) => void;
99
97
  setLoading: (loading: boolean) => void;
100
- setError: (error: string | null) => void;
98
+ setError: (error: Error | null) => void;
99
+ setAuthProvider: (provider: IAuthProvider) => void;
101
100
  signIn: (email: string, password: string) => Promise<void>;
102
101
  signUp: (email: string, password: string) => Promise<void>;
103
102
  signOut: () => Promise<void>;
@@ -108,11 +107,6 @@ interface AuthStore {
108
107
  getSession: () => Promise<AuthSession | null>;
109
108
  onAuthStateChange: (callback: (event: AuthEvent, session: AuthSession | null) => void) => any;
110
109
  }
111
- /**
112
- * Type for the actual Zustand hook returned by createAuthStore
113
- * This is what gets passed through context and used by components
114
- */
115
- type AuthStoreHook = () => AuthStore;
116
110
 
117
111
  /**
118
112
  * OAuth provider types - re-export from types for backward compatibility
@@ -197,6 +191,21 @@ interface IAuthProvider {
197
191
  validateConfiguration?(): Promise<void>;
198
192
  }
199
193
 
194
+ interface AuthProviderProps {
195
+ children: React.ReactNode;
196
+ onAuthChange?: (event: AuthEvent) => void;
197
+ autoSignIn?: boolean;
198
+ }
199
+ declare const AuthProvider: React.FC<AuthProviderProps>;
200
+
201
+ interface AuthState extends AuthStore {
202
+ authProvider: IAuthProvider | null;
203
+ setAuthProvider: (provider: IAuthProvider) => void;
204
+ setSession: (session: AuthSession | null) => void;
205
+ }
206
+
207
+ declare const useAuth: () => AuthState;
208
+
200
209
  /**
201
210
  * Storage interface for cross-platform compatibility
202
211
  */
@@ -284,15 +293,6 @@ declare class AuthProviderFactory {
284
293
  static getInstances(): Map<AuthProviderType, IAuthProvider>;
285
294
  }
286
295
 
287
- interface AuthProviderProps {
288
- children: ReactNode;
289
- providerType?: AuthProviderType;
290
- storage?: IAuthStorage;
291
- }
292
- declare const AuthProvider: ({ children, providerType, storage }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
293
-
294
- declare const useAuth: () => AuthStore;
295
-
296
296
  type Database = {
297
297
  public: {
298
298
  Tables: {
@@ -344,4 +344,4 @@ declare function withAuth(request: NextRequest): {
344
344
 
345
345
  declare const createSupabaseServerClient: (cookieStore: ReadonlyRequestCookies) => _supabase_supabase_js.SupabaseClient<Database, "public", any>;
346
346
 
347
- export { type AuthConfig, AuthEvent, type AuthFormProps, type AuthMode, AuthProvider, AuthProviderFactory, type AuthSession, type AuthStore, type AuthStoreHook, type OAuthProvider$1 as OAuthProvider, type PasswordConfig, type User, type UserRole, createSupabaseServerClient, getSupabaseClient, useAuth, withAuth };
347
+ export { type AuthConfig, AuthEvent, type AuthFormProps, type AuthMode, AuthProvider, AuthProviderFactory, type AuthSession, type AuthStore, type OAuthProvider$1 as OAuthProvider, type PasswordConfig, type User, type UserRole, createSupabaseServerClient, getSupabaseClient, useAuth, withAuth };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
1
+ import React from 'react';
3
2
  import * as _supabase_supabase_js from '@supabase/supabase-js';
4
3
  import { NextRequest, NextResponse } from 'next/server.js';
5
4
  import { ReadonlyRequestCookies } from 'next/dist/server/web/spec-extension/adapters/request-cookies';
@@ -87,17 +86,17 @@ interface AuthFormProps {
87
86
  allowMagicLink?: boolean;
88
87
  className?: string;
89
88
  }
90
- /**
91
- * Zustand store interface for authentication state and actions
92
- * This represents the actual store hook that components will use
93
- */
89
+
94
90
  interface AuthStore {
95
91
  user: User | null;
92
+ session: AuthSession | null;
96
93
  loading: boolean;
97
- error: string | null;
98
- updateUser: (user: User | null) => void;
94
+ error: Error | null;
95
+ setUser: (user: User | null) => void;
96
+ setSession: (session: AuthSession | null) => void;
99
97
  setLoading: (loading: boolean) => void;
100
- setError: (error: string | null) => void;
98
+ setError: (error: Error | null) => void;
99
+ setAuthProvider: (provider: IAuthProvider) => void;
101
100
  signIn: (email: string, password: string) => Promise<void>;
102
101
  signUp: (email: string, password: string) => Promise<void>;
103
102
  signOut: () => Promise<void>;
@@ -108,11 +107,6 @@ interface AuthStore {
108
107
  getSession: () => Promise<AuthSession | null>;
109
108
  onAuthStateChange: (callback: (event: AuthEvent, session: AuthSession | null) => void) => any;
110
109
  }
111
- /**
112
- * Type for the actual Zustand hook returned by createAuthStore
113
- * This is what gets passed through context and used by components
114
- */
115
- type AuthStoreHook = () => AuthStore;
116
110
 
117
111
  /**
118
112
  * OAuth provider types - re-export from types for backward compatibility
@@ -197,6 +191,21 @@ interface IAuthProvider {
197
191
  validateConfiguration?(): Promise<void>;
198
192
  }
199
193
 
194
+ interface AuthProviderProps {
195
+ children: React.ReactNode;
196
+ onAuthChange?: (event: AuthEvent) => void;
197
+ autoSignIn?: boolean;
198
+ }
199
+ declare const AuthProvider: React.FC<AuthProviderProps>;
200
+
201
+ interface AuthState extends AuthStore {
202
+ authProvider: IAuthProvider | null;
203
+ setAuthProvider: (provider: IAuthProvider) => void;
204
+ setSession: (session: AuthSession | null) => void;
205
+ }
206
+
207
+ declare const useAuth: () => AuthState;
208
+
200
209
  /**
201
210
  * Storage interface for cross-platform compatibility
202
211
  */
@@ -284,15 +293,6 @@ declare class AuthProviderFactory {
284
293
  static getInstances(): Map<AuthProviderType, IAuthProvider>;
285
294
  }
286
295
 
287
- interface AuthProviderProps {
288
- children: ReactNode;
289
- providerType?: AuthProviderType;
290
- storage?: IAuthStorage;
291
- }
292
- declare const AuthProvider: ({ children, providerType, storage }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
293
-
294
- declare const useAuth: () => AuthStore;
295
-
296
296
  type Database = {
297
297
  public: {
298
298
  Tables: {
@@ -344,4 +344,4 @@ declare function withAuth(request: NextRequest): {
344
344
 
345
345
  declare const createSupabaseServerClient: (cookieStore: ReadonlyRequestCookies) => _supabase_supabase_js.SupabaseClient<Database, "public", any>;
346
346
 
347
- export { type AuthConfig, AuthEvent, type AuthFormProps, type AuthMode, AuthProvider, AuthProviderFactory, type AuthSession, type AuthStore, type AuthStoreHook, type OAuthProvider$1 as OAuthProvider, type PasswordConfig, type User, type UserRole, createSupabaseServerClient, getSupabaseClient, useAuth, withAuth };
347
+ export { type AuthConfig, AuthEvent, type AuthFormProps, type AuthMode, AuthProvider, AuthProviderFactory, type AuthSession, type AuthStore, type OAuthProvider$1 as OAuthProvider, type PasswordConfig, type User, type UserRole, createSupabaseServerClient, getSupabaseClient, useAuth, withAuth };