1import{r,aS as M,s as D,j as e,T as l,B as n,D as K,Q as N,h as G,dO as ge,dP as je,dQ as ye,n as oe,G as w,y as R,dR as fe,dS as F,V as Z,a7 as $,aF as be,ak as J,aA as ve,ay as ee,b_ as te,dT as se,av as ne,f as ke,bZ as we,A as Se,cQ as Ce,g as _e,e as De}from"./index-DwyKB3JU.js";import{P as Y,A as le,G as Ae,d as Ie,a as Le,b as Me,c as We}from"./marketing.style.module-BVapIrZ8.js";import{I as q}from"./InfoOutlined-BuU-njRi.js";import{d as Te,s as Be,a as Pe}from"./stripe-utils-CYASs4ym.js";import{u as ce}from"./index-BK78i--I.js";import{S as de}from"./Slider-Cn1i-Vds.js";import{h as ze}from"./react-apexcharts.esm-L7meJvVx.js";import{C as Ue}from"./index-DweA3EL6.js";import{P as he}from"./progress-button.component-BPz7dioT.js";import{A as Ee}from"./google-ads-logo-Bhzcg3x3.js";import"./MoreVert-CyhW2Llr.js";import"./Public-CMPmsZpI.js";import"./CardHeader-2Z3vSXlI.js";import"./Delete-DIdOnN0C.js";import"./Edit-CJRejqCv.js";import"./RadioGroup-CJfV7wFj.js";import"./ClickAwayListener-VtbwCpIs.js";import"./unitConverter-DMOAFOJB.js";import"./textfieldCounter.component-DInGLx3r.js";import"./visuallyHidden-Dan1xhjv.js";import"./index-BrogtWmS.js";function Fe(p){const{stripePlan:t,value:s,setValue:i,budget:h}=p,[x,g]=r.useState([]),[j,b]=r.useState(),[m,v]=r.useState({});r.useEffect(()=>{t&&Te(t).then(u=>{let c=2,d=Object.keys(u).map((y,T)=>{let S=u[y],A=S/30.4;return(h==Number((.85*A).toFixed(2))||h==Number((.85*S/30).toFixed(2)))&&(c=T),{id:y,daily:A,monthly:S,label:M(A,"USD",2)}});g(d),i(d[c])})},[t]);const a=r.useRef(null);r.useEffect(()=>(s?.monthly&&(b(null),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{m[s.monthly]?b(m[s.monthly]):D().getMarketingForecast(null,s.monthly).then(u=>{console.log("getForecast data",u),b(u),v(c=>({...c,[s.monthly]:u}))})},600)),()=>{a.current&&clearTimeout(a.current)}),[s]);const o=(u,c)=>{if(typeof c=="number"){let d=x.findIndex(y=>y.daily===c);i(x[d])}};let _=j?.clicks&&Math.round(Number(j.clicks)*.75),B=j?.clicks&&Math.round(Number(j.clicks));const W=ce("(max-width:600px)");return e.jsxs(r.Fragment,{children:[e.jsx(l,{sx:{mt:4,mb:2},variant:"h5",component:"div",children:"Campaign budget"}),e.jsx(l,{sx:{mb:2},variant:"body1",component:"div",children:"You will be prompted to pay for this pay-per-click Google Ads campaign launch, afterwards, your campaign budget will be added to your monthly EntityMed bill."}),e.jsxs(n,{sx:{width:600,maxWidth:"100%",mx:"auto"},children:[e.jsxs(l,{variant:"h4",component:"div",align:"center",sx:{fontWeight:"400",mt:6},children:["about ",e.jsx(n,{sx:{fontWeight:"600",display:"inline",fontSize:"1.4em"},children:s.label})," per day"]}),e.jsxs(l,{sx:{mb:2},component:"div",align:"center",children:[e.jsx(n,{sx:{fontWeight:"600",display:"inline"},children:M(s.monthly,"USD",2)})," monthly budget",e.jsx(K,{title:e.jsx(r.Fragment,{children:e.jsx(l,{color:"inherit",component:"div",align:"center",children:`Each month you'll pay this amount. 2 It includes a 15% EntityMed service fee and 85% ad spend, 3 which will be converted into about ${M(s.monthly*.85,"USD",2)} ad credits (~${M(s.daily*.85,"USD",2)} per day)`})}),children:e.jsx(q,{sx:{ml:1},fontSize:"small"})})]})]}),e.jsx(n,{sx:{width:800,maxWidth:"calc(100% - 20px)",mx:"auto"},children:e.jsx(de,{"aria-label":"daily budget",value:s.daily,min:x[0]?.daily??0,max:x[4]?.daily??1e4,valueLabelFormat:u=>M(u,"USD",2),getAriaValueText:u=>M(u,"USD",2),step:null,valueLabelDisplay:"auto",marks:Object.values(x).map(u=>({value:u.daily,label:u.label})),onChange:o,slotProps:{markLabel:{style:{fontSize:W?10:12}}}})}),j?e.jsxs(l,{variant:"h4",component:"div",align:"center",sx:{fontWeight:"400",mt:3},children:["Estimated clicks with this budget: ",e.jsxs(n,{sx:{fontWeight:"600",display:"inline"},children:[_," to ",B," clicks"]})," per 30 days",e.jsx(K,{title:`This estimate is based on Google Adsâ cost per click,\r 4 which ranges between 50¢ and $10. Itâs affected by your keyword themes,\r 5 locations, and when your ad is shown`,children:e.jsx(q,{sx:{ml:1},fontSize:"small"})})]}):e.jsx(n,{sx:{textAlign:"center",mt:3},children:e.jsx(Y,{color:"#3f51b5"})}),e.jsx(N,{sx:{my:2}}),e.jsx(n,{children:e.jsx(l,{sx:{mb:2},component:"div",children:"Your Google Ads campaign budget will automatically renew monthly."})})]})}function ae(p){const{activeStep:t,handleBack:s,editAdTexts:i,handleComplete:h,lastBtn:x}=p;return e.jsxs(n,{sx:{display:"flex",flexDirection:"row",py:2},children:[e.jsx(G,{color:"error",variant:"contained",disabled:t===0,onClick:s,sx:{mr:1},children:"Back"}),e.jsx(n,{sx:{flex:"1 1 auto"}}),t!==1&&e.jsx(G,{onClick:i,variant:"contained",color:"info",sx:{mr:1},children:"Edit Ad Texts"}),x.length>0&&e.jsx(G,{onClick:h,variant:"contained",children:x})]})}const $e=oe(fe)(()=>({[`&.${F.alternativeLabel}`]:{top:36,left:"calc(-50% + 35px)",right:"calc(50% + 35px)"},[`&.${F.active}`]:{[`& .${F.line}`]:{borderColor:"#784af4"}},[`&.${F.completed}`]:{[`& .${F.line}`]:{borderColor:"#784af4"}},[`& .${F.line}`]:{borderColor:"#784af444",borderTopWidth:3,borderRadius:1}})),O=["Locations & Ad preview","Edit Ad Text","Create an ad"],Ne=p=>{const{templateMarketingData:t,adminMarketingData:s,userMarketingData:i,setUserMarketingData:h,clinicId:x,alias:g}=p,[j,b]=r.useState([]),[m,v]=r.useState({id:"loading",daily:0,monthly:0,label:"Loading"}),[a,o]=r.useState(0);r.useEffect(()=>{a===1&&j.length==0&&D().getKeywardsIdeas(x).then(I=>{b(I.sort((L,P)=>P.avg_monthly_searches-L.avg_monthly_searches))})},[a]);const[_,B]=r.useState({}),W=()=>O.length,u=()=>Object.keys(_).length,c=()=>a===W()-1,d=()=>u()===W(),y=()=>{const I=i.headlines?.filter(f=>f.trim()!==""),L=i.descriptions?.filter(f=>f.trim()!==""),P={...i,...I&&{headlines:I},...L&&{descriptions:L}};
5D().saveUserMarketingData(P,x).then(()=>{R.info("Changes saved")}).catch(f=>console.error(f))},T=()=>{let I={...t,...s,...i};if(Object.keys(I.locations??{}).length==0){R.warning("You must select at least one ad marketing location to proceed");return}B({0:!0});const L=!!s?.campaign_id;a===0&&!L&&y(),o(1)},S=()=>{B({}),o(0)},A=()=>{let I={...t,...s,...i};if(Object.keys(I.locations??{}).length==0){R.warning("You must select at least one ad marketing location to proceed");return}const L=!!s?.campaign_id,P=_;if(P[a]=!0,a===0&&(P[1]=!0),B(P),!c())L||y(),o(W()-1);else if(d())if(L)o(3);else{const f={price:m.id,allow_promotion_codes:!0,success_url:window.location.origin+"/my_account/subscriptions?success_marketing=true",cancel_url:window.location.origin+"/my_account/marketing",metadata:{clinicId:x??""}};Be(f),o(3)}else{const f=O.findIndex((C,Q)=>!(Q in _));o(f)}};let U={...t,...s,...i};const k=U.keywords??[],V=U.headlines??[],H=U.descriptions??[];return e.jsxs(n,{sx:{width:"100%",maxWidth:1200,m:"15px auto 0"},children:[e.jsx(ae,{activeStep:a,handleBack:S,editAdTexts:T,handleComplete:A,lastBtn:a===O.length?"":u()===W()-1?"Finish":"Save & Continue"}),e.jsx(ge,{nonLinear:!0,alternativeLabel:!0,activeStep:a,connector:e.jsx($e,{}),children:O.map((I,L)=>e.jsx(je,{completed:_[L],children:e.jsx(ye,{sx:{fontSize:26},StepIconProps:{sx:{fontSize:72}},children:I})},I))}),e.jsx(n,{sx:{background:"rgba(34, 51, 84, 0.02)",py:1,px:{md:4,sm:2,xs:1}},children:d()?e.jsx(r.Fragment,{children:e.jsxs(n,{sx:{textAlign:"center"},children:[e.jsx(Y,{color:"#3f51b5"}),e.jsx(l,{sx:{mt:2,mb:1},children:"All steps completed - your Google Ads campaign will begin as soon as you make the payment."}),e.jsx(Y,{color:"#3f51b5"})]})}):e.jsx(r.Fragment,{children:a==0?e.jsxs(w,{container:!0,spacing:2,children:[e.jsx(w,{size:{xs:12,sm:6},children:e.jsx(le,{userMarketingData:i,setUserMarketingData:h,marketingData:U})}),e.jsxs(w,{size:{xs:12,sm:6},children:[e.jsx(l,{sx:{mt:4,mb:1},variant:"h5",component:"div",children:"This is an example of how your Google Ad will look. You can choose to use the text we recommend (Save and Continue), or edit and adjust the Ad (Edit Ad Texts)."}),e.jsx(Ae,{clinicId:g||x||"",headers:V,descriptions:H}),e.jsx(Ie,{templateMarketingData:t,adminMarketingData:s,userMarketingData:i,setUserMarketingData:h})]})]}):a==1?e.jsxs(w,{container:!0,spacing:2,children:[e.jsx(w,{size:{xs:12,sm:6},children:e.jsx(Le,{userMarketingData:i,setUserMarketingData:h,keywordsSuggestions:j,keywords:k})}),e.jsx(w,{size:{xs:12,sm:6},children:e.jsx(Me,{templateMarketingData:t,adminMarketingData:s,userMarketingData:i,setUserMarketingData:h})})]}):a==2?e.jsx(n,{children:e.jsx(Fe,{stripePlan:t.stripe??"",value:m,setValue:v,budget:s?.budget??0})}):e.jsx(r.Fragment,{children:"Error"})})}),e.jsx(ae,{activeStep:a,handleBack:S,editAdTexts:T,handleComplete:A,lastBtn:a===O.length?"":u()===W()-1?"Finish":"Save & Continue"})]})};function E(p){const t=Z(),{name:s,val:i,type:h,decimals:x}=p;return e.jsx(r.Fragment,{children:e.jsx(w,{size:{xs:6,sm:3,md:"grow"},children:e.jsx($,{sx:{p:1,background:`${t.colors.gradients.blue3}`,height:"calc(100% - 18px)",textAlign:"center"},children:e.jsxs(be,{spacing:0,sx:{height:"100%"},children:[e.jsx(l,{variant:"subtitle2",sx:{lineHeight:1.05,color:`${t.colors.alpha.trueWhite[100]}`},children:s}),e.jsxs(n,{sx:{mt:"auto"},children:[e.jsx(l,{variant:"h3",sx:{color:`${t.colors.alpha.trueWhite[100]}`},children:e.jsx(Ue,{start:0,end:i,duration:6,separator:",",delay:2,decimals:x??(i>8?0:2),suffix:h?" "+h:""})}),e.jsx(l,{variant:"h6",sx:{lineHeight:1.05,color:`${t.colors.alpha.trueWhite[70]}`},children:"last 30 days"})]})]})})})})}function ie(p){const t=Z(),{ctr:s}=p;return e.jsxs(n,{sx:{display:"inline-flex",position:"relative"},children:[e.jsx(n,{sx:{animationDuration:"550ms",position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(l,{sx:{fontWeight:"bold",fontSize:`${t.typography.pxToRem(12)}`,color:i=>i.colors.primary.main},children:s.toLocaleString("en",{style:"percent"})})}),e.jsx(J,{variant:"determinate",sx:{color:i=>i.colors.alpha.black[10]},size:50,thickness:2,value:100}),e.jsx(J,{size:50,sx:{animationDuration:"550ms",position:"absolute",left:0,top:0,[`& .${ve.circle}`]:{strokeLinecap:"round"}},thickness:2,variant:"determinate",value:s})]})}const re=oe(we)(()=>` 6 .MuiDivider-root:first-of-type { 7 display: none; 8 } 9 `);function Oe(p,t){if(!p?.stats_by_date)return{chartOptions:null,chartData:null,sumStats:null};const s=p.stats_by_date.sort((m,v)=>Number(new Date(m.date))-Number(new Date(v.date))),i=s.map(m=>m.date),h=s.map(m=>m.impressions),x=s.map(m=>m.clicks),g=s.reduce((m,v)=>(Object.keys(v).forEach(a=>m[a]=(m[a]||0)+v[a]),m),{});return g.average_cpc=s.length?g.average_cpc/(1e6*s.length):0,{chartOptions:{chart:{background:"transparent",toolbar:{show:!1}},stroke:{curve:"smooth",width:[3,3],dashArray:[0,5],colors:[t.colors.error.main,t.palette.btnPrimary.main]},fill:{opacity:[1,.2]},theme:{mode:t.palette.mode}
9,markers:{hover:{sizeOffset:1},shape:"circle",size:5,strokeWidth:2,strokeOpacity:1,strokeColors:t.colors.alpha.white[100],colors:[t.colors.error.main,t.palette.btnPrimary.main]},colors:[t.colors.error.main,t.palette.btnPrimary.main],labels:i,dataLabels:{enabled:!1},legend:{labels:{useSeriesColors:!0},itemMargin:{horizontal:15,vertical:15},show:!0},xaxis:{axisBorder:{show:!1},labels:{show:!0}},yaxis:[{show:!0,opposite:!0,title:{text:"Impressions"},labels:{show:!0}},{show:!0,title:{text:"Clicks"},labels:{show:!0}}],grid:{xaxis:{lines:{show:!0}},yaxis:{lines:{show:!0}},strokeDashArray:5,borderColor:t.colors.alpha.black[10]}},chartData:[{type:"line",name:"impressions",data:h},{type:"area",name:"clicks",data:x}],sumStats:g}}function Ge(p){const{stats:t,leadsCount:s}=p,[i,h]=r.useState(!1),x=()=>{h(o=>!o)},g=Z(),{chartOptions:j,chartData:b,sumStats:m}=Oe(t,g),v=!!t?.status?.status,a=t?.status?.status=="ENABLED";return e.jsxs(n,{children:[e.jsx(l,{sx:{pt:2},variant:"h3",fontWeight:"700",color:v?a?"success.dark":"warning.dark":void 0,align:"center",children:v?e.jsxs(e.Fragment,{children:["Your advertisement is currently ",t?.status.primary_status,a&&` and your bidding strategy ${t?.status.bidding_strategy_system_status}`,"."]}):"Loading campaign activity report"}),e.jsx(l,{sx:{pt:1,pb:2},variant:"h3",fontWeight:"700",color:"text.secondary",align:"center",children:"View your Google Ads performance insights"}),m&&j&&b?e.jsxs(n,{children:[e.jsxs(w,{container:!0,spacing:2,alignItems:"stretch",children:[e.jsx(E,{name:"Clicks",val:m.clicks??0,type:"",decimals:0}),e.jsx(E,{name:"Daily Budget",val:(t?.status?.per_day??0)/1e6,type:"$"}),e.jsx(E,{name:"Impressions",val:m.impressions??0,type:"",decimals:0}),e.jsx(E,{name:"Average CPC",val:m.average_cpc,type:"$"}),e.jsx(E,{name:"Leads",val:s,type:""}),e.jsx(E,{name:"Cost per Lead",val:s?(t?.status?.total_spend??0)/(1e6*s):0,type:"$"}),e.jsx(E,{name:"CTR",val:(t?.status?.ctr??0)*100,type:"%",decimals:2})]}),e.jsx(ze,{options:j,series:b,type:"line",height:322}),e.jsx(n,{my:2,textAlign:"center",children:e.jsx(G,{onClick:x,variant:"contained",color:"info",sx:{mr:1},children:i?"Hide Keywords & Device data":"Show Keywords & Device data"})}),e.jsxs(w,{container:!0,spacing:2,children:[e.jsx(w,{size:{xs:12,md:6},children:e.jsx(ee,{className:i?"open":"",children:e.jsx(re,{disablePadding:!0,children:t?.keyword_stats.map((o,_)=>e.jsxs(r.Fragment,{children:[e.jsx(N,{}),e.jsxs(te,{sx:{py:1,px:2},children:[e.jsx(se,{sx:{display:"flex",alignItems:"center",mr:1.5},children:e.jsx(K,{arrow:!0,title:e.jsxs(r.Fragment,{children:[e.jsxs(l,{color:"inherit",children:["Clicks: ",o.clicks]}),e.jsxs(l,{color:"inherit",children:["Impressions: ",o.impressions]})]}),children:e.jsx(n,{children:e.jsx(ie,{ctr:o.impressions?o.clicks/o.impressions:0})})})}),e.jsx(ne,{primary:e.jsx(l,{color:"text.primary",variant:"h4",children:o.keyword}),secondary:e.jsx(e.Fragment,{children:e.jsxs(l,{variant:"subtitle1",children:["Match type is ",o.match_type]})}),secondaryTypographyProps:{variant:"subtitle2",noWrap:!0}}),e.jsx(n,{display:"flex",alignItems:"center",mr:3,children:e.jsxs(l,{variant:"h5",children:["Clicks: ",o.clicks]})}),e.jsx(n,{display:"flex",alignItems:"center",children:e.jsxs(l,{variant:"h5",children:["$",o.cost_micros/1e6," cost"]})})]})]},"stat"+_))})})}),e.jsx(w,{size:{xs:12,md:6},children:e.jsx(ee,{className:i?"open":"",children:e.jsx(re,{disablePadding:!0,children:t?.byDevice.map((o,_)=>e.jsxs(r.Fragment,{children:[e.jsx(N,{}),e.jsxs(te,{sx:{py:1,px:2},children:[e.jsx(se,{sx:{display:"flex",alignItems:"center",mr:1.5},children:e.jsx(ie,{ctr:o.ctr??0})}),e.jsx(ne,{primary:e.jsx(l,{color:"text.primary",variant:"h4",children:o.device}),secondary:e.jsxs(l,{variant:"subtitle1",children:["With an average CPC of ",(o.average_cpc/1e6).toFixed(2)]}),secondaryTypographyProps:{variant:"subtitle2",noWrap:!0}}),e.jsx(n,{display:"flex",alignItems:"center",mr:3,children:e.jsxs(l,{variant:"h5",children:["Clicks: ",o.clicks]})}),e.jsx(n,{display:"flex",alignItems:"center",children:e.jsxs(l,{variant:"h5",children:["Impressions: ",o.impressions]})})]})]},"stat"+_))})})})]})]}):e.jsx(n,{display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(ke,{background:"#fff"})}),e.jsx(N,{})]})}const Re="_object_10qkj_1",Ke="_shape_10qkj_14",Ve="_rope_10qkj_34",Ye="_content_10qkj_43",qe="_message_10qkj_51",z={object:Re,shape:Ke,rope:Ve,content:Ye,message:qe};function He(p){const{title:t,text:s,url:i,urlText:h}=p;return e.jsxs(n,{sx:{py:2},children:[e.jsxs(n,{className:z.object,children:[e.jsx(n,{className:z.rope}),e.jsx(n,{className:z.shape,children:e.jsxs(l,{className:z.message,children:["Coming ",e.jsx(n,{component:"span",className:z.soon,children:"Soon"})]})})]}),e.jsxs(n,{className:z.content,children:[e.jsx(l,{variant:"h4",className:z.message,children:t}),e.jsx(l,{className:z.message,children:s}),i&&h&&e.jsx(G,{variant:"contained",size:"large",href:i,target:"_blank",rel:"noreferrer",color:"info",sx:{mt:2},children:h})]})]})}const xe=()=>e.jsxs(n,{sx:{pb:3,maxWidth:800,mx:"auto"},children:[e.jsxs(n,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(l,{variant:"h3",align:"center",sx:{fontWeight:"700",color:"text.secondary"},children:"Google Ads Campaign Generator"}),e.jsx(n,{children:e.jsx("img",{src:Ee,alt:"google ads logo"})})]}),e.jsx(n,{sx:{maxWidth:800,mx:"auto"},children:e.jsx(l,{align:"center",sx:{color:"text.secondary"},children:"Google Ads is one of the best ways to grow your business- and now, we've made it easy for you. We've fully automated the Google Ads Campaign process and optimized it for the AI Simulator and aesthetic industry. With just a few steps, you'll have an effective professional Google Ads Campaign up and running. Let's get started."})})]});let X=500;function Qe({clinicId:p}){const[t,s]=r.useState(35),[i,h]=r.useState(),[x,g]=r.useState({});let j=Pe();const[b,m]=r.useState([]),v=async()=>{const d=((j?.length===0&&p?await Ce():j)??[]).filter(y=>y.productData?.stripe_metadata_type=="marketing");m(d),X=(d[0]?.payData.unit_amount||0)/3040||35,s(X)};r.useEffect(()=>{j&&v()},[p,j]);const a=r.useRef(null);r.useEffect(()=>(t&&(h(null),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{x[t]?h(x[t]):D().getMarketingForecast(null,t*30.4).then(c=>{console.log("getForecast data",c),h(c),g(d=>({...d,[t]:c}))})},600)),()=>{a.current&&clearTimeout(a.current)}),[t]);const o=(c,d)=>{typeof d=="number"&&s(d)},_=()=>{let c=(b[0]?.payData.unit_amount||0)/3040;if(c===t)return;if(b[0]?.payData.unit_amount){let y={time:Date.now(),oldBudget:c,newBudget:t};D().updateChangelog("adsBudget",y).catch(T=>{console.error(T)})}const d={type:c>t?"downgrade":"upgrade",subId:b[0]?.items?.[0]?.subscription,paymentId:b[0]?.items?.[0]?.id,productId:b[0]?.payData.product,newAmount:t};return D().updateAdBudget(d).then(y=>{R.info("Changes saved")}
9).catch(y=>{console.error(y)})};let B=i?.clicks&&Math.round(Number(i.clicks)*.75),W=i?.clicks&&Math.round(Number(i.clicks));const u=ce("(max-width:600px)");return e.jsxs(n,{children:[e.jsxs(n,{sx:{textAlign:"center"},children:[e.jsxs(l,{sx:{mt:1,mb:2,maxWidth:600,mx:"auto",lineHeight:1.5},component:"div",children:[e.jsx("b",{children:"Increasing your Budget:"}),e.jsx("br",{}),"Any adjustments made will be reflected in your next billing cycle, with immediate billing for additional expenses added to your monthly EntityMed total.",e.jsx("br",{}),e.jsx("b",{children:"Decreasing your Budget:"}),e.jsx("br",{}),"Changes will take effect from the next billing cycle, allowing you to optimize your campaign expenditure according to your strategy."]}),e.jsxs(n,{sx:{width:600,maxWidth:"100%",mx:"auto"},children:[e.jsxs(l,{variant:"h4",component:"div",align:"center",sx:{fontWeight:"400",mt:6},children:["about ",e.jsx(n,{sx:{fontWeight:"600",display:"inline",fontSize:"1.4em"},children:M(t,"USD",2)})," per day"]}),e.jsxs(l,{sx:{mb:2},component:"div",align:"center",children:[e.jsx(n,{sx:{fontWeight:"600",display:"inline"},children:M(t*30.4,"USD",2)})," monthly budget",e.jsx(K,{title:e.jsx(r.Fragment,{children:e.jsx(l,{color:"inherit",component:"div",align:"center",children:`Each month you'll pay this amount. 10 It includes a 15% EntityMed service fee and 85% ad spend, 11 which will be converted into about ${M(t*.85*30.4,"USD",2)} ad credits (~${M(t*.85,"USD",2)} per day)`})}),children:e.jsx(q,{sx:{ml:1},fontSize:"small"})})]})]})]}),e.jsxs(n,{sx:{width:800,py:4,maxWidth:"calc(100% - 20px)",mx:"auto"},children:[e.jsx(l,{variant:"h4",align:"center",sx:{fontWeight:"500",color:"text.secondary"},children:"daily budget"}),e.jsx(de,{"aria-label":"daily budget",value:t,min:Math.min(X,16.45),max:300,valueLabelDisplay:"on",valueLabelFormat:c=>M(c,"USD",2),getAriaValueText:c=>M(c,"USD",2),step:.05,onChange:o,slotProps:{markLabel:{style:{fontSize:u?10:12}}}}),i?e.jsxs(l,{variant:"h4",component:"div",align:"center",sx:{fontWeight:"400",mt:3},children:["Estimated clicks with this budget: ",e.jsxs(n,{sx:{fontWeight:"600",display:"inline"},children:[B," to ",W," clicks"]})," per 30 days",e.jsx(K,{title:`This estimate is based on Google Adsâ cost per click,\r 12 which ranges between 50¢ and $10. Itâs affected by your keyword themes,\r 13 locations, and when your ad is shown`,children:e.jsx(q,{sx:{ml:1},fontSize:"small"})})]}):e.jsx(n,{sx:{textAlign:"center",mt:3},children:e.jsx(Y,{color:"#3f51b5"})})]}),e.jsxs(n,{sx:{textAlign:"center"},children:[e.jsx(n,{sx:{mb:2,mx:"auto",width:800,maxWidth:"calc(100% - 20px)"},children:e.jsx(Se,{severity:"info",children:e.jsx(l,{variant:"subtitle2",children:"Changes in budget will be visible within two working days from the update."})})}),e.jsx(he,{clicked:_,variant:"contained",children:"Save Current Changes"})]})]})}const Xe=null,Ze=p=>{const{templateMarketingData:t,adminMarketingData:s,userMarketingData:i,setUserMarketingData:h,clinicId:x}=p,[g,j]=r.useState(Xe),[b,m]=r.useState(0),[v,a]=r.useState({}),o=r.useRef({});r.useEffect(()=>{const u=_e(),c=new Date,d=new Date(c);d.setDate(d.getDate()-30);const y=d.getTime(),T=Object.values(u??{}).filter(S=>S?.patient?.info&&S.patient.info.utm_source==="gads"&&S.patient.info.createdAt>=y);D().getAdStats().then(S=>{j(S),m(T.length);const{locations:A,proximities:U}=S;o.current={locations:A,proximities:U};let k={...i};if(k?.locations){let V=Object.values(k.locations);const H=A.filter(f=>{for(const C of V)if(f.geo_target_constant==="geoTargetConstants/"+C.ads_id&&k.locations?.[C.id])return k.locations={...k.locations,[C.id]:{...k.locations[C.id],resource_name:f.resource_name}},!1;return!0}),I={3:"km",2:"mi"},L=f=>I[f]??void 0,P=U.filter(f=>{for(const C of V){const Q=f.geo_point.latitude_in_micro_degrees===Math.round(C.lat*1e6),me=f.geo_point.longitude_in_micro_degrees===Math.round(C.lng*1e6),ue=L(f.radius_units)===C.distUnit,pe=f.radius===C.distVal;if(Q&&me&&ue&&pe&&k.locations?.[C.id])return k.locations={...k.locations,[C.id]:{...k.locations[C.id],resource_name:f.resource_name}},!1}return!0});console.log("upUser.locations before:",k.locations),k.locations=Object.fromEntries(Object.entries(k.locations).filter(([f,C])=>!!C.resource_name)),h(k),a({locations:H,proximities:P})}})},[]);const _=u=>{if(g){const{locations:c,proximities:d}=g;let y=c?.filter(A=>A.resource_name!==u)??[],T=d?.filter(A=>A.resource_name!==u)??[],S={...g,locations:y,proximities:T};j(S)}},B=()=>{const u=[...g?.proximities??[],...g?.locations??[]].map(d=>d.resource_name),c=i?.locations??{};if(Object.keys(o.current).length){let d={time:Date.now(),newData:c,oldData:{...o.current}};D().updateChangelog("adsLocations",d).catch(y=>{console.error(y)})}return D().updateAdLocations(u,c).then(d=>
13D().saveUserMarketingData(i,x).then(()=>{o.current.old=c,R.info("Changes saved")}).catch(y=>{console.error(y)})).catch(d=>{console.error(d)})};let W={...t,...s,...i};return e.jsxs(e.Fragment,{children:[e.jsxs($,{sx:{width:"100%",maxWidth:1200,px:{md:4,sm:2,xs:1},py:1},children:[e.jsx(xe,{}),e.jsx(N,{}),e.jsx(n,{children:e.jsx(Ge,{stats:g,leadsCount:b})})]}),e.jsx($,{sx:{width:"100%",maxWidth:1200,mt:3,px:{md:4,sm:2,xs:1},py:1},children:e.jsx(w,{container:!0,spacing:2,children:e.jsxs(w,{size:{xs:12,sm:6},children:[e.jsx(l,{variant:"h3",align:"center",sx:{fontWeight:"500",color:"text.secondary"},children:"Update your Budget"}),e.jsx(Qe,{clinicId:x})]})})}),e.jsx($,{sx:{width:"100%",maxWidth:1200,mt:3,px:{md:4,sm:2,xs:1},py:1},children:e.jsxs(w,{container:!0,spacing:2,children:[e.jsxs(w,{size:{xs:12,sm:6},children:[e.jsx(l,{variant:"h3",align:"center",sx:{fontWeight:"500",color:"text.secondary"},children:"Update your Locations"}),e.jsx(le,{userMarketingData:i,setUserMarketingData:h,marketingData:W,unInitData:v,delLoc:_})]}),e.jsx(w,{size:{xs:12,sm:12},children:e.jsx(n,{sx:{textAlign:"center"},children:e.jsx(he,{clicked:B,variant:"contained",children:"Save Current Changes"})})})]})}),e.jsx($,{sx:{width:"100%",maxWidth:1200,mt:3,px:{md:4,sm:2,xs:1},py:1},children:e.jsx(He,{title:"Edit Your Google Ads Campaign Data.",text:"Stay tuned for the ability to easily edit and refine your Google Ads campaign data, allowing you to stay agile and drive even better results."})})]})},bt=()=>{const[p,t]=r.useState({}),[s,i]=r.useState({}),[h,x]=r.useState({}),[g,j]=r.useState(null),[b,m]=r.useState("");r.useEffect(()=>{De().then(a=>j(a)),m(D().get_alias()||""),D().getAdminMarketingData().then(a=>{if(a.exists()){const o=a.val();i(o)}}),D().getMarketingTemplateData().then(a=>{if(a.exists()){const o=a.val();t(o)}}),D().getUserMarketingData(g).then(a=>{if(a.exists()){const o=a.val();x(o)}})},[]);const v=!!s?.campaign_id;return e.jsx("div",{className:We.Page,children:v?e.jsx(Ze,{templateMarketingData:p,adminMarketingData:s,userMarketingData:h,setUserMarketingData:x,clinicId:g}):e.jsxs($,{sx:{width:"100%",maxWidth:1200,p:{md:4,sm:2,xs:1}},children:[e.jsx(xe,{}),e.jsx(N,{}),e.jsx(Ne,{templateMarketingData:p,adminMarketingData:s,userMarketingData:h,setUserMarketingData:x,clinicId:g,alias:b})]})})};export{bt 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.