@insforge/nextjs 0.4.0 → 0.5.6

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
@@ -32,27 +32,58 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
  // src/index.ts
33
33
  var src_exports = {};
34
34
  __export(src_exports, {
35
- AuthProvider: () => AuthProvider,
36
- InsforgeConfigProvider: () => InsforgeConfigProvider,
35
+ AuthBranding: () => AuthBranding,
36
+ AuthContainer: () => AuthContainer,
37
+ AuthDivider: () => AuthDivider,
38
+ AuthErrorBanner: () => AuthErrorBanner,
39
+ AuthFormField: () => AuthFormField,
40
+ AuthHeader: () => AuthHeader,
41
+ AuthLink: () => AuthLink,
42
+ AuthOAuthButton: () => AuthOAuthButton,
43
+ AuthOAuthProviders: () => AuthOAuthProviders,
44
+ AuthPasswordField: () => AuthPasswordField,
45
+ AuthPasswordStrengthIndicator: () => AuthPasswordStrengthIndicator,
46
+ AuthSubmitButton: () => AuthSubmitButton,
47
+ AuthVerificationCodeInput: () => AuthVerificationCodeInput,
48
+ InsforgeProvider: () => InsforgeProvider,
49
+ OAUTH_PROVIDER_CONFIG: () => OAUTH_PROVIDER_CONFIG,
37
50
  Protect: () => Protect,
38
51
  SignIn: () => SignIn,
39
52
  SignUp: () => SignUp,
40
53
  SignedIn: () => SignedIn,
41
54
  SignedOut: () => SignedOut,
42
55
  UserButton: () => UserButton,
56
+ getProviderConfig: () => getProviderConfig,
57
+ getProviderName: () => getProviderName,
58
+ isProviderSupported: () => isProviderSupported,
43
59
  useAuth: () => useAuth,
44
- useInsforgeConfig: () => useInsforgeConfig,
60
+ useInsforge: () => useInsforge,
45
61
  useOAuthProviders: () => useOAuthProviders,
46
62
  useSession: () => useSession,
47
- useUser: () => useUser
63
+ useUser: () => useUser,
64
+ validatePasswordStrength: () => validatePasswordStrength
48
65
  });
49
66
  module.exports = __toCommonJS(src_exports);
50
67
 
51
- // src/provider/AuthProvider.tsx
68
+ // src/provider/InsforgeProvider.tsx
52
69
  var import_react = require("react");
53
70
  var import_sdk = require("@insforge/sdk");
54
71
  var import_jsx_runtime = require("react/jsx-runtime");
