1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9450],{79450:function(e,t,o){o.r(t);var a=o(85893),r=o(67294),n=o(14416),l=o(34357),s=o(56490),c=o(33610),d=o(7056),i=o(71143),u=o(54866),p=o(66416),I=o(9669),g=o.n(I),C=o(39332),h=o(11163);let T=(0,u.ZP)("nav",{name:"TopBar",slot:"NavBar"})(e=>{let{theme:t}=e;return{width:"100%",margin:"0 auto",padding:"0 ".concat(t.spacing(5)),paddingRight:t.spacing(.75),height:t.spacing(16),backgroundColor:"yellow",border:"1px solid yellow",borderTop:0,boxShadow:"0px 2px 10px 2px rgba(0, 0, 0, 0.1)",display:"flex",justifyContent:"center",alignItems:"center",flexWrap:"wrap",position:"fixed",top:0,right:0,left:0,zIndex:1030,color:"black"}}),m=(0,u.ZP)("button",{name:"TopBar",slot:"Button"})(e=>{let{theme:t}=e;return{background:t.palette.background.light.primary,color:t.palette.color.black,borderColor:t.palette.color.black,display:"inline-block",margin:t.spacing(1.25),fontWeight:400,textAlign:"center",whiteSpace:"nowrap",verticalAlign:"middle",userSelect:"none",border:"1px solid transparent",padding:"".concat(t.spacing(1.5)," ").concat(t.spacing(3)),fontSize:16,lineHeight:1.25,borderRadius:4,transition:"color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",cursor:"pointer"}}),k=(0,u.ZP)(m,{name:"TopBar",slot:"BtnWarning"})({backgroundColor:"#e0a800",borderColor:"#e0a800"}),f=(0,u.ZP)(m,{name:"TopBar",slot:"BtnDanger"})({backgroundColor:"#dc3545",borderColor:"#dc3545",color:"white"}),S=(null===l.default||void 0===l.default?void 0:l.default.transactionHost)||"",W={getCart:"/wcs/resources/store/{storeId}/cart/@self?forUserId={customerId}",takeOver:"/wcs/resources/store/{storeId}/cart/{orderId}/lockOnBehalf?takeOverLock=Y",lockCart:"/wcs/resources/store/{storeId}/cart/{orderId}/lockOnBehalf?forUserId={customerId}",unlockCart:"/wcs/resources/store/{storeId}/cart/{orderId}/unlockOnBehalf?forUserId={customerId}",unlockBehalf:"/wcs/resources/store/{storeId}/cart/{orderId}/unlockOnBehalf"};t.default=()=>{let[e,t]=(0,r.useState)("false"),[o,l]=(0,r.useState)(null),[u,I]=(0,r.useState)(!1),[b,y]=(0,r.useState)("false"),[j,x]=(0,r.useState)(!1),[z,B]=(0,r.useState)(!1),[w,D]=(0,r.useState)(!1),O=(0,h.useRouter)(),P=(0,n.useDispatch)(),[v]=(0,r.useState)(null),U=(0,C.useSearchParams)().toString(),{get:N,set:E}=i.sessionStorageUtil,{locale:A,isLocaleDomain:R}=(0,h.useRouter)(),{langCode:G}=(0,d.d)(),J=()=>{let e=S+W.getCart.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{customerId}",localStorage.getItem("customerId")||""),t=JSON.parse(N(c.St,!1));null!=t&&g()({url:e,method:"GET",headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}}).then(e=>{"true"===e.data.locked?(localStorage.getItem("callerId")===e.data.orderEditor.uniqueID?(x(!1),B(!0),D(!1)):(B(!1),x(!1),D(!0)),P((0,s.DB)(!0))):(x(!0),B(!1),D(!1),P((0,s.DB)(!1)))}).catch(()=>{x(!1),B(!1),D(!1)})},L=()=>{let e=S+W.getCart.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{customerId}",localStorage.getItem("customerId")||""),t=JSON.parse(N(c.St,!1));null!=t&&g()({url:e,method:"GET",headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}}).then(e=>{let o=e.data.orderId,a=S+W.takeOver.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{orderId}",o);g()({url:a,method:"POST",data:{},headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}}).then(()=>{J()}).catch(()=>{J()})}).catch(()=>{J()})},_=()=>{let e=S+W.getCart.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{customerId}",localStorage.getItem("customerId")||""),t=JSON.parse(N(c.St,!1));null!=t&&g()({url:e,method:"GET",headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}}).then(e=>{let o=e.data.buyerId,a=e.data.orderId,r=S+W.lockCart.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{orderId}",a).replace("{customerId}",o);g()({url:r,method:"POST",data:{},headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}}).then(()=>{x(!1),B(!0),P((0,s.DB)(!0))}).catch(()=>{J()})}).catch(()=>{J()})},H=()=>{let e=S+W.getCart.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{customerId}",localStorage.getItem("customerId")||""),t=JSON.parse(N(c.St,!1));null!=t&&g()({url:e,method:"GET",headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}}).then(e=>{let o=e.data.buyerId,a=e.data.orderId,r=S+W.unlockCart.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{orderId}",a).replace("{customerId}",o);g()({url:r,method:"POST",data:{},headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}}).then(()=>{x(!0),B(!1),P((0,s.DB)(!1))}).catch(()=>{J()})}).catch(()=>{J()})},Z=async()=>
1{if(u)return;I(!0),y("false"),l(null),t("false"),P((0,s.dy)(!1)),P((0,s.DB)(!1)),localStorage.clear(),sessionStorage.clear();let e=(0,p._)("/",A);window.location.href=e},q=async()=>{let e=S+W.getCart.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{customerId}",localStorage.getItem("customerId")||""),t=JSON.parse(N(c.St,!1));if(null!=t)try{let o=await g()({url:e,method:"GET",headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}}),a=o.data.orderId,r=o.data.locked;if("true"===r&&localStorage.getItem("callerId")===o.data.orderEditor.uniqueID){let e=S+W.unlockBehalf.replace("{storeId}",localStorage.getItem("storeId")||"").replace("{orderId}",a);await g()({url:e,method:"POST",data:{},headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:t.personalizationID,WCToken:t.WCToken,WCTrustedToken:t.WCTrustedToken}})}}catch(e){console.error("An error occurred while restoring user:",e)}Z()};return(0,r.useEffect)(()=>{u||(t(localStorage.getItem("beHalfTrue")||"false"),y("false"),l(localStorage.getItem(c.m$)))},[O.pathname,O.query,u]),(0,r.useEffect)(()=>{if(u)return;let o=new URLSearchParams(U);if(o.get("onBehalfSession")||"true"===e?(y("true"),document.getElementsByTagName("main")[0].style.marginTop="32px",document.getElementsByTagName("header")[0].style.marginTop="32px"):y("false"),"true"===b&&"false"===e){localStorage.setItem("beHalfTrue","true"),t("true"),localStorage.setItem("personalizationID",o.get("personalizationID")),localStorage.setItem("storeId",o.get("storeId")),localStorage.setItem("callerId",o.get("userId")),localStorage.setItem("customerId",o.get("forUserId"));let e=S+"/wcs/resources/store/"+o.get("storeId")+"/person/@self?forUserId="+o.get("forUserId")+"&storeId="+o.get("storeId");g()({url:e,method:"GET",headers:{"Cache-Control":"no-cache",Accept:"application/json","Content-Type":"application/json; charset=utf-8",WCPersonalization:o.get("personalizationID"),WCToken:encodeURIComponent(o.get("WCToken")),WCTrustedToken:encodeURIComponent(o.get("WCTrustedToken"))}}).then(e=>{let t={WCToken:encodeURIComponent(o.get("WCToken")),WCTrustedToken:encodeURIComponent(o.get("WCTrustedToken")),details:e.data,forUserId:o.get("forUserId"),logonId:o.get("agentLogonId"),personalizationID:o.get("personalizationID"),resourceName:"loginidentity",userId:o.get("userId"),userLoggedIn:!0};E(c.St,JSON.stringify(t),!1),localStorage.setItem(c.m$,e.data.email1),l(e.data.email1)}).catch(e=>{console.error("An error occurred while setting the session storage key:",e)}),localStorage.reload||(setTimeout("document.location.reload()",2e3),localStorage.reload=1)}"true"===b&&(P((0,s.dy)(!0)),J())},[b,U,e,o,u,P]),(0,a.jsx)(a.Fragment,{children:"true"===b&&(0,a.jsxs)(T,{children:[(0,a.jsxs)("span",{className:"navbar-text",children:["On behalf of: ",localStorage.getItem(c.m$)]}),(0,a.jsx)("span",{className:"navbar-text text-center",id:"adviseCstUserText",children:localStorage.getItem("adviseCstUserText")}),(0,a.jsxs)("form",{children:[(0,a.jsx)(m,{type:"button",className:"btn btn-primary",onClick:()=>q(),children:"Exit CST On Behalf"}),j&&(0,a.jsxs)(f,{id:"lockCartBtn",type:"button",onClick:()=>_(),children:["Lock Cart"," "]}),z&&(0,a.jsxs)(k,{id:"unlockCartBtn",type:"button",onClick:()=>H(),children:["Unlock Cart"," "]}),w&&(0,a.jsx)(k,{id:"takeOverCartBtn",type:"button",onClick:()=>L(),children:"Take Over"})]}),v&&(0,a.jsx)("div",{className:"navbar-error",children:v})]})})}}}]);
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.