@zydon/common 2.8.18 → 2.8.20
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/contexts/PushNotifications/index.js +1 -1
- package/dist/contexts/PushNotifications/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/theme/core/index.d.ts +1 -1
- package/dist/theme/styles/index.d.ts +12 -12
- package/package.json +1 -1
- package/dist/{index-5a5e5dc8.d.ts → index-c8f1e6e7.d.ts} +12 -12
|
@@ -5,7 +5,7 @@ import '../../chunk-TVKBRJHF.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
|
|
8
|
+
var ee=createContext(void 0),fe=({children:v,originId:V,originType:G,bearerToken:te,vapidKey:H,serviceWorkerPath:k="/",serviceWorkerFile:x="service-worker.js",pollingInterval:A=1e3,apiAdapters:r,onMessageReceived:y,onError:o})=>{let[s,h]=useState(null),[W,m]=useState(!1),[B,L]=useState(!1),[N,se]=useState(!1),[z,w]=useState(0),[D]=useState(new Set),[p,ie]=useState({subscriptions:[]}),[F,_]=useState(!1),[b,I]=useState(!1),[P,f]=useState(!1),E=useRef(new Map),$=useMemo(()=>!s||F||W,[s,F,W]);useEffect(()=>{if(!b||!P||!s||!r.fetchMessages||p.subscriptions.length===0)return;let e=setInterval(async()=>{try{let a$1=((await r.fetchMessages(s))?.messages??[]).filter(i=>!(!i?.payload||D.has(i.id)));if(a$1.length===0)return;a$1.forEach(i=>{D.add(i.id),y?.(i.payload,i.topic);}),w(i=>i+a$1.length);try{(await Promise.allSettled(a$1.map(u=>r.updateMessageStatus(u.id,{status:"DELIVERED"})))).forEach(u=>{u.status==="rejected"&&a({type:"ERROR",environment:["development","homologation"],message:"Erro ao marcar mensagem como entregue:",data:u.reason});});}finally{new Set(a$1.map(g=>g.topic).filter(Boolean)).forEach(g=>{E.current.get(g)?.stopPollingOnFirstMessage&&E.current.delete(g);}),p.subscriptions.length>0||(I(!1),f(!1));}}catch(t){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao buscar mensagens:",data:t});}},A);return ()=>clearInterval(e)},[r,s,y,b,A,D,P,p.subscriptions.length]);let T=useCallback(async(e,t)=>{m(!0);try{let c=e?.toJSON().keys,a={origin_type:G,origin_id:V,...t&&e?{endpoint:e.endpoint,auth:c?.auth,p256dh:c?.p256dh}:{}},i=await r.registerClient(a);return h(i.id),L(!1),se(t),t||f(!0),i.id}catch(c){return a({type:"ERROR",environment:["development","homologation"],message:"Erro ao registrar cliente:",data:c}),L(!0),o?.(c),null}finally{m(!1);}},[r,o,V,G]);useEffect(()=>{let e=!0,t=null;async function c(){if(m(!0),!("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 a=await T(null,!1);e&&a&&(h(a),f(!0));}catch(a$1){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao registrar cliente ativo:",data:a$1}),o?.(a$1);}finally{m(!1);}return}try{let a$2=await Notification.requestPermission(),i=null,u=!1;if(a$2==="granted")try{let M=await navigator.serviceWorker.register(`${k}${x}`);if(!e||(await navigator.serviceWorker.ready,!e))return;i=await M.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:a$1(H)}),t=async S=>{let Q=S.data?.payload,X=S.data?.id;if(Q&&(w(R=>R+1),y?.(Q,S.data?.topic)),X)try{await r.updateMessageStatus(X,{status:"DELIVERED"});}catch(R){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao atualizar status da mensagem:",data:R}),L(!0),o?.(R);}},navigator.serviceWorker.addEventListener("message",t),u=!0,a({type:"LOG",environment:["development","homologation"],message:"Permiss\xE3o concedida, criando cliente passivo (aguarda webpush)"});}catch(M){a({type:"WARN",environment:["development","homologation"],message:"Falha ao configurar push subscription, criando cliente ativo:",data:M}),u=!1;}else a({type:"WARN",environment:["development","homologation"],message:"Permiss\xE3o de notifica\xE7\xE3o negada, criando cliente ativo com polling"}),u=!1;let g=await T(i,u);e&&g&&(h(g),u||f(!0));}catch(a$1){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao inicializar notifica\xE7\xF5es:",data:a$1}),o?.(a$1);try{let i=await T(null,!1);e&&i&&(h(i),f(!0));}catch(i){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao criar cliente ativo como fallback:",data:i});}}finally{m(!1);}}return te&&a({type:"WARN",environment:["development","homologation"],message:"O par\xE2metro bearerToken est\xE1 deprecated e n\xE3o \xE9 mais necess\xE1rio. Ele ser\xE1 removido em vers\xF5es futuras."}),c(),()=>{e=!1,t&&"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",t);}},[r,o,y,T,x,k,H]);let O=useCallback(async()=>{if(s){_(!0);try{let e=await r.listSubscriptions(s);ie(e);}catch(e){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao listar inscri\xE7\xF5es:",data:e}),o?.(e);}finally{_(!1);}}},[r,s,o]);useEffect(()=>{s&&O();},[s]);let j=useCallback(async(e,t)=>{if(!s){a({type:"WARN",environment:["development","homologation"],message:"Cliente n\xE3o registrado"});return}try{t&&E.current.set(e,t),await r.subscribeTopic(s,e),await O(),!N&&(!b||!P)&&(I(!0),f(!0));}catch(c){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao inscrever no t\xF3pico:",data:c}),o?.(c);}},[r,s,N,o,b,O,P]),q=useCallback(async e=>{if(!s){a({type:"WARN",environment:["development","homologation"],message:"Cliente n\xE3o registrado"});return}try{E.current.delete(e),await r.unsubscribeTopic(s,e),await O();}catch(t){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao desinscrever do t\xF3pico:",data:t}),o?.(t);}},[r,s,o,O]),J=useCallback(async e=>{if(!(!s||e.length===0))try{e.forEach(t=>{E.current.has(t)||E.current.set(t,{});}),await r.subscribeTopicsBatch(s,e),await O(),N||(I(!0),f(!0));}catch(t){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao inscrever em t\xF3picos:",data:t}),o?.(t);}},[r,s,N,o,O]),U=useCallback(async e=>{if(!(!s||e.length===0))try{e.forEach(t=>E.current.delete(t)),await r.unsubscribeTopicsBatch(s,e),await O();}catch(t){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao desinscrever de t\xF3picos:",data:t}),o?.(t);}},[r,s,o,O]),K=useCallback(()=>{w(0);},[]),ne=useMemo(()=>({clientId:s,subscribedTopics:p,isLoading:$,newMessageCount:z,isRegisterError:B,subscribeToTopic:j,unsubscribeFromTopic:q,subscribeTopicsBatch:J,unsubscribeTopicsBatch:U,resetMessageCount:K}),[s,$,B,z,K,p,j,J,q,U]);return jsx(ee.Provider,{value:ne,children:v})};function Ee(){let v=useContext(ee);if(!v)throw new Error("usePushNotifications precisa estar dentro de PushNotificationProvider");return v}
|
|
9
9
|
|
|
10
10
|
export { fe as PushNotificationProvider, Ee as usePushNotifications };
|
|
11
11
|
//# sourceMappingURL=out.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/contexts/PushNotifications/index.tsx"],"names":["createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","jsx","PushNotificationContext","PushNotificationProvider","children","originId","originType","bearerToken","vapidKey","serviceWorkerPath","serviceWorkerFile","pollingInterval","apiAdapters","onMessageReceived","onError","clientId","setClientId","isRegistering","setIsRegistering","isRegisterError","setIsRegisterError","isPassiveClient","setIsPassiveClient","newMessageCount","setNewMessageCount","processedMessageIds","subscribedTopics","setSubscribedTopics","isLoadingSubscriptions","setIsLoadingSubscriptions","pollingEnabled","setPollingEnabled","shouldPoll","setShouldPoll","topicOptionsRef","isLoading","interval","deliverables","m","prev","consoleLog","topic","error","performClientRegistration","subscription","isPassive","keys","payload","response","mounted","messageHandler","initSwAndRegister","id","err","permission","registration","urlBase64ToUint8Array","e","message","deliveredId","fallbackErr","refetchSubscriptions","data","subscribeToTopic","options","unsubscribeFromTopic","subscribeTopicsBatch","topics","unsubscribeTopicsBatch","resetMessageCount","value","usePushNotifications","context"],"mappings":"wJAAA,OACE,iBAAAA,GACA,eAAAC,EACA,cAAAC,GACA,aAAAC,EACA,WAAAC,GACA,UAAAC,GACA,YAAAC,MACK,QA4jBH,cAAAC,OAAA,oBA9iBJ,IAAMC,GAA0BR,GAE9B,MAAS,EAEES,GAA2B,CAAsB,CAC5D,SAAAC,EACA,SAAAC,EACA,WAAAC,EACA,YAAAC,EACA,SAAAC,EACA,kBAAAC,EAAoB,IACpB,kBAAAC,EAAoB,oBACpB,gBAAAC,EAAkB,IAClB,YAAAC,EACA,kBAAAC,EACA,QAAAC,CACF,IAA+C,CAC7C,GAAM,CAACC,EAAUC,CAAW,EAAIhB,EAAwB,IAAI,EACtD,CAACiB,EAAeC,CAAgB,EAAIlB,EAAkB,EAAK,EAC3D,CAACmB,EAAiBC,CAAkB,EAAIpB,EAAkB,EAAK,EAC/D,CAACqB,EAAiBC,EAAkB,EAAItB,EAAkB,EAAK,EAC/D,CAACuB,EAAiBC,CAAkB,EAAIxB,EAAiB,CAAC,EAC1D,CAACyB,CAAmB,EAAIzB,EAAsB,IAAI,GAAK,EAEvD,CAAC0B,EAAkBC,EAAmB,EAAI3B,EAA4B,CAC1E,cAAe,CAAC,CAClB,CAAC,EACK,CAAC4B,EAAwBC,CAAyB,EACtD7B,EAAkB,EAAK,EAEnB,CAAC8B,EAAgBC,CAAiB,EAAI/B,EAAkB,EAAK,EAC7D,CAACgC,EAAYC,CAAa,EAAIjC,EAAkB,EAAK,EAErDkC,EAAkBnC,GACtB,IAAI,GACN,EAEMoC,EAAYrC,GAChB,IAAM,CAACiB,GAAYa,GAA0BX,EAC7C,CAACF,EAAUa,EAAwBX,CAAa,CAClD,EAEApB,EAAU,IAAM,CACd,GACE,CAACiC,GACD,CAACE,GACD,CAACjB,GACD,CAACH,EAAY,eACbc,EAAiB,cAAc,SAAW,EAE1C,OAEF,IAAMU,EAAW,YAAY,SAA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T,KAAMa,CACR,CAAC,EAEDvC,IAAUuC,CAAY,CACxB,CACF,EACA,CAACzC,EAAaG,EAAUD,EAAS+C,CAAoB,CACvD,EAEMQ,EAAoB1E,EAAY,IAAM,CAC1C6B,EAAmB,CAAC,CACtB,EAAG,CAAC,CAAC,EAEC8C,GAAqCxE,GACzC,KAAO,CACL,SAAAiB,EACA,iBAAAW,EACA,UAAAS,EACA,gBAAAZ,EACA,gBAAAJ,EACA,iBAAA4C,EACA,qBAAAE,EACA,qBAAAC,EACA,uBAAAE,EACA,kBAAAC,CACF,GACA,CACEtD,EACAoB,EACAhB,EACAI,EACA8C,EACA3C,EACAqC,EACAG,EACAD,EACAG,CACF,CACF,EAEA,OACEnE,GAACC,GAAwB,SAAxB,CAAiC,MAAOoE,GACtC,SAAAlE,EACH,CAEJ,EAEO,SAASmE,IAAoD,CAClE,IAAMC,EAAU5E,GAAWM,EAAuB,EAElD,GAAI,CAACsE,EACH,MAAM,IAAI,MACR,uEACF,EAGF,OAAOA,CACT","sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { ConsoleType, Environment } from 'types/consoleLog';\nimport {\n type ClientRegistrationPayload,\n MessageStatus,\n type PushNotificationContextData,\n type PushNotificationProviderProps,\n type SubscriptionsData,\n type TopicSubscriptionOptions,\n} from 'types/pushNotifications';\nimport { consoleLog } from 'utils/consoleLog';\nimport { urlBase64ToUint8Array } from 'utils/urlBase64ToUint8Array';\n\nconst PushNotificationContext = createContext<\n PushNotificationContextData | undefined\n>(undefined);\n\nexport const PushNotificationProvider = <TMessage = unknown,>({\n children,\n originId,\n originType,\n bearerToken,\n vapidKey,\n serviceWorkerPath = '/',\n serviceWorkerFile = 'service-worker.js',\n pollingInterval = 1000,\n apiAdapters,\n onMessageReceived,\n onError,\n}: PushNotificationProviderProps<TMessage>) => {\n const [clientId, setClientId] = useState<string | null>(null);\n const [isRegistering, setIsRegistering] = useState<boolean>(false);\n const [isRegisterError, setIsRegisterError] = useState<boolean>(false);\n const [isPassiveClient, setIsPassiveClient] = useState<boolean>(false);\n const [newMessageCount, setNewMessageCount] = useState<number>(0);\n const [processedMessageIds] = useState<Set<string>>(new Set());\n\n const [subscribedTopics, setSubscribedTopics] = useState<SubscriptionsData>({\n subscriptions: [],\n });\n const [isLoadingSubscriptions, setIsLoadingSubscriptions] =\n useState<boolean>(false);\n\n const [pollingEnabled, setPollingEnabled] = useState<boolean>(false);\n const [shouldPoll, setShouldPoll] = useState<boolean>(false);\n\n const topicOptionsRef = useRef<Map<string, TopicSubscriptionOptions>>(\n new Map(),\n );\n\n const isLoading = useMemo(\n () => !clientId || isLoadingSubscriptions || isRegistering,\n [clientId, isLoadingSubscriptions, isRegistering],\n );\n\n useEffect(() => {\n if (\n !pollingEnabled ||\n !shouldPoll ||\n !clientId ||\n !apiAdapters.fetchMessages ||\n subscribedTopics.subscriptions.length === 0\n )\n return;\n\n const interval = setInterval(async () => {\n try {\n const result = await apiAdapters.fetchMessages!(clientId);\n const messages = result?.messages ?? [];\n\n const deliverables = messages.filter(m => {\n if (!m?.payload) return false;\n if (processedMessageIds.has(m.id)) return false;\n\n return true;\n });\n\n if (deliverables.length === 0) return;\n\n deliverables.forEach(m => {\n processedMessageIds.add(m.id);\n onMessageReceived?.(m.payload, m.topic);\n });\n\n setNewMessageCount(prev => prev + deliverables.length);\n\n try {\n const updates = await Promise.allSettled(\n deliverables.map(m =>\n apiAdapters.updateMessageStatus(m.id, {\n status: MessageStatus.DELIVERED,\n }),\n ),\n );\n\n updates.forEach(u => {\n if (u.status === 'rejected') {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [\n Environment.DEVELOPMENT,\n Environment.HOMOLOGATION,\n ],\n message: 'Erro ao marcar mensagem como entregue:',\n data: u.reason,\n });\n }\n });\n } finally {\n const topicsProcessed = new Set(\n deliverables.map(m => m.topic).filter(Boolean) as string[],\n );\n\n topicsProcessed.forEach(topic => {\n const topicOptions = topicOptionsRef.current.get(topic);\n\n if (topicOptions?.stopPollingOnFirstMessage) {\n topicOptionsRef.current.delete(topic);\n }\n });\n\n const hasSubscriptions = subscribedTopics.subscriptions.length > 0;\n\n if (!hasSubscriptions) {\n setPollingEnabled(false);\n setShouldPoll(false);\n }\n }\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao buscar mensagens:',\n data: error,\n });\n }\n }, pollingInterval);\n\n return () => clearInterval(interval);\n }, [\n apiAdapters,\n clientId,\n onMessageReceived,\n pollingEnabled,\n pollingInterval,\n processedMessageIds,\n shouldPoll,\n subscribedTopics.subscriptions.length,\n ]);\n\n const performClientRegistration = useCallback(\n async (subscription: PushSubscription | null, isPassive: boolean) => {\n setIsRegistering(true);\n\n try {\n const keys = subscription?.toJSON().keys;\n const payload: ClientRegistrationPayload = {\n origin_type: originType,\n origin_id: originId,\n ...(isPassive && subscription\n ? {\n endpoint: subscription.endpoint,\n auth: keys?.auth,\n p256dh: keys?.p256dh,\n }\n : {}),\n };\n\n const response = await apiAdapters.registerClient(payload);\n\n setClientId(response.id);\n setIsRegisterError(false);\n setIsPassiveClient(isPassive);\n\n if (!isPassive) {\n setShouldPoll(true);\n }\n\n return response.id;\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao registrar cliente:',\n data: error,\n });\n\n setIsRegisterError(true);\n onError?.(error as Error);\n\n return null;\n } finally {\n setIsRegistering(false);\n }\n },\n [apiAdapters, onError, originId, originType],\n );\n\n useEffect(() => {\n let mounted = true;\n let messageHandler: ((e: MessageEvent) => void) | null = null;\n\n async function initSwAndRegister() {\n setIsRegistering(true);\n\n if (!('serviceWorker' in navigator) || !('PushManager' in window)) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'Push notifications não suportadas, criando cliente ativo com polling',\n });\n\n try {\n const id = await performClientRegistration(null, false);\n if (mounted && id) {\n setClientId(id);\n setShouldPoll(true);\n }\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao registrar cliente ativo:',\n data: err,\n });\n onError?.(err as Error);\n } finally {\n setIsRegistering(false);\n }\n return;\n }\n\n try {\n const permission = await Notification.requestPermission();\n\n let subscription: PushSubscription | null = null;\n let isPassiveClient = false;\n\n if (permission === 'granted') {\n try {\n const registration = await navigator.serviceWorker.register(\n `${serviceWorkerPath}${serviceWorkerFile}`,\n );\n\n if (!mounted) return;\n\n await navigator.serviceWorker.ready;\n\n if (!mounted) return;\n\n subscription = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: urlBase64ToUint8Array(\n vapidKey,\n ) as BufferSource,\n });\n\n messageHandler = async (e: MessageEvent) => {\n const message = e.data?.payload;\n const deliveredId = e.data?.id;\n\n if (message) {\n setNewMessageCount(prev => prev + 1);\n onMessageReceived?.(message, e.data?.topic);\n }\n\n if (deliveredId) {\n try {\n await apiAdapters.updateMessageStatus(deliveredId, {\n status: MessageStatus.DELIVERED,\n });\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [\n Environment.DEVELOPMENT,\n Environment.HOMOLOGATION,\n ],\n message: 'Erro ao atualizar status da mensagem:',\n data: err,\n });\n setIsRegisterError(true);\n onError?.(err as Error);\n }\n }\n };\n\n navigator.serviceWorker.addEventListener('message', messageHandler);\n\n isPassiveClient = true;\n consoleLog({\n type: ConsoleType.LOG,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'Permissão concedida, criando cliente passivo (aguarda webpush)',\n });\n } catch (err) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'Falha ao configurar push subscription, criando cliente ativo:',\n data: err,\n });\n isPassiveClient = false;\n }\n } else {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'Permissão de notificação negada, criando cliente ativo com polling',\n });\n isPassiveClient = false;\n }\n\n const id = await performClientRegistration(\n subscription,\n isPassiveClient,\n );\n if (mounted && id) {\n setClientId(id);\n\n if (!isPassiveClient) {\n setShouldPoll(true);\n }\n }\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao inicializar notificações:',\n data: err,\n });\n onError?.(err as Error);\n\n try {\n const id = await performClientRegistration(null, false);\n if (mounted && id) {\n setClientId(id);\n setShouldPoll(true);\n }\n } catch (fallbackErr) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao criar cliente ativo como fallback:',\n data: fallbackErr,\n });\n }\n } finally {\n setIsRegistering(false);\n }\n }\n\n if (bearerToken) {\n void initSwAndRegister();\n }\n\n return () => {\n mounted = false;\n if (messageHandler && 'serviceWorker' in navigator) {\n navigator.serviceWorker.removeEventListener('message', messageHandler);\n }\n };\n }, [\n apiAdapters,\n bearerToken,\n onError,\n onMessageReceived,\n performClientRegistration,\n serviceWorkerFile,\n serviceWorkerPath,\n vapidKey,\n ]);\n\n const refetchSubscriptions = useCallback(async () => {\n if (!clientId) return;\n\n setIsLoadingSubscriptions(true);\n\n try {\n const data = await apiAdapters.listSubscriptions(clientId);\n\n setSubscribedTopics(data);\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao listar inscrições:',\n data: error,\n });\n\n onError?.(error as Error);\n } finally {\n setIsLoadingSubscriptions(false);\n }\n }, [apiAdapters, clientId, onError]);\n\n useEffect(() => {\n if (clientId) {\n void refetchSubscriptions();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clientId]);\n\n const subscribeToTopic = useCallback(\n async (topic: string, options?: TopicSubscriptionOptions) => {\n if (!clientId) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Cliente não registrado',\n });\n\n return;\n }\n\n try {\n if (options) {\n topicOptionsRef.current.set(topic, options);\n }\n\n await apiAdapters.subscribeTopic(clientId, topic);\n await refetchSubscriptions();\n\n if (!isPassiveClient && (!pollingEnabled || !shouldPoll)) {\n setPollingEnabled(true);\n setShouldPoll(true);\n }\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao inscrever no tópico:',\n data: error,\n });\n\n onError?.(error as Error);\n }\n },\n [\n apiAdapters,\n clientId,\n isPassiveClient,\n onError,\n pollingEnabled,\n refetchSubscriptions,\n shouldPoll,\n ],\n );\n\n const unsubscribeFromTopic = useCallback(\n async (topic: string) => {\n if (!clientId) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Cliente não registrado',\n });\n\n return;\n }\n\n try {\n topicOptionsRef.current.delete(topic);\n\n await apiAdapters.unsubscribeTopic(clientId, topic);\n await refetchSubscriptions();\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao desinscrever do tópico:',\n data: error,\n });\n\n onError?.(error as Error);\n }\n },\n [apiAdapters, clientId, onError, refetchSubscriptions],\n );\n\n const subscribeTopicsBatch = useCallback(\n async (topics: string[]): Promise<void> => {\n if (!clientId || topics.length === 0) return;\n\n try {\n topics.forEach(topic => {\n if (!topicOptionsRef.current.has(topic)) {\n topicOptionsRef.current.set(topic, {});\n }\n });\n\n await apiAdapters.subscribeTopicsBatch(clientId, topics);\n await refetchSubscriptions();\n\n if (!isPassiveClient) {\n setPollingEnabled(true);\n setShouldPoll(true);\n }\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao inscrever em tópicos:',\n data: err,\n });\n\n onError?.(err as Error);\n }\n },\n [apiAdapters, clientId, isPassiveClient, onError, refetchSubscriptions],\n );\n\n const unsubscribeTopicsBatch = useCallback(\n async (topics: string[]): Promise<void> => {\n if (!clientId || topics.length === 0) return;\n\n try {\n topics.forEach(topic => topicOptionsRef.current.delete(topic));\n\n await apiAdapters.unsubscribeTopicsBatch(clientId, topics);\n await refetchSubscriptions();\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao desinscrever de tópicos:',\n data: err,\n });\n\n onError?.(err as Error);\n }\n },\n [apiAdapters, clientId, onError, refetchSubscriptions],\n );\n\n const resetMessageCount = useCallback(() => {\n setNewMessageCount(0);\n }, []);\n\n const value: PushNotificationContextData = useMemo(\n () => ({\n clientId,\n subscribedTopics,\n isLoading,\n newMessageCount,\n isRegisterError,\n subscribeToTopic,\n unsubscribeFromTopic,\n subscribeTopicsBatch,\n unsubscribeTopicsBatch,\n resetMessageCount,\n }),\n [\n clientId,\n isLoading,\n isRegisterError,\n newMessageCount,\n resetMessageCount,\n subscribedTopics,\n subscribeToTopic,\n subscribeTopicsBatch,\n unsubscribeFromTopic,\n unsubscribeTopicsBatch,\n ],\n );\n\n return (\n <PushNotificationContext.Provider value={value}>\n {children}\n </PushNotificationContext.Provider>\n );\n};\n\nexport function usePushNotifications(): PushNotificationContextData {\n const context = useContext(PushNotificationContext);\n\n if (!context) {\n throw new Error(\n 'usePushNotifications precisa estar dentro de PushNotificationProvider',\n );\n }\n\n return context;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/contexts/PushNotifications/index.tsx"],"names":["createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","jsx","PushNotificationContext","PushNotificationProvider","children","originId","originType","bearerToken","vapidKey","serviceWorkerPath","serviceWorkerFile","pollingInterval","apiAdapters","onMessageReceived","onError","clientId","setClientId","isRegistering","setIsRegistering","isRegisterError","setIsRegisterError","isPassiveClient","setIsPassiveClient","newMessageCount","setNewMessageCount","processedMessageIds","subscribedTopics","setSubscribedTopics","isLoadingSubscriptions","setIsLoadingSubscriptions","pollingEnabled","setPollingEnabled","shouldPoll","setShouldPoll","topicOptionsRef","isLoading","interval","deliverables","m","prev","consoleLog","topic","error","performClientRegistration","subscription","isPassive","keys","payload","response","mounted","messageHandler","initSwAndRegister","id","err","permission","registration","urlBase64ToUint8Array","e","message","deliveredId","fallbackErr","refetchSubscriptions","data","subscribeToTopic","options","unsubscribeFromTopic","subscribeTopicsBatch","topics","unsubscribeTopicsBatch","resetMessageCount","value","usePushNotifications","context"],"mappings":"wJAAA,OACE,iBAAAA,GACA,eAAAC,EACA,cAAAC,GACA,aAAAC,EACA,WAAAC,EACA,UAAAC,GACA,YAAAC,MACK,QAmkBH,cAAAC,OAAA,oBArjBJ,IAAMC,GAA0BR,GAE9B,MAAS,EAEES,GAA2B,CAAsB,CAC5D,SAAAC,EACA,SAAAC,EACA,WAAAC,EACA,YAAAC,GACA,SAAAC,EACA,kBAAAC,EAAoB,IACpB,kBAAAC,EAAoB,oBACpB,gBAAAC,EAAkB,IAClB,YAAAC,EACA,kBAAAC,EACA,QAAAC,CACF,IAA+C,CAC7C,GAAM,CAACC,EAAUC,CAAW,EAAIhB,EAAwB,IAAI,EACtD,CAACiB,EAAeC,CAAgB,EAAIlB,EAAkB,EAAK,EAC3D,CAACmB,EAAiBC,CAAkB,EAAIpB,EAAkB,EAAK,EAC/D,CAACqB,EAAiBC,EAAkB,EAAItB,EAAkB,EAAK,EAC/D,CAACuB,EAAiBC,CAAkB,EAAIxB,EAAiB,CAAC,EAC1D,CAACyB,CAAmB,EAAIzB,EAAsB,IAAI,GAAK,EAEvD,CAAC0B,EAAkBC,EAAmB,EAAI3B,EAA4B,CAC1E,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AI,EACtBE,EAAc,EAAI,EAEtB,OAASoB,EAAP,CACAb,EAAW,CACT,aACA,YAAa,6BAAkD,EAC/D,QAAS,mCACT,KAAMa,CACR,CAAC,EAEDvC,IAAUuC,CAAY,CACxB,CACF,EACA,CAACzC,EAAaG,EAAUM,EAAiBP,EAAS+C,CAAoB,CACxE,EAEMO,EAAyBzE,EAC7B,MAAOwE,GAAoC,CACzC,GAAI,GAACpD,GAAYoD,EAAO,SAAW,GAEnC,GAAI,CACFA,EAAO,QAAQ1B,GAASP,EAAgB,QAAQ,OAAOO,CAAK,CAAC,EAE7D,MAAM7B,EAAY,uBAAuBG,EAAUoD,CAAM,EACzD,MAAMN,EAAqB,CAC7B,OAASR,EAAP,CACAb,EAAW,CACT,aACA,YAAa,6BAAkD,EAC/D,QAAS,sCACT,KAAMa,CACR,CAAC,EAEDvC,IAAUuC,CAAY,CACxB,CACF,EACA,CAACzC,EAAaG,EAAUD,EAAS+C,CAAoB,CACvD,EAEMQ,EAAoB1E,EAAY,IAAM,CAC1C6B,EAAmB,CAAC,CACtB,EAAG,CAAC,CAAC,EAEC8C,GAAqCxE,EACzC,KAAO,CACL,SAAAiB,EACA,iBAAAW,EACA,UAAAS,EACA,gBAAAZ,EACA,gBAAAJ,EACA,iBAAA4C,EACA,qBAAAE,EACA,qBAAAC,EACA,uBAAAE,EACA,kBAAAC,CACF,GACA,CACEtD,EACAoB,EACAhB,EACAI,EACA8C,EACA3C,EACAqC,EACAG,EACAD,EACAG,CACF,CACF,EAEA,OACEnE,GAACC,GAAwB,SAAxB,CAAiC,MAAOoE,GACtC,SAAAlE,EACH,CAEJ,EAEO,SAASmE,IAAoD,CAClE,IAAMC,EAAU5E,GAAWM,EAAuB,EAElD,GAAI,CAACsE,EACH,MAAM,IAAI,MACR,uEACF,EAGF,OAAOA,CACT","sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { ConsoleType, Environment } from 'types/consoleLog';\nimport {\n type ClientRegistrationPayload,\n MessageStatus,\n type PushNotificationContextData,\n type PushNotificationProviderProps,\n type SubscriptionsData,\n type TopicSubscriptionOptions,\n} from 'types/pushNotifications';\nimport { consoleLog } from 'utils/consoleLog';\nimport { urlBase64ToUint8Array } from 'utils/urlBase64ToUint8Array';\n\nconst PushNotificationContext = createContext<\n PushNotificationContextData | undefined\n>(undefined);\n\nexport const PushNotificationProvider = <TMessage = unknown,>({\n children,\n originId,\n originType,\n bearerToken,\n vapidKey,\n serviceWorkerPath = '/',\n serviceWorkerFile = 'service-worker.js',\n pollingInterval = 1000,\n apiAdapters,\n onMessageReceived,\n onError,\n}: PushNotificationProviderProps<TMessage>) => {\n const [clientId, setClientId] = useState<string | null>(null);\n const [isRegistering, setIsRegistering] = useState<boolean>(false);\n const [isRegisterError, setIsRegisterError] = useState<boolean>(false);\n const [isPassiveClient, setIsPassiveClient] = useState<boolean>(false);\n const [newMessageCount, setNewMessageCount] = useState<number>(0);\n const [processedMessageIds] = useState<Set<string>>(new Set());\n\n const [subscribedTopics, setSubscribedTopics] = useState<SubscriptionsData>({\n subscriptions: [],\n });\n const [isLoadingSubscriptions, setIsLoadingSubscriptions] =\n useState<boolean>(false);\n\n const [pollingEnabled, setPollingEnabled] = useState<boolean>(false);\n const [shouldPoll, setShouldPoll] = useState<boolean>(false);\n\n const topicOptionsRef = useRef<Map<string, TopicSubscriptionOptions>>(\n new Map(),\n );\n\n const isLoading = useMemo(\n () => !clientId || isLoadingSubscriptions || isRegistering,\n [clientId, isLoadingSubscriptions, isRegistering],\n );\n\n useEffect(() => {\n if (\n !pollingEnabled ||\n !shouldPoll ||\n !clientId ||\n !apiAdapters.fetchMessages ||\n subscribedTopics.subscriptions.length === 0\n )\n return;\n\n const interval = setInterval(async () => {\n try {\n const result = await apiAdapters.fetchMessages!(clientId);\n const messages = result?.messages ?? [];\n\n const deliverables = messages.filter(m => {\n if (!m?.payload) return false;\n if (processedMessageIds.has(m.id)) return false;\n\n return true;\n });\n\n if (deliverables.length === 0) return;\n\n deliverables.forEach(m => {\n processedMessageIds.add(m.id);\n onMessageReceived?.(m.payload, m.topic);\n });\n\n setNewMessageCount(prev => prev + deliverables.length);\n\n try {\n const updates = await Promise.allSettled(\n deliverables.map(m =>\n apiAdapters.updateMessageStatus(m.id, {\n status: MessageStatus.DELIVERED,\n }),\n ),\n );\n\n updates.forEach(u => {\n if (u.status === 'rejected') {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [\n Environment.DEVELOPMENT,\n Environment.HOMOLOGATION,\n ],\n message: 'Erro ao marcar mensagem como entregue:',\n data: u.reason,\n });\n }\n });\n } finally {\n const topicsProcessed = new Set(\n deliverables.map(m => m.topic).filter(Boolean) as string[],\n );\n\n topicsProcessed.forEach(topic => {\n const topicOptions = topicOptionsRef.current.get(topic);\n\n if (topicOptions?.stopPollingOnFirstMessage) {\n topicOptionsRef.current.delete(topic);\n }\n });\n\n const hasSubscriptions = subscribedTopics.subscriptions.length > 0;\n\n if (!hasSubscriptions) {\n setPollingEnabled(false);\n setShouldPoll(false);\n }\n }\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao buscar mensagens:',\n data: error,\n });\n }\n }, pollingInterval);\n\n return () => clearInterval(interval);\n }, [\n apiAdapters,\n clientId,\n onMessageReceived,\n pollingEnabled,\n pollingInterval,\n processedMessageIds,\n shouldPoll,\n subscribedTopics.subscriptions.length,\n ]);\n\n const performClientRegistration = useCallback(\n async (subscription: PushSubscription | null, isPassive: boolean) => {\n setIsRegistering(true);\n\n try {\n const keys = subscription?.toJSON().keys;\n const payload: ClientRegistrationPayload = {\n origin_type: originType,\n origin_id: originId,\n ...(isPassive && subscription\n ? {\n endpoint: subscription.endpoint,\n auth: keys?.auth,\n p256dh: keys?.p256dh,\n }\n : {}),\n };\n\n const response = await apiAdapters.registerClient(payload);\n\n setClientId(response.id);\n setIsRegisterError(false);\n setIsPassiveClient(isPassive);\n\n if (!isPassive) {\n setShouldPoll(true);\n }\n\n return response.id;\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao registrar cliente:',\n data: error,\n });\n\n setIsRegisterError(true);\n onError?.(error as Error);\n\n return null;\n } finally {\n setIsRegistering(false);\n }\n },\n [apiAdapters, onError, originId, originType],\n );\n\n useEffect(() => {\n let mounted = true;\n let messageHandler: ((e: MessageEvent) => void) | null = null;\n\n async function initSwAndRegister() {\n setIsRegistering(true);\n\n if (!('serviceWorker' in navigator) || !('PushManager' in window)) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'Push notifications não suportadas, criando cliente ativo com polling',\n });\n\n try {\n const id = await performClientRegistration(null, false);\n if (mounted && id) {\n setClientId(id);\n setShouldPoll(true);\n }\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao registrar cliente ativo:',\n data: err,\n });\n onError?.(err as Error);\n } finally {\n setIsRegistering(false);\n }\n return;\n }\n\n try {\n const permission = await Notification.requestPermission();\n\n let subscription: PushSubscription | null = null;\n let isPassiveClient = false;\n\n if (permission === 'granted') {\n try {\n const registration = await navigator.serviceWorker.register(\n `${serviceWorkerPath}${serviceWorkerFile}`,\n );\n\n if (!mounted) return;\n\n await navigator.serviceWorker.ready;\n\n if (!mounted) return;\n\n subscription = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: urlBase64ToUint8Array(\n vapidKey,\n ) as BufferSource,\n });\n\n messageHandler = async (e: MessageEvent) => {\n const message = e.data?.payload;\n const deliveredId = e.data?.id;\n\n if (message) {\n setNewMessageCount(prev => prev + 1);\n onMessageReceived?.(message, e.data?.topic);\n }\n\n if (deliveredId) {\n try {\n await apiAdapters.updateMessageStatus(deliveredId, {\n status: MessageStatus.DELIVERED,\n });\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [\n Environment.DEVELOPMENT,\n Environment.HOMOLOGATION,\n ],\n message: 'Erro ao atualizar status da mensagem:',\n data: err,\n });\n setIsRegisterError(true);\n onError?.(err as Error);\n }\n }\n };\n\n navigator.serviceWorker.addEventListener('message', messageHandler);\n\n isPassiveClient = true;\n consoleLog({\n type: ConsoleType.LOG,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'Permissão concedida, criando cliente passivo (aguarda webpush)',\n });\n } catch (err) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'Falha ao configurar push subscription, criando cliente ativo:',\n data: err,\n });\n isPassiveClient = false;\n }\n } else {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'Permissão de notificação negada, criando cliente ativo com polling',\n });\n isPassiveClient = false;\n }\n\n const id = await performClientRegistration(\n subscription,\n isPassiveClient,\n );\n if (mounted && id) {\n setClientId(id);\n\n if (!isPassiveClient) {\n setShouldPoll(true);\n }\n }\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao inicializar notificações:',\n data: err,\n });\n onError?.(err as Error);\n\n try {\n const id = await performClientRegistration(null, false);\n if (mounted && id) {\n setClientId(id);\n setShouldPoll(true);\n }\n } catch (fallbackErr) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao criar cliente ativo como fallback:',\n data: fallbackErr,\n });\n }\n } finally {\n setIsRegistering(false);\n }\n }\n\n if (bearerToken) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message:\n 'O parâmetro bearerToken está deprecated e não é mais necessário. Ele será removido em versões futuras.',\n });\n }\n\n void initSwAndRegister();\n\n return () => {\n mounted = false;\n if (messageHandler && 'serviceWorker' in navigator) {\n navigator.serviceWorker.removeEventListener('message', messageHandler);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n apiAdapters,\n onError,\n onMessageReceived,\n performClientRegistration,\n serviceWorkerFile,\n serviceWorkerPath,\n vapidKey,\n ]);\n\n const refetchSubscriptions = useCallback(async () => {\n if (!clientId) return;\n\n setIsLoadingSubscriptions(true);\n\n try {\n const data = await apiAdapters.listSubscriptions(clientId);\n\n setSubscribedTopics(data);\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao listar inscrições:',\n data: error,\n });\n\n onError?.(error as Error);\n } finally {\n setIsLoadingSubscriptions(false);\n }\n }, [apiAdapters, clientId, onError]);\n\n useEffect(() => {\n if (clientId) {\n void refetchSubscriptions();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clientId]);\n\n const subscribeToTopic = useCallback(\n async (topic: string, options?: TopicSubscriptionOptions) => {\n if (!clientId) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Cliente não registrado',\n });\n\n return;\n }\n\n try {\n if (options) {\n topicOptionsRef.current.set(topic, options);\n }\n\n await apiAdapters.subscribeTopic(clientId, topic);\n await refetchSubscriptions();\n\n if (!isPassiveClient && (!pollingEnabled || !shouldPoll)) {\n setPollingEnabled(true);\n setShouldPoll(true);\n }\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao inscrever no tópico:',\n data: error,\n });\n\n onError?.(error as Error);\n }\n },\n [\n apiAdapters,\n clientId,\n isPassiveClient,\n onError,\n pollingEnabled,\n refetchSubscriptions,\n shouldPoll,\n ],\n );\n\n const unsubscribeFromTopic = useCallback(\n async (topic: string) => {\n if (!clientId) {\n consoleLog({\n type: ConsoleType.WARN,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Cliente não registrado',\n });\n\n return;\n }\n\n try {\n topicOptionsRef.current.delete(topic);\n\n await apiAdapters.unsubscribeTopic(clientId, topic);\n await refetchSubscriptions();\n } catch (error) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao desinscrever do tópico:',\n data: error,\n });\n\n onError?.(error as Error);\n }\n },\n [apiAdapters, clientId, onError, refetchSubscriptions],\n );\n\n const subscribeTopicsBatch = useCallback(\n async (topics: string[]): Promise<void> => {\n if (!clientId || topics.length === 0) return;\n\n try {\n topics.forEach(topic => {\n if (!topicOptionsRef.current.has(topic)) {\n topicOptionsRef.current.set(topic, {});\n }\n });\n\n await apiAdapters.subscribeTopicsBatch(clientId, topics);\n await refetchSubscriptions();\n\n if (!isPassiveClient) {\n setPollingEnabled(true);\n setShouldPoll(true);\n }\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao inscrever em tópicos:',\n data: err,\n });\n\n onError?.(err as Error);\n }\n },\n [apiAdapters, clientId, isPassiveClient, onError, refetchSubscriptions],\n );\n\n const unsubscribeTopicsBatch = useCallback(\n async (topics: string[]): Promise<void> => {\n if (!clientId || topics.length === 0) return;\n\n try {\n topics.forEach(topic => topicOptionsRef.current.delete(topic));\n\n await apiAdapters.unsubscribeTopicsBatch(clientId, topics);\n await refetchSubscriptions();\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao desinscrever de tópicos:',\n data: err,\n });\n\n onError?.(err as Error);\n }\n },\n [apiAdapters, clientId, onError, refetchSubscriptions],\n );\n\n const resetMessageCount = useCallback(() => {\n setNewMessageCount(0);\n }, []);\n\n const value: PushNotificationContextData = useMemo(\n () => ({\n clientId,\n subscribedTopics,\n isLoading,\n newMessageCount,\n isRegisterError,\n subscribeToTopic,\n unsubscribeFromTopic,\n subscribeTopicsBatch,\n unsubscribeTopicsBatch,\n resetMessageCount,\n }),\n [\n clientId,\n isLoading,\n isRegisterError,\n newMessageCount,\n resetMessageCount,\n subscribedTopics,\n subscribeToTopic,\n subscribeTopicsBatch,\n unsubscribeFromTopic,\n unsubscribeTopicsBatch,\n ],\n );\n\n return (\n <PushNotificationContext.Provider value={value}>\n {children}\n </PushNotificationContext.Provider>\n );\n};\n\nexport function usePushNotifications(): PushNotificationContextData {\n const context = useContext(PushNotificationContext);\n\n if (!context) {\n throw new Error(\n 'usePushNotifications precisa estar dentro de PushNotificationProvider',\n );\n }\n\n return context;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CustomShadows } from './index-
|
|
2
|
-
export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from './index-
|
|
1
|
+
import { C as CustomShadows } from './index-c8f1e6e7.js';
|
|
2
|
+
export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from './index-c8f1e6e7.js';
|
|
3
3
|
export { S as SettingsContextValue, _ as SettingsProvider, T as ThemeProviderProps, u as useSettingsContext } from './settings-provider-38d09283.js';
|
|
4
4
|
export { THEME_CONFIG, default as ThemeProvider } from './theme/theme-provider.js';
|
|
5
5
|
import { S as SettingsState } from './settings-583c107c.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from '../../index-
|
|
1
|
+
export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from '../../index-c8f1e6e7.js';
|
|
2
2
|
import '@mui/lab/TimelineConnector';
|
|
3
3
|
import '@mui/system';
|
|
4
4
|
import '@mui/lab/TimelineDot';
|
|
@@ -173,7 +173,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
173
173
|
float?: csstype.Property.Float | readonly NonNullable<csstype.Property.Float | undefined>[] | readonly csstype.Property.Float[] | undefined;
|
|
174
174
|
floodColor?: readonly string[] | csstype.Property.FloodColor | readonly csstype.Property.FloodColor[] | undefined;
|
|
175
175
|
floodOpacity?: readonly ((string & {}) | csstype.Globals)[] | csstype.Property.FloodOpacity | readonly NonNullable<csstype.Property.FloodOpacity | undefined>[] | undefined;
|
|
176
|
-
fontFamily?: csstype.Property.FontFamily | readonly
|
|
176
|
+
fontFamily?: readonly string[] | csstype.Property.FontFamily | readonly csstype.Property.FontFamily[] | undefined;
|
|
177
177
|
fontFeatureSettings?: readonly string[] | csstype.Property.FontFeatureSettings | readonly csstype.Property.FontFeatureSettings[] | undefined;
|
|
178
178
|
fontKerning?: csstype.Property.FontKerning | readonly NonNullable<csstype.Property.FontKerning | undefined>[] | readonly csstype.Property.FontKerning[] | undefined;
|
|
179
179
|
fontLanguageOverride?: readonly string[] | csstype.Property.FontLanguageOverride | readonly csstype.Property.FontLanguageOverride[] | undefined;
|
|
@@ -197,7 +197,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
197
197
|
fontVariantNumeric?: readonly string[] | csstype.Property.FontVariantNumeric | readonly csstype.Property.FontVariantNumeric[] | undefined;
|
|
198
198
|
fontVariantPosition?: csstype.Property.FontVariantPosition | readonly NonNullable<csstype.Property.FontVariantPosition | undefined>[] | readonly csstype.Property.FontVariantPosition[] | undefined;
|
|
199
199
|
fontVariationSettings?: readonly string[] | csstype.Property.FontVariationSettings | readonly csstype.Property.FontVariationSettings[] | undefined;
|
|
200
|
-
fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
200
|
+
fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ("bold" | (string & {}) | csstype.Globals | "normal" | "bolder" | "lighter")[] | undefined;
|
|
201
201
|
fontWidth?: readonly string[] | csstype.Property.FontWidth | readonly csstype.Property.FontWidth[] | undefined;
|
|
202
202
|
forcedColorAdjust?: csstype.Property.ForcedColorAdjust | readonly NonNullable<csstype.Property.ForcedColorAdjust | undefined>[] | readonly csstype.Property.ForcedColorAdjust[] | undefined;
|
|
203
203
|
gridAutoColumns?: readonly (string | (string & {}))[] | csstype.Property.GridAutoColumns<string | number> | readonly NonNullable<csstype.Property.GridAutoColumns<string | number> | undefined>[] | undefined;
|
|
@@ -462,7 +462,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
462
462
|
zIndex?: readonly ((string & {}) | csstype.Globals | "auto")[] | csstype.Property.ZIndex | readonly NonNullable<csstype.Property.ZIndex | undefined>[] | undefined;
|
|
463
463
|
zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reset")[] | undefined;
|
|
464
464
|
all?: csstype.Globals | readonly NonNullable<csstype.Globals | undefined>[] | readonly csstype.Globals[] | undefined;
|
|
465
|
-
animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
465
|
+
animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
466
466
|
animationRange?: readonly (string | (string & {}))[] | csstype.Property.AnimationRange<string | number> | readonly NonNullable<csstype.Property.AnimationRange<string | number> | undefined>[] | undefined;
|
|
467
467
|
background?: readonly (string | (string & {}))[] | csstype.Property.Background<string | number> | readonly NonNullable<csstype.Property.Background<string | number> | undefined>[] | undefined;
|
|
468
468
|
border?: readonly (string | (string & {}))[] | csstype.Property.Border<string | number> | readonly NonNullable<csstype.Property.Border<string | number> | undefined>[] | undefined;
|
|
@@ -474,7 +474,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
474
474
|
borderBlockWidth?: readonly (string | (string & {}))[] | csstype.Property.BorderBlockWidth<string | number> | readonly NonNullable<csstype.Property.BorderBlockWidth<string | number> | undefined>[] | undefined;
|
|
475
475
|
borderBottom?: readonly (string | (string & {}))[] | csstype.Property.BorderBottom<string | number> | readonly NonNullable<csstype.Property.BorderBottom<string | number> | undefined>[] | undefined;
|
|
476
476
|
borderColor?: readonly string[] | csstype.Property.BorderColor | readonly csstype.Property.BorderColor[] | undefined;
|
|
477
|
-
borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
477
|
+
borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
478
478
|
borderInline?: readonly (string | (string & {}))[] | csstype.Property.BorderInline<string | number> | readonly NonNullable<csstype.Property.BorderInline<string | number> | undefined>[] | undefined;
|
|
479
479
|
borderInlineColor?: readonly string[] | csstype.Property.BorderInlineColor | readonly csstype.Property.BorderInlineColor[] | undefined;
|
|
480
480
|
borderInlineEnd?: readonly (string | (string & {}))[] | csstype.Property.BorderInlineEnd<string | number> | readonly NonNullable<csstype.Property.BorderInlineEnd<string | number> | undefined>[] | undefined;
|
|
@@ -509,7 +509,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
509
509
|
marginBlock?: readonly (string | (string & {}))[] | csstype.Property.MarginBlock<string | number> | readonly NonNullable<csstype.Property.MarginBlock<string | number> | undefined>[] | undefined;
|
|
510
510
|
marginInline?: readonly (string | (string & {}))[] | csstype.Property.MarginInline<string | number> | readonly NonNullable<csstype.Property.MarginInline<string | number> | undefined>[] | undefined;
|
|
511
511
|
mask?: readonly (string | (string & {}))[] | csstype.Property.Mask<string | number> | readonly NonNullable<csstype.Property.Mask<string | number> | undefined>[] | undefined;
|
|
512
|
-
maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
512
|
+
maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
|
|
513
513
|
motion?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
|
|
514
514
|
offset?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
|
|
515
515
|
outline?: readonly (string | (string & {}))[] | csstype.Property.Outline<string | number> | readonly NonNullable<csstype.Property.Outline<string | number> | undefined>[] | undefined;
|
|
@@ -758,8 +758,8 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
758
758
|
WebkitUserModify?: csstype.Property.WebkitUserModify | readonly NonNullable<csstype.Property.WebkitUserModify | undefined>[] | readonly csstype.Property.WebkitUserModify[] | undefined;
|
|
759
759
|
WebkitUserSelect?: csstype.Property.WebkitUserSelect | readonly NonNullable<csstype.Property.WebkitUserSelect | undefined>[] | readonly csstype.Property.WebkitUserSelect[] | undefined;
|
|
760
760
|
WebkitWritingMode?: csstype.Property.WritingMode | readonly NonNullable<csstype.Property.WritingMode | undefined>[] | readonly csstype.Property.WritingMode[] | undefined;
|
|
761
|
-
MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
762
|
-
MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
761
|
+
MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
762
|
+
MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
763
763
|
MozColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
|
|
764
764
|
MozColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
|
|
765
765
|
MozOutlineRadius?: readonly (string | (string & {}))[] | csstype.Property.MozOutlineRadius<string | number> | readonly NonNullable<csstype.Property.MozOutlineRadius<string | number> | undefined>[] | undefined;
|
|
@@ -771,16 +771,16 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
771
771
|
msScrollSnapX?: readonly string[] | csstype.Property.MsScrollSnapX | readonly csstype.Property.MsScrollSnapX[] | undefined;
|
|
772
772
|
msScrollSnapY?: readonly string[] | csstype.Property.MsScrollSnapY | readonly csstype.Property.MsScrollSnapY[] | undefined;
|
|
773
773
|
msTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
|
|
774
|
-
WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
774
|
+
WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
775
775
|
WebkitBorderBefore?: readonly (string | (string & {}))[] | csstype.Property.WebkitBorderBefore<string | number> | readonly NonNullable<csstype.Property.WebkitBorderBefore<string | number> | undefined>[] | undefined;
|
|
776
|
-
WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
776
|
+
WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
777
777
|
WebkitBorderRadius?: readonly (string | (string & {}))[] | csstype.Property.BorderRadius<string | number> | readonly NonNullable<csstype.Property.BorderRadius<string | number> | undefined>[] | undefined;
|
|
778
778
|
WebkitColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
|
|
779
779
|
WebkitColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
|
|
780
780
|
WebkitFlex?: readonly (string | (string & {}))[] | csstype.Property.Flex<string | number> | readonly NonNullable<csstype.Property.Flex<string | number> | undefined>[] | undefined;
|
|
781
781
|
WebkitFlexFlow?: readonly string[] | csstype.Property.FlexFlow | readonly csstype.Property.FlexFlow[] | undefined;
|
|
782
782
|
WebkitMask?: readonly (string | (string & {}))[] | csstype.Property.WebkitMask<string | number> | readonly NonNullable<csstype.Property.WebkitMask<string | number> | undefined>[] | undefined;
|
|
783
|
-
WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
783
|
+
WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
|
|
784
784
|
WebkitTextEmphasis?: readonly string[] | csstype.Property.TextEmphasis | readonly csstype.Property.TextEmphasis[] | undefined;
|
|
785
785
|
WebkitTextStroke?: readonly (string | (string & {}))[] | csstype.Property.WebkitTextStroke<string | number> | readonly NonNullable<csstype.Property.WebkitTextStroke<string | number> | undefined>[] | undefined;
|
|
786
786
|
WebkitTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
|
|
@@ -861,7 +861,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
861
861
|
MozUserFocus?: csstype.Property.MozUserFocus | readonly NonNullable<csstype.Property.MozUserFocus | undefined>[] | readonly csstype.Property.MozUserFocus[] | undefined;
|
|
862
862
|
MozUserInput?: csstype.Property.MozUserInput | readonly NonNullable<csstype.Property.MozUserInput | undefined>[] | readonly csstype.Property.MozUserInput[] | undefined;
|
|
863
863
|
msImeMode?: csstype.Property.ImeMode | readonly NonNullable<csstype.Property.ImeMode | undefined>[] | readonly csstype.Property.ImeMode[] | undefined;
|
|
864
|
-
OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
864
|
+
OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
865
865
|
OAnimationDelay?: readonly string[] | csstype.Property.AnimationDelay<string & {}> | readonly csstype.Property.AnimationDelay<string & {}>[] | undefined;
|
|
866
866
|
OAnimationDirection?: readonly string[] | csstype.Property.AnimationDirection | readonly csstype.Property.AnimationDirection[] | undefined;
|
|
867
867
|
OAnimationDuration?: readonly string[] | csstype.Property.AnimationDuration<string & {}> | readonly csstype.Property.AnimationDuration<string & {}>[] | undefined;
|
|
@@ -871,7 +871,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
871
871
|
OAnimationPlayState?: readonly string[] | csstype.Property.AnimationPlayState | readonly csstype.Property.AnimationPlayState[] | undefined;
|
|
872
872
|
OAnimationTimingFunction?: readonly string[] | csstype.Property.AnimationTimingFunction | readonly csstype.Property.AnimationTimingFunction[] | undefined;
|
|
873
873
|
OBackgroundSize?: readonly (string | (string & {}))[] | csstype.Property.BackgroundSize<string | number> | readonly NonNullable<csstype.Property.BackgroundSize<string | number> | undefined>[] | undefined;
|
|
874
|
-
OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
874
|
+
OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
875
875
|
OObjectFit?: csstype.Property.ObjectFit | readonly NonNullable<csstype.Property.ObjectFit | undefined>[] | readonly csstype.Property.ObjectFit[] | undefined;
|
|
876
876
|
OObjectPosition?: readonly (string | (string & {}))[] | csstype.Property.ObjectPosition<string | number> | readonly NonNullable<csstype.Property.ObjectPosition<string | number> | undefined>[] | undefined;
|
|
877
877
|
OTabSize?: readonly (string | (string & {}))[] | csstype.Property.TabSize<string | number> | readonly NonNullable<csstype.Property.TabSize<string | number> | undefined>[] | undefined;
|
package/package.json
CHANGED
|
@@ -286,10 +286,13 @@ declare const components: {
|
|
|
286
286
|
MuiTimelineDot: {
|
|
287
287
|
defaultProps?: Partial<_mui_lab_TimelineDot.TimelineDotProps> | undefined;
|
|
288
288
|
styleOverrides?: Partial<_mui_material_styles_overrides.OverridesStyleRules<keyof _mui_lab_TimelineDot.TimelineDotClasses, "MuiTimelineDot", {
|
|
289
|
-
|
|
289
|
+
cssVarPrefix: string;
|
|
290
|
+
zIndex: _mui_material.ZIndex;
|
|
291
|
+
direction: _mui_system.Direction;
|
|
292
|
+
opacity: _mui_material.Opacity;
|
|
293
|
+
typography: _mui_material.TypographyVariants;
|
|
290
294
|
palette: _mui_material.Palette;
|
|
291
295
|
colorSchemes: Record<_mui_material.SupportedColorScheme, _mui_material.ColorSystem>;
|
|
292
|
-
cssVarPrefix: string;
|
|
293
296
|
vars: _mui_material.ThemeVars;
|
|
294
297
|
getCssVar: (field: _mui_material.ThemeCssVar, ...vars: _mui_material.ThemeCssVar[]) => string;
|
|
295
298
|
getColorSchemeSelector: (colorScheme: _mui_material.SupportedColorScheme) => string;
|
|
@@ -300,16 +303,13 @@ declare const components: {
|
|
|
300
303
|
spacing: _mui_system.Spacing;
|
|
301
304
|
breakpoints: _mui_system.Breakpoints;
|
|
302
305
|
shape: _mui_system.Shape;
|
|
303
|
-
|
|
306
|
+
transitions: _mui_material.Transitions;
|
|
304
307
|
shadows: _mui_material.Shadows;
|
|
305
308
|
mixins: _mui_material.Mixins;
|
|
306
|
-
zIndex: _mui_material.ZIndex;
|
|
307
|
-
direction: _mui_system.Direction;
|
|
308
309
|
shouldSkipGeneratingVar: (keys: string[], value: string | number) => boolean;
|
|
309
310
|
unstable_sxConfig: _mui_system.SxConfig;
|
|
310
311
|
unstable_sx: (props: _mui_system.SxProps<_mui_material.Theme>) => _mui_styled_engine.CSSObject;
|
|
311
312
|
applyStyles: _mui_system.ApplyStyles<"light" | "dark">;
|
|
312
|
-
opacity: _mui_material.Opacity;
|
|
313
313
|
overlays: _mui_material.Overlays;
|
|
314
314
|
customShadows: CustomShadows;
|
|
315
315
|
unstable_strictMode?: boolean | undefined;
|
|
@@ -326,10 +326,13 @@ declare const components: {
|
|
|
326
326
|
MuiTimelineConnector: {
|
|
327
327
|
defaultProps?: Partial<_mui_lab_TimelineConnector.TimelineConnectorProps> | undefined;
|
|
328
328
|
styleOverrides?: Partial<_mui_material_styles_overrides.OverridesStyleRules<"root", "MuiTimelineConnector", {
|
|
329
|
-
|
|
329
|
+
cssVarPrefix: string;
|
|
330
|
+
zIndex: _mui_material.ZIndex;
|
|
331
|
+
direction: _mui_system.Direction;
|
|
332
|
+
opacity: _mui_material.Opacity;
|
|
333
|
+
typography: _mui_material.TypographyVariants;
|
|
330
334
|
palette: _mui_material.Palette;
|
|
331
335
|
colorSchemes: Record<_mui_material.SupportedColorScheme, _mui_material.ColorSystem>;
|
|
332
|
-
cssVarPrefix: string;
|
|
333
336
|
vars: _mui_material.ThemeVars;
|
|
334
337
|
getCssVar: (field: _mui_material.ThemeCssVar, ...vars: _mui_material.ThemeCssVar[]) => string;
|
|
335
338
|
getColorSchemeSelector: (colorScheme: _mui_material.SupportedColorScheme) => string;
|
|
@@ -340,16 +343,13 @@ declare const components: {
|
|
|
340
343
|
spacing: _mui_system.Spacing;
|
|
341
344
|
breakpoints: _mui_system.Breakpoints;
|
|
342
345
|
shape: _mui_system.Shape;
|
|
343
|
-
|
|
346
|
+
transitions: _mui_material.Transitions;
|
|
344
347
|
shadows: _mui_material.Shadows;
|
|
345
348
|
mixins: _mui_material.Mixins;
|
|
346
|
-
zIndex: _mui_material.ZIndex;
|
|
347
|
-
direction: _mui_system.Direction;
|
|
348
349
|
shouldSkipGeneratingVar: (keys: string[], value: string | number) => boolean;
|
|
349
350
|
unstable_sxConfig: _mui_system.SxConfig;
|
|
350
351
|
unstable_sx: (props: _mui_system.SxProps<_mui_material.Theme>) => _mui_styled_engine.CSSObject;
|
|
351
352
|
applyStyles: _mui_system.ApplyStyles<"light" | "dark">;
|
|
352
|
-
opacity: _mui_material.Opacity;
|
|
353
353
|
overlays: _mui_material.Overlays;
|
|
354
354
|
customShadows: CustomShadows;
|
|
355
355
|
unstable_strictMode?: boolean | undefined;
|