1import{r,e as g,t as i,j as e}from"./edge-BOITG1XR.js";import{L as u}from"./mod-DxqX0N6D.js";import{R as f}from"./mod-RPxq32x0.js";import{V as N}from"./mod-RgRA0Qxw.js";import{E as h}from"./mod-B_npTkgx.js";import{K as _}from"./mod-BBgDTOoh.js";import{T as b,a as y}from"./mod-BaZPqQwn.js";import{S as w}from"./mod-C9xhOiHj.js";const T=[{key:"tiktok",label:"TikTok",color:"bg-black",badge:"Short-form",badgeColor:"bg-slate-100 text-slate-700",desc:"Auto-post generated videos to TikTok for Business",tokenKey:"tiktok_access_token",tokenLabel:"TikTok Access Token",tokenPlaceholder:"Paste your TikTok Business access token...",docsUrl:"https://developers.tiktok.com",enabledKey:"tiktok_enabled"},{key:"instagram",label:"Instagram",color:"bg-gradient-to-r from-pink-500 to-yellow-400",badge:"Reels",badgeColor:"bg-pink-100 text-pink-700",desc:"Publish as Instagram Reels via the Graph API",tokenKey:"instagram_access_token",tokenLabel:"Instagram Access Token",tokenPlaceholder:"EAA... (Graph API long-lived token)",extraKey:"instagram_account_id",extraLabel:"Instagram Business Account ID",extraPlaceholder:"17841...",docsUrl:"https://developers.facebook.com/docs/instagram-api",enabledKey:"instagram_enabled"},{key:"youtube",label:"YouTube",color:"bg-red-600",badge:"Shorts",badgeColor:"bg-red-100 text-red-700",desc:"Upload as YouTube Shorts via Data API v3",tokenKey:"youtube_access_token",tokenLabel:"YouTube OAuth2 Access Token",tokenPlaceholder:"ya29...",docsUrl:"https://developers.google.com/youtube/v3",enabledKey:"youtube_enabled"}],p={creatomate_api_key:"",creatomate_template_id:"",tiktok_access_token:"",instagram_access_token:"",instagram_account_id:"",youtube_access_token:"",video_auto_generate:"0",video_tiktok_enabled:"0",video_instagram_enabled:"0",video_youtube_enabled:"0"};function E(){const[a,l]=r.useState(p),[v,c]=r.useState(!0),[n,d]=r.useState(!1);r.useEffect(()=>{x()},[]);const x=async()=>{c(!0);try{const s=await g.get("/admin/video-settings");l({...p,...s.data})}catch{i.error("Failed to load video settings")}finally{c(!1)}},o=(s,t)=>l(k=>({...k,[s]:t})),m=s=>l(t=>({...t,[s]:t[s]==="1"?"0":"1"})),j=async()=>{d(!0);try{await g.put("/admin/video-settings",a),i.success("Video settings saved")}catch{i.error("Failed to save settings")}finally{d(!1)}};return v?e.jsx("div",{className:"flex items-center justify-center min-h-96",children:e.jsx(u,{className:"h-8 w-8 animate-spin text-violet-600"})}):e.jsxs("div",{className:"p-6 space-y-6 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Video Settings"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Configure AI video generation and social media publishing"})]}),e.jsxs("button",{onClick:x,className:"flex items-center gap-2 px-3 py-2 border border-gray-200 rounded-lg text-sm text-gray-600 hover:bg-gray-50 transition-colors",children:[e.jsx(f,{className:"h-4 w-4"}),"Refresh"]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-5",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 pb-4",children:[e.jsx("div",{className:"p-2 bg-violet-100 rounded-lg",children:e.jsx(N,{className:"h-5 w-5 text-violet-600"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold text-gray-900",children:"Creatomate â AI Video Generator"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Renders product slideshows into TikTok/Reels-style videos"})]}),e.jsxs("a",{href:"https://creatomate.com",target:"_blank",rel:"noreferrer",className:"ml-auto flex items-center gap-1 text-xs text-violet-600 hover:underline",children:["Get API Key ",e.jsx(h,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:[e.jsx(_,{className:"inline h-3.5 w-3.5 mr-1 text-gray-400"}),"API Key ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"password",value:a.creatomate_api_key,onChange:s=>o("creatomate_api_key",s.target.value),placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",className:"w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-violet-500"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Found in your Creatomate dashboard â Settings â API Keys"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:["Template ID ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:a.creatomate_template_id,onChange:s=>o("creatomate_template_id",s.target.value),placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",className:"w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-violet-500"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"The video template ID from Creatomate's template library. Use a product-slideshow template (9:16 ratio for Reels/TikTok)."})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:"Auto-generate on product create"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Automatically create a video whenever a new product is published"})]}),e.jsx("button",{onClick:()=>m("video_auto_generate"),className:"flex-shrink-0",children:a.video_auto_generate==="1"?e.jsx(b,{className:"h-8 w-8 text-violet-600"}):e.jsx(y,{className:"h-8 w-8 text-gray-400"})})]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-5",children:[e.jsxs("div",{className:"border-b border-gray-100 pb-4",children:[e.jsx("h2",{className:"font-semibold text-gray-900",children:"Social Media Publishing"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Connect platforms to auto-post generated videos"})]}),e.jsx("div",{className:"space-y-5",children:T.map(s=>e.jsxs("div",{className:"border border-gray-100 rounded-xl p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center text-white text-xs font-bold ${s.color}`,children:s.label[0]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:s.label}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${s.badgeColor}`,children:s.badge})]}),e.jsx("p",{className:"text-xs text-gray-500",children:s.desc})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:s.docsUrl,target:"_blank",rel:"noreferrer",className:"text-xs text-violet-600 hover:underline flex items-center gap-0.5",children:["Docs ",e.jsx(h,{className:"h-3 w-3"})]}),e.jsx("button",{onClick:()=>m(s.enabledKey),children:a[s.enabledKey]==="1"?e.jsx(b,{className:"h-7 w-7 text-violet-600"}):e.jsx(y,{className:"h-7 w-7 text-gray-400"})})]})]}),e.jsxs("div",{className:"space-y-3 pt-1",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:s.tokenLabel}),e.jsx("input",{type:"password",value:a[s.tokenKey]||"",onChange:t=>o(s.tokenKey,t.target.value),placeholder:s.tokenPlaceholder,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-violet-500"})]}),s.extraKey&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:s.extraLabel}),e.jsx("input",{type:"text",value:a[s.extraKey]||"",onChange:t=>o(s.extraKey,t.target.value),placeholder:s.extraPlaceholder,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-violet-500"})]})]})]},s.key))})]}),e.jsx("div",{className:"sticky bottom-4",children:e.jsxs("button",{onClick:j,disabled:n,className:"w-full flex items-center justify-center gap-2 py-3 bg-violet-600 hover:bg-violet-700 disabled:opacity-60 text-white rounded-xl font-semibold text-sm shadow-lg transition-colors",children:[n?e.jsx(u,{className:"h-4 w-4 animate-spin"}):e.jsx(w,{className:"h-4 w-4"}),n?"Saving...":"Save Video Settings"]})})]})}export{E as default};
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.