@fayz-ai/auth 0.12.0 → 0.15.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.
@@ -1 +1 @@
1
- {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/adapters/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,KAAK,EAAE,WAAW,EAAuC,MAAM,eAAe,CAAA;AAGrF;;;mEAGmE;AACnE,eAAO,MAAM,sBAAsB,2BAA2B,CAAA;AAE9D,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAwCD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,WAAW,CAkKjF"}
1
+ {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/adapters/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,KAAK,EAAE,WAAW,EAAuC,MAAM,eAAe,CAAA;AAGrF;;;mEAGmE;AACnE,eAAO,MAAM,sBAAsB,2BAA2B,CAAA;AAE9D,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAwCD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,WAAW,CAgLjF"}
package/dist/context.d.ts CHANGED
@@ -11,6 +11,9 @@ export declare function useAuth(): {
11
11
  isLoading: boolean;
12
12
  isAuthenticated: boolean;
13
13
  error: Error | null;
14
+ pendingVerification: {
15
+ email: string;
16
+ } | null;
14
17
  signIn: (email: string, password: string) => Promise<AuthSession>;
15
18
  signUp: (email: string, password: string, fullName: string) => Promise<AuthSession>;
16
19
  signOut: () => Promise<void>;
@@ -24,5 +27,9 @@ export declare function useAuth(): {
24
27
  redirectTo?: string;
25
28
  data?: Record<string, unknown>;
26
29
  }) => Promise<void>;
30
+ resendConfirmation: (email: string, options?: {
31
+ redirectTo?: string;
32
+ }) => Promise<boolean>;
33
+ clearPendingVerification: () => void;
27
34
  };
28
35
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,IAAI,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAwB5F,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,iBAAiB,qBAiJpE;AAMD,wBAAgB,OAAO;;;;;;oBA5KL,MAAM,YAAY,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC;oBACjD,MAAM,YAAY,MAAM,YAAY,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC;mBACpE,OAAO,CAAC,IAAI,CAAC;gCACA,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC;2BACpC,MAAM,YAAY;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC;+BACvD,MAAM,KAAK,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;2BAC1C,MAAM,KAAK,OAAO,CAAC,WAAW,GAAG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AC,OAAO,CAAC;oCAE1D,IAAI;EAyNrC"}
package/dist/index.js CHANGED
@@ -128,6 +128,16 @@ function createSupabaseAuthAdapter(config) {
128
128
  }
129
129
  return mapSupabaseSession(data.session);
130
130
  },
