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

var D=Object.defineProperty;var I=(i,t,e)=>t in i?D(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var l=(i,t,e)=>I(i,typeof t!="symbol"?t+"":t,e);import{V as C,f as S,e as b,M as A,a9 as $,C as B,_ as V,g as y,h as f,i as p,j as s,w as g,k as m,t as _,l as N,F as k,z as T,x as r,p as h}from"./index-BLqts8WY.js";import{Q as P}from"./QuickNav-DgCyvgDx.js";import{aB as j}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var E=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,O=(i,t,e,o)=>{for(var n=o>1?void 0:o?Y(t,e):t,a=i.length-1,u;a>=0;a--)(u=i[a])&&(n=(o?u(t,e,n):u(n))||n);return o&&n&&E(t,e,n),n};let v=class extends C{constructor(){super(...arguments);l(this,"$notify");l(this,"activeDid","");l(this,"activeDidInIdentities",!1);l(this,"apiServer","");l(this,"apiServerInput","");l(this,"otherIdentities",[])}async created(){try{const e=await S();this.activeDid=e.activeDid||"",this.apiServer=e.apiServer||"",this.apiServerInput=e.apiServer||"";const o=await j();for(let n=0;n<o.length;n++){const a=o[n];this.otherIdentities.push({id:a.id,did:a.did}),a.did&&this.activeDid===a.did&&(this.activeDidInIdentities=!0)}}catch(e){this.$notify({group:"alert",type:"danger",title:"Error Loading Accounts",text:"Clear your cache and start over (after data backup)."},-1),console.error("Telling user to clear cache at page create because:",e)}}async switchAccount(e){e==="0"&&(e=void 0),await b.open(),await b.settings.update(A,{activeDid:e}),this.$router.push({name:"account"})}async deleteAccount(e){this.$notify({group:"modal",type:"confirm",title:"Delete Identity?",text:"Are you sure you want to erase this identity? (There is no undo. You may want to select it and back it up just in case.)",onYes:async()=>{await(await $).accounts.delete(e),this.otherIdentities=this.otherIdentities.filter(n=>n.id!==e)}},-1)}notifyCannotDelete(){this.$notify({group:"alert",type:"warning",title:"Cannot Delete",text:"You cannot delete the active identity. Set to another identity or 'no identity' first."},3e3)}};v=O([B({components:{QuickNav:P}})],v);const Q={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},F={id:"ViewBreadcrumb",class:"mb-8"},M={class:"text-lg text-center font-light relative px-7"},L={key:0,class:"block bg-slate-100 rounded-md flex items-center px-4 py-3 mb-4"},q={class:"text-sm text-slate-500"},z={class:"overflow-hidden truncate"},G={class:"mb-4"},K={class:"flex items-center justify-between mb-2"},R=["onClick"],H={class:"flex-grow overflow-hidden"},J={class:"text-sm text-slate-500 truncate"};function U(i,t,e,o,n,a){const u=y("QuickNav"),d=y("fa"),x=y("router-link");return r(),f(k,null,[p(u,{selected:"Profile"}),s("section",Q,[s("div",F,[s("h1",M,[p(x,{to:{name:"account"},class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1"},{default:g(()=>[p(d,{icon:"chevron-left",class:"fa-fw"})]),_:1}),t[2]||(t[2]=m(" Switch Identity "))])]),i.activeDid&&!i.activeDidInIdentities?(r(),f("div",L,[p(d,{icon:"circle-check",class:"fa-fw text-red-600 text-xl mr-3"}),s("div",q,[s("div",z,[t[3]||(t[3]=s("b",null,"ID:",-1)),t[4]||(t[4]=m()),s("code",null,_(i.activeDid),1)]),t[5]||(t[5]=s("b",null,"There is a data corruption error: this identity is selected but it is not in storage. You cannot send any more claims with this identity until you import the seed again. This may require reinstalling the app; if you know how, you can also clear out the TimeSafariAccounts IndexedDB. Be sure to back up all your Settings & Contacts first.",-1))])])):N("",!0),s("ul",G,[(r(!0),f(k,null,T(i.otherIdentities,c=>(r(),f("li",{key:c.did},[s("div",K,[s("div",{class:"flex flex-grow items-center bg-slate-100 rounded-md px-4 py-3 mb-2 truncate cursor-pointer",onClick:w=>i.switchAccount(c.did)},[c.did===i.activeDid?(r(),h(d,{key:0,icon:"circle-check",class:"fa-fw text-blue-600 text-xl mr-3"})):(r(),h(d,{key:1,icon:"circle",class:"fa-fw text-slate-400 text-xl mr-3"})),s("span",H,[s("div",J,[t[6]||(t[6]=s("b",null,"ID:",-1)),t[7]||(t[7]=m()),s("code",null,_(c.did),1)])])],8,R),s("div",null,[c.did===i.activeDid?(r(),h(d,{key:0,icon:"trash-can",class:"text-slate-400 text-xl ml-2 mr-2 cursor-pointer",onClick:t[0]||(t[0]=w=>i.notifyCannotDelete())})):(r(),h(d,{key:1,icon:"trash-can",class:"text-red-600 text-xl ml-2 mr-2 cursor-pointer",onClick:w=>i.deleteAccount(c.id)},null,8,["onClick"]))])])]))),128))]),p(x,{id:"start-link",to:{name:"start"},class:"block text-center text-lg font-bold uppercase 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-2 py-3 rounded-md mb-2"},{default:g(()=>t[8]||(t[8]=[m(" Add Another Identity… ")])),_:1}),s("a",{href:"#",class:"block w-full text-center text-md uppercase 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-1.5 py-2 rounded-md mb-8",onClick:t[1]||(t[1]=c=>i.switchAccount("0"))}," No Identity ")])],64)}const st=V(v,[["render",U]]);export{st as default};