@wellesley/notifications 1.0.491 → 1.0.493

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 Yf,handleBasicResponse as rn,usePostApiV1BlockByUserIdMutation as L1,useDeleteApiV1BlockByUserIdMutation as M1,usePostApiV1UsersFollowByUsernameAcceptMutation as U1,usePostApiV1UsersFollowByUsernameRejectMutation as j1,useGetApiV1UsersFolloweesQuery as D1,useGetApiV1UsersByUserIdFollowingQuery as z1,useGetApiV1SearchQuery as F1}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.592";import{toast as os,ToastContainer as my}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as vy,createSelector as i0,createSlice as Np}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import yy,{forwardRef as _y,createElement as zv,useState as vi,useEffect as Fa,useRef as qu,useCallback as Ev}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{authSlice as ed}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.648";import{useSelector as Nn,useDispatch as Qg}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as $1,DialogContent as B1,cn as mt,Form as wy,FormField as xy,FormItem as W1,FormLabel as V1,FormControl as H1,Input as Sy,Command as Z1,CommandList as G1,CommandItem as Q1,FormMessage as q1,Button as Rc,ButtonLoader as Fv,TooltipWrapper as $v,Avatar as Y1,AvatarImage as K1,Skeleton as J1,DropdownMenu as ky,DropdownMenuTrigger as Ey,DropdownMenuContent as Cy,DropdownMenuItem as Ay,useIsMobile as X1,Tabs as e_,TabsList as t_,TabsTrigger as y0,TabsContent as _0,HoverCard as n_,HoverCardTrigger as r_,HoverCardContent as i_,Tooltip as s_,TooltipTrigger as o_,TooltipContent as a_}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.554";import{get as Bv,set as Cv,appendErrors as u_,useForm as s0,FormProvider as l_}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as c_,ExternalLinks as f_,AppsLink as Ph}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.520";import{usePostApiV1UsersFollowByUsernameMutation as d_,usePostApiV1UsersFollowByUsernameUndoMutation as p_,canFollowBack as h_,isFollowPending as g_,canUnfollow as w0,userSlice as Kh,useRelationship as m_,useCurrentUser as Ny,useGetUserByUserName as v_,useGetUserById as y_,usePostApiV1MuteByUserIdMutation as __,useDeleteApiV1MuteByUserIdMutation as w_,isMuted as x_,usePutApiV1NotesMutation as S_,useDeleteApiV1NotesByUserIdMutation as k_,useGetApiV1UsersFollowersQuery as E_,useGetApiV1UsersByUserIdFollowersQuery as C_,UserAvatar as Ty,usePostApiV1UsersFollowByUsernameRejectMutation as A_,canUnsubscribeFromMe as N_}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.607";import{getErrorMsg as _p}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.443";import{getStore as T_,rootReducer as Iy}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.591";import{selectSmallestPreview as x0}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.477";import{useProfileSettings as by,platformSettingsSlice as I_,UserKeysSettings as b_}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.549";import{wsSlice as R_}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.574";const O_=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)},P_=e=>O_(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=>P_(t)&&t.type===e,t};ct("remoteReady");const L_=ct("askLogin");ct("reselectUser"),ct("requestLogout"),ct("setConfirmLeavePage"),ct("requestChangePath");const M_=ct("wsSubscribe"),U_=ct("wsUnSubscribe");ct("hostStoreConnect"),ct("remoteLogin"),ct("remoteLogout"),ct("wsOnMessage"),ct("setRouterPath"),ct("setDeviceType");const Ry=ct("setUserError"),Oy=ct("setUserIsError"),Wv=ct("setUserPending"),Vv=ct("setUserSuccess"),Py=ct("setUserData"),j_=ct("updateAccountData"),D_=ct("updateUser"),Ly=ct("addNotification"),My=ct("markNotification"),Uy=ct("setNotificationsError"),jy=ct("setNotificationsList"),Hv=ct("setNotificationsPending"),Dy=ct("setNotificationsTotalCount"),Zv=ct("setNotificationsUnreadCount"),zy=ct("resetNotificationsState"),Fy=ct("undoNotification");ct("setInstanceInfo"),ct("setInstanceInfoPending"),ct("setInstanceInfoError"),ct("setPlatformSettings"),ct("setProfileSettings"),ct("setGroupData"),ct("setGroupLoading"),vy("requestMicroFrontendFetch"),vy("sendMicroFrontendFetchResponse");const z_=Yf.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(jy({userId:a,list:e.data}))}catch(e){t(Uy(e))}finally{t(Hv(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await rn(n),t(My(e))}catch(e){os.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?Dy(r.data):Zv(r.data))}catch(e){os.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:F_,usePostApiV1NotificationsByIdMarkMutation:nE,usePostApiV1NotificationsMarkAllMutation:rE,useGetApiV1NotificationsCountQuery:$_}=z_,S0={data:{userId:"",list:[]},count:{},isPending:!1},B_=e=>e,W_=e=>e.error,V_=e=>e.isPending,H_=e=>{var t;return null==(t=e.count)?void 0:t.total},Z_=e=>{var t;return null==(t=e.count)?void 0:t.unread},G_=e=>e.data.userId,o0=i0(B_,(e=>e.data.list)),Q_=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(Uy,((e,t)=>{e.error=t.payload})).addCase(jy,((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(Ly,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(My,((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(Dy,((e,t)=>{e.count.total=t.payload})).addCase(Zv,((e,t)=>{e.count.unread=t.payload})).addCase(zy,(()=>S0)).addCase(Fy,((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:W_,selectIsPending:V_,selectTotalCount:H_,selectUnreadCount:Z_,selectNotifications:o0,selectUnreadNotifications:Q_,selectLastNotification:q_,selectNotificationsOwner:G_}});var bc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $y(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k0,E0,Av={exports:{}},xh={};
1
+ import{api as Yf,handleBasicResponse as rn,usePostApiV1BlockByUserIdMutation as L1,useDeleteApiV1BlockByUserIdMutation as M1,usePostApiV1UsersFollowByUsernameAcceptMutation as U1,usePostApiV1UsersFollowByUsernameRejectMutation as j1,useGetApiV1UsersFolloweesQuery as D1,useGetApiV1UsersByUserIdFollowingQuery as z1,useGetApiV1SearchQuery as F1}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.594";import{toast as os,ToastContainer as my}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as vy,createSelector as i0,createSlice as Np}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import yy,{forwardRef as _y,createElement as zv,useState as vi,useEffect as Fa,useRef as qu,useCallback as Ev}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{authSlice as ed}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.650";import{useSelector as Nn,useDispatch as Qg}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as $1,DialogContent as B1,cn as mt,Form as wy,FormField as xy,FormItem as W1,FormLabel as V1,FormControl as H1,Input as Sy,Command as Z1,CommandList as G1,CommandItem as Q1,FormMessage as q1,Button as Rc,ButtonLoader as Fv,TooltipWrapper as $v,Avatar as Y1,AvatarImage as K1,Skeleton as J1,DropdownMenu as ky,DropdownMenuTrigger as Ey,DropdownMenuContent as Cy,DropdownMenuItem as Ay,useIsMobile as X1,Tabs as e_,TabsList as t_,TabsTrigger as y0,TabsContent as _0,HoverCard as n_,HoverCardTrigger as r_,HoverCardContent as i_,Tooltip as s_,TooltipTrigger as o_,TooltipContent as a_}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.556";import{get as Bv,set as Cv,appendErrors as u_,useForm as s0,FormProvider as l_}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as c_,ExternalLinks as f_,AppsLink as Ph}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.522";import{usePostApiV1UsersFollowByUsernameMutation as d_,usePostApiV1UsersFollowByUsernameUndoMutation as p_,canFollowBack as h_,isFollowPending as g_,canUnfollow as w0,userSlice as Kh,useRelationship as m_,useCurrentUser as Ny,useGetUserByUserName as v_,useGetUserById as y_,usePostApiV1MuteByUserIdMutation as __,useDeleteApiV1MuteByUserIdMutation as w_,isMuted as x_,usePutApiV1NotesMutation as S_,useDeleteApiV1NotesByUserIdMutation as k_,useGetApiV1UsersFollowersQuery as E_,useGetApiV1UsersByUserIdFollowersQuery as C_,UserAvatar as Ty,usePostApiV1UsersFollowByUsernameRejectMutation as A_,canUnsubscribeFromMe as N_}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.609";import{getErrorMsg as _p}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.445";import{getStore as T_,rootReducer as Iy}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.593";import{selectSmallestPreview as x0}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.479";import{useProfileSettings as by,platformSettingsSlice as I_,UserKeysSettings as b_}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.551";import{wsSlice as R_}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.576";const O_=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)},P_=e=>O_(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=>P_(t)&&t.type===e,t};ct("remoteReady");const L_=ct("askLogin");ct("reselectUser"),ct("requestLogout"),ct("setConfirmLeavePage"),ct("requestChangePath");const M_=ct("wsSubscribe"),U_=ct("wsUnSubscribe");ct("hostStoreConnect"),ct("remoteLogin"),ct("remoteLogout"),ct("wsOnMessage"),ct("setRouterPath"),ct("setDeviceType");const Ry=ct("setUserError"),Oy=ct("setUserIsError"),Wv=ct("setUserPending"),Vv=ct("setUserSuccess"),Py=ct("setUserData"),j_=ct("updateAccountData"),D_=ct("updateUser"),Ly=ct("addNotification"),My=ct("markNotification"),Uy=ct("setNotificationsError"),jy=ct("setNotificationsList"),Hv=ct("setNotificationsPending"),Dy=ct("setNotificationsTotalCount"),Zv=ct("setNotificationsUnreadCount"),zy=ct("resetNotificationsState"),Fy=ct("undoNotification");ct("setInstanceInfo"),ct("setInstanceInfoPending"),ct("setInstanceInfoError"),ct("setPlatformSettings"),ct("setProfileSettings"),ct("setGroupData"),ct("setGroupLoading"),vy("requestMicroFrontendFetch"),vy("sendMicroFrontendFetchResponse");const z_=Yf.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(jy({userId:a,list:e.data}))}catch(e){t(Uy(e))}finally{t(Hv(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await rn(n),t(My(e))}catch(e){os.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?Dy(r.data):Zv(r.data))}catch(e){os.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:F_,usePostApiV1NotificationsByIdMarkMutation:nE,usePostApiV1NotificationsMarkAllMutation:rE,useGetApiV1NotificationsCountQuery:$_}=z_,S0={data:{userId:"",list:[]},count:{},isPending:!1},B_=e=>e,W_=e=>e.error,V_=e=>e.isPending,H_=e=>{var t;return null==(t=e.count)?void 0:t.total},Z_=e=>{var t;return null==(t=e.count)?void 0:t.unread},G_=e=>e.data.userId,o0=i0(B_,(e=>e.data.list)),Q_=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(Uy,((e,t)=>{e.error=t.payload})).addCase(jy,((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(Ly,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(My,((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(Dy,((e,t)=>{e.count.total=t.payload})).addCase(Zv,((e,t)=>{e.count.unread=t.payload})).addCase(zy,(()=>S0)).addCase(Fy,((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:W_,selectIsPending:V_,selectTotalCount:H_,selectUnreadCount:Z_,selectNotifications:o0,selectUnreadNotifications:Q_,selectLastNotification:q_,selectNotificationsOwner:G_}});var bc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $y(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
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "!*.map"
9
9
  ],
10
10
  "module": "index.ts",
11
- "version": "1.0.491",
11
+ "version": "1.0.493",
12
12
  "devDependencies": {
13
13
  "eslint-config": "^1.0.0",
14
14
  "prettier-config": "^1.0.0",