@digilogiclabs/saas-factory-auth 0.1.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.d.mts +103 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.js +185 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +153 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { User } from '@supabase/supabase-js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import * as zustand from 'zustand';
|
|
5
|
+
import * as _supabase_auth_helpers_nextjs from '@supabase/auth-helpers-nextjs';
|
|
6
|
+
|
|
7
|
+
type AuthMode = 'signIn' | 'signUp' | 'resetPassword' | 'magicLink';
|
|
8
|
+
interface UserRole {
|
|
9
|
+
role: 'admin' | 'user' | 'guest' | 'superuser' | 'experimental';
|
|
10
|
+
permissions: string[];
|
|
11
|
+
}
|
|
12
|
+
interface AuthConfig {
|
|
13
|
+
passwordRequirements?: {
|
|
14
|
+
minLength: number;
|
|
15
|
+
requireNumbers: boolean;
|
|
16
|
+
requireSpecialChars: boolean;
|
|
17
|
+
requireUppercase: boolean;
|
|
18
|
+
};
|
|
19
|
+
maxLoginAttempts?: number;
|
|
20
|
+
lockoutDuration?: number;
|
|
21
|
+
jwtExpiryTime?: number;
|
|
22
|
+
require2FA?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface AuthFormProps {
|
|
25
|
+
defaultMode?: AuthMode;
|
|
26
|
+
onSuccess?: () => void;
|
|
27
|
+
onError?: (error: Error) => void;
|
|
28
|
+
redirectTo?: string;
|
|
29
|
+
providers?: string[];
|
|
30
|
+
allowMagicLink?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface AuthState {
|
|
33
|
+
user: User | null;
|
|
34
|
+
loading: boolean;
|
|
35
|
+
error: Error | null;
|
|
36
|
+
}
|
|
37
|
+
interface AuthStore extends AuthState {
|
|
38
|
+
signIn: (email: string, password: string) => Promise<void>;
|
|
39
|
+
signUp: (email: string, password: string) => Promise<void>;
|
|
40
|
+
signInWithOAuth: (provider: string, redirectTo?: string) => Promise<void>;
|
|
41
|
+
signInWithMagicLink: (email: string, redirectTo?: string) => Promise<void>;
|
|
42
|
+
signOut: () => Promise<void>;
|
|
43
|
+
resetPassword: (email: string) => Promise<void>;
|
|
44
|
+
updateUser: (user: User | null) => void;
|
|
45
|
+
setLoading: (loading: boolean) => void;
|
|
46
|
+
setError: (error: Error | null) => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare const useAuth: () => AuthStore;
|
|
50
|
+
|
|
51
|
+
declare const AuthProvider: ({ children }: {
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare const useAuthContext: () => AuthStore;
|
|
55
|
+
|
|
56
|
+
declare const useAuthStore: zustand.UseBoundStore<zustand.StoreApi<AuthStore>>;
|
|
57
|
+
|
|
58
|
+
type Database = {
|
|
59
|
+
public: {
|
|
60
|
+
Tables: {
|
|
61
|
+
profiles: {
|
|
62
|
+
Row: {
|
|
63
|
+
id: string;
|
|
64
|
+
updated_at: string;
|
|
65
|
+
username: string;
|
|
66
|
+
full_name: string;
|
|
67
|
+
avatar_url: string;
|
|
68
|
+
website: string;
|
|
69
|
+
};
|
|
70
|
+
Insert: {
|
|
71
|
+
id: string;
|
|
72
|
+
updated_at?: string;
|
|
73
|
+
username: string;
|
|
74
|
+
full_name?: string;
|
|
75
|
+
avatar_url?: string;
|
|
76
|
+
website?: string;
|
|
77
|
+
};
|
|
78
|
+
Update: {
|
|
79
|
+
id?: string;
|
|
80
|
+
updated_at?: string;
|
|
81
|
+
username?: string;
|
|
82
|
+
full_name?: string;
|
|
83
|
+
avatar_url?: string;
|
|
84
|
+
website?: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
Views: {
|
|
89
|
+
[_ in never]: never;
|
|
90
|
+
};
|
|
91
|
+
Functions: {
|
|
92
|
+
[_ in never]: never;
|
|
93
|
+
};
|
|
94
|
+
Enums: {
|
|
95
|
+
[_ in never]: never;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
declare const createClient: () => _supabase_auth_helpers_nextjs.SupabaseClient<Database, "public", any>;
|
|
101
|
+
declare const supabase: _supabase_auth_helpers_nextjs.SupabaseClient<Database, "public", any>;
|
|
102
|
+
|
|
103
|
+
export { type AuthConfig, type AuthFormProps, type AuthMode, AuthProvider, type AuthState, type AuthStore, type UserRole, createClient, supabase, useAuth, useAuthContext, useAuthStore };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { User } from '@supabase/supabase-js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import * as zustand from 'zustand';
|
|
5
|
+
import * as _supabase_auth_helpers_nextjs from '@supabase/auth-helpers-nextjs';
|
|
6
|
+
|
|
7
|
+
type AuthMode = 'signIn' | 'signUp' | 'resetPassword' | 'magicLink';
|
|
8
|
+
interface UserRole {
|
|
9
|
+
role: 'admin' | 'user' | 'guest' | 'superuser' | 'experimental';
|
|
10
|
+
permissions: string[];
|
|
11
|
+
}
|
|
12
|
+
interface AuthConfig {
|
|
13
|
+
passwordRequirements?: {
|
|
14
|
+
minLength: number;
|
|
15
|
+
requireNumbers: boolean;
|
|
16
|
+
requireSpecialChars: boolean;
|
|
17
|
+
requireUppercase: boolean;
|
|
18
|
+
};
|
|
19
|
+
maxLoginAttempts?: number;
|
|
20
|
+
lockoutDuration?: number;
|
|
21
|
+
jwtExpiryTime?: number;
|
|
22
|
+
require2FA?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface AuthFormProps {
|
|
25
|
+
defaultMode?: AuthMode;
|
|
26
|
+
onSuccess?: () => void;
|
|
27
|
+
onError?: (error: Error) => void;
|
|
28
|
+
redirectTo?: string;
|
|
29
|
+
providers?: string[];
|
|
30
|
+
allowMagicLink?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface AuthState {
|
|
33
|
+
user: User | null;
|
|
34
|
+
loading: boolean;
|
|
35
|
+
error: Error | null;
|
|
36
|
+
}
|
|
37
|
+
interface AuthStore extends AuthState {
|
|
38
|
+
signIn: (email: string, password: string) => Promise<void>;
|
|
39
|
+
signUp: (email: string, password: string) => Promise<void>;
|
|
40
|
+
signInWithOAuth: (provider: string, redirectTo?: string) => Promise<void>;
|
|
41
|
+
signInWithMagicLink: (email: string, redirectTo?: string) => Promise<void>;
|
|
42
|
+
signOut: () => Promise<void>;
|
|
43
|
+
resetPassword: (email: string) => Promise<void>;
|
|
44
|
+
updateUser: (user: User | null) => void;
|
|
45
|
+
setLoading: (loading: boolean) => void;
|
|
46
|
+
setError: (error: Error | null) => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare const useAuth: () => AuthStore;
|
|
50
|
+
|
|
51
|
+
declare const AuthProvider: ({ children }: {
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare const useAuthContext: () => AuthStore;
|
|
55
|
+
|
|
56
|
+
declare const useAuthStore: zustand.UseBoundStore<zustand.StoreApi<AuthStore>>;
|
|
57
|
+
|
|
58
|
+
type Database = {
|
|
59
|
+
public: {
|
|
60
|
+
Tables: {
|
|
61
|
+
profiles: {
|
|
62
|
+
Row: {
|
|
63
|
+
id: string;
|
|
64
|
+
updated_at: string;
|
|
65
|
+
username: string;
|
|
66
|
+
full_name: string;
|
|
67
|
+
avatar_url: string;
|
|
68
|
+
website: string;
|
|
69
|
+
};
|
|
70
|
+
Insert: {
|
|
71
|
+
id: string;
|
|
72
|
+
updated_at?: string;
|
|
73
|
+
username: string;
|
|
74
|
+
full_name?: string;
|
|
75
|
+
avatar_url?: string;
|
|
76
|
+
website?: string;
|
|
77
|
+
};
|
|
78
|
+
Update: {
|
|
79
|
+
id?: string;
|
|
80
|
+
updated_at?: string;
|
|
81
|
+
username?: string;
|
|
82
|
+
full_name?: string;
|
|
83
|
+
avatar_url?: string;
|
|
84
|
+
website?: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
Views: {
|
|
89
|
+
[_ in never]: never;
|
|
90
|
+
};
|
|
91
|
+
Functions: {
|
|
92
|
+
[_ in never]: never;
|
|
93
|
+
};
|
|
94
|
+
Enums: {
|
|
95
|
+
[_ in never]: never;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
declare const createClient: () => _supabase_auth_helpers_nextjs.SupabaseClient<Database, "public", any>;
|
|
101
|
+
declare const supabase: _supabase_auth_helpers_nextjs.SupabaseClient<Database, "public", any>;
|
|
102
|
+
|
|
103
|
+
export { type AuthConfig, type AuthFormProps, type AuthMode, AuthProvider, type AuthState, type AuthStore, type UserRole, createClient, supabase, useAuth, useAuthContext, useAuthStore };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AuthProvider: () => AuthProvider,
|
|
24
|
+
createClient: () => createClient,
|
|
25
|
+
supabase: () => supabase,
|
|
26
|
+
useAuth: () => useAuth,
|
|
27
|
+
useAuthContext: () => useAuthContext,
|
|
28
|
+
useAuthStore: () => useAuthStore
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
|
+
|
|
32
|
+
// src/hooks/useAuth.ts
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
|
|
35
|
+
// src/store/authStore.ts
|
|
36
|
+
var import_zustand = require("zustand");
|
|
37
|
+
|
|
38
|
+
// src/utils/supabase.ts
|
|
39
|
+
var import_auth_helpers_nextjs = require("@supabase/auth-helpers-nextjs");
|
|
40
|
+
var createClient = () => {
|
|
41
|
+
if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) {
|
|
42
|
+
throw new Error("Missing Supabase environment variables");
|
|
43
|
+
}
|
|
44
|
+
return (0, import_auth_helpers_nextjs.createClientComponentClient)();
|
|
45
|
+
};
|
|
46
|
+
var supabase = createClient();
|
|
47
|
+
|
|
48
|
+
// src/store/authStore.ts
|
|
49
|
+
var useAuthStore = (0, import_zustand.create)((set) => ({
|
|
50
|
+
user: null,
|
|
51
|
+
loading: true,
|
|
52
|
+
error: null,
|
|
53
|
+
signIn: async (email, password) => {
|
|
54
|
+
try {
|
|
55
|
+
set({ loading: true, error: null });
|
|
56
|
+
const { error } = await supabase.auth.signInWithPassword({
|
|
57
|
+
email,
|
|
58
|
+
password
|
|
59
|
+
});
|
|
60
|
+
if (error) throw error;
|
|
61
|
+
} catch (error) {
|
|
62
|
+
set({ error });
|
|
63
|
+
} finally {
|
|
64
|
+
set({ loading: false });
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
signUp: async (email, password) => {
|
|
68
|
+
try {
|
|
69
|
+
set({ loading: true, error: null });
|
|
70
|
+
const { error } = await supabase.auth.signUp({
|
|
71
|
+
email,
|
|
72
|
+
password
|
|
73
|
+
});
|
|
74
|
+
if (error) throw error;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
set({ error });
|
|
77
|
+
} finally {
|
|
78
|
+
set({ loading: false });
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
signOut: async () => {
|
|
82
|
+
try {
|
|
83
|
+
set({ loading: true, error: null });
|
|
84
|
+
const { error } = await supabase.auth.signOut();
|
|
85
|
+
if (error) throw error;
|
|
86
|
+
set({ user: null });
|
|
87
|
+
} catch (error) {
|
|
88
|
+
set({ error });
|
|
89
|
+
} finally {
|
|
90
|
+
set({ loading: false });
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
resetPassword: async (email) => {
|
|
94
|
+
try {
|
|
95
|
+
set({ loading: true, error: null });
|
|
96
|
+
const { error } = await supabase.auth.resetPasswordForEmail(email);
|
|
97
|
+
if (error) throw error;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
set({ error });
|
|
100
|
+
} finally {
|
|
101
|
+
set({ loading: false });
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
signInWithOAuth: async (provider, redirectTo) => {
|
|
105
|
+
try {
|
|
106
|
+
set({ loading: true, error: null });
|
|
107
|
+
const { error } = await supabase.auth.signInWithOAuth({
|
|
108
|
+
provider,
|
|
109
|
+
options: {
|
|
110
|
+
redirectTo
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
if (error) throw error;
|
|
114
|
+
} catch (error) {
|
|
115
|
+
set({ error });
|
|
116
|
+
} finally {
|
|
117
|
+
set({ loading: false });
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
signInWithMagicLink: async (email, redirectTo) => {
|
|
121
|
+
try {
|
|
122
|
+
set({ loading: true, error: null });
|
|
123
|
+
const { error } = await supabase.auth.signInWithOtp({
|
|
124
|
+
email,
|
|
125
|
+
options: {
|
|
126
|
+
emailRedirectTo: redirectTo
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
if (error) throw error;
|
|
130
|
+
} catch (error) {
|
|
131
|
+
set({ error });
|
|
132
|
+
} finally {
|
|
133
|
+
set({ loading: false });
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
updateUser: (user) => set({ user }),
|
|
137
|
+
setLoading: (loading) => set({ loading }),
|
|
138
|
+
setError: (error) => set({ error })
|
|
139
|
+
}));
|
|
140
|
+
|
|
141
|
+
// src/hooks/useAuth.ts
|
|
142
|
+
var useAuth = () => {
|
|
143
|
+
const store = useAuthStore();
|
|
144
|
+
(0, import_react.useEffect)(() => {
|
|
145
|
+
supabase.auth.getSession().then(({ data: { session } }) => {
|
|
146
|
+
var _a;
|
|
147
|
+
store.updateUser((_a = session == null ? void 0 : session.user) != null ? _a : null);
|
|
148
|
+
store.setLoading(false);
|
|
149
|
+
});
|
|
150
|
+
const {
|
|
151
|
+
data: { subscription }
|
|
152
|
+
} = supabase.auth.onAuthStateChange((_event, session) => {
|
|
153
|
+
var _a;
|
|
154
|
+
store.updateUser((_a = session == null ? void 0 : session.user) != null ? _a : null);
|
|
155
|
+
});
|
|
156
|
+
return () => subscription.unsubscribe();
|
|
157
|
+
}, []);
|
|
158
|
+
return store;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// src/components/AuthProvider.tsx
|
|
162
|
+
var import_react2 = require("react");
|
|
163
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
164
|
+
var AuthContext = (0, import_react2.createContext)(null);
|
|
165
|
+
var AuthProvider = ({ children }) => {
|
|
166
|
+
const auth = useAuth();
|
|
167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthContext.Provider, { value: auth, children });
|
|
168
|
+
};
|
|
169
|
+
var useAuthContext = () => {
|
|
170
|
+
const context = (0, import_react2.useContext)(AuthContext);
|
|
171
|
+
if (!context) {
|
|
172
|
+
throw new Error("useAuthContext must be used within an AuthProvider");
|
|
173
|
+
}
|
|
174
|
+
return context;
|
|
175
|
+
};
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
AuthProvider,
|
|
179
|
+
createClient,
|
|
180
|
+
supabase,
|
|
181
|
+
useAuth,
|
|
182
|
+
useAuthContext,
|
|
183
|
+
useAuthStore
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/hooks/useAuth.ts","../src/store/authStore.ts","../src/utils/supabase.ts","../src/components/AuthProvider.tsx"],"sourcesContent":["export * from './types'\r\nexport * from './hooks/useAuth'\r\nexport * from './components/AuthProvider'\r\nexport * from './store/authStore'\r\nexport * from './utils/supabase'","'use client'\r\n\r\nimport { useEffect } from 'react'\r\nimport { useAuthStore } from '../store/authStore'\r\nimport { supabase } from '../utils/supabase'\r\n\r\nexport const useAuth = () => {\r\n const store = useAuthStore()\r\n\r\n useEffect(() => {\r\n // Check active session\r\n supabase.auth.getSession().then(({ data: { session } }) => {\r\n store.updateUser(session?.user ?? null)\r\n store.setLoading(false)\r\n })\r\n\r\n // Listen for auth changes\r\n const {\r\n data: { subscription },\r\n } = supabase.auth.onAuthStateChange((_event, session) => {\r\n store.updateUser(session?.user ?? null)\r\n })\r\n\r\n return () => subscription.unsubscribe()\r\n }, [])\r\n\r\n return store\r\n}","import { create } from 'zustand'\r\nimport { AuthStore } from '../types'\r\nimport { supabase } from '../utils/supabase'\r\n\r\nexport const useAuthStore = create<AuthStore>((set) => ({\r\n user: null,\r\n loading: true,\r\n error: null,\r\n\r\n signIn: async (email: string, password: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signInWithPassword({\r\n email,\r\n password,\r\n })\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n\r\n signUp: async (email: string, password: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signUp({\r\n email,\r\n password,\r\n })\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n\r\n signOut: async () => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signOut()\r\n if (error) throw error\r\n set({ user: null })\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n\r\n resetPassword: async (email: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.resetPasswordForEmail(email)\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n signInWithOAuth: async (provider: string, redirectTo?: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signInWithOAuth({\r\n provider: provider as any,\r\n options: {\r\n redirectTo\r\n }\r\n })\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n\r\n signInWithMagicLink: async (email: string, redirectTo?: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signInWithOtp({\r\n email,\r\n options: {\r\n emailRedirectTo: redirectTo\r\n }\r\n })\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n updateUser: (user) => set({ user }),\r\n setLoading: (loading) => set({ loading }),\r\n setError: (error) => set({ error }),\r\n}))\r\n\r\n// Example usage in a Next.js app:\r\n/*\r\nimport { AuthForm } from '@digilogiclabs/saas-factory-auth'\r\n\r\nexport default function LoginPage() {\r\n const router = useRouter()\r\n\r\n return (\r\n <AuthForm\r\n defaultMode=\"signIn\"\r\n onSuccess={() => router.push('/dashboard')}\r\n providers={['google', 'github']}\r\n redirectTo=\"https://your-app.com/auth/callback\"\r\n />\r\n )\r\n}\r\n*/","\r\nimport { createClientComponentClient } from '@supabase/auth-helpers-nextjs'\r\nimport type { Database } from './database.types'\r\n\r\nexport const createClient = () => {\r\n if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) {\r\n throw new Error('Missing Supabase environment variables')\r\n }\r\n\r\n return createClientComponentClient<Database>()\r\n}\r\n\r\nexport const supabase = createClient()","'use client'\r\n\r\nimport { createContext, useContext, ReactNode } from 'react'\r\nimport { useAuth } from '../hooks/useAuth'\r\nimport type { AuthStore } from '../types'\r\n\r\nconst AuthContext = createContext<AuthStore | null>(null)\r\n\r\nexport const AuthProvider = ({ children }: { children: ReactNode }) => {\r\n const auth = useAuth()\r\n\r\n return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider>\r\n}\r\n\r\nexport const useAuthContext = () => {\r\n const context = useContext(AuthContext)\r\n if (!context) {\r\n throw new Error('useAuthContext must be used within an AuthProvider')\r\n }\r\n return context\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAA0B;;;ACF1B,qBAAuB;;;ACCvB,iCAA4C;AAGrC,IAAM,eAAe,MAAM;AAChC,MAAI,CAAC,QAAQ,IAAI,4BAA4B,CAAC,QAAQ,IAAI,+BAA+B;AACvF,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC1D;AAEA,aAAO,wDAAsC;AAC/C;AAEO,IAAM,WAAW,aAAa;;;ADR9B,IAAM,mBAAe,uBAAkB,CAAC,SAAS;AAAA,EACtD,MAAM;AAAA,EACN,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YAAW,wCAAS,SAAT,YAAiB,IAAI;AACtC,YAAM,WAAW,KAAK;AAAA,IACxB,CAAC;AAGD,UAAM;AAAA,MACJ,MAAM,EAAE,aAAa;AAAA,IACvB,IAAI,SAAS,KAAK,kBAAkB,CAAC,QAAQ,YAAY;AAnB7D;AAoBM,YAAM,YAAW,wCAAS,SAAT,YAAiB,IAAI;AAAA,IACxC,CAAC;AAED,WAAO,MAAM,aAAa,YAAY;AAAA,EACxC,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;;;AGzBA,IAAAA,gBAAqD;AAS5C;AALT,IAAM,kBAAc,6BAAgC,IAAI;AAEjD,IAAM,eAAe,CAAC,EAAE,SAAS,MAA+B;AACrE,QAAM,OAAO,QAAQ;AAErB,SAAO,4CAAC,YAAY,UAAZ,EAAqB,OAAO,MAAO,UAAS;AACtD;AAEO,IAAM,iBAAiB,MAAM;AAClC,QAAM,cAAU,0BAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;","names":["import_react"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// src/hooks/useAuth.ts
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
|
|
4
|
+
// src/store/authStore.ts
|
|
5
|
+
import { create } from "zustand";
|
|
6
|
+
|
|
7
|
+
// src/utils/supabase.ts
|
|
8
|
+
import { createClientComponentClient } from "@supabase/auth-helpers-nextjs";
|
|
9
|
+
var createClient = () => {
|
|
10
|
+
if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) {
|
|
11
|
+
throw new Error("Missing Supabase environment variables");
|
|
12
|
+
}
|
|
13
|
+
return createClientComponentClient();
|
|
14
|
+
};
|
|
15
|
+
var supabase = createClient();
|
|
16
|
+
|
|
17
|
+
// src/store/authStore.ts
|
|
18
|
+
var useAuthStore = create((set) => ({
|
|
19
|
+
user: null,
|
|
20
|
+
loading: true,
|
|
21
|
+
error: null,
|
|
22
|
+
signIn: async (email, password) => {
|
|
23
|
+
try {
|
|
24
|
+
set({ loading: true, error: null });
|
|
25
|
+
const { error } = await supabase.auth.signInWithPassword({
|
|
26
|
+
email,
|
|
27
|
+
password
|
|
28
|
+
});
|
|
29
|
+
if (error) throw error;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
set({ error });
|
|
32
|
+
} finally {
|
|
33
|
+
set({ loading: false });
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
signUp: async (email, password) => {
|
|
37
|
+
try {
|
|
38
|
+
set({ loading: true, error: null });
|
|
39
|
+
const { error } = await supabase.auth.signUp({
|
|
40
|
+
email,
|
|
41
|
+
password
|
|
42
|
+
});
|
|
43
|
+
if (error) throw error;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
set({ error });
|
|
46
|
+
} finally {
|
|
47
|
+
set({ loading: false });
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
signOut: async () => {
|
|
51
|
+
try {
|
|
52
|
+
set({ loading: true, error: null });
|
|
53
|
+
const { error } = await supabase.auth.signOut();
|
|
54
|
+
if (error) throw error;
|
|
55
|
+
set({ user: null });
|
|
56
|
+
} catch (error) {
|
|
57
|
+
set({ error });
|
|
58
|
+
} finally {
|
|
59
|
+
set({ loading: false });
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
resetPassword: async (email) => {
|
|
63
|
+
try {
|
|
64
|
+
set({ loading: true, error: null });
|
|
65
|
+
const { error } = await supabase.auth.resetPasswordForEmail(email);
|
|
66
|
+
if (error) throw error;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
set({ error });
|
|
69
|
+
} finally {
|
|
70
|
+
set({ loading: false });
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
signInWithOAuth: async (provider, redirectTo) => {
|
|
74
|
+
try {
|
|
75
|
+
set({ loading: true, error: null });
|
|
76
|
+
const { error } = await supabase.auth.signInWithOAuth({
|
|
77
|
+
provider,
|
|
78
|
+
options: {
|
|
79
|
+
redirectTo
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (error) throw error;
|
|
83
|
+
} catch (error) {
|
|
84
|
+
set({ error });
|
|
85
|
+
} finally {
|
|
86
|
+
set({ loading: false });
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
signInWithMagicLink: async (email, redirectTo) => {
|
|
90
|
+
try {
|
|
91
|
+
set({ loading: true, error: null });
|
|
92
|
+
const { error } = await supabase.auth.signInWithOtp({
|
|
93
|
+
email,
|
|
94
|
+
options: {
|
|
95
|
+
emailRedirectTo: redirectTo
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
if (error) throw error;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
set({ error });
|
|
101
|
+
} finally {
|
|
102
|
+
set({ loading: false });
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
updateUser: (user) => set({ user }),
|
|
106
|
+
setLoading: (loading) => set({ loading }),
|
|
107
|
+
setError: (error) => set({ error })
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
// src/hooks/useAuth.ts
|
|
111
|
+
var useAuth = () => {
|
|
112
|
+
const store = useAuthStore();
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
supabase.auth.getSession().then(({ data: { session } }) => {
|
|
115
|
+
var _a;
|
|
116
|
+
store.updateUser((_a = session == null ? void 0 : session.user) != null ? _a : null);
|
|
117
|
+
store.setLoading(false);
|
|
118
|
+
});
|
|
119
|
+
const {
|
|
120
|
+
data: { subscription }
|
|
121
|
+
} = supabase.auth.onAuthStateChange((_event, session) => {
|
|
122
|
+
var _a;
|
|
123
|
+
store.updateUser((_a = session == null ? void 0 : session.user) != null ? _a : null);
|
|
124
|
+
});
|
|
125
|
+
return () => subscription.unsubscribe();
|
|
126
|
+
}, []);
|
|
127
|
+
return store;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// src/components/AuthProvider.tsx
|
|
131
|
+
import { createContext, useContext } from "react";
|
|
132
|
+
import { jsx } from "react/jsx-runtime";
|
|
133
|
+
var AuthContext = createContext(null);
|
|
134
|
+
var AuthProvider = ({ children }) => {
|
|
135
|
+
const auth = useAuth();
|
|
136
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, { value: auth, children });
|
|
137
|
+
};
|
|
138
|
+
var useAuthContext = () => {
|
|
139
|
+
const context = useContext(AuthContext);
|
|
140
|
+
if (!context) {
|
|
141
|
+
throw new Error("useAuthContext must be used within an AuthProvider");
|
|
142
|
+
}
|
|
143
|
+
return context;
|
|
144
|
+
};
|
|
145
|
+
export {
|
|
146
|
+
AuthProvider,
|
|
147
|
+
createClient,
|
|
148
|
+
supabase,
|
|
149
|
+
useAuth,
|
|
150
|
+
useAuthContext,
|
|
151
|
+
useAuthStore
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useAuth.ts","../src/store/authStore.ts","../src/utils/supabase.ts","../src/components/AuthProvider.tsx"],"sourcesContent":["'use client'\r\n\r\nimport { useEffect } from 'react'\r\nimport { useAuthStore } from '../store/authStore'\r\nimport { supabase } from '../utils/supabase'\r\n\r\nexport const useAuth = () => {\r\n const store = useAuthStore()\r\n\r\n useEffect(() => {\r\n // Check active session\r\n supabase.auth.getSession().then(({ data: { session } }) => {\r\n store.updateUser(session?.user ?? null)\r\n store.setLoading(false)\r\n })\r\n\r\n // Listen for auth changes\r\n const {\r\n data: { subscription },\r\n } = supabase.auth.onAuthStateChange((_event, session) => {\r\n store.updateUser(session?.user ?? null)\r\n })\r\n\r\n return () => subscription.unsubscribe()\r\n }, [])\r\n\r\n return store\r\n}","import { create } from 'zustand'\r\nimport { AuthStore } from '../types'\r\nimport { supabase } from '../utils/supabase'\r\n\r\nexport const useAuthStore = create<AuthStore>((set) => ({\r\n user: null,\r\n loading: true,\r\n error: null,\r\n\r\n signIn: async (email: string, password: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signInWithPassword({\r\n email,\r\n password,\r\n })\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n\r\n signUp: async (email: string, password: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signUp({\r\n email,\r\n password,\r\n })\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n\r\n signOut: async () => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signOut()\r\n if (error) throw error\r\n set({ user: null })\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n\r\n resetPassword: async (email: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.resetPasswordForEmail(email)\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n signInWithOAuth: async (provider: string, redirectTo?: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signInWithOAuth({\r\n provider: provider as any,\r\n options: {\r\n redirectTo\r\n }\r\n })\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n\r\n signInWithMagicLink: async (email: string, redirectTo?: string) => {\r\n try {\r\n set({ loading: true, error: null })\r\n const { error } = await supabase.auth.signInWithOtp({\r\n email,\r\n options: {\r\n emailRedirectTo: redirectTo\r\n }\r\n })\r\n if (error) throw error\r\n } catch (error) {\r\n set({ error: error as Error })\r\n } finally {\r\n set({ loading: false })\r\n }\r\n },\r\n updateUser: (user) => set({ user }),\r\n setLoading: (loading) => set({ loading }),\r\n setError: (error) => set({ error }),\r\n}))\r\n\r\n// Example usage in a Next.js app:\r\n/*\r\nimport { AuthForm } from '@digilogiclabs/saas-factory-auth'\r\n\r\nexport default function LoginPage() {\r\n const router = useRouter()\r\n\r\n return (\r\n <AuthForm\r\n defaultMode=\"signIn\"\r\n onSuccess={() => router.push('/dashboard')}\r\n providers={['google', 'github']}\r\n redirectTo=\"https://your-app.com/auth/callback\"\r\n />\r\n )\r\n}\r\n*/","\r\nimport { createClientComponentClient } from '@supabase/auth-helpers-nextjs'\r\nimport type { Database } from './database.types'\r\n\r\nexport const createClient = () => {\r\n if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) {\r\n throw new Error('Missing Supabase environment variables')\r\n }\r\n\r\n return createClientComponentClient<Database>()\r\n}\r\n\r\nexport const supabase = createClient()","'use client'\r\n\r\nimport { createContext, useContext, ReactNode } from 'react'\r\nimport { useAuth } from '../hooks/useAuth'\r\nimport type { AuthStore } from '../types'\r\n\r\nconst AuthContext = createContext<AuthStore | null>(null)\r\n\r\nexport const AuthProvider = ({ children }: { children: ReactNode }) => {\r\n const auth = useAuth()\r\n\r\n return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider>\r\n}\r\n\r\nexport const useAuthContext = () => {\r\n const context = useContext(AuthContext)\r\n if (!context) {\r\n throw new Error('useAuthContext must be used within an AuthProvider')\r\n }\r\n return context\r\n}"],"mappings":";AAEA,SAAS,iBAAiB;;;ACF1B,SAAS,cAAc;;;ACCvB,SAAS,mCAAmC;AAGrC,IAAM,eAAe,MAAM;AAChC,MAAI,CAAC,QAAQ,IAAI,4BAA4B,CAAC,QAAQ,IAAI,+BAA+B;AACvF,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC1D;AAEA,SAAO,4BAAsC;AAC/C;AAEO,IAAM,WAAW,aAAa;;;ADR9B,IAAM,eAAe,OAAkB,CAAC,SAAS;AAAA,EACtD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EAEP,QAAQ,OAAO,OAA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AK;AAAA,IACxB,CAAC;AAGD,UAAM;AAAA,MACJ,MAAM,EAAE,aAAa;AAAA,IACvB,IAAI,SAAS,KAAK,kBAAkB,CAAC,QAAQ,YAAY;AAnB7D;AAoBM,YAAM,YAAW,wCAAS,SAAT,YAAiB,IAAI;AAAA,IACxC,CAAC;AAED,WAAO,MAAM,aAAa,YAAY;AAAA,EACxC,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;;;AGzBA,SAAS,eAAe,kBAA6B;AAS5C;AALT,IAAM,cAAc,cAAgC,IAAI;AAEjD,IAAM,eAAe,CAAC,EAAE,SAAS,MAA+B;AACrE,QAAM,OAAO,QAAQ;AAErB,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,MAAO,UAAS;AACtD;AAEO,IAAM,iBAAiB,MAAM;AAClC,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@digilogiclabs/saas-factory-auth",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "restricted"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.mjs",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": ["dist"],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup --dts",
|
|
21
|
+
"dev": "tsup --watch --dts",
|
|
22
|
+
"clean": "rm -rf dist",
|
|
23
|
+
"type-check": "tsc --noEmit"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@supabase/auth-helpers-nextjs": "^0.8.7",
|
|
27
|
+
"@supabase/supabase-js": "^2.39.3",
|
|
28
|
+
"zustand": "^4.4.7"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"next": ">=13",
|
|
32
|
+
"react": ">=18",
|
|
33
|
+
"react-dom": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/react": "^18.2.48",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
|
38
|
+
"@typescript-eslint/parser": "^6.19.1",
|
|
39
|
+
"eslint": "^8.56.0",
|
|
40
|
+
"tsup": "^8.0.1",
|
|
41
|
+
"typescript": "^5.3.3"
|
|
42
|
+
}
|
|
43
|
+
}
|