PageSourceSearch

https://app.stammer.ai/static/react/8707.8e6ec897e30f192086ad.js

js stammer.ai collected 2026-09-28 10:06:32 UTC 11,019 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkStammer_ai=self.webpackChunkStammer_ai||[]).push([[8707],{41088:function(e,n,t){t.r(n),t.d(n,{ApiTokenPage:function(){return P}});var r=t(78685),s=t(2057),i=t(73349),a=t(93715),o=t(24926),l=t(8482),c=t(72433),d=t(26400),u=t(15874),h=t(45602),x=t(86591),p=t(97749),f=t(78166),m=t(6765),v=t(19124),g=t(21762),j=t(16657),b=t(15790),y=function(e,n,t,r){return new(t||(t=Promise))((function(s,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?s(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,o)}l((r=r.apply(e,n||[])).next())}))},w=function(e,n){var t,r,s,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(l){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)try{if(t=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=n.call(e,i)}catch(e){o=[6,e],r=0}finally{t=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}},k=["account","api-token"];function A(e){var n,t,r,s,i=e;return(null===(t=null===(n=i.response)||void 0===n?void 0:n.data)||void 0===t?void 0:t.message)||(null===(s=null===(r=i.response)||void 0===r?void 0:r.data)||void 0===s?void 0:s.detail)||"DEFAULT_ERROR"}function N(e){if("undefined"==typeof document)return!1;var n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.focus(),n.select();var t=!1;try{t=document.execCommand("copy")}catch(e){t=!1}return document.body.removeChild(n),t}var P=function(){var e=(0,j.Bd)().t,n=(0,h.jE)(),t=s.useState(!1),P=t[0],C=t[1],E=s.useState(null),S=E[0],T=E[1],R=s.useState(""),_=R[0],I=R[1],D=(0,x.I)({queryKey:k,queryFn:function(){return y(void 0,void 0,void 0,(function(){return w(this,(function(e){switch(e.label){case 0:return[4,m.nv.get(g.n.USERS.API_TOKEN)];case 1:return[2,e.sent().data]}}))}))}}),L=D.data,F=D.isLoading,O=s.useCallback((function(){n.invalidateQueries({queryKey:k})}),[n]),K=(0,p.n)({mutationFn:function(){return y(void 0,void 0,void 0,(function(){return w(this,(function(e){switch(e.label){case 0:return[4,m.nv.post(g.n.USERS.API_TOKEN)];case 1:return[2,e.sent().data]}}))}))},onSuccess:function(e){(0,v.Sx)("",e.message||"API token updated.","success"),C(!1),I(""),T(null),O()},onError:function(n){var t=A(n);(0,v.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}}),U=(0,p.n)({mutationFn:function(){return y(void 0,void 0,void 0,(function(){return w(this,(function(e){switch(e.label){case 0:return[4,m.nv.delete(g.n.USERS.API_TOKEN)];case 1:return[2,e.sent().data]}}))}))},onSuccess:function(e){(0,v.Sx)("",e.message||"API token deleted.","success"),C(!1),I(""),T(null),O()},onError:function(n){var t=A(n);(0,v.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}}),G="Delete"===_.trim(),q="Regenerate"===_.trim();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.aTG,{heading:"API Access Token",icon:(0,r.jsx)(u.A,{})}),(0,r.jsx)("div",{className:"container-xl px-4 mt-0",title:(null==L?void 0:L.is_accessible)||F?void 0:"To access API, please upgrade.",children:F?(0,r.jsx)(b.A,{showHeader:!1}):(0,r.jsxs)("div",{className:"row ".concat((null==L?void 0:L.is_accessible)?"":"disabled"),children:[(0,r.jsx)("div",{className:"col-12 col-md-6",children:(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("div",{className:"card-header",children:"API Token"}),(0,r.jsxs)("div",{className:"card-body",children:[(null==L?void 0:L.has_token)?(0,r.jsx)("div",{children:(0,r.jsxs)("div",{children:["Keep your token private. For requests, include it in headers as"," ",(0,r.jsx)("code",{children:(0,r.jsx)("b",{children:"Authorization: Token xxxxxxxxxxxx"})}),(0,r.jsxs)("div",{className:"d-flex justify-content-end",children:[(0,r.jsx)("span",{id:"api-token-copy-trigger",onClick:function(){return y(void 0,void 0,void 0,(function(){var n;return w(this,(function(t){switch(t.label){case 0:if(!(null==L?void 0:L.token))return[2];t.label=1;case 1:return t.trys.push([1,5,,6]),(null===(n=navigator.clipboard)||void 0===n?void 0:n.writeText)&&window.isSecureContext?[4,navigator.clipboard.writeText(L.token)]:[3,3];case 2:return t.sent(),[3,4];case 3:if(!N(L.token))throw new Error("Clipboard copy failed");t.label=4;case 4:return(0,v.Sx)("","Copied to clipboard","success"),[3,6];case 5:return t.sent(),N(L.token)?((0,v.Sx)("","Copied to clipboard","success"),[2]):((0,v.Sx)("",e("DISPLAY_STRINGS.FAILED_TO_COPY_ELEMENT"),"error"),[3,6]);case 6:return[2]}}
1))}))},className:"pointer","data-bs-toggle":"tooltip","data-bs-placement":"top",title:"Copy to clipboard",style:{cursor:"pointer"},children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-copy",children:[(0,r.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),(0,r.jsx)("span",{style:{width:12}}),(0,r.jsx)("a",{href:"#",className:"text-danger","data-bs-toggle":"tooltip","data-bs-placement":"top",title:"Delete Token",onClick:function(e){e.preventDefault(),I(""),T("delete")},children:(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-trash-2",children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),(0,r.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,r.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})})]}),(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsxs)("div",{className:"col-12",children:[(0,r.jsx)("div",{className:"d-flex align-items-center mb-1"}),(0,r.jsxs)("div",{className:"input-group password-input-group",children:[(0,r.jsx)("input",{id:"api-access-token-input",className:"form-control",type:P?"text":"password",readOnly:!0,value:L.token,onFocus:function(e){return e.currentTarget.select()}}),(0,r.jsxs)("span",{className:"input-group-text password-toggle-icon",id:"togglePassword_api_access_token",onClick:function(){return C((function(e){return!e}))},children:[(0,r.jsx)("i",{className:"fa fa-eye show-password-icon ".concat(P?"d-none":"")}),(0,r.jsx)("i",{className:"fa fa-eye-slash hide-password-icon ".concat(P?"":"d-none")})]})]}),(0,r.jsx)("small",{className:"form-text text-muted",children:L.help_text}),(0,r.jsx)("br",{}),(0,r.jsx)("small",{className:"text-red"})]})})]})}):(0,r.jsx)("div",{className:"alert alert-warning",children:"You need an API Token to use our services/APIs. Create one now."}),(null==L?void 0:L.is_accessible)?null:(0,r.jsx)(i.A,{severity:"warning",sx:{mt:2},children:"To access API, please upgrade."})]}),(0,r.jsx)("div",{className:"card-footer",children:(null==L?void 0:L.has_token)?(0,r.jsx)("button",{type:"button",className:"btn btn-primary",disabled:K.isPending,onClick:function(){I(""),T("regenerate")},children:K.isPending?"Re-generating...":"Re-generate Token"}):(0,r.jsx)("button",{type:"button",className:"btn btn-primary",disabled:K.isPending,onClick:function(){return K.mutate()},children:K.isPending?"Generating...":"Generate a New Token"})})]})}),(0,r.jsx)("div",{className:"col-12 col-md-6",children:(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("div",{className:"card-header",children:"API Documentation"}),(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsx)("p",{children:"Our APIs are comprehensively documented, designed for optimal efficiency, and maintain high availability to ensure your projects run seamlessly."}),(0,r.jsx)("p",{children:"Dive in to discover the powerful features and integrations we offer."})]}),(0,r.jsx)("div",{className:"card-footer",children:(0,r.jsx)("a",{className:"btn btn-primary",href:(null==L?void 0:L.docs_url)||"/doc/introduction/",target:"_blank",rel:"noopener noreferrer",children:"Explore API Documentation"})})]})})]})}),(0,r.jsxs)(a.A,{open:"delete"===S,onClose:function(){return T(null)},fullWidth:!0,maxWidth:"sm",children:[(0,r.jsx)(o.A,{children:"Confirm API Token Deletion"}),(0,r.jsxs)(l.A,{children:[(0,r.jsx)("p",{children:"Are you sure you want to delete this API Token? All requests using this token will fail."}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("label",{htmlFor:"deleteApiKey",className:"form-label",children:'Please enter "Delete" to confirm.'}),(0,r.jsx)("input",{className:"form-control",id:"deleteApiKey",value:_,onCh
1ange:function(e){return I(e.target.value)}})]}),!G&&_?(0,r.jsx)("div",{className:"mt-3 text-danger",children:'Please enter "Delete" to confirm.'}):null]}),(0,r.jsxs)(c.A,{children:[(0,r.jsx)(d.A,{onClick:function(){return T(null)},children:"Cancel"}),(0,r.jsx)("button",{type:"button",className:"btn btn-danger",disabled:!G,onClick:function(){return U.mutate()},children:U.isPending?"Deleting...":"Delete"})]})]}),(0,r.jsxs)(a.A,{open:"regenerate"===S,onClose:function(){return T(null)},fullWidth:!0,maxWidth:"sm",children:[(0,r.jsx)(o.A,{children:"API Token Regeneration"}),(0,r.jsxs)(l.A,{children:[(0,r.jsx)("p",{children:"Regenerating your API Token will invalidate the current one, causing all requests using it to fail. Ensure to replace any usage with the new token. Proceed?"}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("label",{htmlFor:"reGenerateApiKey",className:"form-label",children:'Please enter "Regenerate" to confirm.'}),(0,r.jsx)("input",{className:"form-control",id:"reGenerateApiKey",value:_,onChange:function(e){return I(e.target.value)}})]}),!q&&_?(0,r.jsx)("div",{className:"mt-3 text-danger",children:'Please enter "Regenerate" to confirm.'}):null]}),(0,r.jsxs)(c.A,{children:[(0,r.jsx)(d.A,{onClick:function(){return T(null)},children:"Cancel"}),(0,r.jsx)("button",{type:"button",className:q?"btn btn-success":"btn btn-secondary",disabled:!q,onClick:function(){return K.mutate()},children:K.isPending?"Regenerating...":"Confirm Regeneration"})]})]})]})}}}]);

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.