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.
 
 
 

1 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.giveDetails.unit)),this.giveDetails.description&&(this.urlForNewGive+="&description="+encodeURIComponent(this.giveDetails.description)),this.giverName=this.didInfo(this.giveDetails.agentDid),this.giveDetails.agentDid&&(this.urlForNewGive+="&giverDid="+encodeURIComponent(this.giveDetails.agentDid)+"&giverName="+encodeURIComponent(this.giverName)),this.recipientName=this.didInfo(this.giveDetails.recipientDid),this.giveDetails.recipientDid&&(this.urlForNewGive+="&recipientDid="+encodeURIComponent(this.giveDetails.recipientDid)+"&recipientName="+encodeURIComponent(this.recipientName)),this.giveDetails.fullClaim.image&&(this.urlForNewGive+="&image="+encodeURIComponent(this.giveDetails.fullClaim.image)),this.giveDetails.type=="Offer"&&this.giveDetails.fulfillsHandleId&&(this.urlForNewGive+="&offerId="+encodeURIComponent((v=this.giveDetails)==null?void 0:v.fulfillsHandleId)),this.giveDetails.fulfillsPlanHandleId&&(this.urlForNewGive+="&fulfillsProjectId="+encodeURIComponent(this.giveDetails.fulfillsPlanHandleId));const y=await ie(this.apiServer,i,this.veriClaim.issuer,n);y?(this.confirmerIdList=y.confirmerIdList,this.confsVisibleToIdList=y.confsVisibleToIdList,this.numConfsNotVisible=y.numConfsNotVisible):this.confsVisibleErrorMessage="Had problems retrieving confirmations."}catch(p){console.error("Error retrieving claim:",p),this.$notify({group:"alert",type:"danger",title:"Error",text:"Something went wrong retrieving claim data."},3e3)}}confirmConfirmClaim(){this.$notify({group:"modal",type:"confirm",title:"Confirm",text:"Do you personally confirm that this is true?",onYes:async()=>{await this.confirmClaim()}},-1)}async confirmClaim(){const n={"@context":"https://schema.org","@type":"AgreeAction",object:te(se(oe(this.veriClaim.claim,this.veriClaim.id,this.veriClaim.handleId)))},f=await ne(n,this.activeDid,this.apiServer,this.axios);f.type==="success"?this.$notify({group:"alert",type:"success",title:"Success",text:"Confirmation submitted."},3e3):(console.error("Got error submitting the confirmation:",f),this.$notify({group:"alert",type:"danger",title:"Error",text:"There was a problem submitting the confirmation."},5e3))}showClaimPage(i){const n={path:"/claim/"+encodeURIComponent(i)};this.$router.push(n).then(async()=>{this.resetThisValues(),await this.loadClaim(i,this.activeDid)})}copyToClipboard(i,n){Q().copy(n).then(()=>{this.$notify({group:"alert",type:"toast",title:"Copied",text:(i||"That")+" was copied to the clipboard."},2e3)})}notifyWhyCannotConfirm(){ae(this.$notify,this.isRegistered,this.veriClaim.claimType,this.giveDetails,this.activeDid,this.confirmerIdList)}notifyWhyCannotConfirmBak(){var i,n;this.isRegistered?re(this.veriClaim)?this.confirmerIdList.includes(this.activeDid)?this.$notify({group:"alert",type:"info",title:"Already Confirmed",text:"You already confirmed this claim."},3e3):((i=this.giveDetails)==null?void 0:i.issuerDid)==this.activeDid?this.$notify({group:"alert",type:"info",title:"Cannot Confirm",text:"You cannot confirm this because you issued this claim."},3e3):le((n=this.giveDetails)==null?void 0:n.fullClaim)?this.$notify({group:"alert",type:"info",title:"Cannot Confirm",text:"You cannot confirm this because some people are hidden."},3e3):this.$notify({group:"alert",type:"info",title:"Cannot Confirm",text:"You cannot confirm this claim. There are no other details, but we can help more if you contact us and send us screenshots."},3e3):this.$notify({group:"alert",type:"info",title:"Not A Give",text:"This is not a giving action to confirm."},3e3):this.$notify({group:"alert",type:"info",title:"Not Registered",text:"Someone needs to register you before you can contribute."},3e3)}onClickShareClaim(){window.navigator.share({title:"Help Connect Me",text:"I'm trying to find the full details of this claim. Can you help me?",url:this.windowLocation.href})}};T=ue([W({methods:{displayAmount:de},components:{TopMessage:me,QuickNav:q}})],T);const ce={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},pe={id:"ViewBreadcrumb",class:"mb-8"},ve={class:"text-lg text-center font-light relative px-7"},ge={key:0},ye={key:1},Ce={key:0},be={class:"flex justify-center"},we={class:"bg-slate-100 rounded-md overflow-hidden px-4 py-3 mt-4"},De={class:"flex gap-4 overflow-hidden"},ke={class:"overflow-hidden"},Ie={class:"text-sm"},Ne={key:0},Te={key:1},Re={key:2,class:"mt-2"},Le={key:3},Ve={class:"mt-2"},Ue={key:0,class:"mt-4"},$e={key:0},Se={key:1},Ae={key:2},Ee={key:3},Ge={key:0},He={key:1},Fe={key:2},Pe={class:"ml-4"},Oe={class:"flex gap-4"},_e={class:"grow overflow-hidden"},Be={class:"text-sm"},Me={key:0},je=["onClick"],Ye={key:3},We={class:"ml-4"},ze={class:"flex gap-4"},Qe={class:"grow overflow-hidden"},qe={class:"text-sm"},Ke={key:0},Ze=["onClick"],Je={key:4},Xe={key:5},xe={key:6},ei={key:0},ii={key:1},ti={key:1},si={key:0,class:"mb-2"},oi={key:0},ni={key:1},ai={key:1},ri={key:0},li={key:1},di={class:"text-sm"},mi={class:"ml-12 p-1"},hi={class:"text-sm mt-2"},fi={key:0},ui=["onClick"],ci={key:1},pi=["href"],vi={class:"text-sm overflow-x-scroll px-4 py-3 bg-slate-100 rounded-md"},gi={class:"mt-2 ml-2"},yi={class:"mt-2 ml-2"},Ci=["href"],bi={key:1},wi={key:2,class:"fixed left-6 bottom-24 text-center text-4xl leading-none bg-slate-400 text-white w-14 py-2.5 rounded-full"};function Di(e,i,n,f,c,v){var b,y,R,L,V,U;const p=k("QuickNav"),C=k("TopMessage"),m=k("fa"),D=k("router-link");return s(),t(w,null,[d(p),d(C),o("section",ce,[o("div",pe,[o("h1",ve,[o("button",{onClick:i[0]||(i[0]=l=>e.$router.go(-1)),class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1"},[d(m,{icon:"chevron-left",class:"fa-fw"})]),e.libsUtil.isGiveRecordTheUserCanConfirm(e.isRegistered,e.veriClaim,e.activeDid,e.confirmerIdList)?(s(),t("span",ge," Do you agree? ")):(s(),t("span",ye," Confirmation Details "))])]),e.giveDetails&&!e.isLoading?(s(),t("div",Ce,[o("div",be,[e.libsUtil.isGiveRecordTheUserCanConfirm(e.isRegistered,e.veriClaim,e.activeDid,e.confirmerIdList)?(s(),t("button",{key:0,class:"col-span-1 bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-4 py-2 rounded-md",onClick:i[1]||(i[1]=l=>e.confirmConfirmClaim())},[i[9]||(i[9]=a(" Confirm ")),d(m,{icon:"circle-check",class:"ml-2 text-white cursor-pointer"})])):(s(),t("button",{key:1,onClick:i[2]||(i[2]=l=>e.notifyWhyCannotConfirm()),class:"col-span-1 bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-4 py-2 rounded-md"},[i[10]||(i[10]=a(" Confirm ")),d(m,{icon:"circle-check",class:"ml-2 text-white cursor-pointer"})]))]),o("div",we,[o("div",De,[o("div",ke,[o("div",Ie,[o("div",null,[d(m,{icon:"arrow-left",class:"fa-fw text-slate-400"}),a(" "+u(e.giverName),1)]),i[12]||(i[12]=o("div",{class:"ml-6"},"gave",-1)),e.giveDetails.amount?(s(),t("div",Ne,[d(m,{icon:"hand-holding-dollar",class:"fa-fw text-slate-400"}),a(" "+u(e.displayAmount(e.giveDetails.unit,e.giveDetails.amount)),1)])):h("",!0),e.giveDetails.description?(s(),t("div",Te,[d(m,{icon:"message",class:"fa-fw text-slate-400"}),a(" "+u(e.giveDetails.amount?"and:":"")+" "+u(e.giveDetails.description),1)])):h("",!0),i[13]||(i[13]=o("div",{class:"ml-6"},"to",-1)),o("div",null,[d(m,{icon:"arrow-right",class:"fa-fw text-slate-400"}),a(" "+u(e.recipientName),1)]),o("div",null,[d(m,{icon:"calendar",class:"fa-fw text-slate-400"}),a(" on "+u(e.giveDetails.issuedAt.substring(0,10)),1)]),(b=e.giveDetails)!=null&&b.fulfillsPlanHandleId?(s(),t("div",Re,[d(D,{to:"/project/"+encodeURIComponent(((y=e.giveDetails)==null?void 0:y.fulfillsPlanHandleId)||""),class:"text-blue-500 mt-2 cursor-pointer",target:"_blank"},{default:A(()=>[i[11]||(i[11]=a(" This fulfills a bigger plan ")),d(m,{icon:"arrow-up-right-from-square",class:"fa-fw"})]),_:1},8,["to"])])):h("",!0),(R=e.giveDetails)!=null&&R.fulfillsType&&((L=e.giveDetails)==null?void 0:L.fulfillsType)!=="PlanAction"&&((V=e.giveDetails)!=null&&V.fulfillsHandleId)?(s(),t("div",Le,[d(D,{to:"/claim/"+encodeURIComponent(((U=e.giveDetails)==null?void 0:U.fulfillsHandleId)||""),class:"text-blue-500 mt-2 cursor-pointer",target:"_blank"},{default:A(()=>{var l;return[a(" This fulfills "+u(e.capitalizeAndInsertSpacesBeforeCapsWithAPrefix(((l=e.giveDetails)==null?void 0:l.fulfillsType)||""))+" ",1),d(m,{icon:"arrow-up-right-from-square",class:"fa-fw"})]}),_:1},8,["to"])])):h("",!0)])])])]),o("div",Ve,[d(m,{icon:"comment",class:"text-slate-400"}),a(" "+u(e.issuerName)+" posted that. ",1)]),e.libsUtil.isGiveAction(e.veriClaim)?(s(),t("div",Ue,[i[16]||(i[16]=o("h2",{class:"font-bold uppercase text-xl mt-8 mb-2"},"Confirmations",-1)),e.totalConfirmers()===0?(s(),t("span",$e,"Nobody has confirmed this.")):e.totalConfirmers()===1?(s(),t("span",Se," One person confirmed this. ")):(s(),t("span",Ae,u(e.totalConfirmers())+" people confirmed this. ",1)),e.totalConfirmers()>0?(s(),t("div",Ee,[e.confirmerIdList.length===0&&e.confsVisibleToIdList.length===0?(s(),t("div",Ge," Nobody that you know confirmed this claim, nor do they have any confirmers in their network. ")):h("",!0),e.confirmerIdList.length===0&&e.confsVisibleToIdList.length>0?(s(),t("div",He," Nobody that you know issued or confirmed this claim. ")):h("",!0),e.confirmerIdList.length>0?(s(),t("div",Fe,[i[14]||(i[14]=a(" The following people confirmed this claim. ")),o("ul",Pe,[(s(!0),t(w,null,I(e.confirmerIdList,l=>(s(),t("li",{key:l,class:"list-disc ml-4"},[o("div",Oe,[o("div",_e,[o("div",Be,[a(u(e.didInfo(l))+" ",1),e.serverUtil.isEmptyOrHiddenDid(l)?h("",!0):(s(),t("span",Me,[o("button",{onClick:N=>e.copyToClipboard("The DID of "+l,l)},[d(m,{icon:"copy",class:"text-slate-400 fa-fw"})],8,je)]))])])])]))),128))])])):h("",!0),e.confsVisibleToIdList.length>0?(s(),t("div",Ye,[i[15]||(i[15]=a(" The following people can connect you with people who issued or confirmed this claim. ")),o("ul",We,[(s(!0),t(w,null,I(e.confsVisibleToIdList,l=>(s(),t("li",{key:l,class:"list-disc ml-4"},[o("div",ze,[o("div",Qe,[o("div",qe,[a(u(e.didInfo(l))+" ",1),e.serverUtil.isEmptyOrHiddenDid(l)?h("",!0):(s(),t("span",Ke,[o("button",{onClick:N=>e.copyToClipboard("The DID of "+l,l)},[d(m,{icon:"copy",class:"text-slate-400 fa-fw"})],8,Ze)]))])])])]))),128))])])):h("",!0)])):h("",!0),e.isRegistered?e.giveDetails.issuerDid==e.activeDid?(s(),t("div",Xe," You cannot confirm this because you issued this claim, so you already count as confirming it. ")):e.serverUtil.containsHiddenDid(e.veriClaim.claim)?(s(),t("div",xe," You cannot confirm this because some people are hidden. ")):h("",!0):(s(),t("div",Je," You cannot confirm this because you are not registered. Find someone to register you, maybe on the Help page. "))])):h("",!0),o("h2",{class:"font-bold uppercase text-xl text-blue-500 mt-8 mb-2 cursor-pointer",onClick:i[3]||(i[3]=l=>e.showVeriClaimDump=!e.showVeriClaimDump)},[i[17]||(i[17]=a(" Details ")),e.showVeriClaimDump?(s(),t("span",ii,[d(m,{icon:"chevron-up"})])):(s(),t("span",ei,[d(m,{icon:"chevron-down"})]))]),e.showVeriClaimDump?(s(),t("div",ti,[e.serverUtil.containsHiddenDid(e.veriClaim)&&e.R.isEmpty(e.veriClaimDidsVisible)?(s(),t("div",si,[i[22]||(i[22]=a(' Some of the details are not visible to you; they show as "HIDDEN". They are not visible to any of your direct contacts, either. ')),e.canShare?(s(),t("span",oi,[i[18]||(i[18]=a(" If you'd like to ask any of your contacts to take a look and see if their contacts can see more details, ")),o("a",{onClick:i[4]||(i[4]=l=>e.onClickShareClaim()),class:"text-blue-500"},"click to send them this info"),i[19]||(i[19]=a(" and see if they are willing to make an introduction. They are surely connected to someone; if you don't know who to ask, you might try the person who registered you. "))])):(s(),t("span",ni,[i[20]||(i[20]=a(" If you'd like to ask any of your contacts to take a look and see if their contacts can see more details, ")),o("a",{onClick:i[5]||(i[5]=l=>e.copyToClipboard("Location",e.windowLocation.href)),class:"text-blue-500"},"share this page with them"),i[21]||(i[21]=a(" and see if they are willing to make an introduction. "))]))])):h("",!0),e.R.isEmpty(e.veriClaimDidsVisible)?h("",!0):(s(),t("div",ai,[i[26]||(i[26]=a(" Some of the details are not visible to you but they are visible to some of your contacts. ")),e.canShare?(s(),t("span",ri,[i[23]||(i[23]=a(" If you'd like an introduction, ")),o("a",{onClick:i[6]||(i[6]=l=>e.onClickShareClaim()),class:"text-blue-500"},"click to share the information with them and ask if they'll tell you more about the participants.")])):(s(),t("span",li,[i[24]||(i[24]=a(" If you'd like an introduction, ")),o("a",{onClick:i[7]||(i[7]=l=>e.copyToClipboard("A link to this page",e.windowLocation.href)),class:"text-blue-500"},"share this page with them and ask if they'll tell you more about about the participants.")])),(s(!0),t(w,null,I(Object.keys(e.veriClaimDidsVisible),(l,N)=>(s(),t("div",{key:N,class:"list-disc p-4"},[o("div",di,[d(m,{icon:"minus",class:"fa-fw"}),a(" The "+u(l)+" is visible to: ",1)]),o("div",mi,[o("ul",null,[(s(!0),t(w,null,I(e.veriClaimDidsVisible[l],(g,H)=>{var $,S;return s(),t("li",{key:H,class:"list-disc"},[o("div",hi,[o("span",null,[a(u(e.didInfo(g))+" ",1),e.serverUtil.isEmptyOrHiddenDid(g)?h("",!0):(s(),t("span",fi,[o("button",{onClick:ki=>e.copyToClipboard("The DID of "+g,g)},[d(m,{icon:"copy",class:"text-slate-400 fa-fw"})],8,ui)])),($=e.veriClaim.publicUrls)!=null&&$[g]?(s(),t("span",ci,[i[25]||(i[25]=a(", found at ")),d(m,{icon:"globe",class:"fa-fw text-slate-400"}),o("a",{href:(S=e.veriClaim.publicUrls)==null?void 0:S[g],class:"text-blue-500"},u(e.veriClaim.publicUrls[g].substring(e.veriClaim.publicUrls[g].indexOf("//")+2)),9,pi)])):h("",!0)])])])}),128))])])]))),128))])),o("pre",vi,u(e.veriClaimDump),1),o("div",gi,[o("a",{onClick:i[8]||(i[8]=l=>e.showClaimPage(e.veriClaim.id)),class:"text-blue-500 cursor-pointer"},[d(m,{icon:"file-lines"}),i[27]||(i[27]=a(" See All Generic Info "))])]),o("div",yi,[e.isRegistered?(s(),t("a",{key:0,class:"text-blue-500 cursor-pointer",href:e.urlForNewGive},[d(m,{icon:"file-lines"}),i[28]||(i[28]=a(" Record a Give Similar to the Original "))],8,Ci)):h("",!0)])])):h("",!0)])):e.isLoading?h("",!0):(s(),t("div",bi,"This does not have details to confirm.")),e.isLoading?(s(),t("div",wi,[d(m,{icon:"spinner",class:"fa-spin-pulse"})])):h("",!0)])],64)}const Ei=z(T,[["render",Di]]);export{Ei as default};