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.
12 lines
39 KiB
12 lines
39 KiB
4 weeks ago
|
var K=Object.defineProperty;var q=(t,e,i)=>e in t?K(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var n=(t,e,i)=>q(t,typeof e!="symbol"?e+"":e,i);import{a as J,r as Q,V as X,A as Z,D as _,b as O,c as ee,d as T,e as l,f as te,M as w,X as se,u as G,I as ie,C as oe,_ as ne,g as k,h as u,i as d,j as s,k as a,w as c,l as b,t as m,m as y,v as E,n as F,o as I,p as re,q as j,T as ae,s as P,F as le,x as p}from"./index-BLqts8WY.js";import{t as N,r as de,b as H,D as W,a as Y,o as pe,f as ue,c as me,g as fe,d as ge}from"./index-MyY_xqVN.js";import"./dexie-export-import-B7Ze1sjn.js";import{u as we}from"./index-CsfPLOYu.js";import{E as be}from"./EntityIcon-CF1RwQI5.js";import{I as ye}from"./ImageMethodDialog-B6b8zZ7c.js";import{P as ve}from"./PushNotificationPermission-9Wf_h46a.js";import{Q as he}from"./QuickNav-DgCyvgDx.js";import{T as ce}from"./TopMessage-BE0GBIgW.js";import{U as Se}from"./UserNameDialog-B8a82q1n.js";import"./PhotoDialog-Dn3GjI9b.js";const{Axios:ts,AxiosError:ke,CanceledError:ss,isCancel:is,CancelToken:os,VERSION:ns,all:rs,Cancel:as,isAxiosError:ls,spread:ds,toFormData:ps,AxiosHeaders:us,HttpStatusCode:ms,formToJSON:fs,getAdapter:gs,mergeConfig:ws}=J;var Ie=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,xe=(t,e,i,r)=>{for(var f=r>1?void 0:r?Ce(e,i):e,v=t.length-1,S;v>=0;v--)(S=t[v])&&(f=(r?S(e,i,f):S(f))||f);return r&&f&&Ie(e,i,f),f};const C=Q();let D=class extends X{constructor(){super(...arguments);n(this,"$notify");n(this,"AppConstants",Z);n(this,"DEFAULT_PUSH_SERVER",_);n(this,"DEFAULT_IMAGE_API_SERVER",O);n(this,"DEFAULT_PARTNER_API_SERVER",ee);n(this,"activeDid","");n(this,"apiServer","");n(this,"apiServerInput","");n(this,"derivationPath","");n(this,"downloadUrl","");n(this,"endorserLimits",null);n(this,"givenName","");n(this,"hideRegisterPromptOnNewContact",!1);n(this,"imageLimits",null);n(this,"imageServer","");n(this,"isRegistered",!1);n(this,"limitsMessage","");n(this,"loadingLimits",!1);n(this,"notifyingNewActivity",!1);n(this,"notifyingNewActivityTime","");n(this,"notifyingReminder",!1);n(this,"notifyingReminderMessage","");n(this,"notifyingReminderTime","");n(this,"partnerApiServer","");n(this,"partnerApiServerInput","");n(this,"passkeyExpirationDescription","");n(this,"passkeyExpirationMinutes",T);n(this,"previousPasskeyExpirationMinutes",T);n(this,"profileImageUrl");n(this,"publicHex","");n(this,"publicBase64","");n(this,"showAdvanced",!1);n(this,"showB64Copy",!1);n(this,"showContactGives",!1);n(this,"showDidCopy",!1);n(this,"showDerCopy",!1);n(this,"showGeneralAdvanced",!1);n(this,"showLargeIdenticonId");n(this,"showLargeIdenticonUrl");n(this,"showPubCopy",!1);n(this,"showShortcutBvc",!1);n(this,"subscription",null);n(this,"warnIfProdServer",!1);n(this,"warnIfTestServer",!1);n(this,"webPushServer","");n(this,"webPushServerInput","")}async mounted(){var i;try{await this.initializeState(),await this.processIdentity()}catch(r){console.error("Telling user to clear cache at page create because:",r),console.error("To repeat with concatenated error: telling user to clear cache at page create because: "+r),this.$notify({group:"alert",type:"danger",title:"Error Loading Profile",text:"See the Help page about errors with your personal data."},-1)}try{const r=await((i=navigator.serviceWorker)==null?void 0:i.ready);this.subscription=await r.pushManager.getSubscription(),this.subscription||(this.notifyingNewActivity||this.notifyingReminder)&&this.turnOffNotifyingFlags()}catch{this.$notify({group:"alert",type:"warning",title:"Cannot Set Notifications",text:"This browser does not support notifications. Use Chrome, or install this to the home screen, or try other suggestions on the 'Troubleshoot your notifications' page."},3e3)}this.passkeyExpirationDescription=N()}beforeUnmount(){this.downloadUrl&&URL.revokeObjectURL(this.downloadUrl)}async initializeState(){await l.open();const i=await te();this.activeDid=i.activeDid||"",this.apiServer=i.apiServer||"",this.apiServerInput=i.apiServer||"",this.givenName=((i==null?void 0:i.firstName)||"")+(i!=null&&i.lastName?` ${i.lastName}`:""),this.hid
|
||
|
This will only notify you when there is new relevant activity for you personally.
|
||
|
Note that it runs on your device and many factors may affect delivery,
|
||
|
so if you want a reliable but simple daily notification then choose a 'Reminder'.
|
||
|
Do you want more details?
|
||
|
`,onYes:async()=>{await this.$router.push({name:"help-notification-types"})},yesText:"tell me more."},-1)}async showNewActivityNotificationChoice(){this.notifyingNewActivity?this.$notify({group:"modal",type:"notification-off",title:W,text:"",callback:async i=>{i&&(await l.settings.update(w,{notifyingNewActivityTime:""}),this.notifyingNewActivity=!1,this.notifyingNewActivityTime="")}},-1):this.$refs.pushNotificationPermission.open(W,async(i,r)=>{i&&(await l.settings.update(w,{notifyingNewActivityTime:r}),this.notifyingNewActivity=!0,this.notifyingNewActivityTime=r)})}async showReminderNotificationInfo(){this.$notify({group:"modal",type:"confirm",title:"Reminder Notification",text:`
|
||
|
This will notify you at a specific time each day.
|
||
|
Note that it does not give you personalized notifications,
|
||
|
so if you want less reliable but personalized notification then choose a 'New Activity' Notification.
|
||
|
Do you want more details?
|
||
|
`,onYes:async()=>{await this.$router.push({name:"help-notification-types"})},yesText:"tell me more."},-1)}async showReminderNotificationChoice(){this.notifyingReminder?this.$notify({group:"modal",type:"notification-off",title:Y,text:"",callback:async i=>{i&&(await l.settings.update(w,{notifyingReminderMessage:"",notifyingReminderTime:""}),this.notifyingReminder=!1,this.notifyingReminderMessage="",this.notifyingReminderTime="")}},-1):this.$refs.pushNotificationPermission.open(Y,async(i,r,f)=>{i&&(await l.settings.update(w,{notifyingReminderMessage:f,notifyingReminderTime:r}),this.notifyingReminder=!0,this.notifyingReminderMessage=f||"",this.notifyingReminderTime=r)})}async toggleHideRegisterPromptOnNewContact(){const i=!this.hideRegisterPromptOnNewContact;await l.open(),await l.settings.update(w,{hideRegisterPromptOnNewContact:i}),this.hideRegisterPromptOnNewContact=i}async updatePasskeyExpiration(){await l.open(),await l.settings.update(w,{passkeyExpirationMinutes:this.passkeyExpirationMinutes}),ge(),this.passkeyExpirationDescription=N()}async turnOffNotifyingFlags(){await l.open(),await l.settings.update(w,{notifyingNewActivityTime:"",notifyingReminderMessage:"",notifyingReminderTime:""}),this.notifyingNewActivity=!1,this.notifyingNewActivityTime="",this.notifyingReminder=!1,this.notifyingReminderMessage="",this.notifyingReminderTime=""}async exportDatabase(){try{const i=await this.generateDatabaseBlob();this.downloadUrl=this.createBlobURL(i),this.downloadDatabaseBackup(this.downloadUrl),this.notifyDownloadStarted(),setTimeout(()=>URL.revokeObjectURL(this.downloadUrl),1e3)}catch(i){this.handleExportError(i)}}async generateDatabaseBlob(){return await l.export({prettyJson:!0})}createBlobURL(i){return URL.createObjectURL(i)}downloadDatabaseBackup(i){const r=this.$refs.downloadLink;r.href=i,r.download=`${l.name}-backup.json`,r.click()}computedStartDownloadLinkClassNames(){return{hidden:this.downloadUrl}}computedDownloadLinkClassNames(){return{hidden:!this.downloadUrl}}notifyDownloadStarted(){this.$notify({group:"alert",type:"success",title:"Download Started",text:"See your downloads directory for the backup. It is in the Dexie format."},-1)}handleExportError(i){console.error("Export Error:",i),this.$notify({group:"alert",type:"danger",title:"Export Error",text:"There was an error exporting the data."},-1)}async uploadImportFile(i){C.value=i.target.files[0]}showContactImport(){return!!C.value}confirmSubmitImportFile(){C.value!=null&&this.$notify({group:"modal",type:"confirm",title:"Replace All",text:"This will replace all settings and contacts, so we recommend you first do the backup step above. Are you sure you want to import and replace all contacts and settings?",onYes:this.submitImportFile},-1)}async submitImportFile(){C.value!=null&&(await l.delete(),await se.import(C.value,{progressCallback:this.progressCallback}))}async checkContactImports(){const i=new FileReader;i.onload=r=>{var v,S,A,h;const f=((v=r.target)==null?void 0:v.result)||"{}";try{const x=((h=(A=(S=JSON.parse(f).data)==null?void 0:S.data)==null?void 0:A.find(R=>R.tableName==="contacts"))==null?void 0:h.rows).map(R=>pe(["$types"],R));this.$router.push({name:"contact-import",query:{contacts:JSON.stringify(x)}})}catch(g){console.error("Error checking contact imports:",g),this.$notify({group:"alert",type:"danger",title:"Error Importing",text:"There was an error reading that Dexie file."},3e3)}},i.readAsText(C.value)}progressCallback(i){return console.log(`Import progress: ${i.completedRows} of ${i.totalRows} rows completed.`),i.done&&this.$notify({group:"alert",type:"success",title:"Import Complete",text:""},5e3),!0}async checkLimits(){this.activeDid?this.checkLimitsFor(this.activeDid):this.limitsMessage="You have no identifier, or your data has been corrupted."}async checkLimitsFor(i){this.loadingLimits=!0,this.limitsMessage="";try{const r=await ue(this.apiServer,this.axios,i);if(r.status===200){if(this.endorserLimits=r.data,!this.isRegistered)try{await G(i,{isRegistered:!0}),this.isRegistered=!0}catch(v){console.error("Got an error updating settings
|