@lastbrain/ai-ui-react 1.0.56 → 1.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LBSigninModal.d.ts","sourceRoot":"","sources":["../../src/components/LBSigninModal.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"LBSigninModal.d.ts","sourceRoot":"","sources":["../../src/components/LBSigninModal.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,kDAijBpE"}
|
|
@@ -12,25 +12,14 @@ export function LBSigninModal({ isOpen, onClose }) {
|
|
|
12
12
|
const [error, setError] = useState("");
|
|
13
13
|
const [showKeySelector, setShowKeySelector] = useState(false);
|
|
14
14
|
const [currentApiKeys, setCurrentApiKeys] = useState([]); // Stocker les clés API localement
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let apiKeys = [];
|
|
20
|
-
let lbStatus;
|
|
21
|
-
let lbContext;
|
|
22
|
-
try {
|
|
23
|
-
lbContext = useLB();
|
|
24
|
-
login = lbContext.login;
|
|
25
|
-
selectApiKeyWithToken = lbContext.selectApiKeyWithToken;
|
|
26
|
-
fetchApiKeys = lbContext.fetchApiKeys;
|
|
27
|
-
apiKeys = lbContext.apiKeys || [];
|
|
28
|
-
lbStatus = lbContext.status;
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
// LBProvider n'est pas disponible, ne pas rendre le modal
|
|
15
|
+
// Appeler useLB() inconditionnellement - hook doit toujours être appelé
|
|
16
|
+
const lbContext = useLB();
|
|
17
|
+
// Vérifier si le contexte est valide
|
|
18
|
+
if (!lbContext || !isOpen) {
|
|
32
19
|
return null;
|
|
33
20
|
}
|
|
21
|
+
// Extraire les valeurs du contexte
|
|
22
|
+
const { login, selectApiKeyWithToken, fetchApiKeys, apiKeys = [], status: lbStatus, } = lbContext;
|
|
34
23
|
if (!isOpen || !login)
|
|
35
24
|
return null;
|
|
36
25
|
const handleSubmit = async (e) => {
|
package/package.json
CHANGED
|
@@ -19,36 +19,23 @@ export function LBSigninModal({ isOpen, onClose }: LBSigninModalProps) {
|
|
|
19
19
|
const [showKeySelector, setShowKeySelector] = useState(false);
|
|
20
20
|
const [currentApiKeys, setCurrentApiKeys] = useState<any[]>([]); // Stocker les clés API localement
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
| ((
|
|
25
|
-
email: string,
|
|
26
|
-
password: string
|
|
27
|
-
) => Promise<{
|
|
28
|
-
success: boolean;
|
|
29
|
-
error?: string;
|
|
30
|
-
needsKeySelection?: boolean;
|
|
31
|
-
accessToken?: string;
|
|
32
|
-
}>)
|
|
33
|
-
| undefined;
|
|
34
|
-
let selectApiKeyWithToken: ((apiKeyId: string) => Promise<void>) | undefined;
|
|
35
|
-
let fetchApiKeys: ((accessToken: string) => Promise<any[]>) | undefined;
|
|
36
|
-
let apiKeys: any[] = [];
|
|
37
|
-
let lbStatus: string | undefined;
|
|
22
|
+
// Appeler useLB() inconditionnellement - hook doit toujours être appelé
|
|
23
|
+
const lbContext = useLB();
|
|
38
24
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
lbContext = useLB();
|
|
42
|
-
login = lbContext.login;
|
|
43
|
-
selectApiKeyWithToken = lbContext.selectApiKeyWithToken;
|
|
44
|
-
fetchApiKeys = lbContext.fetchApiKeys;
|
|
45
|
-
apiKeys = lbContext.apiKeys || [];
|
|
46
|
-
lbStatus = lbContext.status;
|
|
47
|
-
} catch {
|
|
48
|
-
// LBProvider n'est pas disponible, ne pas rendre le modal
|
|
25
|
+
// Vérifier si le contexte est valide
|
|
26
|
+
if (!lbContext || !isOpen) {
|
|
49
27
|
return null;
|
|
50
28
|
}
|
|
51
29
|
|
|
30
|
+
// Extraire les valeurs du contexte
|
|
31
|
+
const {
|
|
32
|
+
login,
|
|
33
|
+
selectApiKeyWithToken,
|
|
34
|
+
fetchApiKeys,
|
|
35
|
+
apiKeys = [],
|
|
36
|
+
status: lbStatus,
|
|
37
|
+
} = lbContext;
|
|
38
|
+
|
|
52
39
|
if (!isOpen || !login) return null;
|
|
53
40
|
|
|
54
41
|
const handleSubmit = async (e: React.FormEvent) => {
|