@wellesley/notifications 1.0.266 → 1.0.267
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/index.mjs +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{api as Hf,handleBasicResponse as Zt,usePostApiV1BlockByUserIdMutation as Dy,useDeleteApiV1BlockByUserIdMutation as By,usePostApiV1UsersFollowByUsernameAcceptMutation as Wy,usePostApiV1UsersFollowByUsernameRejectMutation as $y,useGetApiV1UsersFolloweesQuery as Vy,useGetApiV1UsersByUserIdFollowingQuery as Zy,useGetApiV1SearchQuery as Hy}from"https://unpkg.com/@wellesley/openapi@next
|
|
1
|
+
import{api as Hf,handleBasicResponse as Zt,usePostApiV1BlockByUserIdMutation as Dy,useDeleteApiV1BlockByUserIdMutation as By,usePostApiV1UsersFollowByUsernameAcceptMutation as Wy,usePostApiV1UsersFollowByUsernameRejectMutation as $y,useGetApiV1UsersFolloweesQuery as Vy,useGetApiV1UsersByUserIdFollowingQuery as Zy,useGetApiV1SearchQuery as Hy}from"https://unpkg.com/@wellesley/openapi@next";import{toast as Ro,ToastContainer as j0}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as z0,createSelector as $v,createSlice as Sp}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import F0,{forwardRef as D0,createElement as Cv,useState as no,useEffect as Gf,useRef as Ih,useCallback as cv}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{authSlice as Yf}from"https://unpkg.com/@wellesley/auth@next";import{useSelector as yn,useDispatch as Ug}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as Qy,DialogContent as Gy,cn as gt,Form as B0,FormField as W0,FormItem as qy,FormLabel as Ky,FormControl as Yy,Input as $0,Command as Xy,CommandList as Jy,CommandItem as e1,FormMessage as t1,Button as Ec,ButtonLoader as Av,TooltipWrapper as Tv,Avatar as n1,AvatarImage as r1,Skeleton as i1,DropdownMenu as V0,DropdownMenuTrigger as Z0,DropdownMenuContent as H0,DropdownMenuItem as Q0,useIsMobile as o1,Tabs as s1,TabsList as u1,TabsTrigger as Yv,TabsContent as Xv,HoverCard as l1,HoverCardTrigger as a1,HoverCardContent as c1,Tooltip as f1,TooltipTrigger as d1,TooltipContent as p1}from"https://unpkg.com/@wellesley/ui@next";import{get as Nv,set as fv,appendErrors as h1,useForm as Vv,FormProvider as g1}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as G0,ExternalLinks as m1,AppsLink as Th}from"https://unpkg.com/@wellesley/router@next";import{usePostApiV1UsersFollowByUsernameMutation as v1,usePostApiV1UsersFollowByUsernameUndoMutation as y1,canFollowBack as _1,isFollowPending as w1,canUnfollow as Jv,userSlice as Vh,useRelationship as x1,useCurrentUser as q0,useGetUserByUserName as S1,useGetUserById as k1,usePostApiV1MuteByUserIdMutation as E1,useDeleteApiV1MuteByUserIdMutation as C1,isMuted as A1,usePutApiV1NotesMutation as T1,useDeleteApiV1NotesByUserIdMutation as N1,useGetApiV1UsersFollowersQuery as I1,useGetApiV1UsersByUserIdFollowersQuery as R1,UserAvatar as K0,usePostApiV1UsersFollowByUsernameRejectMutation as b1,canUnsubscribeFromMe as P1}from"https://unpkg.com/@wellesley/user@next";import{selectSmallestPreview as e0}from"https://unpkg.com/@wellesley/uploads@next";import{getErrorMsg as xg}from"https://unpkg.com/@wellesley/error-kit@next";import{rootReducer as Y0}from"https://unpkg.com/@wellesley/store@next";import{platformSettingsSlice as O1,useProfileSettings as L1,UserKeysSettings as M1}from"https://unpkg.com/@wellesley/settings@next";import{wsSlice as U1}from"https://unpkg.com/@wellesley/ws@next";const j1=e=>{if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)},z1=e=>j1(e)&&"type"in e&&"string"==typeof e.type,qe=e=>{const t=t=>({type:e,payload:t});return t.toString=()=>`${e}`,t.type=e,t.match=t=>z1(t)&&t.type===e,t};qe("remoteReady"),qe("reselectUser"),qe("requestLogin"),qe("requestLogout"),qe("setConfirmLeavePage"),qe("requestChangePath");const F1=qe("wsSubscribe"),D1=qe("wsUnSubscribe");qe("hostStoreConnect"),qe("remoteLogin"),qe("remoteLogout"),qe("wsOnMessage"),qe("setRouterPath"),qe("setDeviceType");const X0=qe("setUserError"),J0=qe("setUserIsError"),Iv=qe("setUserPending"),Rv=qe("setUserSuccess"),ey=qe("setUserData"),B1=qe("updateAccountData"),W1=qe("updateUser"),ty=qe("addNotification"),ny=qe("markNotification"),ry=qe("setNotificationsError"),iy=qe("setNotificationsList"),bv=qe("setNotificationsPending"),oy=qe("setNotificationsTotalCount"),Pv=qe("setNotificationsUnreadCount"),sy=qe("resetNotificationsState"),uy=qe("undoNotification");qe("setInstanceInfo"),qe("setInstanceInfoPending"),qe("setInstanceInfoError"),qe("setPlatformSettings"),qe("setProfileSettings"),qe("setGroupData"),qe("setGroupLoading"),qe("showGroupBasicInfo"),z0("requestMicroFrontendFetch"),z0("sendMicroFrontendFetchResponse");const $1=Hf.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var a;t(bv(!0));try{const e=await Zt(n),i=(null==(a=r().user.data)?void 0:a.selectedUserId)||"";e&&t(iy({userId:i,list:e.data}))}catch(e){t(ry(e))}finally{t(bv(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Zt(n),t(ny(e))}catch(e){Ro.error(`Mark notification error', ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await Zt(n),t(Pv(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await Zt(n),a=!e.status;r&&t(a?oy(r.data):Pv(r.data))}catch(e){Ro.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:V1,usePostApiV1NotificationsByIdMarkMutation:hS,usePostApiV1NotificationsMarkAllMutation:gS,useGetApiV1NotificationsCountQuery:Z1}=$1,t0={data:{userId:"",list:[]},count:{},isPending:!1},H1=e=>e,Q1=e=>e.error,G1=e=>e.isPending,q1=e=>{var t;return null==(t=e.count)?void 0:t.total},K1=e=>{var t;return null==(t=e.count)?void 0:t.unread},Y1=e=>e.data.userId,Zv=$v(H1,(e=>e.data.list)),X1=$v(Zv,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),J1=$v(Zv,(e=>null==e?void 0:e.at(-1))),Ag=Sp({name:"notifications",initialState:t0,reducers:{updateNotification:(e,t)=>{var n;if(!e.data.list)return;const r=t.payload;e.data.list=null==(n=e.data.list)?void 0:n.map((e=>e.id===r.id?{...e,...r}:e))},readAll:e=>{var t;e.data.list&&(e.data.list=null==(t=e.data.list)?void 0:t.map((e=>({...e,status:"READ"}))))}},extraReducers:e=>{e.addCase(bv,((e,t)=>{e.isPending=t.payload})).addCase(ry,((e,t)=>{e.error=t.payload})).addCase(iy,((e,t)=>{const n=t.payload.userId,r=t.payload.list;e.data={userId:n,list:[...e.data.list||[],...r.filter((t=>{var n;return!(null!=(n=e.data.list)&&n.some((e=>e.id===t.id)))}))]}})).addCase(ty,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(ny,((e,t)=>{e.data.list&&(e.data.list=e.data.list.map((e=>e.id===t.payload.id?{...e,status:t.payload.status}:e)))})).addCase(oy,((e,t)=>{e.count.total=t.payload})).addCase(Pv,((e,t)=>{e.count.unread=t.payload})).addCase(sy,(()=>t0)).addCase(uy,((e,t)=>{var n,r,a;const i=t.payload;"UNREAD"===(null==(r=null==(n=e.data.list)?void 0:n.find((e=>e.id===i)))?void 0:r.status)&&e.count.unread&&(e.count.unread-=1),e.data.list=(null==(a=e.data.list)?void 0:a.filter((e=>e.id!==i)))||[]}))},selectors:{selectError:Q1,selectIsPending:G1,selectTotalCount:q1,selectUnreadCount:K1,selectNotifications:Zv,selectUnreadNotifications:X1,selectLastNotification:J1,selectNotificationsOwner:Y1}});var n0,r0,kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dv={exports:{}},mh={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|