PageSourceSearch

https://www.madpaws.com.au/marketplace/_next/static/chunks/pages/inbox-8cbf1150cc85254a.js

js madpaws.com.au collected 2026-09-24 18:11:25 UTC 7,194 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2648],{73102:function(n,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/inbox",function(){return t(6814)}])},23072:function(n,e,t){"use strict";t.d(e,{v:function(){return c}});var o=t(85893),r=t(51664),i=t(67294),a=t(52402),s=t.n(a),c=function(n){var e=n.children,t=n.hasMore,a=n.isLoadingMore,c=n.loadMore,u=n.threshold,d=void 0===u?100:u,l=n.loader;return(0,i.useEffect)(function(){if(t){var n=function(){window.innerHeight+window.scrollY>=document.documentElement.offsetHeight-d&&!a&&c()};return window.addEventListener("scroll",n),function(){return window.removeEventListener("scroll",n)}}},[t,a,c,d]),(0,o.jsxs)(o.Fragment,{children:[e,a&&(0,o.jsx)("div",{className:s().spinnerContainer,children:null!=l?l:(0,o.jsx)(r.AXE,{size:"large2x"})})]})}},6814:function(n,e,t){"use strict";t.r(e),t.d(e,{__N_SSP:function(){return A},default:function(){return Z}});var o=t(26042),r=t(10253),i=t(36305),a=t(85893),s=t(51664),c=t(67294),u=t(23072),d=t(86809),l=t.n(d),f=t(64687),v=function(n){var e,t=(0,c.useRef)(),o=(0,r.Z)((0,c.useState)(!1),2),i=o[0],a=o[1],s=null!==(e="https://api.madpaws.com.au/api".replace("/api",""))&&void 0!==e?e:"",u=(0,f.tO)().authorization,d=function(n){n.emit("authenticate",{token:u})},v=function(e){var t,o=null===(t=(0,f.zM)(u))||void 0===t?void 0:t.sub;if(!o){console.warn("[Socket] No profile ID found. Cannot join channel.");return}e.emit("join",{channel:o});var r="channel.".concat(o);e.off(r),e.on(r,n)},h=function(){a(!0)},g=function(){a(!1)},m=function(){console.error("[Socket] Socket error occurred."),a(!1)},p=function(){console.error("[Socket] Unauthorized:")};return(0,c.useEffect)(function(){var n=l()(s,{path:"/chat_ws",autoConnect:!0,reconnectionAttempts:5,reconnectionDelay:1e3});return t.current=n,n.on("welcome",function(){return d(n)}),n.on("authenticated",function(){return v(n)}),n.on("connect_error",m),n.on("disconnect",g),n.on("connect",h),n.on("unauthorized",p),function(){n.disconnect()}},[]),{socket:t.current,isConnected:i}},h=t(54324),g=t(14924),m=t(99534),p=t(94184),_=t.n(p),x=t(11163),j=t(2096),w=t(9351),C=t(69771),y=t.n(C),S=t(27484),b=t.n(S),k=function(n){var e=b()(),t=b().unix(n),o=e.startOf("day"),r=t.startOf("day"),i=o.diff(r,"day");return 0===i?t.format("h:mm A"):1===i?"Yesterday":t.format("MMM D, YYYY")},I=function(n){var e={},t=[],o=!0,r=!1,i=void 0;try{for(var a,s=n[Symbol.iterator]();!(o=(a=s.next()).done);o=!0){var c=a.value;e[c.id]=c,t.push(c.id)}}catch(n){r=!0,i=n}finally{try{o||null==s.return||s.return()}finally{if(r)throw i}}return{byId:e,idKeys:t}},M=function(n){return n.split("<br>")[0]},N=function(n){var e,t,o,r=n.conversation,i=(0,x.useRouter)(),c=(0,s.Vmp)(),u=r.newMessages,d=r.id,l=(0,m.Z)(r,["newMessages","id"]),f=l.lastMessage.data,v=l.lastBooking.data,h=l.collocutor.data,p=k(l.updatedAt),C="structured"===f.type?"MadPaws: ".concat(M(null!==(t=f.structured.data.body.data[0].value)&&void 0!==t?t:"")):M(null!==(o=f.body)&&void 0!==o?o:""),S=function(n,e){n.stopPropagation();var t=(0,w.k4)(j.VT,{petId:e.toString()});window.open(t,"_blank")},b=_()(y().conversation,(0,g.Z)({},y().conversationUnread,u));return(0,a.jsxs)("div",{className:b,onClick:function(){i.push((0,w.k4)(j.rK,{conversationId:d.toString()}))},children:[(0,a.jsx)(s.qEK,{alt:h.firstName,size:"large",src:h.avatar}),(0,a.jsxs)("div",{className:y().conversationContent,children:[(0,a.jsxs)("div",{className:y().conversationSection1,children:[(0,a.jsx)(s.uTp,{children:h.name}),(0,a.jsx)(s.uTp,{children:p})]}),(0,a.jsxs)("div",{className:y().conversationSection2,children:[(0,a.jsx)(s.uTp,{children:(e=c?80:40,"string"!=typeof C?"":C.length>e?C.substring(0,e)+"...":C)}),u&&(0,a.jsx)("div",{className:y().unreadIndicator})]}),(0,a.jsxs)("div",{children:["Pets:",v.pets.data.map(function(n,e){return(0,a.jsxs)(a.Fragment,{children:[0===e?" ":", ",(0,a.jsx)(s.ZPD,{onClick:function(e){return S(e,n.id)},children:n.name},n.id)]})})]})]})]},d)},E=t(69060),P=t.n(E),Z=function(n){var e=n.conversations,t=n.userDetails,d=n.pagination,l=n.archivedCount,f=(0,c.useMemo)(function(){return I(e)},[e]),g=(0,c.useRef)(!1),m=(0,r.Z)((0,c.useState)(!1),2),p=m[0],_=m[1],x=(0,r.Z)((0,c.useState)(!1),2),j=x[0],w=x[1],C=(0,r.Z)((0,c.useState)(d.currentPage),2),y=C[0],S=C[1],b=(0,r.Z)((0,c.useState)(d.totalPages),2),k=b[0],M=b[1],E=(0,r.Z)((0,c.useState)(!1),2),Z=E[0],A=E[1],K=(0,r.Z)((0,c.useState)(f),2),T=K[0],z=K[1],O=(0,s.Vmp)(),D=(0,s.E1C)(),L=(0,c.useCallback)(function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];1===n?w(e):A(!0),h.W.getUserConversations(20,p,n).then(function(e){var t=e.data,r=e.meta,a=I(t);1===n?z(a):z(function(n){return{byId:(0,o.Z)({},n.byId,a.byId),idKeys:(0,i.Z)(n.idKeys).concat((0,i.Z)(a.idKeys))}}),S(r.pagination.currentPage),M(r.pagination.totalPages)}).catch(function(){}).finally(function(){w(!1),A(!1)})},[p]);v(function(){L(1,!1)}),(0,c.useEffect)(function(){if(g.current){L(1);return}},[p,L]);var U=(0,c.useCallback)(function(n){var e=T.byId[n];return(0,a.jsx)(N,{conversation:e},n)},[T]),V=(0,c.useMemo)(function(){return 0!==T.idKeys.length||j?j?(0,a.jsx)("div",{className:P().spinnerContainer,children:(0,a.jsx)(s.AXE,{size:"large2x"})}):T.idKeys.map(U):(0,a.jsx)(s.uTp,{children:"No messages to show."})},[T,j,U]),X=(0,c.useCallback)(function(){L(y+1,!1)},[y,L]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.uoO,{children:(0,a.jsxs)(s.Of5,{children:[(0,a.jsx)(s._Vj,{placement:{small:[1,13],medium:[1,7],large:[1,7]},children:(0,a.jsx)(s.X6q,{fontFamily:"heading",size:D?"large1x":O?"medium":"small1x",children:"Messages"})}),(0,a.jsx)(s._Vj,{placement:{small:[1,8],medium:[10,13],large:[10,13]},children:(0,a.jsx)("div",{className:P().toggleGroupContainer,children:(0,a.jsx)(s.tXp,{isLegendVisuallyHidden:!0,legend:"Show archived",name:"showArchived",onChange:function(n){var e=n.target;if(g.current=!0,e.value.length>0){_(!0);return}_(!1)},options:[{label:"Show archived (".concat(l,")"),value:"showArchived"}],value:p?["showArchived"]:[]})})})]})}),t.isSitter&&t.hasTooManyPendingBooking&&(0,a.jsx)(s.uoO,{children:(0,a.jsx)(s.jL0,{description:"Too many pen
1ding bookings could mean not showing up in owners searches.",title:"Approve or decline pending bookings",type:"warning"})}),(0,a.jsx)(u.v,{hasMore:y<k,isLoadingMore:Z,loadMore:X,children:V})]})},A=!0},69771:function(n){n.exports={conversation:"ConversationItem_conversation__Qgus8",conversationContent:"ConversationItem_conversationContent__P_gMv",conversationSection1:"ConversationItem_conversationSection1__4bMjk",conversationSection2:"ConversationItem_conversationSection2__Clbmj",unreadIndicator:"ConversationItem_unreadIndicator__k6age",conversationUnread:"ConversationItem_conversationUnread__kgD9Z"}},69060:function(n){n.exports={toggleGroupContainer:"Inbox_toggleGroupContainer__RGHyK",spinnerContainer:"Inbox_spinnerContainer__N3Su6"}},52402:function(n){n.exports={spinnerContainer:"InfiniteScroll_spinnerContainer___PcUf"}},77020:function(){}},function(n){n.O(0,[6809,9774,2888,179],function(){return n(n.s=73102)}),_N_E=n.O()}]);
2//# sourceMappingURL=inbox-8cbf1150cc85254a.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.