PageSourceSearch

https://homesell.co.nz/component---src-pages-admin-change-requests-tsx-471cbd699cc9d89d5a49.js

js homesell.co.nz collected 2026-10-07 15:00:22 UTC 13,875 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"57678cfd3438f70fe30b7709dfa50a42deb83d77"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5710273f-3156-496c-9b29-6cef15f41091",e._sentryDebugIdIdentifier="sentry-dbid-5710273f-3156-496c-9b29-6cef15f41091")}catch(e){}}(),(self.webpackChunkhomesell=self.webpackChunkhomesell||[]).push([[800],{2573:function(e,t,n){"use strict";var a=n(9965),i=n(6918),r=n(6540),o=n(4794),l=n(1504),s=n(3546);t.A=e=>{var t;let{children:n,handle:d,title:c="My Homesell"}=e;const{user:u,logout:f}=(0,s.Pj)(),{0:p,1:m}=(0,r.useState)(!1),h=(0,r.useRef)(null);(0,l.Wr)(h,()=>m(!1));return(0,r.useEffect)(()=>{u||(0,o.navigate)("/")},[u]),r.createElement(i.wn,{isTop:!0},r.createElement(i.Um,null,r.createElement(i.ZT,null,r.createElement(i.mc,{flexFlow:"column nowrap",maxWidth:"60%"},r.createElement(i.mc,{margin:"0 0 20px"},r.createElement("h1",null,c)),r.createElement("h5",null,"Welcome ",null==u?void 0:u.firstName," ",null==u?void 0:u.lastName,". Click on your property below to add more details or buy a package")),r.createElement(i.mc,{style:{gap:"10px"}},r.createElement(a.$n,{theme:"base",internalSlug:"/sell",linkText:null!=u&&null!==(t=u.propertyIds)&&void 0!==t&&t.length?"Add Another Property":"Add Property"}),r.createElement(a.$n,{theme:"baseOutline",onClick:()=>{(0,o.navigate)("/"),f()},linkText:"Logout"})))),r.createElement(i.Ev,{gap:"35px",gridTemplateColumns:"1fr"},r.createElement(i.mc,{flexFlow:"column nowrap"},n)))}},3826:function(e){e.exports=function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(a,i,r){var o=i.prototype;r.utc=function(e){return new i({date:e,utc:!0,args:arguments})},o.utc=function(t){var n=r(this.toDate(),{locale:this.$L,utc:!0});return t?n.add(this.utcOffset(),e):n},o.local=function(){return r(this.toDate(),{locale:this.$L,utc:!1})};var l=o.parse;o.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),l.call(this,e)};var s=o.init;o.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else s.call(this)};var d=o.utcOffset;o.utcOffset=function(a,i){var r=this.$utils().u;if(r(a))return this.$u?0:r(this.$offset)?d.call(this):this.$offset;if("string"==typeof a&&(a=function(e){void 0===e&&(e="");var a=e.match(t);if(!a)return null;var i=(""+a[0]).match(n)||["-",0,0],r=i[0],o=60*+i[1]+ +i[2];return 0===o?0:"+"===r?o:-o}(a),null===a))return this;var o=Math.abs(a)<=16?60*a:a;if(0===o)return this.utc(i);var l=this.clone();if(i)return l.$offset=o,l.$u=!1,l;var s=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(l=this.local().add(o+s,e)).$offset=o,l.$x.$localOffset=s,l};var c=o.format;o.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,t)},o.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},o.isUTC=function(){return!!this.$u},o.toISOString=function(){return this.toDate().toISOString()},o.toString=function(){return this.toDate().toUTCString()};var u=o.toDate;o.toDate=function(e){return"s"===e&&this.$offset?r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():u.call(this)};var f=o.diff;o.diff=function(e,t,n){if(e&&this.$u===e.$u)return f.call(this,e,t,n);var a=this.local(),i=r(e).local();return f.call(a,i,t,n)}}}()},8569:function(e){e.exports=function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(n,a,i){var r,o=function(e,n,a){void 0===a&&(a={});var i=new Date(e),r=function(e,n){void 0===n&&(n={});var a=n.timeZoneName||"short",i=e+"|"+a,r=t[i];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:a}),t[i]=r),r}(n,a);return r.formatToParts(i)},l=function(t,n){for(var a=o(t,n),r=[],l=0;l<a.length;l+=1){var s=a[l],d=s.type,c=s.value,u=e[d];u>=0&&(r[u]=parseInt(c,10))}var f=r[3],p=24===f?0:f,m=r[0]+"-"+r[1]+"-"+r[2]+" "+p+":"+r[4]+":"+r[5]+":000",h=+t;return(i.utc(m).valueOf()-(h-=h%1e3))/6e4},s=a.prototype;s.tz=function(e,t){void 0===e&&(e=r);
1var n,a=this.utcOffset(),o=this.toDate(),l=o.toLocaleString("en-US",{timeZone:e}),s=Math.round((o-new Date(l))/1e3/60),d=15*-Math.round(o.getTimezoneOffset()/15)-s;if(Number(d)){if(n=i(l,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(d,!0),t){var c=n.utcOffset();n=n.add(a-c,"minute")}}else n=this.utcOffset(0,t);return n.$x.$timezone=e,n},s.offsetName=function(e){var t=this.$x.$timezone||i.tz.guess(),n=o(this.valueOf(),t,{timeZoneName:e}).find(function(e){return"timezonename"===e.type.toLowerCase()});return n&&n.value};var d=s.startOf;s.startOf=function(e,t){if(!this.$x||!this.$x.$timezone)return d.call(this,e,t);var n=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return d.call(n,e,t).tz(this.$x.$timezone,!0)},i.tz=function(e,t,n){var a=n&&t,o=n||t||r,s=l(+i(),o);if("string"!=typeof e)return i(e).tz(o);var d=function(e,t,n){var a=e-60*t*1e3,i=l(a,n);if(t===i)return[a,t];var r=l(a-=60*(i-t)*1e3,n);return i===r?[a,i]:[e-60*Math.min(i,r)*1e3,Math.max(i,r)]}(i.utc(e,a).valueOf(),s,o),c=d[0],u=d[1],f=i(c).utcOffset(u);return f.$x.$timezone=o,f},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(e){r=e}}}()},9888:function(e,t,n){"use strict";n.r(t);n(6910);var a=n(4506),i=n(6540),r=n(4794),o=n(9965),l=n(2573),s=n(3546),d=n(6687),c=n(6918),u=n(6258),f=n(7077),p=n(2202),m=n(9072),h=n(4353),g=n.n(h),y=n(3826),v=n.n(y),$=n(8569),x=n.n($),E=n(780);g().extend(v()),g().extend(x());t.default=()=>{const{user:e}=(0,s.Pj)(),{0:t,1:n}=(0,i.useState)("pending"),{0:h,1:y}=(0,i.useState)(!0),{0:v,1:$}=(0,i.useState)([]),{0:x,1:E}=(0,i.useState)([]),{0:_,1:M}=(0,i.useState)({}),{0:N,1:A}=(0,i.useState)(null),{0:z,1:L}=(0,i.useState)(null),Y=null==e?void 0:e.isAdmin;(0,i.useEffect)(()=>{if(!(0,d.Bd)())return;if(e&&!Y)return void(0,r.navigate)("/account");if(!Y)return;(async()=>{y(!0),A(null);try{const e=await(0,d.Wy)(null,"_id, address, notes[] { _key, title, content, date, senderType, senderName, isReadByAdmin, actioned, actionedAt, actionedBy }"),n={};
1(null!=e?e:[]).forEach(e=>{null!=e&&e._id&&(n[e._id]=e)}),M(n);const a=(null!=e?e:[]).map(e=>e._id).filter(Boolean),i=(await Promise.all(a.map(e=>(0,u.SO)(e)))).reduce((e,t)=>e.concat(null!=t?t:[]),[]),r="all"===t?i:i.filter(e=>"pending"===t?!e.actioned:e.actioned);E(r);const o=[];(null!=e?e:[]).forEach(e=>{var n;(null!==(n=e.notes)&&void 0!==n?n:[]).filter(e=>"vendor"===(null==e?void 0:e.senderType)&&("all"===t||"pending"===t&&!e.actioned||"actioned"===t&&e.actioned)).forEach(t=>{var n,a;null!=t&&t._key&&o.push({type:"vendor",propertyId:e._id,propertyAddress:(0,d.zP)(e.address)||"Unknown",noteKey:t._key,title:t.title||"No subject",content:t.content||"",date:t.date||"",displayDate:t.date||"",senderName:"Property Owner",isReadByAdmin:null!==(n=t.isReadByAdmin)&&void 0!==n&&n,actioned:null!==(a=t.actioned)&&void 0!==a&&a})})}),$(o)}catch(e){console.error("Failed to fetch messages:",e)}finally{y(!1)}})()},[Y,t]);const U=[].concat((0,a.A)(v),(0,a.A)(x.map(e=>{var t;return{type:"internal",propertyId:e.propertyId,propertyAddress:(0,d.zP)(null===(t=_[e.propertyId])||void 0===t?void 0:t.address)||"Unknown",messageId:e.id,title:e.title,content:e.content,date:e.date,displayDate:e.dueDate||e.date,senderName:e.senderName,actioned:e.actioned}}))).sort((e,t)=>new Date(t.displayDate).getTime()-new Date(e.displayDate).getTime());return(0,d.Bd)()?e&&!Y?null:i.createElement(l.A,{handle:"change-requests",title:"Messages Log"},i.createElement(c.wn,{isTop:!0},i.createElement(c.Um,null,i.createElement(c.ZT,null,i.createElement(c.mc,{flexFlow:"column nowrap"},i.createElement(c.mc,{margin:"0 0 20px"},i.createElement("h1",null,"Messages Log")),i.createElement("p",null,"Welcome ",null==e?void 0:e.firstName," ",null==e?void 0:e.lastName,". View and action messages from clients and staff.")),i.createElement(c.mc,{style:{gap:"10px"},mobileFlexFlow:"row wrap"},i.createElement(o.$n,{theme:"baseOutline",internalSlug:p.Bd.userOverview,linkText:"User Overview",padding:"10px 20px"}),i.createElement(o.$n,{theme:"baseOutline",internalSlug:p.Bd.adminProperties,linkText:"Admin Properties",padding:"10px 20px"}))),N&&i.createElement(S,null,N),i.createElement(b,null,i.createElement(w,{$active:"pending"===t,onClick:()=>n("pending")},"Pending"),i.createElement(w,{$active:"actioned"===t,onClick:()=>n("actioned")},"Actioned"),i.createElement(w,{$active:"all"===t,onClick:()=>n("all")},"All")),h?i.createElement(c.mc,{padding:"40px 0",justifyContent:"center"},i.createElement("p",null,"Loading messages...")):0===U.length?i.createElement(O,null,i.createElement("p",null,"No messages found for this filter.")):i.createElement(T,null,i.createElement("thead",null,i.createElement("tr",null,i.createElement("th",
1null,"Property"),i.createElement("th",null,"Type"),i.createElement("th",null,"From"),i.createElement("th",null,"Subject"),i.createElement("th",null,"Date"),i.createElement("th",null,"Actions"))),i.createElement("tbody",null,U.map(t=>{var n;return i.createElement("tr",{key:"vendor"===t.type?t.noteKey:t.messageId,onClick:()=>{return e=t.propertyId,n=t.type,void(0,r.navigate)("/account/property?propertyId="+e,{state:{property:_[e],isAdmin:!0,openTab:"internal"===n?10:6}});var e,n}},i.createElement("td",null,i.createElement(k,null,t.propertyAddress)),i.createElement("td",null,i.createElement(C,{$type:t.type},"vendor"===t.type?"Customer":"Staff")),i.createElement("td",null,t.senderName),i.createElement("td",null,i.createElement(D,{title:t.content},t.title||(null===(n=t.content)||void 0===n?void 0:n.slice(0,50))||"—")),i.createElement("td",null,t.displayDate?g().utc(t.displayDate).tz("Pacific/Auckland").format("D MMM YYYY, h:mm a"):"—"),i.createElement("td",{onClick:e=>e.stopPropagation()},"internal"===t.type&&!t.actioned&&i.createElement(o.$n,{theme:"baseOutline",linkText:"Mark actioned",padding:"6px 12px",loading:z==="i-"+t.propertyId+"-"+t.messageId,onClick:()=>(async(t,n)=>{if(!e)return;L("i-"+t+"-"+n);const a=m.oR.loading("Saving...");try{await(0,u.r8)(t,n,e)?(E(e=>e.map(e=>e.id===n?Object.assign({},e,{actioned:!0}):e)),m.oR.update(a,{render:"Marked as actioned",type:"success",isLoading:!1,autoClose:3e3})):m.oR.update(a,{render:"Failed to update",type:"error",isLoading:!1,autoClose:4e3})}catch(i){m.oR.update(a,{render:"Failed to update",type:"error",isLoading:!1,autoClose:4e3})}finally{L(null)}})(t.propertyId,t.messageId)}),"internal"===t.type&&t.actioned&&i.createElement(I,null,"Actioned"),"vendor"===t.type&&!t.actioned&&i.createElement(o.$n,{theme:"baseOutline",linkText:"Mark actioned",padding:"6px 12px",loading:z==="v-"+t.propertyId+"-"+t.noteKey,onClick:()=>(async(e,t)=>{const n=_[e];if(!n)return;L("v-"+e+"-"+t);const a=m.oR.loading("Saving...");try{const i=await(0,f.LC)(t,n);i?(M(t=>Object.assign({},t,{[e]:i})),$(n=>n.map(n=>"vendor"===n.type&&n.propertyId===e&&n.noteKey===t?Object.assign({},n,{actioned:!0}):n)),m.oR.update(a,{render:"Marked as actioned",type:"success",isLoading:!1,autoClose:3e3})):m.oR.dismiss(a)}catch(i){m.oR.dismiss(a)}finally{L(null)}})(t.propertyId,t.noteKey)}),"vendor"===t.type&&t.actioned&&i.createElement(I,null,"Actioned")))})))))):null};const b=E.default.div.withConfig({displayName:"change-requests__FilterTabs",componentId:"sc-18dnps8-0"})(["display:flex;gap:8px;margin-bottom:24px;border-bottom:1px solid #e9ecef;padding-bottom:12px;"]),w=E.default.button.withConfig({displayName:"change-requests__FilterTab",componentId:"sc-18dnps8-1"})(["padding:10px 16px;border:1px solid ",";border-radius:6px;background:",";color:",";font-size:0.9rem;font-weight:500;cursor:pointer;&:hover{border-color:",";background:",";color:",";}"],e=>e.$active?p.Tj.main:"#dee2e6",e=>e.$active?p.Tj.main:"white",e=>e.$active?"white":"#495057",p.Tj.main,e=>e.$active?p.Tj.main:"#f8f9fa",e=>e.$active?"white":p.Tj.main),T=E.default.table.withConfig({displayName:"change-requests__MessagesTable",componentId:"sc-18dnps8-2"})(["width:100%;border-collapse:collapse;font-size:14px;th,td{padding:12px 16px;text-align:left;border-bottom:1px solid #e9ecef;}th{font-weight:600;color:#495057;background:#f8f9fa;}tbody tr{cursor:pointer;&:hover{background:#f8f9fa;}}"]),k=E.default.span.withConfig({displayName:"change-requests__PropertyLink",componentId:"sc-18dnps8-3"})(["color:",";font-weight:500;"],p.Tj.main),C=E.default.span.withConfig({displayName:"change-requests__TypeBadge",componentId:"sc-18dnps8-4"})(["display:inline-block;padding:4px 8px;border-radius:4px;font-size:12px;font-weight:500;background:",";color:",";"],e=>"vendor"===e.$type?"#fff8e1":"#f3e8ff",e=>"vendor"===e.$type?"#b45309":"#7c3aed"),D=E.default.span.withConfig({displayName:"change-requests__SubjectCell",componentId:"sc-18dnps8-5"})(["max-width:200px;display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]),I=E.default.span.withConfig({displayName:"change-requests__ActionedLabel",componentId:"sc-18dn
1ps8-6"})(["font-size:12px;color:#6b7280;font-style:italic;"]),O=E.default.div.withConfig({displayName:"change-requests__EmptyState",componentId:"sc-18dnps8-7"})(["padding:40px 20px;text-align:center;color:#6b7280;"]),S=E.default.div.withConfig({displayName:"change-requests__InternalErrorBanner",componentId:"sc-18dnps8-8"})(["padding:12px 16px;margin-bottom:20px;background:#fef2f2;border:1px solid #fecaca;border-radius:6px;color:#991b1b;font-size:14px;"])}}]);

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.