PageSourceSearch

https://app.wecantrack.com/wct-app/assets/Setup-ROOrz34b.js

js wecantrack.com collected 2026-10-02 03:13:11 UTC 17,097 bytes, 1 lines download raw bytes

1import{d as j,T as H,c as O,w as S,a as e,b as P,u as a,i as T,P as h,t as i,o as l,e as n,g as d,j as q,k as m,F as V,r as N,f as c,l as C,n as f,v as z,s as K,m as Q,q as v,h as U,N as W,Q as X}from"./wct-app-zVoOyqoJ.js";import{F as Z}from"./FullLayout-BBdw16bv.js";import"./auth.store-DGjXzvfG.js";import"./common.store-CaiisVSK.js";import"./auth.service-DT1Z-eBl.js";import"./Header-CVlVgCk3.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./DynamicHeroIcon-RtlqcllT.js";import"./ShieldCheckIcon-DX5I4eE8.js";import"./ExclamationCircleIcon-D3seTqzk.js";import"./FunnelIcon-NuGtbFHR.js";import"./CheckCircleIcon-tJp7k4qQ.js";import"./ChevronDownIcon-CZfG2Avm.js";import"./ChevronRightIcon-i1AkBnM5.js";import"./LinkIcon-D5VYdLA3.js";import"./CogIcon-BkQy7RXp.js";import"./DocumentTextIcon-CINr7rjU.js";import"./ExclamationTriangleIcon-fzphjkuy.js";import"./InformationCircleIcon-DEU9wywc.js";import"./MagnifyingGlassIcon-CX-_6uQF.js";import"./PlusIcon-C88m3W7y.js";import"./WrenchScrewdriverIcon-DFrP9z1h.js";import"./TableCellsIcon-DAD8p38B.js";import"./UserGroupIcon-B-pr3QHb.js";import"./XMarkIcon-CGg_meYD.js";import"./format-Grfp2_uY.js";import"./Loading-B8sjktwd.js";import"./ModalBlank-AAGEETCW.js";const ee={class:"min-h-screen bg-gray-50 dark:bg-gray-900"},te={class:"bg-white dark:bg-gray-800 shadow-sm"},oe={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6"},ae={class:"flex items-center gap-3"},re={class:"text-2xl font-semibold text-gray-900 dark:text-white"},se={class:"mt-1 text-sm text-gray-600 dark:text-gray-400"},le={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"},ne={key:0,class:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6"},ie={class:"flex items-start"},de={class:"ml-3"},ue={class:"mt-1 text-sm text-green-700 dark:text-green-300"},ce={key:1,class:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-6"},me={class:"flex items-start"},pe={class:"ml-3"},ve={class:"mt-1 text-sm text-blue-700 dark:text-blue-300"},ye={key:2,class:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mb-6"},fe={class:"flex items-start"},ge={class:"ml-3"},be={class:"mt-1 text-sm text-red-700 dark:text-red-300"},xe={class:"bg-white dark:bg-gray-800 rounded-lg shadow border border-gray-200 dark:border-gray-700"},_e=["value"],ke=["value"],he={class:"p-6 space-y-6"},Ce={key:0,class:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-lg p-4 mb-2"},Ae={class:"flex items-start"},we={class:"ml-3 flex-1"},Se=["value"],ze={key:0,class:"text-gray-500"},Ue={class:"mt-2 text-xs text-blue-700 dark:text-blue-300"},Me=["placeholder"],De={key:0,class:"mt-1 text-sm text-red-500"},Be={key:1},Ee={for:"platform_account_id",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Pe=["placeholder"],Te={key:0,class:"mt-1 text-sm text-red-500"},Ve={class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},Ne=["for"],Fe=["id","onUpdate:modelValue","type","placeholder","autocomplete"],Ie={key:0,class:"mt-1 text-sm text-red-500"},Le={class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},$e={key:2},Ye=["disabled"],Re={key:0},Ge={key:1},Je={key:0,class:"mt-1 text-sm text-red-500"},je={key:3},He={key:0,class:"mt-1 text-sm text-red-500"},Oe={key:0,class:"mt-1 text-sm text-red-500"},qe={key:0,class:"mt-1 text-sm text-red-500"},Ke={class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},Qe={class:"flex items-center"},We={class:"px-6 py-4 bg-gray-50 dark:bg-gray-900/20 border-t border-gray-200 dark:border-gray-700"},Xe={class:"flex items-center justify-between"},Ze=["disabled"],et={key:0},tt={key:1},Dt=j({__name:"Setup",props:{platform:{},platformConfig:{},hasTokens:{type:Boolean},availableAccounts:{}},setup(p){const u=p,F=X(),y=v(()=>u.platformConfig.name||u.platform),I=v(()=>`Setup ${y.value} Account › Paid Advertising`),M=v(()=>u.platformConfig.auth_type==="pat"),g=v(()=>u.platformConfig.credential_fields??[]),b=v(()=>u.platformConfig.account_id_field),L=v(()=>u.platformConfig.supports_account_picker),D={authorization_method:u.platformConfig.auth_type};for(const r of g.value)D[r.key]="";const o=H({user_defined_name:"",platform_account_id:"",manager_account_id:"",currency_code:"USD",timezone:"UTC",country_code:"",is_enabled:!0,platform_id:u.platform,credentials:D}),B=v(()=>{const r=F.props.errors;return r&&r.message?r.message:null});function A(r){return o.errors[`credentials.${r}`]}const $=v(()=>g.value.every(r=>!!o.credentials[r.key]?.trim())),x=U(!1),_=U(null);function Y(){x.value=!0,_.value=null;const r={};for(const t of g.value)r[t.key]=o.credentials[t.key];W.post(h("user.data-source.ad-platforms.verify-credentials",{platform:u.platform}),{credentials:r},{preserveScroll:!0,preserveState:!0,only:["availableAccounts","errors","flash"],onError:t=>{_.value=t.message??Object.values(t)[0]??"Failed to verify credentials."},onFinish:()=>{x.value=!1}})}const w=U("");function R(){const r=u.availableAccounts?.find(t=>
1t.id===w.value);r&&(o.platform_account_id=k(r.id),o.user_defined_name=r.name||`Account ${k(r.id)}`,r.currency&&(o.currency_code=r.currency),r.timezone&&(o.timezone=r.timezone),o.manager_account_id=r.manager_id?k(r.manager_id):"")}function E(r){return r&&r.replace(/-/g,"")}function k(r){return r&&r.length===10&&/^\d+$/.test(r)?`${r.substring(0,3)}-${r.substring(3,6)}-${r.substring(6)}`:r}function G(){const r={...o.data(),platform_account_id:E(o.platform_account_id),manager_account_id:o.manager_account_id?E(o.manager_account_id):""};o.transform(()=>r).post(h("user.data-source.ad-platforms.store"))}return(r,t)=>(l(),O(Z,{title:I.value},{default:S(()=>[e("div",ee,[e("div",te,[e("div",oe,[e("div",ae,[P(a(T),{href:a(h)("user.data-source.ad-platforms.index"),class:"p-2 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:"Back to accounts"},{default:S(()=>[...t[8]||(t[8]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),_:1},8,["href"]),e("div",null,[e("h1",re," Setup "+i(y.value)+" Account ",1),e("p",se," Complete the setup for your "+i(y.value)+" account ",1)])])])]),e("div",le,[p.hasTokens?(l(),n("div",ne,[e("div",ie,[t[10]||(t[10]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})])],-1)),e("div",de,[t[9]||(t[9]=e("h3",{class:"text-sm font-medium text-green-800 dark:text-green-200"}," Authorization Successful! ",-1)),e("p",ue," Your "+i(y.value)+" account has been authorized. Please complete the setup below. ",1)])])])):d("",!0),M.value?(l(),n("div",ce,[e("div",me,[t[12]||(t[12]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-5 w-5 text-blue-400",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z","clip-rule":"evenodd"})])],-1)),e("div",pe,[t[11]||(t[11]=e("h3",{class:"text-sm font-medium text-blue-800 dark:text-blue-200"}," API credentials required ",-1)),e("p",ve,i(y.value)+" does not use OAuth. Enter the credentials below — they are stored encrypted and never displayed back to you. ",1)])])])):d("",!0),B.value?(l(),n("div",ye,[e("div",fe,[t[14]||(t[14]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z","clip-rule":"evenodd"})])],-1)),e("div",ge,[t[13]||(t[13]=e("h3",{class:"text-sm font-medium text-red-800 dark:text-red-200"}," Connection Failed ",-1)),e("p",be,i(B.value),1)])])])):d("",!0),e("div",xe,[e("form",{onSubmit:q(G,["prevent"])},[e("input",{type:"hidden",name:"platform_id",value:a(o).platform_id},null,8,_e),e("input",{type:"hidden",name:"credentials[authorization_method]",value:a(o).credentials.authorization_method},null,8,ke),e("div",he,[p.availableAccounts&&p.availableAccounts.length>0?(l(),n("div",Ce,[e("div",Ae,[t[17]||(t[17]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-5 w-5 text-blue-400",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z","clip-rule":"evenodd"})])],-1)),e("div",we,[t[16]||(t[16]=e("h4",{class:"text-sm font-medium text-blue-800 dark:text-blue-200 mb-3"}," Select Your Account ",-1)),m(e("select",{"onUpdate:modelValue":t[0]||(t[0]=s=>w.value=s),onChange:R,class:"form-select w-full"},[t[15]||(t[15]=e("option",{value:""},"-- Select an account or enter manually below --",-1)),(l(!0),n(V,null,N(p.availableAccounts,s=>(l(),n("option",{key:s.id,value:s.id},[c(i(s.name)+" ("+i(k(s.id))+")"+i(s.currency?` - ${s.currency}`:"")+" ",1),s.is_manager?(l(),n("span",ze," [MCC]")):d("",!0)],8,Se))),128))],544),[[C,w.value]]),e("p",Ue," We found "+i(p.availableAccounts.length)+" account"+i(p.availableAccounts.length!==1?"s":"")+" you have access to. Select one to auto-fill the form below. ",1)])])])):d("",!0),e("div",null,[t[18]||(t[18]=e("label",{for:"user_defined_name",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},[c(" Account Name "),e("span",{class:"text-red-500"},"*")],-1)),m(e("input",{id:"user_defined_name","onUpdate:modelValue":t[1]||(t[1]=s=>a(o).user_defined_name=s),type:"text",placeholder:`e.g., My ${y.value} Account`,class:f(["form-input w-full",{"border-red-500":a(o).errors.user_defined_name}])},null,10,Me),[[z,a(o).user_defined_name]]),a(o).errors.user_defined_name?(l(),n("p",De,i(a(o).errors.user_defined_name),1)):d("",!0),t[19]||(t[19]=e("p",{class:"mt-1 text-sm text-gray-500 dark:text-gray-400"}," Give this account a memorable name for easy identification ",-1))]),b.value?(l(),n("div",Be,[e("label",Ee,[c(i(b.value.label)+" ",1),t[20]||(t[20]=e("span",{class:"text-red-500"},"*",-1))]),m(e("input",{id:"platform_account_id","onUpdate:modelValue":t[2]||(t[2]=s=>a(o).platform_account_id=s),type:"text",placeholder:b.value.placeholder,class:f(["form-input w-full",{"border-red-500":a(o).errors.platform_account_id}])},null,10,Pe),[[z,a(o).platform_account_id]]),a(o).errors.platform_account_id?(l(),n("p",Te,i(a(o).errors.platform_account_id),1)):d("",!0),e("p",Ve,i(b.value.help),1)])):d("",!0),(l(!0),n(V,null,N(g.value,s=>(l(),n("div",{key:s.key},[e("label",{for:`cred_${s.key}`,class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},[c(i(s.label)+" ",1),t[21]||(t[21]=e("span",{class:"text-red-500"},"*",-1))],8,Ne),m(e("input",{id:`cred_${s.key}`,"onUpdate:modelValue":J=>a(o).credentials[s.key]=J,type:s.type,placeholder:s.placeholder,autocomplete:s.autocomplete??"off",class:f(["form-input w-full",{"border-red-500":A(s.key)}])},null,10,Fe),[[K,a(o).credentials[s.key]]]),A(s.key)?(l(),n("p",Ie,i(A(s.key)),1)):d("",!0),e("p",Le,i(s.help),1)]))),128)),M.value&&L.value?(l(),n("div",$e,[e("button",{type:"button",class:"btn bg-yellow-400 hover:bg-yellow-500 text-slate-900",disabled:x.value||!$.value,onClick:Y},[x.value?(l(),n("span",Re,"Verifying...")):(l(),n("span",Ge,"Verify credentials and load accounts"))],8,Ye),_.value?(l(),n("p",Je,i(_.value),1)):d("",!0)])):d("",!0),p.platform==="google_ads"?(l(),n("div",je,[t[22]||(t[22]=e("label",{for:"manager_account_id",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},[c(" Manager Account ID (MCC) "),e("span",{class:"text-gray-400"},"(Optional)")],-1)),m(e("input",{id:"manager_account_id","onUpdate:modelValue":t[3]||(t[3]=s=>a(o).manager_account_id=s),type:"text",placeholder:"e.g., 123-456-7890",class:f(["form-input w-full",{"border-red-500":a(o).errors.manager_account_id}])},null,2),[[z,a(o).manager_account_id]]),a(o).errors.manager_account_id?(l(),n("p",He,i(a(o).errors.manager_account_id),1)):d("",!0),t[23]||(t[23]=e("p",{class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},[e("strong",null,"Leave blank if:"),c(" you don't use an MCC, or if you're setting up the MCC itself."),e("br"),e("strong",null,"Fill in if:"),c(" you're setting up a sub-account that's managed by an MCC (the MCC's ID goes here). Hyphens are optional. ")],-1))])):d("",!0),e("div",null,[t[25]||(t[25]=e("label",{for:"currency_code",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},[c(" Currency "),e("span",{class:"text-red-500"},"*")],-1)),m(e("select",{id:"currency_code","onUpdate:modelValue":t[4]||(t[4]=s=>a(o).currency_code=s),class:f(["form-select w-full",{"border-red-500":a(o).errors.currency_code}])},[...t[24]||(t[24]=[e("option",{value:""},"Select currency",-1),e("option",{value:"USD"},"USD - US Dollar",-1),e("option",{value:"EUR"},"EUR - Euro",-1),e("option",{value:"GBP"}
1,"GBP - British Pound",-1),e("option",{value:"CAD"},"CAD - Canadian Dollar",-1),e("option",{value:"AUD"},"AUD - Australian Dollar",-1),e("option",{value:"JPY"},"JPY - Japanese Yen",-1),e("option",{value:"CNY"},"CNY - Chinese Yuan",-1),e("option",{value:"INR"},"INR - Indian Rupee",-1)])],2),[[C,a(o).currency_code]]),a(o).errors.currency_code?(l(),n("p",Oe,i(a(o).errors.currency_code),1)):d("",!0),t[26]||(t[26]=e("p",{class:"mt-1 text-sm text-gray-500 dark:text-gray-400"}," The currency used for cost reporting in this account ",-1))]),e("div",null,[t[28]||(t[28]=e("label",{for:"timezone",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},[c(" Timezone "),e("span",{class:"text-red-500"},"*")],-1)),m(e("select",{id:"timezone","onUpdate:modelValue":t[5]||(t[5]=s=>a(o).timezone=s),class:f(["form-select w-full",{"border-red-500":a(o).errors.timezone}])},[...t[27]||(t[27]=[e("option",{value:""},"Select timezone",-1),e("option",{value:"UTC"},"UTC",-1),e("option",{value:"America/New_York"},"Eastern Time (US & Canada)",-1),e("option",{value:"America/Chicago"},"Central Time (US & Canada)",-1),e("option",{value:"America/Denver"},"Mountain Time (US & Canada)",-1),e("option",{value:"America/Los_Angeles"},"Pacific Time (US & Canada)",-1),e("option",{value:"Europe/London"},"London",-1),e("option",{value:"Europe/Paris"},"Paris",-1),e("option",{value:"Europe/Berlin"},"Berlin",-1),e("option",{value:"Europe/Amsterdam"},"Amsterdam",-1),e("option",{value:"Europe/Brussels"},"Brussels",-1),e("option",{value:"Europe/Madrid"},"Madrid",-1),e("option",{value:"Europe/Rome"},"Rome",-1),e("option",{value:"Europe/Stockholm"},"Stockholm",-1),e("option",{value:"Asia/Tokyo"},"Tokyo",-1),e("option",{value:"Asia/Shanghai"},"Shanghai",-1),e("option",{value:"Asia/Dubai"},"Dubai",-1),e("option",{value:"Australia/Sydney"},"Sydney",-1)])],2),[[C,a(o).timezone]]),a(o).errors.timezone?(l(),n("p",qe,i(a(o).errors.timezone),1)):d("",!0),t[29]||(t[29]=e("p",{class:"mt-1 text-sm text-gray-500 dark:text-gray-400"}," Timezone for reporting and data synchronization ",-1))]),e("div",null,[t[31]||(t[31]=e("label",{for:"country_code",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"}," Country (Optional) ",-1)),m(e("select",{id:"country_code","onUpdate:modelValue":t[6]||(t[6]=s=>a(o).country_code=s),class:"form-select w-full"},[...t[30]||(t[30]=[e("option",{value:""},"Select country",-1),e("option",{value:"US"},"United States",-1),e("option",{value:"GB"},"United Kingdom",-1),e("option",{value:"CA"},"Canada",-1),e("option",{value:"AU"},"Australia",-1),e("option",{value:"DE"},"Germany",-1),e("option",{value:"FR"},"France",-1),e("option",{value:"ES"},"Spain",-1),e("option",{value:"IT"},"Italy",-1),e("option",{value:"JP"},"Japan",-1),e("option",{value:"CN"},"China",-1),e("option",{value:"IN"},"India",-1)])],512),[[C,a(o).country_code]]),e("p",Ke," Primary country for this advertising account (not provided by "+i(y.value)+" API - manual selection only) ",1)]),e("div",Qe,[m(e("input",{id:"is_enabled","onUpdate:modelValue":t[7]||(t[7]=s=>a(o).is_enabled=s),type:"checkbox",class:"form-checkbox"},null,512),[[Q,a(o).is_enabled]]),t[32]||(t[32]=e("label",{for:"is_enabled",class:"ml-2 text-sm text-gray-700 dark:text-gray-300"}," Enable automatic cost data synchronization ",-1))])]),e("div",We,[e("div",Xe,[P(a(T),{href:a(h)("user.data-source.ad-platforms.index"),class:"btn btn-secondary"},{default:S(()=>[...t[33]||(t[33]=[c(" Cancel ",-1)])]),_:1},8,["href"]),e("button",{type:"submit",class:"btn bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white",disabled:a(o).processing},[a(o).processing?(l(),n("span",et,"Creating Account...")):(l(),n("span",tt,"Create Account"))],8,Ze)])])],32)])])])]),_:1},8,["title"]))}});export{Dt 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.