55
- var AuthContext = (0, import_react.createContext)(void 0);
72
+ var InsforgeContext = (0, import_react.createContext)(void 0);
73
+ async function fetchOAuthProviders(baseUrl) {
74
+ try {
75
+ const response = await fetch(`${baseUrl}/api/auth/oauth/configs`);
76
+ if (!response.ok) return [];
77
+ const result = await response.json();
78
+ if (result?.data && Array.isArray(result.data)) {
79
+ return result.data.map((config) => config.provider);
80
+ }
81
+ return [];
82
+ } catch (error) {
83
+ console.warn("Failed to fetch OAuth configs:", error);
84
+ return [];
85
+ }
86
+ }
56
87
  function getTokenFromSDK() {
57
88
  if (typeof window === "undefined") return null;
58
89
  try {
@@ -82,12 +113,26 @@ async function syncTokenToCookie(token) {
82
113
  return false;
83
114
  }
84
115
  }
85
- function AuthProvider({ children, baseUrl, onAuthChange }) {
116
+ function InsforgeProvider({
117
+ children,
118
+ baseUrl,
119
+ onAuthChange
120
+ }) {
86
121
  const [user, setUser] = (0, import_react.useState)(null);
87
122
  const [session, setSession] = (0, import_react.useState)(null);
88
123
  const [isLoaded, setIsLoaded] = (0, import_react.useState)(false);
124
+ const [oauthProviders, setOauthProviders] = (0, import_react.useState)([]);
125
+ const [isConfigLoaded, setIsConfigLoaded] = (0, import_react.useState)(false);
89
126
  const refreshIntervalRef = (0, import_react.useRef)();
90
- const insforge = (0, import_react.useRef)((0, import_sdk.createClient)({ baseUrl })).current;
127
+ const [insforge] = (0, import_react.useState)(() => (0, import_sdk.createClient)({ baseUrl }));
128
+ (0, import_react.useEffect)(() => {
129
+ async function loadConfig() {
130
+ const providers = await fetchOAuthProviders(baseUrl);
131
+ setOauthProviders(providers);
132
+ setIsConfigLoaded(true);
133
+ }
134
+ loadConfig();
135
+ }, [baseUrl]);
91
136
  const loadAuthState = (0, import_react.useCallback)(async () => {
92
137
  try {
93
138
  const token = getTokenFromSDK();
@@ -185,10 +230,14 @@ function AuthProvider({ children, baseUrl, onAuthChange }) {
185
230
  try {
186
231
  await syncTokenToCookie(sdkResult.data.accessToken);
187
232
  } catch (error) {
233
+ console.error("Please add /api/auth route to your server to sync token to cookie:", error);
188
234
  }
235
+ } else {
236
+ const errorMessage = sdkResult.error?.message || "Invalid email or password";
237
+ throw new Error(errorMessage);
189
238
  }
190
239
  },
191
- [baseUrl, onAuthChange, insforge]
240
+ [insforge, onAuthChange]
192
241
  );
193
242
  const signUp = (0, import_react.useCallback)(
194
243
  async (email, password) => {
@@ -216,9 +265,12 @@ function AuthProvider({ children, baseUrl, onAuthChange }) {
216
265
  await syncTokenToCookie(sdkResult.data.accessToken);
217
266
  } catch (error) {
218
267
  }
268
+ } else {
269
+ const errorMessage = sdkResult.error?.message || "Sign up failed";
270
+ throw new Error(errorMessage);
219
271
  }
220
272
  },
221
- [baseUrl, onAuthChange, insforge]
273
+ [insforge, onAuthChange]
222
274
  );
223
275
  const signOut = (0, import_react.useCallback)(async () => {
224
276
  await insforge.auth.signOut();
@@ -232,7 +284,7 @@ function AuthProvider({ children, baseUrl, onAuthChange }) {
232
284
  if (onAuthChange) {
233
285
  onAuthChange(null);
234
286
  }
235
- }, [baseUrl, onAuthChange, insforge]);
287
+ }, [insforge, onAuthChange]);
236
288
  const updateUser = (0, import_react.useCallback)(
237
289
  async (data) => {
238
290
  if (!user) throw new Error("No user signed in");
@@ -247,10 +299,64 @@ function AuthProvider({ children, baseUrl, onAuthChange }) {
247
299
  },
248
300
  [user, onAuthChange, insforge]
249
301
  );
302
+ const sendVerificationCode = (0, import_react.useCallback)(
303
+ async (email, type) => {
304
+ console.log(`[Verification] Sending ${type} code to ${email}`);
305
+ console.log("[Verification] Dummy code: 123456");
306
+ await new Promise((resolve) => setTimeout(resolve, 500));
307
+ },
308
+ [insforge]
309
+ );
310
+ const verifySignUpCode = (0, import_react.useCallback)(
311
+ async (email, password, code) => {
312
+ if (code !== "123456") {
313
+ throw new Error("Invalid verification code");
314
+ }
315
+ const sdkResult = await insforge.auth.signUp({ email, password });
316
+ if (sdkResult.data) {
317
+ const userData = {
318
+ id: sdkResult.data.user.id,
319
+ email: sdkResult.data.user.email,
320
+ name: sdkResult.data.user.name || void 0,
321
+ createdAt: sdkResult.data.user.createdAt,
322
+ updatedAt: sdkResult.data.user.updatedAt
323
+ };
324
+ const sessionData = {
325
+ userId: sdkResult.data.user.id,
326
+ token: sdkResult.data.accessToken,
327
+ expiresAt: "",
328
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
329
+ };
330
+ setUser(userData);
331
+ setSession(sessionData);
332
+ if (onAuthChange) {
333
+ onAuthChange(userData);
334
+ }
335
+ try {
336
+ await syncTokenToCookie(sdkResult.data.accessToken);
337
+ } catch (error) {
338
+ }
339
+ } else {
340
+ const errorMessage = sdkResult.error?.message || "Sign up failed";
341
+ throw new Error(errorMessage);
342
+ }
343
+ },
344
+ [insforge, onAuthChange]
345
+ );
346
+ const verifySignInCode = (0, import_react.useCallback)(
347
+ async (email, code) => {
348
+ if (code !== "123456") {
349
+ throw new Error("Invalid verification code");
350
+ }
351
+ throw new Error("Passwordless sign in via verification code is not yet implemented in the backend");
352
+ },
353
+ [insforge, onAuthChange]
354
+ );
250
355
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
251
- AuthContext.Provider,
356
+ InsforgeContext.Provider,
252
357
  {
253
358
  value: {
359
+ // Auth
254
360
  user,
255
361
  session,
256
362
  isLoaded,
@@ -258,132 +364,338 @@ function AuthProvider({ children, baseUrl, onAuthChange }) {
258
364
  signIn,
259
365
  signUp,
260
366
  signOut,
261
- updateUser
262
- },
263
- children
264
- }
265
- );
266
- }
267
- function useAuthContext() {
268
- const context = (0, import_react.useContext)(AuthContext);
269
- if (!context) {
270
- throw new Error("useAuthContext must be used within AuthProvider");
271
- }
272
- return context;
273
- }
274
-
275
- // src/provider/InsforgeConfigProvider.tsx
276
- var import_react2 = require("react");
277
- var import_jsx_runtime2 = require("react/jsx-runtime");
278
- var InsforgeConfigContext = (0, import_react2.createContext)(void 0);
279
- async function fetchBackendConfig(baseUrl) {
280
- try {
281
- const response = await fetch(`${baseUrl}/api/auth/config`);
282
- if (!response.ok) {
283
- return [];
284
- }
285
- const config = await response.json();
286
- if (config?.oauth?.providers && Array.isArray(config.oauth.providers)) {
287
- return config.oauth.providers.filter((p) => p.enabled).map((p) => p.provider);
288
- }
289
- return [];
290
- } catch (error) {
291
- return [];
292
- }
293
- }
294
- function InsforgeConfigProvider({ children, baseUrl }) {
295
- const [oauthProviders, setOauthProviders] = (0, import_react2.useState)([]);
296
- const [isLoaded, setIsLoaded] = (0, import_react2.useState)(false);
297
- const fetchConfig = async () => {
298
- const providers = await fetchBackendConfig(baseUrl);
299
- setOauthProviders(providers);
300
- setIsLoaded(true);
301
- };
302
- (0, import_react2.useEffect)(() => {
303
- fetchConfig();
304
- }, [baseUrl]);
305
- const refetch = async () => {
306
- setIsLoaded(false);
307
- await fetchConfig();
308
- };
309
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
310
- InsforgeConfigContext.Provider,
311
- {
312
- value: {
367
+ updateUser,
368
+ // Verification
369
+ sendVerificationCode,
370
+ verifySignUpCode,
371
+ verifySignInCode,
372
+ // Config
313
373
  oauthProviders,
314
- isLoaded,
315
- refetch
374
+ isConfigLoaded,
375
+ // Base
376
+ baseUrl
316
377
  },
317
378
  children
318
379
  }
319
380
  );
320
381
  }
321
- function useInsforgeConfig() {
322
- const context = (0, import_react2.useContext)(InsforgeConfigContext);
382
+ function useInsforge() {
383
+ const context = (0, import_react.useContext)(InsforgeContext);
323
384
  if (!context) {
324
- throw new Error("useInsforgeConfig must be used within InsforgeConfigProvider");
385
+ throw new Error("useInsforge must be used within InsforgeProvider");
325
386
  }
326
387
  return context;
327
388
  }
328
389
 
329
390
  // src/hooks/useAuth.ts
330
391
  function useAuth() {
331
- return useAuthContext();
392
+ const { signIn, signUp, signOut, isLoaded, isSignedIn } = useInsforge();
393
+ return { signIn, signUp, signOut, isLoaded, isSignedIn };
332
394
  }
333
395
 
334
396
  // src/hooks/useUser.ts
335
397
  function useUser() {
336
- const { user, isLoaded } = useAuthContext();
337
- return { user, isLoaded };
398
+ const { user, isLoaded, updateUser } = useInsforge();
399
+ return { user, isLoaded, updateUser };
338
400
  }
339
401
 
340
402
  // src/hooks/useSession.ts
341
403
  function useSession() {
342
- const { session, isLoaded, isSignedIn } = useAuthContext();
343
- return { session, isLoaded, isSignedIn };
404
+ const { session, isLoaded } = useInsforge();
405
+ return { session, isLoaded };
344
406
  }
345
407
 
346
408
  // src/hooks/useOAuthProviders.ts
347
409
  function useOAuthProviders() {
348
- const { oauthProviders } = useInsforgeConfig();
349
- return oauthProviders;
410
+ const { oauthProviders, isConfigLoaded } = useInsforge();
411
+ return { providers: oauthProviders, isLoaded: isConfigLoaded };
350
412
  }
351
413
 
352
414
  // src/components/SignIn.tsx
353
- var import_react3 = require("react");
354
- var import_link = __toESM(require("next/link"));
415
+ var import_react4 = require("react");
355
416
  var import_sdk2 = require("@insforge/sdk");
356
- var import_lucide_react2 = require("lucide-react");
357
417
 
358
- // src/components/OAuthButton.tsx
359
- var import_lucide_react = require("lucide-react");
418
+ // src/components/auth/AuthBranding.tsx
419
+ var import_link = __toESM(require("next/link"));
420
+ var import_jsx_runtime2 = require("react/jsx-runtime");
421
+ function AuthBranding({ text = "Secured by", href = "https://insforge.dev" }) {
422
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "insforge-branding", children: [
423
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "insforge-branding-text", children: text }),
424
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_link.default, { href, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "83", height: "20", viewBox: "0 0 83 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
425
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
426
+ "path",
427
+ {
428
+ d: "M2.16783 8.46797C1.9334 8.23325 1.9334 7.85269 2.16783 7.61797L8.11049 1.66797L16.6 1.66797L6.41259 11.868C6.17815 12.1027 5.79807 12.1027 5.56363 11.868L2.16783 8.46797Z",
429
+ fill: "url(#paint0_linear_2976_9475)"
430
+ }
431
+ ),
432
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
433
+ "path",
434
+ {
435
+ d: "M12.8858 6.44922L16.6 10.168V18.668L8.64108 10.6992L12.8858 6.44922Z",
436
+ fill: "url(#paint1_linear_2976_9475)"
437
+ }
438
+ ),
439
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
440
+ "path",
441
+ {
442
+ d: "M67.5439 6.48828C68.2894 6.48828 68.9145 6.67064 69.418 7.03516C69.5229 7.10943 69.6214 7.1907 69.7158 7.27637V6.70703H71.248V14.959C71.248 15.1583 71.2381 15.3485 71.2188 15.5283C71.2042 15.7129 71.1774 15.8925 71.1387 16.0674C71.0225 16.5776 70.7998 16.9957 70.4707 17.3213C70.1415 17.6518 69.7321 17.8972 69.2432 18.0576C68.7592 18.2179 68.2222 18.2988 67.6318 18.2988C67.1962 18.2988 66.7768 18.2308 66.375 18.0947C65.9782 17.9587 65.6202 17.7614 65.3008 17.5039C64.9813 17.2512 64.7199 16.9446 64.5166 16.585L66.1289 15.7832C66.2789 16.0698 66.4888 16.2819 66.7598 16.418C67.0356 16.5589 67.3289 16.6289 67.6387 16.6289C68.0016 16.6289 68.3258 16.5628 68.6113 16.4316C68.8969 16.3053 69.1176 16.116 69.2725 15.8633C69.4321 15.6155 69.5077 15.3047 69.498 14.9307V14.1797C69.4665 14.2037 69.4359 14.229 69.4033 14.252C68.8855 14.6164 68.2441 14.7988 67.4795 14.7988C66.7582 14.7988 66.1281 14.6165 65.5908 14.252C65.0537 13.8875 64.637 13.3915 64.3418 12.7646C64.0467 12.1378 63.8994 11.4307 63.8994 10.6436C63.8994 9.84651 64.0465 9.13673 64.3418 8.51465C64.6419 7.88768 65.0663 7.39481 65.6133 7.03516C66.1601 6.67077 66.8036 6.48836 67.5439 6.48828ZM37.5 6.48828C38.1099 6.48828 38.6496 6.58294 39.1191 6.77246C39.5935 6.96201 39.9762 7.2321 40.2666 7.58203C40.5569 7.93184 40.7359 8.34227 40.8037 8.81348L39.0176 9.13477C38.974 8.79951 38.8218 8.53424 38.5605 8.33984C38.304 8.14547 37.96 8.03605 37.5293 8.01172C37.1178 7.98742 36.7859 8.05051 36.5342 8.20117C36.2825 8.34698 36.1562 8.55398 36.1562 8.82129C36.1563 8.97184 36.208 9.10017 36.3096 9.20703C36.4112 9.31394 36.614 9.42141 36.9189 9.52832C37.2288 9.63524 37.6889 9.76635 38.2988 9.92188C38.9232 10.0823 39.4222 10.2666 39.7949 10.4756C40.1722 10.6796 40.4428 10.9254 40.6074 11.2119C40.7768 11.4987 40.8623 11.8466 40.8623 12.2549C40.8623 13.047 40.574 13.6691 39.998 14.1211C39.4268 14.5731 38.6348 14.7988 37.623 14.7988C36.6551 14.7988 35.8687 14.5799 35.2637 14.1426C34.6587 13.7052 34.2909 13.0908 34.1602 12.2988L35.9463 12.0215C36.0383 12.4102 36.2411 12.7169 36.5557 12.9404C36.8703 13.164 37.2678 13.2754 37.7471 13.2754C38.1681 13.2754 38.4922 13.1926 38.7197 13.0273C38.9521 12.8572 39.0684 12.6266 39.0684 12.335C39.0684 12.1552 39.0245 12.0122 38.9375 11.9053C38.8552 11.7935 38.6713 11.686 38.3857 11.584C38.1001 11.4819 37.6618 11.3528 37.0713 11.1973C36.4131 11.0223 35.8901 10.8359 35.5029 10.6367C35.1158 10.4327 34.8374 10.192 34.668 9.91504C34.4985 9.63801 34.4141 9.30188 34.4141 8.9082C34.4141 8.41746 34.5423 7.98943 34.7988 7.625C35.0553 7.26073 35.4135 6.98146 35.873 6.78711C36.3329 6.58784 36.8755 6.48828 37.5 6.48828ZM53.3047 6.48828C54.0937 6.48828 54.7815 6.66572 55.3672 7.02051C55.9527 7.37528 56.4072 7.86634 56.7314 8.49316C57.0558 9.11525 57.2187 9.83193 57.2188 10.6436C57.2188 11.46 57.0537 12.1817 56.7246 12.8086C56.4003 13.4307 55.9451 13.9196 55.3594 14.2744C54.7737 14.6242 54.0888 14.7988 53.3047 14.7988C52.5205 14.7988 51.8357 14.6214 51.25 14.2666C50.6643 13.9118 50.2091 13.4238 49.8848 12.8018C49.5653 12.1748 49.4053 11.4552 49.4053 10.6436C49.4053 9.81735 49.5703 9.09279 49.8994 8.4707C50.2286 7.8488 50.6859 7.36255 51.2715 7.0127C51.8572 6.66281 52.5351 6.48828 53.3047 6.48828ZM76.7471 6.48828C77.5603 6.48828 78.25 6.68053 78.8164 7.06445C79.3876 7.44351 79.812 7.97991 80.0879 8.6748C80.3638 9.36976 80.4672 10.189 80.3994 11.1318H74.7256C74.7843 11.6972 74.949 12.1516 75.2227 12.4951C75.5711 12.9325 76.0792 13.1513 76.7471 13.1514C77.1779 13.1514 77.5486 13.0567 77.8584 12.8672C78.173 12.6728 78.4146 12.3928 78.584 12.0283L80.3125 12.5537C80.0124 13.2633 79.5473 13.8153 78.918 14.209C78.2936 14.6025 77.6036 14.7988 76.8486 14.7988C76.0549 14.7988 75.358 14.6263 74.7578 14.2812C74.1576 13.9362 73.6875 13.458 73.3486 12.8457C73.0147 12.2334 72.8477 11.5284 72.8477 10.7314C72.8477 9.87126 73.0127 9.12495 73.3418 8.49316C73.671 7.85651 74.1282 7.36263 74.7139 7.0127C75.2995 6.6628 75.9775 6.48832 76.7471 6.48828ZM23.3301 14.5801H21.5801V4.08203H23.3301V14.5801ZM29.6152 6.48047C30.1959 6.48052 30.6753 6.5781 31.0527 6.77246C31.4301 6.96681 31.7305 7.21443 31.9531 7.51562C32.1758 7.81695 32.3398 8.13831 32.4463 8.47852C32.5528 8.81873 32.6213 9.14205 32.6504 9.44824C32.6843 9.74946 32.7012 9.99508 32.7012 10.1846V14.5801H30.9287V10.7891C30.9287 10.5413 30.9118 10.2669 30.8779 9.96582C30.844 9.66449 30.7645 9.37469 30.6387 9.09766C30.5177 8.81592 30.3337 8.58503 30.0869 8.40527C29.8449 8.22551 29.5157 8.13579 29.0996 8.13574C28.8769 8.13574 28.6563 8.17221 28.4385 8.24512C28.2206 8.31802 28.0219 8.4442 27.8428 8.62402C27.6685 8.79899 27.5284 9.04249 27.4219 9.35352C27.3154 9.65965 27.2617 10.0532 27.2617 10.5342V14.5801H25.4902V6.70703H27.0518V7.58301C27.2521 7.34675 27.486 7.14172 27.7559 6.96973C28.2593 6.64409 28.8794 6.48047 29.6152 6.48047ZM48.748 5.83887H44.2021V8.45605H47.876V10.2061H44.2021V14.5801H42.4521V4.08203H48.748V5.83887ZM62.5137 6.67773C62.7606 6.65829 63.001 6.66815 63.2334 6.70703V8.34766C63.001 8.27961 62.7317 8.25695 62.4268 8.28125C62.1267 8.30557 61.8553 8.39134 61.6133 8.53711C61.3715 8.66829 61.1733 8.83606 61.0186 9.04004C60.8686 9.24404 60.7572 9.47701 60.6846 9.73926C60.612 9.99685 60.5752 10.2768 60.5752 10.5781V14.5801H58.8184V6.70703H60.3652V7.96582C60.4243 7.85986 60.4888 7.75824 60.5605 7.66211C60.7251 7.4434 60.9219 7.26302 61.1494 7.12207C61.3429 6.99098 61.5559 6.88926 61.7881 6.81641C62.0251 6.73869 62.267 6.69235 62.5137 6.67773ZM67.8057 8.0625C67.3362 8.06252 66.9485 8.17982 66.6436 8.41309C66.3389 8.64144 66.1139 8.95232 65.9688 9.3457C65.8235 9.7345 65.751 10.1673 65.751 10.6436C65.751 11.1247 65.8215 11.5624 65.9619 11.9561C66.1071 12.3447 66.3269 12.6535 66.6221 12.8818C66.9174 13.1103 67.293 13.2246 67.748 13.2246C68.2174 13.2246 68.5953 13.1171 68.8809 12.9033C69.1711 12.6846 69.3811 12.3808 69.5117 11.9922C69.6473 11.6034 69.7158 11.1539 69.7158 10.6436C69.7158 10.1284 69.6473 9.67886 69.5117 9.29492C69.381 8.90617 69.1753 8.60445 68.8945 8.39062C68.6138 8.17213 68.2508 8.0625 67.8057 8.0625ZM53.3047 8.13574C52.8351 8.13574 52.4475 8.24222 52.1426 8.45605C51.8425 8.66504 51.6198 8.95977 51.4746 9.33887C51.3295 9.71303 51.2568 10.148 51.2568 10.6436C51.2568 11.4066 51.4288 12.0168 51.7725 12.4736C52.121 12.9256 52.6318 13.1514 53.3047 13.1514C54.0017 13.1514 54.5196 12.9177 54.8584 12.4512C55.1971 11.9846 55.3672 11.3822 55.3672 10.6436C55.3672 9.8807 55.1951 9.27324 54.8516 8.82129C54.5079 8.36444 53.9921 8.13575 53.3047 8.13574ZM76.8203 8.02637C76.1039 8.02637 75.5712 8.25013 75.2227 8.69727C74.9987 8.98144 74.8476 9.35094 74.7676 9.80566H78.6221C78.5589 9.29301 78.4236 8.89686 78.2139 8.61719C77.9186 8.22359 77.4543 8.02645 76.8203 8.02637Z",
443
+ fill: "black"
444
+ }
445
+ ),
446
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("defs", { children: [
447
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
448
+ "linearGradient",
449
+ {
450
+ id: "paint0_linear_2976_9475",
451
+ x1: "1.85883",
452
+ y1: "1.92425",
453
+ x2: "24.3072",
454
+ y2: "9.64016",
455
+ gradientUnits: "userSpaceOnUse",
456
+ children: [
457
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", {}),
458
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "1", stopOpacity: "0.4" })
459
+ ]
460
+ }
461
+ ),
462
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
463
+ "linearGradient",
464
+ {
465
+ id: "paint1_linear_2976_9475",
466
+ x1: "25.6475",
467
+ y1: "8.65468",
468
+ x2: "10.7901",
469
+ y2: "8.65468",
470
+ gradientUnits: "userSpaceOnUse",
471
+ children: [
472
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", {}),
473
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "1", stopOpacity: "0.4" })
474
+ ]
475
+ }
476
+ )
477
+ ] })
478
+ ] }) })
479
+ ] });
480
+ }
481
+
482
+ // src/components/auth/AuthContainer.tsx
360
483
  var import_jsx_runtime3 = require("react/jsx-runtime");
