switch BVC-meeting-end gift to be from the plan, and add display of providers on claim-view page
This commit is contained in:
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
|
|
||||||
## [?]
|
## [?]
|
||||||
|
### Added
|
||||||
|
- Display of providers on claim view page
|
||||||
|
### Changed
|
||||||
|
- Switched BVC-meeting-ending gift to be a gift from the group.
|
||||||
|
|
||||||
|
|
||||||
## [0.3.27] - 2024.09.22 - ee23e6f005e47f5bd6f04d804599f6395371b0e4
|
## [0.3.27] - 2024.09.22 - ee23e6f005e47f5bd6f04d804599f6395371b0e4
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ export interface GiveVerifiableCredential extends GenericVerifiableCredential {
|
|||||||
identifier?: string;
|
identifier?: string;
|
||||||
image?: string;
|
image?: string;
|
||||||
object?: { amountOfThisGood: number; unitCode: string };
|
object?: { amountOfThisGood: number; unitCode: string };
|
||||||
|
provider?: Array<GenericVerifiableCredential>; // typically @type & identifier
|
||||||
recipient?: { identifier: string };
|
recipient?: { identifier: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,6 +593,7 @@ export function hydrateGive(
|
|||||||
fulfillsOfferHandleId?: string,
|
fulfillsOfferHandleId?: string,
|
||||||
isTrade: boolean = false,
|
isTrade: boolean = false,
|
||||||
imageUrl?: string,
|
imageUrl?: string,
|
||||||
|
providers?: Array<GenericVerifiableCredential>, // typically @type & identifier
|
||||||
lastClaimId?: string,
|
lastClaimId?: string,
|
||||||
): GiveVerifiableCredential {
|
): GiveVerifiableCredential {
|
||||||
// Remember: replace values or erase if it's null
|
// Remember: replace values or erase if it's null
|
||||||
@@ -650,6 +652,8 @@ export function hydrateGive(
|
|||||||
|
|
||||||
vcClaim.image = imageUrl || undefined;
|
vcClaim.image = imageUrl || undefined;
|
||||||
|
|
||||||
|
vcClaim.provider = providers || undefined;
|
||||||
|
|
||||||
return vcClaim;
|
return vcClaim;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,6 +678,7 @@ export async function createAndSubmitGive(
|
|||||||
fulfillsOfferHandleId?: string,
|
fulfillsOfferHandleId?: string,
|
||||||
isTrade: boolean = false,
|
isTrade: boolean = false,
|
||||||
imageUrl?: string,
|
imageUrl?: string,
|
||||||
|
providers?: Array<GenericVerifiableCredential>,
|
||||||
): Promise<CreateAndSubmitClaimResult> {
|
): Promise<CreateAndSubmitClaimResult> {
|
||||||
const vcClaim = hydrateGive(
|
const vcClaim = hydrateGive(
|
||||||
undefined,
|
undefined,
|
||||||
@@ -686,6 +691,7 @@ export async function createAndSubmitGive(
|
|||||||
fulfillsOfferHandleId,
|
fulfillsOfferHandleId,
|
||||||
isTrade,
|
isTrade,
|
||||||
imageUrl,
|
imageUrl,
|
||||||
|
providers,
|
||||||
undefined,
|
undefined,
|
||||||
);
|
);
|
||||||
return createAndSubmitClaim(
|
return createAndSubmitClaim(
|
||||||
@@ -718,6 +724,7 @@ export async function editAndSubmitGive(
|
|||||||
fulfillsOfferHandleId?: string,
|
fulfillsOfferHandleId?: string,
|
||||||
isTrade: boolean = false,
|
isTrade: boolean = false,
|
||||||
imageUrl?: string,
|
imageUrl?: string,
|
||||||
|
providers?: Array<GenericVerifiableCredential>,
|
||||||
): Promise<CreateAndSubmitClaimResult> {
|
): Promise<CreateAndSubmitClaimResult> {
|
||||||
const vcClaim = hydrateGive(
|
const vcClaim = hydrateGive(
|
||||||
fullClaim.claim,
|
fullClaim.claim,
|
||||||
@@ -730,6 +737,7 @@ export async function editAndSubmitGive(
|
|||||||
fulfillsOfferHandleId,
|
fulfillsOfferHandleId,
|
||||||
isTrade,
|
isTrade,
|
||||||
imageUrl,
|
imageUrl,
|
||||||
|
providers,
|
||||||
fullClaim.id,
|
fullClaim.id,
|
||||||
);
|
);
|
||||||
return createAndSubmitClaim(
|
return createAndSubmitClaim(
|
||||||
@@ -1180,7 +1188,7 @@ export const claimSpecialDescription = (
|
|||||||
|
|
||||||
export const BVC_MEETUPS_PROJECT_CLAIM_ID =
|
export const BVC_MEETUPS_PROJECT_CLAIM_ID =
|
||||||
import.meta.env.VITE_BVC_MEETUPS_PROJECT_CLAIM_ID ||
|
import.meta.env.VITE_BVC_MEETUPS_PROJECT_CLAIM_ID ||
|
||||||
"https://endorser.ch/entity/01HWE8FWHQ1YGP7GFZYYPS272F"; // this won't resolve as a URL on production; it's a URN only found in the test system
|
"https://endorser.ch/entity/01GXYPFF7FA03NXKPYY142PY4H"; // production value, which seems like the safest value if forgotten
|
||||||
|
|
||||||
export const bvcMeetingJoinClaim = (did: string, startTime: string) => {
|
export const bvcMeetingJoinClaim = (did: string, startTime: string) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
<!-- Fullfills Links -->
|
<!-- Fullfills Links -->
|
||||||
|
|
||||||
<!-- fullfills links for a give -->
|
<!-- fullfills links for a give -->
|
||||||
<div v-if="detailsForGive?.fulfillsPlanHandleId">
|
<div v-if="detailsForGive?.fulfillsPlanHandleId" class="mt-4">
|
||||||
<router-link
|
<router-link
|
||||||
:to="
|
:to="
|
||||||
'/project/' +
|
'/project/' +
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
@click="
|
@click="
|
||||||
showDifferentClaimPage(detailsForGive?.fulfillsHandleId)
|
showDifferentClaimPage(detailsForGive?.fulfillsHandleId)
|
||||||
"
|
"
|
||||||
class="text-blue-500 mt-4"
|
class="text-blue-500 mt-4 cursor-pointer"
|
||||||
>
|
>
|
||||||
Fulfills
|
Fulfills
|
||||||
{{
|
{{
|
||||||
@@ -136,6 +136,41 @@
|
|||||||
Offered to a bigger plan...
|
Offered to a bigger plan...
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Providers -->
|
||||||
|
<div v-if="providersForGive?.length > 0" class="mt-4">
|
||||||
|
<span>Other assistance provided by:</span>
|
||||||
|
<ul class="ml-4">
|
||||||
|
<li
|
||||||
|
v-for="provider of providersForGive"
|
||||||
|
:key="provider.identifier"
|
||||||
|
class="list-disc ml-4"
|
||||||
|
>
|
||||||
|
<div class="flex gap-4">
|
||||||
|
<div class="grow overflow-hidden">
|
||||||
|
<a
|
||||||
|
@click="
|
||||||
|
provider.identifier.startsWith('did:')
|
||||||
|
? this.$router.push(
|
||||||
|
'/did/' +
|
||||||
|
encodeURIComponent(provider.identifier),
|
||||||
|
)
|
||||||
|
: showDifferentClaimPage(provider.identifier)
|
||||||
|
"
|
||||||
|
class="text-blue-500 mt-4 cursor-pointer"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
provider.identifier.startsWith("did:")
|
||||||
|
? "a person..."
|
||||||
|
: "an activity..."
|
||||||
|
}}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -465,6 +500,11 @@ import {
|
|||||||
OfferVerifiableCredential,
|
OfferVerifiableCredential,
|
||||||
} from "@/libs/endorserServer";
|
} from "@/libs/endorserServer";
|
||||||
|
|
||||||
|
interface ProviderInfo {
|
||||||
|
identifier: string; // could be a DID or a handleId
|
||||||
|
linkConfirmed: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: { GiftedDialog, QuickNav },
|
components: { GiftedDialog, QuickNav },
|
||||||
})
|
})
|
||||||
@@ -488,6 +528,7 @@ export default class ClaimView extends Vue {
|
|||||||
isEditedGlobalId = false;
|
isEditedGlobalId = false;
|
||||||
isRegistered = false;
|
isRegistered = false;
|
||||||
numConfsNotVisible = 0; // number of hidden DIDs in the confirmerIdList, minus the issuer if they aren't visible
|
numConfsNotVisible = 0; // number of hidden DIDs in the confirmerIdList, minus the issuer if they aren't visible
|
||||||
|
providersForGive: ProviderInfo[] = [];
|
||||||
showDidCopy = false;
|
showDidCopy = false;
|
||||||
showIdCopy = false;
|
showIdCopy = false;
|
||||||
showVeriClaimDump = false;
|
showVeriClaimDump = false;
|
||||||
@@ -620,11 +661,40 @@ export default class ClaimView extends Vue {
|
|||||||
const giveResp = await this.axios.get(giveUrl, {
|
const giveResp = await this.axios.get(giveUrl, {
|
||||||
headers: giveHeaders,
|
headers: giveHeaders,
|
||||||
});
|
});
|
||||||
if (giveResp.status === 200) {
|
if (giveResp.status === 200 && giveResp.data.data?.length > 0) {
|
||||||
this.detailsForGive = giveResp.data.data[0];
|
this.detailsForGive = giveResp.data.data[0];
|
||||||
} else {
|
} else {
|
||||||
console.error("Error getting detailed give info:", giveResp);
|
console.error("Error getting detailed give info:", giveResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// look for providers
|
||||||
|
const providerUrl =
|
||||||
|
this.apiServer +
|
||||||
|
"/api/v2/report/providersToGive?handleId=" +
|
||||||
|
encodeURIComponent(this.veriClaim.handleId as string);
|
||||||
|
console.log("providerUrl:", providerUrl);
|
||||||
|
const providerHeaders = await serverUtil.getHeaders(userDid);
|
||||||
|
const providerResp = await this.axios.get(providerUrl, {
|
||||||
|
headers: providerHeaders,
|
||||||
|
});
|
||||||
|
// should be at least an empty array
|
||||||
|
if (
|
||||||
|
providerResp.status === 200 &&
|
||||||
|
Array.isArray(providerResp.data.data)
|
||||||
|
) {
|
||||||
|
this.providersForGive = providerResp.data.data;
|
||||||
|
} else {
|
||||||
|
console.error("Error getting give providers:", giveResp);
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "warning",
|
||||||
|
title: "Error",
|
||||||
|
text: "Got error retrieving linked provider data.",
|
||||||
|
},
|
||||||
|
-1,
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if (this.veriClaim.claimType === "Offer") {
|
} else if (this.veriClaim.claimType === "Offer") {
|
||||||
const offerUrl =
|
const offerUrl =
|
||||||
this.apiServer +
|
this.apiServer +
|
||||||
@@ -638,6 +708,15 @@ export default class ClaimView extends Vue {
|
|||||||
this.detailsForOffer = offerResp.data.data[0];
|
this.detailsForOffer = offerResp.data.data[0];
|
||||||
} else {
|
} else {
|
||||||
console.error("Error getting detailed offer info:", offerResp);
|
console.error("Error getting detailed offer info:", offerResp);
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "warning",
|
||||||
|
title: "Error",
|
||||||
|
text: "Got error retrieving linked offer data.",
|
||||||
|
},
|
||||||
|
-1,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -640,6 +640,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
this.offerId,
|
this.offerId,
|
||||||
this.isTrade,
|
this.isTrade,
|
||||||
this.imageUrl,
|
this.imageUrl,
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,6 +709,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
this.offerId,
|
this.offerId,
|
||||||
this.isTrade,
|
this.isTrade,
|
||||||
this.imageUrl,
|
this.imageUrl,
|
||||||
|
[],
|
||||||
this.prevCredToEdit?.id as string,
|
this.prevCredToEdit?.id as string,
|
||||||
);
|
);
|
||||||
const claimStr = JSON.stringify(giveClaim);
|
const claimStr = JSON.stringify(giveClaim);
|
||||||
|
|||||||
@@ -385,7 +385,7 @@
|
|||||||
<span>
|
<span>
|
||||||
{{
|
{{
|
||||||
serverUtil.didInfo(
|
serverUtil.didInfo(
|
||||||
give.agentDid,
|
give.recipientDid,
|
||||||
activeDid,
|
activeDid,
|
||||||
allMyDids,
|
allMyDids,
|
||||||
allContacts,
|
allContacts,
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
<h2 class="text-2xl m-2">Anything else?</h2>
|
<h2 class="text-2xl m-2">Anything else?</h2>
|
||||||
<div class="m-2 flex">
|
<div class="m-2 flex">
|
||||||
<input type="checkbox" v-model="someoneGave" class="h-6 w-6" />
|
<input type="checkbox" v-model="someoneGave" class="h-6 w-6" />
|
||||||
<span class="pb-2 pl-2 pr-2">Someone else gave</span>
|
<span class="pb-2 pl-2 pr-2">The group provided</span>
|
||||||
<span v-if="someoneGave">
|
<span v-if="someoneGave">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -305,6 +305,12 @@ export default class QuickActionBvcBeginView extends Vue {
|
|||||||
// now send the give for the description
|
// now send the give for the description
|
||||||
let giveSucceeded = false;
|
let giveSucceeded = false;
|
||||||
if (this.someoneGave) {
|
if (this.someoneGave) {
|
||||||
|
const providers: Array<GenericVerifiableCredential> = [
|
||||||
|
{
|
||||||
|
"@type": "PlanAction",
|
||||||
|
identifier: BVC_MEETUPS_PROJECT_CLAIM_ID,
|
||||||
|
},
|
||||||
|
];
|
||||||
const giveResult = await createAndSubmitGive(
|
const giveResult = await createAndSubmitGive(
|
||||||
axios,
|
axios,
|
||||||
this.apiServer,
|
this.apiServer,
|
||||||
@@ -314,7 +320,11 @@ export default class QuickActionBvcBeginView extends Vue {
|
|||||||
this.description,
|
this.description,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
BVC_MEETUPS_PROJECT_CLAIM_ID,
|
undefined,
|
||||||
|
undefined,
|
||||||
|
false,
|
||||||
|
undefined,
|
||||||
|
providers,
|
||||||
);
|
);
|
||||||
giveSucceeded = giveResult.type === "success";
|
giveSucceeded = giveResult.type === "success";
|
||||||
if (!giveSucceeded) {
|
if (!giveSucceeded) {
|
||||||
|
|||||||
Reference in New Issue
Block a user