1"use strict";(self.webpackChunkshopwp=self.webpackChunkshopwp||[]).push([["SettingExternalApiKey-admin"],{"./_tmp/admin/js/app/settings/_common/external-api-keys.jsx"(e,t,n){n.r(t),n.d(t,{default:()=>y});var a=n("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),s=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),r=n("./node_modules/@babel/runtime/regenerator/index.js"),o=n.n(r),p=n("./node_modules/@emotion/react/dist/emotion-react.browser.esm.js"),i=n("./npm-packages/@shopwp/api/src/errors/index.js"),l=n("./_tmp/admin/js/app/admin/_state/hooks.js"),c=n("./npm-packages/@shopwp/common/src/utils/index.jsx");function u(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e||(e=arguments.length>1?arguments[1]:void 0),e?e.substring(e.length-30):""}var d={name:"1z927q-FormFieldsWrapperCSS",styles:"display:flex;flex-direction:column;flex:1;.shopwp-help{margin-top:16px!important;}.components-base-control+.components-base-control{margin-top:20px;}.components-button{width:100px;};label:FormFieldsWrapperCSS;"},m={name:"3pm7kj-ErrorCSS",styles:".components-notice{width:100%;margin-top:0;}.components-button{top:0px;};label:ErrorCSS;"};const y=function(e){var t=e.activator,n=e.deactivator,r=e.defaultApiKey,y=e.defaultApiSecretKey,h=e.serviceName,x=e.serviceLink,b=e.hasCustomFields,f=void 0!==b&&b,g=wp.components,v=g.TextControl,S=g.Button,A=g.Notice,w=wp.element.useState,k=w(!1),K=(0,s.A)(k,2),C=K[0],_=K[1],Y=w(r),j=(0,s.A)(Y,2),E=j[0],T=j[1],I=w(y),F=(0,s.A)(I,2),N=F[0],P=F[1],L=w((function(){return!!r})),O=(0,s.A)(L,2),R=O[0],B=O[1],H=w(!1),z=(0,s.A)(H,2),G=z[0],W=z[1],q=(0,l.H)(),M=(0,l.G)();function D(){return J.apply(this,arguments)}function J(){return J=(0,a.A)(o().mark((function e(){var n,a,r,p,l,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _(!1),W(!0),q({type:"SET_NOTICE",message:!1}),n=f?{apiKey:E,apiSecretKey:N}:{apiKey:E},e.next=1,(0,c.to)(t(n));case 1:if(a=e.sent,r=(0,s.A)(a,2),p=r[0],l=r[1],W(!1),!(d=(0,i.FL)(p,l))){e.next=2;break}return _(d),e.abrupt("return");case 2:B(!0),f?(T(l.data.api_key),P(l.data.api_secret_key)):T(u(l.data,E)),q({type:"SET_NOTICE",payload:{type:"success",message:M.t.a.acAPIKey}});case 3:case"end":return e.stop()}}),e)}))),J.apply(this,arguments)}function Q(){return U.apply(this,arguments)}function U(){return U=(0,a.A)(o().mark((function e(){var t,a,r,p,l,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _(!1),W(!0),q({type:"SET_NOTICE",message:!1}),t=f?{apiKey:E,apiSecretKey:N}:{apiKey:E},e.next=1,(0,c.to)(n(t));case 1:if(a=e.sent,r=(0,s.A)(a,2),p=r[0],l=r[1],W(!1),!(u=(0,i.FL)(p,l))){e.next=2;break}return _(u),W(!1),e.abrupt("return");case 2:B(!1),T(""),P(""),q({type:"SET_NOTICE",payload:{type:"success",message:M.t.a.deAPIKey}});case 3:case"end":return e.stop()}}),e)}))),U.apply(this,arguments)}var V=(0,p.AH)("display:flex;justify-content:space-between;margin-bottom:22px;position:relative;.components-base-control{flex:1;margin-right:8px;}.components-button{position:relative;top:20px;top:25px;height:31px;justify-content:center;}.shopwp-help{margin-top:",f?"14px":"-15px","!important;font-size:12px;color:rgb(117, 117, 117);};label:RowCSS;"),X=m,Z=d;return(0,p.Y)(React.Fragment,null,(0,p.Y)("div",{css:V},f?(0,p.Y)("div",{css:Z},(0,p.Y)("div",{css:Z},(0,p.Y)(v,{type:"text",value:E,onChange:T,disabled:G||R,placeholder:M.t.a.enterKey,label:h+" API Key"}),(0,p.Y)(v,{type:"text",value:N,onChange:P,disabled:G||R,placeholder:M.t.a.enterSecretKey,label:h+" API Secret Key"})),(0,p.Y)(S,{onClick:R?Q:D,disabled:G,isBusy:G,isPrimary:!0,text:R?M.t.a.de:M.t.a.ac})):(0,p.Y)(React.Fragment,null,(0,p.Y)(v,{type:"text",value:E,onChange:T,disabled:G||R,placeholder:M.t.a.enterKey,label:h+" API Key"}),(0,p.Y)(S,{onClick:R?Q:D,disabled:G,isBusy:G,isPrimary:!0,text:R?M.t.a.de:M.t.a.ac}))),(0,p.Y)("div",{css:V},(0,p.Y)("p",{className:"shopwp-help"},(0,p.Y)("a",{href:x,target:"_blank"},M.t.a.genApiKey))),C&&(0,p.Y)("div",{css:[V,X,";label:ExternalApiKey;"]},(0,p.Y)(A,{status:"error",onRemove:function(){_(!1)}},(0,p.Y)("div",{dangerouslySetInnerHTML:{__html:C}}))))}}}]);
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.