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
6.1 KiB

var $=Object.defineProperty;var T=(a,t,s)=>t in a?$(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var v=(a,t,s)=>T(a,typeof t!="symbol"?t+"":t,s);import{V as E,e as N,f as O,C as V,_ as j,g as x,h as l,i as m,j as e,w as G,t as y,F as b,z as R,x as d,k as D,l as A}from"./index-BLqts8WY.js";import{Q as I}from"./QuickNav-DgCyvgDx.js";import{A as U,G as F,g as _,H as J,S,I as M}from"./index-MyY_xqVN.js";import{c as B}from"./concat-BK8PKeDS.js";import{s as H}from"./sort-Dh4GzQVc.js";import"./index-CsfPLOYu.js";var P=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,W=(a,t,s,i)=>{for(var n=i>1?void 0:i?Q(t,s):t,h=a.length-1,r;h>=0;h--)(r=a[h])&&(n=(i?r(t,s,n):r(n))||n);return i&&n&&P(t,s,n),n};let w=class extends E{constructor(){super(...arguments);v(this,"$notify");v(this,"activeDid","");v(this,"apiServer","");v(this,"contact",null);v(this,"giveRecords",[]);v(this,"numAccounts",0);v(this,"displayAmount",U)}async beforeCreate(){this.numAccounts=await F()}async created(){try{const t=this.$route.query.contactDid;this.contact=await N.contacts.get(t)||null;const s=await O();this.activeDid=(s==null?void 0:s.activeDid)||"",this.apiServer=(s==null?void 0:s.apiServer)||"",this.activeDid&&this.contact&&this.loadGives(this.activeDid,this.contact)}catch(t){console.error("Error retrieving settings or gives.",t),this.$notify({group:"alert",type:"danger",title:"Error",text:t.userMessage||"There was an error retrieving your settings or contacts or gives."},-1)}}async loadGives(t,s){try{let i=[];const n=this.apiServer+"/api/v2/report/gives?agentDid="+encodeURIComponent(this.activeDid)+"&recipientDid="+encodeURIComponent(s.did),h=await _(t),r=await this.axios.get(n,{headers:h});r.status===200?i=r.data.data:(console.error("Got bad response status & data of",r.status,r.data),this.$notify({group:"alert",type:"danger",title:"Error With Server",text:"Got an error retrieving your given time from the server."},-1));const c=this.apiServer+"/api/v2/report/gives?agentDid="+encodeURIComponent(s.did)+"&recipientDid="+encodeURIComponent(this.activeDid),g=await _(t),p=await this.axios.get(c,{headers:g});p.status===200?i=B(i,p.data.data):(console.error("Got bad response status & data of",p.status,p.data),this.$notify({group:"alert",type:"danger",title:"Error With Server",text:"Got an error retrieving your given time from the server."},-1));const o=H((u,f)=>new Date(f.issuedAt).getTime()-new Date(u.issuedAt).getTime(),i);this.giveRecords=o}catch(i){this.$notify({group:"alert",type:"danger",title:"Error With Server",text:i},-1)}}async confirm(t){var g,p;const s=J(t.fullClaim);t.fullClaim["@context"]==S&&delete s["@context"],s.identifier=t.handleId;const i={"@context":S,"@type":"AgreeAction",object:s},n=await M(this.activeDid,i),h=JSON.stringify({jwtEncoded:n}),r=this.apiServer+"/api/v2/claim",c=await _(this.activeDid);try{(g=(await this.axios.post(r,h,{headers:c})).data)!=null&&g.success&&(t.amountConfirmed=((p=s.object)==null?void 0:p.amountOfThisGood)||1)}catch(o){let u="There was an error.";const f=o;f?f.message?u=f.message:u=JSON.stringify(f.toJSON()):u=o,this.$notify({group:"alert",type:"danger",title:"Error With Server",text:u},-1)}}cannotConfirmMessage(){this.$notify({group:"alert",type:"danger",title:"Not Allowed",text:"Only the recipient can confirm final receipt."},-1)}};w=W([V({components:{QuickNav:I}})],w);const L={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},q={class:"mb-8"},z={id:"ViewBreadcrumb",class:"text-lg text-center font-light relative px-7"},X={id:"ViewHeading",class:"text-4xl text-center font-light pt-4"},K={class:"table-auto w-full border-t border-slate-300 text-sm sm:text-base text-center"},Y={class:"p-1 text-xs sm:text-sm text-left text-slate-500"},Z={class:"p-1"},tt={key:0},et={class:"font-bold"},st={key:0,title:"Confirmed"},ot=["onClick"],at={class:"italic text-xs sm:text-sm text-slate-500"},it={class:"p-1"},nt={key:0},rt={key:1},ct={class:"p-1"},lt={key:0},dt={class:"font-bold"},pt={key:0,title:"Confirmed"},ut={class:"italic text-xs sm:text-sm text-slate-500"};function ft(a,t,s,i,n,h){var p;const r=x(