Fix offer fulfillment detection + consistencies between ClaimView and ConfirmGiftView #167

Merged
jose merged 8 commits from claimview-fullfills-offer into master 2025-09-08 08:37:03 +00:00
Showing only changes of commit 3e5e2cd0bb - Show all commits

View File

@@ -724,13 +724,18 @@ export default class ConfirmGiftView extends Vue {
}
const fulfills = this.giveDetails.fullClaim.fulfills;
if (!Array.isArray(fulfills)) {
this.giveDetailsOfferFulfillment = null;
return;
// Handle both array and single object cases
let offerFulfill = null;
if (Array.isArray(fulfills)) {
// Find the Offer in the fulfills array
offerFulfill = fulfills.find((item) => item["@type"] === "Offer");
} else if (fulfills["@type"] === "Offer") {
// fulfills is a single Offer object
offerFulfill = fulfills;
}
// Find the Offer in the fulfills array
const offerFulfill = fulfills.find((item) => item["@type"] === "Offer");
if (offerFulfill) {
this.giveDetailsOfferFulfillment = {
offerHandleId: offerFulfill.identifier,