@micha.bigler/ui-core-micha 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // src/auth/components/SecurityComponent.jsx
2
3
  import React, { useState } from 'react';
3
- import { Box, Typography, Divider, Button, Stack, Alert, TextField, } from '@mui/material';
4
+ import { Box, Typography, Divider, Alert, } from '@mui/material';
4
5
  import PasswordChangeForm from './PasswordChangeForm';
5
6
  import SocialLoginButtons from './SocialLoginButtons';
7
+ import PasskeysComponent from './PasskeysComponent'; // <--- WICHTIG
6
8
  import { authApi } from '../auth/authApi';
7
- import { FEATURES } from '../auth/authConfig';
8
9
  const SecurityComponent = () => {
9
10
  const [message, setMessage] = useState('');
10
11
  const [error, setError] = useState('');
11
- const [passkeyName, setPasskeyName] = useState('');
12
- const [passkeySubmitting, setPasskeySubmitting] = useState(false);
13
12
  const handleSocialClick = async (provider) => {
14
13
  setMessage('');
15
14
  setError('');
@@ -35,26 +34,6 @@ const SecurityComponent = () => {
35
34
  setError(errorMsg);
36
35
  }
37
36
  };
38
- const handleRegisterPasskey = async () => {
39
- setMessage('');
40
- setError('');
41
- setPasskeySubmitting(true);
42
- try {
43
- // Fallback-Name, wenn der User nichts einträgt
44
- const fallbackName = (passkeyName === null || passkeyName === void 0 ? void 0 : passkeyName.trim()) ||
45
- `Passkey on ${navigator.platform || 'this device'}`;
46
- await authApi.registerPasskey(fallbackName);
47
- setMessage('Passkey added successfully.');
48
- setPasskeyName('');
49
- }
50
- catch (e) {
51
- setError(e.message || 'Could not add passkey.');
52
- }
53
- finally {
54
- setPasskeySubmitting(false);
55
- }
56
- };
57
- const passkeysSupported = typeof window !== 'undefined' && !!window.PublicKeyCredential;
58
- return (_jsxs(Box, { children: [message && (_jsx(Alert, { severity: "success", sx: { mb: 2 }, children: message })), error && (_jsx(Alert, { severity: "error", sx: { mb: 2 }, children: error })), _jsx(Typography, { variant: "h6", gutterBottom: true, children: "Password" }), _jsx(PasswordChangeForm, { onSubmit: handlePasswordChange }), _jsx(Divider, { sx: { my: 3 } }), _jsx(Typography, { variant: "h6", gutterBottom: true, children: "Social logins" }), _jsx(Typography, { variant: "body2", sx: { mb: 1 }, children: "Sign in using a connected Google or Microsoft account." }), _jsx(SocialLoginButtons, { onProviderClick: handleSocialClick }), _jsx(Divider, { sx: { my: 3 } }), _jsx(Typography, { variant: "h6", gutterBottom: true, children: "Passkeys" }), _jsx(Typography, { variant: "body2", sx: { mb: 1 }, children: "Use passkeys for passwordless sign-in on this device." }), !passkeysSupported && (_jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mb: 1 }, children: "Passkeys are not supported in this browser." })), FEATURES.passkeysEnabled && passkeysSupported ? (_jsx(PasskeysComponent, {})) : (_jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: "Passkeys are disabled for this project." }))] }));
37
+ return (_jsxs(Box, { children: [message && (_jsx(Alert, { severity: "success", sx: { mb: 2 }, children: message })), error && (_jsx(Alert, { severity: "error", sx: { mb: 2 }, children: error })), _jsx(Typography, { variant: "h6", gutterBottom: true, children: "Password" }), _jsx(PasswordChangeForm, { onSubmit: handlePasswordChange }), _jsx(Divider, { sx: { my: 3 } }), _jsx(Typography, { variant: "h6", gutterBottom: true, children: "Social logins" }), _jsx(Typography, { variant: "body2", sx: { mb: 1 }, children: "Sign in using a connected Google or Microsoft account." }), _jsx(SocialLoginButtons, { onProviderClick: handleSocialClick }), _jsx(Divider, { sx: { my: 3 } }), _jsx(PasskeysComponent, {})] }));
59
38
  };
60
39
  export default SecurityComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "private": false,
@@ -1,23 +1,19 @@
1
+ // src/auth/components/SecurityComponent.jsx
1
2
  import React, { useState } from 'react';
2
3
  import {
3
4
  Box,
4
5
  Typography,
5
6
  Divider,
6
- Button,
7
- Stack,
8
7
  Alert,
9
- TextField,
10
8
  } from '@mui/material';
11
9
  import PasswordChangeForm from './PasswordChangeForm';
12
10
  import SocialLoginButtons from './SocialLoginButtons';
11
+ import PasskeysComponent from './PasskeysComponent'; // <--- WICHTIG
13
12
  import { authApi } from '../auth/authApi';
14
- import { FEATURES } from '../auth/authConfig';
15
13
 
16
14
  const SecurityComponent = () => {
17
15
  const [message, setMessage] = useState('');
18
16
  const [error, setError] = useState('');
19
- const [passkeyName, setPasskeyName] = useState('');
20
- const [passkeySubmitting, setPasskeySubmitting] = useState(false);
21
17
 
22
18
  const handleSocialClick = async (provider) => {
23
19
  setMessage('');
@@ -44,30 +40,6 @@ const SecurityComponent = () => {
44
40
  }
45
41
  };
46
42
 
47
- const handleRegisterPasskey = async () => {
48
- setMessage('');
49
- setError('');
50
- setPasskeySubmitting(true);
51
-
52
- try {
53
- // Fallback-Name, wenn der User nichts einträgt
54
- const fallbackName =
55
- passkeyName?.trim() ||
56
- `Passkey on ${navigator.platform || 'this device'}`;
57
-
58
- await authApi.registerPasskey(fallbackName);
59
- setMessage('Passkey added successfully.');
60
- setPasskeyName('');
61
- } catch (e) {
62
- setError(e.message || 'Could not add passkey.');
63
- } finally {
64
- setPasskeySubmitting(false);
65
- }
66
- };
67
-
68
- const passkeysSupported =
69
- typeof window !== 'undefined' && !!window.PublicKeyCredential;
70
-
71
43
  return (
72
44
  <Box>
73
45
  {message && (
@@ -101,28 +73,7 @@ const SecurityComponent = () => {
101
73
  <Divider sx={{ my: 3 }} />
102
74
 
103
75
  {/* Passkeys Section */}
104
- <Typography variant="h6" gutterBottom>
105
- Passkeys
106
- </Typography>
107
- <Typography variant="body2" sx={{ mb: 1 }}>
108
- Use passkeys for passwordless sign-in on this device.
109
- </Typography>
110
-
111
- {!passkeysSupported && (
112
- <Typography variant="body2" color="text.secondary" sx={{ mb: 1 }}>
113
- Passkeys are not supported in this browser.
114
- </Typography>
115
- )}
116
-
117
- {FEATURES.passkeysEnabled && passkeysSupported ? (
118
- <PasskeysComponent />
119
- ) : (
120
- <Typography variant="body2" color="text.secondary" sx={{ mt: 1 }}>
121
- Passkeys are disabled for this project.
122
- </Typography>
123
- )}
124
-
125
- {/* Hier später: Liste der vorhandenen Passkeys + Delete-Buttons */}
76
+ <PasskeysComponent />
126
77
  </Box>
127
78
  );
128
79
  };