@wellesley/notifications 1.0.466 → 1.0.467
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 Qf,handleBasicResponse as rn,usePostApiV1BlockByUserIdMutation as P1,useDeleteApiV1BlockByUserIdMutation as L1,usePostApiV1UsersFollowByUsernameAcceptMutation as M1,usePostApiV1UsersFollowByUsernameRejectMutation as U1,useGetApiV1UsersFolloweesQuery as j1,useGetApiV1UsersByUserIdFollowingQuery as D1,useGetApiV1SearchQuery as z1}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as Qf,handleBasicResponse as rn,usePostApiV1BlockByUserIdMutation as P1,useDeleteApiV1BlockByUserIdMutation as L1,usePostApiV1UsersFollowByUsernameAcceptMutation as M1,usePostApiV1UsersFollowByUsernameRejectMutation as U1,useGetApiV1UsersFolloweesQuery as j1,useGetApiV1UsersByUserIdFollowingQuery as D1,useGetApiV1SearchQuery as z1}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.568";import{toast as ss,ToastContainer as gy}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as my,createSelector as i0,createSlice as Np}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import vy,{forwardRef as yy,createElement as zv,useState as os,useEffect as Yf,useRef as wp,useCallback as Ev}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{authSlice as Xf}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.624";import{useSelector as Nn,useDispatch as Qg}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as F1,DialogContent as $1,cn as mt,Form as _y,FormField as wy,FormItem as B1,FormLabel as W1,FormControl as V1,Input as xy,Command as H1,CommandList as Z1,CommandItem as G1,FormMessage as Q1,Button as Ic,ButtonLoader as Fv,TooltipWrapper as $v,Avatar as q1,AvatarImage as Y1,Skeleton as K1,DropdownMenu as Sy,DropdownMenuTrigger as ky,DropdownMenuContent as Ey,DropdownMenuItem as Cy,useIsMobile as J1,Tabs as X1,TabsList as e_,TabsTrigger as y0,TabsContent as _0,HoverCard as t_,HoverCardTrigger as n_,HoverCardContent as r_,Tooltip as i_,TooltipTrigger as s_,TooltipContent as o_}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.530";import{get as Bv,set as Cv,appendErrors as a_,useForm as s0,FormProvider as u_}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as l_,ExternalLinks as c_,AppsLink as Ph}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.496";import{usePostApiV1UsersFollowByUsernameMutation as f_,usePostApiV1UsersFollowByUsernameUndoMutation as d_,canFollowBack as p_,isFollowPending as h_,canUnfollow as w0,userSlice as Kh,useRelationship as g_,useCurrentUser as Ay,useGetUserByUserName as m_,useGetUserById as v_,usePostApiV1MuteByUserIdMutation as y_,useDeleteApiV1MuteByUserIdMutation as __,isMuted as w_,usePutApiV1NotesMutation as x_,useDeleteApiV1NotesByUserIdMutation as S_,useGetApiV1UsersFollowersQuery as k_,useGetApiV1UsersByUserIdFollowersQuery as E_,UserAvatar as Ny,usePostApiV1UsersFollowByUsernameRejectMutation as C_,canUnsubscribeFromMe as A_}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.583";import{getErrorMsg as yp}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.419";import{getStore as N_,rootReducer as Ty}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.567";import{selectSmallestPreview as x0}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.453";import{useProfileSettings as Iy,platformSettingsSlice as T_,UserKeysSettings as I_}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.525";import{wsSlice as b_}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.550";const R_=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)},O_=e=>R_(e)&&"type"in e&&"string"==typeof e.type,ut=e=>{const t=t=>({type:e,payload:t});return t.toString=()=>`${e}`,t.type=e,t.match=t=>O_(t)&&t.type===e,t};ut("remoteReady");const P_=ut("askLogin");ut("reselectUser"),ut("requestLogin"),ut("requestLogout"),ut("setConfirmLeavePage"),ut("requestChangePath");const L_=ut("wsSubscribe"),M_=ut("wsUnSubscribe");ut("hostStoreConnect"),ut("remoteLogin"),ut("remoteLogout"),ut("wsOnMessage"),ut("setRouterPath"),ut("setDeviceType");const by=ut("setUserError"),Ry=ut("setUserIsError"),Wv=ut("setUserPending"),Vv=ut("setUserSuccess"),Oy=ut("setUserData"),U_=ut("updateAccountData"),j_=ut("updateUser"),Py=ut("addNotification"),Ly=ut("markNotification"),My=ut("setNotificationsError"),Uy=ut("setNotificationsList"),Hv=ut("setNotificationsPending"),jy=ut("setNotificationsTotalCount"),Zv=ut("setNotificationsUnreadCount"),Dy=ut("resetNotificationsState"),zy=ut("undoNotification");ut("setInstanceInfo"),ut("setInstanceInfoPending"),ut("setInstanceInfoError"),ut("setPlatformSettings"),ut("setProfileSettings"),ut("setGroupData"),ut("setGroupLoading"),my("requestMicroFrontendFetch"),my("sendMicroFrontendFetchResponse");const D_=Qf.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t(Hv(!0));try{const e=await rn(n),a=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(Uy({userId:a,list:e.data}))}catch(e){t(My(e))}finally{t(Hv(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await rn(n),t(Ly(e))}catch(e){ss.error(`Mark notification error', ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await rn(n),t(Zv(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await rn(n),i=!e.status;r&&t(i?jy(r.data):Zv(r.data))}catch(e){ss.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:z_,usePostApiV1NotificationsByIdMarkMutation:Xk,usePostApiV1NotificationsMarkAllMutation:eE,useGetApiV1NotificationsCountQuery:F_}=D_,S0={data:{userId:"",list:[]},count:{},isPending:!1},$_=e=>e,B_=e=>e.error,W_=e=>e.isPending,V_=e=>{var t;return null==(t=e.count)?void 0:t.total},H_=e=>{var t;return null==(t=e.count)?void 0:t.unread},Z_=e=>e.data.userId,o0=i0($_,(e=>e.data.list)),G_=i0(o0,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),Q_=i0(o0,(e=>null==e?void 0:e.at(-1))),Dg=Np({name:"notifications",initialState:S0,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(Hv,((e,t)=>{e.isPending=t.payload})).addCase(My,((e,t)=>{e.error=t.payload})).addCase(Uy,((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(Py,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(Ly,((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(jy,((e,t)=>{e.count.total=t.payload})).addCase(Zv,((e,t)=>{e.count.unread=t.payload})).addCase(Dy,(()=>S0)).addCase(zy,((e,t)=>{var n,r,i;const a=t.payload;"UNREAD"===(null==(r=null==(n=e.data.list)?void 0:n.find((e=>e.id===a)))?void 0:r.status)&&e.count.unread&&(e.count.unread-=1),e.data.list=(null==(i=e.data.list)?void 0:i.filter((e=>e.id!==a)))||[]}))},selectors:{selectError:B_,selectIsPending:W_,selectTotalCount:V_,selectUnreadCount:H_,selectNotifications:o0,selectUnreadNotifications:G_,selectLastNotification:Q_,selectNotificationsOwner:Z_}});var Tc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k0,E0,Av={exports:{}},xh={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|