361
- var providerConfig = {
484
+ function AuthContainer({ children, style }) {
485
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "insforge-auth-container", style, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "insforge-auth-card", children: [
486
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "insforge-auth-content", children }),
487
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AuthBranding, {})
488
+ ] }) });
489
+ }
490
+
491
+ // src/components/auth/AuthHeader.tsx
492
+ var import_jsx_runtime4 = require("react/jsx-runtime");
493
+ function AuthHeader({ title, subtitle }) {
494
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-auth-header", children: [
495
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { className: "insforge-auth-title", children: title }),
496
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "insforge-auth-subtitle", children: subtitle })
497
+ ] });
498
+ }
499
+
500
+ // src/components/auth/AuthErrorBanner.tsx
501
+ var import_lucide_react = require("lucide-react");
502
+ var import_jsx_runtime5 = require("react/jsx-runtime");
503
+ function AuthErrorBanner({ error }) {
504
+ if (!error) return null;
505
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "insforge-error-banner", children: [
506
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.AlertTriangle, { className: "insforge-error-icon" }),
507
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: error })
508
+ ] });
509
+ }
510
+
511
+ // src/components/auth/AuthFormField.tsx
512
+ var import_jsx_runtime6 = require("react/jsx-runtime");
513
+ function AuthFormField({ label, id, className = "", ...props }) {
514
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "insforge-form-group", children: [
515
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: "insforge-form-label", children: label }),
516
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
517
+ "input",
518
+ {
519
+ id,
520
+ className: `insforge-input ${className}`,
521
+ ...props
522
+ }
523
+ )
524
+ ] });
525
+ }
526
+
527
+ // src/components/auth/AuthPasswordField.tsx
528
+ var import_react2 = require("react");
529
+ var import_lucide_react3 = require("lucide-react");
530
+
531
+ // src/components/auth/AuthPasswordStrengthIndicator.tsx
532
+ var import_lucide_react2 = require("lucide-react");
533
+ var import_jsx_runtime7 = require("react/jsx-runtime");
534
+ var requirements = [
535
+ {
536
+ label: "At least 1 Uppercase letter",
537
+ test: (pwd) => /[A-Z]/.test(pwd)
538
+ },
539
+ {
540
+ label: "At least 1 Number",
541
+ test: (pwd) => /\d/.test(pwd)
542
+ },
543
+ {
544
+ label: "Special character (e.g. !?<>@#$%)",
545
+ test: (pwd) => /[!@#$%^&*()_+\-=[\]{};\\|,.<>/?]/.test(pwd)
546
+ },
547
+ {
548
+ label: "8 characters or more",
549
+ test: (pwd) => pwd.length >= 8
550
+ }
551
+ ];
552
+ function validatePasswordStrength(password) {
553
+ if (!password) return false;
554
+ return requirements.every((req) => req.test(password));
555
+ }
556
+ function AuthPasswordStrengthIndicator({ password }) {
557
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "insforge-password-strength", children: requirements.map((requirement, index) => {
558
+ const isValid = requirement.test(password);
559
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "insforge-password-requirement", children: [
560
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
561
+ "div",
562
+ {
563
+ className: `insforge-password-check ${isValid ? "insforge-password-check-valid" : ""}`,
564
+ children: isValid && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.Check, { className: "insforge-password-check-icon", size: 12 })
565
+ }
566
+ ),
567
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "insforge-password-requirement-label", children: requirement.label })
568
+ ] }, index);
569
+ }) });
570
+ }
571
+
572
+ // src/components/auth/AuthPasswordField.tsx
573
+ var import_jsx_runtime8 = require("react/jsx-runtime");
574
+ function AuthPasswordField({
575
+ label,
576
+ id,
577
+ showStrengthIndicator = false,
578
+ forgotPasswordLink,
579
+ value,
580
+ className = "",
581
+ onFocus,
582
+ ...props
583
+ }) {
584
+ const [showPassword, setShowPassword] = (0, import_react2.useState)(false);
585
+ const [showStrength, setShowStrength] = (0, import_react2.useState)(false);
586
+ const handleFocus = (e) => {
587
+ if (showStrengthIndicator) {
588
+ setShowStrength(true);
589
+ }
590
+ onFocus?.(e);
591
+ };
592
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "insforge-form-group", children: [
593
+ (label || forgotPasswordLink) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "insforge-form-label-row", children: [
594
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { htmlFor: id, className: "insforge-form-label", style: { margin: 0 }, children: label }),
595
+ forgotPasswordLink && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { href: forgotPasswordLink.href, className: "insforge-form-link", children: forgotPasswordLink.text || "Forget Password?" })
596
+ ] }),
597
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "insforge-input-wrapper", children: [
598
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
599
+ "input",
600
+ {
601
+ id,
602
+ type: showPassword ? "text" : "password",
603
+ className: `insforge-input insforge-input-with-icon ${className}`,
604
+ value,
605
+ onFocus: handleFocus,
606
+ ...props
607
+ }
608
+ ),
609
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
610
+ "button",
611
+ {
612
+ type: "button",
613
+ onClick: () => setShowPassword(!showPassword),
614
+ className: "insforge-input-icon-btn",
615
+ "aria-label": showPassword ? "Hide password" : "Show password",
616
+ children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.EyeOff, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Eye, { size: 20 })
617
+ }
618
+ )
619
+ ] }),
620
+ showStrengthIndicator && showStrength && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AuthPasswordStrengthIndicator, { password: String(value || "") })
621
+ ] });
622
+ }
623
+
624
+ // src/components/auth/AuthSubmitButton.tsx
625
+ var import_lucide_react4 = require("lucide-react");
626
+ var import_jsx_runtime9 = require("react/jsx-runtime");
627
+ function AuthSubmitButton({
628
+ children,
629
+ isLoading = false,
630
+ confirmed = false,
631
+ disabled = false,
632
+ style
633
+ }) {
634
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
635
+ "button",
636
+ {
637
+ type: "submit",
638
+ className: "insforge-btn-primary",
639
+ style,
640
+ disabled: disabled || isLoading || confirmed,
641
+ "data-loading": isLoading || void 0,
642
+ "data-confirmed": confirmed || void 0,
643
+ children: [
644
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Loader2, { className: "insforge-btn-loader", size: 20 }),
645
+ confirmed && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CircleCheck, { className: "insforge-btn-check", size: 20 }),
646
+ children
647
+ ]
648
+ }
649
+ );
650
+ }
651
+
652
+ // src/components/auth/AuthDivider.tsx
653
+ var import_jsx_runtime10 = require("react/jsx-runtime");
654
+ function AuthDivider({ text = "or" }) {
655
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "insforge-divider", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "insforge-divider-text", children: text }) });
656
+ }
657
+
658
+ // src/components/auth/AuthLink.tsx
659
+ var import_jsx_runtime11 = require("react/jsx-runtime");
660
+ function AuthLink({ text, linkText, href }) {
661
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "insforge-text-center", children: [
662
+ text,
663
+ " ",
664
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { href, className: "insforge-link-primary", children: linkText })
665
+ ] });
666
+ }
667
+
668
+ // src/components/auth/AuthOAuthButton.tsx
669
+ var import_lucide_react5 = require("lucide-react");
670
+
671
+ // src/config/oauth-providers.tsx
672
+ var import_jsx_runtime12 = require("react/jsx-runtime");
673
+ var OAUTH_PROVIDER_CONFIG = {
362
674
  google: {
363
675
  name: "Google",
364
- svg: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: [
365
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
676
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: [
677
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
366
678
  "path",
367
679
  {
368
680
  d: "M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.874 2.684-6.615z",
369
681
  fill: "#4285F4"
370
682
  }
371
683
  ),
372
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
684
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
373
685
  "path",
374
686
  {
375
687
  d: "M9 18c2.43 0 4.467-.806 5.956-2.184l-2.908-2.258c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332C2.438 15.983 5.482 18 9 18z",
376
688
  fill: "#34A853"
377
689
  }
378
690
  ),
379
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
691
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
380
692
  "path",
381
693
  {
382
694
  d: "M3.964 10.707c-.18-.54-.282-1.117-.282-1.707 0-.593.102-1.17.282-1.709V4.958H.957C.347 6.173 0 7.548 0 9c0 1.452.348 2.827.957 4.042l3.007-2.335z",
383
695
  fill: "#FBBC05"
384
696
  }
385
697
  ),
386
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
698
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
387
699
  "path",
388
700
  {
389
701
  d: "M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0 5.482 0 2.438 2.017.957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",
@@ -395,16 +707,134 @@ var providerConfig = {
395
707
  },
396
708
  github: {
397
709
  name: "GitHub",
398
- svg: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" }) }),
710
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" }) }),
399
711
  className: "insforge-oauth-github"
712
+ },
713
+ discord: {
714
+ name: "Discord",
715
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
716
+ "path",
717
+ {
718
+ d: "M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z",
719
+ fill: "#5865F2"
720
+ }
721
+ ) }),
722
+ className: "insforge-oauth-discord"
723
+ },
724
+ facebook: {
725
+ name: "Facebook",
726
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
727
+ "path",
728
+ {
729
+ d: "M24 12.073C24 5.405 18.627 0 12 0S0 5.405 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047v-2.66c0-3.025 1.792-4.697 4.533-4.697 1.312 0 2.686.236 2.686.236v2.971H15.83c-1.49 0-1.955.93-1.955 1.886v2.264h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z",
730
+ fill: "#1877F2"
731
+ }
732
+ ) }),
733
+ className: "insforge-oauth-facebook"
734
+ },
735
+ linkedin: {
736
+ name: "LinkedIn",
737
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
738
+ "path",
739
+ {
740
+ d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",
741
+ fill: "#0A66C2"
742
+ }
743
+ ) }),
744
+ className: "insforge-oauth-linkedin"
745
+ },
746
+ microsoft: {
747
+ name: "Microsoft",
748
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 23 23", fill: "none", children: [
749
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M0 0h11v11H0z", fill: "#F25022" }),
750
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M12 0h11v11H12z", fill: "#7FBA00" }),
751
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M0 12h11v11H0z", fill: "#00A4EF" }),
752
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M12 12h11v11H12z", fill: "#FFB900" })
753
+ ] }),
754
+ className: "insforge-oauth-microsoft"
755
+ },
756
+ apple: {
757
+ name: "Apple",
758
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) }),
759
+ className: "insforge-oauth-apple"
760
+ },
761
+ x: {
762
+ name: "X",
763
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }) }),
764
+ className: "insforge-oauth-x"
765
+ },
766
+ instagram: {
767
+ name: "Instagram",
768
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: [
769
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
770
+ "path",
771
+ {
772
+ d: "M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z",
773
+ fill: "url(#instagram-gradient)"
774
+ }
775
+ ),
776
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("linearGradient", { id: "instagram-gradient", x1: "0%", y1: "100%", x2: "100%", y2: "0%", children: [
777
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "0%", stopColor: "#FD5949" }),
778
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "50%", stopColor: "#D6249F" }),
779
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "100%", stopColor: "#285AEB" })
780
+ ] }) })
781
+ ] }),
782
+ className: "insforge-oauth-instagram"
783
+ },
784
+ tiktok: {
785
+ name: "TikTok",
786
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
787
+ "path",
788
+ {
789
+ d: "M19.589 6.686a4.793 4.793 0 01-3.77-4.245V2h-3.445v13.672a2.896 2.896 0 01-5.201 1.743l-.002-.001.002.001a2.895 2.895 0 013.183-4.51v-3.5a6.329 6.329 0 00-5.394 10.692 6.33 6.33 0 0010.857-4.424V8.687a8.182 8.182 0 004.773 1.526V6.79a4.831 4.831 0 01-1.003-.104z",
790
+ fill: "currentColor"
791
+ }
792
+ ) }),
793
+ className: "insforge-oauth-tiktok"
794
+ },
795
+ spotify: {
796
+ name: "Spotify",
797
+ svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
798
+ "path",
799
+ {
800
+ d: "M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z",
801
+ fill: "#1DB954"
802
+ }
803
+ ) }),
804
+ className: "insforge-oauth-spotify"
400
805
  }
