"use strict";exports.id=4255,exports.ids=[4255],exports.modules={4255:(e,s,t)=>{t.a(e,async(e,r)=>{try{t.r(s),t.d(s,{default:()=>QuestionForm});var a=t(20997),i=t(75609),l=t(60802),d=t(66644),n=t(13330),o=t(45009),x=t(61175),u=t(54574),c=t(86201),m=t(77649),p=t(11377),h=e([d,u,c]);[d,u,c]=h.then?(await h)():h;let g=i.object().shape({question:i.string().required("Tell us more about it")});function QuestionForm(){let{data:e}=(0,o.X9)(),{t:s}=(0,p.useTranslation)("common"),{closeModal:t}=(0,o.SO)(),r=(0,x.useQueryClient)(),{mutate:i,isLoading:h}=(0,x.useMutation)(u.Z.questions.create,{onSuccess:()=>{c.default.success(s("text-ask-question-success"))},onError:e=>{let{response:{data:t}}=e??{};t?.message?.includes("MAXIMUM_QUESTION_LIMIT_EXCEEDED")?c.default.error(s("text-ask-question-error")):c.default.error(t?.message)},onSettled:()=>{r.refetchQueries([m.P.PRODUCTS_QUESTIONS]),t()}});return(0,a.jsxs)("div",{className:"flex h-full min-h-screen w-screen flex-col justify-center bg-light text-left dark:bg-dark-250 xs:h-auto xs:min-h-0 xs:max-w-[400px] md:max-w-[590px] md:rounded-xl lg:max-w-[650px]",children:[a.jsx("h3",{className:"mb-2 pl-6 pr-6 text-center text-base font-medium tracking-[-0.3px] text-dark dark:text-light xs:mb-0 xs:border-b xs:border-dark/10 xs:py-4 xs:pr-10 xs:text-left xs:dark:border-light/10 md:py-5 md:pl-7 lg:py-6 lg:pr-16",children:s("text-ask-seller-question")}),a.jsx("div",{className:"p-6 md:p-7",children:a.jsx(d.l,{onSubmit:s=>{i({product_id:e.product_id,shop_id:e.shop_id,question:s.question})},validationSchema:g,children:({register:e,formState:{errors:t}})=>(0,a.jsxs)(a.Fragment,{children:[a.jsx(n.Z,{...e("question"),className:"mb-5",error:t?.question?.message}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs leading-5 text-dark/60 ltr:pr-8 rtl:pl-8 dark:text-light/60",children:s("text-ask-question-desc")}),a.jsx(l.Z,{className:"text-sm",isLoading:h,disabled:h,children:s("text-submit")})]})]})})})]})}r()}catch(e){r(e)}})}};