1import{b as d,j as e}from"./react-DkY5NCor.js";import{c as t}from"./Input-BPQ-HfnZ-BJhgaqVG.js";import{u as N,a as o,i as _}from"../global-free-editor.js";import{u as C}from"./useTrackFieldInput-DsFY234W.js";import"./InputHint-BeF4ZhNU-BcEihOk7.js";import"./react-dom-D2uz-j24.js";import"./snowplow-B76Al7v7.js";function y(){const{t:s}=N(),{setQr_code_text:c,setProFeaturesSelection:h}=o(),f=o(i=>i.setDigitalBusinessCardValue),a=o(i=>i.digitalBusinessCardValue),[p,x]=d.useState(!1),u=d.useRef(0),g=C(),n=i=>l=>{if(f(i,l),g(i,l),i==="website"){const r=l.trim();if(h({isProWebsiteSelected:!!r}),u.current&&clearTimeout(u.current),!r){x(!1);return}x(!1),u.current=window.setTimeout(()=>{x(!_(r))},500)}};d.useEffect(()=>{Object.entries(a).find(l=>l[1].trim().length>0)?c(b(a)):(c(""),o.getState().resetQrCode())},[a,c]);const b=i=>{const l=Object.entries(i).reduce((m,[j,w])=>({...m,[j]:(w||"").replace(/;/g,";")}),{});return["BEGIN:VCARD","VERSION:3.0",l.full_name?`N:${l.full_name}`:"",l.full_name?`FN:${l.full_name}`:"",l.company_name?`ORG:${l.company_name}`:"",l.work_title?`TITLE:${l.work_title}`:"","ADR:;;"+[l.street,l.city,l.state,l.zip_code,l.country].join(";"),l.phone_number?`TEL;WORK;VOICE:${l.phone_number}`:"",l.phone_number?`TEL;CELL:${l.phone_number}`:"",l.fax?`TEL;FAX:${l.fax}`:"",l.email_address?`EMAIL;WORK;INTERNET:${l.email_address}`:"",l.website?`URL:${l.website}`:"","END:VCARD"].filter(m=>m).join(` 2`)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs text-lapis-950 font-bold mb-6",children:s("DIGITAL BUSINESS CARD INFORMATION")}),e.jsx("label",{className:"w-full",children:e.jsx(t,{inputSize:"xl",label:s("Full name"),value:a.full_name,onChange:n("full_name"),maxLength:1e3})})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[e.jsx("label",{className:"w-full",children:e.jsx(t,{inputSize:"xl",label:s("Phone number"),value:a.phone_number,onChange:n("phone_number"),maxLength:100})}),e.jsx("label",{className:"w-full",children:e.jsx(t,{label:s("Email address"),inputSize:"xl",value:a.email_address,onChange:n("email_address"),maxLength:500})})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[e.jsx("label",{className:"w-full",children:e.jsx(t,{inputSize:"xl",label:s("Company name"),value:a.company_name,onChange:n("company_name"),maxLength:500})}),e.jsx("label",{className:"w-full",children:e.jsx(t,{label:s("Work title"),inputSize:"xl",value:a.work_title,onChange:n("work_title"),maxLength:500})})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[e.jsx("label",{className:"w-full",children:e.jsx(t,{inputSize:"xl",label:s("Work phone"),value:a.work_phone,onChange:n("work_phone"),maxLength:500})}),e.jsx("label",{className:"w-full",children:e.jsx(t,{label:s("Fax"),inputSize:"xl",value:a.fax,onChange:n("fax"),maxLength:100})})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[e.jsx("label",{className:"w-full",children:e.jsx(t,{inputSize:"xl",label:s("Street"),value:a.street,onChange:n("street"),maxLength:1e3})}),e.jsx("label",{className:"w-full",children:e.jsx(t,{label:s("City"),inputSize:"xl",value:a.city,onChange:n("city"),maxLength:500})})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[e.jsx("label",{className:"w-full",children:e.jsx(t,{inputSize:"xl",label:s("State"),value:a.state,onChange:n("state"),maxLength:100})}),e.jsx("label",{className:"w-full",children:e.jsx(t,{label:s("Country"),inputSize:"xl",value:a.country,onChange:n("country"),maxLength:100})})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[e.jsx("label",{className:"w-full",children:e.jsx(t,{inputSize:"xl",label:s("Zip"),value:a.zip_code,onChange:n("zip_code"),maxLength:100})}),e.jsx("div",{className:"w-full relative",children:e.jsx("label",{children:e.jsx(t,{label:s("Website"),inputSize:"xl",value:a.website,onChange:n("website"),hasError:p,errorMessage:s("Please enter a valid URL"),maxLength:1e3})})})]})]})}export{y as default};
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.