401
806
  };
402
- function OAuthButton({ provider, onClick, disabled, loading }) {
403
- const config = providerConfig[provider];
807
+ function getProviderConfig(provider) {
808
+ return OAUTH_PROVIDER_CONFIG[provider] || null;
809
+ }
810
+ function getProviderName(provider) {
811
+ return OAUTH_PROVIDER_CONFIG[provider]?.name || provider;
812
+ }
813
+ function isProviderSupported(provider) {
814
+ return provider in OAUTH_PROVIDER_CONFIG;
815
+ }
816
+
817
+ // src/components/auth/AuthOAuthButton.tsx
818
+ var import_jsx_runtime13 = require("react/jsx-runtime");
819
+ function AuthOAuthButton({
820
+ provider,
821
+ onClick,
822
+ disabled,
823
+ loading,
824
+ displayMode = "full",
825
+ style
826
+ }) {
827
+ const config = getProviderConfig(provider);
404
828
  if (!config) {
405
829
  return null;
406
830
  }
407
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
831
+ const getButtonText = () => {
832
+ if (loading) return "Authenticating...";
833
+ if (displayMode === "full") return `Continue with ${config.name}`;
834
+ if (displayMode === "short") return config.name;
835
+ return "";
836
+ };
837
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
408
838
  "button",
409
839
  {
410
840
  type: "button",
@@ -412,21 +842,147 @@ function OAuthButton({ provider, onClick, disabled, loading }) {
412
842
  className: "insforge-oauth-btn",
413
843
  disabled: disabled || loading,
414
844
  "data-loading": loading || void 0,
845
+ "data-display-mode": displayMode,
846
+ style,
415
847
  children: [
416
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Loader2, { className: "insforge-oauth-loader", size: 18 }),
417
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "insforge-oauth-icon", children: config.svg }),
418
- loading ? "Authenticating..." : `Continue with ${config.name}`
848
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.Loader2, { className: "insforge-oauth-loader", size: 18 }),
849
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "insforge-oauth-icon", children: config.svg }),
850
+ getButtonText() && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "insforge-oauth-text", children: getButtonText() })
419
851
  ]
420
852
  }
421
853
  );
422
854
  }
423
855
 
856
+ // src/components/auth/AuthOAuthProviders.tsx
857
+ var import_jsx_runtime14 = require("react/jsx-runtime");
858
+ function AuthOAuthProviders({
859
+ providers,
860
+ onClick,
861
+ disabled,
862
+ loading
863
+ }) {
864
+ if (!providers || providers.length === 0) {
865
+ return null;
866
+ }
867
+ const count = providers.length;
868
+ const getDisplayMode = () => {
869
+ if (count === 1) return "full";
870
+ if (count === 2 || count === 4) return "short";
871
+ return "icon";
872
+ };
873
+ const getGridColumnStyle = (index) => {
874
+ if (count <= 4) {
875
+ return {};
876
+ }
877
+ const totalRows = Math.ceil(count / 3);
878
+ const lastRowStartIndex = (totalRows - 1) * 3;
879
+ const isInLastRow = index >= lastRowStartIndex;
880
+ if (!isInLastRow) {
881
+ return { gridColumn: "span 2" };
882
+ }
883
+ const positionInLastRow = index - lastRowStartIndex;
884
+ const itemsInLastRow = count - lastRowStartIndex;
885
+ if (itemsInLastRow === 1) {
886
+ return { gridColumn: "3 / 5" };
887
+ } else if (itemsInLastRow === 2) {
888
+ if (positionInLastRow === 0) {
889
+ return { gridColumn: "2 / 4" };
890
+ } else {
891
+ return { gridColumn: "4 / 6" };
892
+ }
893
+ } else {
894
+ return { gridColumn: "span 2" };
895
+ }
896
+ };
897
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "insforge-oauth-container", "data-provider-count": count, children: providers.map((provider, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
898
+ AuthOAuthButton,
899
+ {
900
+ provider,
901
+ onClick,
902
+ disabled,
903
+ loading: loading === provider,
904
+ displayMode: getDisplayMode(),
905
+ style: getGridColumnStyle(index)
906
+ },
907
+ provider
908
+ )) });
909
+ }
910
+
911
+ // src/components/auth/AuthVerificationCodeInput.tsx
912
+ var import_react3 = require("react");
913
+ var import_jsx_runtime15 = require("react/jsx-runtime");
914
+ function AuthVerificationCodeInput({
915
+ length = 6,
916
+ value,
917
+ email,
918
+ onChange,
919
+ disabled = false
920
+ }) {
921
+ const inputRefs = (0, import_react3.useRef)([]);
922
+ const handleChange = (index, digit) => {
923
+ if (digit.length > 1) return;
924
+ if (digit && !/^\d$/.test(digit)) return;
925
+ const newValue = value.split("");
926
+ newValue[index] = digit;
927
+ const updatedValue = newValue.join("");
928
+ onChange(updatedValue);
929
+ if (digit && index < length - 1) {
930
+ inputRefs.current[index + 1]?.focus();
931
+ }
932
+ };
933
+ const handleKeyDown = (index, e) => {
934
+ if (e.key === "Backspace") {
935
+ if (!value[index] && index > 0) {
936
+ inputRefs.current[index - 1]?.focus();
937
+ } else {
938
+ handleChange(index, "");
939
+ }
940
+ } else if (e.key === "ArrowLeft" && index > 0) {
941
+ inputRefs.current[index - 1]?.focus();
942
+ } else if (e.key === "ArrowRight" && index < length - 1) {
943
+ inputRefs.current[index + 1]?.focus();
944
+ }
945
+ };
946
+ const handlePaste = (e) => {
947
+ e.preventDefault();
948
+ const pastedData = e.clipboardData.getData("text/plain").trim();
949
+ if (/^\d+$/.test(pastedData) && pastedData.length === length) {
950
+ onChange(pastedData);
951
+ inputRefs.current[length - 1]?.focus();
952
+ }
953
+ };
954
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "insforge-verification-code-container", children: [
955
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "insforge-verification-instructions", children: [
956
+ "We've sent a verification code to your inbox at ",
957
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: email }),
958
+ ". Enter it below to proceed."
959
+ ] }),
960
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "insforge-verification-code-inputs", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
961
+ "input",
962
+ {
963
+ ref: (el) => {
964
+ inputRefs.current[index] = el;
965
+ },
966
+ type: "text",
967
+ inputMode: "numeric",
968
+ maxLength: 1,
969
+ value: value[index] || "",
970
+ onChange: (e) => handleChange(index, e.target.value),
971
+ onKeyDown: (e) => handleKeyDown(index, e),
972
+ onPaste: handlePaste,
973
+ disabled,
974
+ className: "insforge-verification-code-input",
975
+ autoComplete: "one-time-code"
976
+ },
977
+ index
978
+ )) })
979
+ ] });
980
+ }
981
+
424
982
  // src/components/SignIn.tsx
425
- var import_jsx_runtime4 = require("react/jsx-runtime");
983
+ var import_jsx_runtime16 = require("react/jsx-runtime");
426
984
  function SignIn({
427
- baseUrl,
428
985
  afterSignInUrl = "/",
429
- providers = [],
430
986
  appearance = {},
431
987
  title = "Welcome Back",
432
988
  subtitle = "Login to your account",
@@ -444,14 +1000,13 @@ function SignIn({
444
1000
  onSuccess,
445
1001
  onError
446
1002
  }) {
447
- const { signIn } = useAuth();
448
- const [email, setEmail] = (0, import_react3.useState)("");
449
- const [password, setPassword] = (0, import_react3.useState)("");
450
- const [error, setError] = (0, import_react3.useState)("");
451
- const [loading, setLoading] = (0, import_react3.useState)(false);
452
- const [showPassword, setShowPassword] = (0, import_react3.useState)(false);
453
- const [oauthLoading, setOauthLoading] = (0, import_react3.useState)(null);
454
- const insforge = (0, import_react3.useState)(() => (0, import_sdk2.createClient)({ baseUrl }))[0];
1003
+ const { signIn, oauthProviders, baseUrl } = useInsforge();
1004
+ const [email, setEmail] = (0, import_react4.useState)("");
1005
+ const [password, setPassword] = (0, import_react4.useState)("");
1006
+ const [error, setError] = (0, import_react4.useState)("");
1007
+ const [loading, setLoading] = (0, import_react4.useState)(false);
1008
+ const [oauthLoading, setOauthLoading] = (0, import_react4.useState)(null);
1009
+ const insforge = (0, import_react4.useState)(() => (0, import_sdk2.createClient)({ baseUrl }))[0];
455
1010
  async function handleSubmit(e) {
456
1011
  e.preventDefault();
457
1012
  setLoading(true);
@@ -480,9 +1035,7 @@ function SignIn({
480
1035
  provider,
481
1036
  redirectTo
482
1037
  });
483
- if (result.data?.url) {
484
- window.location.href = result.data.url;
485
- }
1038
+ console.log("handleOAuth result", result);
486
1039
  } catch (err) {
487
1040
  const errorMessage = err.message || `${provider} sign in failed`;
488
1041
  setError(errorMessage);
@@ -490,238 +1043,71 @@ function SignIn({
490
1043
  setOauthLoading(null);
491
1044
  }
492
1045
  }
493
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "insforge-auth-container", style: appearance.container, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-auth-card", style: appearance.form, children: [
494
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-auth-content", children: [
495
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-auth-header", children: [
496
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { className: "insforge-auth-title", children: title }),
497
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "insforge-auth-subtitle", children: subtitle })
498
- ] }),
499
- error && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-error-banner", children: [
500
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.AlertTriangle, { className: "insforge-error-icon" }),
501
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: error })
502
- ] }),
503
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { onSubmit: handleSubmit, className: "insforge-form", children: [
504
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-form-group", children: [
505
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: "email", className: "insforge-form-label", children: emailLabel }),
506
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
507
- "input",
508
- {
509
- id: "email",
510
- type: "email",
511
- className: "insforge-input",
512
- placeholder: emailPlaceholder,
513
- value: email,
514
- onChange: (e) => setEmail(e.target.value),
515
- required: true,
516
- autoComplete: "email"
517
- }
518
- )
519
- ] }),
520
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-form-group", children: [
521
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-form-label-row", children: [
522
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
523
- "label",
524
- {
525
- htmlFor: "password",
526
- className: "insforge-form-label",
527
- style: { margin: 0 },
528
- children: passwordLabel
529
- }
530
- ),
531
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: "#", className: "insforge-form-link", children: forgotPasswordText })
532
- ] }),
533
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-input-wrapper", children: [
534
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
535
- "input",
536
- {
537
- id: "password",
538
- type: showPassword ? "text" : "password",
539
- className: "insforge-input insforge-input-with-icon",
540
- placeholder: passwordPlaceholder,
541
- value: password,
542
- onChange: (e) => setPassword(e.target.value),
543
- required: true,
544
- autoComplete: "current-password"
545
- }
546
- ),
547
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
548
- "button",
549
- {
550
- type: "button",
551
- onClick: () => setShowPassword(!showPassword),
552
- className: "insforge-input-icon-btn",
553
- "aria-label": showPassword ? "Hide password" : "Show password",
554
- children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.EyeOff, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Eye, { size: 20 })
555
- }
556
- )
557
- ] })
558
- ] }),
559
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
560
- "button",
561
- {
562
- type: "submit",
563
- className: "insforge-btn-primary",
564
- style: appearance.button,
565
- disabled: loading || oauthLoading !== null,
566
- "data-loading": loading || void 0,
567
- children: [
568
- loading && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Loader2, { className: "insforge-btn-loader", size: 20 }),
569
- loading ? loadingButtonText : submitButtonText
570
- ]
1046
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(AuthContainer, { style: appearance.container, children: [
1047
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AuthHeader, { title, subtitle }),
1048
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AuthErrorBanner, { error }),
1049
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("form", { onSubmit: handleSubmit, className: "insforge-form", children: [
1050
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1051
+ AuthFormField,
1052
+ {
1053
+ id: "email",
1054
+ type: "email",
1055
+ label: emailLabel,
1056
+ placeholder: emailPlaceholder,
1057
+ value: email,
1058
+ onChange: (e) => setEmail(e.target.value),
1059
+ required: true,
1060
+ autoComplete: "email"
1061
+ }
1062
+ ),
1063
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1064
+ AuthPasswordField,
1065
+ {
1066
+ id: "password",
1067
+ label: passwordLabel,
1068
+ placeholder: passwordPlaceholder,
1069
+ value: password,
1070
+ onChange: (e) => setPassword(e.target.value),
1071
+ required: true,
1072
+ autoComplete: "current-password",
1073
+ forgotPasswordLink: {
1074
+ href: "#",
1075
+ text: forgotPasswordText
571
1076
  }
572
- )
573
- ] }),
574
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "insforge-text-center", children: [
575
- signUpText,
576
- " ",
577
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: signUpUrl, className: "insforge-link-primary", children: signUpLinkText })
578
- ] }),
579
- providers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
580
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "insforge-divider", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "insforge-divider-text", children: dividerText }) }),
581
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "insforge-oauth-container", children: providers.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
582
- OAuthButton,
583
- {
584
- provider,
585
- onClick: handleOAuth,
586
- disabled: loading || oauthLoading !== null,
587
- loading: oauthLoading === provider
588
- },
589
- provider
590
- )) })
591
- ] })
1077
+ }
1078
+ ),
1079
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1080
+ AuthSubmitButton,
1081
+ {
1082
+ isLoading: loading,
1083
+ disabled: loading || oauthLoading !== null,
1084
+ style: appearance.button,
1085
+ children: loading ? loadingButtonText : submitButtonText
1086
+ }
1087
+ )
592
1088
  ] }),
