@wellesley/notifications 1.0.333 → 1.0.335

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.
Files changed (2) hide show
  1. package/index.mjs +1 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{api as Hf,handleBasicResponse as rn,usePostApiV1BlockByUserIdMutation as k1,useDeleteApiV1BlockByUserIdMutation as E1,usePostApiV1UsersFollowByUsernameAcceptMutation as C1,usePostApiV1UsersFollowByUsernameRejectMutation as A1,useGetApiV1UsersFolloweesQuery as N1,useGetApiV1UsersByUserIdFollowingQuery as T1,useGetApiV1SearchQuery as I1}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.434";import{toast as Rs,ToastContainer as cy}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as fy,createSelector as n0,createSlice as Cp}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import dy,{forwardRef as py,createElement as jv,useState as ss,useEffect as Gf,useRef as Lh,useCallback as xv}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{authSlice as Yf}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.490";import{useSelector as Nn,useDispatch as Zg}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as b1,DialogContent as R1,cn as xt,Form as hy,FormField as gy,FormItem as O1,FormLabel as L1,FormControl as P1,Input as my,Command as M1,CommandList as U1,CommandItem as j1,FormMessage as D1,Button as Ac,ButtonLoader as Dv,TooltipWrapper as zv,Avatar as z1,AvatarImage as F1,Skeleton as $1,DropdownMenu as vy,DropdownMenuTrigger as yy,DropdownMenuContent as _y,DropdownMenuItem as wy,useIsMobile as B1,Tabs as W1,TabsList as V1,TabsTrigger as h0,TabsContent as g0,HoverCard as H1,HoverCardTrigger as Z1,HoverCardContent as G1,Tooltip as Q1,TooltipTrigger as q1,TooltipContent as Y1}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.396";import{get as Fv,set as Sv,appendErrors as K1,useForm as r0,FormProvider as X1}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as xy,ExternalLinks as J1,AppsLink as bh}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.362";import{usePostApiV1UsersFollowByUsernameMutation as e_,usePostApiV1UsersFollowByUsernameUndoMutation as t_,canFollowBack as n_,isFollowPending as r_,canUnfollow as m0,userSlice as qh,useRelationship as i_,useCurrentUser as Sy,useGetUserByUserName as s_,useGetUserById as o_,usePostApiV1MuteByUserIdMutation as a_,useDeleteApiV1MuteByUserIdMutation as u_,isMuted as l_,usePutApiV1NotesMutation as c_,useDeleteApiV1NotesByUserIdMutation as f_,useGetApiV1UsersFollowersQuery as d_,useGetApiV1UsersByUserIdFollowersQuery as p_,UserAvatar as ky,usePostApiV1UsersFollowByUsernameRejectMutation as h_,canUnsubscribeFromMe as g_}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.449";import{selectSmallestPreview as v0}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.319";import{getErrorMsg as Ag}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.285";import{rootReducer as Ey}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.433";import{platformSettingsSlice as m_,useProfileSettings as v_,UserKeysSettings as y_}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.391";import{wsSlice as __}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.416";const w_=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)},x_=e=>w_(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=>x_(t)&&t.type===e,t};ut("remoteReady"),ut("reselectUser"),ut("requestLogin"),ut("requestLogout"),ut("setConfirmLeavePage"),ut("requestChangePath");const S_=ut("wsSubscribe"),k_=ut("wsUnSubscribe");ut("hostStoreConnect"),ut("remoteLogin"),ut("remoteLogout"),ut("wsOnMessage"),ut("setRouterPath"),ut("setDeviceType");const Cy=ut("setUserError"),Ay=ut("setUserIsError"),$v=ut("setUserPending"),Bv=ut("setUserSuccess"),Ny=ut("setUserData"),E_=ut("updateAccountData"),C_=ut("updateUser"),Ty=ut("addNotification"),Iy=ut("markNotification"),by=ut("setNotificationsError"),Ry=ut("setNotificationsList"),Wv=ut("setNotificationsPending"),Oy=ut("setNotificationsTotalCount"),Vv=ut("setNotificationsUnreadCount"),Ly=ut("resetNotificationsState"),Py=ut("undoNotification");ut("setInstanceInfo"),ut("setInstanceInfoPending"),ut("setInstanceInfoError"),ut("setPlatformSettings"),ut("setProfileSettings"),ut("setGroupData"),ut("setGroupLoading"),ut("showGroupBasicInfo"),fy("requestMicroFrontendFetch"),fy("sendMicroFrontendFetchResponse");const A_=Hf.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t(Wv(!0));try{const e=await rn(n),a=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(Ry({userId:a,list:e.data}))}catch(e){t(by(e))}finally{t(Wv(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await rn(n),t(Iy(e))}catch(e){Rs.error(`Mark notification error', ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await rn(n),t(Vv(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await rn(n),i=!e.status;r&&t(i?Oy(r.data):Vv(r.data))}catch(e){Rs.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:N_,usePostApiV1NotificationsByIdMarkMutation:Mk,usePostApiV1NotificationsMarkAllMutation:Uk,useGetApiV1NotificationsCountQuery:T_}=A_,y0={data:{userId:"",list:[]},count:{},isPending:!1},I_=e=>e,b_=e=>e.error,R_=e=>e.isPending,O_=e=>{var t;return null==(t=e.count)?void 0:t.total},L_=e=>{var t;return null==(t=e.count)?void 0:t.unread},P_=e=>e.data.userId,i0=n0(I_,(e=>e.data.list)),M_=n0(i0,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),U_=n0(i0,(e=>null==e?void 0:e.at(-1))),Ug=Cp({name:"notifications",initialState:y0,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(Wv,((e,t)=>{e.isPending=t.payload})).addCase(by,((e,t)=>{e.error=t.payload})).addCase(Ry,((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(Iy,((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(Vv,((e,t)=>{e.count.unread=t.payload})).addCase(Ly,(()=>y0)).addCase(Py,((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:R_,selectTotalCount:O_,selectUnreadCount:L_,selectNotifications:i0,selectUnreadNotifications:M_,selectLastNotification:U_,selectNotificationsOwner:P_}});var Cc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function My(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _0,w0,kv={exports:{}},_h={};
1
+ import{api as Hf,handleBasicResponse as rn,usePostApiV1BlockByUserIdMutation as k1,useDeleteApiV1BlockByUserIdMutation as E1,usePostApiV1UsersFollowByUsernameAcceptMutation as C1,usePostApiV1UsersFollowByUsernameRejectMutation as A1,useGetApiV1UsersFolloweesQuery as N1,useGetApiV1UsersByUserIdFollowingQuery as T1,useGetApiV1SearchQuery as I1}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.436";import{toast as Rs,ToastContainer as cy}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as fy,createSelector as n0,createSlice as Cp}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import dy,{forwardRef as py,createElement as jv,useState as ss,useEffect as Gf,useRef as Lh,useCallback as xv}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{authSlice as Yf}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.492";import{useSelector as Nn,useDispatch as Zg}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as b1,DialogContent as R1,cn as xt,Form as hy,FormField as gy,FormItem as O1,FormLabel as L1,FormControl as P1,Input as my,Command as M1,CommandList as U1,CommandItem as j1,FormMessage as D1,Button as Ac,ButtonLoader as Dv,TooltipWrapper as zv,Avatar as z1,AvatarImage as F1,Skeleton as $1,DropdownMenu as vy,DropdownMenuTrigger as yy,DropdownMenuContent as _y,DropdownMenuItem as wy,useIsMobile as B1,Tabs as W1,TabsList as V1,TabsTrigger as h0,TabsContent as g0,HoverCard as H1,HoverCardTrigger as Z1,HoverCardContent as G1,Tooltip as Q1,TooltipTrigger as q1,TooltipContent as Y1}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.398";import{get as Fv,set as Sv,appendErrors as K1,useForm as r0,FormProvider as X1}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as xy,ExternalLinks as J1,AppsLink as bh}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.364";import{usePostApiV1UsersFollowByUsernameMutation as e_,usePostApiV1UsersFollowByUsernameUndoMutation as t_,canFollowBack as n_,isFollowPending as r_,canUnfollow as m0,userSlice as qh,useRelationship as i_,useCurrentUser as Sy,useGetUserByUserName as s_,useGetUserById as o_,usePostApiV1MuteByUserIdMutation as a_,useDeleteApiV1MuteByUserIdMutation as u_,isMuted as l_,usePutApiV1NotesMutation as c_,useDeleteApiV1NotesByUserIdMutation as f_,useGetApiV1UsersFollowersQuery as d_,useGetApiV1UsersByUserIdFollowersQuery as p_,UserAvatar as ky,usePostApiV1UsersFollowByUsernameRejectMutation as h_,canUnsubscribeFromMe as g_}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.451";import{selectSmallestPreview as v0}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.321";import{getErrorMsg as Ag}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.287";import{rootReducer as Ey}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.435";import{platformSettingsSlice as m_,useProfileSettings as v_,UserKeysSettings as y_}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.393";import{wsSlice as __}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.418";const w_=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)},x_=e=>w_(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=>x_(t)&&t.type===e,t};ut("remoteReady"),ut("reselectUser"),ut("requestLogin"),ut("requestLogout"),ut("setConfirmLeavePage"),ut("requestChangePath");const S_=ut("wsSubscribe"),k_=ut("wsUnSubscribe");ut("hostStoreConnect"),ut("remoteLogin"),ut("remoteLogout"),ut("wsOnMessage"),ut("setRouterPath"),ut("setDeviceType");const Cy=ut("setUserError"),Ay=ut("setUserIsError"),$v=ut("setUserPending"),Bv=ut("setUserSuccess"),Ny=ut("setUserData"),E_=ut("updateAccountData"),C_=ut("updateUser"),Ty=ut("addNotification"),Iy=ut("markNotification"),by=ut("setNotificationsError"),Ry=ut("setNotificationsList"),Wv=ut("setNotificationsPending"),Oy=ut("setNotificationsTotalCount"),Vv=ut("setNotificationsUnreadCount"),Ly=ut("resetNotificationsState"),Py=ut("undoNotification");ut("setInstanceInfo"),ut("setInstanceInfoPending"),ut("setInstanceInfoError"),ut("setPlatformSettings"),ut("setProfileSettings"),ut("setGroupData"),ut("setGroupLoading"),ut("showGroupBasicInfo"),fy("requestMicroFrontendFetch"),fy("sendMicroFrontendFetchResponse");const A_=Hf.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t(Wv(!0));try{const e=await rn(n),a=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(Ry({userId:a,list:e.data}))}catch(e){t(by(e))}finally{t(Wv(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await rn(n),t(Iy(e))}catch(e){Rs.error(`Mark notification error', ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await rn(n),t(Vv(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await rn(n),i=!e.status;r&&t(i?Oy(r.data):Vv(r.data))}catch(e){Rs.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:N_,usePostApiV1NotificationsByIdMarkMutation:Mk,usePostApiV1NotificationsMarkAllMutation:Uk,useGetApiV1NotificationsCountQuery:T_}=A_,y0={data:{userId:"",list:[]},count:{},isPending:!1},I_=e=>e,b_=e=>e.error,R_=e=>e.isPending,O_=e=>{var t;return null==(t=e.count)?void 0:t.total},L_=e=>{var t;return null==(t=e.count)?void 0:t.unread},P_=e=>e.data.userId,i0=n0(I_,(e=>e.data.list)),M_=n0(i0,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),U_=n0(i0,(e=>null==e?void 0:e.at(-1))),Ug=Cp({name:"notifications",initialState:y0,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(Wv,((e,t)=>{e.isPending=t.payload})).addCase(by,((e,t)=>{e.error=t.payload})).addCase(Ry,((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(Iy,((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(Vv,((e,t)=>{e.count.unread=t.payload})).addCase(Ly,(()=>y0)).addCase(Py,((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:R_,selectTotalCount:O_,selectUnreadCount:L_,selectNotifications:i0,selectUnreadNotifications:M_,selectLastNotification:U_,selectNotificationsOwner:P_}});var Cc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function My(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _0,w0,kv={exports:{}},_h={};
2
2
  /**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.min.js
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "!*.map"
9
9
  ],
10
10
  "module": "index.ts",
11
- "version": "1.0.333",
11
+ "version": "1.0.335",
12
12
  "devDependencies": {
13
13
  "eslint-config": "^1.0.0",
14
14
  "prettier-config": "^1.0.0",