@zydon/common 2.7.33 → 2.7.35
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-4LP75UX2.js +3 -0
- package/dist/components/FieldMentions/index.d.ts +2 -1
- package/dist/components/FieldMentions/index.js +11 -11
- package/dist/contexts/PushNotifications/index.js +1 -1
- package/dist/types/fieldMentions.d.ts +4 -0
- package/dist/types/fieldMentions.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-SPIMM5MW.js +0 -3
|
@@ -2,13 +2,14 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { BaseSuggestionData, MentionData, SuggestionDataSource, SuggestionOverlaySlotProps } from '../../types/fieldMentions.js';
|
|
3
3
|
import { TextFieldVariants, TextFieldProps } from '@mui/material/TextField';
|
|
4
4
|
import '@mui/material/Popper';
|
|
5
|
+
import '@mui/material/styles';
|
|
6
|
+
import '@mui/system';
|
|
5
7
|
|
|
6
8
|
interface FieldMentionsBaseProps<T extends BaseSuggestionData> {
|
|
7
9
|
value?: string;
|
|
8
10
|
defaultValue?: string;
|
|
9
11
|
onChange?: (newValue: string, newPlainText: string, mentions: MentionData[]) => void;
|
|
10
12
|
dataSources: SuggestionDataSource<T>[];
|
|
11
|
-
highlightColor?: string;
|
|
12
13
|
inputRef?: React.Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
13
14
|
highlightTextColor?: boolean;
|
|
14
15
|
slotProps?: {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { a as a$1 } from '../../chunk-WIPXRHSG.js';
|
|
2
|
-
import { b, c, a } from '../../chunk-
|
|
2
|
+
import { b, c, a } from '../../chunk-4LP75UX2.js';
|
|
3
3
|
import { useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import Ye from '@mui/material/TextField';
|
|
5
5
|
import A from '@mui/material/Box';
|
|
6
6
|
import Be from '@mui/material/Portal';
|
|
7
7
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
8
|
+
import Q from 'invariant';
|
|
9
|
+
import Ke from '@mui/material/CircularProgress';
|
|
10
|
+
import Qe from '@mui/material/List';
|
|
11
|
+
import ze from '@mui/material/Paper';
|
|
12
|
+
import Ge from '@mui/material/Popper';
|
|
13
|
+
import Je from '@mui/material/Stack';
|
|
14
14
|
import Ae from '@mui/material/ListItemButton';
|
|
15
15
|
|
|
16
|
-
var we=({display:e,color:t,highlightTextColor:
|
|
17
|
-
`,"")),!(r&&r===o&&r>=
|
|
16
|
+
var we=({display:e,color:t,backgroundColor:n,highlightTextColor:o})=>jsxs(A,{component:"span",sx:{position:"relative",color:o&&t?t:"transparent",...o&&n&&{bgcolor:n}},children:[e,!o&&n&&jsx(A,{component:"span",sx:{position:"absolute",left:"-1px",top:"-2px",bottom:0,right:"-1px",borderRadius:"3px",color:"transparent"}})]}),ue=we;function z(e){return typeof e=="number"}function Ce(e){let t=/^\/(.+)\/(\w+)?$/;return new RegExp(e.map(n=>{let[,o,r]=t.exec(n.toString())||[];return Q(!r,`RegExp flags are not supported. Change /${o}/${r} into /${o}/`),`(${o})`}).join("|"),"g")}function pe(e){let t=0;return e.indexOf("__id__")>=0&&t++,e.indexOf("__display__")>=0&&t++,t}function ce(e,t){Q(t==="id"||t==="display",`Second arg must be either "id" or "display", got: "${t}"`);let n=e.indexOf("__display__"),o=e.indexOf("__id__");return Q(n>=0||o>=0,`The markup '${e}' does not contain at least one of the placeholders '__id__' or '__display__'`),n>=0&&o>=0?t==="id"&&o<=n||t==="display"&&n<=o?0:1:0}function H(e,t,n,o,r){let u=Ce(t.map(a=>a.regex?ve(a.regex,a.markup||b):ke(a.markup||b))),d=2,c$1=t.map(({markup:a})=>{let f=d;return d+=pe(a||b)+1,f}),i,l=0,g=0;for(;(i=u.exec(e))!==null;){let a=c$1.find(k=>!!i?.[k]);if(a===void 0)continue;let f=c$1.indexOf(a),{markup:x,displayTransform:p}=t[f],m=a+ce(x||b,"id"),M=a+ce(x||b,"display"),D=i[m],T=p?p(D,i[M]):c(D,i[M],r),R=e.substring(l,i.index);o?.(R,l,g),g+=R.length,n(i[0],i.index,g,D,T,f,l),g+=T.length,l=u.lastIndex;}l<e.length&&o?.(e.substring(l),l,g);}function $(e,t,n){let o="";return H(e,t,(r,u,d,c,i)=>{o+=i;},r=>{o+=r;},n),o}var ve=(e,t)=>{let n=(new RegExp(e.toString()+"|").exec("")?.length||0)-1,o=pe(t);return Q(n===o,`Number of capturing groups in RegExp ${e.toString()} (${n}) does not match the number of placeholders in the markup '${t}' (${o})`),e},ke=e=>{let t=K(e),n=e[e.indexOf("__display__")+11],o=e[e.indexOf("__id__")+6];return new RegExp(t.replace("__display__",`([^${K(n||"")}]+?)`).replace("__id__",`([^${K(o||"")}]+?)`))},K=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");function de(e,t,n,o,r,u,d){let c=$(e,u,d),i=c.length-t.length;n===null&&(n=r+i),o===null&&(o=n),n===o&&o===r&&c.length===t.length&&(n=n-1);let l=t.slice(n,r),g=Math.min(n,r),a=o;n===r&&(a=Math.max(o,n+i));let f=L(e,u,g,"START"),x=L(e,u,a,"END"),p=L(e,u,g,"NULL"),m=L(e,u,a,"NULL"),M=p===null||m===null,D=V(e,f||0,x||0,l);if(!M){let T=$(D,u,d);if(T!==t){for(g=0;t[g]===T[g];)g++;l=t.slice(g,r),a=c.lastIndexOf(t.substring(r)),f=L(e,u,g,"START"),x=L(e,u,a,"END"),D=V(e,f||0,x||0,l);}}return D}function L(e,t,n,o="START"){if(typeof n!="number")return n;let r;return H(e,t,(c,i,l,g,a)=>{r===void 0&&l+a.length>n&&(o==="NULL"?r=null:r=i+(o==="END"?c.length:0));},(c,i,l)=>{r===void 0&&l+c.length>=n&&(r=i+n-l);}),r===void 0?e.length:r}function V(e,t,n,o){return e.substring(0,t)+o+e.substring(n)}function fe(e,t,n){let o;return H(e,t,(u,d,c,i,l)=>{c<=n&&c+l.length>n&&(o=c);}),o}function G(e,t){let n=[];return H(e,t,(o,r,u,d,c,i)=>{n.push({id:d,display:c,dataSourceIndex:i,index:r,plainTextIndex:u});}),n}function me(e){return Object.values(e).reduce((t,{results:n})=>t+n.length,0)}function he(e,t){let n=G(e,t),o=n[n.length-1];return o?o.plainTextIndex+o.display.length:0}function Se(e,t){if(e instanceof RegExp)return e;{let n=K(e);return new RegExp(`(?:^|\\s)(${n}([^${t?"":"\\s"}${n}]*))$`)}}function xe(e,t){return e instanceof Array?async function(n){let o=[];for(let r=0,u=e.length;r<u;++r){let d=e[r].display||e[r].id;Oe(d,n,t)>=0&&o.push(e[r]);}return o}:e}var Oe=(e,t,n)=>n?ge(e).indexOf(ge(t)):e.toLowerCase().indexOf(t.toLowerCase()),$e=e=>{let t=e;return a$1.forEach(n=>{t=t.replace(n.letters,n.base);}),t},ge=e=>$e(e).toLowerCase(),Te=(e,t,n)=>e.replace("__id__",t).replace("__display__",n||t);function Fe(e){let t={x:0,y:0,width:0,height:0};if(!e)return t;let n=getComputedStyle(e);return t.width=e.clientWidth,t.width-=parseFloat(n.paddingLeft),t.width-=parseFloat(n.paddingRight),t.height=e.clientHeight,t.height-=parseFloat(n.paddingTop),t.height-=parseFloat(n.paddingBottom),t.x=e.offsetLeft,t.x+=parseFloat(n.paddingLeft),t.x+=parseFloat(n.borderLeft),t.y=e.offsetTop,t.y+=parseFloat(n.paddingTop),t.y+=parseFloat(n.borderTop),t}var _e=e=>{let{highlighterRef:t,cursorRef:n,selectionEnd:o,selectionStart:r,value:u,dataSources:d,multiline:c,highlightTextColor:i}=e,l=[];H(u,d,(x,p,m,M,D,T)=>{let R=d[T];l.push(jsx(ue,{display:D,color:R?.color,backgroundColor:R?.backgroundColor,highlightTextColor:i},`${M}-${p}`));},(x,p,m)=>{if(c||(x=x.replaceAll(`
|
|
17
|
+
`,"")),!(r&&r===o&&r>=m&&r<=m+x.length))l.push(jsx(A,{component:"span",visibility:i?"visible":"hidden",children:x},`${p}-${m}`));else {let D=r-m,T=x.substring(0,D),R=x.substring(D);T&&l.push(jsx(A,{component:"span",visibility:i?"visible":"hidden",children:T},`${p}-${m}-precursor`)),l.push(jsx(A,{ref:n,component:"span",visibility:"hidden"},"cursor")),R&&l.push(jsx(A,{component:"span",visibility:i?"visible":"hidden",children:R},`${p}-${m}-postcursor`));}},c);let f=Fe(e.inputRef);return jsx(Be,{container:()=>e.inputRef?.parentElement||null,children:jsxs(A,{ref:t,sx:{position:"absolute",top:`${f.y}px`,left:`${f.x}px`,width:`${f.width}px`,height:`${f.height}px`,whiteSpace:c?"pre-wrap":"pre",overflow:"hidden",overscrollBehavior:"none",zIndex:i?1:-1,pointerEvents:"none"},children:[l,jsx(A,{component:"span",visibility:"hidden",children:" "})]})})},be=_e;var Ne=e=>{let{renderSuggestion:t,suggestion:n,focused:o,onClick:r,onMouseEnter:u}=e;if(t)return t(e);let d=c(n.id,n.display);return jsx(Ae,{role:"option","aria-selected":o,selected:o,onClick:r,onMouseEnter:u,children:d})},ye=Ne;var Xe=e=>{let{value:t,dataSources:n,selectionStart:o,selectionEnd:r,cursorRef:u,onSelect:d,onMouseDown:c}=e,i=useRef(null),[l,g]=useState({}),[a$1,f]=useState(0),[x,p]=useState(!1),[m,M]=useState(!1);useEffect(()=>{let h=i.current;if(!x||!h||h.children.length===0)return;let y=h.scrollTop,{top:s,bottom:S}=h.children[a$1].getBoundingClientRect(),{top:b}=h.getBoundingClientRect();s=s-b+y,S=S-b+y,s<y?h.scrollTop=s:S>h.offsetHeight+y&&(h.scrollTop=S-h.offsetHeight),p(!1);},[x,i,a$1,p]);let D=useCallback(async(h,y,s,S,b,P)=>{try{let w=xe(h.data,h.ignoreAccents);M(!0);let I=await w(y);g(E=>({...E,[s]:{queryInfo:{childIndex:s,query:y,querySequenceStart:S,querySequenceEnd:b,plainTextValue:P},results:I}}));}catch(w){console.error(w);}finally{M(!1);}},[]),T=useRef(n);useEffect(()=>{T.current=n;},[n]),useEffect(()=>{if(g({}),!o||o!==r)return;let h=T.current,y=$(t,h),s=L(y,h,o,"NULL");if(!s)return;let S=he(y.substring(0,s),h),b=y.substring(S,o);h.forEach((P,w)=>{if(!P)return;let I=Se(P.trigger||a,P.allowSpaceInQuery),E=b.match(I);if(E){let C=S+b.indexOf(E[1],E.index);D(P,E[2],w,C,C+E[1].length,y);}});},[o,r,t,D]);let R=useCallback(()=>{g({}),f(0);},[g,f]),k=useCallback((h,y)=>{d(h,y),R();},[d,R]),U=useCallback(h=>{f(h);},[f]),N=useMemo(()=>Object.values(l).reduce((h,{results:y,queryInfo:s})=>[...h,...y.map((S,b)=>jsx(ye,{id:S.id,query:s.query,index:b,suggestion:S,focused:b===a$1,onClick:()=>k(S,s),onMouseEnter:()=>U(b)},S.id))],[]),[l,k,U,a$1]);return o===null||o!==r||!m&&N.length===0?null:jsxs(Fragment,{children:[jsx(je,{suggestions:l,clearSuggestions:R,onSelect:k,focusIndex:a$1,setFocusIndex:f,setScrollFocusedIntoView:p,loading:m}),jsx(Ge,{placement:"bottom-start",...e.slotProps?.popper,sx:{zIndex:2,...e.slotProps?.popper?.sx},open:!0,anchorEl:u.current,children:jsx(ze,{elevation:8,onMouseDown:c,children:jsx(Qe,{ref:i,sx:{width:"300px",maxHeight:"40vh",overflow:"auto"},children:N.length>0?N:m&&jsx(Je,{justifyContent:"center",alignItems:"center",height:"40vh",children:jsx(Ke,{})})})})})]})},Me=Xe;var je=e=>{let{suggestions:t,clearSuggestions:n,focusIndex:o,setFocusIndex:r,setScrollFocusedIntoView:u,onSelect:d,loading:c}=e;return useEffect(()=>{let i=a=>{if(c)return;let f=me(t);r((f+o+a)%f),u(!0);},l=()=>{if(c)return;let{result:a,queryInfo:f}=Object.values(t).reduce((x,{results:p,queryInfo:m})=>[...x,...p.map(M=>({result:M,queryInfo:m}))],[])[o];d(a,f);},g=a=>{switch(a.key){case"Escape":{n();break}case"ArrowDown":{i(1);break}case"ArrowUp":{i(-1);break}case"Enter":case"Tab":{l();break}default:return}a.preventDefault(),a.stopPropagation();};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[t,n,o,r,d,u,c]),null};var Ze=e=>{let[t,n]=useState(e.defaultValue||""),[o,r]=useState(null),u=useRef(null),d=useRef(null),c$1=useRef(!1),[i,l]=useState(null),[g,a]=useState(null),f=s=>{r(s),m&&(typeof m=="function"?m(s):m&&"current"in m&&typeof m!="function"&&(m.current=s));};useEffect(()=>{let s=o,S=()=>{!u.current||!s||(u.current.scrollLeft=s.scrollLeft,u.current.scrollTop=s.scrollTop);};return s?.addEventListener("scroll",S),()=>s?.removeEventListener("scroll",S)},[o,u]),useEffect(()=>{let s=o;!s||s.selectionStart===i&&s.selectionEnd===g||s.setSelectionRange(i,g);},[i,g,o]);let{value:x,dataSources:p,inputRef:m,highlightTextColor:M,...D}=e,T=x!==void 0?x:t,R=()=>{c$1.current||(l(null),a(null)),c$1.current=!1;},k=()=>{c$1.current=!0;},U=(s,{childIndex:S,querySequenceStart:b$1,querySequenceEnd:P,plainTextValue:w})=>{let I=p[S],{markup:E,displayTransform:C,appendSpaceOnAdd:q,onAdd:te}=I,O=L(T,p,b$1,"START");if(!z(O))return;let ne=O+P-b$1,oe=Te(E||b,s.id,s.display),Y=(C||c)(s.id,s.display);q&&(oe+=" ",Y+=" ");let re=b$1+Y.length;l(re),a(re);let se=V(T,O,ne,oe),Ee=G(se,p),Pe=V(w,b$1,P,Y);(e.onChange||n)(se,Pe,Ee),te?.(s,O,ne);},N=s=>{let S=s.target.value,b=i;z(b)||(b=s.target.selectionStart);let P=g;z(P)||(P=s.target.selectionEnd);let w=de(T,S,b,P,s.target.selectionEnd||0,p,e.multiline);S=$(w,p);let I=s.target.selectionStart,E=s.target.selectionEnd,C=fe(T,p,s.target.selectionStart||0);if(C!==void 0&&E!==null&&E>C){let O=s.nativeEvent.data;I=C+(O?O.length:0),E=I;}l(I),a(E);let q=G(w,p);(e.onChange||n)(w,S,q);},h=s=>{l(s.target.selectionStart),a(s.target.selectionEnd),e.onSelect?.(s);},y={...D,value:$(T,p,e.multiline),onChange:N,onSelect:h,onBlur:R,InputProps:{sx:{overscrollBehavior:"none",color:M?void 0:"transparent",caretColor:M?void 0:s=>s.palette.text.primary}}};return jsxs(Fragment,{children:[jsx(be,{highlighterRef:u,cursorRef:d,selectionStart:i,selectionEnd:g,value:T,dataSources:p,inputRef:o,multiline:y.multiline,highlightTextColor:M}),jsx(Ye,{inputRef:f,...y}),jsx(Me,{value:T,dataSources:p,selectionStart:i,selectionEnd:g,cursorRef:d,loading:!1,onSelect:U,onMouseDown:k,slotProps:e.slotProps?.suggestionsOverlay})]})},nn=Ze;
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { nn as default };
|
|
@@ -5,6 +5,6 @@ import '../../chunk-6MUF35YU.js';
|
|
|
5
5
|
import { createContext, useState, useRef, useMemo, useEffect, useCallback, useContext } from 'react';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
|
-
var Z=createContext(void 0),le=({children:d,originId:I,originType:C,bearerToken:S,vapidKey:V,serviceWorkerPath:G="/",serviceWorkerFile:H="service-worker.js",pollingInterval:k=1e3,apiAdapters:n,onMessageReceived:m,onError:r})=>{let[t,p]=useState(null),[x,h]=useState(0),[W,M]=useState(!1),[v,b]=useState(!1),[y,O]=useState(!1),[N,ee]=useState(!1),[A,te]=useState({subscriptions:[]}),[B,z]=useState(!1),[R]=useState(new Set),
|
|
8
|
+
var Z=createContext(void 0),le=({children:d,originId:I,originType:C,bearerToken:S,vapidKey:V,serviceWorkerPath:G="/",serviceWorkerFile:H="service-worker.js",pollingInterval:k=1e3,apiAdapters:n,onMessageReceived:m,onError:r})=>{let[t,p]=useState(null),[x,h]=useState(0),[W,M]=useState(!1),[v,b]=useState(!1),[y,O]=useState(!1),[N,ee]=useState(!1),[A,te]=useState({subscriptions:[]}),[B,z]=useState(!1),[R]=useState(new Set),g=useRef(new Map),F=useMemo(()=>!t||B,[t,B]);useEffect(()=>{if(!v||!y||!t||!n.fetchMessages||g.current.size===0)return;let e=setInterval(async()=>{try{let c=(await n.fetchMessages(t))?.messages?.[0];if(c?.payload){let o=c.id;if(R.has(o))return;R.add(o),h(a=>a+1),m?.(c.payload);try{await n.updateMessageStatus(o,{status:"DELIVERED"});}catch(a$1){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao marcar mensagem como entregue:",data:a$1});}finally{let a=c.topic;g.current.get(a)?.stopPollingOnFirstMessage&&(g.current.delete(a),g.current.size>0||(b(!1),O(!1)));}}}catch(s){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao buscar mensagens:",data:s});}},k);return ()=>clearInterval(e)},[v,y,t,k,n,m,R]);let P=useCallback(async(e,s)=>{try{let c=e?.toJSON().keys,o={origin_type:C,origin_id:I,...s&&e?{endpoint:e.endpoint,auth:c?.auth,p256dh:c?.p256dh}:{}},a=await n.registerClient(o);return p(a.id),M(!1),ee(s),s||O(!0),a.id}catch(c){return a({type:"ERROR",environment:["development","homologation"],message:"Erro ao registrar cliente:",data:c}),M(!0),r?.(c),null}},[n,I,C,r]);useEffect(()=>{let e=!0,s=null;async function c(){if(!("serviceWorker"in navigator)||!("PushManager"in window)){a({type:"WARN",environment:["development","homologation"],message:"Push notifications n\xE3o suportadas, criando cliente ativo com polling"});try{let o=await P(null,!1);e&&o&&(p(o),O(!0));}catch(o){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao registrar cliente ativo:",data:o}),r?.(o);}return}try{let o=await Notification.requestPermission(),a$2=null,f=!1;if(o==="granted")try{let w=await navigator.serviceWorker.register(`${G}${H}`);if(!e||(await navigator.serviceWorker.ready,!e))return;a$2=await w.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:a$1(V)}),s=async j=>{let K=j.data?.payload,Q=j.data?.id;if(K&&(h(T=>T+1),m?.(K)),Q)try{await n.updateMessageStatus(Q,{status:"DELIVERED"});}catch(T){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao atualizar status da mensagem:",data:T}),M(!0),r?.(T);}},navigator.serviceWorker.addEventListener("message",s),f=!0,a({type:"LOG",environment:["development","homologation"],message:"Permiss\xE3o concedida, criando cliente passivo (aguarda webpush)"});}catch(w){a({type:"WARN",environment:["development","homologation"],message:"Falha ao configurar push subscription, criando cliente ativo:",data:w}),f=!1;}else a({type:"WARN",environment:["development","homologation"],message:"Permiss\xE3o de notifica\xE7\xE3o negada, criando cliente ativo com polling"}),f=!1;let L=await P(a$2,f);e&&L&&(p(L),f||O(!0));}catch(o){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao inicializar notifica\xE7\xF5es:",data:o}),r?.(o);try{let a=await P(null,!1);e&&a&&(p(a),O(!0));}catch(a$1){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao criar cliente ativo como fallback:",data:a$1});}}}return S&&c(),()=>{e=!1,s&&"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",s);}},[S,P,n,V,G,H,m,r]);let u=useCallback(async()=>{if(t){z(!0);try{let e=await n.listSubscriptions(t);te(e);}catch(e){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao listar inscri\xE7\xF5es:",data:e}),r?.(e);}finally{z(!1);}}},[t,n,r]);useEffect(()=>{t&&u();},[t]);let _=useCallback(async(e,s)=>{if(!t){a({type:"WARN",environment:["development","homologation"],message:"Cliente n\xE3o registrado"});return}try{s&&g.current.set(e,s),await n.subscribeTopic(t,e),await u(),!N&&(!v||!y)&&(b(!0),O(!0));}catch(c){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao inscrever no t\xF3pico:",data:c}),r?.(c);}},[t,n,u,r,v,y,N]),$=useCallback(async e=>{if(!t){a({type:"WARN",environment:["development","homologation"],message:"Cliente n\xE3o registrado"});return}try{g.current.delete(e),await n.unsubscribeTopic(t,e),await u();}catch(s){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao desinscrever do t\xF3pico:",data:s}),r?.(s);}},[t,n,u,r]),q=useCallback(async e=>{if(!(!t||e.length===0))try{await n.subscribeTopicsBatch(t,e),await u(),N||(b(!0),O(!0));}catch(s){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao inscrever em t\xF3picos:",data:s}),r?.(s);}},[t,n,u,r,N]),J=useCallback(async e=>{if(!(!t||e.length===0))try{await n.unsubscribeTopicsBatch(t,e),await u();}catch(s){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao desinscrever de t\xF3picos:",data:s}),r?.(s);}},[t,n,u,r]),U=useCallback(()=>{h(0);},[]),se=useMemo(()=>({clientId:t,subscribedTopics:A,isLoading:F,newMessageCount:x,isRegisterError:W,subscribeToTopic:_,unsubscribeFromTopic:$,subscribeTopicsBatch:q,unsubscribeTopicsBatch:J,resetMessageCount:U}),[t,A,F,x,W,_,$,q,J,U]);return jsx(Z.Provider,{value:se,children:d})};function Oe(){let d=useContext(Z);if(!d)throw new Error("usePushNotifications precisa estar dentro de PushNotificationProvider");return d}
|
|
9
9
|
|
|
10
10
|
export { le as PushNotificationProvider, Oe as usePushNotifications };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PopperProps } from '@mui/material/Popper';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
import { SystemProps } from '@mui/system';
|
|
2
4
|
|
|
3
5
|
interface BaseSuggestionData {
|
|
4
6
|
id: string;
|
|
@@ -18,6 +20,8 @@ interface SuggestionDataSource<T extends BaseSuggestionData> {
|
|
|
18
20
|
appendSpaceOnAdd?: boolean;
|
|
19
21
|
displayTransform?: (id: string, display?: string) => string;
|
|
20
22
|
onAdd?: (suggestion: SuggestionData<T>, start: number, end: number) => void;
|
|
23
|
+
color?: SystemProps<Theme>['color'];
|
|
24
|
+
backgroundColor?: SystemProps<Theme>['bgcolor'];
|
|
21
25
|
}
|
|
22
26
|
interface SuggestionOverlaySlotProps {
|
|
23
27
|
popper?: Omit<PopperProps, 'anchorEl' | 'open'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { c as DefaultDisplayTransform, b as DefaultMarkupTemplate, a as DefaultTrigger } from '../chunk-
|
|
1
|
+
export { c as DefaultDisplayTransform, b as DefaultMarkupTemplate, a as DefaultTrigger } from '../chunk-4LP75UX2.js';
|
package/package.json
CHANGED
package/dist/chunk-SPIMM5MW.js
DELETED