@cnc-ti/layout-basic 8.7.0 → 8.8.0

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.mjs CHANGED
@@ -7328,10 +7328,14 @@ async function buscarAlertas({
7328
7328
  email,
7329
7329
  fetchFn = fetch,
7330
7330
  signal,
7331
- eventoId
7331
+ eventoId,
7332
+ filtros
7332
7333
  }) {
7333
7334
  const params = new URLSearchParams({ sistema, email });
7334
7335
  if (eventoId !== void 0) params.set("eventoId", String(eventoId));
7336
+ for (const [chave, valor] of Object.entries(filtros ?? {})) {
7337
+ if (valor !== void 0 && valor !== null && valor !== "") params.set(chave, String(valor));
7338
+ }
7335
7339
  const url = `${normalizarBaseUrl(baseUrl)}/notificacoes?${params.toString()}`;
7336
7340
  const resposta = await fetchFn(url, {
7337
7341
  method: "GET",
@@ -7354,6 +7358,7 @@ function usarAlertas({
7354
7358
  email,
7355
7359
  fetchFn,
7356
7360
  eventoId,
7361
+ filtros,
7357
7362
  habilitado = true,
7358
7363
  onErro
7359
7364
  }) {
@@ -7363,13 +7368,18 @@ function usarAlertas({
7363
7368
  const jaCarregouRef = React31.useRef(false);
7364
7369
  const onErroRef = React31.useRef(onErro);
7365
7370
  const fetchFnRef = React31.useRef(fetchFn);
7371
+ const filtrosRef = React31.useRef(filtros);
7366
7372
  React31.useEffect(() => {
7367
7373
  onErroRef.current = onErro;
7368
7374
  }, [onErro]);
7369
7375
  React31.useEffect(() => {
7370
7376
  fetchFnRef.current = fetchFn;
7371
7377
  }, [fetchFn]);
7378
+ React31.useEffect(() => {
7379
+ filtrosRef.current = filtros;
7380
+ }, [filtros]);
7372
7381
  const pronto = baseUrl !== void 0 && sistema !== void 0 && email !== void 0;
7382
+ const filtrosChave = filtros ? JSON.stringify(filtros) : "";
7373
7383
  const atualizar = React31.useCallback(() => {
7374
7384
  if (!habilitado || !pronto) return;
7375
7385
  controladorRef.current?.abort();
@@ -7383,6 +7393,7 @@ function usarAlertas({
7383
7393
  email,
7384
7394
  fetchFn: fetchFnRef.current,
7385
7395
  eventoId,
7396
+ filtros: filtrosRef.current,
7386
7397
  signal: controlador.signal
7387
7398
  });
7388
7399
  if (controlador.signal.aborted) return;
@@ -7397,7 +7408,7 @@ function usarAlertas({
7397
7408
  }
7398
7409
  }
7399
7410
  })();
7400
- }, [baseUrl, sistema, email, eventoId, habilitado, pronto]);
7411
+ }, [baseUrl, sistema, email, eventoId, filtrosChave, habilitado, pronto]);
7401
7412
  React31.useEffect(() => {
7402
7413
  if (!habilitado || !pronto) {
7403
7414
  setCarregando(false);
@@ -7431,6 +7442,7 @@ function Alertas({
7431
7442
  email,
7432
7443
  fetchFn,
7433
7444
  eventoId,
7445
+ filtros,
7434
7446
  onErro
7435
7447
  }) {
7436
7448
  const [formAberto, setFormAberto] = React32.useState(false);
@@ -7444,6 +7456,7 @@ function Alertas({
7444
7456
  email,
7445
7457
  fetchFn,
7446
7458
  eventoId,
7459
+ filtros,
7447
7460
  habilitado: conectado,
7448
7461
  onErro
7449
7462
  });