593
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "insforge-branding", children: [
594
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "insforge-branding-text", children: "Powered by" }),
595
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
596
- import_link.default,
1089
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AuthLink, { text: signUpText, linkText: signUpLinkText, href: signUpUrl }),
1090
+ oauthProviders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1091
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AuthDivider, { text: dividerText }),
1092
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1093
+ AuthOAuthProviders,
597
1094
  {
598
- href: "https://insforge.dev",
599
- target: "_blank",
600
- rel: "noopener noreferrer",
601
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
602
- "svg",
603
- {
604
- width: "83",
605
- height: "20",
606
- viewBox: "0 0 83 20",
607
- fill: "none",
608
- xmlns: "http://www.w3.org/2000/svg",
609
- children: [
610
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
611
- "path",
612
- {
613
- d: "M2.16783 8.46797C1.9334 8.23325 1.9334 7.85269 2.16783 7.61797L8.11049 1.66797L16.6 1.66797L6.41259 11.868C6.17815 12.1027 5.79807 12.1027 5.56363 11.868L2.16783 8.46797Z",
614
- fill: "url(#paint0_linear_2976_9475)"
615
- }
616
- ),
617
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
618
- "path",
619
- {
620
- d: "M12.8858 6.44922L16.6 10.168V18.668L8.64108 10.6992L12.8858 6.44922Z",
621
- fill: "url(#paint1_linear_2976_9475)"
622
- }
623
- ),
624
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
625
- "path",
626
- {
627
- d: "M67.5439 6.48828C68.2894 6.48828 68.9145 6.67064 69.418 7.03516C69.5229 7.10943 69.6214 7.1907 69.7158 7.27637V6.70703H71.248V14.959C71.248 15.1583 71.2381 15.3485 71.2188 15.5283C71.2042 15.7129 71.1774 15.8925 71.1387 16.0674C71.0225 16.5776 70.7998 16.9957 70.4707 17.3213C70.1415 17.6518 69.7321 17.8972 69.2432 18.0576C68.7592 18.2179 68.2222 18.2988 67.6318 18.2988C67.1962 18.2988 66.7768 18.2308 66.375 18.0947C65.9782 17.9587 65.6202 17.7614 65.3008 17.5039C64.9813 17.2512 64.7199 16.9446 64.5166 16.585L66.1289 15.7832C66.2789 16.0698 66.4888 16.2819 66.7598 16.418C67.0356 16.5589 67.3289 16.6289 67.6387 16.6289C68.0016 16.6289 68.3258 16.5628 68.6113 16.4316C68.8969 16.3053 69.1176 16.116 69.2725 15.8633C69.4321 15.6155 69.5077 15.3047 69.498 14.9307V14.1797C69.4665 14.2037 69.4359 14.229 69.4033 14.252C68.8855 14.6164 68.2441 14.7988 67.4795 14.7988C66.7582 14.7988 66.1281 14.6165 65.5908 14.252C65.0537 13.8875 64.637 13.3915 64.3418 12.7646C64.0467 12.1378 63.8994 11.4307 63.8994 10.6436C63.8994 9.84651 64.0465 9.13673 64.3418 8.51465C64.6419 7.88768 65.0663 7.39481 65.6133 7.03516C66.1601 6.67077 66.8036 6.48836 67.5439 6.48828ZM37.5 6.48828C38.1099 6.48828 38.6496 6.58294 39.1191 6.77246C39.5935 6.96201 39.9762 7.2321 40.2666 7.58203C40.5569 7.93184 40.7359 8.34227 40.8037 8.81348L39.0176 9.13477C38.974 8.79951 38.8218 8.53424 38.5605 8.33984C38.304 8.14547 37.96 8.03605 37.5293 8.01172C37.1178 7.98742 36.7859 8.05051 36.5342 8.20117C36.2825 8.34698 36.1562 8.55398 36.1562 8.82129C36.1563 8.97184 36.208 9.10017 36.3096 9.20703C36.4112 9.31394 36.614 9.42141 36.9189 9.52832C37.2288 9.63524 37.6889 9.76635 38.2988 9.92188C38.9232 10.0823 39.4222 10.2666 39.7949 10.4756C40.1722 10.6796 40.4428 10.9254 40.6074 11.2119C40.7768 11.4987 40.8623 11.8466 40.8623 12.2549C40.8623 13.047 40.574 13.6691 39.998 14.1211C39.4268 14.5731 38.6348 14.7988 37.623 14.7988C36.6551 14.7988 35.8687 14.5799 35.2637 14.1426C34.6587 13.7052 34.2909 13.0908 34.1602 12.2988L35.9463 12.0215C36.0383 12.4102 36.2411 12.7169 36.5557 12.9404C36.8703 13.164 37.2678 13.2754 37.7471 13.2754C38.1681 13.2754 38.4922 13.1926 38.7197 13.0273C38.9521 12.8572 39.0684 12.6266 39.0684 12.335C39.0684 12.1552 39.0245 12.0122 38.9375 11.9053C38.8552 11.7935 38.6713 11.686 38.3857 11.584C38.1001 11.4819 37.6618 11.3528 37.0713 11.1973C36.4131 11.0223 35.8901 10.8359 35.5029 10.6367C35.1158 10.4327 34.8374 10.192 34.668 9.91504C34.4985 9.63801 34.4141 9.30188 34.4141 8.9082C34.4141 8.41746 34.5423 7.98943 34.7988 7.625C35.0553 7.26073 35.4135 6.98146 35.873 6.78711C36.3329 6.58784 36.8755 6.48828 37.5 6.48828ZM53.3047 6.48828C54.0937 6.48828 54.7815 6.66572 55.3672 7.02051C55.9527 7.37528 56.4072 7.86634 56.7314 8.49316C57.0558 9.11525 57.2187 9.83193 57.2188 10.6436C57.2188 11.46 57.0537 12.1817 56.7246 12.8086C56.4003 13.4307 55.9451 13.9196 55.3594 14.2744C54.7737 14.6242 54.0888 14.7988 53.3047 14.7988C52.5205 14.7988 51.8357 14.6214 51.25 14.2666C50.6643 13.9118 50.2091 13.4238 49.8848 12.8018C49.5653 12.1748 49.4053 11.4552 49.4053 10.6436C49.4053 9.81735 49.5703 9.09279 49.8994 8.4707C50.2286 7.8488 50.6859 7.36255 51.2715 7.0127C51.8572 6.66281 52.5351 6.48828 53.3047 6.48828ZM76.7471 6.48828C77.5603 6.48828 78.25 6.68053 78.8164 7.06445C79.3876 7.44351 79.812 7.97991 80.0879 8.6748C80.3638 9.36976 80.4672 10.189 80.3994 11.1318H74.7256C74.7843 11.6972 74.949 12.1516 75.2227 12.4951C75.5711 12.9325 76.0792 13.1513 76.7471 13.1514C77.1779 13.1514 77.5486 13.0567 77.8584 12.8672C78.173 12.6728 78.4146 12.3928 78.584 12.0283L80.3125 12.5537C80.0124 13.2633 79.5473 13.8153 78.918 14.209C78.2936 14.6025 77.6036 14.7988 76.8486 14.7988C76.0549 14.7988 75.358 14.6263 74.7578 14.2812C74.1576 13.9362 73.6875 13.458 73.3486 12.8457C73.0147 12.2334 72.8477 11.5284 72.8477 10.7314C72.8477 9.87126 73.0127 9.12495 73.3418 8.49316C73.671 7.85651 74.1282 7.36263 74.7139 7.0127C75.2995 6.6628 75.9775 6.48832 76.7471 6.48828ZM23.3301 14.5801H21.5801V4.08203H23.3301V14.5801ZM29.6152 6.48047C30.1959 6.48052 30.6753 6.5781 31.0527 6.77246C31.4301 6.96681 31.7305 7.21443 31.9531 7.51562C32.1758 7.81695 32.3398 8.13831 32.4463 8.47852C32.5528 8.81873 32.6213 9.14205 32.6504 9.44824C32.6843 9.74946 32.7012 9.99508 32.7012 10.1846V14.5801H30.9287V10.7891C30.9287 10.5413 30.9118 10.2669 30.8779 9.96582C30.844 9.66449 30.7645 9.37469 30.6387 9.09766C30.5177 8.81592 30.3337 8.58503 30.0869 8.40527C29.8449 8.22551 29.5157 8.13579 29.0996 8.13574C28.8769 8.13574 28.6563 8.17221 28.4385 8.24512C28.2206 8.31802 28.0219 8.4442 27.8428 8.62402C27.6685 8.79899 27.5284 9.04249 27.4219 9.35352C27.3154 9.65965 27.2617 10.0532 27.2617 10.5342V14.5801H25.4902V6.70703H27.0518V7.58301C27.2521 7.34675 27.486 7.14172 27.7559 6.96973C28.2593 6.64409 28.8794 6.48047 29.6152 6.48047ZM48.748 5.83887H44.2021V8.45605H47.876V10.2061H44.2021V14.5801H42.4521V4.08203H48.748V5.83887ZM62.5137 6.67773C62.7606 6.65829 63.001 6.66815 63.2334 6.70703V8.34766C63.001 8.27961 62.7317 8.25695 62.4268 8.28125C62.1267 8.30557 61.8553 8.39134 61.6133 8.53711C61.3715 8.66829 61.1733 8.83606 61.0186 9.04004C60.8686 9.24404 60.7572 9.47701 60.6846 9.73926C60.612 9.99685 60.5752 10.2768 60.5752 10.5781V14.5801H58.8184V6.70703H60.3652V7.96582C60.4243 7.85986 60.4888 7.75824 60.5605 7.66211C60.7251 7.4434 60.9219 7.26302 61.1494 7.12207C61.3429 6.99098 61.5559 6.88926 61.7881 6.81641C62.0251 6.73869 62.267 6.69235 62.5137 6.67773ZM67.8057 8.0625C67.3362 8.06252 66.9485 8.17982 66.6436 8.41309C66.3389 8.64144 66.1139 8.95232 65.9688 9.3457C65.8235 9.7345 65.751 10.1673 65.751 10.6436C65.751 11.1247 65.8215 11.5624 65.9619 11.9561C66.1071 12.3447 66.3269 12.6535 66.6221 12.8818C66.9174 13.1103 67.293 13.2246 67.748 13.2246C68.2174 13.2246 68.5953 13.1171 68.8809 12.9033C69.1711 12.6846 69.3811 12.3808 69.5117 11.9922C69.6473 11.6034 69.7158 11.1539 69.7158 10.6436C69.7158 10.1284 69.6473 9.67886 69.5117 9.29492C69.381 8.90617 69.1753 8.60445 68.8945 8.39062C68.6138 8.17213 68.2508 8.0625 67.8057 8.0625ZM53.3047 8.13574C52.8351 8.13574 52.4475 8.24222 52.1426 8.45605C51.8425 8.66504 51.6198 8.95977 51.4746 9.33887C51.3295 9.71303 51.2568 10.148 51.2568 10.6436C51.2568 11.4066 51.4288 12.0168 51.7725 12.4736C52.121 12.9256 52.6318 13.1514 53.3047 13.1514C54.0017 13.1514 54.5196 12.9177 54.8584 12.4512C55.1971 11.9846 55.3672 11.3822 55.3672 10.6436C55.3672 9.8807 55.1951 9.27324 54.8516 8.82129C54.5079 8.36444 53.9921 8.13575 53.3047 8.13574ZM76.8203 8.02637C76.1039 8.02637 75.5712 8.25013 75.2227 8.69727C74.9987 8.98144 74.8476 9.35094 74.7676 9.80566H78.6221C78.5589 9.29301 78.4236 8.89686 78.2139 8.61719C77.9186 8.22359 77.4543 8.02645 76.8203 8.02637Z",
628
- fill: "black"
629
- }
630
- ),
631
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("defs", { children: [
632
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
633
- "linearGradient",
634
- {
635
- id: "paint0_linear_2976_9475",
636
- x1: "1.85883",
637
- y1: "1.92425",
638
- x2: "24.3072",
639
- y2: "9.64016",
640
- gradientUnits: "userSpaceOnUse",
641
- children: [
642
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("stop", {}),
643
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("stop", { offset: "1", stopOpacity: "0.4" })
644
- ]
645
- }
646
- ),
647
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
648
- "linearGradient",
649
- {
650
- id: "paint1_linear_2976_9475",
651
- x1: "25.6475",
652
- y1: "8.65468",
653
- x2: "10.7901",
654
- y2: "8.65468",
655
- gradientUnits: "userSpaceOnUse",
656
- children: [
657
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("stop", {}),
658
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("stop", { offset: "1", stopOpacity: "0.4" })
659
- ]
660
- }
661
- )
662
- ] })
663
- ]
664
- }
665
- )
1095
+ providers: oauthProviders,
1096
+ onClick: handleOAuth,
1097
+ disabled: loading || oauthLoading !== null,
1098
+ loading: oauthLoading
666
1099
  }
