|  | @ -210,6 +210,7 @@ import { | 
			
		
	
		
		
			
				
					|  |  |   didInfo, |  |  |   didInfo, | 
			
		
	
		
		
			
				
					|  |  |   GiverInputInfo, |  |  |   GiverInputInfo, | 
			
		
	
		
		
			
				
					|  |  |   GiverOutputInfo, |  |  |   GiverOutputInfo, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |   GiveServerRecord, | 
			
		
	
		
		
			
				
					|  |  | } from "@/libs/endorserServer"; |  |  | } from "@/libs/endorserServer"; | 
			
		
	
		
		
			
				
					|  |  | import { Contact } from "@/db/tables/contacts"; |  |  | import { Contact } from "@/db/tables/contacts"; | 
			
		
	
		
		
			
				
					|  |  | import QuickNav from "@/components/QuickNav"; |  |  | import QuickNav from "@/components/QuickNav"; | 
			
		
	
	
		
		
			
				
					|  | @ -236,7 +237,7 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |   apiServer = ""; |  |  |   apiServer = ""; | 
			
		
	
		
		
			
				
					|  |  |   feedAllLoaded = false; |  |  |   feedAllLoaded = false; | 
			
		
	
		
		
			
				
					|  |  |   feedData = []; |  |  |   feedData = []; | 
			
		
	
		
		
			
				
					
					|  |  |   feedPreviousOldestId = null; |  |  |   feedPreviousOldestId?: string; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |   feedLastViewedId?: string; |  |  |   feedLastViewedId?: string; | 
			
		
	
		
		
			
				
					|  |  |   isHiddenSpinner = true; |  |  |   isHiddenSpinner = true; | 
			
		
	
		
		
			
				
					|  |  |   numAccounts = 0; |  |  |   numAccounts = 0; | 
			
		
	
	
		
		
			
				
					|  | @ -300,7 +301,7 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |   public async buildHeaders() { |  |  |   public async buildHeaders() { | 
			
		
	
		
		
			
				
					
					|  |  |     const headers: RawAxiosRequestHeaders = { |  |  |     const headers: HeadersInit = { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |       "Content-Type": "application/json", |  |  |       "Content-Type": "application/json", | 
			
		
	
		
		
			
				
					|  |  |     }; |  |  |     }; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -325,7 +326,7 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |   public async updateAllFeed() { |  |  |   public async updateAllFeed() { | 
			
		
	
		
		
			
				
					|  |  |     this.isHiddenSpinner = false; |  |  |     this.isHiddenSpinner = false; | 
			
		
	
		
		
			
				
					
					|  |  |     await this.retrieveClaims(this.apiServer, null, this.feedPreviousOldestId) |  |  |     await this.retrieveClaims(this.apiServer, this.feedPreviousOldestId) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |       .then(async (results) => { |  |  |       .then(async (results) => { | 
			
		
	
		
		
			
				
					|  |  |         if (results.data.length > 0) { |  |  |         if (results.data.length > 0) { | 
			
		
	
		
		
			
				
					|  |  |           this.feedData = this.feedData.concat(results.data); |  |  |           this.feedData = this.feedData.concat(results.data); | 
			
		
	
	
		
		
			
				
					|  | @ -360,7 +361,7 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |     this.isHiddenSpinner = true; |  |  |     this.isHiddenSpinner = true; | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |   public async retrieveClaims(endorserApiServer, identifier, beforeId) { |  |  |   public async retrieveClaims(endorserApiServer: string, beforeId?: string) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     const beforeQuery = beforeId == null ? "" : "&beforeId=" + beforeId; |  |  |     const beforeQuery = beforeId == null ? "" : "&beforeId=" + beforeId; | 
			
		
	
		
		
			
				
					|  |  |     const response = await fetch( |  |  |     const response = await fetch( | 
			
		
	
		
		
			
				
					|  |  |       endorserApiServer + "/api/v2/report/gives?" + beforeQuery, |  |  |       endorserApiServer + "/api/v2/report/gives?" + beforeQuery, | 
			
		
	
	
		
		
			
				
					|  | @ -383,13 +384,14 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |   giveDescription(giveRecord) { |  |  |   giveDescription(giveRecord: GiveServerRecord) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     let claim = giveRecord.fullClaim; |  |  |     let claim = giveRecord.fullClaim; | 
			
		
	
		
		
			
				
					
					|  |  |     if (claim.claim) { |  |  |     if ((claim as any).claim) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |       claim = claim.claim; |  |  |       // can happen for some claims wrapped in a Verifiable Credential | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |       claim = (claim as any).claim; | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |     // agent.did is for legacy data, before March 2023 |  |  |     // agent.did is for legacy data, before March 2023 | 
			
		
	
		
		
			
				
					
					|  |  |     const giverDid = claim.agent?.identifier || claim.agent?.did; |  |  |     const giverDid = claim.agent?.identifier || (claim.agent as any)?.did; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     const giverInfo = didInfo( |  |  |     const giverInfo = didInfo( | 
			
		
	
		
		
			
				
					|  |  |       giverDid, |  |  |       giverDid, | 
			
		
	
		
		
			
				
					|  |  |       this.activeDid, |  |  |       this.activeDid, | 
			
		
	
	
		
		
			
				
					|  | @ -400,7 +402,8 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |       ? this.displayAmount(claim.object.unitCode, claim.object.amountOfThisGood) |  |  |       ? this.displayAmount(claim.object.unitCode, claim.object.amountOfThisGood) | 
			
		
	
		
		
			
				
					|  |  |       : claim.description || "something unknown"; |  |  |       : claim.description || "something unknown"; | 
			
		
	
		
		
			
				
					|  |  |     // recipient.did is for legacy data, before March 2023 |  |  |     // recipient.did is for legacy data, before March 2023 | 
			
		
	
		
		
			
				
					
					|  |  |     const gaveRecipientId = claim.recipient?.identifier || claim.recipient?.did; |  |  |     const gaveRecipientId = | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |       claim.recipient?.identifier || (claim.recipient as any)?.did; | 
			
		
	
		
		
			
				
					|  |  |     const gaveRecipientInfo = gaveRecipientId |  |  |     const gaveRecipientInfo = gaveRecipientId | 
			
		
	
		
		
			
				
					|  |  |       ? " to " + |  |  |       ? " to " + | 
			
		
	
		
		
			
				
					|  |  |         didInfo( |  |  |         didInfo( | 
			
		
	
	
		
		
			
				
					|  | @ -417,7 +420,7 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |     return "" + amt + " " + this.currencyShortWordForCode(code, amt === 1); |  |  |     return "" + amt + " " + this.currencyShortWordForCode(code, amt === 1); | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |   currencyShortWordForCode(unitCode: string, single: number) { |  |  |   currencyShortWordForCode(unitCode: string, single: boolean) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     return unitCode === "HUR" ? (single ? "hour" : "hours") : unitCode; |  |  |     return unitCode === "HUR" ? (single ? "hour" : "hours") : unitCode; | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -425,11 +428,16 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |     this.$refs.customDialog.open(giver); |  |  |     this.$refs.customDialog.open(giver); | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |   handleDialogResult(result: GiverInputInfo) { |  |  |   handleDialogResult(result: GiverOutputInfo) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     if (result.action === "confirm") { |  |  |     if (result.action === "confirm") { | 
			
		
	
		
		
			
				
					|  |  |       return new Promise((resolve) => { |  |  |       return new Promise((resolve) => { | 
			
		
	
		
		
			
				
					
					|  |  |         this.recordGive(result.giver?.did, result.description, result.hours); |  |  |         this.recordGive( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         resolve(); |  |  |           result.giver?.did, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |           result.description, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           result.hours, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         ).then(() => { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           resolve(null); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         }); | 
			
		
	
		
		
			
				
					|  |  |       }); |  |  |       }); | 
			
		
	
		
		
			
				
					|  |  |     } else { |  |  |     } else { | 
			
		
	
		
		
			
				
					|  |  |       // action was "cancel" so do nothing |  |  |       // action was "cancel" so do nothing | 
			
		
	
	
		
		
			
				
					|  | @ -445,7 +453,7 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |   public async recordGive( |  |  |   public async recordGive( | 
			
		
	
		
		
			
				
					|  |  |     giverDid?: string, |  |  |     giverDid?: string, | 
			
		
	
		
		
			
				
					|  |  |     description?: string, |  |  |     description?: string, | 
			
		
	
		
		
			
				
					
					|  |  |     hours?: string, |  |  |     hours?: number, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |   ) { |  |  |   ) { | 
			
		
	
		
		
			
				
					|  |  |     if (!this.activeDid) { |  |  |     if (!this.activeDid) { | 
			
		
	
		
		
			
				
					|  |  |       this.$notify( |  |  |       this.$notify( | 
			
		
	
	
		
		
			
				
					|  | @ -482,7 +490,7 @@ export default class HomeView extends Vue { | 
			
		
	
		
		
			
				
					|  |  |         giverDid, |  |  |         giverDid, | 
			
		
	
		
		
			
				
					|  |  |         this.activeDid, |  |  |         this.activeDid, | 
			
		
	
		
		
			
				
					|  |  |         description, |  |  |         description, | 
			
		
	
		
		
			
				
					
					|  |  |         hours ? parseFloat(hours) : undefined, |  |  |         hours, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |       ); |  |  |       ); | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |       if (this.isGiveCreationError(result)) { |  |  |       if (this.isGiveCreationError(result)) { | 
			
		
	
	
		
		
			
				
					|  | 
 |