@chimera-pe/react-saas 0.0.2 → 0.0.4
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/react-saas.js +528 -0
- package/dist/react-saas.umd.cjs +1 -0
- package/package.json +25 -21
- package/dist/react-saas.es.js +0 -29053
- package/dist/react-saas.umd.js +0 -336
- package/src/Constantes.js +0 -2
- package/src/api/inicializarApi.jsx +0 -9
- package/src/api/loginApi.jsx +0 -30
- package/src/components/Cargando.jsx +0 -15
- package/src/components/Error.jsx +0 -31
- package/src/components/Idioma.jsx +0 -48
- package/src/components/Inicializar.jsx +0 -64
- package/src/components/Login.jsx +0 -202
- package/src/components/MainRouter.jsx +0 -35
- package/src/components/Notificacion.jsx +0 -36
- package/src/components/SaasApp.jsx +0 -30
- package/src/components/Tema.jsx +0 -59
- package/src/components/index.jsx +0 -9
- package/src/hooks/index.jsx +0 -7
- package/src/hooks/useCheckLogin.jsx +0 -24
- package/src/hooks/useNotificar.jsx +0 -12
- package/src/i18n/es.jsx +0 -22
- package/src/i18n/index.jsx +0 -7
- package/src/index.js +0 -12
- package/src/redux/index.jsx +0 -17
- package/src/redux/inicializarSlice.jsx +0 -57
- package/src/redux/loginSlice.jsx +0 -94
- package/src/redux/notificacionSlice.jsx +0 -20
- package/src/redux/store.jsx +0 -15
- package/src/redux/uiSlice.jsx +0 -24
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { jsx as i, jsxs as d, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { Box as g, CircularProgress as q, Alert as I, AlertTitle as X, Snackbar as Y, useMediaQuery as ee, CssBaseline as re, Container as oe, Grid as m, Typography as w, Card as ie, CardHeader as ne, CardContent as ae, AppBar as te, Toolbar as se, Link as ce, InputAdornment as j, Button as le } from "@mui/material";
|
|
3
|
+
import { useTranslate as k, I18n as de } from "react-polyglot";
|
|
4
|
+
import t from "prop-types";
|
|
5
|
+
import { useDispatch as u, useSelector as p, Provider as pe } from "react-redux";
|
|
6
|
+
import { createSlice as b, createAsyncThunk as S, configureStore as ue } from "@reduxjs/toolkit";
|
|
7
|
+
import v from "axios";
|
|
8
|
+
import me from "jwt-decode";
|
|
9
|
+
import { useState as fe, useEffect as f, useMemo as ge, useCallback as he } from "react";
|
|
10
|
+
import { enGB as ye, es as xe } from "date-fns/locale";
|
|
11
|
+
import { LocalizationProvider as ke } from "@mui/x-date-pickers";
|
|
12
|
+
import { AdapterDateFns as be } from "@mui/x-date-pickers/AdapterDateFns";
|
|
13
|
+
import { createTheme as Te, ThemeProvider as Ce } from "@mui/material/styles";
|
|
14
|
+
import { grey as L } from "@mui/material/colors";
|
|
15
|
+
import { useLocation as D, Navigate as U, BrowserRouter as we, Routes as Re, Route as z } from "react-router-dom";
|
|
16
|
+
import { Email as ve, Lock as Se } from "@mui/icons-material";
|
|
17
|
+
import { Form as je } from "react-final-form";
|
|
18
|
+
import { TextField as A } from "mui-rff";
|
|
19
|
+
const Le = () => /* @__PURE__ */ i(g, { sx: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
flexGrow: 1,
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
alignItems: "center"
|
|
25
|
+
}, children: /* @__PURE__ */ i(q, {}) }), _ = ({ titulo: o, texto: e, align: r = "center", severity: n = "error" }) => {
|
|
26
|
+
const a = k();
|
|
27
|
+
return /* @__PURE__ */ i(g, { sx: {
|
|
28
|
+
display: "flex",
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
flexGrow: 1,
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
alignItems: r
|
|
33
|
+
}, children: /* @__PURE__ */ d(I, { severity: n, children: [
|
|
34
|
+
/* @__PURE__ */ i(X, { children: a(o) }),
|
|
35
|
+
e && a(e)
|
|
36
|
+
] }) });
|
|
37
|
+
};
|
|
38
|
+
_.propTypes = {
|
|
39
|
+
titulo: t.string.isRequired,
|
|
40
|
+
texto: t.string,
|
|
41
|
+
align: t.string,
|
|
42
|
+
severity: t.string
|
|
43
|
+
};
|
|
44
|
+
const $ = b({
|
|
45
|
+
name: "ui",
|
|
46
|
+
initialState: {
|
|
47
|
+
tema: "light",
|
|
48
|
+
temaSeleccionado: !1,
|
|
49
|
+
idioma: "es"
|
|
50
|
+
},
|
|
51
|
+
reducers: {
|
|
52
|
+
cambiarTema: (o, e) => {
|
|
53
|
+
o.tema = e.payload, o.temaSeleccionado = !0, localStorage.setItem("tema", e.payload);
|
|
54
|
+
},
|
|
55
|
+
cambiarIdioma: (o, e) => {
|
|
56
|
+
o.idioma = e.payload;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}), { cambiarTema: ze, cambiarIdioma: Ae } = $.actions, qe = $.reducer, Ie = "https://saas.chimera.com.pe/backend", De = "https://saas.chimera.com.pe/oauth", F = (o = De) => ({
|
|
60
|
+
login: (e, r) => v({
|
|
61
|
+
url: `${o}/oauth/token`,
|
|
62
|
+
headers: {
|
|
63
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
64
|
+
Authorization: `Basic ${e}`
|
|
65
|
+
},
|
|
66
|
+
method: "post",
|
|
67
|
+
data: {
|
|
68
|
+
username: r.correo,
|
|
69
|
+
password: r.password,
|
|
70
|
+
grant_type: "password"
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
refreshToken: (e, r) => v({
|
|
74
|
+
url: `${o}/oauth/token`,
|
|
75
|
+
headers: {
|
|
76
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
77
|
+
Authorization: `Basic ${e}`
|
|
78
|
+
},
|
|
79
|
+
method: "post",
|
|
80
|
+
data: {
|
|
81
|
+
refresh_token: r,
|
|
82
|
+
grant_type: "refresh_token"
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
}), P = b({
|
|
86
|
+
name: "login",
|
|
87
|
+
initialState: {
|
|
88
|
+
cargando: !1,
|
|
89
|
+
autenticado: !1,
|
|
90
|
+
token: null,
|
|
91
|
+
refreshToken: null,
|
|
92
|
+
expiracion: null,
|
|
93
|
+
usuario: null,
|
|
94
|
+
perfiles: [],
|
|
95
|
+
error: null
|
|
96
|
+
},
|
|
97
|
+
reducers: {
|
|
98
|
+
logout: (o) => {
|
|
99
|
+
o.cargando = !1, o.autenticado = !1, o.token = null, o.refreshToken = null, o.expiracion = null, o.usuario = null, o.perfiles = [], o.error = null;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
extraReducers(o) {
|
|
103
|
+
o.addCase(h.pending, (e) => {
|
|
104
|
+
e.cargando = !0, e.error = null;
|
|
105
|
+
}).addCase(h.fulfilled, (e, r) => {
|
|
106
|
+
const n = r.payload.access_token, a = me(n), s = /* @__PURE__ */ new Date();
|
|
107
|
+
s.setSeconds(s.getSeconds() + r.payload.expires_in), e.cargando = !1, e.autenticado = !0, e.token = n, e.refreshToken = r.payload.refresh_token, e.expiracion = s.getTime(), e.usuario = a.name, e.perfiles = a.authorities;
|
|
108
|
+
}).addCase(h.rejected, (e, r) => {
|
|
109
|
+
var n;
|
|
110
|
+
console.log(r), e.cargando = !1, e.autenticado = !1, e.token = null, e.refreshToken = null, e.expiracion = null, e.usuario = null, e.perfiles = [], e.error = (n = r.error) == null ? void 0 : n.message;
|
|
111
|
+
}).addCase(y.pending, (e) => {
|
|
112
|
+
e.cargando = !0;
|
|
113
|
+
}).addCase(y.fulfilled, (e, r) => {
|
|
114
|
+
const n = /* @__PURE__ */ new Date();
|
|
115
|
+
n.setSeconds(n.getSeconds() + r.payload.expires_in), e.token = r.payload.access_token, e.refreshToken = r.payload.refresh_token, e.expiracion = n.getTime();
|
|
116
|
+
}).addCase(y.rejected, (e, r) => {
|
|
117
|
+
var n;
|
|
118
|
+
e.cargando = !1, e.autenticado = !1, e.token = null, e.refreshToken = null, e.expiracion = null, e.usuario = null, e.perfiles = [], e.error = (n = r.error) == null ? void 0 : n.message;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}), h = S("login/requestToken", async (o) => (await F(o.devURL).login(o.clientCredentials, o.data)).data), y = S("login/refreshToken", async (o, e, r) => (await F(o).refreshToken(e, r)).data), { logout: Ue } = P.actions, _e = P.reducer, B = b({
|
|
122
|
+
name: "notificacion",
|
|
123
|
+
initialState: [],
|
|
124
|
+
reducers: {
|
|
125
|
+
mostrarNotificacion: (o, e) => {
|
|
126
|
+
o.push(e.payload);
|
|
127
|
+
},
|
|
128
|
+
ocultarNotificacion: (o) => {
|
|
129
|
+
o.pop();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}), { mostrarNotificacion: $e, ocultarNotificacion: Fe } = B.actions, Pe = B.reducer, Be = (o = Ie, e) => v({
|
|
133
|
+
url: `${o}/identidad/`,
|
|
134
|
+
params: {
|
|
135
|
+
codigoAplicacion: e
|
|
136
|
+
}
|
|
137
|
+
}), R = {
|
|
138
|
+
primary: "#1C6CCC",
|
|
139
|
+
secondary: "#17A7FF",
|
|
140
|
+
error: "#f44336",
|
|
141
|
+
warning: "#ff9800",
|
|
142
|
+
info: "#2196f3",
|
|
143
|
+
success: "#4caf50"
|
|
144
|
+
}, Ne = b({
|
|
145
|
+
name: "inicializar",
|
|
146
|
+
initialState: {
|
|
147
|
+
inicializando: !0,
|
|
148
|
+
inicializado: !1,
|
|
149
|
+
instancia: {
|
|
150
|
+
color: R
|
|
151
|
+
},
|
|
152
|
+
error: null
|
|
153
|
+
},
|
|
154
|
+
extraReducers(o) {
|
|
155
|
+
o.addCase(x.pending, (e) => {
|
|
156
|
+
e.inicializando = !0;
|
|
157
|
+
}).addCase(x.fulfilled, (e, r) => {
|
|
158
|
+
e.inicializando = !1, e.inicializado = !0, e.instancia = {
|
|
159
|
+
...r.payload,
|
|
160
|
+
abreviatura: r.payload.nombre.match(/\b([A-Z])/g).join(""),
|
|
161
|
+
color: {
|
|
162
|
+
...R,
|
|
163
|
+
...r.payload.color
|
|
164
|
+
}
|
|
165
|
+
}, e.error = null;
|
|
166
|
+
}).addCase(x.rejected, (e, r) => {
|
|
167
|
+
e.inicializando = !1, e.inicializado = !1, e.instancia = {
|
|
168
|
+
color: R
|
|
169
|
+
}, e.error = r.payload;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}), x = S("inicializar", async (o) => (await Be(o.devURL, o.aplicacion)).data), Ge = Ne.reducer, Ee = (o) => ue({
|
|
173
|
+
reducer: {
|
|
174
|
+
ui: qe,
|
|
175
|
+
aplicacion: Ge,
|
|
176
|
+
login: _e,
|
|
177
|
+
notificaciones: Pe,
|
|
178
|
+
...o
|
|
179
|
+
}
|
|
180
|
+
}), Me = () => {
|
|
181
|
+
const [o, e] = fe(!1), r = u(), n = k(), a = p((c) => c.notificaciones[0]);
|
|
182
|
+
f(() => {
|
|
183
|
+
e(!!a);
|
|
184
|
+
}, [a]);
|
|
185
|
+
const s = () => {
|
|
186
|
+
e(!1), r(Fe());
|
|
187
|
+
};
|
|
188
|
+
return /* @__PURE__ */ i(
|
|
189
|
+
Y,
|
|
190
|
+
{
|
|
191
|
+
open: o,
|
|
192
|
+
message: a && a.mensaje && a.tipo === "default" && n(a.mensaje),
|
|
193
|
+
autoHideDuration: 5e3,
|
|
194
|
+
onClose: s,
|
|
195
|
+
children: a && a.mensaje && a.tipo !== "default" && /* @__PURE__ */ i(I, { severity: a.tipo, children: n(a.mensaje) })
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}, He = {
|
|
199
|
+
inicializar: {
|
|
200
|
+
error: {
|
|
201
|
+
titulo: "Error iniciando aplicación",
|
|
202
|
+
mensaje: "No fue posible conectarnos con el servicio"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
login: {
|
|
206
|
+
titulo: "Acceder al sistema",
|
|
207
|
+
correo: "Correo electrónico",
|
|
208
|
+
password: "Contraseña",
|
|
209
|
+
ingresar: "Acceder",
|
|
210
|
+
validacion: {
|
|
211
|
+
correo: "Debe ingresar una dirección de correo",
|
|
212
|
+
password: "Debe ingresar una contraseña"
|
|
213
|
+
},
|
|
214
|
+
error: "Usuario o contraseña incorrectos"
|
|
215
|
+
},
|
|
216
|
+
copy: "Todos los derechos reservados "
|
|
217
|
+
}, Oe = {
|
|
218
|
+
es: He
|
|
219
|
+
}, We = { en: ye, es: xe }, N = ({ messages: o, children: e }) => {
|
|
220
|
+
const r = p((n) => n.ui.idioma);
|
|
221
|
+
return /* @__PURE__ */ i(de, { locale: r, messages: o[r], children: /* @__PURE__ */ i(ke, { dateAdapter: be, adapterLocale: We[r], children: e }) });
|
|
222
|
+
};
|
|
223
|
+
N.propTypes = {
|
|
224
|
+
messages: t.object,
|
|
225
|
+
children: t.element.isRequired
|
|
226
|
+
};
|
|
227
|
+
const G = ({ messages: o, idioma: e, children: r }) => {
|
|
228
|
+
const n = u();
|
|
229
|
+
f(() => {
|
|
230
|
+
e && n(Ae(e));
|
|
231
|
+
}, [n, e]);
|
|
232
|
+
const a = {};
|
|
233
|
+
return Object.keys(o).forEach((s) => {
|
|
234
|
+
a[s] = {
|
|
235
|
+
...o[s],
|
|
236
|
+
saas: Oe[s]
|
|
237
|
+
};
|
|
238
|
+
}), /* @__PURE__ */ i(N, { messages: a, children: r });
|
|
239
|
+
};
|
|
240
|
+
G.propTypes = {
|
|
241
|
+
messages: t.object,
|
|
242
|
+
idioma: t.string,
|
|
243
|
+
children: t.element.isRequired
|
|
244
|
+
};
|
|
245
|
+
const E = ({ children: o }) => {
|
|
246
|
+
const e = u(), { instancia: r } = p((c) => c.aplicacion), n = p((c) => c.ui.tema), a = ee("(prefers-color-scheme: dark)");
|
|
247
|
+
f(() => {
|
|
248
|
+
e(ze(a ? "dark" : "light"));
|
|
249
|
+
}, [e, a]);
|
|
250
|
+
const s = ge(() => Te({
|
|
251
|
+
palette: {
|
|
252
|
+
mode: n,
|
|
253
|
+
primary: {
|
|
254
|
+
main: r.color.primary
|
|
255
|
+
},
|
|
256
|
+
secondary: {
|
|
257
|
+
main: r.color.secondary
|
|
258
|
+
},
|
|
259
|
+
error: {
|
|
260
|
+
main: r.color.error
|
|
261
|
+
},
|
|
262
|
+
warning: {
|
|
263
|
+
main: r.color.warning
|
|
264
|
+
},
|
|
265
|
+
info: {
|
|
266
|
+
main: r.color.info
|
|
267
|
+
},
|
|
268
|
+
success: {
|
|
269
|
+
main: r.color.success
|
|
270
|
+
},
|
|
271
|
+
...n === "light" && {
|
|
272
|
+
background: {
|
|
273
|
+
default: L.A200,
|
|
274
|
+
paper: L[100]
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
shape: {
|
|
279
|
+
borderRadius: 6
|
|
280
|
+
}
|
|
281
|
+
}), [n, r]);
|
|
282
|
+
return /* @__PURE__ */ d(Ce, { theme: s, children: [
|
|
283
|
+
/* @__PURE__ */ i(re, {}),
|
|
284
|
+
o
|
|
285
|
+
] });
|
|
286
|
+
};
|
|
287
|
+
E.propTypes = {
|
|
288
|
+
children: t.element.isRequired
|
|
289
|
+
};
|
|
290
|
+
const M = (o) => {
|
|
291
|
+
const e = u(), r = p((a) => a.login), n = p((a) => a.aplicacion.instancia);
|
|
292
|
+
return f(() => {
|
|
293
|
+
r.autenticado && r.expiracion && new Date(r.expiracion) < /* @__PURE__ */ new Date() && (r.refreshToken ? e(y(o, n.clientCredentials, r.refreshToken)) : e(Ue()));
|
|
294
|
+
}, [o, n.clientCredentials, r, e]), r.autenticado;
|
|
295
|
+
}, Qe = () => {
|
|
296
|
+
const o = u();
|
|
297
|
+
return he((e, r = "default") => {
|
|
298
|
+
o($e({ mensaje: e, tipo: r }));
|
|
299
|
+
}, [o]);
|
|
300
|
+
}, H = ({ devURL: o }) => {
|
|
301
|
+
const e = u(), r = k(), n = Qe(), { cargando: a, error: s } = p((l) => l.login), c = p((l) => l.aplicacion.instancia), T = (l) => {
|
|
302
|
+
e(h({
|
|
303
|
+
devURL: o,
|
|
304
|
+
clientCredentials: c.clientCredentials,
|
|
305
|
+
data: {
|
|
306
|
+
correo: l.correo,
|
|
307
|
+
password: l.password
|
|
308
|
+
}
|
|
309
|
+
}));
|
|
310
|
+
}, K = (l) => {
|
|
311
|
+
const C = { correo: void 0, password: void 0 };
|
|
312
|
+
return l.correo || (C.correo = r("saas.login.validacion.correo")), l.password || (C.password = r("saas.login.validacion.password")), C;
|
|
313
|
+
};
|
|
314
|
+
return f(() => {
|
|
315
|
+
s && n("saas.login.error", "error");
|
|
316
|
+
}, [n, s]), /* @__PURE__ */ i(
|
|
317
|
+
je,
|
|
318
|
+
{
|
|
319
|
+
onSubmit: T,
|
|
320
|
+
validate: K,
|
|
321
|
+
render: ({ handleSubmit: l }) => /* @__PURE__ */ d("form", { onSubmit: l, children: [
|
|
322
|
+
/* @__PURE__ */ i(
|
|
323
|
+
A,
|
|
324
|
+
{
|
|
325
|
+
id: "correo",
|
|
326
|
+
name: "correo",
|
|
327
|
+
label: r("saas.login.correo"),
|
|
328
|
+
variant: "outlined",
|
|
329
|
+
autoComplete: "off",
|
|
330
|
+
disabled: a,
|
|
331
|
+
autoFocus: !0,
|
|
332
|
+
InputProps: {
|
|
333
|
+
startAdornment: /* @__PURE__ */ i(j, { position: "start", children: /* @__PURE__ */ i(ve, { color: "primary" }) })
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
),
|
|
337
|
+
/* @__PURE__ */ i(
|
|
338
|
+
A,
|
|
339
|
+
{
|
|
340
|
+
id: "password",
|
|
341
|
+
name: "password",
|
|
342
|
+
type: "password",
|
|
343
|
+
label: r("saas.login.password"),
|
|
344
|
+
variant: "outlined",
|
|
345
|
+
autoComplete: "current-password",
|
|
346
|
+
disabled: a,
|
|
347
|
+
InputProps: {
|
|
348
|
+
startAdornment: /* @__PURE__ */ i(j, { position: "start", children: /* @__PURE__ */ i(Se, { color: "primary" }) })
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
),
|
|
352
|
+
/* @__PURE__ */ d(m, { container: !0, children: [
|
|
353
|
+
/* @__PURE__ */ i(m, { item: !0, xs: 6 }),
|
|
354
|
+
/* @__PURE__ */ i(m, { item: !0, xs: 6, align: "right", children: /* @__PURE__ */ i(
|
|
355
|
+
le,
|
|
356
|
+
{
|
|
357
|
+
variant: "contained",
|
|
358
|
+
color: "primary",
|
|
359
|
+
type: "submit",
|
|
360
|
+
disabled: a,
|
|
361
|
+
children: a ? /* @__PURE__ */ i(q, { size: 24, thickness: 4 }) : r("saas.login.ingresar")
|
|
362
|
+
}
|
|
363
|
+
) })
|
|
364
|
+
] })
|
|
365
|
+
] })
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
};
|
|
369
|
+
H.propTypes = {
|
|
370
|
+
devURL: t.string
|
|
371
|
+
};
|
|
372
|
+
const O = ({ devURL: o }) => {
|
|
373
|
+
const e = p((c) => c.aplicacion.instancia), r = k(), n = D(), a = M(o), { from: s } = n.state || { from: { pathname: "/" } };
|
|
374
|
+
return !e.requiereLogin || a ? /* @__PURE__ */ i(U, { to: s }) : /* @__PURE__ */ d(g, { sx: {
|
|
375
|
+
position: "relative",
|
|
376
|
+
display: "flex",
|
|
377
|
+
flexDirection: "column",
|
|
378
|
+
flexGrow: 1,
|
|
379
|
+
minHeight: "100vh",
|
|
380
|
+
backgroundColor: "primary.main",
|
|
381
|
+
"&::before": {
|
|
382
|
+
content: '""',
|
|
383
|
+
backgroundImage: `url(${e.logo})`,
|
|
384
|
+
backgroundSize: "contain",
|
|
385
|
+
backgroundRepeat: "no-repeat",
|
|
386
|
+
backgroundPosition: "right",
|
|
387
|
+
position: "absolute",
|
|
388
|
+
top: "20%",
|
|
389
|
+
bottom: 0,
|
|
390
|
+
right: 0,
|
|
391
|
+
width: "50%",
|
|
392
|
+
opacity: 0.02,
|
|
393
|
+
filter: "grayscale(100%)"
|
|
394
|
+
}
|
|
395
|
+
}, children: [
|
|
396
|
+
/* @__PURE__ */ i(g, { sx: {
|
|
397
|
+
display: "flex",
|
|
398
|
+
justifyContent: "center",
|
|
399
|
+
alignItems: "center",
|
|
400
|
+
flexGrow: 1
|
|
401
|
+
}, children: /* @__PURE__ */ i(oe, { maxWidth: "md", children: /* @__PURE__ */ d(m, { container: !0, spacing: 3, children: [
|
|
402
|
+
/* @__PURE__ */ d(m, { item: !0, xs: 12, lg: 5, align: "center", children: [
|
|
403
|
+
/* @__PURE__ */ i("img", { src: e.logo, alt: e.nombre, style: { maxWidth: "100%" } }),
|
|
404
|
+
/* @__PURE__ */ i(w, { variant: "h3", align: "center", children: r("aplicacion.nombre", { smart_count: 1 }) }),
|
|
405
|
+
/* @__PURE__ */ i(w, { variant: "h5", align: "center", children: e.nombre })
|
|
406
|
+
] }),
|
|
407
|
+
/* @__PURE__ */ i(m, { item: !0, xs: 12, lg: 7, sx: {
|
|
408
|
+
display: "flex",
|
|
409
|
+
alignItems: "center",
|
|
410
|
+
justifyContent: "center",
|
|
411
|
+
zIndex: 5
|
|
412
|
+
}, children: /* @__PURE__ */ d(ie, { elevation: 5, children: [
|
|
413
|
+
/* @__PURE__ */ i(ne, { title: r("saas.login.titulo"), titleTypographyProps: { align: "center" } }),
|
|
414
|
+
/* @__PURE__ */ i(ae, { sx: {
|
|
415
|
+
"& .MuiTextField-root": {
|
|
416
|
+
mb: 2
|
|
417
|
+
}
|
|
418
|
+
}, children: /* @__PURE__ */ i(H, { devURL: o }) })
|
|
419
|
+
] }) })
|
|
420
|
+
] }) }) }),
|
|
421
|
+
/* @__PURE__ */ i(te, { position: "static", color: "primary", children: /* @__PURE__ */ i(se, { sx: { justifyContent: "center" }, children: /* @__PURE__ */ d(w, { variant: "caption", children: [
|
|
422
|
+
r("saas.copy"),
|
|
423
|
+
/* @__PURE__ */ i(ce, { href: "//chimera.com.pe", color: "inherit", target: "_blank", rel: "noreferrer", children: "Chimera Software" })
|
|
424
|
+
] }) }) })
|
|
425
|
+
] });
|
|
426
|
+
};
|
|
427
|
+
O.propTypes = {
|
|
428
|
+
devURL: t.string
|
|
429
|
+
};
|
|
430
|
+
const W = ({ devURL: o, redirectTo: e, children: r }) => {
|
|
431
|
+
const n = D();
|
|
432
|
+
return M(o) ? r : /* @__PURE__ */ i(U, { to: e, state: { from: n }, replace: !0 });
|
|
433
|
+
};
|
|
434
|
+
W.propTypes = {
|
|
435
|
+
devURL: t.string,
|
|
436
|
+
redirectTo: t.string.isRequired,
|
|
437
|
+
children: t.element.isRequired
|
|
438
|
+
};
|
|
439
|
+
const Q = ({ devURL: o, requiereLogin: e, children: r }) => /* @__PURE__ */ i(we, { children: /* @__PURE__ */ d(Re, { children: [
|
|
440
|
+
/* @__PURE__ */ i(z, { path: "/login", element: /* @__PURE__ */ i(O, { devURL: o }) }),
|
|
441
|
+
/* @__PURE__ */ i(
|
|
442
|
+
z,
|
|
443
|
+
{
|
|
444
|
+
path: "/*",
|
|
445
|
+
element: e ? /* @__PURE__ */ i(W, { devURL: o, redirectTo: "/login", children: r }) : r
|
|
446
|
+
}
|
|
447
|
+
)
|
|
448
|
+
] }) });
|
|
449
|
+
Q.propTypes = {
|
|
450
|
+
devURL: t.string,
|
|
451
|
+
requiereLogin: t.bool,
|
|
452
|
+
children: t.element.isRequired
|
|
453
|
+
};
|
|
454
|
+
const Z = ({ devURL: o, children: e }) => {
|
|
455
|
+
const r = p((n) => n.aplicacion);
|
|
456
|
+
return /* @__PURE__ */ i(g, { sx: {
|
|
457
|
+
display: "flex",
|
|
458
|
+
flexDirection: "column",
|
|
459
|
+
minHeight: "100vh",
|
|
460
|
+
justifyContent: "flex-start",
|
|
461
|
+
backgroundColor: "background.default"
|
|
462
|
+
}, children: r.inicializando ? /* @__PURE__ */ i(Le, {}) : r.error || !r.inicializado ? /* @__PURE__ */ i(_, { titulo: "saas.inicializar.error.titulo", texto: "saas.inicializar.error.mensaje" }) : /* @__PURE__ */ d(V, { children: [
|
|
463
|
+
/* @__PURE__ */ i(Q, { devURL: o, requiereLogin: r.instancia.requiereLogin, children: e }),
|
|
464
|
+
/* @__PURE__ */ i(Me, {})
|
|
465
|
+
] }) });
|
|
466
|
+
};
|
|
467
|
+
Z.propTypes = {
|
|
468
|
+
devURL: t.string,
|
|
469
|
+
children: t.element.isRequired
|
|
470
|
+
};
|
|
471
|
+
const J = ({
|
|
472
|
+
aplicacion: o,
|
|
473
|
+
devSaasURL: e,
|
|
474
|
+
devAuthURL: r,
|
|
475
|
+
messages: n,
|
|
476
|
+
idioma: a,
|
|
477
|
+
children: s
|
|
478
|
+
}) => {
|
|
479
|
+
const c = u();
|
|
480
|
+
return f(() => {
|
|
481
|
+
c(x({ devURL: e, aplicacion: o }));
|
|
482
|
+
}, [c, o, e]), /* @__PURE__ */ i(G, { messages: n, idioma: a, children: /* @__PURE__ */ i(E, { children: /* @__PURE__ */ i(Z, { devURL: r, children: s }) }) });
|
|
483
|
+
};
|
|
484
|
+
J.propTypes = {
|
|
485
|
+
aplicacion: t.string.isRequired,
|
|
486
|
+
devSaasURL: t.string,
|
|
487
|
+
devAuthURL: t.string,
|
|
488
|
+
messages: t.object,
|
|
489
|
+
idioma: t.string,
|
|
490
|
+
children: t.element.isRequired
|
|
491
|
+
};
|
|
492
|
+
const Ze = ({
|
|
493
|
+
customReducers: o,
|
|
494
|
+
aplicacion: e,
|
|
495
|
+
devSaasURL: r,
|
|
496
|
+
devAuthURL: n,
|
|
497
|
+
dev: a = !1,
|
|
498
|
+
idioma: s,
|
|
499
|
+
messages: c,
|
|
500
|
+
children: T
|
|
501
|
+
}) => /* @__PURE__ */ i(pe, { store: Ee(o), children: /* @__PURE__ */ i(
|
|
502
|
+
J,
|
|
503
|
+
{
|
|
504
|
+
aplicacion: e,
|
|
505
|
+
devSaasURL: a && r,
|
|
506
|
+
devAuthURL: a && n,
|
|
507
|
+
idioma: s,
|
|
508
|
+
messages: c,
|
|
509
|
+
children: T
|
|
510
|
+
}
|
|
511
|
+
) });
|
|
512
|
+
Ze.propTypes = {
|
|
513
|
+
customReducers: t.object,
|
|
514
|
+
aplicacion: t.string.isRequired,
|
|
515
|
+
devSaasURL: t.string,
|
|
516
|
+
devAuthURL: t.string,
|
|
517
|
+
dev: t.bool,
|
|
518
|
+
idioma: t.string,
|
|
519
|
+
messages: t.object,
|
|
520
|
+
children: t.element.isRequired
|
|
521
|
+
};
|
|
522
|
+
export {
|
|
523
|
+
Le as Cargando,
|
|
524
|
+
_ as Error,
|
|
525
|
+
Ze as SaasApp,
|
|
526
|
+
Ue as logout,
|
|
527
|
+
Qe as useNotificar
|
|
528
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(t,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("@mui/material"),require("react-polyglot"),require("prop-types"),require("react-redux"),require("@reduxjs/toolkit"),require("axios"),require("jwt-decode"),require("react"),require("date-fns/locale"),require("@mui/x-date-pickers"),require("@mui/x-date-pickers/AdapterDateFns"),require("@mui/material/styles"),require("@mui/material/colors"),require("react-router-dom"),require("@mui/icons-material"),require("react-final-form"),require("mui-rff")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@mui/material","react-polyglot","prop-types","react-redux","@reduxjs/toolkit","axios","jwt-decode","react","date-fns/locale","@mui/x-date-pickers","@mui/x-date-pickers/AdapterDateFns","@mui/material/styles","@mui/material/colors","react-router-dom","@mui/icons-material","react-final-form","mui-rff"],o):(t=typeof globalThis<"u"?globalThis:t||self,o(t["react-saas"]={},t.ReactJSX,t.MuiMaterial,t.ReactPolyglot,t.PropTypes,t.ReactRedux,t.ReduxToolkit,t.Axios,t.JWTDecode,t.React,t.DateFNSLocale,t.MuiXDatePickers,t.MuiXDatePickersAdapter,t.MuiMaterialStyles,t.MuiMaterialColors,t.ReactRouterDom,t.MuiIconsMaterial,t.ReactFinalForm,t.MUIRFF))})(this,function(t,o,c,m,s,d,h,S,Z,f,b,K,V,A,j,g,L,Y,z){"use strict";const T=()=>o.jsx(c.Box,{sx:{display:"flex",flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"center"},children:o.jsx(c.CircularProgress,{})}),C=({titulo:i,texto:e,align:r="center",severity:n="error"})=>{const a=m.useTranslate();return o.jsx(c.Box,{sx:{display:"flex",flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:r},children:o.jsxs(c.Alert,{severity:n,children:[o.jsx(c.AlertTitle,{children:a(i)}),e&&a(e)]})})};C.propTypes={titulo:s.string.isRequired,texto:s.string,align:s.string,severity:s.string};const I=h.createSlice({name:"ui",initialState:{tema:"light",temaSeleccionado:!1,idioma:"es"},reducers:{cambiarTema:(i,e)=>{i.tema=e.payload,i.temaSeleccionado=!0,localStorage.setItem("tema",e.payload)},cambiarIdioma:(i,e)=>{i.idioma=e.payload}}}),{cambiarTema:P,cambiarIdioma:R}=I.actions,ee=I.reducer,re="https://saas.chimera.com.pe/backend",ie="https://saas.chimera.com.pe/oauth",D=(i=ie)=>({login:(e,r)=>S({url:`${i}/oauth/token`,headers:{"content-type":"application/x-www-form-urlencoded",Authorization:`Basic ${e}`},method:"post",data:{username:r.correo,password:r.password,grant_type:"password"}}),refreshToken:(e,r)=>S({url:`${i}/oauth/token`,headers:{"content-type":"application/x-www-form-urlencoded",Authorization:`Basic ${e}`},method:"post",data:{refresh_token:r,grant_type:"refresh_token"}})}),F=h.createSlice({name:"login",initialState:{cargando:!1,autenticado:!1,token:null,refreshToken:null,expiracion:null,usuario:null,perfiles:[],error:null},reducers:{logout:i=>{i.cargando=!1,i.autenticado=!1,i.token=null,i.refreshToken=null,i.expiracion=null,i.usuario=null,i.perfiles=[],i.error=null}},extraReducers(i){i.addCase(k.pending,e=>{e.cargando=!0,e.error=null}).addCase(k.fulfilled,(e,r)=>{const n=r.payload.access_token,a=Z(n),l=new Date;l.setSeconds(l.getSeconds()+r.payload.expires_in),e.cargando=!1,e.autenticado=!0,e.token=n,e.refreshToken=r.payload.refresh_token,e.expiracion=l.getTime(),e.usuario=a.name,e.perfiles=a.authorities}).addCase(k.rejected,(e,r)=>{var n;console.log(r),e.cargando=!1,e.autenticado=!1,e.token=null,e.refreshToken=null,e.expiracion=null,e.usuario=null,e.perfiles=[],e.error=(n=r.error)==null?void 0:n.message}).addCase(x.pending,e=>{e.cargando=!0}).addCase(x.fulfilled,(e,r)=>{const n=new Date;n.setSeconds(n.getSeconds()+r.payload.expires_in),e.token=r.payload.access_token,e.refreshToken=r.payload.refresh_token,e.expiracion=n.getTime()}).addCase(x.rejected,(e,r)=>{var n;e.cargando=!1,e.autenticado=!1,e.token=null,e.refreshToken=null,e.expiracion=null,e.usuario=null,e.perfiles=[],e.error=(n=r.error)==null?void 0:n.message})}}),k=h.createAsyncThunk("login/requestToken",async i=>(await D(i.devURL).login(i.clientCredentials,i.data)).data),x=h.createAsyncThunk("login/refreshToken",async(i,e,r)=>(await D(i).refreshToken(e,r)).data),{logout:M}=F.actions,oe=F.reducer,U=h.createSlice({name:"notificacion",initialState:[],reducers:{mostrarNotificacion:(i,e)=>{i.push(e.payload)},ocultarNotificacion:i=>{i.pop()}}}),{mostrarNotificacion:ne,ocultarNotificacion:ae}=U.actions,se=U.reducer,ce=(i=re,e)=>S({url:`${i}/identidad/`,params:{codigoAplicacion:e}}),w={primary:"#1C6CCC",secondary:"#17A7FF",error:"#f44336",warning:"#ff9800",info:"#2196f3",success:"#4caf50"},te=h.createSlice({name:"inicializar",initialState:{inicializando:!0,inicializado:!1,instancia:{color:w},error:null},extraReducers(i){i.addCase(y.pending,e=>{e.inicializando=!0}).addCase(y.fulfilled,(e,r)=>{e.inicializando=!1,e.inicializado=!0,e.instancia={...r.payload,abreviatura:r.payload.nombre.match(/\b([A-Z])/g).join(""),color:{...w,...r.payload.color}},e.error=null}).addCase(y.rejected,(e,r)=>{e.inicializando=!1,e.inicializado=!1,e.instancia={color:w},e.error=r.payload})}}),y=h.createAsyncThunk("inicializar",async i=>(await ce(i.devURL,i.aplicacion)).data),le=te.reducer,de=i=>h.configureStore({reducer:{ui:ee,aplicacion:le,login:oe,notificaciones:se,...i}}),ue=()=>{const[i,e]=f.useState(!1),r=d.useDispatch(),n=m.useTranslate(),a=d.useSelector(u=>u.notificaciones[0]);f.useEffect(()=>{e(!!a)},[a]);const l=()=>{e(!1),r(ae())};return o.jsx(c.Snackbar,{open:i,message:a&&a.mensaje&&a.tipo==="default"&&n(a.mensaje),autoHideDuration:5e3,onClose:l,children:a&&a.mensaje&&a.tipo!=="default"&&o.jsx(c.Alert,{severity:a.tipo,children:n(a.mensaje)})})},pe={es:{inicializar:{error:{titulo:"Error iniciando aplicación",mensaje:"No fue posible conectarnos con el servicio"}},login:{titulo:"Acceder al sistema",correo:"Correo electrónico",password:"Contraseña",ingresar:"Acceder",validacion:{correo:"Debe ingresar una dirección de correo",password:"Debe ingresar una contraseña"},error:"Usuario o contraseña incorrectos"},copy:"Todos los derechos reservados "}},fe={en:b.enGB,es:b.es},B=({messages:i,children:e})=>{const r=d.useSelector(n=>n.ui.idioma);return o.jsx(m.I18n,{locale:r,messages:i[r],children:o.jsx(K.LocalizationProvider,{dateAdapter:V.AdapterDateFns,adapterLocale:fe[r],children:e})})};B.propTypes={messages:s.object,children:s.element.isRequired};const _=({messages:i,idioma:e,children:r})=>{const n=d.useDispatch();f.useEffect(()=>{e&&n(R(e))},[n,e]);const a={};return Object.keys(i).forEach(l=>{a[l]={...i[l],saas:pe[l]}}),o.jsx(B,{messages:a,children:r})};_.propTypes={messages:s.object,idioma:s.string,children:s.element.isRequired};const E=({children:i})=>{const e=d.useDispatch(),{instancia:r}=d.useSelector(u=>u.aplicacion),n=d.useSelector(u=>u.ui.tema),a=c.useMediaQuery("(prefers-color-scheme: dark)");f.useEffect(()=>{e(P(a?"dark":"light"))},[e,a]);const l=f.useMemo(()=>A.createTheme({palette:{mode:n,primary:{main:r.color.primary},secondary:{main:r.color.secondary},error:{main:r.color.error},warning:{main:r.color.warning},info:{main:r.color.info},success:{main:r.color.success},...n==="light"&&{background:{default:j.grey.A200,paper:j.grey[100]}}},shape:{borderRadius:6}}),[n,r]);return o.jsxs(A.ThemeProvider,{theme:l,children:[o.jsx(c.CssBaseline,{}),i]})};E.propTypes={children:s.element.isRequired};const G=i=>{const e=d.useDispatch(),r=d.useSelector(a=>a.login),n=d.useSelector(a=>a.aplicacion.instancia);return f.useEffect(()=>{r.autenticado&&r.expiracion&&new Date(r.expiracion)<new Date&&(r.refreshToken?e(x(i,n.clientCredentials,r.refreshToken)):e(M()))},[i,n.clientCredentials,r,e]),r.autenticado},N=()=>{const i=d.useDispatch();return f.useCallback((e,r="default")=>{i(ne({mensaje:e,tipo:r}))},[i])},$=({devURL:i})=>{const e=d.useDispatch(),r=m.useTranslate(),n=N(),{cargando:a,error:l}=d.useSelector(p=>p.login),u=d.useSelector(p=>p.aplicacion.instancia),q=p=>{e(k({devURL:i,clientCredentials:u.clientCredentials,data:{correo:p.correo,password:p.password}}))},he=p=>{const v={correo:void 0,password:void 0};return p.correo||(v.correo=r("saas.login.validacion.correo")),p.password||(v.password=r("saas.login.validacion.password")),v};return f.useEffect(()=>{l&&n("saas.login.error","error")},[n,l]),o.jsx(Y.Form,{onSubmit:q,validate:he,render:({handleSubmit:p})=>o.jsxs("form",{onSubmit:p,children:[o.jsx(z.TextField,{id:"correo",name:"correo",label:r("saas.login.correo"),variant:"outlined",autoComplete:"off",disabled:a,autoFocus:!0,InputProps:{startAdornment:o.jsx(c.InputAdornment,{position:"start",children:o.jsx(L.Email,{color:"primary"})})}}),o.jsx(z.TextField,{id:"password",name:"password",type:"password",label:r("saas.login.password"),variant:"outlined",autoComplete:"current-password",disabled:a,InputProps:{startAdornment:o.jsx(c.InputAdornment,{position:"start",children:o.jsx(L.Lock,{color:"primary"})})}}),o.jsxs(c.Grid,{container:!0,children:[o.jsx(c.Grid,{item:!0,xs:6}),o.jsx(c.Grid,{item:!0,xs:6,align:"right",children:o.jsx(c.Button,{variant:"contained",color:"primary",type:"submit",disabled:a,children:a?o.jsx(c.CircularProgress,{size:24,thickness:4}):r("saas.login.ingresar")})})]})]})})};$.propTypes={devURL:s.string};const H=({devURL:i})=>{const e=d.useSelector(u=>u.aplicacion.instancia),r=m.useTranslate(),n=g.useLocation(),a=G(i),{from:l}=n.state||{from:{pathname:"/"}};return!e.requiereLogin||a?o.jsx(g.Navigate,{to:l}):o.jsxs(c.Box,{sx:{position:"relative",display:"flex",flexDirection:"column",flexGrow:1,minHeight:"100vh",backgroundColor:"primary.main","&::before":{content:'""',backgroundImage:`url(${e.logo})`,backgroundSize:"contain",backgroundRepeat:"no-repeat",backgroundPosition:"right",position:"absolute",top:"20%",bottom:0,right:0,width:"50%",opacity:.02,filter:"grayscale(100%)"}},children:[o.jsx(c.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",flexGrow:1},children:o.jsx(c.Container,{maxWidth:"md",children:o.jsxs(c.Grid,{container:!0,spacing:3,children:[o.jsxs(c.Grid,{item:!0,xs:12,lg:5,align:"center",children:[o.jsx("img",{src:e.logo,alt:e.nombre,style:{maxWidth:"100%"}}),o.jsx(c.Typography,{variant:"h3",align:"center",children:r("aplicacion.nombre",{smart_count:1})}),o.jsx(c.Typography,{variant:"h5",align:"center",children:e.nombre})]}),o.jsx(c.Grid,{item:!0,xs:12,lg:7,sx:{display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:o.jsxs(c.Card,{elevation:5,children:[o.jsx(c.CardHeader,{title:r("saas.login.titulo"),titleTypographyProps:{align:"center"}}),o.jsx(c.CardContent,{sx:{"& .MuiTextField-root":{mb:2}},children:o.jsx($,{devURL:i})})]})})]})})}),o.jsx(c.AppBar,{position:"static",color:"primary",children:o.jsx(c.Toolbar,{sx:{justifyContent:"center"},children:o.jsxs(c.Typography,{variant:"caption",children:[r("saas.copy"),o.jsx(c.Link,{href:"//chimera.com.pe",color:"inherit",target:"_blank",rel:"noreferrer",children:"Chimera Software"})]})})})]})};H.propTypes={devURL:s.string};const O=({devURL:i,redirectTo:e,children:r})=>{const n=g.useLocation();return G(i)?r:o.jsx(g.Navigate,{to:e,state:{from:n},replace:!0})};O.propTypes={devURL:s.string,redirectTo:s.string.isRequired,children:s.element.isRequired};const W=({devURL:i,requiereLogin:e,children:r})=>o.jsx(g.BrowserRouter,{children:o.jsxs(g.Routes,{children:[o.jsx(g.Route,{path:"/login",element:o.jsx(H,{devURL:i})}),o.jsx(g.Route,{path:"/*",element:e?o.jsx(O,{devURL:i,redirectTo:"/login",children:r}):r})]})});W.propTypes={devURL:s.string,requiereLogin:s.bool,children:s.element.isRequired};const X=({devURL:i,children:e})=>{const r=d.useSelector(n=>n.aplicacion);return o.jsx(c.Box,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",justifyContent:"flex-start",backgroundColor:"background.default"},children:r.inicializando?o.jsx(T,{}):r.error||!r.inicializado?o.jsx(C,{titulo:"saas.inicializar.error.titulo",texto:"saas.inicializar.error.mensaje"}):o.jsxs(o.Fragment,{children:[o.jsx(W,{devURL:i,requiereLogin:r.instancia.requiereLogin,children:e}),o.jsx(ue,{})]})})};X.propTypes={devURL:s.string,children:s.element.isRequired};const J=({aplicacion:i,devSaasURL:e,devAuthURL:r,messages:n,idioma:a,children:l})=>{const u=d.useDispatch();return f.useEffect(()=>{u(y({devURL:e,aplicacion:i}))},[u,i,e]),o.jsx(_,{messages:n,idioma:a,children:o.jsx(E,{children:o.jsx(X,{devURL:r,children:l})})})};J.propTypes={aplicacion:s.string.isRequired,devSaasURL:s.string,devAuthURL:s.string,messages:s.object,idioma:s.string,children:s.element.isRequired};const Q=({customReducers:i,aplicacion:e,devSaasURL:r,devAuthURL:n,dev:a=!1,idioma:l,messages:u,children:q})=>o.jsx(d.Provider,{store:de(i),children:o.jsx(J,{aplicacion:e,devSaasURL:a&&r,devAuthURL:a&&n,idioma:l,messages:u,children:q})});Q.propTypes={customReducers:s.object,aplicacion:s.string.isRequired,devSaasURL:s.string,devAuthURL:s.string,dev:s.bool,idioma:s.string,messages:s.object,children:s.element.isRequired},t.Cargando=T,t.Error=C,t.SaasApp=Q,t.logout=M,t.useNotificar=N,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chimera-pe/react-saas",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -8,47 +8,51 @@
|
|
|
8
8
|
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
|
9
9
|
"preview": "vite preview"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
12
|
-
"@reduxjs/toolkit": ">=1.9",
|
|
13
|
-
"react": ">=18"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
11
|
+
"dependencies": {
|
|
16
12
|
"@emotion/react": "^11.11.1",
|
|
17
13
|
"@emotion/styled": "^11.11.0",
|
|
18
14
|
"@mui/icons-material": "^5.14.1",
|
|
19
15
|
"@mui/lab": "^5.0.0-alpha.137",
|
|
20
16
|
"@mui/material": "^5.14.1",
|
|
17
|
+
"@mui/x-date-pickers": "^6.10.1",
|
|
21
18
|
"@reduxjs/toolkit": "^1.9.5",
|
|
19
|
+
"axios": "^1.4.0",
|
|
20
|
+
"date-fns": "^2.30.0",
|
|
21
|
+
"final-form": "^4.20.9",
|
|
22
|
+
"jwt-decode": "^3.1.2",
|
|
23
|
+
"mui-rff": "^6.2.0",
|
|
24
|
+
"react": ">=18",
|
|
25
|
+
"react-dom": ">=18",
|
|
26
|
+
"react-final-form": "^6.5.9",
|
|
27
|
+
"react-polyglot": "^0.7.2",
|
|
28
|
+
"react-redux": "^8.1.1",
|
|
29
|
+
"react-router-dom": "^6.14.2"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": ">=18",
|
|
33
|
+
"react-dom": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
22
36
|
"@types/react": "^18.2.14",
|
|
23
37
|
"@types/react-dom": "^18.2.6",
|
|
24
38
|
"@vitejs/plugin-react": "^4.0.1",
|
|
25
|
-
"axios": "^1.4.0",
|
|
26
|
-
"date-fns": "^2.30.0",
|
|
27
39
|
"eslint": "^8.44.0",
|
|
28
40
|
"eslint-plugin-react": "^7.32.2",
|
|
29
41
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
30
42
|
"eslint-plugin-react-refresh": "^0.4.1",
|
|
31
|
-
"jwt-decode": "^3.1.2",
|
|
32
|
-
"mui-rff": "^6.1.4",
|
|
33
|
-
"react": "^18.2.0",
|
|
34
|
-
"react-dom": "^18.2.0",
|
|
35
|
-
"react-polyglot": "^0.7.2",
|
|
36
|
-
"react-redux": "^8.1.1",
|
|
37
|
-
"react-router-dom": "^6.14.2",
|
|
38
43
|
"vite": "^4.4.0"
|
|
39
44
|
},
|
|
40
45
|
"description": "Componente integrador con SaaS",
|
|
41
|
-
"main": "dist/react-saas.umd.
|
|
42
|
-
"module": "dist/react-saas.
|
|
46
|
+
"main": "./dist/react-saas.umd.cjs",
|
|
47
|
+
"module": "./dist/react-saas.js",
|
|
43
48
|
"exports": {
|
|
44
49
|
".": {
|
|
45
|
-
"import": "./dist/react-saas.
|
|
46
|
-
"
|
|
50
|
+
"import": "./dist/react-saas.js",
|
|
51
|
+
"require": "./dist/react-saas.umd.cjs"
|
|
47
52
|
}
|
|
48
53
|
},
|
|
49
54
|
"files": [
|
|
50
|
-
|
|
51
|
-
"src"
|
|
55
|
+
"dist"
|
|
52
56
|
],
|
|
53
57
|
"repository": {
|
|
54
58
|
"type": "git",
|