667
1100
  )
668
1101
  ] })
669
- ] }) });
1102
+ ] });
670
1103
  }
671
1104
 
672
1105
  // src/components/SignUp.tsx
673
- var import_react4 = require("react");
674
- var import_link2 = __toESM(require("next/link"));
1106
+ var import_react5 = require("react");
675
1107
  var import_sdk3 = require("@insforge/sdk");
676
- var import_lucide_react4 = require("lucide-react");
677
-
678
- // src/components/PasswordStrengthIndicator.tsx
679
- var import_lucide_react3 = require("lucide-react");
680
- var import_jsx_runtime5 = require("react/jsx-runtime");
681
- var requirements = [
682
- {
683
- label: "At least 1 Uppercase letter",
684
- test: (pwd) => /[A-Z]/.test(pwd)
685
- },
686
- {
687
- label: "At least 1 Number",
688
- test: (pwd) => /\d/.test(pwd)
689
- },
690
- {
691
- label: "Special character (e.g. !?<>@#$%)",
692
- test: (pwd) => /[!@#$%^&*()_+\-=[\]{};\\|,.<>/?]/.test(pwd)
693
- },
694
- {
695
- label: "8 characters or more",
696
- test: (pwd) => pwd.length >= 8
697
- }
698
- ];
699
- function validatePasswordStrength(password) {
700
- if (!password) return false;
701
- return requirements.every((req) => req.test(password));
702
- }
703
- function PasswordStrengthIndicator({ password }) {
704
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "insforge-password-strength", children: requirements.map((requirement, index) => {
705
- const isValid = requirement.test(password);
706
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "insforge-password-requirement", children: [
707
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
708
- "div",
709
- {
710
- className: `insforge-password-check ${isValid ? "insforge-password-check-valid" : ""}`,
711
- children: isValid && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Check, { className: "insforge-password-check-icon", size: 12 })
712
- }
713
- ),
714
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "insforge-password-requirement-label", children: requirement.label })
715
- ] }, index);
716
- }) });
717
- }
718
-
719
- // src/components/SignUp.tsx
720
- var import_jsx_runtime6 = require("react/jsx-runtime");
1108
+ var import_jsx_runtime17 = require("react/jsx-runtime");
721
1109
  function SignUp({
722
- baseUrl,
723
1110
  afterSignUpUrl = "/",
724
- providers = [],
725
1111
  appearance = {},
726
1112
  title = "Get Started",
727
1113
  subtitle = "Create account",
@@ -731,6 +1117,9 @@ function SignUp({
731
1117
  passwordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
732
1118
  submitButtonText = "Sign Up",
733
1119
  loadingButtonText = "Creating account...",
1120
+ verifyButtonText = "Continue",
1121
+ loadingVerifyButtonText = "Verifying...",
1122
+ verifiedButtonText = "Verified",
734
1123
  signInText = "Already have an account?",
735
1124
  signInLinkText = "Login Now",
736
1125
  signInUrl = "/sign-in",
@@ -738,16 +1127,19 @@ function SignUp({
738
1127
  onSuccess,
739
1128
  onError
740
1129
  }) {
741
- const { signUp } = useAuth();
742
- const [email, setEmail] = (0, import_react4.useState)("");
743
- const [password, setPassword] = (0, import_react4.useState)("");
744
- const [error, setError] = (0, import_react4.useState)("");
745
- const [loading, setLoading] = (0, import_react4.useState)(false);
746
- const [showPassword, setShowPassword] = (0, import_react4.useState)(false);
747
- const [oauthLoading, setOauthLoading] = (0, import_react4.useState)(null);
748
- const [showPasswordStrength, setShowPasswordStrength] = (0, import_react4.useState)(false);
749
- const insforge = (0, import_react4.useState)(() => (0, import_sdk3.createClient)({ baseUrl }))[0];
750
- async function handleSubmit(e) {
1130
+ const { sendVerificationCode, verifySignUpCode, oauthProviders, baseUrl } = useInsforge();
1131
+ const [email, setEmail] = (0, import_react5.useState)("");
1132
+ const [password, setPassword] = (0, import_react5.useState)("");
1133
+ const [verificationCode, setVerificationCode] = (0, import_react5.useState)("");
1134
+ const [error, setError] = (0, import_react5.useState)("");
1135
+ const [loading, setLoading] = (0, import_react5.useState)(false);
1136
+ const [oauthLoading, setOauthLoading] = (0, import_react5.useState)(null);
1137
+ const [verified, setVerified] = (0, import_react5.useState)(false);
1138
+ const [step, setStep] = (0, import_react5.useState)(
1139
+ "credentials"
1140
+ );
1141
+ const insforge = (0, import_react5.useState)(() => (0, import_sdk3.createClient)({ baseUrl }))[0];
1142
+ async function handleCredentialsSubmit(e) {
751
1143
  e.preventDefault();
752
1144
  setLoading(true);
753
1145
  setError("");
@@ -757,20 +1149,53 @@ function SignUp({
757
1149
  return;
758
1150
  }
759
1151
  try {
760
- await signUp(email, password);
1152
+ await sendVerificationCode(email, "signup");
1153
+ setStep("verification");
1154
+ } catch (err) {
1155
+ const errorMessage = err.message || "Failed to send verification code";
1156
+ setError(errorMessage);
1157
+ if (onError) onError(new Error(errorMessage));
1158
+ } finally {
1159
+ setLoading(false);
1160
+ }
1161
+ }
1162
+ async function handleVerificationSubmit(e) {
1163
+ e.preventDefault();
1164
+ setLoading(true);
1165
+ setError("");
1166
+ if (verificationCode.length !== 6) {
1167
+ setError("Please enter the complete verification code");
1168
+ setLoading(false);
1169
+ return;
1170
+ }
1171
+ try {
1172
+ await verifySignUpCode(email, password, verificationCode);
761
1173
  if (onSuccess) {
1174
+ setVerified(true);
762
1175
  const userResult = await insforge.auth.getCurrentUser();
763
1176
  if (userResult.data) onSuccess(userResult.data);
764
1177
  }
765
1178
  window.location.href = afterSignUpUrl;
766
1179
  } catch (err) {
767
- const errorMessage = err.message || "Sign up failed";
1180
+ const errorMessage = err.message || "Invalid verification code";
768
1181
  setError(errorMessage);
769
1182
  if (onError) onError(new Error(errorMessage));
770
1183
  } finally {
771
1184
  setLoading(false);
772
1185
  }
773
1186
  }
1187
+ async function handleResendCode() {
1188
+ setLoading(true);
1189
+ setError("");
1190
+ try {
1191
+ await sendVerificationCode(email, "signup");
1192
+ } catch (err) {
1193
+ const errorMessage = err.message || "Failed to resend code";
1194
+ setError(errorMessage);
1195
+ } finally {
1196
+ setLoading(false);
1197
+ }
1198
+ }
774
1199
  async function handleOAuth(provider) {
775
1200
  try {
776
1201
  setOauthLoading(provider);
@@ -790,188 +1215,124 @@ function SignUp({
790
1215
  setOauthLoading(null);
791
1216
  }
792
1217
  }
793
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "insforge-auth-container", style: appearance.container, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "insforge-auth-card", style: appearance.form, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "insforge-auth-content", children: [
794
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "insforge-auth-header", children: [
795
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { className: "insforge-auth-title", children: title }),
796
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "insforge-auth-subtitle", children: subtitle })
797
- ] }),
798
- error && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "insforge-error-banner", children: [
799
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.AlertTriangle, { className: "insforge-error-icon" }),
800
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: error })
801
- ] }),
802
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { onSubmit: handleSubmit, className: "insforge-form", children: [
803
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "insforge-form-group", children: [
804
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: "email", className: "insforge-form-label", children: emailLabel }),
805
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
806
- "input",
1218
+ if (step === "credentials") {
1219
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(AuthContainer, { style: appearance.container, children: [
1220
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthHeader, { title, subtitle }),
1221
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthErrorBanner, { error }),
1222
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("form", { onSubmit: handleCredentialsSubmit, className: "insforge-form", children: [
1223
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1224
+ AuthFormField,
807
1225
  {
808
1226
  id: "email",
809
1227
  type: "email",
810
- className: "insforge-input",
1228
+ label: emailLabel,
811
1229
  placeholder: emailPlaceholder,
812
1230
  value: email,
813
1231
  onChange: (e) => setEmail(e.target.value),
814
1232
  required: true,
815
1233
  autoComplete: "email"
816
1234
  }
1235
+ ),
1236
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1237
+ AuthPasswordField,
1238
+ {
1239
+ id: "password",
1240
+ label: passwordLabel,
1241
+ placeholder: passwordPlaceholder,
1242
+ value: password,
1243
+ onChange: (e) => setPassword(e.target.value),
1244
+ required: true,
1245
+ minLength: 8,
1246
+ autoComplete: "new-password",
1247
+ showStrengthIndicator: true
1248
+ }
1249
+ ),
1250
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1251
+ AuthSubmitButton,
1252
+ {
1253
+ isLoading: loading,
1254
+ disabled: loading || oauthLoading !== null,
1255
+ style: appearance.button,
1256
+ children: loading ? loadingButtonText : submitButtonText
1257
+ }
817
1258
  )
818
1259
  ] }),
