1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2074],{99194:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/connect-instacart",function(){return a(44396)}])},44396:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return p},default:function(){return m}});var n=a(85893),r=a(67294),i=a(11163),c=a(25675),o=a.n(c),s=a(87066),l=a(533),d=a(65459),u=a(78240),h=a(1909),p=!0;function m(e){let{hasAuthorizationCode:t}=e,a=(0,i.useRouter)(),[c,p]=(0,r.useState)(!1),[m,x]=(0,r.useState)(""),[f,g]=(0,r.useState)(""),[b,j]=(0,r.useState)(""),[y,v]=(0,r.useState)(""),[N,w]=(0,r.useState)(""),_=e=>{var t,a;return x((null===(t=e.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.error)||"The connection could not be completed. Please try again.")};(0,r.useEffect)(()=>{let e=!1;return window.history.replaceState(null,"","/connect-instacart"+(t?"?code_received=true":"")),s.Z.post("/api/instacart/connectionConfig",{}).then(t=>{let{data:a}=t;e||w(a.redirect_uri)}).catch(t=>{e||_(t)}),()=>{e=!0}},[t]);let I=async e=>{e.preventDefault(),p(!0),x("");try{await s.Z.post("/api/instacart/check_connection",{client_id:f.trim(),client_secret:b.trim(),code:y.trim()}),j(""),v(""),await a.push("/select-instacart-account?redirected=true")}catch(t){_(t)}finally{p(!1)}};return(0,n.jsx)(u.Z,{title:"Adzviser | Connect to Instacart",content:"Connect your Instacart Ads account using your application credentials.",hideFooter:!0,children:(0,n.jsx)("div",{className:"mx-auto auth__row fromBox",style:{paddingBottom:"50px"},children:(0,n.jsx)("div",{className:"authSignup",children:(0,n.jsxs)("div",{className:"authMain text-center",children:[(0,n.jsx)("div",{className:"authMain__title text-center mb-2",children:(0,n.jsxs)("h2",{className:"medium-font",children:["Connect to Instacart"," ",(0,n.jsx)(o(),{src:h.Z.instacart,width:45,height:45,priority:!0,style:{height:"auto"},alt:"Instacart logo"})]})}),(0,n.jsx)("div",{className:"accordion accordion-flush mb-3",id:"connectionGuideAccordion",children:(0,n.jsxs)("div",{className:"accordion-item",children:[(0,n.jsx)("h2",{className:"accordion-header",id:"connectionGuideHeading",children:(0,n.jsx)("button",{className:"accordion-button",type:"button","data-bs-toggle":"collapse","data-bs-target":"#connectionGuide","aria-expanded":"true","aria-controls":"connectionGuide",children:"Connect with application credentials"})}),(0,n.jsx)("div",{id:"connectionGuide",className:"accordion-collapse collapse show","aria-labelledby":"connectionGuideHeading","data-bs-parent":"#connectionGuideAccordion",children:(0,n.jsxs)("div",{className:"accordion-body fs-6",style:{textAlign:"left",maxHeight:"250px",overflowY:"auto"},children:[(0,n.jsx)("p",{className:"mb-3",children:"Create and authorize your Instacart application, then enter your application UID and secret below."}),(0,n.jsxs)("ol",{children:[(0,n.jsxs)("li",{className:"mb-2",children:["Sign in to"," ",(0,n.jsx)("a",{href:"https://ads.instacart.com/",target:"_blank",rel:"noopener noreferrer",children:"Instacart Ads Manager"})," ","and open Settings â OAuth. Your user needs API Authentication enabled and Read access for Customer Insights Reporting."]}),(0,n.jsxs)("li",{className:"mb-2",children:["Create an application named ",(0,n.jsx)("strong",{children:"Adzviser"})," ","and register this exact redirect URI:",(0,n.jsx)("code",{style:{overflowWrap:"anywhere",display:"block"},children:N||"Loading redirect URIâ¦"})]}),(0,n.jsxs)("li",{className:"mb-2",children:["Copy the application's ",(0,n.jsx)("strong",{children:"UID"})," and"," ",(0,n.jsx)("strong",{children:"Secret"})," and keep them for the form below."]}),(0,n.jsxs)("li",{className:"mb-2",children:["Click ",(0,n.jsx)("strong",{children:"Authorize"})," in Instacart. When redirected here, we capture the authorization code. If you copy it manually, paste only the code value from the callback URL below."]}),(0,n.jsxs)("li",{children:["Enter the UID and secret and click Start within"," ",(0,n.jsx)("strong",{children:"five minutes"}),". If the code expires, authorize again to get a new code."]})]}),(0,n.jsx)("a",{href:"https://docs.instacart.com/ads_manager/managing_your_account",target:"_blank",rel:"noopener noreferrer",children:"Instacart account and API access guide"})]})})]})}),m&&(0,n.jsx)("p",{className:"alert alert-danger",role:"alert",children:m}),(0,n.jsxs)("form",{onSubmit:I,className:"formInputs",children:[(0,n.jsx)("div",{className:"form-group mb-3",children:(0,n.jsx)("input",{id:"client-id",type:"text",className:"form-control",placeholder:"Application UID (Client ID)","aria-label":"Application UID (Client ID)",value:f,onChange:e=>g(e.target.value),required:!0,autoComplete:"off"})}),(0,n.jsx)("div",{className:"form-group ".concat(t?"mb-4":"mb-3"),children:(0,n.jsx)("input",{id:"client-secret",type:"password",className:"form-control",placeholder:"Application Secret","aria-label":"Application Secret",value:b,onChange:e=>j(e.target.value),required:!0,autoComplete:"new-password"})}),t?(0,n.jsx)("p",{className:"alert alert-success text-start mb-4",role:"status",children:"Authorization code received. Enter your application details to finish. If it has expired, authorize again in Instacart."}):(0,n.jsx)("div",{className:"form-group mb-4",children:(0,n.jsx)("input",{id:"authorization-code",type:"password",className:"form-control",placeholder:"Authorization Code","aria-label":"Authorization Code",value:y,onChange:e=>v(e.target.value),required:!0,autoComplete:"off"})}),(0,n.jsx)("button",{className:"btn btn-primary w-100",type:"submit",disabled:c,"aria-label":c?"Connecting to Instacart":"Start",children:c?(0,n.jsx)("div",{className:"d-flex justify-content-center",children:(0,n.jsx)(l.iT,{color:d.w.Secondary,secondaryColor:"#fff",width:30,height:30})}):"Start"})]})]})})})})}}},function(e){e.O(0,[4738,6660,7473,3662,4817,4321,2290,7423,3481,533,4610,5332,2427,8240,9774,2888,179],function(){return e(e.s=99194)}),_N_E=e.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.