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