xertica-ui 2.9.7 → 2.9.9
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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/bin/language-config.ts +17 -9
- package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +19 -5
- package/components/pages/login-page/LoginPage.tsx +19 -5
- package/components/pages/reset-password-page/ResetPasswordPage.tsx +15 -2
- package/components/pages/verify-email-page/VerifyEmailPage.tsx +17 -3
- package/dist/AssistenteContext-Bm8_RJTB.js +200 -0
- package/dist/AssistenteContext-CLK8tgdt.cjs +205 -0
- package/dist/BrandColorsContext-D3Y0CYZF.js +643 -0
- package/dist/BrandColorsContext-SeOZd2Cq.cjs +646 -0
- package/dist/VerifyEmailPage-BInYcjRd.cjs +3305 -0
- package/dist/VerifyEmailPage-Z-cA_IIo.js +3295 -0
- package/dist/XerticaProvider-Ck996htf.cjs +47 -0
- package/dist/XerticaProvider-kE5l0MQn.js +45 -0
- package/dist/brand.cjs.js +1 -1
- package/dist/brand.es.js +1 -1
- package/dist/cli.js +12 -7
- package/dist/components/pages/forgot-password-page/ForgotPasswordPage.d.ts +4 -3
- package/dist/components/pages/login-page/LoginPage.d.ts +4 -3
- package/dist/components/pages/verify-email-page/VerifyEmailPage.d.ts +2 -1
- package/dist/hooks.cjs.js +6 -5
- package/dist/hooks.es.js +2 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +2 -2
- package/dist/pages.cjs.js +1 -1
- package/dist/pages.es.js +1 -1
- package/package.json +1 -1
- package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +15 -2
- package/templates/src/features/auth/ui/LoginContent.tsx +15 -2
- package/templates/src/features/auth/ui/ResetPasswordContent.tsx +15 -2
- package/templates/src/features/auth/ui/VerifyEmailContent.tsx +15 -2
- package/templates/src/styles/index.css +5 -0
- package/templates/tsconfig.node.json +1 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
const React = require('react');
|
|
5
|
+
|
|
6
|
+
const ApiKeyContext = React.createContext(void 0);
|
|
7
|
+
const readStorage = (key) => typeof window !== "undefined" ? window.localStorage?.getItem(key) : null;
|
|
8
|
+
const writeStorage = (key, value) => {
|
|
9
|
+
if (typeof window === "undefined") return;
|
|
10
|
+
window.localStorage?.setItem(key, value);
|
|
11
|
+
};
|
|
12
|
+
const removeStorage = (key) => {
|
|
13
|
+
if (typeof window === "undefined") return;
|
|
14
|
+
window.localStorage?.removeItem(key);
|
|
15
|
+
};
|
|
16
|
+
function ApiKeyProvider({
|
|
17
|
+
children,
|
|
18
|
+
initialApiKey,
|
|
19
|
+
initialGeminiApiKey,
|
|
20
|
+
initialGoogleMapsApiKey
|
|
21
|
+
}) {
|
|
22
|
+
const LEAKED_KEYS = [
|
|
23
|
+
"AIzaSyCMsAMytBeOK0Qd7RKFyA5IW9eWt2WTJg",
|
|
24
|
+
"AIzaSyAiYWEIEmx212Up9zfM8kqyMXB4jLs8gq0"
|
|
25
|
+
];
|
|
26
|
+
const [apiKey, setApiKeyState] = React.useState(() => {
|
|
27
|
+
if (initialApiKey) return initialApiKey;
|
|
28
|
+
const saved = readStorage("xertica-api-key");
|
|
29
|
+
return saved || "";
|
|
30
|
+
});
|
|
31
|
+
const [geminiApiKey, setGeminiApiKeyState] = React.useState(() => {
|
|
32
|
+
if (initialGeminiApiKey) return initialGeminiApiKey;
|
|
33
|
+
const saved = readStorage("xertica-gemini-api-key");
|
|
34
|
+
if (saved && LEAKED_KEYS.includes(saved)) {
|
|
35
|
+
removeStorage("xertica-gemini-api-key");
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
return saved || "";
|
|
39
|
+
});
|
|
40
|
+
const [googleMapsApiKey, setGoogleMapsApiKeyState] = React.useState(() => {
|
|
41
|
+
if (initialGoogleMapsApiKey) return initialGoogleMapsApiKey;
|
|
42
|
+
const saved = readStorage("xertica-googlemaps-api-key");
|
|
43
|
+
return saved || "";
|
|
44
|
+
});
|
|
45
|
+
const [isApiKeyValid, setIsApiKeyValid] = React.useState(false);
|
|
46
|
+
const [isGoogleMapsKeyValid, setIsGoogleMapsKeyValid] = React.useState(false);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
if (initialApiKey !== void 0) {
|
|
49
|
+
setApiKeyState(initialApiKey.trim());
|
|
50
|
+
}
|
|
51
|
+
}, [initialApiKey]);
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
if (initialGeminiApiKey !== void 0) {
|
|
54
|
+
setGeminiApiKeyState(initialGeminiApiKey.trim());
|
|
55
|
+
}
|
|
56
|
+
}, [initialGeminiApiKey]);
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
if (initialGoogleMapsApiKey !== void 0) {
|
|
59
|
+
setGoogleMapsApiKeyState(initialGoogleMapsApiKey.trim());
|
|
60
|
+
}
|
|
61
|
+
}, [initialGoogleMapsApiKey]);
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
if (apiKey) {
|
|
64
|
+
writeStorage("xertica-api-key", apiKey);
|
|
65
|
+
setIsApiKeyValid(apiKey.length > 0);
|
|
66
|
+
} else {
|
|
67
|
+
removeStorage("xertica-api-key");
|
|
68
|
+
setIsApiKeyValid(false);
|
|
69
|
+
}
|
|
70
|
+
}, [apiKey]);
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
if (geminiApiKey) {
|
|
73
|
+
writeStorage("xertica-gemini-api-key", geminiApiKey);
|
|
74
|
+
setIsApiKeyValid(geminiApiKey.startsWith("AIzaSy") && geminiApiKey.length > 20);
|
|
75
|
+
} else {
|
|
76
|
+
removeStorage("xertica-gemini-api-key");
|
|
77
|
+
setIsApiKeyValid(false);
|
|
78
|
+
}
|
|
79
|
+
}, [geminiApiKey]);
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (googleMapsApiKey) {
|
|
82
|
+
writeStorage("xertica-googlemaps-api-key", googleMapsApiKey);
|
|
83
|
+
setIsGoogleMapsKeyValid(
|
|
84
|
+
googleMapsApiKey.startsWith("AIzaSy") && googleMapsApiKey.length > 20
|
|
85
|
+
);
|
|
86
|
+
const reloadMaps = async () => {
|
|
87
|
+
if (googleMapsApiKey.length < 10) return;
|
|
88
|
+
try {
|
|
89
|
+
const { reloadGoogleMaps } = await Promise.resolve().then(() => require('./index-BQjx1Mdf.cjs'));
|
|
90
|
+
await reloadGoogleMaps(googleMapsApiKey);
|
|
91
|
+
console.log("[ApiKeyContext] Google Maps recarregado com sucesso");
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error("[ApiKeyContext] Erro ao recarregar Google Maps:", error);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
reloadMaps();
|
|
97
|
+
} else {
|
|
98
|
+
removeStorage("xertica-googlemaps-api-key");
|
|
99
|
+
setIsGoogleMapsKeyValid(false);
|
|
100
|
+
}
|
|
101
|
+
}, [googleMapsApiKey]);
|
|
102
|
+
const setApiKey = (key) => {
|
|
103
|
+
setApiKeyState(key.trim());
|
|
104
|
+
};
|
|
105
|
+
const setGeminiApiKey = (key) => {
|
|
106
|
+
setGeminiApiKeyState(key.trim());
|
|
107
|
+
};
|
|
108
|
+
const setGoogleMapsApiKey = (key) => {
|
|
109
|
+
setGoogleMapsApiKeyState(key.trim());
|
|
110
|
+
};
|
|
111
|
+
const reloadMapsApi = async () => {
|
|
112
|
+
if (!googleMapsApiKey || googleMapsApiKey.length < 10) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
const { reloadGoogleMaps } = await Promise.resolve().then(() => require('./index-BQjx1Mdf.cjs'));
|
|
117
|
+
await reloadGoogleMaps(googleMapsApiKey);
|
|
118
|
+
console.log("[ApiKeyContext] Google Maps recarregado manualmente");
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error("[ApiKeyContext] Erro ao recarregar Google Maps:", error);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
+
ApiKeyContext.Provider,
|
|
125
|
+
{
|
|
126
|
+
value: {
|
|
127
|
+
apiKey,
|
|
128
|
+
setApiKey,
|
|
129
|
+
geminiApiKey,
|
|
130
|
+
setGeminiApiKey,
|
|
131
|
+
isApiKeyValid,
|
|
132
|
+
googleMapsApiKey,
|
|
133
|
+
setGoogleMapsApiKey,
|
|
134
|
+
isGoogleMapsKeyValid,
|
|
135
|
+
reloadMapsApi
|
|
136
|
+
},
|
|
137
|
+
children
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function useApiKey() {
|
|
142
|
+
const context = React.useContext(ApiKeyContext);
|
|
143
|
+
if (!context) {
|
|
144
|
+
throw new Error("useApiKey must be used within ApiKeyProvider");
|
|
145
|
+
}
|
|
146
|
+
return context;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const AssistenteContext = React.createContext(void 0);
|
|
150
|
+
function AssistenteProvider({ children }) {
|
|
151
|
+
const [conversaAtual, setConversaAtual] = React.useState("1");
|
|
152
|
+
const [conversas, setConversas] = React.useState([
|
|
153
|
+
{
|
|
154
|
+
id: "1",
|
|
155
|
+
titulo: "Nova Conversa",
|
|
156
|
+
mensagens: [],
|
|
157
|
+
ultimaMensagem: "",
|
|
158
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
159
|
+
favorita: false
|
|
160
|
+
}
|
|
161
|
+
]);
|
|
162
|
+
const [isTyping, setIsTyping] = React.useState(false);
|
|
163
|
+
const [abaSelecionada, setAbaSelecionada] = React.useState("chat");
|
|
164
|
+
const [editingDocument, setEditingDocument] = React.useState(
|
|
165
|
+
null
|
|
166
|
+
);
|
|
167
|
+
const [searchFilter, setSearchFilter] = React.useState("all");
|
|
168
|
+
const [savedSearches, setSavedSearches] = React.useState([]);
|
|
169
|
+
const historico = conversas.find((c) => c.id === conversaAtual)?.mensagens || [];
|
|
170
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
171
|
+
AssistenteContext.Provider,
|
|
172
|
+
{
|
|
173
|
+
value: {
|
|
174
|
+
historico,
|
|
175
|
+
conversaAtual,
|
|
176
|
+
setConversaAtual,
|
|
177
|
+
conversas,
|
|
178
|
+
setConversas,
|
|
179
|
+
isTyping,
|
|
180
|
+
setIsTyping,
|
|
181
|
+
abaSelecionada,
|
|
182
|
+
setAbaSelecionada,
|
|
183
|
+
editingDocument,
|
|
184
|
+
setEditingDocument,
|
|
185
|
+
searchFilter,
|
|
186
|
+
setSearchFilter,
|
|
187
|
+
savedSearches,
|
|
188
|
+
setSavedSearches
|
|
189
|
+
},
|
|
190
|
+
children
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
function useAssistente() {
|
|
195
|
+
const context = React.useContext(AssistenteContext);
|
|
196
|
+
if (!context) {
|
|
197
|
+
throw new Error("useAssistente must be used within AssistenteProvider");
|
|
198
|
+
}
|
|
199
|
+
return context;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
exports.ApiKeyProvider = ApiKeyProvider;
|
|
203
|
+
exports.AssistenteProvider = AssistenteProvider;
|
|
204
|
+
exports.useApiKey = useApiKey;
|
|
205
|
+
exports.useAssistente = useAssistente;
|