PageSourceSearch

https://www.hbs.edu/_next/static/chunks/pages/admin/poc/alumni/giving-688eafdbdeb7a207.js

js hbs.edu collected 2026-10-01 08:03:03 UTC 8,264 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4244],{9725:(e,r,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/poc/alumni/giving",function(){return t(92272)}])},37242:(e,r,t)=>{"use strict";t.r(r),t.d(r,{WhoAmiI:()=>d,default:()=>c});var n=t(6029),s=t(55729),o=t(65104),i=t(82203),a=t.n(i),l=t(53668);function c(){return(0,n.jsxs)("div",{children:[(0,n.jsx)(d,{redirect:"/admin/poc/alumni/profile"}),(0,n.jsx)(u,{})]})}function u(){let[e,r]=(0,s.useState)();async function t(){let e=await fetch("/api/internal/alumni/profile/me");e.ok?r({data:await e.json()}):r({error:"Failed to fetch alumni profile data"})}return((0,s.useEffect)(()=>{t().catch(e=>{console.error("Error fetching data:",e)})},[]),e)?(0,n.jsx)("div",{children:(0,n.jsx)("pre",{children:JSON.stringify(e,null,2)})}):(0,n.jsx)("div",{children:"Loading..."})}function d(e){var r,t,s,i;let{data:c}=(0,o.s)({url:"/api/auth/session"});if(!c)return(0,n.jsx)("div",{children:"Loading..."});let u=l.z.object({user:l.z.object({displayName:l.z.string()})}).safeParse(c);if(!u.success)return console.error("Validation error:",u.error),(0,n.jsx)("div",{children:"Error validating session data"});let d=(null==(t=(r={resolvedUrl:e.redirect}).ctx)?void 0:t.request.headers["x-cas-auth"])==="legacy"?{loginUrl:"/api/auth/cas/login?redirect=".concat(encodeURIComponent(r.resolvedUrl)),logoutUrl:"/api/auth/cas/logout?redirect=".concat(encodeURIComponent(r.resolvedUrl))}:(null==(s=r.ctx)?void 0:s.request.domain)==="alumni"||(null==(i=r.ctx)?void 0:i.request.domain)==="my"?{loginUrl:"/api/auth/casOauth/login?redirect=".concat(encodeURIComponent(r.resolvedUrl)),logoutUrl:"/api/auth/cas/logout?redirect=".concat(encodeURIComponent(r.resolvedUrl))}:{loginUrl:"/api/auth/cas/login?redirect=".concat(encodeURIComponent(r.resolvedUrl)),logoutUrl:"/api/auth/cas/logout?redirect=".concat(encodeURIComponent(r.resolvedUrl))};return(0,n.jsx)("div",{children:(0,n.jsxs)("h3",{children:[u.data.user.displayName," ",c.user.loggedIn&&(0,n.jsx)(a(),{href:d.logoutUrl,children:"Logout"}),!c.user.loggedIn&&(0,n.jsx)(a(),{href:d.loginUrl,children:"Login"})]})})}},49572:(e,r,t)=>{"use strict";t.d(r,{e8:()=>s,rW:()=>n});let n="environment",s={DEFAULT:"GTM-N2NWNWX",ONLINE:"GTM-MW34RML",EXED:"GTM-TLS4CQL",MY:"GTM-WNLL79Z"}},65104:(e,r,t)=>{"use strict";t.d(r,{G:()=>i,s:()=>a});var n=t(49572),s=t(33681);class o extends Error{constructor(...e){super(...e),this.status=500,this.info={}}}async function i(e){let{url:r,method:t,params:s,headers:i,body:a}=e,l=new URLSearchParams,c=!1;if(s&&Object.entries(s).forEach(e=>{let[r,t]=e;t&&(l.set(r,t),c=!0)}),r.startsWith("/")){let e=new URL(location.href).searchParams.get(n.rW);e&&l.set("environment",e)}c&&(r+="?"+l.toString());let u=await fetch(r,{method:t,headers:i,body:a}),d=u.headers.get("content-type")||"",h=/\bjson\b/i.test(d),f=await u.text(),g=h||""===d&&/^[\s\r\n]*[{[]/.test(f),p=(()=>{if(!f)return null;if(!g)return f;try{return JSON.parse(f)}catch(e){return f}})();if(!u.ok){let e=new o("An error occurred while fetching the data.");throw e.info={status:u.status,statusText:u.statusText,contentType:d,body:p,bodyParseFailed:g&&"string"==typeof p,url:u.url},e.status=u.status,e}if(204===u.status||null===p||""===p)return null;if(!g||"string"==typeof p){let e=new o("Expected JSON but got non-JSON response.");throw e.status=u.status,e.info={status:u.status,statusText:u.statusText,contentType:d,body:p,bodyParseFailed:g&&"string"==typeof p,url:u.url},e}return p}function a(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{enabled:t=!0}=r;return(0,s.Ay)(t?e:null,i,{revalidateOnMount:!0,refreshInterval:0,refreshWhenHidden:!1,refreshWhenOffline:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,revalidateOnFocus:!1,errorRetryCount:3,errorRetryInterval:1e3,keepPreviousData:!0,onSuccess:(e,r)=>{console.info("useFetch success",{key:r,data:e})},onErrorRetry:(r,t,n,s,o)=>{let{retryCount:i}=o;console.info("useFetch error",{key:t,error:r,props:e,retryCount:i}),404!==r.status&&(i>=3||setTimeout(()=>{console.info("useFetch retry",{key:t,props:e,retryCount:i}),s({retryCount:i})},5e3))}})}},81278:(e,r,t)=>{e.exports=t(77006)},92272:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>u});var n=t(6029),s=t(55729),o=t(37242),i=t(53668),a=t(82203),l=t.n(a),c=t(81278);function u(){return(0,n.jsxs)("div",{style:{padding:"20px"},children:[(0,n.jsx)(o.WhoAmiI,{redirect:"/admin/poc/alumni/giving"}),(0,n.jsx)(g,{})]})}let d=[{name:"ERDonorReportYear",field:"ERDonorReportYear"},{name:"HBSDataSource",field:"HBSDataSource"},{name:"ERDonorReportCategory",field:"ERDonorReportCategory"},{name:"ERDonorClass",field:"ERDonorClass"}],h=i.z.object({doc_count_error_upper_bound:i.z.number(),sum_other_doc_count:i.z.number(),buckets:i.z.array(i.z.object({key:i.z.union([i.z.string(),i.z.number()]),doc_count:i.z.number()}))}),f=i.z.object({hits:i.z.object({hits:i.z.array(i.z.object({_id:i.z.string(),_source:i.z.record(i.z.string(),i.z.unknown())}))}),aggregations:i.z.record(i.z.string(),i.z.unknown())});
1function g(){let[e,r]=(0,s.useState)(),t=(0,c.useRouter)();async function o(e,n){let s=[{terms:{ERDonorIsPublished:"unpublished"===t.query.view?[!0,!1]:[!0]}}];for(let r of d)e[r.field]&&s.push({term:{[r.field]:String(e[r.field])}});let o={};d.forEach(e=>{o[e.name]={terms:{field:e.field,min_doc_count:1,size:1e3}}});let i={query:{bool:{filter:s}},sort:[{ERDonorDisplaySortOrder:{order:"asc"}}],aggs:o,size:e.size?parseInt(e.size,10):200};try{let e=await fetch("/api/internal/search/ERDonorReportV1/_search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:n});if(e.ok){let t=await e.json(),n=f.safeParse(t);if(!n.success)return void console.error("Validation error:",n.error);r(n.data)}}catch(e){console.warn("Fetch aborted")}}return(0,s.useEffect)(()=>{let e=new AbortController;return o(t.query,e.signal),()=>{e.abort()}},[t.query]),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{children:"Giving POC"}),"View:",(0,n.jsxs)("select",{onChange:e=>{let r=new URLSearchParams(t.query);r.set("view",e.target.value),t.push("?".concat(r.toString()))},children:[(0,n.jsx)("option",{value:"published",children:"Published"}),(0,n.jsx)("option",{value:"unpublished",children:"Unpublished"})]}),"Max Results:",(0,n.jsxs)("select",{onChange:e=>{let r=new URLSearchParams(t.query);r.set("size",e.target.value),t.push("?".concat(r.toString()))},children:[(0,n.jsx)("option",{value:"200",children:"200"}),(0,n.jsx)("option",{value:"500",children:"500"}),(0,n.jsx)("option",{value:"1000",children:"1000"})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,n.jsx)("div",{style:{flex:1},children:d.map(r=>(0,n.jsx)(m,{name:r.name,field:r.field,results:e,queryParams:t.query},r.name))}),(0,n.jsxs)("div",{style:{flex:5},children:[(0,n.jsxs)("h3",{children:["Results (",null==e?void 0:e.hits.hits.length,")"]}),(0,n.jsx)(p,{queryParams:t.query}),null==e?void 0:e.hits.hits.map(e=>(0,n.jsx)("pre",{children:JSON.stringify(e._source,null,2)},e._id)),(null==e?void 0:e.hits.hits.length)===0&&(0,n.jsx)("li",{children:"No results found"})]})]}),(0,n.jsx)("br",{}),(0,n.jsx)("hr",{})]})}function p(e){let{queryParams:r}=e,t=(0,c.useRouter)(),s=new URLSearchParams(r),o=[];return d.forEach(e=>{s.has(e.field)&&o.push((0,n.jsx)("span",{children:(0,n.jsxs)("button",{onClick:()=>{s.delete(e.field),t.push("?".concat(s.toString()))},children:[e.name,": ",s.get(e.field)," ✕"]})},e.field))}),(0,n.jsx)("div",{children:o})}function m(e){if(!e.results)return(0,n.jsx)("div",{children:"Loading..."});let r=e.results.aggregations;if(!r||!r[e.name])return(0,n.jsxs)("div",{children:["No data for ",e.name]});let t=r[e.name],s=h.safeParse(t);if(!s.success)return(0,n.jsxs)("div",{children:["Error parsing facet data for ",e.name]});let o=s.data;return(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{children:e.name}),(0,n.jsx)("ul",{children:o.buckets.map(r=>{let t=new URLSearchParams(e.queryParams);return t.set(e.field,String(r.key)),(0,n.jsxs)("li",{children:[(0,n.jsx)(l(),{href:"?".concat(t.toString()),children:String(r.key)}),":"," ",r.doc_count]},String(r.key))})})]})}}},e=>{e.O(0,[3681,3668,2203,636,6593,8792],()=>e(e.s=9725)),_N_E=e.O()}]);
2//# sourceMappingURL=giving-688eafdbdeb7a207.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.