diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts
index 735252f7..cdc516b1 100644
--- a/src/libs/endorserServer.ts
+++ b/src/libs/endorserServer.ts
@@ -1140,6 +1140,28 @@ export const capitalizeAndInsertSpacesBeforeCaps = (text: string) => {
: text[0].toUpperCase() + text.substr(1).replace(/([A-Z])/g, " $1");
};
+/**
+ * Formats type string for display by adding spaces before capitals
+ * and optionally adds an appropriate article prefix (a/an)
+ *
+ * @param text - Text to format
+ * @returns Formatted string with article prefix
+ */
+export const capitalizeAndInsertSpacesBeforeCapsWithAPrefix = (
+ text: string,
+): string => {
+ const word = capitalizeAndInsertSpacesBeforeCaps(text);
+ if (word) {
+ // if the word starts with a vowel, use "an" instead of "a"
+ const firstLetter = word[0].toLowerCase();
+ const vowels = ["a", "e", "i", "o", "u"];
+ const particle = vowels.includes(firstLetter) ? "an" : "a";
+ return particle + " " + word;
+ } else {
+ return "";
+ }
+};
+
/**
return readable summary of claim, or something generic
diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue
index f594dc9b..3653861d 100644
--- a/src/views/ClaimView.vue
+++ b/src/views/ClaimView.vue
@@ -24,7 +24,9 @@
{{
- capitalizeAndInsertSpacesBeforeCaps(veriClaim.claimType || "")
+ serverUtil.capitalizeAndInsertSpacesBeforeCaps(
+ veriClaim.claimType || "",
+ )
}}
+
+
+
+
+ This fulfills a bigger plan
+
+
+
-
-
-
- This fulfills a bigger plan
-
-
-
-
-
-
-
- This fulfills
- {{
- capitalizeAndInsertSpacesBeforeCapsWithAPrefix(
- giveDetails?.fulfillsType || "",
- )
- }}
-
-
+
+
+
+
+ This fulfills
+ {{
+ serverUtil.capitalizeAndInsertSpacesBeforeCapsWithAPrefix(
+ giveDetailsOfferFulfillment.offerType || "Offer",
+ )
+ }}
+
+
+
@@ -493,6 +493,11 @@ export default class ConfirmGiftView extends Vue {
confsVisibleErrorMessage = "";
confsVisibleToIdList: string[] = []; // list of DIDs that can see any confirmer
giveDetails?: GiveSummaryRecord;
+ // Additional offer information extracted from the fulfills array
+ giveDetailsOfferFulfillment: {
+ offerHandleId?: string;
+ offerType?: string;
+ } | null = null;
giverName = "";
issuerName = "";
isLoading = false;
@@ -648,6 +653,8 @@ export default class ConfirmGiftView extends Vue {
if (resp.status === 200) {
this.giveDetails = resp.data.data[0];
+ // Extract offer information from the fulfills array
+ this.extractOfferFulfillment();
} else {
throw new Error("Error getting detailed give info: " + resp.status);
}
@@ -707,6 +714,33 @@ export default class ConfirmGiftView extends Vue {
}
}
+ /**
+ * Extract offer fulfillment information from the fulfills array
+ */
+ private extractOfferFulfillment() {
+ if (!this.giveDetails?.fullClaim?.fulfills) {
+ this.giveDetailsOfferFulfillment = null;
+ return;
+ }
+
+ const fulfills = this.giveDetails.fullClaim.fulfills;
+ if (!Array.isArray(fulfills)) {
+ this.giveDetailsOfferFulfillment = null;
+ return;
+ }
+
+ // Find the Offer in the fulfills array
+ const offerFulfill = fulfills.find((item) => item["@type"] === "Offer");
+ if (offerFulfill) {
+ this.giveDetailsOfferFulfillment = {
+ offerHandleId: offerFulfill.identifier,
+ offerType: offerFulfill["@type"],
+ };
+ } else {
+ this.giveDetailsOfferFulfillment = null;
+ }
+ }
+
/**
* Fetches confirmer information for the claim
*/
@@ -849,27 +883,6 @@ export default class ConfirmGiftView extends Vue {
);
}
- /**
- * Formats type string for display by adding spaces before capitals
- * Optionally adds a prefix
- *
- * @param text - Text to format
- * @param prefix - Optional prefix to add
- * @returns Formatted string
- */
- capitalizeAndInsertSpacesBeforeCapsWithAPrefix(text: string): string {
- const word = this.capitalizeAndInsertSpacesBeforeCaps(text);
- if (word) {
- // if the word starts with a vowel, use "an" instead of "a"
- const firstLetter = word[0].toLowerCase();
- const vowels = ["a", "e", "i", "o", "u"];
- const particle = vowels.includes(firstLetter) ? "an" : "a";
- return particle + " " + word;
- } else {
- return "";
- }
- }
-
/**
* Initiates sharing of claim information
* Handles share functionality based on platform capabilities
@@ -894,11 +907,5 @@ export default class ConfirmGiftView extends Vue {
this.veriClaim = serverUtil.BLANK_GENERIC_SERVER_RECORD;
this.veriClaimDump = "";
}
-
- capitalizeAndInsertSpacesBeforeCaps(text: string) {
- return !text
- ? ""
- : text[0].toUpperCase() + text.substr(1).replace(/([A-Z])/g, " $1");
- }
}