@xouteiro/auth_npm 1.0.4 → 1.0.5

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 CHANGED
@@ -2193,6 +2193,7 @@ var index_exports = {};
2193
2193
  __export(index_exports, {
2194
2194
  AuthWrapper: () => AuthWrapper,
2195
2195
  LogoutButton: () => LogoutButton,
2196
+ initializeSupabase: () => initializeSupabase,
2196
2197
  isAdmin: () => isAdmin,
2197
2198
  signInWithEmail: () => signInWithEmail,
2198
2199
  supabase: () => supabase,
@@ -2208,6 +2209,12 @@ var import_auth_ui_shared = require("@supabase/auth-ui-shared");
2208
2209
  // src/supabaseClient.js
2209
2210
  var import_supabase_js = require("@supabase/supabase-js");
2210
2211
  var supabase = null;
2212
+ function initializeSupabase(url, anonKey) {
2213
+ if (!url || !anonKey) {
2214
+ throw new Error("Supabase URL and Anon Key are required to initialize the client.");
2215
+ }
2216
+ supabase = (0, import_supabase_js.createClient)(url, anonKey);
2217
+ }
2211
2218
 
2212
2219
  // src/AuthWrapper.jsx
2213
2220
  function AuthWrapper({ onAuth, providers = ["google", "github"], theme = "dark" }) {
@@ -2292,6 +2299,7 @@ async function signInWithEmail(email, password) {
2292
2299
  0 && (module.exports = {
2293
2300
  AuthWrapper,
2294
2301
  LogoutButton,
2302
+ initializeSupabase,
2295
2303
  isAdmin,
2296
2304
  signInWithEmail,
2297
2305
  supabase,
package/dist/index.mjs CHANGED
@@ -2191,6 +2191,12 @@ import { ThemeSupa } from "@supabase/auth-ui-shared";
2191
2191
  // src/supabaseClient.js
2192
2192
  import { createClient } from "@supabase/supabase-js";
2193
2193
  var supabase = null;
2194
+ function initializeSupabase(url, anonKey) {
2195
+ if (!url || !anonKey) {
2196
+ throw new Error("Supabase URL and Anon Key are required to initialize the client.");
2197
+ }
2198
+ supabase = createClient(url, anonKey);
2199
+ }
2194
2200
 
2195
2201
  // src/AuthWrapper.jsx
2196
2202
  function AuthWrapper({ onAuth, providers = ["google", "github"], theme = "dark" }) {
@@ -2274,6 +2280,7 @@ async function signInWithEmail(email, password) {
2274
2280
  export {
2275
2281
  AuthWrapper,
2276
2282
  LogoutButton,
2283
+ initializeSupabase,
2277
2284
  isAdmin,
2278
2285
  signInWithEmail,
2279
2286
  supabase,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xouteiro/auth_npm",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Authentication package for Supabase",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/index.js CHANGED
@@ -3,4 +3,5 @@ export { default as LogoutButton } from './LogoutButton';
3
3
  export { useAuth } from './useAuth';
4
4
  export { isAdmin } from './utils';
5
5
  export { supabase } from './supabaseClient';
6
- export { signInWithEmail } from './login'; // Add this line
6
+ export { signInWithEmail } from './login'; // Add this line
7
+ export { initializeSupabase } from './supabaseClient';
package/src/login.js CHANGED
@@ -18,4 +18,4 @@ export async function signInWithEmail(email, password) {
18
18
  console.error('Unexpected error during login:', err);
19
19
  return { session: null, error: err };
20
20
  }
21
- }
21
+ }