@thetechfossil/auth2 1.2.21 → 1.2.22

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.
@@ -12,12 +12,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
  var axios__default = /*#__PURE__*/_interopDefault(axios);
13
13
  var React__default = /*#__PURE__*/_interopDefault(React);
14
14
 
15
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
16
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
17
- }) : x)(function(x) {
18
- if (typeof require !== "undefined") return require.apply(this, arguments);
19
- throw Error('Dynamic require of "' + x + '" is not supported');
20
- });
21
15
  var ERROR_MESSAGES = {
22
16
  NETWORK_ERROR: "Unable to connect to the server. Please check your internet connection and try again.",
23
17
  TIMEOUT: "The request took too long. Please try again.",
@@ -347,6 +341,7 @@ var AuthService = class {
347
341
  if (token) {
348
342
  this.token = token;
349
343
  this.httpClient.setAuthToken(token);
344
+ this.setTokenCookie(token);
350
345
  }
351
346
  } catch (error) {
352
347
  console.warn("Failed to load token from storage:", error);
@@ -357,15 +352,28 @@ var AuthService = class {
357
352
  if (typeof window !== "undefined" && this.config.localStorageKey) {
358
353
  try {
359
354
  localStorage.setItem(this.config.localStorageKey, token);
355
+ this.setTokenCookie(token);
360
356
  } catch (error) {
361
357
  console.warn("Failed to save token to storage:", error);
362
358
  }
363
359
  }
364
360
  }
361
+ setTokenCookie(token) {
362
+ if (typeof window !== "undefined") {
363
+ const maxAge = 7 * 24 * 60 * 60;
364
+ document.cookie = `auth_token=${token}; path=/; max-age=${maxAge}; SameSite=Lax`;
365
+ }
366
+ }
367
+ removeTokenCookie() {
368
+ if (typeof window !== "undefined") {
369
+ document.cookie = "auth_token=; path=/; max-age=0; SameSite=Lax";
370
+ }
371
+ }
365
372
  removeTokenFromStorage() {
366
373
  if (typeof window !== "undefined" && this.config.localStorageKey) {
367
374
  try {
368
375
  localStorage.removeItem(this.config.localStorageKey);
376
+ this.removeTokenCookie();
369
377
  } catch (error) {
370
378
  console.warn("Failed to remove token from storage:", error);
371
379
  }
@@ -1344,14 +1352,6 @@ function useThemeColors() {
1344
1352
  const { theme } = useAuthTheme();
1345
1353
  return theme === "dark" ? darkTheme : lightTheme;
1346
1354
  }
1347
- var PhoneInputWithCountry = null;
1348
- try {
1349
- const module = __require("react-phone-number-input");
1350
- PhoneInputWithCountry = module.default || module;
1351
- __require("react-phone-number-input/style.css");
1352
- } catch (error) {
1353
- console.warn("react-phone-number-input not available, using fallback");
1354
- }
1355
1355
  var CustomPhoneInput = React__default.default.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1356
1356
  "input",
1357
1357
  {
@@ -1372,6 +1372,8 @@ var PhoneInput = ({
1372
1372
  }) => {
1373
1373
  const colors = useThemeColors();
1374
1374
  const [defaultCountry, setDefaultCountry] = React.useState("US");
1375
+ const [PhoneInputComponent, setPhoneInputComponent] = React.useState(null);
1376
+ const [isLoading, setIsLoading] = React.useState(true);
1375
1377
  const styleContent = React.useMemo(() => `
1376
1378
  .PhoneInput {
1377
1379
  display: flex;
@@ -1484,6 +1486,29 @@ var PhoneInput = ({
1484
1486
  opacity: 0.6;
1485
1487
  }
1486
1488
  `, [colors]);
1489
+ React.useEffect(() => {
1490
+ let mounted = true;
1491
+ const loadPhoneInput = async () => {
1492
+ try {
1493
+ const module = await import('react-phone-number-input');
1494
+ if (mounted) {
1495
+ setPhoneInputComponent(() => module.default);
1496
+ }
1497
+ } catch (error) {
1498
+ if (mounted) {
1499
+ setPhoneInputComponent(null);
1500
+ }
1501
+ } finally {
1502
+ if (mounted) {
1503
+ setIsLoading(false);
1504
+ }
1505
+ }
1506
+ };
1507
+ loadPhoneInput();
1508
+ return () => {
1509
+ mounted = false;
1510
+ };
1511
+ }, []);
1487
1512
  React.useEffect(() => {
1488
1513
  const detectCountry = async () => {
1489
1514
  try {
@@ -1536,7 +1561,6 @@ var PhoneInput = ({
1536
1561
  }
1537
1562
  }
1538
1563
  } catch (error) {
1539
- console.log("Country detection failed, using default US");
1540
1564
  }
1541
1565
  };
1542
1566
  detectCountry();
@@ -1544,7 +1568,31 @@ var PhoneInput = ({
1544
1568
  const handleChange = React.useMemo(() => (val) => {
1545
1569
  onChange(val || "");
1546
1570
  }, [onChange]);
1547
- if (!PhoneInputWithCountry) {
1571
+ if (isLoading) {
1572
+ return /* @__PURE__ */ jsxRuntime.jsx(
1573
+ "input",
1574
+ {
1575
+ id,
1576
+ type: "tel",
1577
+ value,
1578
+ onChange: (e) => onChange(e.target.value),
1579
+ disabled,
1580
+ required,
1581
+ placeholder,
1582
+ style: {
1583
+ width: "100%",
1584
+ padding: "12px 16px",
1585
+ border: `1px solid ${colors.borderSecondary}`,
1586
+ borderRadius: "8px",
1587
+ fontSize: "16px",
1588
+ backgroundColor: colors.bgSecondary,
1589
+ color: colors.textPrimary,
1590
+ ...style
1591
+ }
1592
+ }
1593
+ );
1594
+ }
1595
+ if (!PhoneInputComponent) {
1548
1596
  return /* @__PURE__ */ jsxRuntime.jsx(
1549
1597
  "input",
1550
1598
  {
@@ -1578,7 +1626,7 @@ var PhoneInput = ({
1578
1626
  children: [
1579
1627
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: styleContent }),
1580
1628
  /* @__PURE__ */ jsxRuntime.jsx(
1581
- PhoneInputWithCountry,
1629
+ PhoneInputComponent,
1582
1630
  {
1583
1631
  id,
1584
1632
  international: true,
@@ -2076,6 +2124,28 @@ var RegisterForm = ({
2076
2124
  const [error, setError] = React.useState(null);
2077
2125
  const [showPassword, setShowPassword] = React.useState(false);
2078
2126
  const [showConfirmPassword, setShowConfirmPassword] = React.useState(false);
2127
+ const [invitationDetails, setInvitationDetails] = React.useState(null);
2128
+ const [isLoadingInvitation, setIsLoadingInvitation] = React.useState(false);
2129
+ const config = authConfig || {
2130
+ baseUrl: "http://localhost:7000"
2131
+ };
2132
+ React.useEffect(() => {
2133
+ if (invitationToken) {
2134
+ setIsLoadingInvitation(true);
2135
+ fetch(`${config.baseUrl}/api/v1/auth/verify-invitation/${invitationToken}`).then((res) => res.json()).then((data) => {
2136
+ setInvitationDetails(data);
2137
+ if (data.valid && data.email) {
2138
+ setEmail(data.email);
2139
+ }
2140
+ }).catch((err) => {
2141
+ console.error("Failed to verify invitation:", err);
2142
+ setError("Failed to verify invitation. Please try again.");
2143
+ }).finally(() => {
2144
+ setIsLoadingInvitation(false);
2145
+ });
2146
+ }
2147
+ }, [invitationToken, config.baseUrl]);
2148
+ const isEmailDisabled = isLoading || invitationDetails?.valid && !!invitationDetails?.email;
2079
2149
  const getPasswordStrength = (pwd) => {
2080
2150
  if (!pwd) return { strength: "weak", score: 0, label: "" };
2081
2151
  let score = 0;
@@ -2089,9 +2159,6 @@ var RegisterForm = ({
2089
2159
  return { strength: "strong", score, label: "Strong" };
2090
2160
  };
2091
2161
  getPasswordStrength(password);
2092
- const config = authConfig || {
2093
- baseUrl: "http://localhost:7000"
2094
- };
2095
2162
  const { register } = useAuth(config);
2096
2163
  const handleSubmit = async (e) => {
2097
2164
  e.preventDefault();
@@ -2126,6 +2193,25 @@ var RegisterForm = ({
2126
2193
  if (response.ok && data.success) {
2127
2194
  if (typeof window !== "undefined" && data.token) {
2128
2195
  localStorage.setItem("auth_token", data.token);
2196
+ if (data.invitation?.organizationId && data.invitation?.role) {
2197
+ localStorage.setItem("currentOrganizationId", data.invitation.organizationId);
2198
+ const backendUrl = typeof window !== "undefined" ? process.env.NEXT_PUBLIC_INVENTORY_API_URL || process.env.NEXT_PUBLIC_BIZFLOW_API_URL || "http://localhost:5002" : "http://localhost:5002";
2199
+ try {
2200
+ await fetch(`${backendUrl}/api/auth/sync-with-role`, {
2201
+ method: "POST",
2202
+ headers: {
2203
+ "Content-Type": "application/json",
2204
+ "Authorization": `Bearer ${data.token}`
2205
+ },
2206
+ body: JSON.stringify({
2207
+ organizationId: data.invitation.organizationId,
2208
+ roleName: data.invitation.role
2209
+ })
2210
+ });
2211
+ } catch (syncError) {
2212
+ console.error("Failed to sync user role with backend:", syncError);
2213
+ }
2214
+ }
2129
2215
  }
2130
2216
  onRegisterSuccess?.();
2131
2217
  } else {
@@ -2233,7 +2319,7 @@ var RegisterForm = ({
2233
2319
  value: email,
2234
2320
  onChange: (e) => setEmail(e.target.value),
2235
2321
  required: !phoneNumber,
2236
- disabled: isLoading,
2322
+ disabled: isEmailDisabled,
2237
2323
  style: {
2238
2324
  width: "100%",
2239
2325
  padding: "12px 16px",
@@ -2241,9 +2327,11 @@ var RegisterForm = ({
2241
2327
  borderRadius: "8px",
2242
2328
  fontSize: "16px",
2243
2329
  boxSizing: "border-box",
2244
- color: colors.textPrimary,
2330
+ color: isEmailDisabled ? colors.textSecondary : colors.textPrimary,
2245
2331
  transition: "all 0.2s ease",
2246
- backgroundColor: colors.bgSecondary
2332
+ backgroundColor: isEmailDisabled ? colors.bgHover : colors.bgSecondary,
2333
+ cursor: isEmailDisabled ? "not-allowed" : "text",
2334
+ opacity: isEmailDisabled ? 0.7 : 1
2247
2335
  },
2248
2336
  placeholder: "Enter your email"
2249
2337
  }
@@ -2946,7 +3034,7 @@ var EmailVerificationPage = ({
2946
3034
  } })
2947
3035
  ] }) });
2948
3036
  }
2949
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
3037
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
2950
3038
  maxWidth: "500px",
2951
3039
  margin: "0 auto",
2952
3040
  padding: "30px",
@@ -2955,44 +3043,86 @@ var EmailVerificationPage = ({
2955
3043
  backgroundColor: "#ffffff",
2956
3044
  textAlign: "center",
2957
3045
  border: "1px solid #eaeaea"
2958
- }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
2959
- padding: "20px"
2960
3046
  }, children: [
2961
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { color: "black" }, children: "Email Verification" }),
2962
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
2963
- padding: "16px 20px",
2964
- margin: "24px 0",
2965
- borderRadius: "8px",
2966
- fontSize: "15px",
2967
- fontWeight: 500,
2968
- backgroundColor: isSuccess ? "#d4edda" : "#f8d7da",
2969
- color: isSuccess ? "#155724" : "#721c24",
2970
- border: isSuccess ? "1px solid #c3e6cb" : "1px solid #f5c6cb"
2971
- }, children: message }),
2972
- isSuccess && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
2973
- marginTop: "24px"
3047
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
3048
+ padding: "20px"
2974
3049
  }, children: [
2975
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "black" }, children: "Your email has been successfully verified!" }),
2976
- /* @__PURE__ */ jsxRuntime.jsx(
2977
- "button",
2978
- {
2979
- onClick: () => window.location.href = "/login",
2980
- style: {
2981
- padding: "12px 24px",
2982
- backgroundColor: "#007bff",
2983
- color: "white",
2984
- border: "none",
2985
- borderRadius: "8px",
2986
- fontSize: "16px",
2987
- fontWeight: 600,
2988
- cursor: "pointer",
2989
- transition: "all 0.2s ease"
2990
- },
2991
- children: "Go to Login"
3050
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { color: "black" }, children: isSuccess ? "\u2713 Email Verified!" : "\u2717 Verification Failed" }),
3051
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
3052
+ padding: "16px 20px",
3053
+ margin: "24px 0",
3054
+ borderRadius: "8px",
3055
+ fontSize: "15px",
3056
+ fontWeight: 500,
3057
+ backgroundColor: isSuccess ? "#d4edda" : "#f8d7da",
3058
+ color: isSuccess ? "#155724" : "#721c24",
3059
+ border: isSuccess ? "1px solid #c3e6cb" : "1px solid #f5c6cb"
3060
+ }, children: message }),
3061
+ isSuccess ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginTop: "24px" }, children: [
3062
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "#666", marginBottom: "16px" }, children: "Redirecting to login..." }),
3063
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
3064
+ border: "3px solid #d4edda",
3065
+ borderTop: "3px solid #28a745",
3066
+ borderRadius: "50%",
3067
+ width: "30px",
3068
+ height: "30px",
3069
+ animation: "spin 1s linear infinite",
3070
+ margin: "0 auto"
3071
+ } })
3072
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginTop: "24px" }, children: [
3073
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "#666", marginBottom: "16px" }, children: "The verification link may have expired or already been used." }),
3074
+ /* @__PURE__ */ jsxRuntime.jsx(
3075
+ "button",
3076
+ {
3077
+ onClick: () => {
3078
+ const registerPath = process.env.NEXT_PUBLIC_AUTH_REDIRECT_TO_REGISTER || process.env.REACT_APP_AUTH_REDIRECT_TO_REGISTER || "/auth/register";
3079
+ window.location.href = registerPath;
3080
+ },
3081
+ style: {
3082
+ padding: "12px 24px",
3083
+ backgroundColor: "#007bff",
3084
+ color: "white",
3085
+ border: "none",
3086
+ borderRadius: "8px",
3087
+ fontSize: "16px",
3088
+ fontWeight: 600,
3089
+ cursor: "pointer",
3090
+ transition: "all 0.2s ease",
3091
+ marginRight: "12px"
3092
+ },
3093
+ children: "Register Again"
3094
+ }
3095
+ ),
3096
+ /* @__PURE__ */ jsxRuntime.jsx(
3097
+ "button",
3098
+ {
3099
+ onClick: () => {
3100
+ const loginPath = process.env.NEXT_PUBLIC_AUTH_REDIRECT_TO_LOGIN || process.env.REACT_APP_AUTH_REDIRECT_TO_LOGIN || "/auth/login";
3101
+ window.location.href = loginPath;
3102
+ },
3103
+ style: {
3104
+ padding: "12px 24px",
3105
+ backgroundColor: "#6c757d",
3106
+ color: "white",
3107
+ border: "none",
3108
+ borderRadius: "8px",
3109
+ fontSize: "16px",
3110
+ fontWeight: 600,
3111
+ cursor: "pointer",
3112
+ transition: "all 0.2s ease"
3113
+ },
3114
+ children: "Go to Login"
3115
+ }
3116
+ )
3117
+ ] })
3118
+ ] }),
3119
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
3120
+ @keyframes spin {
3121
+ 0% { transform: rotate(0deg); }
3122
+ 100% { transform: rotate(360deg); }
2992
3123
  }
