|
@ -350,6 +350,47 @@ import * as serverUtil from "../libs/endorserServer"; |
|
|
import { logger } from "../utils/logger"; |
|
|
import { logger } from "../utils/logger"; |
|
|
import { GiveRecordWithContactInfo } from "types"; |
|
|
import { GiveRecordWithContactInfo } from "types"; |
|
|
|
|
|
|
|
|
|
|
|
interface Claim { |
|
|
|
|
|
claim?: Claim; // For nested claims in Verifiable Credentials |
|
|
|
|
|
agent?: { |
|
|
|
|
|
identifier?: string; |
|
|
|
|
|
did?: string; |
|
|
|
|
|
}; |
|
|
|
|
|
recipient?: { |
|
|
|
|
|
identifier?: string; |
|
|
|
|
|
did?: string; |
|
|
|
|
|
}; |
|
|
|
|
|
provider?: |
|
|
|
|
|
| { |
|
|
|
|
|
identifier?: string; |
|
|
|
|
|
} |
|
|
|
|
|
| Array<{ identifier?: string }>; |
|
|
|
|
|
object?: { |
|
|
|
|
|
amountOfThisGood?: number; |
|
|
|
|
|
unitCode?: string; |
|
|
|
|
|
}; |
|
|
|
|
|
description?: string; |
|
|
|
|
|
image?: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface FulfillsPlan { |
|
|
|
|
|
locLat?: number; |
|
|
|
|
|
locLon?: number; |
|
|
|
|
|
name?: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface Provider { |
|
|
|
|
|
identifier?: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface ProvidedByPlan { |
|
|
|
|
|
name?: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface FeedError { |
|
|
|
|
|
userMessage?: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* HomeView Component |
|
|
* HomeView Component |
|
|
* |
|
|
* |
|
@ -987,7 +1028,7 @@ export default class HomeView extends Vue { |
|
|
* @param claim The claim object containing giver information |
|
|
* @param claim The claim object containing giver information |
|
|
* @returns The giver's DID |
|
|
* @returns The giver's DID |
|
|
*/ |
|
|
*/ |
|
|
private extractGiverDid(claim: any) { |
|
|
private extractGiverDid(claim: Claim) { |
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
return claim.agent?.identifier || (claim.agent as any)?.did; |
|
|
return claim.agent?.identifier || (claim.agent as any)?.did; |
|
|
} |
|
|
} |
|
@ -998,7 +1039,7 @@ export default class HomeView extends Vue { |
|
|
* @internal |
|
|
* @internal |
|
|
* Called by processRecord() |
|
|
* Called by processRecord() |
|
|
*/ |
|
|
*/ |
|
|
private extractRecipientDid(claim: any) { |
|
|
private extractRecipientDid(claim: Claim) { |
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
return claim.recipient?.identifier || (claim.recipient as any)?.did; |
|
|
return claim.recipient?.identifier || (claim.recipient as any)?.did; |
|
|
} |
|
|
} |
|
@ -1056,7 +1097,7 @@ export default class HomeView extends Vue { |
|
|
*/ |
|
|
*/ |
|
|
private shouldIncludeRecord( |
|
|
private shouldIncludeRecord( |
|
|
record: GiveSummaryRecord, |
|
|
record: GiveSummaryRecord, |
|
|
fulfillsPlan: any, |
|
|
fulfillsPlan?: FulfillsPlan, |
|
|
): boolean { |
|
|
): boolean { |
|
|
if (!this.isAnyFeedFilterOn) { |
|
|
if (!this.isAnyFeedFilterOn) { |
|
|
return true; |
|
|
return true; |
|
@ -1090,7 +1131,7 @@ export default class HomeView extends Vue { |
|
|
* @internal |
|
|
* @internal |
|
|
* Called by processRecord() |
|
|
* Called by processRecord() |
|
|
*/ |
|
|
*/ |
|
|
private extractProvider(claim: any) { |
|
|
private extractProvider(claim: Claim): Provider | undefined { |
|
|
return Array.isArray(claim.provider) ? claim.provider[0] : claim.provider; |
|
|
return Array.isArray(claim.provider) ? claim.provider[0] : claim.provider; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1100,7 +1141,7 @@ export default class HomeView extends Vue { |
|
|
* @internal |
|
|
* @internal |
|
|
* Called by processRecord() |
|
|
* Called by processRecord() |
|
|
*/ |
|
|
*/ |
|
|
private async getProvidedByPlan(provider: any) { |
|
|
private async getProvidedByPlan(provider: Provider | undefined) { |
|
|
return await getPlanFromCache( |
|
|
return await getPlanFromCache( |
|
|
provider?.identifier as string, |
|
|
provider?.identifier as string, |
|
|
this.axios, |
|
|
this.axios, |
|
@ -1138,12 +1179,12 @@ export default class HomeView extends Vue { |
|
|
*/ |
|
|
*/ |
|
|
private createFeedRecord( |
|
|
private createFeedRecord( |
|
|
record: GiveSummaryRecord, |
|
|
record: GiveSummaryRecord, |
|
|
claim: any, |
|
|
claim: Claim, |
|
|
giverDid: string, |
|
|
giverDid: string, |
|
|
recipientDid: string, |
|
|
recipientDid: string, |
|
|
provider: any, |
|
|
provider: Provider | undefined, |
|
|
fulfillsPlan: any, |
|
|
fulfillsPlan?: FulfillsPlan, |
|
|
providedByPlan: any, |
|
|
providedByPlan?: ProvidedByPlan, |
|
|
): GiveRecordWithContactInfo { |
|
|
): GiveRecordWithContactInfo { |
|
|
return { |
|
|
return { |
|
|
...record, |
|
|
...record, |
|
@ -1202,14 +1243,16 @@ export default class HomeView extends Vue { |
|
|
* @internal |
|
|
* @internal |
|
|
* Called by updateAllFeed() |
|
|
* Called by updateAllFeed() |
|
|
*/ |
|
|
*/ |
|
|
private handleFeedError(e: any) { |
|
|
private handleFeedError(e: unknown) { |
|
|
logger.error("Error with feed load:", e); |
|
|
logger.error("Error with feed load:", e); |
|
|
this.$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|
group: "alert", |
|
|
group: "alert", |
|
|
type: "danger", |
|
|
type: "danger", |
|
|
title: "Feed Error", |
|
|
title: "Feed Error", |
|
|
text: e.userMessage || "There was an error retrieving feed data.", |
|
|
text: |
|
|
|
|
|
(e as FeedError)?.userMessage || |
|
|
|
|
|
"There was an error retrieving feed data.", |
|
|
}, |
|
|
}, |
|
|
-1, |
|
|
-1, |
|
|
); |
|
|
); |
|
|