PageSourceSearch

https://cp.pt/js/index-CQl9W2Im.js

js cp.pt collected 2026-10-01 09:14:37 UTC 9,269 bytes, 1 lines download raw bytes

1import{u as e,j as o,C as a}from"./forms-CQIHuKgG.js";import{u as t,r as l}from"./i18n-Da3IOi1c.js";import{C as n,R as r,a as s}from"./ui-C0dJowBQ.js";import{l as i,e as c,S as u}from"./index-CqACRIXY.js";import{W as m}from"./Wrapper-BbNKgFw1.js";import{C as d}from"./ColorDiv-DCSjoc16.js";import{B as f}from"./ButtonCustom-okNO1jHW.js";import{F as v,c as p}from"./FileUpload-BqD8XlZP.js";import{S as h}from"./SelectCustom-CbUWeROE.js";import{I as x}from"./InputCustom-cpSt5GNn.js";import{C}from"./CheckBox-DbKONJrU.js";import{I as N}from"./InputTextAreaCustom-0tLk6qgq.js";import{v as j,a as g,b,c as I,d as y,e as F,g as P,f as S}from"./formConstants-C81__C2c.js";import{u as q,F as _}from"./useRecaptcha-ZQsxgBL8.js";import{u as R}from"./useSEO-D5w_OURl.js";import{a as E}from"./router-CeOKvF5U.js";import"./utils-CLBY9Uzt.js";import"./query-CNvpHjp-.js";import"./redux-B_RFUBXH.js";import"./ticketing-service-DwdP6NJ5.js";import"./DialogCustom-DxQXA1VO.js";const D=()=>{var D,k,w,T,B,A,M,O,L,V,U,G,W;const{register:H,handleSubmit:K,setValue:z,trigger:J,watch:Q,control:X,clearErrors:Y,formState:{errors:Z}}=e({mode:"onChange",reValidateMode:"onChange",defaultValues:{contactNameInfo:{name:"",email:"",phoneNumber:"",countryCode:null},message:"",taxesInfo:{fiscalNumber:"",fiscalCountryCode:null}}}),[$,ee,oe]=Q(["taxesInfo.fiscalCountryCode","contactNameInfo.countryCode","taxesInfo.fiscalNumber"]),ae=E(),{t:te,i18n:le}=t(),{data:ne}=i(),[re,se]=l.useState(void 0),[ie,ce]=l.useState(!1),[ue,me]=l.useState(!1),[de,fe]=l.useState(!1),ve=c({query:"(max-width: 991.98px)"}),{SEOComponent:pe}=R({pageKey:"formContact"}),[he,xe]=l.useState([]),[Ce,Ne]=l.useState([]);l.useEffect(()=>{(async()=>{try{const e=await P(),o=S(e);Ne(e),xe(o)}catch(e){console.error("Erro ao carregar dados para os selecionáveis:",e)}})()},[null==le?void 0:le.language]);const{submitFormWithRecaptcha:je,error:ge}=q({action:"submit"}),be=(e,o)=>{if(Array.isArray(e))for(const a of e){if(a.title.toUpperCase()===o.toUpperCase())return e;if("object"==typeof a&&null!==a){const e=be(a,o);if(e)return e}}else if("object"==typeof e&&null!==e)for(const a in e){const t=be(e[a],o);if(t)return t}return null},Ie=l.useMemo(()=>{var e;const o="pt"===le.language?"pt-PT":"en-US",a=(null==(e=null==ne?void 0:ne[o])?void 0:e.map(e=>e))??[],t=be(a,te("RequestNew"));return null==t?void 0:t.map(e=>({children:e.title,href:e.href,target:"_self",active:(null==e?void 0:e.title)===te("RequestNew")}))},[ne,le.language,te]);return l.useEffect(()=>{oe&&J("taxesInfo.fiscalCountryCode")},[oe,J]),l.useEffect(()=>{(null==$?void 0:$.value)?(J("taxesInfo.fiscalNumber"),J("taxesInfo.fiscalCountryCode")):(null==oe?void 0:oe.trim())?J("taxesInfo.fiscalCountryCode"):Y(["taxesInfo.fiscalNumber","taxesInfo.fiscalCountryCode"])},[$,oe,J,Y]),l.useEffect(()=>{ee&&J("contactNameInfo.phoneNumber")},[ee,J]),o.jsxs(o.Fragment,{children:[o.jsx(pe,{}),o.jsxs(n,{children:[o.jsx(r,{children:o.jsxs(s,{className:"banner-left_column",children:[o.jsxs("div",{className:"form-contact-header  banner-default",children:[o.jsx(d,{}),o.jsx("div",{className:"form-contact-header__content",children:o.jsx("h1",{className:"form-contact-header__content__title",children:te("FormContactPageTitle")})})]}),o.jsx(m,{style:{paddingBottom:"32px"},column:12,children:o.jsxs("div",{className:"form-contact "+(ve?"flex-column":""),children:[!ve&&o.jsx(u,{menuItems:Ie}),o.jsxs("div",{className:"form-contact__content",children:[o.jsx("img",{src:"/assets/images/seta.svg",onClick:()=>{ae(-1)},alt:te("BackButton"),style:{height:"24px",width:"24px",margin:"12px",cursor:"pointer"}}),o.jsx("p",{className:"form-contact-sub-title",children:te("FormContactPageSubTitle")}),o.jsxs("form",{onSubmit:K(async e=>{var o,a,t,l,n,r,s,i,c,u,m,d,f,v,h,x,C;me(!0);let N=null;if(re)try{N=await p(re)}catch(g){return console.error("Erro ao converter arquivo para Base64:",g),ce(!0),void me(!1)}const j={formLanguage:le.language,contactNameInfo:{name:null==(a=null==(o=null==e?void 0:e.contactNameInfo)?void 0:o.name)?void 0:a.trim(),email:null==(l=null==(t=null==e?void 0:e.contactNameInfo)?void 0:t.email)?void 0:l.trim(),phoneNumber:(null==(r=null==(n=null==e?void 0:e.contactNameInfo)?void 0:n.phoneNumber)?void 0:r.trim())?(null==(i=null==(s=null==e?void 0:e.contactNameInfo)?void 0:s.countryCode)?void 0:i.label)+(null==(u=null==(c=null==e?void 0:e.contactNameInfo)?void 0:c.phoneNumber)?void 0:u.trim()):void 0,countryCode:(null==(d=null==(m=null==e?void 0:e.contactNameInfo)?void 0:m.countryCode)?void 0:d.value)||void 0},taxesInfo:{fiscalCountryCode:(null==(v=null==(f=null==e?void 0:e.taxesInfo)?void 0:f.fiscalCountryCode)?void 0:v.value)||void 0,fiscalNumber:(null==(x=null==(h=null==e?void 0:e.taxesInfo)?void 0:h.fiscalNumber)?void 0:x.trim())||void 0},message:null==(C=e.message)?void 0:C.trim(),attachments:N?[N]:void 0};try{await je("institutionalContactForm",j,{cType:"multipart/form-data"});ce(!1)}catch(g){console.error("Erro na submissão do formulário Contacto Institucional:",ge||g),ce(!0)}}),children:[o.jsxs("div",{className:"form-contact__form-info",children:[o.jsxs("p",{className:"form-contact-sub-title-info",children:[o.jsx("span",{dangerouslySetInnerHTML:{__html:te("FormContactPageDescriptionInfo")}}),o.jsx("br",{}),o.jsx("br",{}),te("FormContactPageInfor")]}),o.jsx("p",{className:"form-contact-title-info",children:te("FormContactPageInforTitle")}),o.jsxs("div",{className:"form-contact__form-contact-container",children:[o.jsx(x,{...H("contactNameInfo.name",{required:te("RequiredField"),validate:e=>j(e)||te("ValidFullName")}
1),label:te("FormContactPageName"),placeholder:te("FormContactPageNamePlaceholder"),error:null==(k=null==(D=null==Z?void 0:Z.contactNameInfo)?void 0:D.name)?void 0:k.message,isRequired:!0}),o.jsx(x,{error:null==(T=null==(w=null==Z?void 0:Z.contactNameInfo)?void 0:w.email)?void 0:T.message,label:te("FormContactPageMailLabel"),...H("contactNameInfo.email",{required:te("RequiredField"),validate:e=>g(e.trim())||te("InvalidEmail")}),placeholder:te("FormContactPageMailPlaceholder"),isRequired:!0}),o.jsxs("div",{className:"form-row-split",children:[o.jsx(a,{name:"taxesInfo.fiscalCountryCode",control:X,rules:{validate:e=>!(!!(null==oe?void 0:oe.trim())&&!(null==e?void 0:e.value))||te("RequiredField")},render:({field:e})=>{var a,t,l;return o.jsx(h,{value:null==(a=null==e?void 0:e.value)?void 0:a.value,isRequired:!!(null==oe?void 0:oe.trim()),label:te("FormContactPageCountry"),onChange:e=>z("taxesInfo.fiscalCountryCode",e??null,{shouldValidate:!0,shouldDirty:!0}),placeholder:te("ChooseOption"),options:he,error:null==(l=null==(t=null==Z?void 0:Z.taxesInfo)?void 0:t.fiscalCountryCode)?void 0:l.message,searchable:!0})}}),o.jsx(x,{...H("taxesInfo.fiscalNumber",{validate:e=>{const o=null==e?void 0:e.trim(),a=!!(null==$?void 0:$.value),t="PT"===(null==$?void 0:$.value);if(a&&!o)return te("RequiredField");if(t&&o){return!0===b(o)||te("InvalidNIF")}return!0}}),isNumber:"PT"===(null==$?void 0:$.value),label:"NIF",isRequired:!!(null==$?void 0:$.value),error:null==(A=null==(B=null==Z?void 0:Z.taxesInfo)?void 0:B.fiscalNumber)?void 0:A.message,placeholder:te("FormContactPageNif")})]}),o.jsxs("div",{className:"input-phone-column",children:[o.jsxs("div",{className:"input-phone",children:[o.jsx(a,{name:"contactNameInfo.countryCode",control:X,render:({field:e})=>{var a;return o.jsx(h,{value:(null==(a=null==e?void 0:e.value)?void 0:a.value)||"",onChange:e=>z("contactNameInfo.countryCode",e),placeholder:"Selecionar",className:"input-select-phone",options:Ce,searchable:!0,label:te("PhoneNumber")})}}),o.jsx(x,{...H("contactNameInfo.phoneNumber",{validate:e=>{const o=null==e?void 0:e.trim();return!o||("+351"!==(null==ee?void 0:ee.label)||(I(o,y(o))||te("InvalidPhone")))}}),isNumber:!0,className:(null==(O=null==(M=Z.contactNameInfo)?void 0:M.phoneNumber)?void 0:O.message)?"input-field-error":"",placeholder:te("FormContactPagePhoneNumber")})]}),(null==(V=null==(L=Z.contactNameInfo)?void 0:L.phoneNumber)?void 0:V.message)&&o.jsx("p",{className:"phone-number-error",role:"alert",children:te(null==(G=null==(U=Z.contactNameInfo)?void 0:U.phoneNumber)?void 0:G.message)})]})]}),o.jsx(N,{...H("message",{required:te("RequiredField"),validate:e=>F(e)||te("NotBlankField")}),isRequired:!0,label:te("FormContactPageMessage"),placeholder:te("FormDataGroupOtherDetailsPlaceholder")}),(null==(W=null==Z?void 0:Z.message)?void 0:W.message)&&o.jsx("p",{className:"input-error-message",role:"alert",style:{color:"#D92D20"},children:Z.message.message}),o.jsx(v,{label:te("AttachmentName"),onFileChange:e=>se(e??void 0),placeholder:te("FormContactPageAttachment")})]}),o.jsxs("div",{className:"form-contact-checkbox",children:[o.jsx(C,{checked:de,fontSize:24,onChange:e=>fe(e),height:"32px",width:"32px",isRequired:!0,ariaLabel:te("FormDataGroupPolicyAcceptance")}),o.jsx("p",{className:"form-contact-checkbox-label",dangerouslySetInnerHTML:{__html:te("FormDataGroupPolicyAcceptance")}})]}),o.jsx("div",{className:"form-contact-submit",children:o.jsx(f,{isDisabled:!(!Object.keys(Z).length&&de),type:"submit",text:te("FormContactPageInforBtn")})})]})]}),ve&&o.jsx(u,{menuItems:Ie})]})})]})}),o.jsx(_,{isError:ie,isOpen:ue,setIsOpen:me,onClose:()=>{ie||ae("/"),ce(!1),me(!1)}})]})]})};export{D 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.