@5minds/processcube_app_sdk 0.0.1-feature-edd5ca-ll2c5qrl → 0.0.1-feature-7b4e2a-ll2c66jf
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.
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export declare const NotificationIcon: ({ onTaskClick, newTasksApiUrl, refreshInterval, loadingComponent, errorComponent, }: {
|
|
4
|
-
onTaskClick: (taskId: string) => void;
|
|
5
|
-
newTasksApiUrl: string;
|
|
6
|
-
refreshInterval?: number | undefined;
|
|
7
|
-
loadingComponent?: React.ReactNode;
|
|
8
|
-
errorComponent?: React.ReactNode;
|
|
9
|
-
}) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | React.PromiseLikeOfReactNode;
|
|
1
|
+
export declare const NotificationIcon: any;
|
package/client/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var N=Object.create;var f=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var C=(t,n)=>{for(var s in n)f(t,s,{get:n[s],enumerable:!0})},g=(t,n,s,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of v(n))!P.call(t,a)&&a!==s&&f(t,a,{get:()=>n[a],enumerable:!(i=S(n,a))||i.enumerable});return t};var B=(t,n,s)=>(s=t!=null?N(T(t)):{},g(n||!t||!t.__esModule?f(s,"default",{value:t,enumerable:!0}):s,t)),A=t=>g(f({},"__esModule",{value:!0}),t);var W={};C(W,{DynamicLink:()=>R,NotificationIcon:()=>D});module.exports=A(W);var z=require("client-only");var u=require("next/navigation"),I=require("react/jsx-runtime");function R({href:t,children:n}){let s=(0,u.useRouter)();return(0,I.jsx)("a",{href:t,onClick:i=>{i.preventDefault(),s.replace(t),s.refresh()},children:n})}var m=require("react"),h=require("react-icons/fi"),e=require("@chakra-ui/react"),w=B(require("swr"),1),o=require("react/jsx-runtime"),k=t=>fetch(t).then(n=>n.json()),D=({onTaskClick:t,newTasksApiUrl:n,refreshInterval:s=5e3,loadingComponent:i=null,errorComponent:a=null})=>{let[d,p]=(0,m.useState)([]);Notification.requestPermission().then(r=>{});let c=new Set(JSON.parse(localStorage.getItem("shownTaskIds"))||[]),{data:
|
|
1
|
+
"use strict";"use client";var N=Object.create;var f=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var C=(t,n)=>{for(var s in n)f(t,s,{get:n[s],enumerable:!0})},g=(t,n,s,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of v(n))!P.call(t,a)&&a!==s&&f(t,a,{get:()=>n[a],enumerable:!(i=S(n,a))||i.enumerable});return t};var B=(t,n,s)=>(s=t!=null?N(T(t)):{},g(n||!t||!t.__esModule?f(s,"default",{value:t,enumerable:!0}):s,t)),A=t=>g(f({},"__esModule",{value:!0}),t);var W={};C(W,{DynamicLink:()=>R,NotificationIcon:()=>D});module.exports=A(W);var z=require("client-only");var u=require("next/navigation"),I=require("react/jsx-runtime");function R({href:t,children:n}){let s=(0,u.useRouter)();return(0,I.jsx)("a",{href:t,onClick:i=>{i.preventDefault(),s.replace(t),s.refresh()},children:n})}var m=require("react"),h=require("react-icons/fi"),e=require("@chakra-ui/react"),w=B(require("swr"),1),o=require("react/jsx-runtime"),k=t=>fetch(t).then(n=>n.json()),D=({onTaskClick:t,newTasksApiUrl:n,refreshInterval:s=5e3,loadingComponent:i=null,errorComponent:a=null})=>{let[d,p]=(0,m.useState)([]);Notification.requestPermission().then(r=>{});let c=new Set(JSON.parse(localStorage.getItem("shownTaskIds"))||[]),{data:y,error:b}=(0,w.default)(n,k,{refreshInterval:s,refreshWhenHidden:!0,onSuccess:r=>{p(r),r.forEach(l=>{if(!c.has(l.flowNodeInstanceId)){c.add(l.flowNodeInstanceId);let x=new Notification(l.processModelId,{body:l.flowNodeName,tag:l.flowNodeInstanceId});x.onclose=()=>{c.delete(l.flowNodeInstanceId),t(l.flowNodeInstanceId)}}}),localStorage.setItem("shownTaskIds",JSON.stringify([...c]))}});return b&&a?a:!y&&i?i:(0,o.jsx)(e.ChakraProvider,{children:(0,o.jsx)(e.Box,{children:(0,o.jsxs)(e.Popover,{placement:"right-end",closeOnBlur:!1,children:[(0,o.jsx)(e.PopoverTrigger,{children:(0,o.jsxs)(e.Flex,{position:"relative",align:"center",children:[(0,o.jsx)(e.IconButton,{icon:(0,o.jsx)(h.FiBell,{fontSize:"1.25rem"}),"aria-label":"Settings",bg:"gray.300"}),d.length>0&&(0,o.jsx)(e.Box,{bg:"red",w:"20px",h:"20px",borderRadius:"50%",position:"absolute",top:"-10px",right:"-10px",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"0.8rem",color:"white",children:d.length})]})}),(0,o.jsxs)(e.PopoverContent,{color:"black",bg:"gray.100",borderColor:"blue.800",children:[d.length===0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.PopoverHeader,{pt:4,fontWeight:"bold",border:"0",children:"Keine neuen Aufgaben"}),(0,o.jsx)(e.PopoverArrow,{bg:"blue.800"}),(0,o.jsx)(e.PopoverCloseButton,{})]}),d.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.PopoverHeader,{pt:4,fontWeight:"bold",border:"0",children:"Neue Aufgaben"}),(0,o.jsx)(e.PopoverArrow,{bg:"blue.800"}),(0,o.jsx)(e.PopoverCloseButton,{}),(0,o.jsx)(e.PopoverBody,{children:(0,o.jsx)(e.Center,{maxW:"sm",mx:"auto",py:{base:"4",md:"8"},children:(0,o.jsx)(e.Stack,{spacing:"5",flex:"1",children:(0,o.jsx)(e.List,{listStyleType:"none",children:(0,o.jsx)(e.Stack,{spacing:"3",width:"full",children:d.map(r=>r?(0,o.jsx)(e.ListItem,{value:r.flowNodeInstanceId,backgroundColor:"white",p:"4",boxShadow:"sm",position:"relative",borderRadius:"lg",children:(0,o.jsxs)(e.Stack,{shouldWrapChildren:!0,spacing:"4",children:[(0,o.jsxs)(e.Flex,{justify:"space-between",alignItems:"center",children:[(0,o.jsx)(e.Text,{textStyle:"sm",fontWeight:"medium",color:"fg.emphasized",children:r.processModelId}),(0,o.jsx)(e.Button,{size:"xs",colorScheme:"blue",onClick:()=>{t(r.flowNodeInstanceId),c.delete(r.flowNodeInstanceId),p(d.filter(l=>l.flowNodeInstanceId!==r.flowNodeInstanceId))},children:"X"})]}),(0,o.jsxs)(e.Flex,{justify:"space-between",alignItems:"center",children:[(0,o.jsx)(e.Text,{textStyle:"xs",color:"fg.subtle",fontWeight:"medium",children:r.flowNodeName}),r.startedAt&&(0,o.jsx)(e.Text,{textStyle:"xs",color:"gray.500",textAlign:"right",children:new Date(r.startedAt).toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})})]})]})},r.flowNodeInstanceId):null)})})})})})]})]})]})})})};0&&(module.exports={DynamicLink,NotificationIcon});
|
package/client/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import"client-only";import{useRouter as S}from"next/navigation";import{jsx as v}from"react/jsx-runtime";function U({href:r,children:l}){let i=S();return v("a",{href:r,onClick:d=>{d.preventDefault(),i.replace(r),i.refresh()},children:l})}import{useState as T}from"react";import{FiBell as P}from"react-icons/fi";import{IconButton as C,Box as I,Flex as c,Popover as B,Button as A,PopoverHeader as m,PopoverContent as R,PopoverArrow as h,PopoverCloseButton as w,PopoverBody as k,PopoverTrigger as D,ChakraProvider as W,ListItem as F,Text as f,Center as L,List as M,Stack as p}from"@chakra-ui/react";import O from"swr";import{Fragment as
|
|
1
|
+
"use client";import"client-only";import{useRouter as S}from"next/navigation";import{jsx as v}from"react/jsx-runtime";function U({href:r,children:l}){let i=S();return v("a",{href:r,onClick:d=>{d.preventDefault(),i.replace(r),i.refresh()},children:l})}import{useState as T}from"react";import{FiBell as P}from"react-icons/fi";import{IconButton as C,Box as I,Flex as c,Popover as B,Button as A,PopoverHeader as m,PopoverContent as R,PopoverArrow as h,PopoverCloseButton as w,PopoverBody as k,PopoverTrigger as D,ChakraProvider as W,ListItem as F,Text as f,Center as L,List as M,Stack as p}from"@chakra-ui/react";import O from"swr";import{Fragment as y,jsx as e,jsxs as n}from"react/jsx-runtime";var z=r=>fetch(r).then(l=>l.json()),Q=({onTaskClick:r,newTasksApiUrl:l,refreshInterval:i=5e3,loadingComponent:d=null,errorComponent:g=null})=>{let[s,u]=T([]);Notification.requestPermission().then(o=>{});let a=new Set(JSON.parse(localStorage.getItem("shownTaskIds"))||[]),{data:b,error:x}=O(l,z,{refreshInterval:i,refreshWhenHidden:!0,onSuccess:o=>{u(o),o.forEach(t=>{if(!a.has(t.flowNodeInstanceId)){a.add(t.flowNodeInstanceId);let N=new Notification(t.processModelId,{body:t.flowNodeName,tag:t.flowNodeInstanceId});N.onclose=()=>{a.delete(t.flowNodeInstanceId),r(t.flowNodeInstanceId)}}}),localStorage.setItem("shownTaskIds",JSON.stringify([...a]))}});return x&&g?g:!b&&d?d:e(W,{children:e(I,{children:n(B,{placement:"right-end",closeOnBlur:!1,children:[e(D,{children:n(c,{position:"relative",align:"center",children:[e(C,{icon:e(P,{fontSize:"1.25rem"}),"aria-label":"Settings",bg:"gray.300"}),s.length>0&&e(I,{bg:"red",w:"20px",h:"20px",borderRadius:"50%",position:"absolute",top:"-10px",right:"-10px",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"0.8rem",color:"white",children:s.length})]})}),n(R,{color:"black",bg:"gray.100",borderColor:"blue.800",children:[s.length===0&&n(y,{children:[e(m,{pt:4,fontWeight:"bold",border:"0",children:"Keine neuen Aufgaben"}),e(h,{bg:"blue.800"}),e(w,{})]}),s.length>0&&n(y,{children:[e(m,{pt:4,fontWeight:"bold",border:"0",children:"Neue Aufgaben"}),e(h,{bg:"blue.800"}),e(w,{}),e(k,{children:e(L,{maxW:"sm",mx:"auto",py:{base:"4",md:"8"},children:e(p,{spacing:"5",flex:"1",children:e(M,{listStyleType:"none",children:e(p,{spacing:"3",width:"full",children:s.map(o=>o?e(F,{value:o.flowNodeInstanceId,backgroundColor:"white",p:"4",boxShadow:"sm",position:"relative",borderRadius:"lg",children:n(p,{shouldWrapChildren:!0,spacing:"4",children:[n(c,{justify:"space-between",alignItems:"center",children:[e(f,{textStyle:"sm",fontWeight:"medium",color:"fg.emphasized",children:o.processModelId}),e(A,{size:"xs",colorScheme:"blue",onClick:()=>{r(o.flowNodeInstanceId),a.delete(o.flowNodeInstanceId),u(s.filter(t=>t.flowNodeInstanceId!==o.flowNodeInstanceId))},children:"X"})]}),n(c,{justify:"space-between",alignItems:"center",children:[e(f,{textStyle:"xs",color:"fg.subtle",fontWeight:"medium",children:o.flowNodeName}),o.startedAt&&e(f,{textStyle:"xs",color:"gray.500",textAlign:"right",children:new Date(o.startedAt).toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})})]})]})},o.flowNodeInstanceId):null)})})})})})]})]})]})})})};export{U as DynamicLink,Q as NotificationIcon};
|