PageSourceSearch

https://automateforms.ai/_next/static/chunks/8410-545433917982ffdf.js

js automateforms.ai collected 2026-10-05 11:50:04 UTC 13,812 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8410],{65670:(e,a,t)=>{t.d(a,{E5:()=>u,ED:()=>C,GK:()=>c,HI:()=>_,II:()=>x,Jr:()=>y,Md:()=>k,ZD:()=>N,d_:()=>b,l_:()=>S,uc:()=>F,xZ:()=>g});var n=t(35906),r=t(25848),i=t(39556),l=t(95575),o=t(76046);let s="/v1/form/template";async function d(e){return(0,l.In)({endpoint:"".concat(s,"/categories"),method:"POST",data:e})}let c=()=>{let e=(0,n.jE)();return(0,r.n)({mutationFn:d,onSuccess:()=>{e.invalidateQueries({queryKey:["form-templates-categories"]})}})};async function m(){return(0,l.In)({endpoint:"".concat(s,"/categories"),method:"GET"})}let u=e=>(0,i.I)({queryKey:["form-templates-categories"],queryFn:m,...e});async function p(e){return(0,l.In)({endpoint:"".concat(s,"/categories/").concat(e),method:"DELETE"})}let g=()=>{let e=(0,n.jE)();return(0,r.n)({mutationFn:p,onSuccess:()=>{e.invalidateQueries({queryKey:["form-templates-categories"]})}})};async function h(e){return(0,l.In)({endpoint:"".concat(s),method:"POST",data:e})}let x=()=>{let e=(0,n.jE)();return(0,r.n)({mutationFn:h,onSuccess:()=>{e.invalidateQueries({queryKey:["form-templates-categories"]})}})};async function v(e){return(0,l.In)({endpoint:"".concat(s,"/").concat(e),method:"GET"})}let y=e=>(0,i.I)({queryKey:["form-templates",e],queryFn:()=>v(e),enabled:!!e});async function f(e){return(0,l.In)({endpoint:"".concat(s,"/").concat(e),method:"DELETE"})}let b=()=>(0,r.n)({mutationFn:f});async function j(e,a){return(0,l.In)({endpoint:"".concat(s,"/").concat(e),method:"PUT",data:a})}let N=()=>(0,r.n)({mutationFn:e=>{let{templateId:a,data:t}=e;return j(a,t)}});async function w(e){return(0,l.In)({endpoint:"".concat(s,"/temp/").concat(e),method:"GET"})}let k=e=>{let a="template"===(0,o.useSearchParams)().get("formType");return(0,i.I)({queryKey:["form-templates-details",e],queryFn:()=>w(e),enabled:a})};async function I(e){return(0,l.In)({endpoint:"/v1/forms/createform/template",method:"POST",data:e})}let C=()=>{let e=(0,n.jE)();return(0,r.n)({mutationFn:I,onSuccess:()=>{e.invalidateQueries({queryKey:["usageStats"]})}})};async function E(e){return(0,l.In)({endpoint:"".concat(s,"/status/").concat(e),method:"PUT"})}let F=()=>(0,r.n)({mutationFn:E});async function T(e){return(0,l.In)({endpoint:"".concat(s,"/clone/").concat(e),method:"POST"})}let _=()=>(0,r.n)({mutationFn:T});async function P(e){return(0,l.In)({endpoint:"".concat(s,"/category/").concat(e,"/published"),method:"GET"})}let S=e=>(0,i.I)({queryKey:["public-templates",e],queryFn:()=>P(e),enabled:!!e})},36821:(e,a,t)=>{t.d(a,{AL:()=>o,DD:()=>p,fU:()=>d,ul:()=>m});var n=t(25848),r=t(95575);let i="/v1/forms/submission";async function l(e){return(0,r.In)({endpoint:"".concat(i),method:"POST",data:e})}let o=()=>(0,n.n)({mutationFn:l});async function s(e,a,t,n){return a&&!e.has("workspace_id")&&e.append("workspace_id",a.toString()),void 0===t||e.has("isMultiUpload")||e.append("isMultiUpload",t.toString()),void 0===n||e.has("maxFiles")||e.append("maxFiles",n.toString()),(0,r.In)({endpoint:"".concat(i,"/fileupload"),method:"POST",data:e,isFileUpload:!0})}let d=()=>(0,n.n)({mutationFn:async e=>{let{formData:a,workspace_id:t,isMultiUpload:n,maxFiles:r}=e;try{return await s(a,t,n,r)}catch(e){throw console.error("Upload error:",e),e}}});async function c(e){let{fileUrl:a,workspace_id:t}=e;return(0,r.In)({endpoint:"".concat(i,"/fileremove"),method:"DELETE",data:{fileUrl:a,workspace_id:t}})}let m=()=>(0,n.n)({mutationFn:c});async function u(e){return(0,r.In)({endpoint:"".concat(i,"/quiz/start/").concat(e),method:"POST"})}let p=()=>(0,n.n)({mutationFn:u})},53395:(e,a,t)=>{t.d(a,{A:()=>m});var n=t(95155),r=t(51344),i=t(73312),l=t(33900),o=t(98986),s=t(12115),d=t(65670),c=t(22783);function m(e){let{open:a,onClose:t}=e,[m,u]=(0,s.useState)({name:"",description:"",icon:"",share_with_team:!1}),{mutate:p,isPending:g}=(0,d.GK)();return(0,n.jsx)(r.lG,{open:a,onOpenChange:t,children:(0,n.jsxs)(r.Cf,{onClick:e=>{e.stopPropagation(),e.preventDefault()},className:"sm:max-w-[425px] bg-app-hero-background rounded-lg",children:[(0,n.jsxs)(r.c7,{children:[(0,n.jsx)(r.L3,{className:"text-2xl font-bold text-app-text-color",children:"Create New Category"}),(0,n.jsx)("p",{className:"text-sm text-app-text-secondary mt-2",children:"Create a new category to organize your form templates"})]}),(0,n.jsx)("div",{className:"grid gap-6 py-4",children:(0,n.jsxs)("div",{className:"grid gap-2",children:[(0,n.jsxs)(o.J,{htmlFor:"categoryName",className:"text-sm font-medium text-app-text-color",children:["Category Name ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)(l.p,{id:"categoryName",placeholder:"Enter category name",value:m.name,maxLength:50,onChange:e=>u({...m,name:e.target.value}),className:"border bg-app-background  focus:border-0 focus:ring-0"})]})}),(0,n.jsxs)(r.Es,{className:"gap-2 sm:gap-0",children:[(0,n.jsx)(r.HM,{asChild:!0,children:(0,n.jsx)(i.$,{variant:"outline",className:"bg-app-text-color hover:bg-app-background border border-[#1F311C] hover:text-app-text-color text-app-background",children:"Cancel"})}),(0,n.jsx)(i.$,{onClick:()=>{let e=m.name.trim();e&&p({...m,name:e},{onSuccess:()=>
1{u({name:"",description:"",icon:"",share_with_team:!1}),t()}})},disabled:!m.name.trim()||g,className:"bg-app-background hover:bg-app-text-color border border-[#1F311C] hover:text-app-background text-app-text-color",children:g?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Category"})]})]})})}},92517:(e,a,t)=>{t.d(a,{A:()=>x});var n=t(95155),r=t(51344),i=t(73312),l=t(33900),o=t(37528),s=t(12115),d=t(65670),c=t(46754),m=t(35906),u=t(86968),p=t(76046),g=t(36821),h=t(55037);function x(e){var a,t,x;let{open:v,onClose:y,selectedCategory:f,mode:b="create",template:j}=e,N=(0,m.jE)(),[w,k]=(0,s.useState)({name:(null==j?void 0:j.name)||"",category:(null==j?void 0:j.categoryId)||f||"",description:(null==j?void 0:j.description)||"",image:null,imagePreview:(null==j?void 0:j.image_url)||""}),I=(0,p.useRouter)(),{data:C}=(0,d.E5)(),E=(null==C?void 0:null===(a=C.data)||void 0===a?void 0:a.categories)||[],{mutate:F,isPending:T}=(0,d.II)(),{mutate:_,isPending:P}=(0,d.ZD)(),{data:S,isLoading:M,isError:q}=(0,u.sb)(),D=null==S?void 0:null===(x=S.data)||void 0===x?void 0:null===(t=x.user)||void 0===t?void 0:t.workspace_id,{mutate:U,isPending:A}=(0,g.fU)();return(0,s.useEffect)(()=>{v&&("edit"===b&&j?k({name:j.name||"",category:j.categoryId||j.category||f||"",description:j.description||"",image:null,imagePreview:j.image_url||""}):k({name:"",category:f||"",description:"",image:null,imagePreview:""}))},[v,f,b,j]),(0,n.jsx)(r.lG,{open:v,onOpenChange:y,children:(0,n.jsxs)(r.Cf,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[(0,n.jsxs)(r.c7,{children:[(0,n.jsx)(r.L3,{className:"text-2xl font-bold",children:"edit"===b?"Edit Template":"Create New Template"}),(0,n.jsxs)(r.rr,{className:"text-gray-500 mt-2",children:["Fill in the details below to ","edit"===b?"update":"create a new"," form template"]})]}),(0,n.jsxs)("div",{className:"grid gap-6 py-6",children:[(0,n.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("label",{htmlFor:"name",className:"text-sm font-medium",children:["Template Name ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)(l.p,{id:"name",value:w.name,onChange:e=>k({...w,name:e.target.value}),placeholder:"Enter template name",className:"w-full"})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("label",{className:"text-sm font-medium",children:["Category ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)(o.l6,{value:w.category,onValueChange:e=>k({...w,category:e}),children:[(0,n.jsx)(o.bq,{children:(0,n.jsx)(o.yv,{placeholder:"Select a category"})}),(0,n.jsx)(o.gC,{children:E.map(e=>(0,n.jsx)(o.eb,{value:e.id,children:e.name},e.id))})]})]})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("label",{htmlFor:"description",className:"text-sm font-medium",children:["Description ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)(c.T,{id:"description",value:w.description,onChange:e=>k({...w,description:e.target.value}),placeholder:"Enter a detailed description of your template",className:"min-h-[100px]"})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("label",{htmlFor:"image",className:"text-sm font-medium",children:["Template Image ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)(l.p,{id:"image",type:"file",accept:"image/*",onChange:e=>{var a;let t=null===(a=e.target.files)||void 0===a?void 0:a[0];t&&k({...w,image:t,imagePreview:URL.createObjectURL(t)})},className:"cursor-pointer"}),(0,n.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Recommended: 1200x800px, Max size: 5MB"})]}),w.imagePreview&&(0,n.jsx)("div",{className:"w-32 h-32 rounded-lg overflow-hidden border border-gray-200",children:(0,n.jsx)("img",{src:w.imagePreview,alt:"Preview",className:"w-full h-full object-cover"})})]})]})]}),(0,n.jsxs)(r.Es,{className:"gap-3",children:[(0,n.jsx)(r.HM,{asChild:!0,children:(0,n.jsx)(i.$,{variant:"outline",className:"w-full sm:w-auto",children:"Cancel"})}),(0,n.jsx)(i.$,{type:"submit",disabled:!w.name||!w.category||!w.image&&!w.imagePreview||!w.description||T||A||P,onClick:()=>
1{if("edit"===b&&j){if(w.image){let e=new FormData;e.append("upload",w.image),U({formData:e,workspace_id:D},{onSuccess:e=>{var a;let t=null==e?void 0:null===(a=e.data)||void 0===a?void 0:a.fileUrl;_({templateId:j.id,data:{name:w.name,categoryId:w.category,description:w.description,image_url:t,template_data:j.template_data||{}}},{onSuccess:()=>{N.invalidateQueries(),y()},onError:e=>{console.error(e)}})}})}else _({templateId:j.id,data:{name:w.name,categoryId:w.category,description:w.description,image_url:w.imagePreview,template_data:j.template_data||{}}},{onSuccess:()=>{N.invalidateQueries(),y()},onError:e=>{console.error(e)}})}else{if(!w.image)return;let e=new FormData;e.append("upload",w.image),U({formData:e,workspace_id:D},{onSuccess:e=>{var a;let t=null==e?void 0:null===(a=e.data)||void 0===a?void 0:a.fileUrl;F({name:w.name,categoryId:w.category,description:w.description,image_url:t,template_data:{heading:"",header_img:"",description:"",type:""}},{onSuccess:e=>{var a,t,n,r,i,l;N.invalidateQueries({queryKey:["form-templates",w.category]});let o=(null==e?void 0:null===(t=e.data)||void 0===t?void 0:null===(a=t.template)||void 0===a?void 0:a.id)||(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.id)||(null==e?void 0:null===(r=e.data)||void 0===r?void 0:r.template_id)||(null==e?void 0:null===(i=e.data)||void 0===i?void 0:i.form_id)||(null==e?void 0:null===(l=e.template)||void 0===l?void 0:l.id)||(null==e?void 0:e.id);o?I.push("/playground?formId=".concat(o,"&formType=template")):(h.default.error("Template created, but ID not found in response."),console.error("Unrecognized createTemplate response format:",e)),y()},onError:e=>{console.error(e)}})}})}},className:"w-full sm:w-auto",children:T||A||P?(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"animate-spin",children:"⏳"}),T||A?"edit"===b?"Updating...":"Creating...":"Updating..."]}):"edit"===b?"Update Template":"Create Template"})]})]})})}},98986:(e,a,t)=>{t.d(a,{J:()=>d});var n=t(95155),r=t(12115),i=t(46195),l=t(31027),o=t(21567);let s=(0,l.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,n.jsx)(i.b,{ref:a,className:(0,o.cn)(s(),t),...r})});d.displayName=i.b.displayName},46754:(e,a,t)=>{t.d(a,{T:()=>l});var n=t(95155),r=t(12115),i=t(21567);let l=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,n.jsx)("textarea",{className:(0,i.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:a,...r})});l.displayName="Textarea"},46195:(e,a,t)=>{t.d(a,{b:()=>o});var n=t(12115),r=t(23360),i=t(95155),l=n.forwardRef((e,a)=>(0,i.jsx)(r.sG.label,{...e,ref:a,onMouseDown:a=>{var t;a.target.closest("button, input, select, textarea")||(null===(t=e.onMouseDown)||void 0===t||t.call(e,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));l.displayName="Label";var o=l},96758:(e,a,t)=>{t.d(a,{A:()=>n});let n=(0,t(14057).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},41983:(e,a,t)=>{t.d(a,{A:()=>n});let n=(0,t(14057).A)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},65686:(e,a,t)=>{t.d(a,{A:()=>n});let n=(0,t(14057).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},35524:(e,a,t)=>{t.d(a,{A:()=>n});let n=(0,t(14057).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
1],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])}}]);

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.