PageSourceSearch

https://www.computer.org/_next/static/chunks/5835-d54cd969b9a04e8d.js

js computer.org collected 2026-10-01 06:29:47 UTC 8,155 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5835],{5191:function(e,t,l){l.d(t,{Z:function(){return x}});var r=l(7437),i=l(6648),s=l(7138),a=l(8103),n=l(5232),o=l(2265),c=l(5228),d=l(3463),u=l(998),m=l(4031);let h=e=>{var t,l,r;let{data:i}=(0,u.useSession)();if(!i||!i.user||!i.user.csAuthorizationCMSMetadata||!i.user.csAuthorizationCMSMetadata.cmsRole||!e||!e.membership)return{remainingFreeArticles:0};let s=i.user.csAuthorizationCMSMetadata.cmsRole;if("member"!==(0,m.Gc)(s))return{remainingFreeArticles:0};let a=e.membership,n=a.year,o=null===(t=a.benefits)||void 0===t?void 0:t.free;return a&&o&&n?{remainingFreeArticles:(null!==(l=o.limit)&&void 0!==l?l:0)-(null!==(r=o.article[n])&&void 0!==r?r:0)}:{remainingFreeArticles:0}};var v=l(1296),f=l(7866),p=l(8328),x=e=>{var t,l;let{additionalOptions:u,session:x,setBusy:g}=e,{cart:y,setCart:j}=(0,a.j)()(),[b,N]=(0,o.useState)(null),{remainingFreeArticles:w}=h(b),{logError:I}=(0,f.j)();(0,o.useEffect)(()=>{var e;(null==x?void 0:null===(e=x.user)||void 0===e?void 0:e.email)&&P()},[null==x?void 0:null===(t=x.user)||void 0===t?void 0:t.email]);let P=async()=>{try{var e,t;let l=null!==(t=null==x?void 0:null===(e=x.user)||void 0===e?void 0:e.email)&&void 0!==t?t:null,r=l?await (0,v.O)(l):null;N(r)}catch(e){I("Error in OrderItems.tsx in catch block of the handleGetCSAuthorizationRecord function",e)}};(0,o.useEffect)(()=>{var e;x&&y.userId===(null===(e=x.user)||void 0===e?void 0:e.email)&&k()},[x,y.userId]);let k=async()=>{try{var e,t,l,r;if(!(null==x?void 0:null===(t=x.user)||void 0===t?void 0:null===(e=t.csAuthorizationCMSMetadata)||void 0===e?void 0:e.wpUserId)||!(null==x?void 0:null===(l=x.user)||void 0===l?void 0:l.email)||y.userId!==(null==x?void 0:null===(r=x.user)||void 0===r?void 0:r.email))return;let i=(0,m.g9)(y.cartItems);if(!i||0===i.length)return;let s=!!y.couponCode;s&&(null==g||g(!0));try{let e=await (0,c._7)(i,y.couponCode||"",x.user.csAuthorizationCMSMetadata.wpUserId,x.user.email),t={...y,cartItems:e.cartItems,totalPrice:e.summary.totalPrice,totalDiscountPrice:e.summary.totalDiscountPrice};if(!(0,p.J)(t,y))try{await j({...t,version:Date.now()})}catch(e){I("Failed to update cart with actual items",e)}}finally{s&&(null==g||g(!1))}}catch(e){I("Error in OrderItems.tsx in catch block of the handleGetProducts function",e)}},S=async e=>{var t,l;if(!(null==x?void 0:null===(t=x.user)||void 0===t?void 0:t.email)||!(null===(l=x.user.csAuthorizationCMSMetadata)||void 0===l?void 0:l.wpUserId))return;let r={...y,cartItems:[...y.cartItems]},i=Number(e.currentTarget.id);r.cartItems.splice(i,1);let s=(0,m.g9)(r.cartItems),a=await (0,c._7)(s,r.couponCode||"",x.user.csAuthorizationCMSMetadata.wpUserId,x.user.email),n={...r,cartItems:a.cartItems,totalPrice:a.summary.totalPrice,totalDiscountPrice:a.summary.totalDiscountPrice};if(!(0,p.J)(n,y))try{await j({...n,version:Date.now()})}catch(e){I("Failed to remove item from cart",e)}},A=e=>{var t,l,i,s;return"csdl-article"!==e.productType||w<0?null:(0,r.jsxs)("p",{className:"style-p-sm",children:[null==b?void 0:null===(t=b.membership)||void 0===t?void 0:t.year," Member Benefit – Remaining complimentary articles: ",w," of"," ",null==b?void 0:null===(s=b.membership)||void 0===s?void 0:null===(i=s.benefits)||void 0===i?void 0:null===(l=i.free)||void 0===l?void 0:l.limit]})},C=e=>{var t;let l=null===(t=e.productType)||void 0===t?void 0:t.startsWith("acm-article");if(!u||!e.url||l)return(0,d.ZP)(e.title);let i=(0,d.ZP)(e.title),a=A(e);return(0,n.IC)(e.url,"www.computer.org")?(0,r.jsxs)("div",{children:[(0,r.jsx)(s.default,{href:e.url,className:"style-p font-medium hover:underline hover:text-site-link",prefetch:!0,children:i}),a]}):(0,r.jsxs)("div",{children:[(0,r.jsx)("a",{href:e.url,className:"style-p font-medium hover:underline hover:text-site-link",target:"_blank",children:i}),a]})};return(0,r.jsxs)("section",{"aria-labelledby":"cart-heading",children:[(0,r.jsx)("h2",{id:"cart-heading",className:"sr-only",children:"Items in your shopping cart"}),(0,r.jsx)("ul",{role:"list",className:"divide-y divide-light-grey",children:(null==x?void 0:null===(l=x.user)||void 0===l?void 0:l.email)===y.userId&&y.cartItems&&0!==y.cartItems.length?y.cartItems&&y.cartItems.map((e,t)=>("csdl-article"===e.productType&&w--,(0,r.jsxs)("li",{className:"flex py-6",children:[e.imageUrl&&(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)(i.default,{src:(0,n.Ub)("https://main-cdn.computer.org",e.imageUrl),alt:"",height:50,width:50,className:"rounded-lg",blurDataURL:(0,n.N1)("blue"),placeholder:"blur",loading:"eager"})}),(0,r.jsxs)("div",{className:"ml-4 flex flex-1 flex-col sm:ml-6",children:[(0,r.jsx)("div",{children:(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("div",{children:u&&e.url?C(e):(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-semibold text-slate-700",children:(0,d.ZP)(e.title)}),A(e)]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"ml-4 style-p-sm font-normal text-right",children:["$",Number(e.discountPrice).toFixed(2)]}),Number(e.price)!==Number(e.discountPrice)&&(0,r.jsxs)("p",{className:"ml-4 style-p-sm font-normal text-dark-grey text-right",children:["-$",(Number(e.price)-Number(e.discountPrice)).toFixed(2)," ","discount"]})]})]})}),(0,r.jsxs)("div",{className:"mt-4 flex flex-1 items-end justify-between",children:[(0,r.jsxs)("div",{className:"flex md:gap-4 md:items-center flex-col md:flex-row",children:[e.accessType&&(0,r.jsxs)("p",{className:"text-sm font-normal text-slate-700",children:["Access Type:"," ",(0,r.jsx)("span",{className:"font-medium",children:(0,n.hH)(e.accessType)})]}),e.productType&&(0,r.jsxs)("p",{className:"text-sm font-normal text-slate-700",children:["Product Type:"," ",(0,r.jsx)("span",{className:"font-medium",children:(0,n.$h)(e.productType)})]})]}),u&&(0,r.jsx)("div",{className:"ml-4",children:(0,r.jsx)("button",{className:"style-p-sm not-prose text-site-link font-normal hover:underline",onClick:S,id:t.toString(),children:(0,r.jsx)("span",{children:"Remove"})})})]})]})]},e.contentId?e.contentId:e.variationId))):(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4 my-8",role:"listitem",children:[(0,r.jsx)("h2",{className:"style-h2 font-normal",children:"Your Cart Is Empty"}),(0,r.jsx)(s.default,{href:"/education/courses",className:"block border border-light-grey p-4 rounded-lg group hover:shadow text-center",prefetch:!0,children:(0,r.jsxs)("p",{children:["Advance your knowledge."," ",(0,r.jsx)("span",{className:"not-prose text-site-link font-normal group-hover:underline",children:"Explore education courses →"})]})})]})})]})}},7864:function(e,t,l){l.d(t,{default:function(){return d}});var r=l(7437),i=l(2265),s=l(998),a=l(6463),n=l(1749),o=l(7953),c=l(7866);function d(){let{status:e}
1=(0,s.useSession)(),t=(0,a.useSearchParams)(),l=(0,a.useRouter)(),[d,u]=(0,i.useState)(!1),[m,h]=(0,i.useState)(!1),{logError:v,logWarn:f}=(0,c.j)(),p=t.get("globallogin"),x=t.get("error");return((0,i.useEffect)(()=>{if(!d&&!x&&("y"===p&&"unauthenticated"===e&&(async()=>{try{let e=new URL(window.location.href);e.searchParams.delete("globallogin"),await (0,s.signIn)("keycloak",{callbackUrl:e.toString(),prompt:"none",redirect:!0})}catch(e){v("Silent login failed:",e),h(!0)}finally{u(!0)}})(),"y"===p&&"authenticated"===e)){let e=new URL(window.location.href);e.searchParams.delete("globallogin"),l.replace(e.toString())}},[e,p,d,x,l]),(0,i.useEffect)(()=>{let t;return"loading"===e&&(t=setTimeout(()=>{f("Auth loading state timeout reached for silent login"),h(!0)},2e4)),()=>clearTimeout(t)},[e]),(0,i.useEffect)(()=>{x&&(f("Auth error encountered in silent login: ".concat(x)),h(!0))},[x]),"loading"!==e||m)?"unauthenticated"===e||m?(0,r.jsx)(n.default,{label:"Please sign in to view your cart"}):null:(0,r.jsx)(o.Z,{})}},7953:function(e,t,l){var r=l(7437);l(2265),t.Z=()=>(0,r.jsx)("div",{className:"w-full container-content",children:(0,r.jsx)("div",{className:"h-screen mt-4 md:mt-0 bg-light-grey rounded-lg animate-pulse"})})},1296:function(e,t,l){l.d(t,{O:function(){return r}}),l(4590);var r=(0,l(8064).$)("029cddb892b10a35671a78c526c6e02026f8a8cd")}}]);

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.