2993
- )
2994
- ] })
2995
- ] }) });
3124
+ ` })
3125
+ ] });
2996
3126
  };
2997
3127
  var ThemeWrapper = React.forwardRef(
2998
3128
  ({ children, className = "", style }, ref) => {
@@ -5203,6 +5333,274 @@ var UserProfile = ({
5203
5333
  ] })
5204
5334
  ] });
5205
5335
  };
5336
+ var SuperAdminSignIn = ({ redirectUrl, appearance }) => {
5337
+ const { signIn, isSignedIn, loading: authLoading, user } = useAuth2();
5338
+ const colors = useThemeColors();
5339
+ const [email, setEmail] = React.useState("");
5340
+ const [password, setPassword] = React.useState("");
5341
+ const [showPassword, setShowPassword] = React.useState(false);
5342
+ const [isLoading, setIsLoading] = React.useState(false);
5343
+ const [error, setError] = React.useState(null);
5344
+ const [success, setSuccess] = React.useState(null);
5345
+ React.useEffect(() => {
5346
+ if (isSignedIn && user) {
5347
+ const isSuperAdmin = user.role === "SUPER_ADMIN" || user.role === "SUPERADMIN";
5348
+ if (isSuperAdmin) {
5349
+ const redirect = redirectUrl || process.env.NEXT_PUBLIC_AUTH_REDIRECT_AFTER_LOGIN || process.env.REACT_APP_AUTH_REDIRECT_AFTER_LOGIN || "/dashboard";
5350
+ const baseUrl = process.env.NEXT_PUBLIC_FRONTEND_BASE_URL || process.env.REACT_APP_FRONTEND_BASE_URL || (typeof window !== "undefined" ? window.location.origin : "");
5351
+ window.location.href = `${baseUrl}${redirect}`;
5352
+ } else {
5353
+ setError("Access denied. Only Super Admin users can access this portal.");
5354
+ document.cookie = "auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";
5355
+ document.cookie = "refresh_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";
5356
+ }
5357
+ }
5358
+ }, [isSignedIn, user, redirectUrl]);
5359
+ const handleSubmit = async (e) => {
5360
+ e.preventDefault();
5361
+ setIsLoading(true);
5362
+ setError(null);
5363
+ setSuccess(null);
5364
+ try {
5365
+ const response = await signIn({ email, password });
5366
+ if (response.success) {
5367
+ const userRole = response.user?.role;
5368
+ const isSuperAdmin = userRole === "SUPER_ADMIN" || userRole === "SUPERADMIN";
5369
+ if (!isSuperAdmin) {
5370
+ document.cookie = "auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";
5371
+ document.cookie = "refresh_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";
5372
+ setError("Access denied. Only Super Admin users can access this portal.");
5373
+ return;
5374
+ }
5375
+ setSuccess("Login successful! Redirecting...");
5376
+ } else {
5377
+ setError(response.message || "Login failed. Please check your credentials.");
5378
+ }
5379
+ } catch (err) {
5380
+ setError(err instanceof Error ? err.message : "An error occurred during login.");
5381
+ } finally {
5382
+ setIsLoading(false);
5383
+ }
5384
+ };
5385
+ if (authLoading) {
5386
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", padding: "40px" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading..." }) });
5387
+ }
5388
+ return /* @__PURE__ */ jsxRuntime.jsx(
5389
+ ThemeWrapper,
5390
+ {
5391
+ style: {
5392
+ maxWidth: "400px",
5393
+ margin: "0 auto",
5394
+ padding: "30px",
5395
+ borderRadius: "12px",
5396
+ boxShadow: "0 4px 20px rgba(0, 0, 0, 0.1)",
5397
+ backgroundColor: colors.bgPrimary,
5398
+ border: `1px solid ${colors.borderPrimary}`,
5399
+ ...appearance?.elements?.card
5400
+ },
5401
+ children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, children: [
5402
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", marginBottom: "24px" }, children: [
5403
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
5404
+ width: "60px",
5405
+ height: "60px",
5406
+ margin: "0 auto 16px",
5407
+ backgroundColor: colors.buttonPrimary + "20",
5408
+ borderRadius: "12px",
5409
+ display: "flex",
5410
+ alignItems: "center",
5411
+ justifyContent: "center"
5412
+ }, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", stroke: colors.buttonPrimary, strokeWidth: "2", children: [
5413
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }),
5414
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 12l2 2 4-4" })
5415
+ ] }) }),
5416
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: {
5417
+ color: colors.textPrimary,
5418
+ fontSize: "24px",
5419
+ fontWeight: 600,
5420
+ margin: 0,
5421
+ ...appearance?.elements?.headerTitle
5422
+ }, children: "Super Admin Portal" }),
5423
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: {
5424
+ color: colors.textSecondary,
5425
+ fontSize: "14px",
5426
+ marginTop: "8px"
5427
+ }, children: "Sign in with your administrator credentials" })
5428
+ ] }),
5429
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
5430
+ padding: "12px 16px",
5431
+ marginBottom: "20px",
5432
+ backgroundColor: colors.errorBg,
5433
+ color: colors.errorText,
5434
+ border: `1px solid ${colors.errorBorder}`,
5435
+ borderRadius: "8px",
5436
+ fontSize: "14px"
5437
+ }, children: error }),
5438
+ success && /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
5439
+ padding: "12px 16px",
5440
+ marginBottom: "20px",
5441
+ backgroundColor: colors.successBg,
5442
+ color: colors.successText,
5443
+ border: `1px solid ${colors.successBorder}`,
5444
+ borderRadius: "8px",
5445
+ fontSize: "14px"
5446
+ }, children: success }),
5447
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "20px" }, children: [
5448
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", style: {
5449
+ display: "block",
5450
+ marginBottom: "8px",
5451
+ fontWeight: 500,
5452
+ color: colors.textSecondary,
5453
+ fontSize: "14px"
5454
+ }, children: "Email Address" }),
5455
+ /* @__PURE__ */ jsxRuntime.jsx(
5456
+ "input",
5457
+ {
5458
+ id: "email",
5459
+ type: "email",
5460
+ value: email,
5461
+ onChange: (e) => setEmail(e.target.value),
5462
+ onFocus: (e) => {
5463
+ e.currentTarget.style.borderColor = colors.buttonPrimary;
5464
+ e.currentTarget.style.outline = `2px solid ${colors.buttonPrimary}40`;
5465
+ },
5466
+ onBlur: (e) => {
5467
+ e.currentTarget.style.borderColor = colors.borderSecondary;
5468
+ e.currentTarget.style.outline = "none";
5469
+ },
5470
+ required: true,
5471
+ disabled: isLoading,
5472
+ autoComplete: "email",
5473
+ style: {
5474
+ width: "100%",
5475
+ padding: "12px 16px",
5476
+ border: `1px solid ${colors.borderSecondary}`,
5477
+ borderRadius: "8px",
5478
+ fontSize: "16px",
5479
+ boxSizing: "border-box",
5480
+ backgroundColor: colors.bgSecondary,
5481
+ color: colors.textPrimary,
5482
+ transition: "all 0.2s ease",
5483
+ WebkitTextFillColor: colors.textPrimary,
5484
+ WebkitBoxShadow: `0 0 0 1000px ${colors.bgSecondary} inset`,
5485
+ ...appearance?.elements?.formFieldInput
5486
+ },
5487
+ placeholder: "admin@example.com"
5488
+ }
5489
+ )
5490
+ ] }),
5491
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "24px", position: "relative" }, children: [
5492
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", style: {
5493
+ display: "block",
5494
+ marginBottom: "8px",
5495
+ fontWeight: 500,
5496
+ color: colors.textSecondary,
5497
+ fontSize: "14px"
5498
+ }, children: "Password" }),
5499
+ /* @__PURE__ */ jsxRuntime.jsx(
5500
+ "input",
5501
+ {
5502
+ id: "password",
5503
+ type: showPassword ? "text" : "password",
5504
+ value: password,
5505
+ onChange: (e) => setPassword(e.target.value),
5506
+ onFocus: (e) => {
5507
+ e.currentTarget.style.borderColor = colors.buttonPrimary;
5508
+ e.currentTarget.style.outline = `2px solid ${colors.buttonPrimary}40`;
5509
+ },
5510
+ onBlur: (e) => {
5511
+ e.currentTarget.style.borderColor = colors.borderSecondary;
5512
+ e.currentTarget.style.outline = "none";
5513
+ },
5514
+ required: true,
5515
+ disabled: isLoading,
5516
+ autoComplete: "current-password",
5517
+ style: {
5518
+ width: "100%",
5519
+ padding: "12px 16px",
5520
+ paddingRight: "60px",
5521
+ border: `1px solid ${colors.borderSecondary}`,
5522
+ borderRadius: "8px",
5523
+ fontSize: "16px",
5524
+ boxSizing: "border-box",
5525
+ backgroundColor: colors.bgSecondary,
5526
+ color: colors.textPrimary,
5527
+ transition: "all 0.2s ease",
5528
+ WebkitTextFillColor: colors.textPrimary,
5529
+ WebkitBoxShadow: `0 0 0 1000px ${colors.bgSecondary} inset`,
5530
+ ...appearance?.elements?.formFieldInput
5531
+ },
5532
+ placeholder: "Enter your password"
5533
+ }
5534
+ ),
5535
+ /* @__PURE__ */ jsxRuntime.jsx(
5536
+ "button",
5537
+ {
5538
+ type: "button",
5539
+ onClick: () => setShowPassword(!showPassword),
5540
+ style: {
5541
+ position: "absolute",
5542
+ right: "12px",
5543
+ top: "38px",
5544
+ background: "none",
5545
+ border: "none",
5546
+ cursor: "pointer",
5547
+ color: colors.textTertiary,
5548
+ fontSize: "14px",
5549
+ padding: "4px 8px"
5550
+ },
5551
+ children: showPassword ? "Hide" : "Show"
5552
+ }
5553
+ )
5554
+ ] }),
5555
+ /* @__PURE__ */ jsxRuntime.jsx(
5556
+ "button",
5557
+ {
5558
+ type: "submit",
5559
+ disabled: isLoading || !email || !password,
5560
+ onMouseEnter: (e) => {
5561
+ if (!isLoading && email && password) {
5562
+ e.currentTarget.style.backgroundColor = colors.buttonPrimaryHover;
5563
+ }
5564
+ },
5565
+ onMouseLeave: (e) => {
5566
+ e.currentTarget.style.backgroundColor = colors.buttonPrimary;
5567
+ },
5568
+ style: {
5569
+ width: "100%",
5570
+ padding: "14px",
5571
+ backgroundColor: colors.buttonPrimary,
5572
+ color: "white",
5573
+ border: "none",
5574
+ borderRadius: "8px",
5575
+ fontSize: "16px",
5576
+ fontWeight: 600,
5577
+ cursor: isLoading || !email || !password ? "not-allowed" : "pointer",
5578
+ opacity: isLoading || !email || !password ? 0.6 : 1,
5579
+ transition: "all 0.2s ease",
5580
+ ...appearance?.elements?.formButtonPrimary
5581
+ },
5582
+ children: isLoading ? "Signing in..." : "Sign In"
5583
+ }
5584
+ ),
5585
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
5586
+ marginTop: "20px",
5587
+ padding: "12px",
5588
+ backgroundColor: colors.bgSecondary,
5589
+ borderRadius: "8px",
5590
+ textAlign: "center"
5591
+ }, children: /* @__PURE__ */ jsxRuntime.jsxs("p", { style: {
5592
+ color: colors.textTertiary,
5593
+ fontSize: "12px",
5594
+ margin: 0
5595
+ }, children: [
5596
+ "\u{1F512} This portal is restricted to Super Admin users only.",
5597
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
5598
+ "Contact your system administrator if you need access."
5599
+ ] }) })
5600
+ ] })
5601
+ }
5602
+ );
5603
+ };
5206
5604
  var AvatarManager = ({
5207
5605
  open,
5208
5606
  onOpenChange,
@@ -5496,6 +5894,7 @@ exports.ResetPassword = ResetPassword;
5496
5894
  exports.SignIn = SignIn;
5497
5895
  exports.SignOut = SignOut;
5498
5896
  exports.SignUp = SignUp;
5897
+ exports.SuperAdminSignIn = SuperAdminSignIn;
5499
5898
  exports.UserButton = UserButton;
5500
5899
  exports.UserProfile = UserProfile;
5501
5900
  exports.VerifyEmail = VerifyEmail;