PageSourceSearch

https://app.diggrowth.com/assets/YoutubeInsta-BObCPnWN.js

js diggrowth.com collected 2026-10-03 22:01:53 UTC 9,903 bytes, 2 lines download raw bytes

1import{f as ke,m as ye,o as be,g as ve,c as we,E as Ce,r as l,u as _,U as Le,j as s,G as P,T as S,D as q,V as J,W}from"./index-Cwc_AiC_.js";import{A as h}from"./AdPlatformEndpoints-C7Y3YB4w.js";/* empty css                   */import{t as K}from"./data-D-s2S-_4.js";function je(){const $=ke(),[Q]=ye(),f=be(),b=ve(),d=we(),r=Ce();let x=Q.userData,[T,X]=l.useState("");const D=l.useRef(),g=l.useRef(),[Z,A]=l.useState({}),[C,j]=l.useState({}),[k,ee]=l.useState(""),[u,L]=l.useState(""),[te,p]=l.useState(!0),[y,ae]=l.useState(""),[ne,oe]=l.useState([]),[se,ie]=l.useState({accs_token:"",refresh_token:"",email:"",channel_id:"",channel_name:""}),M=!!_.getItem("isConfigured");let{type:t,configure:Se}=Le();new URLSearchParams(window.location.search),l.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("code"),o=window.location.pathname.includes("facebook-social"),i=!window.location.pathname.includes("youtubepaid"),c=window.location.pathname.includes("instagram-social"),e=window.location.pathname.includes("linkedin-social");M?(_.removeItem("isConfigured"),f("/settings/connectors")):M||(t=="youtube"||t=="youtubepaid"?le(a,i):t=="facebook-social"||t=="facebook"?re(a,o):t=="instagram"||t=="instagram-social"?ue(a,c):de(a,e))},[]),l.useEffect(()=>{ce()},[]);function ce(){const n=[];K.map(a=>{n.push(a.name)}),oe(n)}const le=async(n,a)=>{let o={},i={},c={};return c.code=n,o={headers:i,request:c},r.showLoader(),p(!0),await b.post(a?h.youtubeRedirection(o):h.youtubePaidRedirection(o),!0).then(e=>{ie(m=>({...m,accs_token:e.Access_token,refresh_token:e==null?void 0:e.refresh_token,email:e==null?void 0:e.email,channel_id:e==null?void 0:e.channel_id[0],channel_name:e==null?void 0:e.channel_name})),d.addToast({message:"Authorized",timeout:2e3,type:"success"})}).catch(e=>{d.addToast({message:(e==null?void 0:e.message)||"Something went wrong",timeout:2e3,type:"error"}),f("/settings/connectors")}).finally(()=>{r.hideLoader(),p(!1)})},ue=async(n,a)=>{let o={},i={},c={};return a?i.is_social=1:i.is_social=0,i.code=n,o={headers:i,request:c},r.showLoader(),p(!0),await b.post(h.instaRedirection(o),!0).then(e=>{var w,z,R,U,V,E,Y,F;d.addToast({message:"Authorized",timeout:2e3,type:"success"});let m=[],v={};((z=(w=e==null?void 0:e.data)==null?void 0:w.account_email)==null?void 0:z.length)>0&&((U=(R=e==null?void 0:e.data)==null?void 0:R.account_email)==null||U.map((_e,O)=>{var G,B,H;m.push({account_email:_e,value:(G=e==null?void 0:e.data)==null?void 0:G.account_id[O],name:(B=e==null?void 0:e.data)==null?void 0:B.account_name[O],page_token:(H=e==null?void 0:e.data)==null?void 0:H.page_token[O]})})),v.access_token=(E=(V=e==null?void 0:e.tokens)==null?void 0:V.access_tokens)==null?void 0:E.access_token,v.long_lived_access_token=(F=(Y=e==null?void 0:e.tokens)==null?void 0:Y.long_lived_token)==null?void 0:F.access_token,A(m),j(v),p(!1)}).catch(e=>{d.addToast({message:(e==null?void 0:e.message)||"Something went wrong",timeout:2e3,type:"error"}),f("/settings/connectors")}).finally(()=>{r.hideLoader()})},re=async(n,a)=>{let o={code:n};return a?o.is_social=1:o.is_social=0,r.showLoader(),p(!0),await b.post(h.getFacebookAccounts(o),!0).then(async i=>{r.hideLoader();let c=[];i.ad_accounts.length>0&&i.ad_accounts.map((e,m)=>{c.push({value:e[0],name:e[1],timezone:e[2]})}),A(c),j(i),p(!1)}).catch(i=>{r.hideLoader(),d.addToast({message:(i==null?void 0:i.message)||"Something went wrong",timeout:2e3,type:"error"}),_.removeItem("isConfigured"),f("/settings/connectors")})},de=async(n,a)=>{const o={};o.user_id=x.user_id,o.code=n;const i={};a&&(o.is_social=1);const c={request:i,headers:o};return r.showLoader(),p(!0),await b.get(h.saveLinkedInCreds(c),!0).then(async e=>{const m=JSON.stringify(e);j(m),_.setItem("isConfigured",!0),me(e.credentials.name?e.credentials.name:"",e.credentials.email,e,a),p(!1)}).catch(e=>{d.addToast({message:"Oops!! something went wrong at LinkedIn's end. Please try after some time.",timeout:2e3,type:"error"}),_.removeItem("isConfigured"),f("/settings/connectors")}).finally(()=>{r.hideLoader()})},me=async(n,a,o,i)=>{const c={};c.user_id=x.user_id,c.name=n,c.email=a,c.linkedInToken=o.credentials.access_token,i&&(c.is_social=1);const e={request:{},headers:c};return r.showLoader(),await b.get(h.getLinkedInAccounts(e),!0).then(async m=>{const v=[];m.length>0&&m.map((w,z)=>{v.push({value:w[1],name:w[0]})}),A(v),r.hideLoader()}).catch(m=>{r.hideLoader(),d.addToast({message:"Oops!! something went wrong at LinkedIn's end. Please try after some time.",timeout:2e3,type:"error"}),_.removeItem("isConfigured"),f("/settings/connectors")})},he=n=>{ee(n.target.value)},ge=n=>{let a=Z.find(o=>o.value===n.target.value);t=="instagram"||t=="instagram-social"?L({account_email:a.account_email,account_id:a==null?void 0:a.value,account_name:a==null?void 0:a.name,page_token:a==null?void 0:a.page_token}):t=="facebook-social"||t=="facebook"?L({value:n.target.value,name:a.name,timezone:a.timezone}):t=="linkedin"||t=="linkedin-social"?L({value:n.target.value,name:a.name}):L()},I=n=>(K.map(a=>{n==a.name&&(T=a.value,X(T))}),T),N=async()=>
1{if(t=="instagram"&&!u.account_name||t=="facebook-social"&&!u.value||t=="linkedin"&&!u.value){d.addToast({message:"Please select an account.",timeout:2e3,type:"error"});return}if(!k){d.addToast({message:"Historical Data is required.",timeout:2e3,type:"error"});return}let n=t=="instagram"||t=="instagram-social"?{ad_id:u.account_id,ad_name:u.account_name,page_token:u.page_token,email:u.account_email,duration:k,time_zone:y?I(y):"UTC",creds:C}:t=="facebook"?{ad_id:u.value,ad_name:u.name||"",time_zone:u.timezone,data_preset:k,creds:{...C},is_social:t=="facebook"?0:1}:t=="facebook-social"?{ad_id:u.value,ad_name:u.name||"",time_zone:y?I(y):"UTC",data_preset:k,creds:{...C},is_social:t=="facebook"?0:1}:t=="youtube"||t=="youtubepaid"?{...se,duration:k}:{...JSON.parse(C),user_id:x.user_id,ad_account_id:u.value,ad_account_name:u.name||"",time_zone:y?I(y):"UTC",months:k},o={headers:t=="youtube"||t=="youtubepaid"?{}:t=="instagram"?{is_social:0}:t=="instagram-social"?{is_social:1}:t=="facebook-social"?{is_social:1}:t=="facebook"?{is_social:0}:t=="linkedin-social"?{is_social:1}:{},request:n};return r.showLoader(),await b.post(t=="instagram"||t=="instagram-social"?h.instaConfig(o):t=="facebook-social"||t=="facebook"?h.syncFacebookData(n):t=="youtube"?h.youtubeConfig(o):t=="youtubepaid"?h.youtubePaidConfig(o):h.syncLinkedInAccounts(o),!0).then(i=>{d.addToast({message:"Authorized",timeout:2e3,type:"success"})}).catch(i=>{d.addToast({message:(i==null?void 0:i.message)||"Something went wrong",timeout:2e3,type:"error"})}).finally(()=>{_.removeItem("isConfigured"),f("/settings/connectors")})},fe=()=>s.jsx(s.Fragment,{children:s.jsx(P,{container:!0,children:s.jsxs(P,{item:!0,className:"timeZoneWidth",children:[s.jsx(q,{valueSelector:"value",itemList:ne,label:"Select Timezone",name:"timeZone",defaultValue:"(GMT+00:00) Default",selectedValue:y||"(GMT+00:00) Default",onChange:n=>{ae(n.target.value)}}),s.jsxs(S,{variant:"h6",mt:2,children:[s.jsxs("li",{children:[" ","UTC will be default time zone if you will not select any."]}),s.jsxs("li",{children:[" ","You will not be able to change it until you add the connector again."]}),s.jsxs("li",{children:[" ","Your data will be saved as per this time zone but you will see the reports as per the user profile time zone."]})]})]})})}),pe=n=>{switch(n){case"facebook":return N();case"facebook-social":return g.current.handleClickOpen();case"youtube":return g.current.handleClickOpen();case"youtubepaid":return g.current.handleClickOpen();case"instagram":return g.current.handleClickOpen();case"instagram-social":return g.current.handleClickOpen();case"linkedin":return g.current.handleClickOpen();case"linkedin-social":return g.current.handleClickOpen()}};return s.jsxs(P,{className:"AdPlatform__configure",hidden:te,bgcolor:$.palette.background.light,children:[s.jsx(S,{variant:"h5",component:"div",align:"center",style:{margin:"1rem 0"},children:`Configure ${(t==null?void 0:t.charAt(0).toUpperCase())+(t==null?void 0:t.slice(1))} Integration`}),t!=="youtube"&&t!=="youtubepaid"&&s.jsxs("div",{className:"AdPlatform__configure__dropdown",children:[s.jsx(S,{variant:"h6",component:"div",style:{marginLeft:"0.5rem"},children:t=="facebook-social"||t=="youtube"||t=="instagram-social"||t=="linkedin-social"?"Organic Account":"Ad Account"}),s.jsx(q,{valueSelector:"value",itemList:Z,label:"name",name:"AccountNames",onChange:ge})]}),s.jsxs("div",{className:"AdPlatform__configure__dropdown",children:[s.jsx(S,{variant:"h6",component:"div",style:{marginLeft:"0.5rem"},children:"Sync Historical Data"}),s.jsx(q,{valueSelector:"value",itemList:[{name:"3 Months",value:"3"},{name:"6 Months",value:"6"},{name:"9 Months",value:"9"},{name:"12 Months",value:"12"},{name:"24 Months",value:"24"},{name:"36 Months",value:"36"},{name:"48 Months",value:"48"}],label:"name",name:"name",selectedValue:k,onChange:he})]}),s.jsxs("div",{className:"AdPlatform__configure__row",style:{textAlign:"center"},children:[s.jsx(J,{btnText:"Go Back",color:"secondary",variant:"outlined",onClick:()=>{D.current.handleClickOpen()},type:"button"}),s.jsx(J,{btnText:"Authorise",onClick:()=>{pe(t)},type:"button"})]}),s.jsx(l.Suspense,{fallback:s.jsx("h3",{children:"Loading…"}),children:s.jsx(W,{ref:D,title:"Cancel Authorization?",confirm:"OK",discard:"Cancel",onConfirm:()=>{f("/settings/connectors"),_.removeItem("isConfigured")},hideCloseButton:!0,color:"error",onDiscard:()=>{D.current.handleClose()},description:"Changes made will not be saved. Are you sure you want to reload?"})}),s.jsx(l.Suspense,{fallback:s.jsx("h3",{children:"Loading…"}),children:s.jsx(W,{ref:g,title:"Select your time zone",confirm:"Save",customHTMLContent:fe,onConfirm:()=>{N()},color:"primary",onDiscard:()=>{g.current.handleClose()}})})]})}export{je as default};
2//# sourceMappingURL=YoutubeInsta-BObCPnWN.js.map

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.