1import{_ as ae}from"./DC3cM5Vq.js";import{_ as de,a as ce}from"./5RpKT0ZH.js";import{_ as ue}from"./k-d7lhOR.js";import{o as s,c as l,a as o,_ as q,t as d,b as u,F as p,r as E,d as me,s as ye,w as pe,e as R,f as fe,g as ge,h as v,u as n,i as k,j as N,k as ve,v as he,l as S,m as T,n as be,p as x}from"./F-yQZwJP.js";import we from"./CjhV4eFG.js";import xe from"./Do6h_9er.js";import{u as Ce}from"./C2FEb-wl.js";import{u as Z}from"./BKrCukVI.js";import{u as Pe}from"./CIFRG60p.js";import"./Cnb_PvIO.js";import"./QE_PDQD6.js";import"./DI-UXohB.js";import"./Dem4TqUn.js";import"./C-viTMMQ.js";import"./BlmXHXDx.js";import"./DmhoRejw.js";import"./CXBUnWkI.js";import"./48JnzDp5.js";function _e(e,i){return s(),l("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[o("path",{"fill-rule":"evenodd",d:"M9 4.5a.75.75 0 0 1 .721.544l.813 2.846a3.75 3.75 0 0 0 2.576 2.576l2.846.813a.75.75 0 0 1 0 1.442l-2.846.813a3.75 3.75 0 0 0-2.576 2.576l-.813 2.846a.75.75 0 0 1-1.442 0l-.813-2.846a3.75 3.75 0 0 0-2.576-2.576l-2.846-.813a.75.75 0 0 1 0-1.442l2.846-.813A3.75 3.75 0 0 0 7.466 7.89l.813-2.846A.75.75 0 0 1 9 4.5ZM18 1.5a.75.75 0 0 1 .728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 0 1 0 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 0 1-1.456 0l-.258-1.
1036a2.625 2.625 0 0 0-1.91-1.91l-1.036-.258a.75.75 0 0 1 0-1.456l1.036-.258a2.625 2.625 0 0 0 1.91-1.91l.258-1.036A.75.75 0 0 1 18 1.5ZM16.5 15a.75.75 0 0 1 .712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 0 1 0 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 0 1-1.422 0l-.395-1.183a1.5 1.5 0 0 0-.948-.948l-1.183-.395a.75.75 0 0 1 0-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0 1 16.5 15Z","clip-rule":"evenodd"})])}const ke={class:"space-y-4"},Se={key:0},Ae={key:1},De={key:2},Ie={class:"block"},Ne={key:0,class:"block"},Ee={key:3},Be={class:"flex gap-8"},$e={key:0},Le={key:1},Ue={key:4},Fe={class:"block"},Re={key:0,class:"block"},Te={key:5},Oe={__name:"PolicyDetailCard",props:{namedInsured:{type:String,default:""},mailingAddress:{type:Array,default:()=>[]},primaryCoverage:{type:Object,default:null},additionalCoverages:{type:Array,default:()=>[]},policyType:{type:String,default:""},effectiveDate:{type:String,default:""},expirationDate:{type:String,default:""},category:{type:String,default:""}},setup(e){return(i,t)=>(s(),l("dl",ke,[e.namedInsured?(s(),l("div",Se,[t[0]||(t[0]=o("dt",null,"Primary named insured",-1)),o("dd",null,d(e.namedInsured),1)])):u("",!0),e.mailingAddress.length?(s(),l("div",Ae,[t[1]||(t[1]=o("dt",null,"Mailing address",-1)),o("dd",null,[(s(!0),l(p,null,E(e.mailingAddress,a=>(s(),l("span",{key:a,class:"block"},d(a),1))),128))])])):u("",!0),e.primaryCoverage?(s(),l("div",De,[t[2]||(t[2]=o("dt",null,"Coverage",-1)),o("dd",null,[o("span",Ie,d(e.primaryCoverage.name),1),e.primaryCoverage.limits?(s(),l("span",Ne,d(e.primaryCoverage.limits),1)):u("",!0)])])):u("",!0),e.policyType?(s(),l("div",Ee,[t[3]||(t[3]=o("dt",null,"Policy type",-1)),o("dd",null,d(e.policyType),1)])):u("",!0),o("div",Be,[e.effectiveDate?(s(),l("div",$e,[t[4]||(t[4]=o("dt",null,"Effective",-1)),o("dd",null,d(e.effectiveDate),1)])):u("",!0),e.expirationDate?(s(),l("div",Le,[t[5]||(t[5]=o("dt",null,"Expires",-1)),o("dd",null,d(e.expirationDate),1)])):u("",!0)]),e.additionalCoverages.length?(s(),l("div",Ue,[t[6]||(t[6]=o("dt",null,"Additional coverage",-1)),o("dd",null,[(s(!0),l(p,null,E(e.additionalCoverages,a=>(s(),l(p,{key:a.name},[o("span",Fe,d(a.name),1),a.limits?(s(),l("span",Re,d(a.limits),1)):u("",!0)],64))),128))])])):u("",!0),e.category?(s(),l("div",Te,[t[7]||(t[7]=o("dt",null,"Category",-1)),o("dd",null,d(e.category),1)])):u("",!0)]))}},Ve=q(Oe,[["__scopeId","data-v-4f2931f3"]]),{petrieTheFlyer:O}=Ce(),V="active",z=()=>({certificateHolder:"",mailingAddress:{street1:"",street2:"",city:"",state:"",zipcode:""}}),ze=(e,i)=>{const t=e?.policyStatus===V,a=i?.policyStatus===V;return t!==a?t?-1:1:new Date(i?.effectiveDate)-new Date(e?.effectiveDate)},Me=e=>e?.indemnityPerEvent||e?.indemnityInAggregate||e?.indemnityPerItem||"",M=e=>typeof e!="string"||e.trim()===""?"":e.split(".").pop().replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/^./,i=>i.toUpperCase()),He=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),H=e=>{if(e==null||String(e).trim()==="")return"";const i=Number(e);return Number.isFinite(i)?He.format(i):String(e)},je=me("COIStore",{state:()=>({selectedPolicy:"",form:z(),detailsByPolicyNumber:{},detailsLoading:!1,detailsError:null,downloading:!1,downloadError:null}),getters:{policies(){return Z().coiEligiblePolicies},hasSinglePolicy(){return this.policies.length===1},selectedPolicyDetails(){return this.policies.find(e=>e.policyNumber===this.selectedPolicy)||null},selectedPolicyBody(){return this.detailsByPolicyNumber[this.selectedPolicy]?.body||null},namedInsured(){const e=this.selectedPolicyBody?.namedInsured?.[0],i=e?.primaryInsuredName||this.selectedPolicyDetails?.primaryInsuredName||"",t=e?.doingBusinessAs||this.selectedPolicyDetails?.doingBusinessAs;return t?`${i} dba ${t}`:i},mailingAddress(){const e=this.selectedPolicyBody;if(!e)return[];const i=e.namedInsured?.[0],t=e.mailingAddress||{street1:i?.primaryAddressStreet1,street2:i?.primaryAddressStreet2,city:i?.primaryAddressCity,state:i?.primaryAddressState,zipcode:i?.primaryAddressZip},a=typeof t.state=="string"?t.state.replace(/^US-/,""):t.state,h=[t.city,[a,t.zipcode].filter(
1Boolean).join(" ")].filter(Boolean).join(", ");return[t.street1,t.street2,h].filter(Boolean)},primaryCoverage(){const e=this.selectedPolicyBody?.coverages?.[0];return e?{name:M(e.name)||this.selectedPolicyDetails?.productDisplay||"",limits:[e.indemnityPerEvent,e.indemnityInAggregate].filter(Boolean).map(H).join(" / ")}:null},additionalCoverages(){return(this.selectedPolicyBody?.coverages||[]).slice(1).filter(e=>e?.name).map(e=>({name:M(e.name),limits:H(Me(e))}))},category(){const e=this.selectedPolicyBody?.businessLocation?.[0];return e?._categoryDisplay||e?.category||""}},actions:{async fetchSelectedPolicyDetails(){const e=this.selectedPolicyDetails;if(!(!e?.SORLocator||!e?.productName)&&!this.detailsByPolicyNumber[e.policyNumber]){this.detailsLoading=!0,this.detailsError=null;try{const i=await O(`/v1/policy/${encodeURIComponent(e.SORLocator)}?brokerName=${encodeURIComponent(e.productName)}&deep=true`,{method:"GET"},null);this.detailsByPolicyNumber[e.policyNumber]=i.data.value}catch(i){this.detailsError=i}finally{this.detailsLoading=!1}}},async download(){const e=this.selectedPolicyDetails;
1if(!e?.policyNumber||!e?.productKey){this.downloadError=new Error("No policy selected");return}this.downloading=!0,this.downloadError=null;const i=window.open("","_blank");i&&(i.opener=null);try{const{certificateHolder:t,mailingAddress:a}=this.form,f=(await O(`/v1/broker/coi?policyNumber=${encodeURIComponent(e.policyNumber)}&productKey=${encodeURIComponent(e.productKey)}`,{method:"POST"},{certificateHolder:t,mailingAddress:{street1:a.street1,street2:a.street2,city:a.city,state:a.state,zip:a.zipcode}})).data.value?.downloadURL;if(!f)throw new Error("No download URL returned");i?i.location.href=f:window.open(f,"_blank","noopener"),this.resetForm()}catch(t){i&&i.close(),this.downloadError=t}finally{this.downloading=!1}},selectPolicy(e){this.selectedPolicy=e},resetForm(){this.form=z()},setSelectedPolicyOnLoad(){const[e]=[...this.policies].sort(ze);this.selectedPolicy=e?.policyNumber||""}}}),qe={class:"space-y-6 pb-6"},Ze={class:"form-group"},Ge={class:"text-lg"},Ke=["value"],We={class:"p-6 bg-white border rounded border-lighter-gray"},Ye={key:0,class:"flex items-center justify-center py-10"},Xe={key:3,class:"flex items-center justify-center py-10"},Je={class:"w-full px-6 py-4 border rounded mb-4 bg-[#fdf8f0] border-lighter-gray"},Qe={class:"flex items-center gap-2 mb-1 text-xl"},j=140,et="Occurrence",tt={__name:"coi",async setup(e){let i,t;Pe({title:"Certificate of Insurance"});const a=Z(),h=je(),{download:f,fetchSelectedPolicyDetails:B,resetForm:$,setSelectedPolicyOnLoad:G}=h,{additionalCoverages:K,category:W,detailsError:Y,detailsLoading:X,downloadError:L,downloading:J,form:A,mailingAddress:Q,namedInsured:ee,policies:D,primaryCoverage:te,hasSinglePolicy:oe,selectedPolicy:C,selectedPolicyDetails:U}=ye(h),b=T(!1),P=T({});a.policies?.length||([i,t]=pe(()=>a.getPolicyData()),await i,t());const I=be({get:()=>!!L.value,set:m=>{m||(L.value=null)}}),F=m=>m.policyNumber,ie=({certificateHolder:m,mailingAddress:r})=>{const y={},w=m?.trim(),g=r||{},_=g.zipcode?.trim();return w?w.length>j&&(y.certificateHolder=`Certificate holder must be ${j} characters or fewer`):y.certificateHolder="Certificate holder is required",g.street1?.trim()||(y.street1="Street address is required"),g.city?.trim()||(y.city="City is required"),g.state||(y.state="State is required"),_?/^\d{5}$/.test(_)||(y.zipcode="This is not a valid zip code"):y.zipcode="Zip code is required",y},re=m=>{P.value=ie(m),!(Object.keys(P.value).length>0)&&f()};return R(C,()=>{B()}),R(b,m=>{m||(P.value={},$())}),fe(async()=>{G(),await B()}),ge(()=>{$()}),(m,r)=>{const y=ae,w=de,g=ue,_=Ve,se=we,le=ce,ne=xe;return s(),l("div",qe,[v(y),r[12]||(r[12]=o("h1",{class:"mb-4 text-5xl font-bold mt-10 text-dark-navy text-wrap-pretty"}," Certificate of insurance ",-1)),r[13]||(r[13]=o("p",{class:"text-2xl mb-8 text-wrap-pretty"}," Get your certificate of insurance with one click. ",-1)),n(D).length?(s(),l(p,{key:1},[o("div",Ze,[n(oe)?(s(),l(p,{key:0},[r[5]||(r[5]=o("p",{class:"font-semibold"}," Available policies ",-1)),o("p",Ge,d(F(n(D)[0])),1)],64)):(s(),l(p,{key:1},[r[6]||(r[6]=o("label",{for:"policy-select"},"Available policies",-1)),ve(o("select",{id:"policy-select","onUpdate:modelValue":r[0]||(r[0]=c=>S(C)?C.value=c:null),name:"policy-select",class:"outline-slate-400 focus:outline-brand-blue"},[(s(!0),l(p,null,E(n(D),c=>(s(),l("option",{key:c.policyNumber,value:c.policyNumber},d(F(c)),9,Ke))),128))],512),[[he,n(C)]])],64))]),o("div",We,[n(X)?(s(),l("div",Ye,[v(g)])):n(Y)?(s(),k(w,{key:1,type:"error"},{default:N(()=>[...r[7]||(r[7]=[x(" We could not load the details for this policy. Please refresh the page and try again. ",-1)])]),_:1})):(s(),k(_,{key:2,"named-insured":n(ee),"mailing-address":n(Q),"primary-coverage":n(te),"additional-coverages":n(K),"policy-type":et,"effective-date":n(U)?.effectiveDate,"expiration-date":n(U)?.expirationDate,category:n(W)},null,8,["named-insured","mailing-address","primary-coverage","additional-coverages","effective-date","expiration-date","category"])),r[9]||(r[9]=o("hr",{class:"my-5 border-lighter-gray"},null,-1)),n(J)?(s(),l("div",Xe,[v(g)])):(s(),l(p,{key:4},[v(se,{modelValue:n(A),"onUpdate:modelValue":r[1]||(r[1]=c=>S(A)?A.value=c:null),expanded:n(b),"onUpdate:expanded":r[2]||(r[2]=c=>S(b)?b.value=c:null),errors:n(P),onSubmit:re},null,8,["modelValue","expanded","errors"]),n(b)?u("",!0):(s(),k(le,{key:0,class:"mt-6",color:"primary",onClick:n(f)},{default:N(()=>[...r[8]||(r[8]=[x(" download certificate ",-1)])]),_:1}
1,8,["onClick"]))],64))])],64)):(s(),k(w,{key:0,type:"error"},{default:N(()=>[...r[4]||(r[4]=[x(" We could not find a policy eligible for a certificate of insurance. If you think this is a mistake, email ",-1),o("a",{class:"underline",href:"mailto:[email protected]"},"[email protected]",-1),x(" or call ",-1),o("a",{class:"underline",href:"tel:833-242-3794"},"833-242-3794",-1),x(". ",-1)])]),_:1})),o("div",Je,[o("h3",Qe,[v(n(_e),{class:"relative w-6 h-6 text-brand-cyan"}),r[10]||(r[10]=o("span",{class:"text-xl font-bold"},"What is a certificate holder?",-1))]),r[11]||(r[11]=o("p",{class:"text-lg text-wrap-pretty"}," A certificate holder is the person or business requesting your proof of insurance. Common examples of certificate holders are your employer, school, or a client. ",-1))]),v(ne,{modelValue:n(I),"onUpdate:modelValue":r[3]||(r[3]=c=>S(I)?I.value=c:null),onRetry:n(f)},null,8,["modelValue","onRetry"])])}}},wt=q(tt,[["__scopeId","data-v-3656a87f"]]);export{wt as default}; 2//# sourceMappingURL=D4SaJhrm.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.