"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8658],{68658:(e,t,o)=>{o.r(t),o.d(t,{Documentation:()=>S,default:()=>D,useStyles:()=>L});var n=o(37876),a=o(14232),i=o(99220),r=o(7645),s=o(12197),l=o(36503),c=o(34415),d=o(39069),u=o(54821),m=o(8733),p=o(20534),h=o(98685),v=o(88700),b=o(38527),f=o(25443),x=o(77660),C=o(77742),N=o(11148),g=o(38582),A=o(46129),j=o(8288),y=o(17685);let _=()=>{let[e,t]=(0,a.useState)(!1),[o,i]=(0,a.useState)(null),{userSession:r}=(0,y.j)(),{setGlobalSnackbarState:s}=(0,g.W)(),l=(0,C.A)();return{downloadCertificatePdf:async e=>{let{certificateContent:o,client:a}=e,{lotnumber:r,owner:c,term:d,type:u,unit:p}=o;try{t(!0);let{errors:e,data:o}=await a.query({query:b.ym,variables:{input:{unit:p,owner:c,term:d,type:u,lotnumber:r}}});if(e||!o||o.error)throw e;(0,f.lK)(o.pdfDownload,d)}catch(e){(u===x.e_.Coa||u===x.e_.Coo)&&i?i(u):s({open:!0,message:l.formatMessage({id:"NO_PRODUCT_DOC_ONLINE",defaultMessage:"In some cases, our product documentation may not be available online. Please {contactUs} to request a copy."},{contactUs:(0,n.jsx)(A.N,{href:N.mA.customerSupport(),children:(0,n.jsx)(m.A,{id:"CONTACT_US_LOWERCASE",defaultMessage:"contact us"})})}),variant:g.m$.Error})}finally{t(!1)}},showCertificatePdf:e=>{let{certificateContent:t,isCOA:o}=e,{brand:n,lotNumber:a,productNumber:i}=t,s=o?N.Or:N.Ce,l=(0,j.xS)(r,s.index(n,i||"",a||""));window.open(l.as,"_blank")},pdfLoading:e,certificateNotFoundModal:o,handlePDFLoading:t,handleCertificateNotFoundModal:i}};var O=o(47801),E=o(71007);let I=(0,i.makeStyles)()(e=>({searchLink:{marginTop:e.spacing(4)},title:{fontWeight:e.typography.fontWeightBold,margin:e.spacing(3,0)}})),T=e=>{let{documentType:t,productNumber:o}=e,{classes:a}=I(),i=f.z$[t].abbrev;return(0,n.jsxs)(r.A,{"data-testid":"documentation-lookup",children:[(0,n.jsx)(s.A,{className:a.title,variant:"body1",children:(0,n.jsx)(m.A,{id:"DONT_SEE_RIGHT_VERSION",defaultMessage:"Don't see the Right Version?"})}),(0,n.jsx)(s.A,{variant:"body2",children:(0,n.jsx)(m.A,{id:"DOCUMENTATION_LOOKUP_DESCRIPTION",defaultMessage:"If you require a particular version, you can look up a specific certificate by the Lot or Batch number."})}),(0,n.jsx)(r.A,{className:a.searchLink,children:(0,n.jsx)(A.N,{href:"/documents-search?tab=".concat(i.toLowerCase()),onClick:()=>{(0,E.sendCommonDetailProductIdEvent)({event:"documentation_interaction",action:"visit ".concat(i.toLowerCase()," search"),detail:"".concat(i.toLowerCase()," tab"),section:"document search",component:"left rail",elementType:"link",elementText:"search for a ".concat(i.toLowerCase()),linkUrl:"/documents-search?tab=".concat(i.toLowerCase()),coreEvent:"no",productId:o}),O.Lr.setItem("pdpProductNumber",o)},children:(0,n.jsx)(m.A,{id:"DOCUMENTATION_LOOKUP_SEARCH_FOR",defaultMessage:"Search for a {docType}",values:{docType:i}})})})]})},k=(0,i.makeStyles)()(e=>({noDocumentationAvailable:{marginBottom:e.spacing(3)}})),w=e=>{let{documentType:t,productNumber:o}=e,a=f.z$[t].abbrev,i=f.z$[t].name,{classes:l}=k();return(0,n.jsxs)(r.A,{"data-testid":"no-documentation-found",children:[(0,n.jsxs)(s.A,{className:l.noDocumentationAvailable,variant:"body2",children:[(0,n.jsx)(m.A,{id:"IT_LOOKS_LIKE_RUN_INTO_PROBLEM",defaultMessage:"It looks like we've run into a problem, but you can still download {docType} from our",values:{docType:i}})," ",(0,n.jsx)(A.N,{href:"/documents-search?tab=".concat(a.toLowerCase()),onClick:()=>O.Lr.setItem("pdpProductNumber",o),children:(0,n.jsx)(m.A,{id:"DOCUMENTS",defaultMessage:"Documents"})})," ",(0,n.jsx)(m.A,{id:"SECTION",defaultMessage:"section."})]}),(0,n.jsxs)(s.A,{variant:"body2",children:[(0,n.jsx)(m.A,{id:"IF_YOU_NEED_ASSISTANCE",defaultMessage:"If you need assistance, please contact"})," ",(0,n.jsx)(A.N,{href:"/support/customer-support",children:(0,n.jsx)(m.A,{id:"CUSTOMER_SUPPORT",defaultMessage:"Customer Support"})})]})]})},L=(0,i.makeStyles)()(e=>({documentItemContainer:{marginBottom:e.spacing(2)},documentLink:{cursor:"pointer"},expandedLayout:{backgroundColor:e.palette.common.white,border:"1px solid ".concat(e.palette.grey[400]),borderRadius:e.shape.borderRadius,[e.breakpoints.up("md")]:{padding:e.spacing(6)},[e.breakpoints.down("lg")]:{border:"0px",padding:e.spacing(0,0,0)}},lotContentContainer:{margin:e.spacing(2,0)},lotNumber:{marginBottom:e.spacing(2)},title:{marginBottom:e.spacing(2)},titleContainer:{display:"block",marginBottom:e.spacing(1),[e.breakpoints.up("sm")]:{display:"flex",alignItems:"center"}}})),S=e=>{var t;let{brand:o,certificateType:i,documentType:b,isCrmProduct:f,isExpandedLayout:x=!0,productNumber:C,title:N}=e,g=(0,a.useRef)(!1),{data:A,loading:j}=(0,h.OM)({variables:{input:{brand:o,documentType:b,productNumber:C}}}),{downloadCertificatePdf:y,pdfLoading:O,showCertificatePdf:I}=_(),{classes:k,cx:S}=L(),D=null==A?void 0:null===(t=A.getCertificateContent)||void 0===t?void 0:t.content,M=b===v.U_.CofAnalysisDoc,U=(e,t)=>{(0,E.sendCertificatesDownloadEvent)({fileExtension:e,productNumber:C,lotNumber:t})},R=(e,t)=>{var n,a,r;(null==t?void 0:null===(n=t.text)||void 0===n?void 0:n.source)==="GDI"?(U("pdf",t.lotNumber),y({certificateContent:{lotnumber:null==t?void 0:t.lotNumber,owner:null==t?void 0:null===(a=t.text)||void 0===a?void 0:a.owner,term:C,type:i,unit:null==t?void 0:null===(r=t.text)||void 0===r?void 0:r.unit},client:e})):t.url?(U("html",t.lotNumber),window.open(t.url,"_blank")):(U("html",t.lotNumber),I({certificateContent:{brand:o,productNumber:C,lotNumber:null==t?void 0:t.lotNumber},isCOA:M}))};return(0,a.useEffect)(()=>{if(!g.current&&j){g.current=!0;return}(0,E.sendDocumentationImpressionEvent)({action:"coa search impression",detail:!f&&(null==D?void 0:D.length)?"coa list download":"coa unavailable",productId:C})},[null==D?void 0:D.length,f,j]),(0,n.jsx)(u.Y,{children:e=>{var t;return(0,n.jsxs)(r.A,{className:S(x&&k.expandedLayout),children:[(0,n.jsx)(s.A,{className:k.title,variant:"h3",children:N}),(0,n.jsx)(l.A,{className:k.lotContentContainer,container:!0,children:(0,n.jsx)(l.A,{item:!0,xs:6,children:(0,n.jsx)(s.A,{variant:"caption",children:(0,n.jsx)(m.A,{id:"DOCUMENTATION_LOT_BATCH_NUMBER",defaultMessage:"Lot/Batch Number"})})})}),!f&&(null==D?void 0:null===(t=D.slice(0,5))||void 0===t?void 0:t.map(t=>(0,n.jsx)(l.A,{className:k.documentItemContainer,container:!0,children:(0,n.jsx)(l.A,{item:!0,xs:6,children:(0,n.jsx)(c.A,{className:k.documentLink,onClick:()=>R(e,t),rel:"nofollow",children:null==t?void 0:t.lotNumber})})},null==t?void 0:t.id))),(null==D?void 0:D.length)&&!f?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.A,{}),(0,n.jsx)(T,{documentType:b,productNumber:C})]}):(0,n.jsx)(w,{documentType:b,productNumber:C}),O&&(0,n.jsx)(p.A,{})]})}})},D=S}}]); //# sourceMappingURL=8658.935a84925a63494b.js.map