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

var g=Object.defineProperty;var w=(i,t,e)=>t in i?g(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var r=(i,t,e)=>w(i,typeof t!="symbol"?t+"":t,e);import{V as y,e as I,f as k,y as x,C as b,_ as V,g as u,h as p,i as h,j as c,m as $,s as C,l as d,k as D,F as A,x as l}from"./index-BLqts8WY.js";import{Q as S}from"./QuickNav-DgCyvgDx.js";import{ag as J,af as N,x as O}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var T=Object.defineProperty,E=Object.getOwnPropertyDescriptor,P=(i,t,e,o)=>{for(var n=o>1?void 0:o?E(t,e):t,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(o?s(t,e,n):s(n))||n);return o&&n&&T(t,e,n),n};let v=class extends y{constructor(){super(...arguments);r(this,"$notify");r(this,"acceptInput",!1);r(this,"activeDid","");r(this,"apiServer","");r(this,"checkingInvite",!0);r(this,"inputJwt","")}async mounted(){this.checkingInvite=!0,await I.open();const e=await k();this.activeDid=e.activeDid||"",this.apiServer=e.apiServer||"",this.activeDid||(this.activeDid=await J());const o=window.location.pathname.substring(19);await this.processInvite(o,!1),this.checkingInvite=!1}async processInvite(e,o){this.checkingInvite=!0;try{let n=e??"";const a=e.match(/(https?:\/\/[^\s]+)/);if(a&&a[1]){const s=a[1].match(/\/invite-one-accept\/([^?]+)/);s&&s[1]&&(n=s[1])}else{const s=e.match(/(ey[\w.-]+)/);s&&s[1]&&(n=s[1])}n?(N(n),this.$router.push({name:"contacts",query:{inviteJwt:n}})):(o&&this.$notify({group:"alert",type:"danger",title:"Missing invite",text:"There was no invite. Paste the entire text that has the link."},5e3),this.acceptInput=!0)}catch(n){const a="Error accepting invite: "+O(n);x(a,!0),o&&this.$notify({group:"alert",type:"danger",title:"Error",text:"There was an error processing that invite."},3e3),this.acceptInput=!0}this.checkingInvite=!1}async checkInvite(e){(e.endsWith("invite-one-accept")||e.endsWith("invite-one-accept/"))&&this.$notify({group:"alert",type:"danger",title:"Error",text:"That is only part of the invite link; it's missing data at the end. Try another way to get the full link."},5e3)}};v=P([b({components:{QuickNav:S}})],v);const M={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},F={key:0,class:"text-center mt-4"},Q={key:1,class:"text-lg text-center font-light relative px-7"};function B(i,t,e,o,n,a){const s=u("QuickNav"),f=u("fa");return l(),p(A,null,[h(s,{selected:"Invite"}),c("section",M,[i.acceptInput?(l(),p("div",F,[t[3]||(t[3]=c("p",null,"That invitation did not work.",-1)),t[4]||(t[4]=c("p",{class:"mt-2"}," Go back to your invite message and copy the entire text, then paste it here. ",-1)),t[5]||(t[5]=c("p",{class:"mt-2"}," If the link looks correct, try Chrome. (For example, iOS may have cut off the invite data, or it may have shown a preview that stole your invite.) If it still complains, you may need the person who invited you to send a new one. ",-1)),$(c("textarea",{"onUpdate:modelValue":t[0]||(t[0]=m=>i.inputJwt=m),placeholder:"Paste invitation...",class:"mt-4 border-2 border-gray-300 p-2 rounded",cols:"30",onInput:t[1]||(t[1]=()=>i.checkInvite(i.inputJwt))},null,544),[[C,i.inputJwt]]),t[6]||(t[6]=c("br",null,null,-1)),c("button",{onClick:t[2]||(t[2]=()=>i.processInvite(i.inputJwt,!0)),class:"ml-2 p-2 bg-blue-500 text-white rounded"}," Submit ")])):d("",!0),i.checkingInvite?(l(),p("div",Q,[h(f,{icon:"spinner",class:"fa-spin-pulse"}),t[7]||(t[7]=D(" Loading… "))])):d("",!0)])],64)}const z=V(v,[["render",B]]);export{z as default};