819
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "insforge-form-group", children: [
820
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: "password", className: "insforge-form-label", children: passwordLabel }),
821
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "insforge-input-wrapper", children: [
822
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
823
- "input",
824
- {
825
- id: "password",
826
- type: showPassword ? "text" : "password",
827
- className: "insforge-input insforge-input-with-icon",
828
- placeholder: passwordPlaceholder,
829
- value: password,
830
- onChange: (e) => setPassword(e.target.value),
831
- onFocus: () => setShowPasswordStrength(true),
832
- required: true,
833
- minLength: 8,
834
- autoComplete: "new-password"
835
- }
836
- ),
837
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
838
- "button",
839
- {
840
- type: "button",
841
- onClick: () => setShowPassword(!showPassword),
842
- className: "insforge-input-icon-btn",
843
- "aria-label": showPassword ? "Hide password" : "Show password",
844
- children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.EyeOff, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Eye, { size: 20 })
845
- }
846
- )
847
- ] }),
848
- showPasswordStrength && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PasswordStrengthIndicator, { password })
849
- ] }),
850
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
851
- "button",
1260
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1261
+ AuthLink,
1262
+ {
1263
+ text: signInText,
1264
+ linkText: signInLinkText,
1265
+ href: signInUrl
1266
+ }
1267
+ ),
1268
+ oauthProviders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1269
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthDivider, { text: dividerText }),
1270
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1271
+ AuthOAuthProviders,
1272
+ {
1273
+ providers: oauthProviders,
1274
+ onClick: handleOAuth,
1275
+ disabled: loading || oauthLoading !== null,
1276
+ loading: oauthLoading
1277
+ }
1278
+ )
1279
+ ] })
1280
+ ] });
1281
+ }
1282
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(AuthContainer, { style: appearance.container, children: [
1283
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthHeader, { title, subtitle }),
1284
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthErrorBanner, { error }),
1285
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("form", { onSubmit: handleVerificationSubmit, className: "insforge-form", children: [
1286
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1287
+ AuthVerificationCodeInput,
1288
+ {
1289
+ email,
1290
+ value: verificationCode,
1291
+ onChange: setVerificationCode,
1292
+ disabled: loading
1293
+ }
1294
+ ),
1295
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1296
+ AuthSubmitButton,
852
1297
  {
853
- type: "submit",
854
- className: "insforge-btn-primary",
1298
+ isLoading: loading,
1299
+ disabled: loading,
855
1300
  style: appearance.button,
856
- disabled: loading || oauthLoading !== null,
857
- "data-loading": loading || void 0,
858
- children: [
859
- loading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Loader2, { className: "insforge-btn-loader", size: 20 }),
860
- loading ? loadingButtonText : submitButtonText
861
- ]
1301
+ confirmed: verified,
1302
+ children: verified ? verifiedButtonText : loading ? loadingVerifyButtonText : verifyButtonText
862
1303
  }
863
1304
  )
864
1305
  ] }),
865
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "insforge-text-center", children: [
866
- signInText,
1306
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "insforge-resend-code", children: [
1307
+ "Did not received the code?",
867
1308
  " ",
868
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: signInUrl, className: "insforge-link-primary", children: signInLinkText })
869
- ] }),
870
- providers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
871
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "insforge-divider", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "insforge-divider-text", children: dividerText }) }),
872
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "insforge-oauth-container", children: providers.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
873
- OAuthButton,
874
- {
875
- provider,
876
- onClick: handleOAuth,
877
- disabled: loading || oauthLoading !== null,
878
- loading: oauthLoading === provider
879
- },
880
- provider
881
- )) })
882
- ] }),
883
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "insforge-branding", children: [
884
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "insforge-branding-text", children: "Powered by" }),
885
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
886
- import_link2.default,
1309
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1310
+ "button",
887
1311
  {
888
- href: "https://insforge.dev",
889
- target: "_blank",
890
- rel: "noopener noreferrer",
891
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
892
- "svg",
893
- {
894
- width: "83",
895
- height: "20",
896
- viewBox: "0 0 83 20",
897
- fill: "none",
898
- xmlns: "http://www.w3.org/2000/svg",
899
- children: [
900
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
901
- "path",
902
- {
903
- d: "M2.16783 8.46797C1.9334 8.23325 1.9334 7.85269 2.16783 7.61797L8.11049 1.66797L16.6 1.66797L6.41259 11.868C6.17815 12.1027 5.79807 12.1027 5.56363 11.868L2.16783 8.46797Z",
904
- fill: "url(#paint0_linear_2976_9475)"
905
- }
906
- ),
907
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
908
- "path",
909
- {
910
- d: "M12.8858 6.44922L16.6 10.168V18.668L8.64108 10.6992L12.8858 6.44922Z",
911
- fill: "url(#paint1_linear_2976_9475)"
912
- }
913
- ),
914
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
915
- "path",
916
- {
917
- d: "M67.5439 6.48828C68.2894 6.48828 68.9145 6.67064 69.418 7.03516C69.5229 7.10943 69.6214 7.1907 69.7158 7.27637V6.70703H71.248V14.959C71.248 15.1583 71.2381 15.3485 71.2188 15.5283C71.2042 15.7129 71.1774 15.8925 71.1387 16.0674C71.0225 16.5776 70.7998 16.9957 70.4707 17.3213C70.1415 17.6518 69.7321 17.8972 69.2432 18.0576C68.7592 18.2179 68.2222 18.2988 67.6318 18.2988C67.1962 18.2988 66.7768 18.2308 66.375 18.0947C65.9782 17.9587 65.6202 17.7614 65.3008 17.5039C64.9813 17.2512 64.7199 16.9446 64.5166 16.585L66.1289 15.7832C66.2789 16.0698 66.4888 16.2819 66.7598 16.418C67.0356 16.5589 67.3289 16.6289 67.6387 16.6289C68.0016 16.6289 68.3258 16.5628 68.6113 16.4316C68.8969 16.3053 69.1176 16.116 69.2725 15.8633C69.4321 15.6155 69.5077 15.3047 69.498 14.9307V14.1797C69.4665 14.2037 69.4359 14.229 69.4033 14.252C68.8855 14.6164 68.2441 14.7988 67.4795 14.7988C66.7582 14.7988 66.1281 14.6165 65.5908 14.252C65.0537 13.8875 64.637 13.3915 64.3418 12.7646C64.0467 12.1378 63.8994 11.4307 63.8994 10.6436C63.8994 9.84651 64.0465 9.13673 64.3418 8.51465C64.6419 7.88768 65.0663 7.39481 65.6133 7.03516C66.1601 6.67077 66.8036 6.48836 67.5439 6.48828ZM37.5 6.48828C38.1099 6.48828 38.6496 6.58294 39.1191 6.77246C39.5935 6.96201 39.9762 7.2321 40.2666 7.58203C40.5569 7.93184 40.7359 8.34227 40.8037 8.81348L39.0176 9.13477C38.974 8.79951 38.8218 8.53424 38.5605 8.33984C38.304 8.14547 37.96 8.03605 37.5293 8.01172C37.1178 7.98742 36.7859 8.05051 36.5342 8.20117C36.2825 8.34698 36.1562 8.55398 36.1562 8.82129C36.1563 8.97184 36.208 9.10017 36.3096 9.20703C36.4112 9.31394 36.614 9.42141 36.9189 9.52832C37.2288 9.63524 37.6889 9.76635 38.2988 9.92188C38.9232 10.0823 39.4222 10.2666 39.7949 10.4756C40.1722 10.6796 40.4428 10.9254 40.6074 11.2119C40.7768 11.4987 40.8623 11.8466 40.8623 12.2549C40.8623 13.047 40.574 13.6691 39.998 14.1211C39.4268 14.5731 38.6348 14.7988 37.623 14.7988C36.6551 14.7988 35.8687 14.5799 35.2637 14.1426C34.6587 13.7052 34.2909 13.0908 34.1602 12.2988L35.9463 12.0215C36.0383 12.4102 36.2411 12.7169 36.5557 12.9404C36.8703 13.164 37.2678 13.2754 37.7471 13.2754C38.1681 13.2754 38.4922 13.1926 38.7197 13.0273C38.9521 12.8572 39.0684 12.6266 39.0684 12.335C39.0684 12.1552 39.0245 12.0122 38.9375 11.9053C38.8552 11.7935 38.6713 11.686 38.3857 11.584C38.1001 11.4819 37.6618 11.3528 37.0713 11.1973C36.4131 11.0223 35.8901 10.8359 35.5029 10.6367C35.1158 10.4327 34.8374 10.192 34.668 9.91504C34.4985 9.63801 34.4141 9.30188 34.4141 8.9082C34.4141 8.41746 34.5423 7.98943 34.7988 7.625C35.0553 7.26073 35.4135 6.98146 35.873 6.78711C36.3329 6.58784 36.8755 6.48828 37.5 6.48828ZM53.3047 6.48828C54.0937 6.48828 54.7815 6.66572 55.3672 7.02051C55.9527 7.37528 56.4072 7.86634 56.7314 8.49316C57.0558 9.11525 57.2187 9.83193 57.2188 10.6436C57.2188 11.46 57.0537 12.1817 56.7246 12.8086C56.4003 13.4307 55.9451 13.9196 55.3594 14.2744C54.7737 14.6242 54.0888 14.7988 53.3047 14.7988C52.5205 14.7988 51.8357 14.6214 51.25 14.2666C50.6643 13.9118 50.2091 13.4238 49.8848 12.8018C49.5653 12.1748 49.4053 11.4552 49.4053 10.6436C49.4053 9.81735 49.5703 9.09279 49.8994 8.4707C50.2286 7.8488 50.6859 7.36255 51.2715 7.0127C51.8572 6.66281 52.5351 6.48828 53.3047 6.48828ZM76.7471 6.48828C77.5603 6.48828 78.25 6.68053 78.8164 7.06445C79.3876 7.44351 79.812 7.97991 80.0879 8.6748C80.3638 9.36976 80.4672 10.189 80.3994 11.1318H74.7256C74.7843 11.6972 74.949 12.1516 75.2227 12.4951C75.5711 12.9325 76.0792 13.1513 76.7471 13.1514C77.1779 13.1514 77.5486 13.0567 77.8584 12.8672C78.173 12.6728 78.4146 12.3928 78.584 12.0283L80.3125 12.5537C80.0124 13.2633 79.5473 13.8153 78.918 14.209C78.2936 14.6025 77.6036 14.7988 76.8486 14.7988C76.0549 14.7988 75.358 14.6263 74.7578 14.2812C74.1576 13.9362 73.6875 13.458 73.3486 12.8457C73.0147 12.2334 72.8477 11.5284 72.8477 10.7314C72.8477 9.87126 73.0127 9.12495 73.3418 8.49316C73.671 7.85651 74.1282 7.36263 74.7139 7.0127C75.2995 6.6628 75.9775 6.48832 76.7471 6.48828ZM23.3301 14.5801H21.5801V4.08203H23.3301V14.5801ZM29.6152 6.48047C30.1959 6.48052 30.6753 6.5781 31.0527 6.77246C31.4301 6.96681 31.7305 7.21443 31.9531 7.51562C32.1758 7.81695 32.3398 8.13831 32.4463 8.47852C32.5528 8.81873 32.6213 9.14205 32.6504 9.44824C32.6843 9.74946 32.7012 9.99508 32.7012 10.1846V14.5801H30.9287V10.7891C30.9287 10.5413 30.9118 10.2669 30.8779 9.96582C30.844 9.66449 30.7645 9.37469 30.6387 9.09766C30.5177 8.81592 30.3337 8.58503 30.0869 8.40527C29.8449 8.22551 29.5157 8.13579 29.0996 8.13574C28.8769 8.13574 28.6563 8.17221 28.4385 8.24512C28.2206 8.31802 28.0219 8.4442 27.8428 8.62402C27.6685 8.79899 27.5284 9.04249 27.4219 9.35352C27.3154 9.65965 27.2617 10.0532 27.2617 10.5342V14.5801H25.4902V6.70703H27.0518V7.58301C27.2521 7.34675 27.486 7.14172 27.7559 6.96973C28.2593 6.64409 28.8794 6.48047 29.6152 6.48047ZM48.748 5.83887H44.2021V8.45605H47.876V10.2061H44.2021V14.5801H42.4521V4.08203H48.748V5.83887ZM62.5137 6.67773C62.7606 6.65829 63.001 6.66815 63.2334 6.70703V8.34766C63.001 8.27961 62.7317 8.25695 62.4268 8.28125C62.1267 8.30557 61.8553 8.39134 61.6133 8.53711C61.3715 8.66829 61.1733 8.83606 61.0186 9.04004C60.8686 9.24404 60.7572 9.47701 60.6846 9.73926C60.612 9.99685 60.5752 10.2768 60.5752 10.5781V14.5801H58.8184V6.70703H60.3652V7.96582C60.4243 7.85986 60.4888 7.75824 60.5605 7.66211C60.7251 7.4434 60.9219 7.26302 61.1494 7.12207C61.3429 6.99098 61.5559 6.88926 61.7881 6.81641C62.0251 6.73869 62.267 6.69235 62.5137 6.67773ZM67.8057 8.0625C67.3362 8.06252 66.9485 8.17982 66.6436 8.41309C66.3389 8.64144 66.1139 8.95232 65.9688 9.3457C65.8235 9.7345 65.751 10.1673 65.751 10.6436C65.751 11.1247 65.8215 11.5624 65.9619 11.9561C66.1071 12.3447 66.3269 12.6535 66.6221 12.8818C66.9174 13.1103 67.293 13.2246 67.748 13.2246C68.2174 13.2246 68.5953 13.1171 68.8809 12.9033C69.1711 12.6846 69.3811 12.3808 69.5117 11.9922C69.6473 11.6034 69.7158 11.1539 69.7158 10.6436C69.7158 10.1284 69.6473 9.67886 69.5117 9.29492C69.381 8.90617 69.1753 8.60445 68.8945 8.39062C68.6138 8.17213 68.2508 8.0625 67.8057 8.0625ZM53.3047 8.13574C52.8351 8.13574 52.4475 8.24222 52.1426 8.45605C51.8425 8.66504 51.6198 8.95977 51.4746 9.33887C51.3295 9.71303 51.2568 10.148 51.2568 10.6436C51.2568 11.4066 51.4288 12.0168 51.7725 12.4736C52.121 12.9256 52.6318 13.1514 53.3047 13.1514C54.0017 13.1514 54.5196 12.9177 54.8584 12.4512C55.1971 11.9846 55.3672 11.3822 55.3672 10.6436C55.3672 9.8807 55.1951 9.27324 54.8516 8.82129C54.5079 8.36444 53.9921 8.13575 53.3047 8.13574ZM76.8203 8.02637C76.1039 8.02637 75.5712 8.25013 75.2227 8.69727C74.9987 8.98144 74.8476 9.35094 74.7676 9.80566H78.6221C78.5589 9.29301 78.4236 8.89686 78.2139 8.61719C77.9186 8.22359 77.4543 8.02645 76.8203 8.02637Z",
918
- fill: "black"
919
- }
920
- ),
921
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("defs", { children: [
922
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
923
- "linearGradient",
924
- {
925
- id: "paint0_linear_2976_9475",
926
- x1: "1.85883",
927
- y1: "1.92425",
928
- x2: "24.3072",
929
- y2: "9.64016",
930
- gradientUnits: "userSpaceOnUse",
931
- children: [
932
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", {}),
933
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", { offset: "1", stopOpacity: "0.4" })
934
- ]
935
- }
936
- ),
937
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
938
- "linearGradient",
939
- {
940
- id: "paint1_linear_2976_9475",
941
- x1: "25.6475",
942
- y1: "8.65468",
943
- x2: "10.7901",
944
- y2: "8.65468",
945
- gradientUnits: "userSpaceOnUse",
946
- children: [
947
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", {}),
948
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", { offset: "1", stopOpacity: "0.4" })
949
- ]
950
- }
951
- )
952
- ] })
953
- ]
954
- }
955
- )
1312
+ type: "button",
1313
+ onClick: handleResendCode,
1314
+ disabled: loading,
1315
+ className: "insforge-resend-link",
1316
+ children: "Click to resend"
956
1317
  }
