PageSourceSearch

https://askfrom.ai/_next/static/chunks/8476.e400578fbb2177e8.js

js askfrom.ai collected 2026-10-05 13:01:01 UTC 13,356 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8476],{18476:function(e,t,a){a.r(t),a.d(t,{default:function(){return g}});var r=a(27573),s=a(7653),l=a(75721),n=a(34078),i=a(86548),c=a(90743),d=a(83483),o=a(3172),m=a(30609),x=a(24875),u=a(97066),h=a(31686),p=a(34863),f=a(10997);function g(e){let{projectId:t}=e,[a,g]=(0,s.useState)([]),[b,j]=(0,s.useState)(""),[y,N]=(0,s.useState)(!0),[w,v]=(0,s.useState)(!1),[k,Z]=(0,s.useState)(""),[C,D]=(0,s.useState)(null),S="/api/v1/integrations/cloudflare",A=async()=>{if(t){try{let e=await fetch("".concat(S,"/domains?project_id=").concat(t),{credentials:"include"});if(e.ok){let t=await e.json();g(t||[])}}catch(e){console.error("Failed to fetch domains:",e)}N(!1)}};(0,s.useEffect)(()=>{t&&A()},[t]);let M=async e=>{if(e.preventDefault(),b.trim()&&t){v(!0),Z("");try{let e=await fetch("".concat(S,"/domains?project_id=").concat(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({domain:b.trim()})});if(e.ok)j(""),A();else{let t=await e.json();Z(t.detail||"Failed to add domain")}}catch(e){Z("Failed to add domain")}v(!1)}},_=async e=>{try{(await fetch("".concat(S,"/domains/").concat(e,"?project_id=").concat(t),{method:"DELETE",credentials:"include"})).ok&&A()}catch(e){console.error("Failed to remove domain:",e)}D(null)},L=async e=>{try{(await fetch("".concat(S,"/domains/").concat(e,"/toggle?project_id=").concat(t),{method:"PATCH",credentials:"include"})).ok&&A()}catch(e){console.error("Failed to toggle domain:",e)}};if(!t)return(0,r.jsx)("div",{className:"flex justify-center py-12",children:(0,r.jsx)(l.Z,{className:"w-8 h-8 animate-spin text-muted-foreground"})});let F=[{icon:n.Z,title:"Custom Domains",desc:"Use your own domain name"},{icon:i.Z,title:"Free SSL",desc:"Automatic HTTPS certificates"},{icon:c.Z,title:"Global CDN",desc:"Fast loading worldwide"}];return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-12 h-12 bg-gradient-to-br from-orange-500 to-amber-500 rounded-xl flex items-center justify-center shadow-lg",children:(0,r.jsx)(d.Z,{className:"w-6 h-6 text-white"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Custom Domains"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connect your domain to this project"})]})]}),a.length>0&&(0,r.jsxs)("span",{className:"px-3 py-1 bg-green-100 text-green-700 rounded-full text-sm",children:[a.length," domain",a.length>1?"s":""," connected"]})]}),!y&&0===a.length&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-r from-orange-600 via-amber-500 to-yellow-500 p-8 text-white",children:[(0,r.jsxs)("div",{className:"relative z-10",children:[(0,r.jsx)("h3",{className:"text-2xl font-bold mb-2",children:"Use Your Own Domain"}),(0,r.jsx)("p",{className:"text-white/90 mb-4 max-w-xl",children:"Connect a custom domain to your project. We support domains managed via Cloudflare or any other DNS provider. SSL certificates are configured automatically."}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)("span",{className:"px-3 py-1 bg-white/20 rounded-full text-sm",children:"\uD83C\uDF10 Custom Domain"}),(0,r.jsx)("span",{className:"px-3 py-1 bg-white/20 rounded-full text-sm",children:"\uD83D\uDD12 Free SSL"}),(0,r.jsx)("span",{className:"px-3 py-1 bg-white/20 rounded-full text-sm",children:"⚡ Auto Setup"})]})]}),(0,r.jsx)("div",{className:"absolute right-0 top-0 w-64 h-64 bg-white/10 rounded-full blur-3xl -mr-32 -mt-32"})]}),(0,r.jsx)("div",{className:"grid sm:grid-cols-3 gap-4",children:F.map(e=>(0,r.jsxs)("div",{className:"border border-border rounded-xl p-4 text-center",children:[(0,r.jsx)(e.icon,{className:"w-8 h-8 mx-auto mb-2 text-orange-500"}),(0,r.jsx)("h4",{className:"font-semibold",children:e.title}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e.desc})]},e.title))}),(0,r.jsxs)("div",{className:"border border-amber-200 bg-amber-50/50 dark:bg-amber-950/20 dark:border-amber-800 rounded-xl p-4",children:[(0,r.jsx)("h4",{className:"font-semibold text-amber-800 dark:text-amber-300 mb-2",children:"\uD83D\uDCCB How to connect"}),(0,r.jsxs)("ul",{className:"text-sm text-amber-700 dark:text-amber-400 space-y-1",children:[(0,r.jsxs)("li",{children:["• Point your domain's A record to ",(0,r.jsx)("strong",{children:"37.27.195.5"})]}),(0,r.jsx)("li",{children:"• Enter the domain below (example.com or app.example.com)"}),(0,r.jsx)("li",{children:"• SSL certificate will be configured automatically"}),(0,r.jsx)("li",{children:"• Works with Cloudflare, GoDaddy, Namecheap, or any DNS provider"})]})]})]}),(0,r.jsxs)("form",{onSubmit:M,className:"border border-border rounded-xl p-4",children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Add Domain"}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("input",{type:"text",value:b,onChange:e=>j(e.target.value),placeholder:"example.com or app.example.com",className:"flex-1 p-3 border border-input rounded-lg bg-background"}),(0,r.jsxs)("button",{type:"submit",disabled:w||!b.trim(),className:"py-3 px-6 bg-orange-600 text-white rounded-lg font-medium hover:bg-orange-700 disabled:opacity-50 flex items-center gap-2",children:[w?(0,r.jsx)(l.Z,{className:"w-4 h-4 animate-spin"}):(0,r.jsx)(o.Z,{className:"w-4 h-4"}),w?"Setting up...":"Add Domain"]})]}
1),k&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-3 text-red-600 text-sm",children:[(0,r.jsx)(m.Z,{className:"w-4 h-4"}),k]})]}),C&&(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-background border border-border rounded-xl p-6 max-w-md w-full mx-4",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Delete Domain"}),(0,r.jsxs)("p",{className:"text-muted-foreground mb-4",children:["Are you sure you want to remove ",(0,r.jsx)("strong",{children:C.name}),"? This will remove the domain and its SSL certificate."]}),(0,r.jsxs)("div",{className:"flex gap-3 justify-end",children:[(0,r.jsx)("button",{onClick:()=>D(null),className:"py-2 px-4 border border-input rounded-lg hover:bg-muted",children:"Cancel"}),(0,r.jsx)("button",{onClick:()=>_(C.id),className:"py-2 px-4 bg-red-600 text-white rounded-lg hover:bg-red-700",children:"Delete"})]})]})}),y?(0,r.jsx)("div",{className:"flex justify-center py-8",children:(0,r.jsx)(l.Z,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):a.length>0?(0,r.jsx)("div",{className:"border border-border rounded-xl overflow-hidden",children:(0,r.jsxs)("table",{className:"w-full",children:[(0,r.jsx)("thead",{className:"bg-muted/50",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"text-left py-3 px-4 font-semibold",children:"Domain"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 font-semibold",children:"Type"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 font-semibold",children:"Status"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 font-semibold",children:"Added"}),(0,r.jsx)("th",{className:"text-right py-3 px-4 font-semibold",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:a.map(e=>(0,r.jsxs)("tr",{className:"border-t border-border",children:[(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(n.Z,{className:"w-4 h-4 text-muted-foreground"}),(0,r.jsxs)("a",{href:"https://".concat(e.domain),target:"_blank",rel:"noopener noreferrer",className:"font-medium hover:text-orange-600 flex items-center gap-1",children:[e.domain,(0,r.jsx)(x.Z,{className:"w-3 h-3"})]})]})}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ".concat("cloudflare"===e.type?"bg-orange-100 text-orange-700":"bg-blue-100 text-blue-700"),children:"cloudflare"===e.type?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{className:"w-3 h-3"}),"Cloudflare"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{className:"w-3 h-3"}),"SSL"]})})}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ".concat(e.is_active?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"),children:[e.is_active?(0,r.jsx)(u.Z,{className:"w-3 h-3"}):null,e.is_active?"Active":"Inactive"]})}),(0,r.jsx)("td",{className:"py-3 px-4 text-muted-foreground text-sm",children:new Date(e.created_at).toLocaleDateString()}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,r.jsx)("button",{onClick:()=>L(e.id),className:"p-2 hover:bg-muted rounded-lg",title:e.is_active?"Disable":"Enable",children:e.is_active?(0,r.jsx)(h.Z,{className:"w-5 h-5 text-green-600"}):(0,r.jsx)(p.Z,{className:"w-5 h-5 text-muted-foreground"})}),(0,r.jsx)("button",{onClick:()=>D({id:e.id,name:e.domain}),className:"p-2 hover:bg-muted rounded-lg text-red-600",title:"Delete",children:(0,r.jsx)(f.Z,{className:"w-5 h-5"})})]})})]},e.id))})]})}):null]})}},2389:function(e,t,a){a.d(t,{Z:function(){return m}});var r=a(7653);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,a)=>a?a.toUpperCase():t.toLowerCase()),n=e=>{let t=l(e);return t.charAt(0).toUpperCase()+t.slice(1)},i=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter((e,t,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim()},c=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var d={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:n,className:o="",children:m,iconNode:x,...u}=e;return(0,r.createElement)("svg",{ref:t,...d,width:s,height:s,stroke:a,strokeWidth:n?24*Number(l)/Number(s):l,className:i("lucide",o),...!m&&!c(u)&&{"aria-hidden":"true"},...u},[...x.map(e=>
1{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(m)?m:[m]])}),m=(e,t)=>{let a=(0,r.forwardRef)((a,l)=>{let{className:c,...d}=a;return(0,r.createElement)(o,{ref:l,iconNode:t,className:i("lucide-".concat(s(n(e))),"lucide-".concat(e),c),...d})});return a.displayName=n(e),a}},30609:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},97066:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},83483:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]])},24875:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},34078:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},75721:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},3172:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},86548:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},34863:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]])},31686:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]])},10997:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},90743:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(2389).Z)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}}]);

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.