1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4740],{84740:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return Alonomic_Register}});var s=t(57437),o=t(2265),n=t(40882),i=t(16576),l=t(80667),c=t.n(l),common_Toast=function(e){let{title:a,color:t,isOpen:n,setIsOpen:l}=e;return(0,o.useEffect)(()=>{n&&setTimeout(()=>{l(!1)},3e3)},[n]),(0,s.jsx)("div",{className:c().container,children:n&&(0,s.jsx)(i.E.div,{initial:{opacity:0,x:100},animate:{opacity:1,x:0},exit:{opacity:0,x:100},transition:{duration:.5},children:(0,s.jsx)("div",{className:"".concat(t," border-t-4 rounded-b px-4 py-3 shadow-md"),children:(0,s.jsx)("div",{className:"flex",children:(0,s.jsx)("div",{children:(0,s.jsx)("p",{className:"font-normal",children:a})})})})})})},r=t(56951),p=t(98926),m=t(16691),d=t.n(m);let RefreshIcon=e=>(0,s.jsx)("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,s.jsx)("path",{d:"M22 12C22 17.52 17.52 22 12 22C6.48 22 3.11 16.44 3.11 16.44M3.11 16.44H7.63M3.11 16.44V21.44M2 12C2 6.48 6.44 2 12 2C18.67 2 22 7.56 22 7.56M22 7.56V2.56M22 7.56H17.56",stroke:"#66727D","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})});var hooks_useGetCaptcha=()=>{let{dispatch:e}=(0,o.useContext)(p.AlonomicContext),a=(0,o.useCallback)(()=>{e({type:"SET_IS_CAPTCHA_LOADING",payload:!0}),fetch("https://api.alopeyk.com/webhook-service/api/v1/captcha").then(e=>e.json()).then(a=>{var t;(null==a?void 0:null===(t=a.object)||void 0===t?void 0:t.token)&&e({type:"SET_CAPTCHA",payload:{token:a.object.token,captcha:a.object.image}}),e({type:"SET_IS_CAPTCHA_LOADING",payload:!1})}).catch(()=>{e({type:"SET_IS_CAPTCHA_LOADING",payload:!1})})},[e]);return{fetchCaptcha:a}},h=t(19493),u=t.n(h);let CaptchaForm=()=>{let{state:e}=(0,o.useContext)(p.AlonomicContext),{fetchCaptcha:a}=hooks_useGetCaptcha();return e.captcha.token?(0,s.jsx)("div",{className:u().container,children:(0,s.jsxs)("div",{className:"flex gap-2 items-center cursor-pointer",children:[(0,s.jsx)(d(),{className:"captcha",width:165,height:48,src:"data:image/png;base64,".concat(e.captcha.captcha),alt:"captcha"}),(0,s.jsx)(RefreshIcon,{onClick:()=>a()})]})}):(0,s.jsx)("div",{className:"w-[168px] h-[48px] bg-gray-200 rounded-[8px]"})};var hooks_useRegisterUser=()=>{let e=Array.from(new URLSearchParams(window.location.search).entries()).reduce((e,a)=>{let[t,s]=a;return e[t]=s,e},{}),{state:a,dispatch:t}=(0,o.useContext)(p.AlonomicContext),{fetchCaptcha:s}=hooks_useGetCaptcha(),n=(0,o.useCallback)(()=>{t({type:"SET_IS_LOADING",payload:!0});let{name:o,brand:n,captcha:i,category:l,cellphone:c,email:r,userCaptcha:p,parcelCount:m}=a;o&&n&&l&&r?/^09\d{9}$/.test(c)?fetch("https://api.alopeyk.com/webhook-service/api/v1/forms/didar-crm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:{FirstName:o,CompanyName:n,Categories:l?[l]:[],MobilePhone:c,Email:r,Title:n,parcelCount:m},verify_token:i.token,captcha:p,options:null!=e?e:{}})}).then(e=>e.json()).then(e=>{t({type:"SET_IS_LOADING",payload:!1}),200===e.code?(t({type:"SET_TOAST",payload:{message:"Ø§Ø·ÙØ§Ø¹Ø§Øª Ø´Ù
ا ثبت شد.",isOpen:!0,color:"success"}}),t({type:"RESET_STATE"})):t({type:"SET_TOAST",payload:{message:e.message,isOpen:!0,color:"failure"}}),s()}).catch(()=>{t({type:"SET_IS_LOADING",payload:!1}),t({type:"SET_TOAST",payload:{message:"خطاÛÛ Ø±Ø® داد٠است.",isOpen:!0,color:"failure"}}),s()}):(t({type:"SET_TOAST",payload:{message:"Ø´Ù
ار٠ÙÙ
Ø±Ø§Ù Ø®ÙØ¯ را Ø¨Ù ØµÙØ±Øª ÙØ§Ø±Ø¯ Ú©ÙÛØ¯",isOpen:!0,color:"failure"}}),t({type:"SET_IS_LOADING",payload:!1})):(t({type:"SET_TOAST",payload:{message:"تÙ
اÙ
Û Ù
ÙØ§Ø±Ø¯ Ø®ÙØ§Ø³ØªÙ شد٠را Ø¨Ù ØµÙØ±Øª صØÛØ Ù¾Ø± Ú©ÙÛØ¯",isOpen:!0,color:"failure"}}),t({type:"SET_IS_LOADING",payload:!1}))},[a]);return{registerUser:n}},g=t(47877),y=t(24494),x=t.n(y),Alonomic_Register=()=>{let{state:e,dispatch:a}=(0,o.useContext)(p.AlonomicContext),{ref:t,isInView:i}=(0,g._T)(),{registerUser:l}=hooks_useRegisterUser(),{fetchCaptcha:c}=hooks_useGetCaptcha();(0,o.useEffect)(()=>{i&&c()},[c,i]);let m=(0,o.useMemo)(()=>[{value:"ÙÙØ§Ø²Ù
Ø¢Ø±Ø§ÛØ´Û Ù Ø¨ÙØ¯Ø§Ø´ØªÛ",option:"ÙÙØ§Ø²Ù
Ø¢Ø±Ø§ÛØ´Û Ù Ø¨ÙØ¯Ø§Ø´ØªÛ"},{value:"Ù
ØØµÙÙØ§Øª Ø¯ÛØ¬ÛتاÙ",option:"Ù
ØØµÙÙØ§Øª Ø¯ÛØ¬ÛتاÙ"},{value:"Ú©ØªØ§Ø¨Ø Ø§ÙØªØ´Ø§Ø±Ø§Øª Ù ÚØ§Ù¾",option:"Ú©ØªØ§Ø¨Ø Ø§ÙØªØ´Ø§Ø±Ø§Øª Ù ÚØ§Ù¾"},{value:"Ù
د Ù Ù¾ÙØ´Ø§Ú©",option:"Ù
د Ù Ù¾ÙØ´Ø§Ú©"},{value:"Ú©Ø§ÙØ§Û پزشکÛ",option:"Ú©Ø§ÙØ§Û پزشکÛ"},{value:"ÙØ¯Ø§ÛØ§Û ØªØ¨ÙÛØºØ§ØªÛ ٠سازÙ
اÙÛ",option:"ÙØ¯Ø§ÛØ§Û ØªØ¨ÙÛØºØ§ØªÛ ٠سازÙ
اÙÛ"},{value:"Ø³Ø§ÛØ±",option:"Ø³Ø§ÛØ±"}],[]);return(0,s.jsxs)("div",{ref:t,className:x().container,id:"register",children:[(0,s.jsx)("p",{className:"title",children:r.Yg.register.title}),(0,s.jsx)("p",{className:"description",children:r.Yg.register.description}),(0,s.jsx)("div",{className:"forms",children:(0,s.jsxs)("form",{id:"form-register",className:"form-wrapper",onSubmit:e=>{e.preventDefault(),l()},children:[(0,s.jsxs)("div",{className:"input-wrapper",children:[(0,s.jsx)(n.Ee,{src:"new/form/name.svg",alt:"alonomic",className:"business-icon",width:24,height:24,isAlonomic:!0}),(0,s.jsx)("input",{name:"FirstName",className:"input",type:"text",placeholder:"ÙØ§Ù
Ù ÙØ§Ù
خاÙÙØ§Ø¯Ú¯Û",value:e.name,onChange:e=>a({type:"SET_NAME",payload:e.target.value})})]}),(0,s.jsxs)("div",{className:"input-wrapper",children:[(0,s.jsx)(n.Ee,{src:"new/form/phone-number.svg",alt:"alonomic",className:"business-icon",width:24,height:24,isAlonomic:!0}),(0,s.jsx)("input",{name:"MobilePhone",className:"input",type:"tel",inputMode:"numeric",maxLength:11,minLength:11,dir:"ltr",pattern:"^(09|Û°Û¹)[0-9Û°-Û¹]{9}$",required:!0,onInvalid:e=>{e.preventDefault(),a({type:"SET_TOAST",payload:{message:"Ø´Ù
ار٠Ù
1Ù
را٠را صØÛØ Ù Ø¨Ù ØµÙØ±Øª *********Û°Û¹ ÙØ§Ø±Ø¯ Ú©ÙÛØ¯",isOpen:!0,color:"failure"}})},placeholder:"Ø´Ù
ار٠ÙÙ
راÙ",value:e.cellphone,onChange:e=>{let t={"Û°":"0","Û±":"1","Û²":"2","Û³":"3","Û´":"4","Ûµ":"5","Û¶":"6","Û·":"7","Û¸":"8","Û¹":"9"},s=e.target.value.replace(/[Û°-Û¹]/g,e=>t[e]);(s=s.replace(/[^0-9]/g,"")).length>11&&(s=s.slice(0,11)),a({type:"SET_CELLPHONE",payload:s})}})]}),(0,s.jsxs)("div",{className:"input-wrapper",children:[(0,s.jsx)(n.Ee,{src:"new/form/brand.svg",alt:"alonomic",className:"business-icon",width:24,height:24,isAlonomic:!0}),(0,s.jsx)("input",{name:"CompanyName",className:"input",type:"text",placeholder:"ÙØ§Ù
Ø¨Ø±ÙØ¯ Ù ÙØ±ÙشگاÙ",value:e.brand,onChange:e=>a({type:"SET_BRAND",payload:e.target.value})})]}),(0,s.jsxs)("div",{className:"input-wrapper",children:[(0,s.jsx)(n.Ee,{src:"new/form/category.svg",alt:"alonomic",className:"business-icon",width:24,height:24,isAlonomic:!0}),(0,s.jsxs)("select",{name:"Categories",className:"input select-input",value:e.category,onChange:e=>a({type:"SET_CATEGORY",payload:e.target.value}),children:[(0,s.jsx)("option",{value:"",disabled:!0,children:"ØÙØ²Ù ÙØ¹Ø§ÙÛØª"}),m.map(e=>(0,s.jsx)("option",{value:e.value,children:e.option},e.value))]})]}),(0,s.jsxs)("div",{className:"input-wrapper",children:[(0,s.jsx)(n.Ee,{src:"new/form/email.svg",alt:"alonomic",className:"business-icon",width:24,height:24,isAlonomic:!0}),(0,s.jsx)("input",{name:"Email",className:"input",type:"email",placeholder:"آدرس اÛÙ
ÛÙ",value:e.email,onChange:e=>a({type:"SET_EMAIL",payload:e.target.value})})]}),(0,s.jsxs)("div",{className:"input-wrapper",children:[(0,s.jsx)(n.Ee,{src:"new/form/box.svg",alt:"alonomic",className:"business-icon",width:24,height:24,isAlonomic:!0}),(0,s.jsx)("input",{name:"ParcelCount",className:"input",type:"number",placeholder:"تعداد Ø§Ø±Ø³Ø§Ù Ø±ÙØ²Ø§ÙÙ (Ø§Ø®ØªÛØ§Ø±Û)",value:e.parcelCount,onChange:e=>a({type:"SET_PARCEL_COUNT",payload:e.target.value})})]}),(0,s.jsxs)("div",{className:"input-wrapper",children:[(0,s.jsx)(n.Ee,{src:"new/form/shield-tick.svg",alt:"alonomic",className:"business-icon",width:24,height:24,isAlonomic:!0}),(0,s.jsx)("input",{name:"captcha",className:"input",type:"text",placeholder:"کد Ù
ÙØ¬Ùد در تصÙÛØ± را ÙØ§Ø±Ø¯ Ú©ÙÛØ¯",value:e.userCaptcha,onChange:e=>{a({type:"SET_USER_CAPTCHA",payload:e.target.value.replace(/[Û°-Û¹]/g,e=>String.fromCharCode(e.charCodeAt(0)-1728))})}})]}),(0,s.jsx)(CaptchaForm,{})]})}),(0,s.jsx)("div",{className:"footer-wrapper flex-col items-center",children:(0,s.jsx)("button",{disabled:e.isLoading,className:"".concat(e.isLoading&&"grayscale"," submit-btn"),form:"form-register",type:"submit",id:"register-submit-button",children:"ثبت ÙØ§Ù
"})}),(0,s.jsx)(common_Toast,{setIsOpen:()=>{a({type:"SET_TOAST",payload:{message:e.toast.message,isOpen:!1,color:e.toast.color}})},isOpen:e.toast.isOpen,color:e.toast.color,title:e.toast.message})]})}},80667:function(e){e.exports={container:"styles_container__AGQrA"}},19493:function(e){e.exports={container:"styles_container__kydeB"}},24494:function(e){e.exports={container:"styles_container__Yy4hQ"}}}]);
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.