957
1318
  )
958
1319
  ] })
959
- ] }) }) });
1320
+ ] });
960
1321
  }
961
1322
 
962
1323
  // src/components/UserButton.tsx
963
- var import_react5 = require("react");
964
- var import_lucide_react5 = require("lucide-react");
965
- var import_jsx_runtime7 = require("react/jsx-runtime");
1324
+ var import_react6 = require("react");
1325
+ var import_lucide_react6 = require("lucide-react");
1326
+ var import_jsx_runtime18 = require("react/jsx-runtime");
966
1327
  function UserButton({
967
1328
  afterSignOutUrl = "/",
968
1329
  mode = "detailed",
969
1330
  appearance = {}
970
1331
  }) {
971
- const { user, signOut } = useAuth();
972
- const [isOpen, setIsOpen] = (0, import_react5.useState)(false);
973
- const dropdownRef = (0, import_react5.useRef)(null);
974
- (0, import_react5.useEffect)(() => {
1332
+ const { user, signOut } = useInsforge();
1333
+ const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
1334
+ const dropdownRef = (0, import_react6.useRef)(null);
1335
+ (0, import_react6.useEffect)(() => {
975
1336
  function handleClickOutside(event) {
976
1337
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
977
1338
  setIsOpen(false);
@@ -992,8 +1353,8 @@ function UserButton({
992
1353
  if (!user) return null;
993
1354
  const initials = user.nickname ? user.nickname.charAt(0).toUpperCase() : user.email.split("@")[0].slice(0, 2).toUpperCase();
994
1355
  const avatarUrl = user.avatar_url;
995
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "insforge-user-button-container", ref: dropdownRef, children: [
996
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1356
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "insforge-user-button-container", ref: dropdownRef, children: [
1357
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
997
1358
  "button",
998
1359
  {
999
1360
  className: `insforge-user-button ${mode === "detailed" ? "insforge-user-button-detailed" : ""}`,
@@ -1002,52 +1363,52 @@ function UserButton({
1002
1363
  "aria-expanded": isOpen,
1003
1364
  "aria-haspopup": "true",
1004
1365
  children: [
1005
- avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: avatarUrl, alt: user.email, className: "insforge-user-avatar" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "insforge-user-avatar-placeholder", children: initials }),
1006
- mode === "detailed" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "insforge-user-button-info", children: [
1007
- user.nickname && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "insforge-user-button-name", children: user.nickname }),
1008
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "insforge-user-button-email", children: user.email })
1366
+ avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: avatarUrl, alt: user.email, className: "insforge-user-avatar" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "insforge-user-avatar-placeholder", children: initials }),
1367
+ mode === "detailed" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "insforge-user-button-info", children: [
1368
+ user.nickname && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "insforge-user-button-name", children: user.nickname }),
1369
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "insforge-user-button-email", children: user.email })
1009
1370
  ] })
1010
1371
  ]
1011
1372
  }
1012
1373
  ),
1013
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "insforge-user-dropdown", style: appearance.dropdown, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { onClick: handleSignOut, className: "insforge-sign-out-button", children: [
1014
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.LogOut, { className: "w-5 h-5" }),
1374
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "insforge-user-dropdown", style: appearance.dropdown, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("button", { onClick: handleSignOut, className: "insforge-sign-out-button", children: [
1375
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.LogOut, { className: "w-5 h-5" }),
1015
1376
  "Sign out"
1016
1377
  ] }) })
1017
1378
  ] });
1018
1379
  }
1019
1380
 
1020
1381
  // src/components/SignedIn.tsx
1021
- var import_jsx_runtime8 = require("react/jsx-runtime");
1382
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1022
1383
  function SignedIn({ children }) {
1023
- const { isSignedIn, isLoaded } = useAuth();
1384
+ const { isSignedIn, isLoaded } = useInsforge();
1024
1385
  if (!isLoaded) return null;
1025
1386
  if (!isSignedIn) return null;
1026
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
1387
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
1027
1388
  }
1028
1389
 
1029
1390
  // src/components/SignedOut.tsx
1030
- var import_jsx_runtime9 = require("react/jsx-runtime");
1391
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1031
1392
  function SignedOut({ children }) {
1032
- const { isSignedIn, isLoaded } = useAuth();
1393
+ const { isSignedIn, isLoaded } = useInsforge();
1033
1394
  if (!isLoaded) return null;
1034
1395
  if (isSignedIn) return null;
1035
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children });
1396
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
1036
1397
  }
1037
1398
 
1038
1399
  // src/components/Protect.tsx
1039
- var import_react6 = require("react");
1400
+ var import_react7 = require("react");
1040
1401
  var import_navigation = require("next/navigation");
1041
- var import_jsx_runtime10 = require("react/jsx-runtime");
1402
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1042
1403
  function Protect({
1043
1404
  children,
1044
1405
  fallback,
1045
1406
  redirectTo = "/sign-in",
1046
1407
  condition
1047
1408
  }) {
1048
- const { isSignedIn, isLoaded, user } = useAuth();
1409
+ const { isSignedIn, isLoaded, user } = useInsforge();
1049
1410
  const router = (0, import_navigation.useRouter)();
1050
- (0, import_react6.useEffect)(() => {
1411
+ (0, import_react7.useEffect)(() => {
1051
1412
  if (isLoaded && !isSignedIn) {
1052
1413
  router.push(redirectTo);
1053
1414
  } else if (isLoaded && isSignedIn && condition && user) {
@@ -1057,7 +1418,7 @@ function Protect({
1057
1418
  }
1058
1419
  }, [isLoaded, isSignedIn, redirectTo, router, condition, user]);
1059
1420
  if (!isLoaded) {
1060
- return fallback || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "insforge-loading", children: "Loading..." });
1421
+ return fallback || /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "insforge-loading", children: "Loading..." });
1061
1422
  }
1062
1423
  if (!isSignedIn) {
1063
1424
  return fallback || null;
@@ -1065,22 +1426,39 @@ function Protect({
1065
1426
  if (condition && user && !condition(user)) {
1066
1427
  return fallback || null;
1067
1428
  }
1068
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children });
1429
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
1069
1430
  }
1070
1431
  // Annotate the CommonJS export names for ESM import in node:
1071
1432
  0 && (module.exports = {
1072
- AuthProvider,
1073
- InsforgeConfigProvider,
1433
+ AuthBranding,
1434
+ AuthContainer,
1435
+ AuthDivider,
1436
+ AuthErrorBanner,
1437
+ AuthFormField,
1438
+ AuthHeader,
1439
+ AuthLink,
1440
+ AuthOAuthButton,
1441
+ AuthOAuthProviders,
1442
+ AuthPasswordField,
1443
+ AuthPasswordStrengthIndicator,
1444
+ AuthSubmitButton,
1445
+ AuthVerificationCodeInput,
1446
+ InsforgeProvider,
1447
+ OAUTH_PROVIDER_CONFIG,
1074
1448
  Protect,
1075
1449
  SignIn,
1076
1450
  SignUp,
1077
1451
  SignedIn,
1078
1452
  SignedOut,
1079
1453
  UserButton,
1454
+ getProviderConfig,
1455
+ getProviderName,
1456
+ isProviderSupported,
1080
1457
  useAuth,
1081
- useInsforgeConfig,
1458
+ useInsforge,
1082
1459
  useOAuthProviders,
1083
1460
  useSession,
1084
- useUser
1461
+ useUser,
1462
+ validatePasswordStrength
1085
1463
  });
1086
1464
  //# sourceMappingURL=index.js.map