1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9430],{29430:function(e,a,o){"use strict";o.r(a),o.d(a,{default:function(){return RechatV2_ModalForm}});var t=o(85893),n=o(18496),l=o(24836),r=o(7178),m=o(67294),s=o(95719),d=o(75456),i=o(39599),c=o.n(i),u=o(25675),_=o.n(u),RechatV2_ModalSuccess=e=>{let{isOpen:a,toggle:o,handleOpenLinkExtension:n}=e,l=(0,d.Z)(),r=l.rechatV2.modalSuccess;return(0,t.jsx)(s.Z,{isOpen:a,toggle:o,className:c().modalSuccess,centered:!0,children:(0,t.jsxs)("div",{className:c().modalSuccessContainer,children:[(0,t.jsx)(_(),{src:"images/9chat/succes-icon.svg",alt:"success-icon",width:100,height:100,color:"#5CC9D5"}),(0,t.jsx)("p",{className:c().modalSuccessTitle,children:r.title}),(0,t.jsx)("button",{className:"".concat(c().modalSuccessButton," ").concat(c().gradientButton),onClick:()=>{n()},children:r.tryNow})]})})},p=o(53012),h=o(20278),v=o(69993),f=o(80008),g=o.n(f),C=o(13208);let F={name:"",phone:"",mail:"",companyName:"",detail:""},b={name:"",phone:"",mail:""};var RechatV2_ModalForm=e=>{let{isOpen:a,toggle:o,formType:i}=e,u=(0,d.Z)(),_=u.rechatV2.modalForm,[f,x]=(0,m.useState)(F),[y,N]=(0,m.useState)(b),[I,k]=(0,m.useState)(!1),[S,j]=(0,m.useState)(!1),[V,w]=(0,m.useState)(!1),L=[{label:_.form.inputName.placeholder,value:f.name,onChange:e=>x({...f,name:e.target.value}),required:_.form.inputName.required,key:"name"},{label:_.form.phone.placeholder,value:f.phone,onChange:e=>x({...f,phone:e.target.value}),required:_.form.phone.required,key:"phone",showDefaultAlert:!0,alertText:_.form.phone.alert},{label:_.form.email.placeholder,value:f.mail,onChange:e=>x({...f,mail:e.target.value}),required:_.form.email.required,key:"mail"},{label:_.form.companyName.placeholder,value:f.companyName,onChange:e=>x({...f,companyName:e.target.value}),required:_.form.companyName.required,key:"companyName"},{label:_.form.detail.placeholder,value:f.detail,onChange:e=>x({...f,detail:e.target.value}),required:_.form.detail.required,key:"detail",typeInput:"textarea"}];(0,m.useEffect)(()=>{k(!1),N(b),x(F)},[a]);let toggleModalSuccess=()=>{j(!S)},isValidPhone=e=>/^[0-9]{10}$/.test(e),isValidEmail=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),handleValidate=()=>{N(b);let e={};return""===f.name&&(e.name=_.error.name.required),""===f.phone?e.phone=_.error.phone.required:isValidPhone(f.phone)||(e.phone=_.error.phone.invalid),""===f.mail||isValidEmail(f.mail)||(e.mail=_.error.mail.invalid),0===Object.keys(e).length||(N(e),!1)},classNameInput=(e,a)=>{var o;let t="".concat(c().modalFormInput),n=null===(o=L.find(a=>a.key===e))||void 0===o?void 0:o.showDefaultAlert;return"textarea"===a&&(t+=" ".concat(c().modalFormInputTextarea)),n&&!I&&(t+=" ".concat(c().showAlert)),I&&((null==f?void 0:f[e])?(null==y?void 0:y[e])?t+=" ".concat(c().invalid):t+=" ".concat(c().valid):(null==y?void 0:y[e])&&(t+=" ".concat(c().invalid))),t},handleGetToken=async()=>{try{let e=await (0,v.LP)({app_id:"1115981220387908",app_secret:"7f94e039-798d-4eda-9b11-8d0d774c37e8"});if(201===e.status)return e.data.access_token;return null}catch(e){return console.log("=======error=======",e),null}},handleSubmit=async()=>{var e,a,t,n,l;let r=new URL(window.location.href),m={medium:r.searchParams.get("utm_medium")||(0,C.Do)("utmMedium")||"",campaign:r.searchParams.get("utm_campaign")||(0,C.Do)("utmCampaign")||"",source:r.searchParams.get("utm_source")||(0,C.Do)("utmSource")||"",content:r.searchParams.get("utm_content")||(0,C.Do)("utmContent")||""},{medium:s,campaign:d,source:c,content:_}=m;try{if(V)return;if(k(!0),w(!0),handleValidate()){k(!1),N(b);let l=await handleGetToken();if(!l){(0,p._N)(u.rechatV2.toast.error.sendForm);return}let r={name:f.name,phone:[f.phone],email:[f.mail],company_name:f.companyName,message:f.detail,form_type:h.K7,source_channel:{label:"Webform",value:"webform",color:""},utm_campaign:d,utm_medium:s,utm_source:c,utm_content:_,lead_note:"name: ".concat(f.name," \nphone: ").concat(f.phone," \nemail: ").concat(f.mail," \ncompany_name: ").concat(f.companyName," \nmessage: ").concat(f.detail," \nurl: ").concat(window.location.href),is_auto_create_lead_by_person:!0,is_check_lead_exist_and_add_note:!0,is_system_generate:!0,pipeline:{lead_stage_id:"684052636f741e78912ee56f",value:"684052636f741e78912ee56f",label:"NEW LEAD",color:"#3A7F90",position:0,pipeline_id:"687480826f741e78913dcbe0",is_active:!0,actived_at:g()().unix()},...h.OF[i]};c&&(r.lead_note+=" \nutm_source: ".concat(c)),s&&(r.lead_note+=" \nutm_medium: ".concat(s)),d&&(r.lead_note+=" \nutm_campaign: ".concat(d)),_&&(r.lead_note+=" \nutm_content: ".concat(_));let m=await Promise.allSettled([(0,v.v1)(r,l),(0,v.qm)(r)]);m.every(e=>"fulfilled"===e.status)?(o(),toggleModalSuccess()):((0,p._N)((null===(n=m.find(e=>"rejected"===e.status))||void 0===n?void 0:null===(t=n.reason)||void 0===t?void 0:null===(a=t.response)||void 0===a?void 0:null===(e=a.data)||void 0===e?void 0:e.message)||u.rechatV2.toast.error.sendForm),o())}}catch(a){let{response:e}=a;console.log("=======response=======",e),(0,p._N)((null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.message)||u.rechatV2.toast.error.sendForm)}finally{w(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s.Z,{isOpen:a,toggle:o,className:c().modalForm,centered:!0,size:"lg",children:[(0,t.jsx)(n.Z,{width:24,color:"#A5ADBB",className:c().closeModalIcon,onClick:o}),(0,t.jsxs)("div",{className:c().modalFormContainer,children:[(0,t.jsx)("p",{className:c().modalFormTitle,children:_.title}),(0,t.jsx)("p",{className:c().modalFormDesc,dangerouslySetInnerHTML:{__html:_.desc}}),(0,t.jsx)("div",{className:c().formContainer,children:L.map((e,a)=>(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("div",{className:c().modalFormInputContainer,children:[(0,t.jsxs)("p",{className:"".concat(c().modalFormInputLabel," ").concat((null==f?void 0:f[e.key])?c().active:""),children:[e.label,e.required&&(0,t.jsx)("span",{className:c().modalFormInputRequired,children:" *"})]}),"textarea"===e.typeInput?(0,t.jsx)("textarea",{value:e.value,onChange:e.onChange,className:classNameInput(e.key,e.typeInput)}):(0,t.jsx)("input",{value:e.value,onChange:e.onChange,className:classNameInput(e.key,e.typeInput)})]}),(null==y?void 0:y[e.key])&&(0,t.jsxs)("div",{className:c().modalFormInputError,children:[(0,t.jsx)(l.Z,{size:14,color:"#fff"}),(0,t.jsx)("span",{children:null==y?void 0:y[e.key]})]}),e.showDefaultAlert&&!I&&(0,t.jsxs)("div",{className:c().modalFormInputAlert,children:[(0,t.jsx)(l.Z,{size:14,color:"#fff"}),(0,t.jsx)("span",{children:e.alertText})]})]},a))}),(0,t.jsxs)("button",{className:"".concat(c().modalFormButton," ").concat(c().gradientButton," ").concat(V?c().disabled:""),onClick:handleSubmit,disabled:V,children:[_.button,(0,t.jsx)(r.Z,{size:16,color:"#fff"})]})]})]}),(0,t.jsx)(RechatV2_ModalSuccess,{isOpen:S,toggle:toggleModalSuccess,handleOpenLinkExtension:()=>{switch(i){case"9push":window.open(h.ZP.VI.PUSH,"_blank");break;case"9rechat":window.open(h.ZP.VI.RECHAT,"_blank")}}})]})}},43522:function(e,a,o){"use strict";o.d(a,{VL:function(){return l},bZ:function(){return r},mg:function(){return m},sg:function(){return n}});var t=o(87066);t.Z.create({baseURL:"https://cdn-internal.so9.vn/api/v1"});let n=t.Z.create({baseURL:"https://so9.vn/api/v2"}),l=t.Z.create({baseURL:"https://i.so9.vn/api/v1/"}),r=t.Z.create({baseURL:"https://i.so9.vn/ext/v1"}),m=t.Z.create({baseURL:"https://open-api.so9.vn/api/v1"})},69993:function(e,a,o){"use strict";o.d(a,{LP:function(){return getToken},qm:function(){return sendForm},v1:function(){return createPersonCRM}});var t=o(43522);let getToken=async e=>{let a=await t.mg.post("oauth",e);return a.data},createPersonCRM=async(e,a)=>{let o=await t.mg.post("crm/persons/create",e,{headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"}});return o.data},sendForm=async e=>{let a=await t.VL.post("form-submissions",e);return a.data}},53012:function(e,a,o){"use strict";o.d(a,{_N:function(){return toastError}});var t=o(44173);function toastError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Th\xe0nh c\xf4ng";return t.toast.error(e,{position:"top-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,progress:void 0})}},39599:function(e){e.exports={modalBorderRadius:"modal_modalBorderRadius__oFVaY",modalVideoInfoContainer:"modal_modalVideoInfoContainer__21bN1",modalVideoInfoHeader:"modal_modalVideoInfoHeader__yzUUc",modalVideoInfoContent:"modal_modalVideoInfoContent__OjpNV",typesCustomerList:"modal_typesCustomerList__CQLIB",typesCustomerItem:"modal_typesCustomerItem__2SbHu",active:"modal_active__WO_HS",videoContainer:"modal_videoContainer__Adiir",loadingContainer:"modal_loadingContainer__UCMrX",modalForm:"modal_modalForm__Zv_Ss",closeModalIcon:"modal_closeModalIcon__e5EHc",modalFormContainer:"modal_modalFormContainer__mMLeo",modalFormTitle:"modal_modalFormTitle__CBmBU",modalFormDesc:"modal_modalFormDesc__54L5F",formContainer:"modal_formContainer__VKLci",modalFormInputContainer:"modal_modalFormInputContainer__oFppR",modalFormInputLabel:"modal_modalFormInputLabel__vKjET",modalFormInputRequired:"modal_modalFormInputRequired__BMCJA",modalFormInput:"modal_modalFormInput__7bhSP",modalFormInputTextarea:"modal_modalFormInputTextarea__WQoW4",valid:"modal_valid__NpNte",invalid:"modal_invalid__zVOU6",modalFormInputError:"modal_modalFormInputError__YJhtQ",modalFormInputAlert:"modal_modalFormInputAlert__jy9k1",modalFormCheckboxContainer:"modal_modalFormCheckboxContainer__t1eUT",modalFormCheckboxLabel:"modal_modalFormCheckboxLabel__IweOP",modalFormCheckboxLabelRequired:"modal_modalFormCheckboxLabelRequired__WS_Jc",modalFormButton:"modal_modalFormButton__sxCAc",disabled:"modal_disabled__hFMwL",modalSuccess:"modal_modalSuccess__WU0iZ",modalSuccessContainer:"modal_modalSuccessContainer__cNQHg",modalSuccessTitle:"modal_modalSuccessTitle__0aDUR",modalSuccessButton:"modal_modalSuccessButton__8byby",gradientButton:"modal_gradientButton__2Qb_u"}}}]);
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.