131
+ async resendConfirmation(email, options) {
132
+ const { error } = await supabase.auth.resend({
133
+ type: "signup",
134
+ email,
135
+ options: {
136
+ emailRedirectTo: options?.redirectTo ?? config.callbackUrl ?? (typeof window !== "undefined" ? window.location.origin : void 0)
137
+ }
138
+ });
139
+ if (error) throw error;
140
+ },
131
141
  async signOut() {
132
142
  const { error } = await supabase.auth.signOut();
133
143
  if (error) throw error;
@@ -319,7 +329,8 @@ var initialState = {
319
329
  session: null,
320
330
  isLoading: true,
321
331
  isAuthenticated: false,
322
- error: null
332
+ error: null,
333
+ pendingVerification: null
323
334
  };
324
335
  var useAuthStore = create((set) => ({
325
336
  ...initialState,
@@ -327,15 +338,19 @@ var useAuthStore = create((set) => ({
327
338
  setSession: (session) => set({
328
339
  session,
329
340
  user: session?.user ?? null,
330
- isAuthenticated: session !== null
341
+ isAuthenticated: session !== null,
342
+ // A real session arriving is the confirmation landing — the notice it
343
+ // would otherwise keep showing is now about an address already verified.
344
+ ...session ? { pendingVerification: null } : {}
331
345
  }),
332
346
  setLoading: (isLoading) => set({ isLoading }),
333
347
  setError: (error) => set({ error }),
348
+ setPendingVerification: (pendingVerification) => set({ pendingVerification }),
334
349
  reset: () => set(initialState)
335
350
  }));
336
351
  var AuthContext = createContext(null);
337
352
  function AuthProvider({ adapter, children }) {
338
- const { setSession, setLoading, setError, reset } = useAuthStore();
353
+ const { setSession, setLoading, setError, setPendingVerification, reset } = useAuthStore();
339
354
  const adapterRef = useRef(adapter);
340
355
  adapterRef.current = adapter;
341
356
  useEffect(() => {
@@ -382,6 +397,10 @@ function AuthProvider({ adapter, children }) {
382
397
  setError(null);
383
398
  try {
384
399
  const session = await adapterRef.current.signUp(email, password, fullName);
400
+ if (!session.accessToken) {
401
+ setPendingVerification({ email });
402
+ return session;
403
+ }
385
404
  setSession(session);
386
405
  return session;
387
406
  } catch (err) {
@@ -455,6 +474,22 @@ function AuthProvider({ adapter, children }) {
455
474
  setError(error);
456
475
  throw error;
457
476
  }
477
+ },
478
+ async resendConfirmation(email, options) {
479
+ setError(null);
480
+ if (!adapterRef.current.resendConfirmation) return false;
481
+ try {
482
+ await adapterRef.current.resendConfirmation(email, options);
483
+ return true;
484
+ } catch (err) {
485
+ const error = err instanceof Error ? err : new Error(String(err));
486
+ setError(error);
487
+ throw error;
488
+ }
489
+ },
490
+ clearPendingVerification() {
491
+ setPendingVerification(null);
492
+ setError(null);
458
493
  }
459
494
  };
460
495
  return /* @__PURE__ */ jsx(AuthContext.Provider, { value, children });
@@ -464,13 +499,14 @@ function useAuth() {
464
499
  if (!ctx) {
465
500
  throw new Error("useAuth must be used inside <AuthProvider>");
466
501
  }
467
- const { user, session, isLoading, isAuthenticated, error } = useAuthStore();
502
+ const { user, session, isLoading, isAuthenticated, error, pendingVerification } = useAuthStore();
468
503
  return {
469
504
  user,
470
505
  session,
471
506
  isLoading,
472
507
  isAuthenticated,
473
508
  error,
509
+ pendingVerification,
474
510
  signIn: ctx.signIn,
475
511
  signUp: ctx.signUp,
476
512
  signOut: ctx.signOut,
@@ -478,7 +514,9 @@ function useAuth() {
478
514
  resetPassword: ctx.resetPassword,
479
515
  updatePassword: ctx.updatePassword,
480
516
  handleCallback: ctx.handleCallback,
481
- inviteUser: ctx.inviteUser
517
+ inviteUser: ctx.inviteUser,
518
+ resendConfirmation: ctx.resendConfirmation,
519
+ clearPendingVerification: ctx.clearPendingVerification
482
520
  };
483
521
  }
484
522
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/url-intent.ts","../src/adapters/supabase.ts","../src/adapters/mock.ts","../src/store.ts","../src/context.tsx"],"names":[],"mappings":";;;;;;;;AA2BO,IAAM,iBAAA,GAAoB;AAIjC,IAAM,UAAA,GAAa,sBAAA;AAQnB,SA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A;AAAA,IAEA,MAAM,UAAA,CAAW,KAAA,EAAO,OAAA,EAAS;AAC/B,MAAA,QAAA,CAAS,IAAI,CAAA;AACb,MAAA,IAAI;AACF,QAAA,MAAM,UAAA,CAAW,OAAA,CAAQ,UAAA,GAAa,KAAA,EAAO,OAAO,CAAA;AAAA,MACtD,SAAS,GAAA,EAAK;AACZ,QAAA,MAAM,KAAA,GAAQ,eAAe,KAAA,GAAQ,GAAA,GAAM,IAAI,KAAA,CAAM,MAAA,CAAO,GAAG,CAAC,CAAA;AAChE,QAAA,QAAA,CAAS,KAAK,CAAA;AACd,QAAA,MAAM,KAAA;AAAA,MACR;AAAA,IACF;AAAA,GACF;AAEA,EAAA,uBAAO,GAAA,CAAC,WAAA,CAAY,QAAA,EAAZ,EAAqB,OAAe,QAAA,EAAS,CAAA;AACvD;AAMO,SAAS,OAAA,GAAU;AACxB,EAAA,MAAM,GAAA,GAAM,WAAW,WAAW,CAAA;AAClC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,MAAM,4CAA4C,CAAA;AAAA,EAC9D;AAEA,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,WAAW,eAAA,EAAiB,KAAA,KAAU,YAAA,EAAa;AAE1E,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,eAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAQ,GAAA,CAAI,MAAA;AAAA,IACZ,QAAQ,GAAA,CAAI,MAAA;AAAA,IACZ,SAAS,GAAA,CAAI,OAAA;AAAA,IACb,iBAAiB,GAAA,CAAI,eAAA;AAAA,IACrB,eAAe,GAAA,CAAI,aAAA;AAAA,IACnB,gBAAgB,GAAA,CAAI,cAAA;AAAA,IACpB,gBAAgB,GAAA,CAAI,cAAA;AAAA,IACpB,YAAY,GAAA,CAAI;AAAA,GAClB;AACF","file":"index.js","sourcesContent":["// ---------------------------------------------------------------------------\n// Auth link intent — what the URL the user just arrived on is asking for.\n//\n// A Supabase recovery / magic link lands on the app with the tokens in the URL\n// FRAGMENT (implicit flow is the supabase-js default), e.g.\n//\n// https://app.example.com/#access_token=…&refresh_token=…&type=recovery\n//\n// GoTrue then consumes that fragment and wipes it (`window.location.hash = ''`)\n// as soon as the client initialises — so by the time React renders, the reason\n// the user is here is gone. Hence the module-load snapshot: this file is\n// imported long before any createClient() call, so it always sees the original\n// URL.\n//\n// Errors arrive the same way, without a `type`:\n//\n// https://app.example.com/#error=access_denied&error_code=otp_expired&…\n// ---------------------------------------------------------------------------\n\nexport type AuthUrlIntent =\n /** A password-recovery link — the user must choose a new password now. */\n | { kind: 'recovery' }\n /** A one-time link that was already used or has expired. */\n | { kind: 'expired'; message?: string }\n\n/** Query param apps can put on their own redirect URLs to force the\n * set-password screen (e.g. when they override `resetPasswordUrl`). */\nexport const AUTH_INTENT_PARAM = 'fayz_auth'\n\n/** Path segment the SDK historically used as the reset-password redirect.\n * Still honoured so apps that configured it keep working. */\nconst RESET_PATH = '/auth/reset-password'\n\ninterface UrlSnapshot {\n pathname: string\n search: string\n hash: string\n}\n\nfunction snapshot(): UrlSnapshot | null {\n if (typeof window === 'undefined') return null\n return {\n pathname: window.location.pathname,\n search: window.location.search,\n hash: window.location.hash,\n }\n}\n\n/** Taken at import time — before any Supabase client can strip the fragment. */\nconst initialUrl: UrlSnapshot | null = snapshot()\n\n/** The fragment can be either auth params (`access_token=…&type=recovery`) or a\n * hash-router path (`#/dashboard`). Only the former parses into pairs. */\nfunction hashParams(hash: string): URLSearchParams {\n const raw = hash.replace(/^#/, '')\n if (!raw || !raw.includes('=')) return new URLSearchParams()\n return new URLSearchParams(raw)\n}\n\nexport function readAuthUrlIntent(url?: UrlSnapshot | null): AuthUrlIntent | null {\n const loc = url ?? initialUrl\n if (!loc) return null\n\n const query = new URLSearchParams(loc.search)\n const hash = hashParams(loc.hash)\n const param = (key: string) => hash.get(key) ?? query.get(key)\n\n const errorCode = param('error_code') ?? param('error')\n const errorDescription = param('error_description')?.replace(/\\+/g, ' ')\n // A dead one-time link (`error_code=otp_expired`). Deliberately narrow: an\n // OAuth `access_denied` is a different failure and must not land here. GoTrue\n // does not echo `type` on error redirects, so recovery and invite links are\n // indistinguishable at this point — the screen offers a fresh link either way.\n if (errorCode && /otp|expired|link/i.test(`${errorCode} ${errorDescription ?? ''}`)) {\n return { kind: 'expired', message: errorDescription ?? undefined }\n }\n\n const marker = query.get(AUTH_INTENT_PARAM)\n const type = param('type')\n if (type === 'recovery' || marker === 'recovery') return { kind: 'recovery' }\n\n // `/auth/reset-password` with no tokens at all: the user opened the reset URL\n // directly, or the tokens were already consumed by a previous page load.\n const path = loc.pathname.replace(/\\/+$/, '')\n if (path.endsWith(RESET_PATH)) return { kind: 'recovery' }\n\n return null\n}\n\n/** Strip auth leftovers from the address bar once the flow is finished, so a\n * reload does not put the user back on the set-password screen (and so the\n * hash router gets a clean slate). */\nexport function clearAuthUrlTokens(): void {\n if (typeof window === 'undefined') return\n const url = new URL(window.location.href)\n url.searchParams.delete(AUTH_INTENT_PARAM)\n if (url.hash.includes('=')) url.hash = ''\n window.history.replaceState(window.history.state, '', url.toString())\n}\n\n/** Add the intent marker to a redirect URL. Absolute or relative; existing\n * params are preserved. */\nexport function withAuthIntent(url: string, intent: 'recovery'): string {\n const base = typeof window === 'undefined' ? 'http://localhost' : window.location.origin\n const parsed = new URL(url, base)\n parsed.searchParams.set(AUTH_INTENT_PARAM, intent)\n return /^https?:\\/\\//i.test(url) ? parsed.toString() : `${parsed.pathname}${parsed.search}${parsed.hash}`\n}\n\n// ---------------------------------------------------------------------------\n// Whether the user owes us a password before they reach the app. Pure, so the\n// decision is testable without a browser; the React wrapper lives in\n// @fayz-ai/plugin-auth (usePasswordSetupGate).\n// ---------------------------------------------------------------------------\n\nexport type PasswordSetupReason = 'recovery' | 'invite'\n\nexport interface PasswordSetupInput {\n intent: AuthUrlIntent | null\n /** Session still resolving — the link's tokens are exchanged asynchronously. */\n isLoading: boolean\n isAuthenticated: boolean\n /** AuthUser.mustSetPassword — an invitee who never chose one. */\n mustSetPassword?: boolean\n}\n\nexport interface PasswordSetupDecision {\n reason: PasswordSetupReason | null\n expired: boolean\n checking: boolean\n}\n\nconst NOTHING: PasswordSetupDecision = { reason: null, expired: false, checking: false }\n\nexport function decidePasswordSetup(input: PasswordSetupInput): PasswordSetupDecision {\n const { intent, isLoading, isAuthenticated, mustSetPassword } = input\n\n if (intent?.kind === 'expired') return { reason: 'recovery', expired: true, checking: false }\n\n if (intent?.kind === 'recovery') {\n if (isLoading) return { reason: 'recovery', expired: false, checking: true }\n // A recovery link with no session behind it was already used or has expired.\n return { reason: 'recovery', expired: !isAuthenticated, checking: false }\n }\n\n if (!isLoading && isAuthenticated && mustSetPassword) {\n return { reason: 'invite', expired: false, checking: false }\n }\n\n return NOTHING\n}\n","import { createClient, type SupabaseClient } from '@supabase/supabase-js'\nimport type { AuthAdapter, AuthUser, AuthSession, AuthProvider } from '@fayz-ai/core'\nimport { withAuthIntent } from '../lib/url-intent'\n\n/** Metadata flag stamped on invited users (created by a magic link, so they have\n * no password yet) and cleared the moment they choose one. Metadata, not a URL\n * param: it survives the link being opened later, in another browser, or twice —\n * and it needs no new entry in Supabase's redirect allow-list. */\nexport const MUST_SET_PASSWORD_FLAG = 'fayz_must_set_password'\n\nexport interface SupabaseAuthConfig {\n supabaseUrl: string\n supabaseAnonKey: string\n supabaseClient?: SupabaseClient\n callbackUrl?: string\n resetPasswordUrl?: string\n}\n\nfunction mapSupabaseUser(supabaseUser: {\n id: string\n email?: string | null\n created_at?: string\n updated_at?: string | null\n email_confirmed_at?: string | null\n user_metadata?: Record<string, unknown>\n app_metadata?: { providers?: string[]; provider?: string }\n}): AuthUser {\n return {\n id: supabaseUser.id,\n email: supabaseUser.email ?? '',\n fullName:\n (supabaseUser.user_metadata?.['full_name'] as string | undefined) ??\n (supabaseUser.user_metadata?.['name'] as string | undefined) ??\n '',\n avatarUrl: supabaseUser.user_metadata?.['avatar_url'] as string | undefined,\n mustSetPassword: supabaseUser.user_metadata?.[MUST_SET_PASSWORD_FLAG] === true,\n }\n}\n\nfunction mapSupabaseSession(session: {\n access_token: string\n refresh_token?: string\n expires_at?: number\n expires_in?: number\n user: Parameters<typeof mapSupabaseUser>[0]\n}): AuthSession {\n return {\n accessToken: session.access_token,\n refreshToken: session.refresh_token,\n expiresAt:\n session.expires_at ??\n Math.floor(Date.now() / 1000) + (session.expires_in ?? 3600),\n user: mapSupabaseUser(session.user),\n }\n}\n\nexport function createSupabaseAuthAdapter(config: SupabaseAuthConfig): AuthAdapter {\n const supabase = config.supabaseClient ?? createClient(config.supabaseUrl, config.supabaseAnonKey)\n\n return {\n async getSession() {\n const {\n data: { session },\n } = await supabase.auth.getSession()\n if (!session) return null\n const mapped = mapSupabaseSession(session)\n return { user: mapped.user, session: mapped }\n },\n\n onAuthStateChange(cb) {\n const {\n data: { subscription },\n } = supabase.auth.onAuthStateChange((_event, session) => {\n cb(session ? mapSupabaseUser(session.user) : null)\n })\n return () => subscription.unsubscribe()\n },\n\n async signIn(email, password) {\n const { data, error } = await supabase.auth.signInWithPassword({ email, password })\n if (error) throw error\n return mapSupabaseSession(data.session)\n },\n\n async signUp(email, password, fullName) {\n const { data, error } = await supabase.auth.signUp({\n email,\n password,\n options: { data: { full_name: fullName } },\n })\n if (error) throw error\n\n // When email confirmation is required, session is null\n if (!data.session) {\n if (!data.user) throw new Error('Signup failed: no user returned')\n return {\n accessToken: '',\n refreshToken: '',\n expiresAt: 0,\n user: mapSupabaseUser(data.user),\n }\n }\n\n return mapSupabaseSession(data.session)\n },\n\n async signOut() {\n const { error } = await supabase.auth.signOut()\n if (error) throw error\n },\n\n async signInWithOAuth(provider: AuthProvider) {\n const { error } = await supabase.auth.signInWithOAuth({\n provider: provider as 'google' | 'github' | 'apple',\n options: {\n redirectTo:\n config.callbackUrl ??\n (typeof window !== 'undefined' ? `${window.location.origin}/auth/callback` : undefined),\n },\n })\n if (error) throw error\n },\n\n async resetPassword(email, options) {\n // Root, not `/auth/reset-password`: the shell recognises a recovery link by\n // the link's own `type=recovery` param, so the flow needs no route of its\n // own — and the app root is the one URL every deployment already serves and\n // every Supabase project already allow-lists (a URL outside the allow-list\n // is silently swapped for the project's Site URL, i.e. another app).\n // A host that DOES point recovery somewhere else gets the explicit intent\n // marker, since we cannot assume its landing page carries the params.\n const explicit = options?.redirectTo ?? config.resetPasswordUrl\n const { error } = await supabase.auth.resetPasswordForEmail(email, {\n redirectTo: explicit\n ? withAuthIntent(explicit, 'recovery')\n : typeof window !== 'undefined'\n ? `${window.location.origin}/`\n : undefined,\n })\n if (error) throw error\n },\n\n async updatePassword(password) {\n // Clearing the flag in the same call as the password: one round-trip, and\n // no window where the password is set but the screen still demands one.\n const { data, error } = await supabase.auth.updateUser({\n password,\n data: { [MUST_SET_PASSWORD_FLAG]: false },\n })\n if (error) throw error\n const {\n data: { session },\n } = await supabase.auth.getSession()\n if (session) return mapSupabaseSession(session)\n if (!data.user) return undefined\n return {\n accessToken: '',\n refreshToken: '',\n expiresAt: 0,\n user: mapSupabaseUser(data.user),\n }\n },\n\n async handleCallback(url) {\n const target = url ?? (typeof window !== 'undefined' ? window.location.href : '')\n const parsed = new URL(target)\n // The fragment carries the params on the implicit flow; the query on PKCE\n // and on `{{ .TokenHash }}`-style e-mail templates.\n const fragment = new URLSearchParams(parsed.hash.replace(/^#/, ''))\n const param = (key: string) => parsed.searchParams.get(key) ?? fragment.get(key)\n\n const code = param('code')\n if (code) {\n const { data, error } = await supabase.auth.exchangeCodeForSession(code)\n if (error) throw error\n return data.session ? mapSupabaseSession(data.session) : null\n }\n\n // Templates that link straight at the app with a token instead of routing\n // through GoTrue's /verify never produce a session on their own.\n const tokenHash = param('token_hash') ?? param('token')\n const type = param('type')\n if (tokenHash && type) {\n const { data, error } = await supabase.auth.verifyOtp({\n token_hash: tokenHash,\n type: type as 'recovery' | 'invite' | 'magiclink' | 'signup' | 'email',\n })\n if (error) throw error\n return data.session ? mapSupabaseSession(data.session) : null\n }\n\n const {\n data: { session },\n } = await supabase.auth.getSession()\n return session ? mapSupabaseSession(session) : null\n },\n\n async inviteUser(email, options) {\n // Native, edge-function-free invite: a passwordless magic link. Sends the\n // e-mail + creates the auth user (anon-callable, no service-role/admin).\n // Membership is NOT granted from `data` (a client could forge it) — the\n // accept-time trigger trusts the RLS-protected public.invitations row.\n const { error } = await supabase.auth.signInWithOtp({\n email,\n options: {\n shouldCreateUser: true,\n emailRedirectTo:\n options?.redirectTo ??\n (typeof window !== 'undefined' ? `${window.location.origin}/` : undefined),\n // `data` only lands on users the OTP actually creates, which is exactly\n // who needs a password: the shell holds them on the set-password screen\n // until they choose one, so they can sign in normally from then on.\n data: { ...options?.data, [MUST_SET_PASSWORD_FLAG]: true },\n },\n })\n if (error) throw error\n },\n }\n}\n","import type { AuthAdapter, AuthUser, AuthSession } from '@fayz-ai/core'\n\nexport interface MockUser {\n id: string\n email: string\n fullName: string\n role?: string\n}\n\nconst DEFAULT_MOCK_USER: MockUser = {\n id: 'mock-user-id',\n email: 'demo@fayz.dev',\n fullName: 'Demo User',\n role: 'admin',\n}\n\nconst STORAGE_KEY = 'fayz:mock-auth'\n\nfunction toAuthUser(mockUser: MockUser): AuthUser {\n return {\n id: mockUser.id,\n email: mockUser.email,\n fullName: mockUser.fullName,\n }\n}\n\nfunction createMockSession(user: AuthUser): AuthSession {\n return {\n accessToken: `mock-token-${user.id}`,\n refreshToken: `mock-refresh-${user.id}`,\n expiresAt: Math.floor(Date.now() / 1000) + 3600,\n user,\n }\n}\n\nfunction getStored(): { user: AuthUser; session: AuthSession } | null {\n try {\n if (typeof localStorage === 'undefined') return null\n const raw = localStorage.getItem(STORAGE_KEY)\n if (!raw) return null\n return JSON.parse(raw) as { user: AuthUser; session: AuthSession }\n } catch {\n return null\n }\n}\n\nfunction setStored(data: { user: AuthUser; session: AuthSession } | null): void {\n try {\n if (typeof localStorage === 'undefined') return\n if (data) {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(data))\n } else {\n localStorage.removeItem(STORAGE_KEY)\n }\n } catch {\n // SSR or storage unavailable — silently skip\n }\n}\n\nexport function createMockAuthAdapter(mockUser: MockUser = DEFAULT_MOCK_USER): AuthAdapter {\n const listeners = new Set<(user: AuthUser | null) => void>()\n\n function notifyListeners(user: AuthUser | null): void {\n for (const cb of listeners) cb(user)\n }\n\n return {\n async getSession() {\n return getStored()\n },\n\n onAuthStateChange(cb) {\n listeners.add(cb)\n return () => {\n listeners.delete(cb)\n }\n },\n\n async signIn(email, _password) {\n // Mock accepts any credentials, but the identity FOLLOWS the email —\n // storefront customers and saas users keep their own purchase/session\n // history instead of all becoming the configured demo user.\n const stored = getStored()\n const user: AuthUser =\n stored && stored.user.email === email\n ? stored.user\n : {\n id: email === mockUser.email ? mockUser.id : `mock-${email}`,\n email,\n fullName: email === mockUser.email ? mockUser.fullName : (email.split('@')[0] ?? 'Cliente'),\n }\n const session = createMockSession(user)\n setStored({ user, session })\n notifyListeners(user)\n return session\n },\n\n async signUp(email, _password, fullName) {\n // Mock signup creates a user from the provided details\n const user: AuthUser = {\n id: `mock-${email}`,\n email,\n fullName: fullName || (email.split('@')[0] ?? 'Cliente'),\n }\n const session = createMockSession(user)\n setStored({ user, session })\n notifyListeners(user)\n return session\n },\n\n async signOut() {\n setStored(null)\n notifyListeners(null)\n },\n\n async signInWithOAuth(_provider) {\n // Mock OAuth signs in as the configured user\n const user = toAuthUser(mockUser)\n const session = createMockSession(user)\n setStored({ user, session })\n notifyListeners(user)\n },\n\n async resetPassword(_email) {\n // No-op in mock\n },\n\n async updatePassword(_password) {\n const stored = getStored()\n return stored?.session\n },\n\n async handleCallback() {\n return getStored()?.session ?? null\n },\n\n async inviteUser(_email, _options) {\n // No admin path in mock — the org mock adapter still records the pending\n // invite so the Team UI shows it. Delivery is a no-op locally.\n },\n }\n}\n","import { create } from 'zustand'\nimport type { AuthUser, AuthSession } from '@fayz-ai/core'\n\nexport interface AuthState {\n user: AuthUser | null\n session: AuthSession | null\n isLoading: boolean\n isAuthenticated: boolean\n error: Error | null\n}\n\nexport interface AuthStore extends AuthState {\n setUser: (user: AuthUser | null) => void\n setSession: (session: AuthSession | null) => void\n setLoading: (isLoading: boolean) => void\n setError: (error: Error | null) => void\n reset: () => void\n}\n\nconst initialState: AuthState = {\n user: null,\n session: null,\n isLoading: true,\n isAuthenticated: false,\n error: null,\n}\n\nexport const useAuthStore = create<AuthStore>((set) => ({\n ...initialState,\n\n setUser: (user) =>\n set({ user, isAuthenticated: user !== null }),\n\n setSession: (session) =>\n set({\n session,\n user: session?.user ?? null,\n isAuthenticated: session !== null,\n }),\n\n setLoading: (isLoading) => set({ isLoading }),\n\n setError: (error) => set({ error }),\n\n reset: () => set(initialState),\n}))\n","import React, { createContext, useContext, useEffect, useRef } from 'react'\nimport type { AuthAdapter, AuthProvider as OAuthProvider, AuthSession } from '@fayz-ai/core'\nimport { useAuthStore } from './store'\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface AuthContextValue {\n signIn: (email: string, password: string) => Promise<AuthSession>\n signUp: (email: string, password: string, fullName: string) => Promise<AuthSession>\n signOut: () => Promise<void>\n signInWithOAuth: (provider: OAuthProvider) => Promise<void>\n resetPassword: (email: string, options?: { redirectTo?: string }) => Promise<void>\n updatePassword: (password: string) => Promise<AuthSession | void>\n handleCallback: (url?: string) => Promise<AuthSession | null>\n inviteUser: (email: string, options?: { redirectTo?: string; data?: Record<string, unknown> }) => Promise<void>\n}\n\nconst AuthContext = createContext<AuthContextValue | null>(null)\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport interface AuthProviderProps {\n adapter: AuthAdapter\n children: React.ReactNode\n}\n\nexport function AuthProvider({ adapter, children }: AuthProviderProps) {\n const { setSession, setLoading, setError, reset } = useAuthStore()\n\n // Keep a stable ref to the adapter so the effect only runs once on mount\n const adapterRef = useRef(adapter)\n adapterRef.current = adapter\n\n useEffect(() => {\n let unsubscribe: (() => void) | undefined\n\n async function init() {\n try {\n setLoading(true)\n const result = await adapterRef.current.getSession()\n setSession(result?.session ?? null)\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)))\n } finally {\n setLoading(false)\n }\n\n // Subscribe to future auth state changes\n unsubscribe = adapterRef.current.onAuthStateChange((user) => {\n if (!user) {\n reset()\n // Keep isLoading false after an explicit sign-out\n setLoading(false)\n return\n }\n // Positive change (adapter-driven sign-in — e.g. an external callback,\n // another tab, or a direct adapter.signUp bridge) — sync the session so\n // consumers reflect it even when the call didn't go through ctx.signIn.\n void adapterRef.current.getSession().then((result) => setSession(result?.session ?? null)).catch(() => {})\n })\n }\n\n void init()\n\n return () => {\n unsubscribe?.()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const value: AuthContextValue = {\n async signIn(email, password) {\n setError(null)\n try {\n const session = await adapterRef.current.signIn(email, password)\n setSession(session)\n return session\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async signUp(email, password, fullName) {\n setError(null)\n try {\n const session = await adapterRef.current.signUp(email, password, fullName)\n setSession(session)\n return session\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async signOut() {\n setError(null)\n try {\n await adapterRef.current.signOut()\n reset()\n setLoading(false)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async signInWithOAuth(provider) {\n setError(null)\n try {\n await adapterRef.current.signInWithOAuth(provider)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async resetPassword(email, options) {\n setError(null)\n try {\n await adapterRef.current.resetPassword(email, options)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async updatePassword(password) {\n setError(null)\n try {\n const session = await adapterRef.current.updatePassword?.(password)\n if (session) setSession(session)\n return session\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async handleCallback(url) {\n setError(null)\n try {\n const session = await adapterRef.current.handleCallback?.(url) ?? null\n if (session) setSession(session)\n return session\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async inviteUser(email, options) {\n setError(null)\n try {\n await adapterRef.current.inviteUser?.(email, options)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n }\n\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\nexport function useAuth() {\n const ctx = useContext(AuthContext)\n if (!ctx) {\n throw new Error('useAuth must be used inside <AuthProvider>')\n }\n\n const { user, session, isLoading, isAuthenticated, error } = useAuthStore()\n\n return {\n user,\n session,\n isLoading,\n isAuthenticated,\n error,\n signIn: ctx.signIn,\n signUp: ctx.signUp,\n signOut: ctx.signOut,\n signInWithOAuth: ctx.signInWithOAuth,\n resetPassword: ctx.resetPassword,\n updatePassword: ctx.updatePassword,\n handleCallback: ctx.handleCallback,\n inviteUser: ctx.inviteUser,\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/url-intent.ts","../src/adapters/supabase.ts","../src/adapters/mock.ts","../src/store.ts","../src/context.tsx"],"names":[],"mappings":";;;;;;;;AA2BO,IAAM,iBAAA,GAAoB;AAIjC,IAAM,UAAA,GAAa,sBAAA;AAQnB,SAAS,QAAA,GAA+B;AACtC,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,IAAA;AAC1C,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,OAAO,QAAA,CAAS,QAAA;AAAA,IAC1B,MAAA,EAAQ,OAAO,QAAA,CAAS,MAAA;AAAA,IACxB,IAAA,EAAM,OAAO,QAAA,CAAS;AAAA,GACxB;AACF;AAGA,IAAM,aAAiC,QAAA,EAAS;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AAA,GAAQ,GAAA,GAAM,IAAI,KAAA,CAAM,MAAA,CAAO,GAAG,CAAC,CAAA;AAChE,QAAA,QAAA,CAAS,KAAK,CAAA;AACd,QAAA,MAAM,KAAA;AAAA,MACR;AAAA,IACF,CAAA;AAAA,IAEA,wBAAA,GAA2B;AACzB,MAAA,sBAAA,CAAuB,IAAI,CAAA;AAC3B,MAAA,QAAA,CAAS,IAAI,CAAA;AAAA,IACf;AAAA,GACF;AAEA,EAAA,uBAAO,GAAA,CAAC,WAAA,CAAY,QAAA,EAAZ,EAAqB,OAAe,QAAA,EAAS,CAAA;AACvD;AAMO,SAAS,OAAA,GAAU;AACxB,EAAA,MAAM,GAAA,GAAM,WAAW,WAAW,CAAA;AAClC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,MAAM,4CAA4C,CAAA;AAAA,EAC9D;AAEA,EAAA,MAAM,EAAE,MAAM,OAAA,EAAS,SAAA,EAAW,iBAAiB,KAAA,EAAO,mBAAA,KAAwB,YAAA,EAAa;AAE/F,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,eAAA;AAAA,IACA,KAAA;AAAA,IACA,mBAAA;AAAA,IACA,QAAQ,GAAA,CAAI,MAAA;AAAA,IACZ,QAAQ,GAAA,CAAI,MAAA;AAAA,IACZ,SAAS,GAAA,CAAI,OAAA;AAAA,IACb,iBAAiB,GAAA,CAAI,eAAA;AAAA,IACrB,eAAe,GAAA,CAAI,aAAA;AAAA,IACnB,gBAAgB,GAAA,CAAI,cAAA;AAAA,IACpB,gBAAgB,GAAA,CAAI,cAAA;AAAA,IACpB,YAAY,GAAA,CAAI,UAAA;AAAA,IAChB,oBAAoB,GAAA,CAAI,kBAAA;AAAA,IACxB,0BAA0B,GAAA,CAAI;AAAA,GAChC;AACF","file":"index.js","sourcesContent":["// ---------------------------------------------------------------------------\n// Auth link intent — what the URL the user just arrived on is asking for.\n//\n// A Supabase recovery / magic link lands on the app with the tokens in the URL\n// FRAGMENT (implicit flow is the supabase-js default), e.g.\n//\n// https://app.example.com/#access_token=…&refresh_token=…&type=recovery\n//\n// GoTrue then consumes that fragment and wipes it (`window.location.hash = ''`)\n// as soon as the client initialises — so by the time React renders, the reason\n// the user is here is gone. Hence the module-load snapshot: this file is\n// imported long before any createClient() call, so it always sees the original\n// URL.\n//\n// Errors arrive the same way, without a `type`:\n//\n// https://app.example.com/#error=access_denied&error_code=otp_expired&…\n// ---------------------------------------------------------------------------\n\nexport type AuthUrlIntent =\n /** A password-recovery link — the user must choose a new password now. */\n | { kind: 'recovery' }\n /** A one-time link that was already used or has expired. */\n | { kind: 'expired'; message?: string }\n\n/** Query param apps can put on their own redirect URLs to force the\n * set-password screen (e.g. when they override `resetPasswordUrl`). */\nexport const AUTH_INTENT_PARAM = 'fayz_auth'\n\n/** Path segment the SDK historically used as the reset-password redirect.\n * Still honoured so apps that configured it keep working. */\nconst RESET_PATH = '/auth/reset-password'\n\ninterface UrlSnapshot {\n pathname: string\n search: string\n hash: string\n}\n\nfunction snapshot(): UrlSnapshot | null {\n if (typeof window === 'undefined') return null\n return {\n pathname: window.location.pathname,\n search: window.location.search,\n hash: window.location.hash,\n }\n}\n\n/** Taken at import time — before any Supabase client can strip the fragment. */\nconst initialUrl: UrlSnapshot | null = snapshot()\n\n/** The fragment can be either auth params (`access_token=…&type=recovery`) or a\n * hash-router path (`#/dashboard`). Only the former parses into pairs. */\nfunction hashParams(hash: string): URLSearchParams {\n const raw = hash.replace(/^#/, '')\n if (!raw || !raw.includes('=')) return new URLSearchParams()\n return new URLSearchParams(raw)\n}\n\nexport function readAuthUrlIntent(url?: UrlSnapshot | null): AuthUrlIntent | null {\n const loc = url ?? initialUrl\n if (!loc) return null\n\n const query = new URLSearchParams(loc.search)\n const hash = hashParams(loc.hash)\n const param = (key: string) => hash.get(key) ?? query.get(key)\n\n const errorCode = param('error_code') ?? param('error')\n const errorDescription = param('error_description')?.replace(/\\+/g, ' ')\n // A dead one-time link (`error_code=otp_expired`). Deliberately narrow: an\n // OAuth `access_denied` is a different failure and must not land here. GoTrue\n // does not echo `type` on error redirects, so recovery and invite links are\n // indistinguishable at this point — the screen offers a fresh link either way.\n if (errorCode && /otp|expired|link/i.test(`${errorCode} ${errorDescription ?? ''}`)) {\n return { kind: 'expired', message: errorDescription ?? undefined }\n }\n\n const marker = query.get(AUTH_INTENT_PARAM)\n const type = param('type')\n if (type === 'recovery' || marker === 'recovery') return { kind: 'recovery' }\n\n // `/auth/reset-password` with no tokens at all: the user opened the reset URL\n // directly, or the tokens were already consumed by a previous page load.\n const path = loc.pathname.replace(/\\/+$/, '')\n if (path.endsWith(RESET_PATH)) return { kind: 'recovery' }\n\n return null\n}\n\n/** Strip auth leftovers from the address bar once the flow is finished, so a\n * reload does not put the user back on the set-password screen (and so the\n * hash router gets a clean slate). */\nexport function clearAuthUrlTokens(): void {\n if (typeof window === 'undefined') return\n const url = new URL(window.location.href)\n url.searchParams.delete(AUTH_INTENT_PARAM)\n if (url.hash.includes('=')) url.hash = ''\n window.history.replaceState(window.history.state, '', url.toString())\n}\n\n/** Add the intent marker to a redirect URL. Absolute or relative; existing\n * params are preserved. */\nexport function withAuthIntent(url: string, intent: 'recovery'): string {\n const base = typeof window === 'undefined' ? 'http://localhost' : window.location.origin\n const parsed = new URL(url, base)\n parsed.searchParams.set(AUTH_INTENT_PARAM, intent)\n return /^https?:\\/\\//i.test(url) ? parsed.toString() : `${parsed.pathname}${parsed.search}${parsed.hash}`\n}\n\n// ---------------------------------------------------------------------------\n// Whether the user owes us a password before they reach the app. Pure, so the\n// decision is testable without a browser; the React wrapper lives in\n// @fayz-ai/plugin-auth (usePasswordSetupGate).\n// ---------------------------------------------------------------------------\n\nexport type PasswordSetupReason = 'recovery' | 'invite'\n\nexport interface PasswordSetupInput {\n intent: AuthUrlIntent | null\n /** Session still resolving — the link's tokens are exchanged asynchronously. */\n isLoading: boolean\n isAuthenticated: boolean\n /** AuthUser.mustSetPassword — an invitee who never chose one. */\n mustSetPassword?: boolean\n}\n\nexport interface PasswordSetupDecision {\n reason: PasswordSetupReason | null\n expired: boolean\n checking: boolean\n}\n\nconst NOTHING: PasswordSetupDecision = { reason: null, expired: false, checking: false }\n\nexport function decidePasswordSetup(input: PasswordSetupInput): PasswordSetupDecision {\n const { intent, isLoading, isAuthenticated, mustSetPassword } = input\n\n if (intent?.kind === 'expired') return { reason: 'recovery', expired: true, checking: false }\n\n if (intent?.kind === 'recovery') {\n if (isLoading) return { reason: 'recovery', expired: false, checking: true }\n // A recovery link with no session behind it was already used or has expired.\n return { reason: 'recovery', expired: !isAuthenticated, checking: false }\n }\n\n if (!isLoading && isAuthenticated && mustSetPassword) {\n return { reason: 'invite', expired: false, checking: false }\n }\n\n return NOTHING\n}\n","import { createClient, type SupabaseClient } from '@supabase/supabase-js'\nimport type { AuthAdapter, AuthUser, AuthSession, AuthProvider } from '@fayz-ai/core'\nimport { withAuthIntent } from '../lib/url-intent'\n\n/** Metadata flag stamped on invited users (created by a magic link, so they have\n * no password yet) and cleared the moment they choose one. Metadata, not a URL\n * param: it survives the link being opened later, in another browser, or twice —\n * and it needs no new entry in Supabase's redirect allow-list. */\nexport const MUST_SET_PASSWORD_FLAG = 'fayz_must_set_password'\n\nexport interface SupabaseAuthConfig {\n supabaseUrl: string\n supabaseAnonKey: string\n supabaseClient?: SupabaseClient\n callbackUrl?: string\n resetPasswordUrl?: string\n}\n\nfunction mapSupabaseUser(supabaseUser: {\n id: string\n email?: string | null\n created_at?: string\n updated_at?: string | null\n email_confirmed_at?: string | null\n user_metadata?: Record<string, unknown>\n app_metadata?: { providers?: string[]; provider?: string }\n}): AuthUser {\n return {\n id: supabaseUser.id,\n email: supabaseUser.email ?? '',\n fullName:\n (supabaseUser.user_metadata?.['full_name'] as string | undefined) ??\n (supabaseUser.user_metadata?.['name'] as string | undefined) ??\n '',\n avatarUrl: supabaseUser.user_metadata?.['avatar_url'] as string | undefined,\n mustSetPassword: supabaseUser.user_metadata?.[MUST_SET_PASSWORD_FLAG] === true,\n }\n}\n\nfunction mapSupabaseSession(session: {\n access_token: string\n refresh_token?: string\n expires_at?: number\n expires_in?: number\n user: Parameters<typeof mapSupabaseUser>[0]\n}): AuthSession {\n return {\n accessToken: session.access_token,\n refreshToken: session.refresh_token,\n expiresAt:\n session.expires_at ??\n Math.floor(Date.now() / 1000) + (session.expires_in ?? 3600),\n user: mapSupabaseUser(session.user),\n }\n}\n\nexport function createSupabaseAuthAdapter(config: SupabaseAuthConfig): AuthAdapter {\n const supabase = config.supabaseClient ?? createClient(config.supabaseUrl, config.supabaseAnonKey)\n\n return {\n async getSession() {\n const {\n data: { session },\n } = await supabase.auth.getSession()\n if (!session) return null\n const mapped = mapSupabaseSession(session)\n return { user: mapped.user, session: mapped }\n },\n\n onAuthStateChange(cb) {\n const {\n data: { subscription },\n } = supabase.auth.onAuthStateChange((_event, session) => {\n cb(session ? mapSupabaseUser(session.user) : null)\n })\n return () => subscription.unsubscribe()\n },\n\n async signIn(email, password) {\n const { data, error } = await supabase.auth.signInWithPassword({ email, password })\n if (error) throw error\n return mapSupabaseSession(data.session)\n },\n\n async signUp(email, password, fullName) {\n const { data, error } = await supabase.auth.signUp({\n email,\n password,\n options: { data: { full_name: fullName } },\n })\n if (error) throw error\n\n // When email confirmation is required, session is null\n if (!data.session) {\n if (!data.user) throw new Error('Signup failed: no user returned')\n return {\n accessToken: '',\n refreshToken: '',\n expiresAt: 0,\n user: mapSupabaseUser(data.user),\n }\n }\n\n return mapSupabaseSession(data.session)\n },\n\n async resendConfirmation(email: string, options?: { redirectTo?: string }) {\n const { error } = await supabase.auth.resend({\n type: 'signup',\n email,\n options: {\n emailRedirectTo:\n options?.redirectTo ??\n config.callbackUrl ??\n (typeof window !== 'undefined' ? window.location.origin : undefined),\n },\n })\n if (error) throw error\n },\n\n async signOut() {\n const { error } = await supabase.auth.signOut()\n if (error) throw error\n },\n\n async signInWithOAuth(provider: AuthProvider) {\n const { error } = await supabase.auth.signInWithOAuth({\n provider: provider as 'google' | 'github' | 'apple',\n options: {\n redirectTo:\n config.callbackUrl ??\n (typeof window !== 'undefined' ? `${window.location.origin}/auth/callback` : undefined),\n },\n })\n if (error) throw error\n },\n\n async resetPassword(email, options) {\n // Root, not `/auth/reset-password`: the shell recognises a recovery link by\n // the link's own `type=recovery` param, so the flow needs no route of its\n // own — and the app root is the one URL every deployment already serves and\n // every Supabase project already allow-lists (a URL outside the allow-list\n // is silently swapped for the project's Site URL, i.e. another app).\n // A host that DOES point recovery somewhere else gets the explicit intent\n // marker, since we cannot assume its landing page carries the params.\n const explicit = options?.redirectTo ?? config.resetPasswordUrl\n const { error } = await supabase.auth.resetPasswordForEmail(email, {\n redirectTo: explicit\n ? withAuthIntent(explicit, 'recovery')\n : typeof window !== 'undefined'\n ? `${window.location.origin}/`\n : undefined,\n })\n if (error) throw error\n },\n\n async updatePassword(password) {\n // Clearing the flag in the same call as the password: one round-trip, and\n // no window where the password is set but the screen still demands one.\n const { data, error } = await supabase.auth.updateUser({\n password,\n data: { [MUST_SET_PASSWORD_FLAG]: false },\n })\n if (error) throw error\n const {\n data: { session },\n } = await supabase.auth.getSession()\n if (session) return mapSupabaseSession(session)\n if (!data.user) return undefined\n return {\n accessToken: '',\n refreshToken: '',\n expiresAt: 0,\n user: mapSupabaseUser(data.user),\n }\n },\n\n async handleCallback(url) {\n const target = url ?? (typeof window !== 'undefined' ? window.location.href : '')\n const parsed = new URL(target)\n // The fragment carries the params on the implicit flow; the query on PKCE\n // and on `{{ .TokenHash }}`-style e-mail templates.\n const fragment = new URLSearchParams(parsed.hash.replace(/^#/, ''))\n const param = (key: string) => parsed.searchParams.get(key) ?? fragment.get(key)\n\n const code = param('code')\n if (code) {\n const { data, error } = await supabase.auth.exchangeCodeForSession(code)\n if (error) throw error\n return data.session ? mapSupabaseSession(data.session) : null\n }\n\n // Templates that link straight at the app with a token instead of routing\n // through GoTrue's /verify never produce a session on their own.\n const tokenHash = param('token_hash') ?? param('token')\n const type = param('type')\n if (tokenHash && type) {\n const { data, error } = await supabase.auth.verifyOtp({\n token_hash: tokenHash,\n type: type as 'recovery' | 'invite' | 'magiclink' | 'signup' | 'email',\n })\n if (error) throw error\n return data.session ? mapSupabaseSession(data.session) : null\n }\n\n const {\n data: { session },\n } = await supabase.auth.getSession()\n return session ? mapSupabaseSession(session) : null\n },\n\n async inviteUser(email, options) {\n // Native, edge-function-free invite: a passwordless magic link. Sends the\n // e-mail + creates the auth user (anon-callable, no service-role/admin).\n // Membership is NOT granted from `data` (a client could forge it) — the\n // accept-time trigger trusts the RLS-protected public.invitations row.\n const { error } = await supabase.auth.signInWithOtp({\n email,\n options: {\n shouldCreateUser: true,\n emailRedirectTo:\n options?.redirectTo ??\n (typeof window !== 'undefined' ? `${window.location.origin}/` : undefined),\n // `data` only lands on users the OTP actually creates, which is exactly\n // who needs a password: the shell holds them on the set-password screen\n // until they choose one, so they can sign in normally from then on.\n data: { ...options?.data, [MUST_SET_PASSWORD_FLAG]: true },\n },\n })\n if (error) throw error\n },\n }\n}\n","import type { AuthAdapter, AuthUser, AuthSession } from '@fayz-ai/core'\n\nexport interface MockUser {\n id: string\n email: string\n fullName: string\n role?: string\n}\n\nconst DEFAULT_MOCK_USER: MockUser = {\n id: 'mock-user-id',\n email: 'demo@fayz.dev',\n fullName: 'Demo User',\n role: 'admin',\n}\n\nconst STORAGE_KEY = 'fayz:mock-auth'\n\nfunction toAuthUser(mockUser: MockUser): AuthUser {\n return {\n id: mockUser.id,\n email: mockUser.email,\n fullName: mockUser.fullName,\n }\n}\n\nfunction createMockSession(user: AuthUser): AuthSession {\n return {\n accessToken: `mock-token-${user.id}`,\n refreshToken: `mock-refresh-${user.id}`,\n expiresAt: Math.floor(Date.now() / 1000) + 3600,\n user,\n }\n}\n\nfunction getStored(): { user: AuthUser; session: AuthSession } | null {\n try {\n if (typeof localStorage === 'undefined') return null\n const raw = localStorage.getItem(STORAGE_KEY)\n if (!raw) return null\n return JSON.parse(raw) as { user: AuthUser; session: AuthSession }\n } catch {\n return null\n }\n}\n\nfunction setStored(data: { user: AuthUser; session: AuthSession } | null): void {\n try {\n if (typeof localStorage === 'undefined') return\n if (data) {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(data))\n } else {\n localStorage.removeItem(STORAGE_KEY)\n }\n } catch {\n // SSR or storage unavailable — silently skip\n }\n}\n\nexport function createMockAuthAdapter(mockUser: MockUser = DEFAULT_MOCK_USER): AuthAdapter {\n const listeners = new Set<(user: AuthUser | null) => void>()\n\n function notifyListeners(user: AuthUser | null): void {\n for (const cb of listeners) cb(user)\n }\n\n return {\n async getSession() {\n return getStored()\n },\n\n onAuthStateChange(cb) {\n listeners.add(cb)\n return () => {\n listeners.delete(cb)\n }\n },\n\n async signIn(email, _password) {\n // Mock accepts any credentials, but the identity FOLLOWS the email —\n // storefront customers and saas users keep their own purchase/session\n // history instead of all becoming the configured demo user.\n const stored = getStored()\n const user: AuthUser =\n stored && stored.user.email === email\n ? stored.user\n : {\n id: email === mockUser.email ? mockUser.id : `mock-${email}`,\n email,\n fullName: email === mockUser.email ? mockUser.fullName : (email.split('@')[0] ?? 'Cliente'),\n }\n const session = createMockSession(user)\n setStored({ user, session })\n notifyListeners(user)\n return session\n },\n\n async signUp(email, _password, fullName) {\n // Mock signup creates a user from the provided details\n const user: AuthUser = {\n id: `mock-${email}`,\n email,\n fullName: fullName || (email.split('@')[0] ?? 'Cliente'),\n }\n const session = createMockSession(user)\n setStored({ user, session })\n notifyListeners(user)\n return session\n },\n\n async signOut() {\n setStored(null)\n notifyListeners(null)\n },\n\n async signInWithOAuth(_provider) {\n // Mock OAuth signs in as the configured user\n const user = toAuthUser(mockUser)\n const session = createMockSession(user)\n setStored({ user, session })\n notifyListeners(user)\n },\n\n async resetPassword(_email) {\n // No-op in mock\n },\n\n async updatePassword(_password) {\n const stored = getStored()\n return stored?.session\n },\n\n async handleCallback() {\n return getStored()?.session ?? null\n },\n\n async inviteUser(_email, _options) {\n // No admin path in mock — the org mock adapter still records the pending\n // invite so the Team UI shows it. Delivery is a no-op locally.\n },\n }\n}\n","import { create } from 'zustand'\nimport type { AuthUser, AuthSession } from '@fayz-ai/core'\n\nexport interface AuthState {\n user: AuthUser | null\n session: AuthSession | null\n isLoading: boolean\n isAuthenticated: boolean\n error: Error | null\n /**\n * Set when a sign-up succeeded but the account cannot be used until the\n * address is confirmed. Deliberately NOT a session: an account in this state\n * has no access token, and treating it as signed in is what used to let\n * someone into the app where every request came back 401.\n */\n pendingVerification: { email: string } | null\n}\n\nexport interface AuthStore extends AuthState {\n setUser: (user: AuthUser | null) => void\n setSession: (session: AuthSession | null) => void\n setLoading: (isLoading: boolean) => void\n setError: (error: Error | null) => void\n setPendingVerification: (pending: { email: string } | null) => void\n reset: () => void\n}\n\nconst initialState: AuthState = {\n user: null,\n session: null,\n isLoading: true,\n isAuthenticated: false,\n error: null,\n pendingVerification: null,\n}\n\nexport const useAuthStore = create<AuthStore>((set) => ({\n ...initialState,\n\n setUser: (user) =>\n set({ user, isAuthenticated: user !== null }),\n\n setSession: (session) =>\n set({\n session,\n user: session?.user ?? null,\n isAuthenticated: session !== null,\n // A real session arriving is the confirmation landing — the notice it\n // would otherwise keep showing is now about an address already verified.\n ...(session ? { pendingVerification: null } : {}),\n }),\n\n setLoading: (isLoading) => set({ isLoading }),\n\n setError: (error) => set({ error }),\n\n setPendingVerification: (pendingVerification) => set({ pendingVerification }),\n\n reset: () => set(initialState),\n}))\n","import React, { createContext, useContext, useEffect, useRef } from 'react'\nimport type { AuthAdapter, AuthProvider as OAuthProvider, AuthSession } from '@fayz-ai/core'\nimport { useAuthStore } from './store'\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface AuthContextValue {\n signIn: (email: string, password: string) => Promise<AuthSession>\n signUp: (email: string, password: string, fullName: string) => Promise<AuthSession>\n signOut: () => Promise<void>\n signInWithOAuth: (provider: OAuthProvider) => Promise<void>\n resetPassword: (email: string, options?: { redirectTo?: string }) => Promise<void>\n updatePassword: (password: string) => Promise<AuthSession | void>\n handleCallback: (url?: string) => Promise<AuthSession | null>\n inviteUser: (email: string, options?: { redirectTo?: string; data?: Record<string, unknown> }) => Promise<void>\n /** Re-send the sign-up confirmation. Resolves `false` when the adapter has no such path. */\n resendConfirmation: (email: string, options?: { redirectTo?: string }) => Promise<boolean>\n /** Abandon the pending sign-up so the login screen goes back to its form. */\n clearPendingVerification: () => void\n}\n\nconst AuthContext = createContext<AuthContextValue | null>(null)\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport interface AuthProviderProps {\n adapter: AuthAdapter\n children: React.ReactNode\n}\n\nexport function AuthProvider({ adapter, children }: AuthProviderProps) {\n const { setSession, setLoading, setError, setPendingVerification, reset } = useAuthStore()\n\n // Keep a stable ref to the adapter so the effect only runs once on mount\n const adapterRef = useRef(adapter)\n adapterRef.current = adapter\n\n useEffect(() => {\n let unsubscribe: (() => void) | undefined\n\n async function init() {\n try {\n setLoading(true)\n const result = await adapterRef.current.getSession()\n setSession(result?.session ?? null)\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)))\n } finally {\n setLoading(false)\n }\n\n // Subscribe to future auth state changes\n unsubscribe = adapterRef.current.onAuthStateChange((user) => {\n if (!user) {\n reset()\n // Keep isLoading false after an explicit sign-out\n setLoading(false)\n return\n }\n // Positive change (adapter-driven sign-in — e.g. an external callback,\n // another tab, or a direct adapter.signUp bridge) — sync the session so\n // consumers reflect it even when the call didn't go through ctx.signIn.\n void adapterRef.current.getSession().then((result) => setSession(result?.session ?? null)).catch(() => {})\n })\n }\n\n void init()\n\n return () => {\n unsubscribe?.()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const value: AuthContextValue = {\n async signIn(email, password) {\n setError(null)\n try {\n const session = await adapterRef.current.signIn(email, password)\n setSession(session)\n return session\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async signUp(email, password, fullName) {\n setError(null)\n try {\n const session = await adapterRef.current.signUp(email, password, fullName)\n // A project with \"confirm email\" on returns a session with no access\n // token — the account exists but cannot do anything yet. Storing it as\n // a session marked the user authenticated, the AuthGate waved them into\n // the app, and every request 401'd. Park it as pending instead.\n if (!session.accessToken) {\n setPendingVerification({ email })\n return session\n }\n setSession(session)\n return session\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async signOut() {\n setError(null)\n try {\n await adapterRef.current.signOut()\n reset()\n setLoading(false)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async signInWithOAuth(provider) {\n setError(null)\n try {\n await adapterRef.current.signInWithOAuth(provider)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async resetPassword(email, options) {\n setError(null)\n try {\n await adapterRef.current.resetPassword(email, options)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async updatePassword(password) {\n setError(null)\n try {\n const session = await adapterRef.current.updatePassword?.(password)\n if (session) setSession(session)\n return session\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async handleCallback(url) {\n setError(null)\n try {\n const session = await adapterRef.current.handleCallback?.(url) ?? null\n if (session) setSession(session)\n return session\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async inviteUser(email, options) {\n setError(null)\n try {\n await adapterRef.current.inviteUser?.(email, options)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n async resendConfirmation(email, options) {\n setError(null)\n if (!adapterRef.current.resendConfirmation) return false\n try {\n await adapterRef.current.resendConfirmation(email, options)\n return true\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n setError(error)\n throw error\n }\n },\n\n clearPendingVerification() {\n setPendingVerification(null)\n setError(null)\n },\n }\n\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\nexport function useAuth() {\n const ctx = useContext(AuthContext)\n if (!ctx) {\n throw new Error('useAuth must be used inside <AuthProvider>')\n }\n\n const { user, session, isLoading, isAuthenticated, error, pendingVerification } = useAuthStore()\n\n return {\n user,\n session,\n isLoading,\n isAuthenticated,\n error,\n pendingVerification,\n signIn: ctx.signIn,\n signUp: ctx.signUp,\n signOut: ctx.signOut,\n signInWithOAuth: ctx.signInWithOAuth,\n resetPassword: ctx.resetPassword,\n updatePassword: ctx.updatePassword,\n handleCallback: ctx.handleCallback,\n inviteUser: ctx.inviteUser,\n resendConfirmation: ctx.resendConfirmation,\n clearPendingVerification: ctx.clearPendingVerification,\n }\n}\n"]}
package/dist/store.d.ts CHANGED
@@ -5,12 +5,24 @@ export interface AuthState {
5
5
  isLoading: boolean;
6
6
  isAuthenticated: boolean;
7
7
  error: Error | null;
8
+ /**
9
+ * Set when a sign-up succeeded but the account cannot be used until the
10
+ * address is confirmed. Deliberately NOT a session: an account in this state
11
+ * has no access token, and treating it as signed in is what used to let
12
+ * someone into the app where every request came back 401.
13
+ */
14
+ pendingVerification: {
15
+ email: string;
16
+ } | null;
8
17
  }
9
18
  export interface AuthStore extends AuthState {
10
19
  setUser: (user: AuthUser | null) => void;
11
20
  setSession: (session: AuthSession | null) => void;
12
21
  setLoading: (isLoading: boolean) => void;
13
22
  setError: (error: Error | null) => void;
23
+ setPendingVerification: (pending: {
24
+ email: string;
25
+ } | null) => void;
14
26
  reset: () => void;
15
27
  }
16
28
  export declare const useAuthStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AuthStore>>;
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,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W,GAAG,IAAI,KAAK,IAAI,CAAA;IACjD,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAA;IACvC,sBAAsB,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAA;IACnE,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAWD,eAAO,MAAM,YAAY,wEAuBtB,CAAA"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "fayz": {
4
4
  "status": "beta"
5
5
  },
6
- "version": "0.12.0",
6
+ "version": "0.15.0",
7
7
  "description": "Fayz SDK auth — pluggable authentication adapters with React hooks",
8
8
  "type": "module",
9
9
  "sideEffects": false,
@@ -25,7 +25,7 @@
25
25
  "zustand": "^4.5.0 || ^5.0.0"
26
26
  },
27
27
  "dependencies": {
28
- "@fayz-ai/core": "^0.12.0"
28
+ "@fayz-ai/core": "^0.15.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@supabase/supabase-js": "^2.45.0",
@@ -41,10 +41,10 @@
41
41
  "access": "public"
42
42
  },
43
43
  "scripts": {
44
- "build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
44
+ "build": "tsup && tsc -b --force",
45
45
  "dev": "tsup --watch",
46
- "typecheck": "tsc --noEmit -p tsconfig.test.json",
46
+ "typecheck": "tsc -b tsconfig.test.json",
47
47
  "test": "vitest run",
48
- "clean": "rm -rf dist"
48
+ "clean": "rm -rf dist .tsbuildinfo"
49
49
  }
50
50
  }