@lincros-ui/components 0.2.1 → 0.2.3
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/dist/index.js +47 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4551,7 +4551,9 @@ var SSOLoadingOverlay = memo(({
|
|
|
4551
4551
|
tenantId,
|
|
4552
4552
|
error,
|
|
4553
4553
|
show = true,
|
|
4554
|
-
className = ""
|
|
4554
|
+
className = "",
|
|
4555
|
+
ssoProviderName = "SSO",
|
|
4556
|
+
appName = "o sistema"
|
|
4555
4557
|
}) => {
|
|
4556
4558
|
const getStepIcon = useMemo(() => {
|
|
4557
4559
|
switch (step) {
|
|
@@ -4577,7 +4579,7 @@ var SSOLoadingOverlay = memo(({
|
|
|
4577
4579
|
case "redirecting":
|
|
4578
4580
|
return "Redirecionando para SSO";
|
|
4579
4581
|
case "authenticating":
|
|
4580
|
-
return
|
|
4582
|
+
return `Autenticando com ${ssoProviderName}`;
|
|
4581
4583
|
case "processing":
|
|
4582
4584
|
return "Processando credenciais";
|
|
4583
4585
|
case "completing":
|
|
@@ -4587,24 +4589,24 @@ var SSOLoadingOverlay = memo(({
|
|
|
4587
4589
|
default:
|
|
4588
4590
|
return "Carregando...";
|
|
4589
4591
|
}
|
|
4590
|
-
}, [step]);
|
|
4592
|
+
}, [step, ssoProviderName]);
|
|
4591
4593
|
const getStepDescription = useMemo(() => {
|
|
4592
4594
|
if (message) return message;
|
|
4593
4595
|
switch (step) {
|
|
4594
4596
|
case "redirecting":
|
|
4595
|
-
return
|
|
4597
|
+
return `Preparando conex\xE3o segura com ${ssoProviderName}...`;
|
|
4596
4598
|
case "authenticating":
|
|
4597
|
-
return
|
|
4599
|
+
return `Verificando suas credenciais no sistema ${ssoProviderName}...`;
|
|
4598
4600
|
case "processing":
|
|
4599
4601
|
return "Criando sua sess\xE3o e configurando acesso...";
|
|
4600
4602
|
case "completing":
|
|
4601
|
-
return
|
|
4603
|
+
return `Redirecionando para ${appName}...`;
|
|
4602
4604
|
case "error":
|
|
4603
4605
|
return error || "Ocorreu um erro durante a autentica\xE7\xE3o SSO";
|
|
4604
4606
|
default:
|
|
4605
4607
|
return "Aguarde...";
|
|
4606
4608
|
}
|
|
4607
|
-
}, [message, step, error]);
|
|
4609
|
+
}, [message, step, error, ssoProviderName, appName]);
|
|
4608
4610
|
const getBgColor = useMemo(() => {
|
|
4609
4611
|
switch (step) {
|
|
4610
4612
|
case "error":
|
|
@@ -4901,7 +4903,10 @@ function ControlSidebar({
|
|
|
4901
4903
|
routePaths,
|
|
4902
4904
|
user,
|
|
4903
4905
|
onLogout,
|
|
4904
|
-
getCurrentTenantId
|
|
4906
|
+
getCurrentTenantId,
|
|
4907
|
+
logoUrl = "/lovable-uploads/632ebc32-3ae3-4944-8e70-0e9c2539494a.png",
|
|
4908
|
+
appName = "App",
|
|
4909
|
+
appSubtitle = "Sistema"
|
|
4905
4910
|
}) {
|
|
4906
4911
|
const {
|
|
4907
4912
|
toggleSubmenu,
|
|
@@ -5066,21 +5071,21 @@ function ControlSidebar({
|
|
|
5066
5071
|
/* @__PURE__ */ jsx(
|
|
5067
5072
|
"img",
|
|
5068
5073
|
{
|
|
5069
|
-
src:
|
|
5070
|
-
alt:
|
|
5074
|
+
src: logoUrl,
|
|
5075
|
+
alt: `${appName} Logo`,
|
|
5071
5076
|
className: "w-20 h-20 object-contain"
|
|
5072
5077
|
}
|
|
5073
5078
|
),
|
|
5074
5079
|
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
5075
|
-
/* @__PURE__ */ jsx("h2", { className: "font-bold text-lg text-gray-800", children:
|
|
5076
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children:
|
|
5080
|
+
/* @__PURE__ */ jsx("h2", { className: "font-bold text-lg text-gray-800", children: appName }),
|
|
5081
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: appSubtitle })
|
|
5077
5082
|
] })
|
|
5078
5083
|
] }),
|
|
5079
5084
|
isCollapsed && /* @__PURE__ */ jsx("div", { className: "flex justify-center px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
5080
5085
|
"img",
|
|
5081
5086
|
{
|
|
5082
|
-
src:
|
|
5083
|
-
alt:
|
|
5087
|
+
src: logoUrl,
|
|
5088
|
+
alt: `${appName} Logo`,
|
|
5084
5089
|
className: "w-8 h-8 object-contain"
|
|
5085
5090
|
}
|
|
5086
5091
|
) })
|
|
@@ -5198,7 +5203,10 @@ function MainLayout({
|
|
|
5198
5203
|
user,
|
|
5199
5204
|
onLogout,
|
|
5200
5205
|
getCurrentTenantId,
|
|
5201
|
-
currentTime
|
|
5206
|
+
currentTime,
|
|
5207
|
+
appName,
|
|
5208
|
+
appSubtitle,
|
|
5209
|
+
logoUrl
|
|
5202
5210
|
}) {
|
|
5203
5211
|
return /* @__PURE__ */ jsx(SidebarProvider, { children: /* @__PURE__ */ jsxs("div", { className: "h-screen w-full flex", children: [
|
|
5204
5212
|
/* @__PURE__ */ jsx(
|
|
@@ -5208,13 +5216,16 @@ function MainLayout({
|
|
|
5208
5216
|
user,
|
|
5209
5217
|
onLogout,
|
|
5210
5218
|
getCurrentTenantId,
|
|
5211
|
-
currentTime
|
|
5219
|
+
currentTime,
|
|
5220
|
+
appName,
|
|
5221
|
+
appSubtitle,
|
|
5222
|
+
logoUrl
|
|
5212
5223
|
}
|
|
5213
5224
|
),
|
|
5214
5225
|
/* @__PURE__ */ jsx("main", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-auto", children }) })
|
|
5215
5226
|
] }) });
|
|
5216
5227
|
}
|
|
5217
|
-
function ProtectedRoute({ children, useAuthContext, tenantId, useSSO, routePaths, useTenant, tenantService }) {
|
|
5228
|
+
function ProtectedRoute({ children, useAuthContext, tenantId, useSSO, routePaths, useTenant, tenantService, appName, appSubtitle, logoUrl }) {
|
|
5218
5229
|
const { isAuthenticated, isLoading, logout, user, getCurrentTenantId } = useAuthContext();
|
|
5219
5230
|
const location = useLocation();
|
|
5220
5231
|
const sso = useSSO(tenantId || void 0);
|
|
@@ -5254,6 +5265,9 @@ function ProtectedRoute({ children, useAuthContext, tenantId, useSSO, routePaths
|
|
|
5254
5265
|
user,
|
|
5255
5266
|
onLogout: logout,
|
|
5256
5267
|
getCurrentTenantId,
|
|
5268
|
+
appName,
|
|
5269
|
+
appSubtitle,
|
|
5270
|
+
logoUrl,
|
|
5257
5271
|
children: /* @__PURE__ */ jsx(EnsureTenant, { useTenant, tenantService, children })
|
|
5258
5272
|
}
|
|
5259
5273
|
);
|
|
@@ -6839,7 +6853,10 @@ var SSOError = memo(({
|
|
|
6839
6853
|
className = "",
|
|
6840
6854
|
onRetry,
|
|
6841
6855
|
onBackToLogin,
|
|
6842
|
-
onContactSupport
|
|
6856
|
+
onContactSupport,
|
|
6857
|
+
ssoProviderName = "SSO",
|
|
6858
|
+
appName = "o sistema",
|
|
6859
|
+
supportEmail = "suporte@example.com"
|
|
6843
6860
|
}) => {
|
|
6844
6861
|
const getErrorIcon = () => {
|
|
6845
6862
|
switch (errorType) {
|
|
@@ -6876,7 +6893,7 @@ var SSOError = memo(({
|
|
|
6876
6893
|
const getErrorDescription = () => {
|
|
6877
6894
|
switch (errorType) {
|
|
6878
6895
|
case "authentication_failed":
|
|
6879
|
-
return
|
|
6896
|
+
return `N\xE3o foi poss\xEDvel autenticar suas credenciais no sistema ${ssoProviderName}. Verifique suas permiss\xF5es e tente novamente.`;
|
|
6880
6897
|
case "invalid_state":
|
|
6881
6898
|
return "A sess\xE3o SSO \xE9 inv\xE1lida ou foi comprometida. Por seguran\xE7a, o login foi cancelado.";
|
|
6882
6899
|
case "token_expired":
|
|
@@ -6893,14 +6910,14 @@ var SSOError = memo(({
|
|
|
6893
6910
|
switch (errorType) {
|
|
6894
6911
|
case "authentication_failed":
|
|
6895
6912
|
return [
|
|
6896
|
-
|
|
6913
|
+
`Verifique se voc\xEA tem acesso ao sistema ${ssoProviderName}`,
|
|
6897
6914
|
"Confirme se suas credenciais est\xE3o corretas",
|
|
6898
6915
|
"Entre em contato com o administrador se o problema persistir"
|
|
6899
6916
|
];
|
|
6900
6917
|
case "invalid_state":
|
|
6901
6918
|
return [
|
|
6902
6919
|
"Limpe os cookies do navegador",
|
|
6903
|
-
|
|
6920
|
+
`Feche todas as abas de ${appName} e ${ssoProviderName}`,
|
|
6904
6921
|
"Inicie um novo processo de login SSO"
|
|
6905
6922
|
];
|
|
6906
6923
|
case "token_expired":
|
|
@@ -6912,7 +6929,7 @@ var SSOError = memo(({
|
|
|
6912
6929
|
case "server_error":
|
|
6913
6930
|
return [
|
|
6914
6931
|
"Aguarde alguns minutos e tente novamente",
|
|
6915
|
-
|
|
6932
|
+
`Verifique se o servi\xE7o ${ssoProviderName} est\xE1 funcionando`,
|
|
6916
6933
|
"Use o login tradicional como alternativa"
|
|
6917
6934
|
];
|
|
6918
6935
|
case "tenant_mismatch":
|
|
@@ -6954,7 +6971,7 @@ var SSOError = memo(({
|
|
|
6954
6971
|
}, [onBackToLogin]);
|
|
6955
6972
|
const handleContactSupport = useCallback(() => {
|
|
6956
6973
|
onContactSupport?.();
|
|
6957
|
-
window.open(
|
|
6974
|
+
window.open(`mailto:${supportEmail}?subject=Erro SSO&body=` + encodeURIComponent(
|
|
6958
6975
|
`Erro SSO
|
|
6959
6976
|
|
|
6960
6977
|
Tipo: ${errorType}
|
|
@@ -6963,7 +6980,7 @@ Tenant: ${tenantId}
|
|
|
6963
6980
|
C\xF3digo: ${errorCode}
|
|
6964
6981
|
Detalhes: ${details}`
|
|
6965
6982
|
), "_blank");
|
|
6966
|
-
}, [onContactSupport, errorType, message, tenantId, errorCode, details]);
|
|
6983
|
+
}, [onContactSupport, errorType, message, tenantId, errorCode, details, supportEmail]);
|
|
6967
6984
|
return /* @__PURE__ */ jsx("div", { className: `min-h-screen flex items-center justify-center p-4 bg-muted/30 ${className}`, children: /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-2xl shadow-lg", children: [
|
|
6968
6985
|
/* @__PURE__ */ jsxs(CardHeader, { className: "text-center pb-4", children: [
|
|
6969
6986
|
/* @__PURE__ */ jsx("div", { className: "flex justify-center mb-4", children: getErrorIcon() }),
|
|
@@ -7068,7 +7085,8 @@ var SSOLoginButton = memo(({
|
|
|
7068
7085
|
onLoginError,
|
|
7069
7086
|
hideAlternativeLogin = false,
|
|
7070
7087
|
ssoLoginUrl,
|
|
7071
|
-
apiBaseUrl = "http://localhost:8000"
|
|
7088
|
+
apiBaseUrl = "http://localhost:8000",
|
|
7089
|
+
ssoProviderName = "SSO"
|
|
7072
7090
|
}) => {
|
|
7073
7091
|
const [isInitiating, setIsInitiating] = useState(false);
|
|
7074
7092
|
const handleSSOLogin = useCallback(async () => {
|
|
@@ -7150,7 +7168,7 @@ var SSOLoginButton = memo(({
|
|
|
7150
7168
|
children: [
|
|
7151
7169
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-3", children: [
|
|
7152
7170
|
isLoading ? /* @__PURE__ */ jsx("div", { className: "icon-size animate-spin rounded-full border-2 border-background border-t-foreground" }) : /* @__PURE__ */ jsx(Shield, { className: "icon-size" }),
|
|
7153
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: isLoading ? "Iniciando SSO..." :
|
|
7171
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: isLoading ? "Iniciando SSO..." : `Entrar com ${ssoProviderName}` })
|
|
7154
7172
|
] }),
|
|
7155
7173
|
isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-background/50 backdrop-blur-sm" })
|
|
7156
7174
|
]
|
|
@@ -10390,7 +10408,8 @@ var SendMessageModal = ({
|
|
|
10390
10408
|
onClose,
|
|
10391
10409
|
config: initialConfig,
|
|
10392
10410
|
configs = [],
|
|
10393
|
-
defaultPhone = ""
|
|
10411
|
+
defaultPhone = "",
|
|
10412
|
+
appName = "Sistema"
|
|
10394
10413
|
}) => {
|
|
10395
10414
|
const { sendMessage, isSending, validatePhoneNumber } = useWhatsApp();
|
|
10396
10415
|
const [selectedConfig, setSelectedConfig] = useState(initialConfig || null);
|
|
@@ -10778,7 +10797,7 @@ var SendMessageModal = ({
|
|
|
10778
10797
|
variant: "acorde",
|
|
10779
10798
|
value: locationName,
|
|
10780
10799
|
onChange: (e) => setLocationName(e.target.value),
|
|
10781
|
-
placeholder:
|
|
10800
|
+
placeholder: appName,
|
|
10782
10801
|
className: "mt-1"
|
|
10783
10802
|
}
|
|
10784
10803
|
)
|