@wellesley/notifications 1.0.205 → 1.0.206
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 N0,handleBasicResponse as hm,usePostApiV1BlockByUserIdMutation as wy,useDeleteApiV1BlockByUserIdMutation as ky,usePostApiV1UsersFollowByUsernameAcceptMutation as Sy,usePostApiV1UsersFollowByUsernameRejectMutation as Ey,useGetApiV1UsersFolloweesQuery as Cy,useGetApiV1UsersByUserIdFollowingQuery as Ny,useGetApiV1SearchQuery as Ty}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as N0,handleBasicResponse as hm,usePostApiV1BlockByUserIdMutation as wy,useDeleteApiV1BlockByUserIdMutation as ky,usePostApiV1UsersFollowByUsernameAcceptMutation as Sy,usePostApiV1UsersFollowByUsernameRejectMutation as Ey,useGetApiV1UsersFolloweesQuery as Cy,useGetApiV1UsersByUserIdFollowingQuery as Ny,useGetApiV1SearchQuery as Ty}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.307";import{toast as yc,ToastContainer as T0}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as A0,createSelector as Mv,createSlice as jv}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import I0,{forwardRef as R0,createElement as yv,useState as Ji,useEffect as $f,useRef as Sh,useCallback as rv}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{authSlice as Hf}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.363";import{useSelector as dr,useDispatch as Am}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as Ay,DialogContent as Iy,cn as gt,Form as b0,FormField as O0,FormItem as Ry,FormLabel as by,FormControl as Oy,Input as L0,Command as Ly,CommandList as Py,CommandItem as My,FormMessage as jy,Button as xc,ButtonLoader as _v,TooltipWrapper as xv,Skeleton as zy,DropdownMenu as P0,DropdownMenuTrigger as M0,DropdownMenuContent as j0,DropdownMenuItem as z0,useIsMobile as Uy,Tabs as Dy,TabsList as Fy,TabsTrigger as Vv,TabsContent as Hv,HoverCard as Wy,HoverCardTrigger as By,HoverCardContent as $y,Tooltip as Zy,TooltipTrigger as Vy,TooltipContent as Hy}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.269";import{get as wv,set as iv,appendErrors as Gy,useForm as zv,FormProvider as qy}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as U0,ExternalLinks as Qy,AppsLink as kh}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.235";import{usePostApiV1UsersFollowByUsernameMutation as Ky,usePostApiV1UsersFollowByUsernameUndoMutation as Yy,isBlocked as Xy,canFollowBack as Jy,isFollowPending as e1,canUnfollow as Gv,userSlice as Gf,useRelationship as Uv,useCurrentUser as Dv,useGetUserByUserName as t1,useGetUserById as n1,usePostApiV1MuteByUserIdMutation as r1,useDeleteApiV1MuteByUserIdMutation as i1,isMuted as o1,usePutApiV1NotesMutation as s1,useDeleteApiV1NotesByUserIdMutation as u1,useGetApiV1UsersFollowersQuery as l1,useGetApiV1UsersByUserIdFollowersQuery as a1,usePostApiV1UsersFollowByUsernameRejectMutation as c1,canUnsubscribeFromMe as f1,UserAvatar as Im}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.322";import{selectSmallestPreview as qv}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.192";import{rootReducer as D0}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.306";import{platformSettingsSlice as d1,useProfileSettings as p1,UserKeysSettings as h1}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.264";import{wsSlice as m1}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.289";const g1=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)},v1=e=>g1(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=>v1(t)&&t.type===e,t};Qe("remoteReady"),Qe("reselectUser"),Qe("requestLogin"),Qe("requestLogout"),Qe("setConfirmLeavePage"),Qe("requestChangePath");const y1=Qe("wsSubscribe"),_1=Qe("wsUnSubscribe");Qe("hostStoreConnect"),Qe("remoteLogin"),Qe("remoteLogout"),Qe("wsOnMessage"),Qe("setRouterPath"),Qe("setDeviceType"),Qe("setUserError"),Qe("setUserIsError"),Qe("setUserPending"),Qe("setUserSuccess"),Qe("setUserData"),Qe("updateAccountData"),Qe("updateUser");const F0=Qe("addNotification"),W0=Qe("markNotification"),B0=Qe("setNotificationsError"),$0=Qe("setNotificationsList"),kv=Qe("setNotificationsPending"),Z0=Qe("setNotificationsTotalCount"),Sv=Qe("setNotificationsUnreadCount"),V0=Qe("resetNotificationsState"),H0=Qe("undoNotification");Qe("setInstanceInfo"),Qe("setInstanceInfoPending"),Qe("setInstanceInfoError"),Qe("setPlatformSettings"),Qe("setProfileSettings"),Qe("setGroupData"),Qe("setGroupLoading"),Qe("showGroupBasicInfo"),A0("requestMicroFrontendFetch"),A0("sendMicroFrontendFetchResponse");const x1=N0.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var a;t(kv(!0));try{const e=await hm(n),i=(null==(a=r().user.data)?void 0:a.selectedUserId)||"";e&&t($0({userId:i,list:e.data}))}catch(e){t(B0(e))}finally{t(kv(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await hm(n),t(W0(e))}catch(e){yc.error(`Mark notification error', ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await hm(n),t(Sv(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await hm(n),a=!e.status;r&&t(a?Z0(r.data):Sv(r.data))}catch(e){yc.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:w1,usePostApiV1NotificationsByIdMarkMutation:I2,usePostApiV1NotificationsMarkAllMutation:R2,useGetApiV1NotificationsCountQuery:k1}=x1,Qv={data:{userId:"",list:[]},count:{},isPending:!1},S1=e=>e,E1=e=>e.error,C1=e=>e.isPending,N1=e=>{var t;return null==(t=e.count)?void 0:t.total},T1=e=>{var t;return null==(t=e.count)?void 0:t.unread},A1=e=>e.data.userId,Fv=Mv(S1,(e=>e.data.list)),I1=Mv(Fv,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),R1=Mv(Fv,(e=>null==e?void 0:e.at(-1))),_m=jv({name:"notifications",initialState:Qv,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(kv,((e,t)=>{e.isPending=t.payload})).addCase(B0,((e,t)=>{e.error=t.payload})).addCase($0,((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(F0,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(W0,((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(Z0,((e,t)=>{e.count.total=t.payload})).addCase(Sv,((e,t)=>{e.count.unread=t.payload})).addCase(V0,(()=>Qv)).addCase(H0,((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:E1,selectIsPending:C1,selectTotalCount:N1,selectUnreadCount:T1,selectNotifications:Fv,selectUnreadNotifications:I1,selectLastNotification:R1,selectNotificationsOwner:A1}});var Kv,Yv,_c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ov={exports:{}},fh={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|