@zydon/common 2.7.10 → 2.7.12
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/{chunk-3IPWUPD7.js → chunk-6LVV2OOJ.js} +1 -1
- package/dist/chunk-OBYJ5SJ2.js +5 -0
- package/dist/components/DataView/index.js +1 -1
- package/dist/components/ListBundles/index.js +1 -1
- package/dist/components/Result/index.d.ts +5 -3
- package/dist/components/Result/index.js +1 -1
- package/dist/components/SelectableCards/index.js +2 -2
- package/dist/components/SwapList/index.js +1 -1
- package/dist/components/form/SelectableCards/index.js +2 -2
- package/dist/contexts/PushNotifications/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-TWGGHTU5.js +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as a$4 } from './chunk-INPRA4JV.js';
|
|
2
2
|
import { a as a$1 } from './chunk-URVMF4MW.js';
|
|
3
|
-
import { a as a$3 } from './chunk-
|
|
3
|
+
import { a as a$3 } from './chunk-OBYJ5SJ2.js';
|
|
4
4
|
import { a as a$2 } from './chunk-26GV7WKC.js';
|
|
5
5
|
import { a as a$5 } from './chunk-WIJV4EHZ.js';
|
|
6
6
|
import { useState } from 'react';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
var l=({isFetching:e,fetching:n,isLoading:u,loading:f,anError:a,error:s,isEmpty:p,empty:d,data:t,children:r})=>{if(u)return f||"Carregando...";if(a)return s||"Error";if(p)return d||"Nenhum resultado";let i=t!==void 0&&typeof r=="function"?r(t):r;return jsxs(Fragment,{children:[e&&jsx(Fragment,{children:n||"Carregando..."}),i]})},m=l;
|
|
4
|
+
|
|
5
|
+
export { m as a };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as a$5 } from '../../chunk-URVMF4MW.js';
|
|
2
|
-
import { a as a$6 } from '../../chunk-
|
|
2
|
+
import { a as a$6 } from '../../chunk-OBYJ5SJ2.js';
|
|
3
3
|
import { a as a$2 } from '../../chunk-5YJTSVA2.js';
|
|
4
4
|
import { a } from '../../chunk-NPXVOPB2.js';
|
|
5
5
|
import { a as a$9 } from '../../chunk-T7AZE2TB.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as a$2 } from '../../chunk-Q7HPO5OB.js';
|
|
2
|
-
import { a as a$1 } from '../../chunk-
|
|
2
|
+
import { a as a$1 } from '../../chunk-OBYJ5SJ2.js';
|
|
3
3
|
import { o, a, f, k as k$1 } from '../../chunk-AJYSAO5N.js';
|
|
4
4
|
import '../../chunk-WIJV4EHZ.js';
|
|
5
5
|
import '../../chunk-FO7JCJ76.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
-
interface ResultProps {
|
|
5
|
+
interface ResultProps<TData = unknown> {
|
|
6
6
|
isFetching?: boolean;
|
|
7
7
|
fetching?: ReactNode;
|
|
8
8
|
isLoading?: boolean;
|
|
@@ -11,8 +11,10 @@ interface ResultProps {
|
|
|
11
11
|
error?: ReactNode;
|
|
12
12
|
isEmpty?: boolean;
|
|
13
13
|
empty?: ReactNode;
|
|
14
|
+
data?: TData;
|
|
15
|
+
children?: ReactNode | ((data: TData) => ReactNode);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
declare const Result: ({ isFetching, fetching, isLoading, loading, anError, error, isEmpty, empty, children, }:
|
|
18
|
+
declare const Result: <TData>({ isFetching, fetching, isLoading, loading, anError, error, isEmpty, empty, data, children, }: ResultProps<TData>) => string | number | true | Iterable<react.ReactNode> | react_jsx_runtime.JSX.Element;
|
|
17
19
|
|
|
18
20
|
export { Result as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-OBYJ5SJ2.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-6LVV2OOJ.js';
|
|
2
2
|
import '../../chunk-INPRA4JV.js';
|
|
3
3
|
import '../../chunk-URVMF4MW.js';
|
|
4
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-OBYJ5SJ2.js';
|
|
5
5
|
import '../../chunk-U26IUEAG.js';
|
|
6
6
|
import '../../chunk-26GV7WKC.js';
|
|
7
7
|
import '../../chunk-WIJV4EHZ.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as a$2 } from '../../chunk-INPRA4JV.js';
|
|
2
2
|
import { a } from '../../chunk-URVMF4MW.js';
|
|
3
|
-
import { a as a$1 } from '../../chunk-
|
|
3
|
+
import { a as a$1 } from '../../chunk-OBYJ5SJ2.js';
|
|
4
4
|
import '../../chunk-U26IUEAG.js';
|
|
5
5
|
import { a as a$3 } from '../../chunk-26GV7WKC.js';
|
|
6
6
|
import { a as a$4 } from '../../chunk-WIJV4EHZ.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a } from '../../../chunk-
|
|
1
|
+
import { a } from '../../../chunk-6LVV2OOJ.js';
|
|
2
2
|
import '../../../chunk-INPRA4JV.js';
|
|
3
3
|
import '../../../chunk-URVMF4MW.js';
|
|
4
|
-
import '../../../chunk-
|
|
4
|
+
import '../../../chunk-OBYJ5SJ2.js';
|
|
5
5
|
import '../../../chunk-U26IUEAG.js';
|
|
6
6
|
import '../../../chunk-26GV7WKC.js';
|
|
7
7
|
import '../../../chunk-WIJV4EHZ.js';
|
|
@@ -3,6 +3,6 @@ import '../../chunk-IHAHXNLH.js';
|
|
|
3
3
|
import { createContext, useState, useMemo, useEffect, useCallback, useContext } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var G=createContext(void 0),re=({children:f,originId:C,originType:M,bearerToken:E,vapidKey:S,serviceWorkerPath:T="/",serviceWorkerFile:N="service-worker.js",pollingInterval:k=1e3,apiAdapters:r,onMessageReceived:g,onError:o})=>{let[t,d]=useState(null),[x,D]=useState(null),[L,y]=useState(0),[I,w]=useState(!1),[B,K]=useState(!1),[R,Q]=useState({subscriptions:[]}),[W,z]=useState(!1),O=useMemo(()=>!t||W,[t,W]);useEffect(()=>{if(!B||!t||!r.fetchMessages)return;let e=setInterval(async()=>{try{let a=(await r.fetchMessages(t))?.messages?.[0];a&&(D(a),y(i=>i+1),g?.(a));}catch(s){console.error("Erro ao buscar mensagens:",s);}},k);return ()=>clearInterval(e)},[B,t,r,k,g]);let h=useCallback(async(e,s)=>{try{let a=e?.toJSON().keys,i={origin_type:M,origin_id:C,...s&&e?{endpoint:e.endpoint,auth:a?.auth,p256dh:a?.p256dh}:{}},c=await r.registerClient(i);return d(c.id),w(!1),K(!s),c.id}catch(a){return console.error("Erro ao registrar cliente:",a),w(!0),o?.(a),null}},[r,C,M,o]);useEffect(()=>{let e=!0,s=null;async function a$1(){if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("Push notifications n\xE3o suportadas, criando cliente ativo com polling");try{let i=await h(null,!1);e&&d?.(i);}catch(i){console.error("Erro ao registrar cliente ativo:",i),o?.(i);}return}try{let i=await Notification.requestPermission(),c=null,v=!1;if(i==="granted")try{let P=await navigator.serviceWorker.register(`${T}${N}`);if(!e||(await navigator.serviceWorker.ready,!e))return;c=await P.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:a(S)}),s=async H=>{let m=H.data?.payload;m&&(D(m),y(b=>b+1),g?.(m));let J=H.data?.id?.value;if(J)try{await r.updateMessageStatus(J,{status:"DELIVERED"});}catch(b){console.error("Erro ao atualizar status da mensagem:",b),w(!0),o?.(b);}},navigator.serviceWorker.addEventListener("message",s),v=!0,console.log("Permiss\xE3o concedida, criando cliente passivo (aguarda webpush)");}catch(P){console.warn("Falha ao configurar push subscription, criando cliente ativo:",P),v=!1;}else console.warn("Permiss\xE3o de notifica\xE7\xE3o negada, criando cliente ativo com polling"),v=!1;let Y=await h(c,v);e&&d?.(Y);}catch(i){console.error("Erro ao inicializar notifica\xE7\xF5es:",i),o?.(i);try{let c=await h(null,!1);e&&d?.(c);}catch(c){console.error("Erro ao criar cliente ativo como fallback:",c);}}}return E&&a$1(),()=>{e=!1,s&&"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",s);}},[E,h,r,S,T,N,g,o]);let n=useCallback(async()=>{if(t){z(!0);try{let e=await r.listSubscriptions(t);Q(e);}catch(e){console.error("Erro ao listar inscri\xE7\xF5es:",e),o?.(e);}finally{z(!1);}}},[t,r,o]);useEffect(()=>{t&&n();},[t]);let V=useCallback(async e=>{if(t)try{await r.subscribeTopic(t,e),await n();}catch(s){console.error("Erro ao inscrever em t\xF3pico:",s),o?.(s);}},[t,r,n,o]),_=useCallback(async e=>{if(t)try{await r.unsubscribeTopic(t,e),await n();}catch(s){console.error("Erro ao desinscrever de t\xF3pico:",s),o?.(s);}},[t,r,n,o]),$=useCallback(async e=>{if(!(!t||e.length===0))try{await r.subscribeTopicsBatch(t,e),await n();}catch(s){console.error("Erro ao inscrever em t\xF3picos:",s),o?.(s);}},[t,r,n,o]),q=useCallback(async e=>{if(!(!t||e.length===0))try{await r.unsubscribeTopicsBatch(t,e),await n();}catch(s){console.error("Erro ao desinscrever de t\xF3picos:",s),o?.(s);}},[t,r,n,o]),F=useCallback(()=>{y(0);},[]),X=useMemo(()=>({clientId:t,subscribedTopics:R,isRegisterError:I,isLoading:O,lastMessage:x,newMessageCount:L,subscribeToTopic:V,unsubscribeFromTopic:_,subscribeTopicsBatch:$,unsubscribeTopicsBatch:q,resetMessageCount:F}),[t,R,I,O,x,L,V,_,$,q,F]);return jsx(G.Provider,{value:X,children:f})};function oe(){let f=useContext(G);if(!f)throw new Error("usePushNotifications precisa estar dentro de PushNotificationProvider");return f}
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { re as PushNotificationProvider, oe as usePushNotifications };
|
package/package.json
CHANGED
package/dist/chunk-TWGGHTU5.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
var d=({isFetching:o,fetching:e,isLoading:t,loading:n,anError:u,error:i,isEmpty:s,empty:l,children:p})=>t?n||"Carregando...":u?i||"Error":s?l||"Nenhum resultado":jsxs(Fragment,{children:[o&&jsx(Fragment,{children:e||"Carregando..."}),p]}),h=d;
|
|
4
|
-
|
|
5
|
-
export { h as a };
|