1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32796],{7805:(t,e,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/instagram-callback",function(){return a(11657)}])},11657:(t,e,a)=>{"use strict";a.r(e),a.d(e,{__N_SSP:()=>n,default:()=>o});var r=a(23798);a(21462);var s=a(55026),n=!0;let o=()=>(0,r.jsx)(s.z,{})},14999:(t,e,a)=>{"use strict";a.d(e,{E:()=>i,y:()=>c});var r=a(27991),s=a(76945);let n="https://caz1liabq0.execute-api.eu-central-1.amazonaws.com/Prod",o=s.A.create({baseURL:n,timeout:1e4,headers:{"Content-Type":"application/json"}});o.interceptors.request.use(async t=>{let e=(await r.N.currentSession()).getAccessToken().getJwtToken();return e&&(t.headers.Authorization="Bearer ".concat(e)),t},t=>Promise.reject(t));var c=function(t){return t.HIDE="HIDE",t.DELETE="DELETE",t}({});let i={getInstagramPages:async t=>{try{return(await o.get("/instagram/pages?org_id=".concat(t))).data.pages||[]}catch(t){throw console.error("Error fetching Instagram pages:",t),t}},registerInstagram:async(t,e)=>{try{return(await o.post("/instagram/oauth?org_id=".concat(t,"&access_token=").concat(e))).data}catch(t){throw console.error("Error registering Instagram account:",t),t}},getInstagramPosts:async(t,e)=>{try{let a=e?"/instagram/posts?page_id=".concat(t,"&next_token=").concat(e):"/instagram/posts?page_id=".concat(t);return(await o.get(a)).data}catch(t){throw console.error("Error fetching Instagram posts:",t),t}},syncInstagramMedia:async t=>{try{let e=s.A.create({baseURL:n,timeout:3e5,headers:{"Content-Type":"application/json"}}),a=(await r.N.currentSession()).getAccessToken().getJwtToken();return a&&(e.defaults.headers.common.Authorization="Bearer ".concat(a)),(await e.post("/instagram/sync-media",{page_id:t})).data}catch(t){throw console.error("Error syncing Instagram media:",t),t}},getInstagramComments:async(t,e)=>{try{let a=e?"/instagram/comments?page_id=".concat(t,"&next_token=").concat(e):"/instagram/comments?page_id=".concat(t);return(await o.get(a)).data}catch(t){throw console.error("Error fetching Instagram comments:",t),t}},moderateComments:async t=>{try{return(await o.post("/instagram/comments/moderate",t)).data}catch(e){throw console.error("Error ".concat(t.type.toLowerCase(),"ing Instagram comments:"),e),e}}}},55026:(t,e,a)=>{"use strict";a.d(e,{z:()=>p});var r=a(23798),s=a(7664),n=a(78720),o=a(97080),c=a(6265),i=a(11864),g=a(97894),l=a(32967),m=a(8861),u=a(21462),d=a(14999),h=a(73518);let p=()=>{let t=(0,h.WD)(),e=(0,m.useRouter)(),a=(0,s.d)(),[p,w]=(0,u.useState)(!1),[E,_]=(0,u.useState)(null),[y,x]=(0,u.useState)(!1);(0,u.useEffect)(()=>{if(window.location.hash){let t=new URLSearchParams(window.location.hash.substring(1)),e=t.get("access_token"),a=t.get("state");if(console.log("Access token:",e,t),e&&a)return void j(e,a)}},[]);let j=async(e,r)=>{w(!0),_(null);try{await d.E.registerInstagram(r,e),x(!0),a({title:t("pages.instagram.connectionSuccess"),status:"success",duration:5e3,isClosable:!0})}catch(r){var s,n;let e=(null==(n=r.response)||null==(s=n.data)?void 0:s.message)||t("pages.instagram.connectionError");_(e),a({title:t("pages.instagram.connectionError"),description:e,status:"error",duration:5e3,isClosable:!0})}finally{w(!1)}},k=()=>{let t=new URLSearchParams(window.location.search).get("state");t?e.push("/org/".concat(t,"/integrations/instagram")):e.push("/choose-organization")};return(0,r.jsx)(n.a,{p:8,children:(0,r.jsx)(o.o,{children:(0,r.jsx)(c.T,{spacing:6,children:p?(0,r.jsxs)(c.T,{children:[(0,r.jsx)(i.y,{size:"xl",color:"blue.500",mb:4}),(0,r.jsx)(g.E,{children:t("pages.instagram.processing")})]}):E?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g.E,{color:"red.500",children:E}),(0,r.jsx)(l.$,{onClick:k,children:t("buttons.back")})]}):y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g.E,{color:"green.500",children:t("pages.instagram.connectionSuccess")}),(0,r.jsx)(l.$,{colorScheme:"blue",onClick:k,children:t("pages.instagram.viewConnections")})]}):(0,r.jsx)(g.E,{children:t("pages.instagram.waitingForRedirect")})})})})}}},t=>{var e=e=>t(t.s=e);t.O(0,[90636,46593,38792],()=>e(7805)),_N_E=t.O()}]);
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.