1import{_ as K}from"./D31hZUl6.js";import{A as g}from"./CAyhup6h.js";import{T as k}from"./DhmNBdcb.js";import{aG as w,aI as p,aJ as l,aK as s,aX as d,aP as y,aL as i,aN as r,aQ as b,aR as v,aO as u,aM as h,aS as A,aT as I,aU as S,aH as M}from"./Duq0Yqab.js";import{P as U}from"./BBZpJyqX.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"bb082cde4d1a2072e36f45763ce4b2e1c8ea0cc5"}}catch{}})();try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b57f550a-3a54-48a8-a03c-6671ab9ba2e9",e._sentryDebugIdIdentifier="sentry-dbid-b57f550a-3a54-48a8-a03c-6671ab9ba2e9")})()}catch{}const N={setup(){const e=I(),{t}=S();return M({title:t("np.API keys"),meta:[{hid:"description",name:"description",content:t("np.API keys")}]}),{nuxtApp:e}},name:"np-api-keys",components:{Popup:U,TextInput:k,AlertMessage:g},data(){return{userApiKeys:[],userApiKey:"",langId:this.$i18n.locale=="uk"?4:2,apiKeyAlreadyInUseStatus:0,userEnteredInvalidApiKeyStatus:0,validApiKey:0,orderId:0,apiKeyModal:0}},async created(){await this.fetchUserApiKeys()},computed:{showApiKeysList(){return this.validApiKey||this.userApiKeys.length>0}},methods:{async fetchUserApiKeys(){try{const{data:e}=await this.$axios.get("psp/np/npCouterpaties/");this.userApiKeys=e,Array.isArray(e)&&e.length>0?this.validApiKey=1:this.validApiKey=0}catch(e){console.error("Error fetching API keys:",e),this.validApiKey=0}},async saveUserApiKey(){if(this.userApiKey.length>0){try{var e=(await this.$axios.post("psp/cabinet/saveUserNpApiKey/",{np_api_key:this.userApiKey})).data}catch(t){console.error("Error while making request:",t)}e&&(this.userEnteredInvalidApiKeyStatus=!e.valid_api_key,this.validApiKey=e.valid_api_key,this.apiKeyAlreadyInUseStatus=e.np_key_already_in_use,this.userApiKey="",e.valid_api_key?(this.validApiKey=1,await this.fetchUserApiKeys()):this.validApiKey=0)}this.closeApiKeyModal()},async deleteApiKey(e){const{data:t}=await this.$axios.post("psp/np/deleteNpApiKey/",{keyId:e});t.status===1&&await this.fetchUserApiKeys()},showApiKeyModal(){this.apiKeyModal=1,this.nuxtApp.$utils.openModalFixed()},closeApiKeyModal(){this.apiKeyModal=0,this.nuxtApp.$utils.closeModalFixed()}}},P={class:"app-content"},T={class:"container-wrapper"},$={class:"relative structure-col-row ai-start-center jc-between gap-10 mb-16"},C={class:"display-if size18-24 bold mb-0"},z={class:"light-box light-box__shadow"},E={class:"bold mb-10 size18"},V={class:"table-section mb-20"},B={class:"table-main w-full"},L=["onClick"],x={class:"text-c mt-20"},Y={key:1,action:"#"},F={class:"bold mb-10 size18"},R={target:"_blank",href:"https://new.novaposhta.ua/dashboard/settings/developers"},j={class:"relative mt-16"},D={class:"size13 text-light shrink-0 ellipsis-1 mb-8 lh1_2"},H={class:"structure-col gap-8 w-full"},q={class:"text-c mt-20"},G=["disabled"],J={action:"#"},O={class:"mt0 mb16"},Q={target:"_blank",href:"https://new.novaposhta.ua/dashboard/settings/developers"},X={class:"structure-col-row ai-center-d jc-between gap-10-16"},W={class:"ellipsis-1 lh1_2 shrink-0"},Z={class:"relative w-full"},ee={class:"text-c mt-20"},se=["disabled"];function te(e,t,ie,ae,n,o){const c=A("AlertMessage"),f=K,_=A("TextInput"),m=A("Popup");return l(),p("div",P,[s("div",T,[s("div",$,[s("h1",C,i(e.$t("np.API keys")),1),t[5]||(t[5]=s("div",{class:"shrink-0"},[s("img",{src:"https://ria.riastatic.com/dist/img/icons/np-logo.png",alt:"image"})],-1))]),n.apiKeyAlreadyInUseStatus?(l(),d(c,{key:0,type:"warning","show-button-close":!1},{default:r(()=>[s("p",null,i(e.$t("np.The New Poshta key is already assigned to another seller"))+".",1)]),_:1})):y("",!0),n.userEnteredInvalidApiKeyStatus&&!n.apiKeyAlreadyInUseStatus?(l(),d(c,{key:1,type:"warning","show-button-close":!1},{default:r(()=>[s("p",null,i(e.$t("np.The New Mail key was not found or its validity period has expired"))+".",1)]),_:1})):y("",!0),n.apiKeyAlreadyInUseStatus?(l(),d(c,{key:2,type:"warning","show-button-close":!1},{default:r(()=>[s("p",null,i(e.$t("np.The New Poshta key is already assigned to another seller"))+".",1)]),_:1})):y("",!0),s("div",z,[o.showApiKeysList?(l(),p(b,{key:0},[s("h3",E,i(e.$t("np.Yours"))+" "+i(e.$t("np.API keys")),1),s("div",V,[s("table",B,[s("thead",null,[s("tr",null,[s("th",null,i(e.$t("np.Sender")),1),t[6]||(t[6]=s("th",null,"API key",-1)),s("th",null,i(e.$t("np.Actions")),1)])]),s("tbody",null,[(l(!0),p(b,null,v(n.userApiKeys,a=>(l(),p("tr",{key:a.key_id},[s("td",null,i(a.last_name)+" "+i(a.first_name),1),s("td",null,i(a.api_key),1),s("td",null,[s("span",{class:"display-if ai-center gap-6 size14 red pointer",onClick:ne=>o.deleteApiKey(a.key_id)},[h(f,{icon:"common-i16-delete",class:"size16"}),u(" "+i(e.$t("basket.Delete")),1)],8,L)])]))),128))])])]),s("div",x,[s("button",{type:"button",class:"button _green size16 w-content",onClick:t[0]||(t[0]=(...a)=>o.showApiKeyModal&&o.showApiKeyModal(...a))},i(e.$t("np.Add a new API key")),1)])],64)):(l(),p("form",Y,[s("h3",F,i(e.$t("np.To start work, you need to specify a special New Mail key")),1),s("span",null,i(e.$t("np.You can get the key on the Nova Poshta website"))+":",1),s("span",null,[u(i(e.$t("np.Business cabinet - Settings - Security"))+" - ",1),s("a",R,i(e.$t("np.create key")),1)]),s("div",j,[s("div",D,i(e.$t("np.Np key"))+": ",1),s("div",H,[h(_,{type:"text",class:"size16",id:"name",modelValue:n.userApiKey,"onUpdate:modelValue":t[1]||(t[1]=a=>n.userApiKey=a),name:"name"},null,8,["modelValue"])])]),s("div",q,[s("button",{type:"button",disabled:n.userApiKey.length<1,onClick:t[2]||(t[2]=(...a)=>o.saveUserApiKey&&o.saveUserApiKey(...a)),class:"button _green size16 w-content"},i(e.$t("np.Save np key")),9,G)])]))])]),n.apiKeyModal?(l(),d(m,{key:0,onClose:o.closeApiKeyM
1odal,customClass:"medium"},{"popup-header":r(()=>[u(i(e.$t("np.Add a new API key")),1)]),"popup-content":r(()=>[s("form",J,[s("p",O,[u(i(e.$t("np.You can get the key on the Nova Poshta website"))+": "+i(e.$t("np.Business cabinet - Settings - Security"))+" - ",1),s("a",Q,i(e.$t("np.create key")),1)]),s("div",X,[s("span",W,i(e.$t("np.Np key"))+": ",1),s("div",Z,[h(_,{type:"text",class:"size16",id:"name",modelValue:n.userApiKey,"onUpdate:modelValue":t[3]||(t[3]=a=>n.userApiKey=a),name:"name"},null,8,["modelValue"])])]),s("div",ee,[s("button",{type:"button",disabled:n.userApiKey.length<1,onClick:t[4]||(t[4]=(...a)=>o.saveUserApiKey&&o.saveUserApiKey(...a)),class:"button _green size16 w-content"},i(e.$t("np.Save np key")),9,se)])])]),_:1},8,["onClose"])):y("",!0)])}const ye=w(N,[["render",te]]);export{ye 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.