fix linting

This commit is contained in:
2025-03-10 09:10:30 -06:00
parent b6213f5040
commit d53de5e79b
6 changed files with 88 additions and 89 deletions

View File

@@ -430,13 +430,11 @@
</template>
<script lang="ts">
import { AxiosError } from "axios";
import * as yaml from "js-yaml";
import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator";
import { useClipboard } from "@vueuse/core";
import { RouteLocationNormalizedLoaded, Router } from "vue-router";
import { GenericVerifiableCredential } from "../interfaces";
import QuickNav from "../components/QuickNav.vue";
import { NotificationIface } from "../constants/app";
import { db, retrieveSettingsForActiveAccount } from "../db/index";
@@ -445,16 +443,16 @@ import * as serverUtil from "../libs/endorserServer";
import { GiveSummaryRecord } from "../interfaces";
import { displayAmount } from "../libs/endorserServer";
import * as libsUtil from "../libs/util";
import { isGiveAction, retrieveAccountDids } from "../libs/util";
import { retrieveAccountDids } from "../libs/util";
import TopMessage from "../components/TopMessage.vue";
/**
* ConfirmGiftView Component
*
*
* Displays details about a gift claim and allows users to confirm it if eligible.
* Shows gift details including giver, recipient, amount, description, and confirmation status.
* Handles visibility of hidden DIDs and provides access to detailed claim information.
*
*
* Key features:
* - Gift confirmation workflow
* - Detailed gift information display
@@ -504,7 +502,7 @@ export default class ConfirmGiftView extends Vue {
/**
* Initializes the view with gift claim information
*
*
* Workflow:
* 1. Retrieves active account settings
* 2. Loads gift claim details from ID in URL
@@ -534,7 +532,7 @@ export default class ConfirmGiftView extends Vue {
this.allContacts = await db.contacts.toArray();
this.isRegistered = settings.isRegistered || false;
this.allMyDids = await retrieveAccountDids();
// Check share capability
// When Chrome compatibility is fixed https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API#api.navigator.canshare
// then use this truer check: navigator.canShare && navigator.canShare()
@@ -545,7 +543,9 @@ export default class ConfirmGiftView extends Vue {
* Loads and processes claim from URL parameters
*/
private async loadClaimFromUrl() {
const pathParam = window.location.pathname.substring("/confirm-gift/".length);
const pathParam = window.location.pathname.substring(
"/confirm-gift/".length,
);
if (!pathParam) {
throw new Error("No claim ID was provided.");
}
@@ -563,7 +563,8 @@ export default class ConfirmGiftView extends Vue {
group: "alert",
type: "danger",
title: "Error",
text: error instanceof Error ? error.message : "No claim ID was provided.",
text:
error instanceof Error ? error.message : "No claim ID was provided.",
},
3000,
);
@@ -571,7 +572,7 @@ export default class ConfirmGiftView extends Vue {
/**
* Loads claim details and associated give information
*
*
* @param claimId - ID of claim to load
* @param userDid - User's DID
*/
@@ -596,7 +597,7 @@ export default class ConfirmGiftView extends Vue {
try {
const headers = await serverUtil.getHeaders(userDid);
const resp = await this.axios.get(url, { headers });
if (resp.status === 200) {
this.veriClaim = resp.data;
this.veriClaimDump = yaml.dump(this.veriClaim);
@@ -619,11 +620,11 @@ export default class ConfirmGiftView extends Vue {
*/
private async fetchGiveDetails(claimId: string, userDid: string) {
const giveUrl = `${this.apiServer}/api/v2/report/gives?handleId=${encodeURIComponent(claimId)}`;
try {
const headers = await serverUtil.getHeaders(userDid);
const resp = await this.axios.get(giveUrl, { headers });
if (resp.status === 200) {
this.giveDetails = resp.data.data[0];
} else {
@@ -683,7 +684,10 @@ export default class ConfirmGiftView extends Vue {
if (this.giveDetails?.fullClaim.image) {
this.urlForNewGive += `&image=${encodeURIComponent(this.giveDetails.fullClaim.image)}`;
}
if (this.giveDetails?.type === "Offer" && this.giveDetails?.fulfillsHandleId) {
if (
this.giveDetails?.type === "Offer" &&
this.giveDetails?.fulfillsHandleId
) {
this.urlForNewGive += `&offerId=${encodeURIComponent(this.giveDetails.fulfillsHandleId)}`;
}
if (this.giveDetails?.fulfillsPlanHandleId) {
@@ -701,7 +705,7 @@ export default class ConfirmGiftView extends Vue {
this.veriClaim.issuer,
userDid,
);
if (confirmerInfo) {
this.confirmerIdList = confirmerInfo.confirmerIdList;
this.confsVisibleToIdList = confirmerInfo.confsVisibleToIdList;
@@ -714,7 +718,7 @@ export default class ConfirmGiftView extends Vue {
/**
* Calculates total number of confirmers for the gift
* Includes both direct confirmers and those visible through network
*
*
* @returns Total number of confirmers
*/
totalConfirmers(): number {
@@ -725,21 +729,10 @@ export default class ConfirmGiftView extends Vue {
);
}
/**
* Formats display amount with proper unit
*
* @param unit - Currency or unit code
* @param amount - Numeric amount
* @returns Formatted amount string
*/
displayAmount(unit: string, amount: number): string {
return displayAmount(unit, amount);
}
/**
* Retrieves human-readable name for a DID
* Falls back to DID if no name available
*
*
* @param did - DID to get name for
* @returns Human-readable name
*/
@@ -754,7 +747,7 @@ export default class ConfirmGiftView extends Vue {
/**
* Copies text to clipboard and shows notification
*
*
* @param description - Description of copied content
* @param text - Text to copy
*/
@@ -776,7 +769,7 @@ export default class ConfirmGiftView extends Vue {
/**
* Navigates to claim page for detailed view
*
*
* @param claimId - ID of claim to view
*/
showClaimPage(claimId: string): void {
@@ -826,15 +819,12 @@ 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,
prefix?: string
): string {
capitalizeAndInsertSpacesBeforeCapsWithAPrefix(text: string): string {
const word = this.capitalizeAndInsertSpacesBeforeCaps(text);
if (word) {
// if the word starts with a vowel, use "an" instead of "a"