You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
18 KiB

var F=Object.defineProperty;var P=(e,i,n)=>i in e?F(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n;var r=(e,i,n)=>P(e,typeof i!="symbol"?i+"":i,n);import{y as O,d as _}from"./js-yaml-CxlQHuPU.js";import{R as B}from"./index-BH4jUAKp.js";import{V as M,f as j,e as Y,C as W,_ as z,g as k,h as t,i as d,j as o,k as a,t as u,l as h,w as A,F as w,z as I,x as s}from"./index-BLqts8WY.js";import{u as Q}from"./index-CsfPLOYu.js";import{Q as q}from"./QuickNav-DgCyvgDx.js";import{B as E,l as K,s as Z,e as J,h as X,i as x,g as G,j as ee,k as ie,n as te,p as se,q as oe,u as ne,C as ae,E as re,F as le,A as de}from"./index-MyY_xqVN.js";import{T as me}from"./TopMessage-BE0GBIgW.js";import"./concat-BK8PKeDS.js";import"./sort-Dh4GzQVc.js";var he=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,ue=(e,i,n,f)=>{for(var c=f>1?void 0:f?fe(i,n):i,v=e.length-1,p;v>=0;v--)(p=e[v])&&(c=(f?p(i,n,c):p(c))||c);return f&&c&&he(i,n,c),c};let T=class extends M{constructor(){super(...arguments);r(this,"$notify");r(this,"activeDid","");r(this,"allMyDids",[]);r(this,"allContacts",[]);r(this,"apiServer","");r(this,"canShare",!1);r(this,"confirmerIdList",[]);r(this,"confsVisibleErrorMessage","");r(this,"confsVisibleToIdList",[]);r(this,"giveDetails");r(this,"giverName","");r(this,"issuerName","");r(this,"isLoading",!1);r(this,"isRegistered",!1);r(this,"numConfsNotVisible",0);r(this,"recipientName","");r(this,"showVeriClaimDump",!1);r(this,"urlForNewGive","");r(this,"veriClaim",E);r(this,"veriClaimDump","");r(this,"veriClaimDidsVisible",{});r(this,"windowLocation",window.location);r(this,"R",B);r(this,"yaml",O);r(this,"libsUtil",K);r(this,"serverUtil",Z)}resetThisValues(){this.confirmerIdList=[],this.confsVisibleErrorMessage="",this.confsVisibleToIdList=[],this.giveDetails=void 0,this.isRegistered=!1,this.numConfsNotVisible=0,this.urlForNewGive="",this.veriClaim=E,this.veriClaimDump=""}async mounted(){this.isLoading=!0;const i=await j();this.activeDid=i.activeDid||"",this.apiServer=i.apiServer||"",this.allContacts=await Y.contacts.toArray(),this.isRegistered=i.isRegistered||!1,this.allMyDids=await J();const n=window.location.pathname.substring(14);let f;n?(f=decodeURIComponent(n),await this.loadClaim(f,this.activeDid)):this.$notify({group:"alert",type:"danger",title:"Error",text:"No claim ID was provided."},3e3),this.canShare=!!navigator.share,this.isLoading=!1}capitalizeAndInsertSpacesBeforeCaps(i){return i?i[0].toUpperCase()+i.substr(1).replace(/([A-Z])/g," $1"):""}capitalizeAndInsertSpacesBeforeCapsWithAPrefix(i){const n=this.capitalizeAndInsertSpacesBeforeCaps(i);if(n){const f=n[0].toLowerCase();return(["a","e","i","o","u"].includes(f)?"an":"a")+" "+n}else return""}totalConfirmers(){return this.numConfsNotVisible+this.confirmerIdList.length+this.confsVisibleToIdList.length}didInfo(i){return X(i,this.activeDid,this.allMyDids,this.allContacts)}async loadClaim(i,n){var v;const f=x(i)?"/api/claim/byHandle/":"/api/claim/",c=this.apiServer+f+encodeURIComponent(i);try{const p=await G(n),C=await this.axios.get(c,{headers:p});if(C.status===200)this.veriClaim=C.data,this.veriClaimDump=_(this.veriClaim),this.veriClaimDidsVisible=ee(this.veriClaim,!0);else{console.error("Error getting claim:",C),this.$notify({group:"alert",type:"danger",title:"Error",text:"There was a problem retrieving that claim."},3e3);return}if(this.veriClaim.claimType!=="GiveAction")return;this.issuerName=this.didInfo(this.veriClaim.issuer);const m=this.apiServer+"/api/v2/report/gives?handleId="+encodeURIComponent(this.veriClaim.handleId),D=await G(n),b=await this.axios.get(m,{headers:D});if(b.status===200)this.giveDetails=b.data.data[0];else{console.error("Error getting detailed give info:",b),this.$notify({group:"alert",type:"danger",title:"Error",text:"Something went wrong retrieving gift data."},3e3);return}if(!this.giveDetails)return;this.urlForNewGive="/gifted-details?",this.giveDetails.amount&&(this.urlForNewGive+="&amountInput="+encodeURIComponent(String(this.giveDetails.amount))),this.giveDetails.unit&&(this.urlForNewGive+="&unitCode="+encodeURIComponent(this.give