PageSourceSearch

https://us.zoie.ai/assets/TiktokOAuthCallback-BcKxdInz.js

js zoie.ai collected 2026-10-05 14:21:26 UTC 6,822 bytes, 1 lines download raw bytes

1import{e,A as L,u as N,f as R}from"./index-C3mDJt84.js";import{M as E,T as z,y as D,f as B,B as W,r as h,S as K,s as w}from"./vendor-antd-Dp-wSBmF.js";import{b as H,e as U}from"./vendor-react-B8SZ4TuU.js";import{aC as Y,df as $}from"./LeadDetailPanel-Vnid2znV.js";import{T as F,a as V,b as j,d as v}from"./startTiktokLogin-OlaJt8RG.js";import{C as G}from"./famicons_checkmark-done-sharp-DwbO9Cv8.js";import{T as Q}from"./TiktokActiveBadge-np6wLN2H.js";import"./vendor-network-vEC1ZpqK.js";import"./index-DcvzyCRK.js";import"./takeoverNotification-Xzi_ehth.js";import"./deployRegion-BKjgxhG7.js";import"./timezone-d65MrB67.js";import"./UserTimezoneContext-CVxgwsUm.js";import"./timezoneUtils-BcVgYIkf.js";import"./AgentRightRail-CGMjVa3M.js";import"./style-Bk9hQovb.js";import"./index-Caq8W1M5.js";import"./whatsappConnection-YwspKzFT.js";import"./CommonCodeList-DfvjmZbB.js";import"./blockedLeads-CpiCZqel.js";import"./stripePaymentsApi-DLmZ0sUM.js";import"./useIsMobile-DonAi6ot.js";import"./TimeSelect-DH4XZrMF.js";import"./AppointmentConfirmation-AixltNVV.js";import"./twilioWhatsAppApi-D4Iz05sq.js";import"./appICON-C-YNxLRb.js";const{Title:X,Text:k}=z;function Z(o){return!o||typeof o!="object"?{username:null,name:null,profile_picture_url:null}:{username:o.username??null,name:o.name??null,profile_picture_url:o.profile_picture_url??null}}const q=({open:o,connection:n,onDone:x})=>{const{username:l,name:m,profile_picture_url:r}=Z(n),y=l?`@${l}`:"@connected",b=m||"TikTok account",T=(m||l||"?").slice(0,1).toUpperCase();return e.jsxs(E,{title:null,open:o,footer:null,closable:!1,centered:!0,width:"100%",style:{maxWidth:420},maskClosable:!1,keyboard:!1,styles:{content:{background:"#EFEFEF",borderRadius:20,border:"1px solid #FFFFFF",padding:0,overflow:"hidden",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.12)"},body:{padding:"28px 24px 24px",background:"transparent"}},children:[e.jsx("div",{style:{textAlign:"center",marginBottom:20},children:e.jsx("img",{src:G,alt:"",width:81,height:81,style:{display:"inline-block",verticalAlign:"middle"},"aria-hidden":!0})}),e.jsx(X,{level:4,style:{textAlign:"center",marginTop:0,marginBottom:8,fontWeight:600,fontSize:20,color:"#000"},children:"Account connected!"}),e.jsx(k,{style:{display:"block",textAlign:"center",marginBottom:24,fontSize:14,color:"#696e98",lineHeight:1.5},children:"Your TikTok account is now linked to Zoie. DMs will start appearing in your inbox right away."}),e.jsxs("div",{style:{background:"#FFFFFF",borderRadius:20,padding:16,marginBottom:16,display:"flex",alignItems:"center",gap:14,boxShadow:"0 1px 4px rgba(0, 0, 0, 0.04)"},children:[e.jsxs("div",{style:{position:"relative",flexShrink:0},children:[e.jsx(D,{size:56,src:r||void 0,style:{background:"#010101",fontSize:22,fontWeight:600,color:"#fff"},children:r?null:T}),e.jsx("img",{src:Y,alt:"",width:14,height:14,style:{position:"absolute",right:-1,bottom:-1,borderRadius:4,border:"1.5px solid #fff",boxShadow:"0 1px 3px rgba(0,0,0,0.12)"}})]}),e.jsxs("div",{style:{minWidth:0,textAlign:"left"},children:[e.jsxs(B,{size:8,wrap:!0,style:{marginBottom:4},children:[e.jsx(k,{strong:!0,style:{fontSize:15,color:"#000"},children:y}),e.jsx(Q,{disabled:!1})]}),e.jsx(k,{style:{fontSize:13,color:"#8C8C8C",display:"block"},children:b})]})]}),e.jsxs("div",{style:{background:"#E6E6E6",borderRadius:8,padding:"12px 14px",display:"flex",alignItems:"flex-start",gap:10,marginBottom:24},children:[e.jsx("span",{style:{flexShrink:0,marginTop:2,display:"inline-flex"},children:e.jsx(L,{width:18,height:18,color:"#5A6574"})}),e.jsx(k,{style:{fontSize:13,color:"#595959",lineHeight:1.5,margin:0},children:"Assign AI agents to handle your TikTok DMs and automate conversations."})]}),e.jsx(W,{type:"primary",block:!0,size:"large",onClick:x,style:{height:46,borderRadius:10,fontWeight:500,background:"#000",borderColor:"#000"},children:"Done"})]})},f=new Set,J={...F,body:{...F.body,padding:"24px 24px 28px",background:"#EFEFEF"}},Ce=()=>{const o=H(),[n]=U(),x=n.toString(),[l,m]=h.useState("Securing your session with TikTok…"),[r,y]=h.useState(null),[b,T]=h.useState("/settings/tiktok");return h.useEffect(()=>{if(N(window.location.search))return;const M=n.get("error"),a=n.get("code"),P=n.get("state"),S=(d,u,g)=>{const t=sessionStorage.getItem(j)||"/settings/tiktok";v(),d==="error"?w.error({message:u,description:g,duration:6}):d==="warning"&&w.warning({message:u,description:g,duration:6}),o(t,{replace:!0})};if(M||n.get("error_description")){S("warning","TikTok connection cancelled","You can try again when you are ready.");return}if(!a){S("error","TikTok","Missing authorization code. Start the connection again from Integrations or Settings.");return}if(f.has(a))return;f.add(a);const C=sessionStorage.getItem("tiktok_oauth_state_expected");if(C&&P!==C){f.delete(a),S("error","TikTok","Security check failed (state mismatch). Try connecting again.");return}const A=sessionStorage.getItem("tiktok_oauth_redirect_uri"),c=sessionStorage.getItem("tiktok_oauth_business_id"),I=sessionStorage.getItem("tiktok_oauth_code_verifier");(async()=>{var d,u,g;try{m("Exchanging authorization with your server…");const t={code:a};A&&(t.redirect_uri=A),c&&(t.business_id=c),I&&(t.code_verifier=I);const i=await R.post("/api/v1/auth/tiktok/connect",t,{headers:c?{"X-Business-Id":String(c)}:{}});if(!((d=i==null?void 0:i.data)!=null&&d.success))throw new Error(((u=i==null?void 0:i.data)==null?void 0:u.message)||"Connection failed");const s=sessionStorage.getItem(j)||"/settings/tiktok";v(),c&&($(String(c),i.data),window.dispatchEvent(new CustomEvent("tiktok-connection-saved"))),T(s),y(i.data)}catch(t){f.delete(a);const i=sessionStorage.getItem(j)||"/settings/tiktok";v();const s=(g=t==null?void 0:t.response)==null?void 0:g.data;let _=(s==null?void 0:s.message)||(t==null?void 0:t.message)||"Could not complete TikTok connection.";const p=s==null?void 0:s.existingConnection;if(p&&(p.businessName||p.businessId!=null)){const O=p.businessName||`business #${p.businessId}`;_=`${_} Linked organization: ${O}. That business must disconnect TikTok before this one can use the same account.`}w.error({message:"TikTok connection failed",description:_,duration:12}),o(i,{replace:!0})}})()},[o,x]),e.jsxs(e.Fragment,{children:[r?null:e.jsxs(E,{title:null,open:!0,footer:null,closable:!1,centered:!0,width:500,style:{maxWidth:"min(100vw - 32px, 600px)"},maskClosable:!1,keyboard:!1,styles:J,children:[e.jsx(V,{description:"Connecting your account…",descriptionStyle:{marginBottom:20}}),e.jsxs(B,{direction:"vertical",size:16,align:"center",style:{width:"100%"},children:[e.jsx(K,{size:"large"}),e.jsx(z.Paragraph,{style:{marginBottom:0,maxWidth:440,textAlign:"center",color:"#696e98",fontSize:15},children:l})]})]}),e.jsx(q,{open:!!r,connection:r,onDone:()=>o(b||"/settings/tiktok",{replace:!0})})]})};export{Ce 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.