@micha.bigler/ui-core-micha 2.1.14 → 2.1.16

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.
@@ -3,6 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import React from 'react';
4
4
  import { Container, Box, Typography } from '@mui/material';
5
5
  // Layout for content pages with larger width (e.g. Profile, Welcome, Input)
6
- export const WidePage = ({ title, children }) => (_jsxs(Container, { maxWidth: "md", sx: { mt: 4 }, children: [title && (_jsx(Typography, { variant: "h4", gutterBottom: true, children: title })), children] }));
6
+ export const WidePage = ({ title, children, maxWidth = 'lg' }) => (_jsxs(Container, { maxWidth: maxWidth, sx: { mt: 4 }, children: [title && (_jsx(Typography, { variant: "h4", gutterBottom: true, children: title })), children] }));
7
7
  // Layout for forms or narrow pages (e.g. Login, Reset, Invite)
8
8
  export const NarrowPage = ({ title, subtitle, children }) => (_jsx(Container, { maxWidth: "md", sx: { mt: 4 }, children: _jsxs(Box, { sx: { maxWidth: 480, mx: 'auto' }, children: [title && (_jsx(Typography, { variant: "h4", gutterBottom: true, children: title })), subtitle && (_jsx(Typography, { paragraph: true, children: subtitle })), children] }) }));
@@ -25,9 +25,13 @@ export function LoginPage() {
25
25
  const [mfaState, setMfaState] = useState(null); // { availableTypes: [...], identifier }
26
26
  // URL Params parsing
27
27
  const params = new URLSearchParams(location.search);
28
- const recoveryToken = params.get('recovery');
29
- // Auto-fill email if provided in URL (UX improvement)
30
- const recoveryEmail = params.get('email') || '';
28
+ const hashParams = new URLSearchParams(String(location.hash || "").startsWith("#") ? String(location.hash).slice(1) : String(location.hash || ""));
29
+ const recoveryTokenRaw = hashParams.get('recovery') || params.get('recovery');
30
+ const recoveryToken = ['invalid', 'expired'].includes(String(recoveryTokenRaw || '').toLowerCase())
31
+ ? null
32
+ : recoveryTokenRaw;
33
+ // Backward-compatible fallback for legacy links using query parameters.
34
+ const recoveryEmail = hashParams.get('email') || params.get('email') || '';
31
35
  // --- Helper: Central Success Logic ---
32
36
  const handleLoginSuccess = (user) => {
33
37
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "2.1.14",
3
+ "version": "2.1.16",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "private": false,
@@ -3,8 +3,8 @@ import React from 'react';
3
3
  import { Container, Box, Typography } from '@mui/material';
4
4
 
5
5
  // Layout for content pages with larger width (e.g. Profile, Welcome, Input)
6
- export const WidePage = ({ title, children }) => (
7
- <Container maxWidth="md" sx={{ mt: 4 }}>
6
+ export const WidePage = ({ title, children, maxWidth = 'lg' }) => (
7
+ <Container maxWidth={maxWidth} sx={{ mt: 4 }}>
8
8
  {title && (
9
9
  <Typography variant="h4" gutterBottom>
10
10
  {title}
@@ -30,9 +30,15 @@ export function LoginPage() {
30
30
 
31
31
  // URL Params parsing
32
32
  const params = new URLSearchParams(location.search);
33
- const recoveryToken = params.get('recovery');
34
- // Auto-fill email if provided in URL (UX improvement)
35
- const recoveryEmail = params.get('email') || '';
33
+ const hashParams = new URLSearchParams(
34
+ String(location.hash || "").startsWith("#") ? String(location.hash).slice(1) : String(location.hash || ""),
35
+ );
36
+ const recoveryTokenRaw = hashParams.get('recovery') || params.get('recovery');
37
+ const recoveryToken = ['invalid', 'expired'].includes(String(recoveryTokenRaw || '').toLowerCase())
38
+ ? null
39
+ : recoveryTokenRaw;
40
+ // Backward-compatible fallback for legacy links using query parameters.
41
+ const recoveryEmail = hashParams.get('email') || params.get('email') || '';
36
42
 
37
43
  // --- Helper: Central Success Logic ---
38
44
  const handleLoginSuccess = (user) => {
@@ -169,4 +175,4 @@ export function LoginPage() {
169
175
  )}
170
176
  </NarrowPage>
171
177
  );
172
- }
178
+ }