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