PageSourceSearch

https://app.knockknockapp.ai/assets/Edit-BfTVdxey.js

js knockknockapp.ai collected 2026-10-01 16:40:42 UTC 15,001 bytes, 1 lines download raw bytes

1import{w as K,l as d,m as i,q as e,B as c,z as U,u as l,J as g,K as y,Y as R,aa as n,ac as u,p as m,F as q,v as C,ag as _,ab as Q,y as S,e as P,a6 as G,b as H,a9 as J,_ as O}from"./vue-vendor-c0W5WEtO.js";import{u as W,b as k,c as j}from"./query-vendor-BMwEzNLN.js";import{b as Y,u as $,f as X}from"./agencies-Cx1f5h-X.js";import{g as Z,a as D}from"./agency-B4HKTNnW.js";import{t as E}from"./index-B2Yag7Gu.js";import{ac as ee,R as p,c as te,bh as ae}from"./ui-vendor-B7SopUXd.js";import"./date-vendor-HBGOQ70J.js";import"./twilio-DAuME2Y9.js";import"./charts-BVdrK9wF.js";import"./socket-Kk_l3rvZ.js";const re={class:"mb-6"},se={class:"mb-6"},le={class:"text-2xl font-bold text-gray-900 dark:text-white"},de={class:"mt-1 text-sm text-gray-600 dark:text-gray-400"},ie={key:0,class:"flex items-center justify-center rounded-lg border border-gray-200 bg-white py-12 dark:border-gray-700 dark:bg-gray-800"},oe={class:"text-center"},ne={key:1,class:"rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-900/50 dark:bg-red-900/20"},ge={class:"flex items-start gap-3"},ue={class:"mt-1 text-sm text-red-700 dark:text-red-300"},ye={class:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800"},ce={class:"grid gap-4 md:grid-cols-2"},me={class:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800"},be={class:"grid gap-4 md:grid-cols-2"},pe={class:"max-h-48 overflow-y-auto rounded-lg border border-gray-300 bg-white p-3 dark:border-gray-600 dark:bg-gray-700"},xe={key:0,class:"py-2 text-center"},_e={key:1,class:"text-sm text-gray-500"},ke=["value"],ve={class:"text-sm text-gray-700 dark:text-gray-300"},fe={class:"max-h-48 overflow-y-auto rounded-lg border border-gray-300 bg-white p-3 dark:border-gray-600 dark:bg-gray-700"},we={key:0,class:"py-2 text-center"},he={key:1,class:"text-sm text-gray-500"},Ae=["value"],Ve={class:"text-sm text-gray-700 dark:text-gray-300"},Ue={class:"text-xs text-gray-500"},qe={class:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800"},Ce={class:"grid gap-4 md:grid-cols-3"},Se={class:"flex items-center gap-3"},Pe={class:"flex cursor-pointer items-center gap-2"},Ee=["disabled"],ze={key:0},Ne=["disabled"],Te={key:0,class:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800"},Fe={class:"grid gap-4 md:grid-cols-2"},Le={key:1,class:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800"},Me={class:"grid gap-4 md:grid-cols-3"},Be={class:"flex items-center gap-4"},Ie=["disabled"],Xe={__name:"Edit",setup(Ke){const b=J(),z=O(),N=W(),o=P(()=>!!b.params.id),a=H({name:"",initial_ai_credits:1500,opening_wallet_transfer_usd:10,available_sub_accounts:0,agency_packages:[],agency_addons:[],trial:!1,trial_duration:0,trial_activated_at:"",go_high_level_install_version:"",first_name:"",email:"",password:""}),{isPending:T,isError:F,error:L,data:M}=k({queryKey:["admin","agencies",P(()=>b.params.id)],queryFn:()=>Y(b.params.id),enabled:o.value}),{isPending:v,data:f}=k({queryKey:["admin","agency-packages"],queryFn:()=>Z({pageSize:100}),select:s=>s.results||[]}),{isPending:w,data:h}=k({queryKey:["admin","agency-addons"],queryFn:()=>D({pageSize:100}),select:s=>s.results||[]});K(()=>M.value,s=>{s&&(a.name=s.name||"",a.initial_ai_credits=s.initial_ai_credits||1500,a.opening_wallet_transfer_usd=(s.opening_wallet_transfer_credits||1e3)/100,a.available_sub_accounts=s.available_sub_accounts||0,a.agency_packages=s.agency_packages||[],a.agency_addons=s.agency_addons||[],a.trial=s.trial||!1,a.trial_duration=s.trial_duration||0,a.trial_activated_at=s.trial_activated_at?new Date(s.trial_activated_at).toISOString().split("T")[0]:"",a.go_high_level_install_version=s.go_high_level_install_version||"")},{immediate:!0});const{isPending:A,mutate:B}=j({mutationFn:s=>o.value?$(b.params.id,s):X(s),onSuccess:()=>{N.invalidateQueries({queryKey:["admin","agencies"]}),E.success(o.value?"Agency updated successfully":"Agency created successfully"),z.push("/admin/agencies")},onError:s=>{E.error(s.response?.data?.message||"Failed to save agency")}}),I=()=>{const s={name:a.name,initial_ai_credits:a.initial_ai_credits,opening_wallet_transfer_credits:Math.round(Number(a.opening_wallet_transfer_usd)*100),available_sub_accounts:a.available_sub_accounts,agency_packages:a.agency_packages,agency_addons:a.agency_addons,tri
1al:a.trial,trial_duration:a.trial_duration};o.value&&a.trial_activated_at&&(s.trial_activated_at=a.trial_activated_at),o.value&&(s.go_high_level_install_version=a.go_high_level_install_version),o.value||(s.first_name=a.first_name,s.email=a.email,s.password=a.password),B(s)};return(s,t)=>{const V=G("router-link");return d(),i("div",null,[e("div",re,[c(V,{to:"/admin/agencies",class:"inline-flex items-center gap-2 text-sm font-medium text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white"},{default:U(()=>[c(l(ee),{size:16}),t[13]||(t[13]=g(" Back to Agencies ",-1))]),_:1})]),e("div",se,[e("h1",le,y(o.value?"Edit Agency":"Create Agency"),1),e("p",de,y(o.value?"Update agency details and settings":"Create a new agency account"),1)]),o.value&&(l(T)||l(v)||l(w))?(d(),i("div",ie,[e("div",oe,[c(l(p),{size:32,class:"mx-auto animate-spin text-gray-400 dark:text-gray-600"}),t[14]||(t[14]=e("p",{class:"mt-4 text-sm text-gray-600 dark:text-gray-400"},"Loading agency...",-1))])])):o.value&&l(F)?(d(),i("div",ne,[e("div",ge,[c(l(te),{size:20,class:"text-red-600"}),e("div",null,[t[15]||(t[15]=e("h3",{class:"font-medium text-red-900 dark:text-red-400"},"Error Loading Agency",-1)),e("p",ue,y(l(L)?.message||"An error occurred while loading agency details"),1)])])])):(d(),i("form",{key:2,onSubmit:R(I,["prevent"]),class:"space-y-6"},[e("div",ye,[t[21]||(t[21]=e("h2",{class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},"Agency Information",-1)),e("div",ce,[e("div",null,[t[16]||(t[16]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"},[g(" Name "),e("span",{class:"text-red-500"},"*")],-1)),n(e("input",{"onUpdate:modelValue":t[0]||(t[0]=r=>a.name=r),type:"text",placeholder:"Agency name",class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 placeholder-gray-500 focus:ring-2 focus:ring-teal-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400",required:""},null,512),[[u,a.name]])]),e("div",null,[t[17]||(t[17]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"},[g(" Initial AI Credits "),e("span",{class:"text-red-500"},"*")],-1)),n(e("input",{"onUpdate:modelValue":t[1]||(t[1]=r=>a.initial_ai_credits=r),type:"number",min:"0",class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 focus:ring-2 focus:ring-teal-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white",required:""},null,512),[[u,a.initial_ai_credits,void 0,{number:!0}]])]),e("div",null,[t[18]||(t[18]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"},[g(" Opening Wallet Transfer ($) "),e("span",{class:"text-red-500"},"*")],-1)),n(e("input",{"onUpdate:modelValue":t[2]||(t[2]=r=>a.opening_wallet_transfer_usd=r),type:"number",min:"1",step:"0.01",class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 focus:ring-2 focus:ring-teal-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white",required:""},null,512),[[u,a.opening_wallet_transfer_usd,void 0,{number:!0}]]),t[19]||(t[19]=e("p",{class:"mt-1 text-xs text-gray-500 dark:text-gray-400"}," Default and minimum an agency moves to a new client's wallet on Add Client. ",-1))]),e("div",null,[t[20]||(t[20]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"}," Available Sub-Accounts ",-1)),n(e("input",{"onUpdate:modelValue":t[3]||(t[3]=r=>a.available_sub_accounts=r),type:"number",min:"0",class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 focus:ring-2 focus:ring-teal-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white"},null,512),[[u,a.available_sub_accounts,void 0,{number:!0}]])])])]),e("div",me,[t[24]||(t[24]=e("h2",{class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},"Packages & Addons",-1)),e("div",be,[e("div",null,[t[22]||(t[22]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"}," Agency Packages ",-1)),e("div",pe,[l(v)?(d(),i("div",xe,[c(l(p),{size:16,class:"mx-auto animate-spin text-gray-400"})])):l(f)?.length?m("",!0):(d(),i("div",_e," No packages available ")),(d(!0),i(q,null,C(l(f),r=>(d(),i("label",{key:r._id,class:"flex cursor-pointer items-center gap-2 py-1.5"},[n(e("input",{type:"checkbox",value:r._id,"onUpdate:modelValue":t[4]||(t[4]=x=>
1a.agency_packages=x),class:"h-4 w-4 rounded border-gray-300 text-teal-500 focus:ring-teal-500"},null,8,ke),[[_,a.agency_packages]]),e("span",ve,y(r.name),1)]))),128))])]),e("div",null,[t[23]||(t[23]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"},[g(" Agency Addons "),e("span",{class:"text-xs font-normal text-gray-400 dark:text-gray-500"}," (Leave empty for all public addons) ")],-1)),e("div",fe,[l(w)?(d(),i("div",we,[c(l(p),{size:16,class:"mx-auto animate-spin text-gray-400"})])):l(h)?.length?m("",!0):(d(),i("div",he," No addons available ")),(d(!0),i(q,null,C(l(h),r=>(d(),i("label",{key:r._id,class:"flex cursor-pointer items-center gap-2 py-1.5"},[n(e("input",{type:"checkbox",value:r._id,"onUpdate:modelValue":t[5]||(t[5]=x=>a.agency_addons=x),class:"h-4 w-4 rounded border-gray-300 text-teal-500 focus:ring-teal-500"},null,8,Ae),[[_,a.agency_addons]]),e("span",Ve,[g(y(r.name)+" ",1),e("span",Ue," ("+y(r.visibility)+" / "+y(r.status)+") ",1)])]))),128))])])])]),e("div",qe,[t[28]||(t[28]=e("h2",{class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},"Trial Settings",-1)),e("div",Ce,[e("div",Se,[e("label",Pe,[n(e("input",{"onUpdate:modelValue":t[6]||(t[6]=r=>a.trial=r),type:"checkbox",class:"h-4 w-4 rounded border-gray-300 text-teal-500 focus:ring-teal-500"},null,512),[[_,a.trial]]),t[25]||(t[25]=e("span",{class:"text-sm font-medium text-gray-700 dark:text-gray-300"}," Enable Trial ",-1))])]),e("div",null,[t[26]||(t[26]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"}," Trial Duration (days) ",-1)),n(e("input",{"onUpdate:modelValue":t[7]||(t[7]=r=>a.trial_duration=r),type:"number",min:"0",disabled:!a.trial,class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 focus:ring-2 focus:ring-teal-500 focus:outline-none disabled:opacity-50 dark:border-gray-600 dark:bg-gray-700 dark:text-white"},null,8,Ee),[[u,a.trial_duration,void 0,{number:!0}]])]),o.value?(d(),i("div",ze,[t[27]||(t[27]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"}," Trial Activated At ",-1)),n(e("input",{"onUpdate:modelValue":t[8]||(t[8]=r=>a.trial_activated_at=r),type:"date",disabled:!a.trial,class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 focus:ring-2 focus:ring-teal-500 focus:outline-none disabled:opacity-50 dark:border-gray-600 dark:bg-gray-700 dark:text-white"},null,8,Ne),[[u,a.trial_activated_at]])])):m("",!0)])]),o.value?(d(),i("div",Te,[t[32]||(t[32]=e("h2",{class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},"Integrations",-1)),e("div",Fe,[e("div",null,[t[30]||(t[30]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"}," GoHighLevel App Version ",-1)),n(e("select",{"onUpdate:modelValue":t[9]||(t[9]=r=>a.go_high_level_install_version=r),class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 focus:ring-2 focus:ring-teal-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white"},[...t[29]||(t[29]=[e("option",{value:""},"Default (global setting)",-1),e("option",{value:"v1"},"v1 (original app)",-1),e("option",{value:"v2"},"v2 (new app)",-1)])],512),[[Q,a.go_high_level_install_version]]),t[31]||(t[31]=e("p",{class:"mt-1 text-xs text-gray-500 dark:text-gray-400"}," Which GoHighLevel marketplace app this agency and its clients install/reconnect with. Already-connected accounts are unchanged until they reconnect. ",-1))])])])):m("",!0),o.value?m("",!0):(d(),i("div",Le,[t[36]||(t[36]=e("h2",{class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"}," Agency User Account ",-1)),e("div",Me,[e("div",null,[t[33]||(t[33]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"},[g(" User's Name "),e("span",{class:"text-red-500"},"*")],-1)),n(e("input",{"onUpdate:modelValue":t[10]||(t[10]=r=>a.first_name=r),type:"text",placeholder:"John Doe",class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 placeholder-gray-500 focus:ring-2 focus:ring-teal-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400",required:""},null,512),[[u,a.first_name]])]),e("div",null,[t[34]||(t[34]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"},[g(" Email "),e("span",{class:"text-red-500"},"*")],-1)),n(e("input",{"onUpdate:modelValue":t[11]||(t[11]=r=>a.email=r),type:"email",placeholder:"[email protected]",class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 placeholder-gray-500 focus:ring-2 focus:ring-teal-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400",required:""},null,512),[[u,a.email]])]),e("div",null,[t[35]||(t[35]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"},[g(" Password "),e("span",{class:"text-red-500"},"*")],-1)),n(e("input",{"onUpdate:modelValue":t[12]||(t[12]=r=>a.password=r),type:"password",placeholder:"********",class:"w-full rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 placeholder-gray-500 focus:ring-2 focus:ring-teal-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400",required:""},null,512),[[u,a.password]])])])])),e("div",Be,[e("button",{type:"submit",disabled:l(A),class:"inline-flex items-center gap-2 rounded-lg bg-teal-500 px-6 py-2.5 text-sm font-medium text-white transition-colors hover:bg-teal-600 disabled:cursor-not-allowed disabled:opacity-50"},[l(A)?(d(),S(l(p),{key:0,size:16,class:"animate-spin"})):(d(),S(l(ae),{key:1,size:16}
1)),g(" "+y(o.value?"Update Agency":"Create Agency"),1)],8,Ie),c(V,{to:"/admin/agencies",class:"inline-flex items-center gap-2 rounded-lg bg-gray-100 px-6 py-2.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"},{default:U(()=>[...t[37]||(t[37]=[g(" Cancel ",-1)])]),_:1})])],32))])}}};export{Xe 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.