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

var R=Object.defineProperty;var V=(t,a,e)=>a in t?R(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e;var u=(t,a,e)=>V(t,typeof a!="symbol"?a+"":a,e);import{l as j,af as _,ag as K,g as $,x as S,ah as L,ai as E,b as I,ac as F,ad as H,ae as J,K as Y,aj as A,ak as W,H as U}from"./index-MyY_xqVN.js";import{V as q,A as z,e as T,f as Q,u as X,y as k,a2 as M,C as Z,G as ee,_ as te,g as x,h as y,i as g,j as h,p as se,w as N,m as oe,s as ie,l as b,a0 as B,t as D,k as G,q as ne,F as P,z as re,x as p}from"./index-BLqts8WY.js";import{u as ae}from"./index-CsfPLOYu.js";import{Q as de}from"./QuickNav-DgCyvgDx.js";import{E as le}from"./EntityIcon-CF1RwQI5.js";import{G as ce}from"./GiftedDialog-CFmou4Be.js";import{O as he}from"./OfferDialog-BFpCo0de.js";import{C as ue}from"./ContactNameDialog-CYaRfHTt.js";import{T as me}from"./TopMessage-BE0GBIgW.js";import{s as fe}from"./sort-Dh4GzQVc.js";var ge=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,ye=(t,a,e,s)=>{for(var o=s>1?void 0:s?pe(a,e):a,i=t.length-1,r;i>=0;i--)(r=t[i])&&(o=(s?r(a,e,o):r(o))||o);return s&&o&&ge(a,e,o),o};let O=class extends q{constructor(){super(...arguments);u(this,"$notify");u(this,"activeDid","");u(this,"apiServer","");u(this,"contacts",[]);u(this,"contactInput","");u(this,"contactEdit",null);u(this,"contactNewName","");u(this,"contactsSelected",[]);u(this,"givenByMeDescriptions",{});u(this,"givenByMeConfirmed",{});u(this,"givenByMeUnconfirmed",{});u(this,"givenToMeDescriptions",{});u(this,"givenToMeConfirmed",{});u(this,"givenToMeUnconfirmed",{});u(this,"hideRegisterPromptOnNewContact",!1);u(this,"isRegistered",!1);u(this,"showDidCopy",!1);u(this,"showPubKeyCopy",!1);u(this,"showPubKeyHashCopy",!1);u(this,"showGiveNumbers",!1);u(this,"showGiveTotals",!0);u(this,"showGiveConfirmed",!0);u(this,"showLargeIdenticon");u(this,"AppString",z);u(this,"libsUtil",j)}async created(){await T.open();const e=await Q();this.activeDid=e.activeDid||"",this.apiServer=e.apiServer||"",this.isRegistered=!!e.isRegistered,this.showGiveNumbers=!!e.showContactGivesInline,this.hideRegisterPromptOnNewContact=!!e.hideRegisterPromptOnNewContact,this.showGiveNumbers&&this.loadGives();const s=await T.contacts.toArray();this.contacts=s.sort((r,n)=>(r.name||"").localeCompare(n.name||""));const o=this.$route.query.contactJwt;if(o){const{payload:r}=_(o),n=r.own,c={did:r.iss,name:n.name,nextPubKeyHashB64:n.nextPublicEncKeyHash,profileImageUrl:n.profileImageUrl,publicKeyBase64:n.publicEncKey,registered:n.registered};this.addContact(c)}const i=this.$route.query.inviteJwt;if(i==="")this.$notify({group:"alert",type:"danger",title:"Blank Invite",text:"The invite was not included, which can happen when your iOS device cuts off the link. Try pasting the full link into a browser."},7e3);else if(i){this.activeDid||(this.activeDid=await K());const r=await $(this.activeDid);try{const n=await this.axios.post(this.apiServer+"/api/v2/claim",{jwtEncoded:i},{headers:r});if(n.status!=201)throw{error:{response:n}};await X(this.activeDid,{isRegistered:!0}),this.isRegistered=!0,this.$notify({group:"alert",type:"success",title:"Registered",text:"You are now registered."},3e3),await new Promise(m=>setTimeout(m,1e3));const d=_(i).payload;this.$refs.contactNameDialog.open("Who Invited You?","",async m=>{await this.addContact({did:d.vc.credentialSubject.agent.identifier,name:m,registered:!0}),await new Promise(f=>setTimeout(f,1e3)),this.showOnboardingInfo()},async()=>{await this.addContact({did:d.vc.credentialSubject.agent.identifier,name:"(person who invited you)",registered:!0}),await new Promise(m=>setTimeout(m,1e3)),this.showOnboardingInfo()})}catch(n){const c="Error redeeming invite: "+S(n);k(c,!0);let d="Got an error sending the invite.";n.response&&n.response.data&&n.response.data.error?n.response.data.error.message?d=n.response.data.error.message:d=n.response.data.error:n.message&&(d=n.message),this.$notify({group:"alert",type:"danger",title:"Error with Invite",text:d},5e3)}}}danger(e,s="Error",o=5e3){this.$notify({group:"alert",type:"danger",title:s,text:e},o)}showOnboardingInfo(){this.$notif