@zydon/common 2.7.46 → 2.7.47
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 Z=createContext(void 0),le=({children:
|
|
8
|
+
var Z=createContext(void 0),le=({children:m,originId:C,originType:V,bearerToken:G,vapidKey:H,serviceWorkerPath:k="/",serviceWorkerFile:x="service-worker.js",pollingInterval:W=1e3,apiAdapters:r,onMessageReceived:p,onError:o})=>{let[s,h]=useState(null),[A,R]=useState(0),[B,L]=useState(!1),[v,w]=useState(!1),[y,E]=useState(!1),[N,ee]=useState(!1),[P,te]=useState({subscriptions:[]}),[z,F]=useState(!1),[D]=useState(new Set),f=useRef(new Map),_=useMemo(()=>!s||z,[s,z]);useEffect(()=>{if(!v||!y||!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),p?.(i.payload,i.topic);}),R(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=>{f.current.get(g)?.stopPollingOnFirstMessage&&f.current.delete(g);}),f.current.size>0||(w(!1),E(!1));}}catch(t){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao buscar mensagens:",data:t});}},W);return ()=>clearInterval(e)},[v,y,s,W,r,p,D,P.subscriptions.length]);let T=useCallback(async(e,t)=>{try{let c=e?.toJSON().keys,a={origin_type:V,origin_id:C,...t&&e?{endpoint:e.endpoint,auth:c?.auth,p256dh:c?.p256dh}:{}},i=await r.registerClient(a);return h(i.id),L(!1),ee(t),t||E(!0),i.id}catch(c){return a({type:"ERROR",environment:["development","homologation"],message:"Erro ao registrar cliente:",data:c}),L(!0),o?.(c),null}},[r,C,V,o]);useEffect(()=>{let e=!0,t=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 a=await T(null,!1);e&&a&&(h(a),E(!0));}catch(a$1){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao registrar cliente ativo:",data:a$1}),o?.(a$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 I=>{let K=I.data?.payload,Q=I.data?.id;if(K&&(R(b=>b+1),p?.(K,I.data?.topic)),Q)try{await r.updateMessageStatus(Q,{status:"DELIVERED"});}catch(b){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao atualizar status da mensagem:",data:b}),L(!0),o?.(b);}},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||E(!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),E(!0));}catch(i){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao criar cliente ativo como fallback:",data:i});}}}return G&&c(),()=>{e=!1,t&&"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",t);}},[G,T,r,H,k,x,p,o]);let l=useCallback(async()=>{if(s){F(!0);try{let e=await r.listSubscriptions(s);te(e);}catch(e){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao listar inscri\xE7\xF5es:",data:e}),o?.(e);}finally{F(!1);}}},[s,r,o]);useEffect(()=>{s&&l();},[s]);let $=useCallback(async(e,t)=>{if(!s){a({type:"WARN",environment:["development","homologation"],message:"Cliente n\xE3o registrado"});return}try{t&&f.current.set(e,t),await r.subscribeTopic(s,e),await l(),!N&&(!v||!y)&&(w(!0),E(!0));}catch(c){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao inscrever no t\xF3pico:",data:c}),o?.(c);}},[s,r,l,o,v,y,N]),j=useCallback(async e=>{if(!s){a({type:"WARN",environment:["development","homologation"],message:"Cliente n\xE3o registrado"});return}try{f.current.delete(e),await r.unsubscribeTopic(s,e),await l();}catch(t){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao desinscrever do t\xF3pico:",data:t}),o?.(t);}},[s,r,l,o]),q=useCallback(async e=>{if(!(!s||e.length===0))try{e.forEach(t=>{f.current.has(t)||f.current.set(t,{});}),await r.subscribeTopicsBatch(s,e),await l(),N||(w(!0),E(!0));}catch(t){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao inscrever em t\xF3picos:",data:t}),o?.(t);}},[s,r,l,o,N]),J=useCallback(async e=>{if(!(!s||e.length===0))try{e.forEach(t=>f.current.delete(t)),await r.unsubscribeTopicsBatch(s,e),await l();}catch(t){a({type:"ERROR",environment:["development","homologation"],message:"Erro ao desinscrever de t\xF3picos:",data:t}),o?.(t);}},[s,r,l,o]),U=useCallback(()=>{R(0);},[]),se=useMemo(()=>({clientId:s,subscribedTopics:P,isLoading:_,newMessageCount:A,isRegisterError:B,subscribeToTopic:$,unsubscribeFromTopic:j,subscribeTopicsBatch:q,unsubscribeTopicsBatch:J,resetMessageCount:U}),[s,P,_,A,B,$,j,q,J,U]);return jsx(Z.Provider,{value:se,children:m})};function Oe(){let m=useContext(Z);if(!m)throw new Error("usePushNotifications precisa estar dentro de PushNotificationProvider");return m}
|
|
9
9
|
|
|
10
10
|
export { le as PushNotificationProvider, Oe 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","newMessageCount","setNewMessageCount","isRegisterError","setIsRegisterError","pollingEnabled","setPollingEnabled","shouldPoll","setShouldPoll","isPassiveClient","setIsPassiveClient","subscribedTopics","setSubscribedTopics","isLoadingSubscriptions","setIsLoadingSubscriptions","processedMessageIds","topicOptionsRef","isLoading","interval","newMessages","m","prev","single","aggregated","err","consoleLog","topicsHandled","topic","error","performClientRegistration","subscription","isPassive","keys","payload","response","mounted","messageHandler","initSwAndRegister","id","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,M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AhB,EACA,gBAAAE,EACA,iBAAA6C,EACA,qBAAAE,EACA,qBAAAC,EACA,uBAAAE,EACA,kBAAAC,CACF,GACA,CACEvD,EACAY,EACAM,EACAhB,EACAE,EACA6C,EACAE,EACAC,EACAE,EACAC,CACF,CACF,EAEA,OACErE,GAACC,EAAwB,SAAxB,CAAiC,MAAOqE,GACtC,SAAAnE,EACH,CAEJ,EAEO,SAASoE,IAAoD,CAClE,IAAMC,EAAU7E,GAAWM,CAAuB,EAElD,GAAI,CAACuE,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 [newMessageCount, setNewMessageCount] = useState<number>(0);\n const [isRegisterError, setIsRegisterError] = useState<boolean>(false);\n const [pollingEnabled, setPollingEnabled] = useState<boolean>(false);\n const [shouldPoll, setShouldPoll] = useState<boolean>(false);\n const [isPassiveClient, setIsPassiveClient] = useState<boolean>(false);\n const [subscribedTopics, setSubscribedTopics] = useState<SubscriptionsData>({\n subscriptions: [],\n });\n const [isLoadingSubscriptions, setIsLoadingSubscriptions] =\n useState<boolean>(false);\n const [processedMessageIds] = useState<Set<string>>(new Set());\n const topicOptionsRef = useRef<Map<string, TopicSubscriptionOptions>>(\n new Map(),\n );\n\n const isLoading = useMemo(\n () => !clientId || isLoadingSubscriptions,\n [clientId, isLoadingSubscriptions],\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 const newMessages = messages.filter(m => m.payload && !processedMessageIds.has(m.id));\n if (newMessages.length === 0) return;\n\n newMessages.forEach(m => processedMessageIds.add(m.id));\n setNewMessageCount(prev => prev + newMessages.length);\n\n if (newMessages.length === 1) {\n const single = newMessages[0];\n onMessageReceived?.(single.payload as TMessage, single.topic);\n } else {\n const aggregated = newMessages.map(m => m.payload) as unknown as TMessage;\n onMessageReceived?.(aggregated);\n }\n\n try {\n await Promise.allSettled(\n newMessages.map(m =>\n apiAdapters.updateMessageStatus(m.id, {\n status: MessageStatus.DELIVERED,\n }),\n ),\n );\n } catch (err) {\n consoleLog({\n type: ConsoleType.ERROR,\n environment: [Environment.DEVELOPMENT, Environment.HOMOLOGATION],\n message: 'Erro ao marcar mensagens como entregues:',\n data: err,\n });\n } finally {\n const topicsHandled = new Set<string>();\n newMessages.forEach(m => topicsHandled.add(m.topic));\n topicsHandled.forEach(topic => {\n const topicOptions = topicOptionsRef.current.get(topic);\n if (topicOptions?.stopPollingOnFirstMessage) {\n topicOptionsRef.current.delete(topic);\n }\n });\n\n const hasOtherTopicsNeedingPolling = topicOptionsRef.current.size > 0;\n if (!hasOtherTopicsNeedingPolling) {\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 pollingEnabled,\n shouldPoll,\n clientId,\n pollingInterval,\n apiAdapters,\n onMessageReceived,\n processedMessageIds,\n subscribedTopics.subscriptions.length,\n ]);\n\n const performClientRegistration = useCallback(\n async (subscription: PushSubscription | null, isPassive: boolean) => {\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 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 setIsRegisterError(true);\n onError?.(error as Error);\n return null;\n }\n },\n [apiAdapters, originId, originType, onError],\n );\n\n useEffect(() => {\n let mounted = true;\n let messageHandler: ((e: MessageEvent) => void) | null = null;\n\n async function initSwAndRegister() {\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 }\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 as TMessage, 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 }\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 bearerToken,\n performClientRegistration,\n apiAdapters,\n vapidKey,\n serviceWorkerPath,\n serviceWorkerFile,\n onMessageReceived,\n onError,\n ]);\n\n const refetchSubscriptions = useCallback(async () => {\n if (!clientId) return;\n\n setIsLoadingSubscriptions(true);\n try {\n const data = await apiAdapters.listSubscriptions(clientId);\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 onError?.(error as Error);\n } finally {\n setIsLoadingSubscriptions(false);\n }\n }, [clientId, apiAdapters, 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 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 onError?.(error as Error);\n }\n },\n [\n clientId,\n apiAdapters,\n refetchSubscriptions,\n onError,\n pollingEnabled,\n shouldPoll,\n isPassiveClient,\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 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 onError?.(error as Error);\n }\n },\n [clientId, apiAdapters, refetchSubscriptions, onError],\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 onError?.(err as Error);\n }\n },\n [clientId, apiAdapters, refetchSubscriptions, onError, isPassiveClient],\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 onError?.(err as Error);\n }\n },\n [clientId, apiAdapters, refetchSubscriptions, onError],\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 subscribedTopics,\n isLoading,\n newMessageCount,\n isRegisterError,\n subscribeToTopic,\n unsubscribeFromTopic,\n subscribeTopicsBatch,\n unsubscribeTopicsBatch,\n resetMessageCount,\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","newMessageCount","setNewMessageCount","isRegisterError","setIsRegisterError","pollingEnabled","setPollingEnabled","shouldPoll","setShouldPoll","isPassiveClient","setIsPassiveClient","subscribedTopics","setSubscribedTopics","isLoadingSubscriptions","setIsLoadingSubscriptions","processedMessageIds","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,QA0hBH,cAAAC,OAAA,oBA5gBJ,IAAMC,EAA0BR,GAE9B,MAAS,EAEES,GAA2B,CAAqB,CAC3D,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,EAAiBC,CAAkB,EAAIlB,EAAiB,CAAC,EAC1D,CAACmB,EAAiBC,CAAkB,EAAIpB,EAAkB,EAAK,EAC/D,CAACqB,EAAgBC,CAAiB,EAAItB,EAAkB,EAAK,EAC7D,CAACuB,EAAYC,CAAa,EAAIxB,EAAkB,EAAK,EACrD,CAACyB,EAAiBC,EAAkB,EAAI1B,EAAkB,EAAK,EAC/D,CAAC2B,EAAkBC,EAAmB,EAAI5B,EAA4B,CAC1E,cAAe,CAAC,CAClB,CAAC,EACK,CAAC6B,EAAwBC,CAAyB,EACtD9B,EAAkB,EAAK,EACnB,CAAC+B,CAAmB,EAAI/B,EAAsB,IAAI,GAAK,EACvDgC,EAAkBjC,GACtB,IAAI,GACN,EAEMkC,EAAYnC,EAChB,IAAM,CAACiB,GAAYc,EACnB,CAACd,EAAUc,CAAsB,CACnC,EAEAhC,EAAU,IAAM,CACd,GACE,CAACwB,GACD,CAACE,GACD,CAACR,GACD,CAACH,EAAY,eACbe,EAAiB,cAAc,SAAW,EAE1C,OAEF,IAAMO,EAAW,YAAY,SAAY,CACvC,GAAI,CAGF,IAAMC,IAFS,MAAMvB,EAAY,cAAeG,CAAQ,IAC/B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AAiB,EACA,iBAAAY,EACA,UAAAM,EACA,gBAAAhB,EACA,gBAAAE,EACA,iBAAA0C,EACA,qBAAAE,EACA,qBAAAC,EACA,uBAAAE,EACA,kBAAAC,CACF,GACA,CACEpD,EACAY,EACAM,EACAhB,EACAE,EACA0C,EACAE,EACAC,EACAE,EACAC,CACF,CACF,EAEA,OACElE,GAACC,EAAwB,SAAxB,CAAiC,MAAOkE,GACtC,SAAAhE,EACH,CAEJ,EAEO,SAASiE,IAAoD,CAClE,IAAMC,EAAU1E,GAAWM,CAAuB,EAElD,GAAI,CAACoE,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 [newMessageCount, setNewMessageCount] = useState<number>(0);\n const [isRegisterError, setIsRegisterError] = useState<boolean>(false);\n const [pollingEnabled, setPollingEnabled] = useState<boolean>(false);\n const [shouldPoll, setShouldPoll] = useState<boolean>(false);\n const [isPassiveClient, setIsPassiveClient] = useState<boolean>(false);\n const [subscribedTopics, setSubscribedTopics] = useState<SubscriptionsData>({\n subscriptions: [],\n });\n const [isLoadingSubscriptions, setIsLoadingSubscriptions] =\n useState<boolean>(false);\n const [processedMessageIds] = useState<Set<string>>(new Set());\n const topicOptionsRef = useRef<Map<string, TopicSubscriptionOptions>>(\n new Map(),\n );\n\n const isLoading = useMemo(\n () => !clientId || isLoadingSubscriptions,\n [clientId, isLoadingSubscriptions],\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 const deliverables = messages.filter(m => {\n if (!m?.payload) return false;\n if (processedMessageIds.has(m.id)) return false;\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 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 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 topicsProcessed.forEach(topic => {\n const topicOptions = topicOptionsRef.current.get(topic);\n if (topicOptions?.stopPollingOnFirstMessage) {\n topicOptionsRef.current.delete(topic);\n }\n });\n const hasOtherTopicsNeedingPolling = topicOptionsRef.current.size > 0;\n if (!hasOtherTopicsNeedingPolling) {\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 pollingEnabled,\n shouldPoll,\n clientId,\n pollingInterval,\n apiAdapters,\n onMessageReceived,\n processedMessageIds,\n subscribedTopics.subscriptions.length,\n ]);\n\n const performClientRegistration = useCallback(\n async (subscription: PushSubscription | null, isPassive: boolean) => {\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 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 setIsRegisterError(true);\n onError?.(error as Error);\n return null;\n }\n },\n [apiAdapters, originId, originType, onError],\n );\n\n useEffect(() => {\n let mounted = true;\n let messageHandler: ((e: MessageEvent) => void) | null = null;\n\n async function initSwAndRegister() {\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 }\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 }\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 bearerToken,\n performClientRegistration,\n apiAdapters,\n vapidKey,\n serviceWorkerPath,\n serviceWorkerFile,\n onMessageReceived,\n onError,\n ]);\n\n const refetchSubscriptions = useCallback(async () => {\n if (!clientId) return;\n\n setIsLoadingSubscriptions(true);\n try {\n const data = await apiAdapters.listSubscriptions(clientId);\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 onError?.(error as Error);\n } finally {\n setIsLoadingSubscriptions(false);\n }\n }, [clientId, apiAdapters, 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 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 onError?.(error as Error);\n }\n },\n [\n clientId,\n apiAdapters,\n refetchSubscriptions,\n onError,\n pollingEnabled,\n shouldPoll,\n isPassiveClient,\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 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 onError?.(error as Error);\n }\n },\n [clientId, apiAdapters, refetchSubscriptions, onError],\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 onError?.(err as Error);\n }\n },\n [clientId, apiAdapters, refetchSubscriptions, onError, isPassiveClient],\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 onError?.(err as Error);\n }\n },\n [clientId, apiAdapters, refetchSubscriptions, onError],\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 subscribedTopics,\n isLoading,\n newMessageCount,\n isRegisterError,\n subscribeToTopic,\n unsubscribeFromTopic,\n subscribeTopicsBatch,\n unsubscribeTopicsBatch,\n resetMessageCount,\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';
|
|
@@ -193,7 +193,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
193
193
|
flexShrink?: readonly ((string & {}) | csstype.Globals)[] | csstype.Property.FlexShrink | readonly NonNullable<csstype.Property.FlexShrink | undefined>[] | undefined;
|
|
194
194
|
flexWrap?: csstype.Property.FlexWrap | readonly NonNullable<csstype.Property.FlexWrap | undefined>[] | readonly csstype.Property.FlexWrap[] | undefined;
|
|
195
195
|
float?: csstype.Property.Float | readonly NonNullable<csstype.Property.Float | undefined>[] | readonly csstype.Property.Float[] | undefined;
|
|
196
|
-
fontFamily?: csstype.Property.FontFamily | readonly
|
|
196
|
+
fontFamily?: readonly string[] | csstype.Property.FontFamily | readonly csstype.Property.FontFamily[] | undefined;
|
|
197
197
|
fontFeatureSettings?: readonly string[] | csstype.Property.FontFeatureSettings | readonly csstype.Property.FontFeatureSettings[] | undefined;
|
|
198
198
|
fontKerning?: csstype.Property.FontKerning | readonly NonNullable<csstype.Property.FontKerning | undefined>[] | readonly csstype.Property.FontKerning[] | undefined;
|
|
199
199
|
fontLanguageOverride?: readonly string[] | csstype.Property.FontLanguageOverride | readonly csstype.Property.FontLanguageOverride[] | undefined;
|
|
@@ -218,7 +218,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
218
218
|
fontVariantNumeric?: readonly string[] | csstype.Property.FontVariantNumeric | readonly csstype.Property.FontVariantNumeric[] | undefined;
|
|
219
219
|
fontVariantPosition?: csstype.Property.FontVariantPosition | readonly NonNullable<csstype.Property.FontVariantPosition | undefined>[] | readonly csstype.Property.FontVariantPosition[] | undefined;
|
|
220
220
|
fontVariationSettings?: readonly string[] | csstype.Property.FontVariationSettings | readonly csstype.Property.FontVariationSettings[] | undefined;
|
|
221
|
-
fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
221
|
+
fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ("bold" | (string & {}) | csstype.Globals | "normal" | "bolder" | "lighter")[] | undefined;
|
|
222
222
|
forcedColorAdjust?: csstype.Property.ForcedColorAdjust | readonly NonNullable<csstype.Property.ForcedColorAdjust | undefined>[] | readonly csstype.Property.ForcedColorAdjust[] | undefined;
|
|
223
223
|
gridAutoColumns?: readonly (string | (string & {}))[] | csstype.Property.GridAutoColumns<string | number> | readonly NonNullable<csstype.Property.GridAutoColumns<string | number> | undefined>[] | undefined;
|
|
224
224
|
gridAutoFlow?: readonly string[] | csstype.Property.GridAutoFlow | readonly csstype.Property.GridAutoFlow[] | undefined;
|
|
@@ -445,7 +445,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
445
445
|
zIndex?: readonly ((string & {}) | csstype.Globals | "auto")[] | csstype.Property.ZIndex | readonly NonNullable<csstype.Property.ZIndex | undefined>[] | undefined;
|
|
446
446
|
zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reset")[] | undefined;
|
|
447
447
|
all?: csstype.Globals | readonly NonNullable<csstype.Globals | undefined>[] | readonly csstype.Globals[] | undefined;
|
|
448
|
-
animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
448
|
+
animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
449
449
|
animationRange?: readonly (string | (string & {}))[] | csstype.Property.AnimationRange<string | number> | readonly NonNullable<csstype.Property.AnimationRange<string | number> | undefined>[] | undefined;
|
|
450
450
|
background?: readonly (string | (string & {}))[] | csstype.Property.Background<string | number> | readonly NonNullable<csstype.Property.Background<string | number> | undefined>[] | undefined;
|
|
451
451
|
border?: readonly (string | (string & {}))[] | csstype.Property.Border<string | number> | readonly NonNullable<csstype.Property.Border<string | number> | undefined>[] | undefined;
|
|
@@ -454,7 +454,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
454
454
|
borderBlockStart?: readonly (string | (string & {}))[] | csstype.Property.BorderBlockStart<string | number> | readonly NonNullable<csstype.Property.BorderBlockStart<string | number> | undefined>[] | undefined;
|
|
455
455
|
borderBottom?: readonly (string | (string & {}))[] | csstype.Property.BorderBottom<string | number> | readonly NonNullable<csstype.Property.BorderBottom<string | number> | undefined>[] | undefined;
|
|
456
456
|
borderColor?: readonly string[] | csstype.Property.BorderColor | readonly csstype.Property.BorderColor[] | undefined;
|
|
457
|
-
borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
457
|
+
borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
458
458
|
borderInline?: readonly (string | (string & {}))[] | csstype.Property.BorderInline<string | number> | readonly NonNullable<csstype.Property.BorderInline<string | number> | undefined>[] | undefined;
|
|
459
459
|
borderInlineEnd?: readonly (string | (string & {}))[] | csstype.Property.BorderInlineEnd<string | number> | readonly NonNullable<csstype.Property.BorderInlineEnd<string | number> | undefined>[] | undefined;
|
|
460
460
|
borderInlineStart?: readonly (string | (string & {}))[] | csstype.Property.BorderInlineStart<string | number> | readonly NonNullable<csstype.Property.BorderInlineStart<string | number> | undefined>[] | undefined;
|
|
@@ -486,7 +486,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
486
486
|
marginBlock?: readonly (string | (string & {}))[] | csstype.Property.MarginBlock<string | number> | readonly NonNullable<csstype.Property.MarginBlock<string | number> | undefined>[] | undefined;
|
|
487
487
|
marginInline?: readonly (string | (string & {}))[] | csstype.Property.MarginInline<string | number> | readonly NonNullable<csstype.Property.MarginInline<string | number> | undefined>[] | undefined;
|
|
488
488
|
mask?: readonly (string | (string & {}))[] | csstype.Property.Mask<string | number> | readonly NonNullable<csstype.Property.Mask<string | number> | undefined>[] | undefined;
|
|
489
|
-
maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
489
|
+
maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
|
|
490
490
|
motion?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
|
|
491
491
|
offset?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
|
|
492
492
|
outline?: readonly (string | (string & {}))[] | csstype.Property.Outline<string | number> | readonly NonNullable<csstype.Property.Outline<string | number> | undefined>[] | undefined;
|
|
@@ -729,8 +729,8 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
729
729
|
WebkitUserModify?: csstype.Property.WebkitUserModify | readonly NonNullable<csstype.Property.WebkitUserModify | undefined>[] | readonly csstype.Property.WebkitUserModify[] | undefined;
|
|
730
730
|
WebkitUserSelect?: csstype.Property.UserSelect | readonly NonNullable<csstype.Property.UserSelect | undefined>[] | readonly csstype.Property.UserSelect[] | undefined;
|
|
731
731
|
WebkitWritingMode?: csstype.Property.WritingMode | readonly NonNullable<csstype.Property.WritingMode | undefined>[] | readonly csstype.Property.WritingMode[] | undefined;
|
|
732
|
-
MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
733
|
-
MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
732
|
+
MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
733
|
+
MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
734
734
|
MozColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
|
|
735
735
|
MozColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
|
|
736
736
|
MozOutlineRadius?: readonly (string | (string & {}))[] | csstype.Property.MozOutlineRadius<string | number> | readonly NonNullable<csstype.Property.MozOutlineRadius<string | number> | undefined>[] | undefined;
|
|
@@ -741,16 +741,16 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
741
741
|
msScrollSnapX?: readonly string[] | csstype.Property.MsScrollSnapX | readonly csstype.Property.MsScrollSnapX[] | undefined;
|
|
742
742
|
msScrollSnapY?: readonly string[] | csstype.Property.MsScrollSnapY | readonly csstype.Property.MsScrollSnapY[] | undefined;
|
|
743
743
|
msTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
|
|
744
|
-
WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
744
|
+
WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
745
745
|
WebkitBorderBefore?: readonly (string | (string & {}))[] | csstype.Property.WebkitBorderBefore<string | number> | readonly NonNullable<csstype.Property.WebkitBorderBefore<string | number> | undefined>[] | undefined;
|
|
746
|
-
WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
746
|
+
WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
747
747
|
WebkitBorderRadius?: readonly (string | (string & {}))[] | csstype.Property.BorderRadius<string | number> | readonly NonNullable<csstype.Property.BorderRadius<string | number> | undefined>[] | undefined;
|
|
748
748
|
WebkitColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
|
|
749
749
|
WebkitColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
|
|
750
750
|
WebkitFlex?: readonly (string | (string & {}))[] | csstype.Property.Flex<string | number> | readonly NonNullable<csstype.Property.Flex<string | number> | undefined>[] | undefined;
|
|
751
751
|
WebkitFlexFlow?: readonly string[] | csstype.Property.FlexFlow | readonly csstype.Property.FlexFlow[] | undefined;
|
|
752
752
|
WebkitMask?: readonly (string | (string & {}))[] | csstype.Property.WebkitMask<string | number> | readonly NonNullable<csstype.Property.WebkitMask<string | number> | undefined>[] | undefined;
|
|
753
|
-
WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
753
|
+
WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
|
|
754
754
|
WebkitTextEmphasis?: readonly string[] | csstype.Property.TextEmphasis | readonly csstype.Property.TextEmphasis[] | undefined;
|
|
755
755
|
WebkitTextStroke?: readonly (string | (string & {}))[] | csstype.Property.WebkitTextStroke<string | number> | readonly NonNullable<csstype.Property.WebkitTextStroke<string | number> | undefined>[] | undefined;
|
|
756
756
|
WebkitTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
|
|
@@ -831,7 +831,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
831
831
|
MozTransitionTimingFunction?: readonly string[] | csstype.Property.TransitionTimingFunction | readonly csstype.Property.TransitionTimingFunction[] | undefined;
|
|
832
832
|
MozUserInput?: csstype.Property.MozUserInput | readonly NonNullable<csstype.Property.MozUserInput | undefined>[] | readonly csstype.Property.MozUserInput[] | undefined;
|
|
833
833
|
msImeMode?: csstype.Property.ImeMode | readonly NonNullable<csstype.Property.ImeMode | undefined>[] | readonly csstype.Property.ImeMode[] | undefined;
|
|
834
|
-
OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
834
|
+
OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
835
835
|
OAnimationDelay?: readonly string[] | csstype.Property.AnimationDelay<string & {}> | readonly csstype.Property.AnimationDelay<string & {}>[] | undefined;
|
|
836
836
|
OAnimationDirection?: readonly string[] | csstype.Property.AnimationDirection | readonly csstype.Property.AnimationDirection[] | undefined;
|
|
837
837
|
OAnimationDuration?: readonly string[] | csstype.Property.AnimationDuration<string & {}> | readonly csstype.Property.AnimationDuration<string & {}>[] | undefined;
|
|
@@ -841,7 +841,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
841
841
|
OAnimationPlayState?: readonly string[] | csstype.Property.AnimationPlayState | readonly csstype.Property.AnimationPlayState[] | undefined;
|
|
842
842
|
OAnimationTimingFunction?: readonly string[] | csstype.Property.AnimationTimingFunction | readonly csstype.Property.AnimationTimingFunction[] | undefined;
|
|
843
843
|
OBackgroundSize?: readonly (string | (string & {}))[] | csstype.Property.BackgroundSize<string | number> | readonly NonNullable<csstype.Property.BackgroundSize<string | number> | undefined>[] | undefined;
|
|
844
|
-
OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "
|
|
844
|
+
OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
845
845
|
OObjectFit?: csstype.Property.ObjectFit | readonly NonNullable<csstype.Property.ObjectFit | undefined>[] | readonly csstype.Property.ObjectFit[] | undefined;
|
|
846
846
|
OObjectPosition?: readonly (string | (string & {}))[] | csstype.Property.ObjectPosition<string | number> | readonly NonNullable<csstype.Property.ObjectPosition<string | number> | undefined>[] | undefined;
|
|
847
847
|
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;
|