forked from trent_larson/crowd-funder-for-time-pwa
fix linting
This commit is contained in:
@@ -111,17 +111,17 @@ export class DeepLinkHandler {
|
||||
): Promise<void> {
|
||||
const routeMap: Record<string, string> = {
|
||||
"user-profile": "user-profile",
|
||||
"project": "project",
|
||||
project: "project",
|
||||
"onboard-meeting-setup": "onboard-meeting-setup",
|
||||
"invite-one-accept": "invite-one-accept",
|
||||
"contact-import": "contact-import",
|
||||
"confirm-gift": "confirm-gift",
|
||||
"claim": "claim",
|
||||
claim: "claim",
|
||||
"claim-cert": "claim-cert",
|
||||
"claim-add-raw": "claim-add-raw",
|
||||
"contact-edit": "contact-edit",
|
||||
"contacts": "contacts",
|
||||
"did": "did"
|
||||
contacts: "contacts",
|
||||
did: "did",
|
||||
};
|
||||
|
||||
const routeName = routeMap[path];
|
||||
|
||||
@@ -37,43 +37,43 @@ export const baseUrlSchema = z.object({
|
||||
// Parameter validation schemas for each route type
|
||||
export const deepLinkSchemas = {
|
||||
"user-profile": z.object({
|
||||
id: z.string()
|
||||
id: z.string(),
|
||||
}),
|
||||
"project-details": z.object({
|
||||
id: z.string()
|
||||
id: z.string(),
|
||||
}),
|
||||
"onboard-meeting-setup": z.object({
|
||||
id: z.string()
|
||||
id: z.string(),
|
||||
}),
|
||||
"invite-one-accept": z.object({
|
||||
id: z.string()
|
||||
id: z.string(),
|
||||
}),
|
||||
"contact-import": z.object({
|
||||
jwt: z.string()
|
||||
jwt: z.string(),
|
||||
}),
|
||||
"confirm-gift": z.object({
|
||||
id: z.string()
|
||||
id: z.string(),
|
||||
}),
|
||||
"claim": z.object({
|
||||
id: z.string()
|
||||
claim: z.object({
|
||||
id: z.string(),
|
||||
}),
|
||||
"claim-cert": z.object({
|
||||
id: z.string()
|
||||
id: z.string(),
|
||||
}),
|
||||
"claim-add-raw": z.object({
|
||||
id: z.string(),
|
||||
claim: z.string().optional(),
|
||||
claimJwtId: z.string().optional()
|
||||
claimJwtId: z.string().optional(),
|
||||
}),
|
||||
"contact-edit": z.object({
|
||||
did: z.string()
|
||||
did: z.string(),
|
||||
}),
|
||||
"contacts": z.object({
|
||||
contacts: z.string() // JSON string of contacts array
|
||||
contacts: z.object({
|
||||
contacts: z.string(), // JSON string of contacts array
|
||||
}),
|
||||
did: z.object({
|
||||
id: z.string()
|
||||
})
|
||||
id: z.string(),
|
||||
}),
|
||||
};
|
||||
|
||||
export type DeepLinkParams = {
|
||||
|
||||
@@ -52,7 +52,7 @@ export default class ClaimAddRawView extends Vue {
|
||||
$route!: RouteLocationNormalizedLoaded;
|
||||
$router!: Router;
|
||||
axios!: AxiosInstance;
|
||||
|
||||
|
||||
accountIdentityStr: string = "null";
|
||||
activeDid = "";
|
||||
apiServer = "";
|
||||
@@ -87,7 +87,7 @@ export default class ClaimAddRawView extends Vue {
|
||||
private async loadClaimData() {
|
||||
// Try loading from direct claim parameter
|
||||
if (await this.loadClaimFromQueryParam()) return;
|
||||
|
||||
|
||||
// Try loading from claim JWT ID
|
||||
await this.loadClaimFromJwtId();
|
||||
}
|
||||
@@ -121,9 +121,9 @@ export default class ClaimAddRawView extends Vue {
|
||||
? "/api/claim/byHandle/"
|
||||
: "/api/claim/";
|
||||
const url = this.apiServer + urlPath + encodeURIComponent(claimJwtId);
|
||||
|
||||
|
||||
try {
|
||||
const response = await this.fetchClaimData(url, claimJwtId);
|
||||
const response = await this.fetchClaimData(url);
|
||||
this.formatClaimResponse(response, claimJwtId);
|
||||
} catch (error: unknown) {
|
||||
this.handleClaimError(error);
|
||||
@@ -133,7 +133,7 @@ export default class ClaimAddRawView extends Vue {
|
||||
/**
|
||||
* Fetch claim data from API
|
||||
*/
|
||||
private async fetchClaimData(url: string, claimJwtId: string) {
|
||||
private async fetchClaimData(url: string) {
|
||||
const headers = await serverUtil.getHeaders(this.activeDid);
|
||||
return await this.axios.get(url, { headers });
|
||||
}
|
||||
@@ -169,7 +169,7 @@ export default class ClaimAddRawView extends Vue {
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
title: "Error",
|
||||
text: "Got an error retrieving claim data.",
|
||||
},
|
||||
3000,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -255,12 +255,12 @@ import EntityIcon from "../components/EntityIcon.vue";
|
||||
|
||||
/**
|
||||
* DIDView Component
|
||||
*
|
||||
*
|
||||
* Displays detailed information about a DID (Decentralized Identifier) entity, including:
|
||||
* - Basic identity information (name, profile image)
|
||||
* - Contact management controls (visibility, registration status)
|
||||
* - Associated claims and their details
|
||||
*
|
||||
*
|
||||
* The view supports both viewing one's own DID and other contacts' DIDs.
|
||||
* It provides infinite scrolling for claims and interactive controls for contact management.
|
||||
*/
|
||||
@@ -300,7 +300,7 @@ export default class DIDView extends Vue {
|
||||
|
||||
/**
|
||||
* Initializes the view with DID information
|
||||
*
|
||||
*
|
||||
* Workflow:
|
||||
* 1. Retrieves active account settings (DID and API server)
|
||||
* 2. Determines which DID to display from URL params or defaults to active DID
|
||||
@@ -334,14 +334,14 @@ export default class DIDView extends Vue {
|
||||
private async determineDIDToDisplay() {
|
||||
const pathParam = window.location.pathname.substring("/did/".length);
|
||||
let showDid = pathParam;
|
||||
|
||||
|
||||
if (!showDid) {
|
||||
showDid = this.activeDid;
|
||||
if (showDid) {
|
||||
this.notifyDefaultToActiveDID();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (showDid) {
|
||||
this.viewingDid = decodeURIComponent(showDid);
|
||||
}
|
||||
@@ -368,7 +368,7 @@ export default class DIDView extends Vue {
|
||||
*/
|
||||
private async loadContactInformation() {
|
||||
if (!this.viewingDid) return;
|
||||
|
||||
|
||||
this.contactFromDid = await db.contacts.get(this.viewingDid);
|
||||
if (this.contactFromDid) {
|
||||
this.contactYaml = yaml.dump(this.contactFromDid);
|
||||
@@ -380,7 +380,7 @@ export default class DIDView extends Vue {
|
||||
*/
|
||||
private async checkIfOwnDID() {
|
||||
if (!this.viewingDid) return;
|
||||
|
||||
|
||||
const allAccountDids = await libsUtil.retrieveAccountDids();
|
||||
this.isMyDid = allAccountDids.includes(this.viewingDid);
|
||||
}
|
||||
@@ -388,7 +388,7 @@ export default class DIDView extends Vue {
|
||||
/**
|
||||
* Loads additional claims when user scrolls to bottom
|
||||
* Used by infinite scroll component to implement pagination
|
||||
*
|
||||
*
|
||||
* @param payload - Boolean indicating if more data should be loaded
|
||||
*/
|
||||
async loadMoreData(payload: boolean) {
|
||||
@@ -400,7 +400,7 @@ export default class DIDView extends Vue {
|
||||
/**
|
||||
* Prompts user to confirm contact deletion
|
||||
* Shows additional warning if contact has visibility permissions
|
||||
*
|
||||
*
|
||||
* @param contact - Contact object to be deleted
|
||||
*/
|
||||
confirmDeleteContact(contact: Contact) {
|
||||
@@ -428,7 +428,7 @@ export default class DIDView extends Vue {
|
||||
|
||||
/**
|
||||
* Deletes contact from local database and navigates back to contacts list
|
||||
*
|
||||
*
|
||||
* @param contact - Contact object to be deleted
|
||||
*/
|
||||
async deleteContact(contact: Contact) {
|
||||
@@ -449,7 +449,7 @@ export default class DIDView extends Vue {
|
||||
/**
|
||||
* Prompts user to confirm registering a contact
|
||||
* Shows additional warning if contact is already registered
|
||||
*
|
||||
*
|
||||
* @param contact - Contact to be registered
|
||||
*/
|
||||
async confirmRegister(contact: Contact) {
|
||||
@@ -476,7 +476,7 @@ export default class DIDView extends Vue {
|
||||
/**
|
||||
* Registers a contact with the endorser server
|
||||
* Updates local database with registration status
|
||||
*
|
||||
*
|
||||
* @param contact - Contact to register
|
||||
*/
|
||||
async register(contact: Contact) {
|
||||
@@ -609,7 +609,7 @@ export default class DIDView extends Vue {
|
||||
|
||||
/**
|
||||
* Navigates to detailed claim view
|
||||
*
|
||||
*
|
||||
* @param jwtId - JWT ID of the claim to view
|
||||
*/
|
||||
onClickLoadClaim(jwtId: string) {
|
||||
@@ -622,7 +622,7 @@ export default class DIDView extends Vue {
|
||||
/**
|
||||
* Extracts and formats claim amount information
|
||||
* Handles different claim types (GiveAction, Offer)
|
||||
*
|
||||
*
|
||||
* @param claim - Claim object to process
|
||||
* @returns Formatted amount string or empty string if no amount
|
||||
*/
|
||||
@@ -657,7 +657,7 @@ export default class DIDView extends Vue {
|
||||
/**
|
||||
* Extracts claim description
|
||||
* Falls back to name if no description available
|
||||
*
|
||||
*
|
||||
* @param claim - Claim to get description from
|
||||
* @returns Description string or empty string
|
||||
*/
|
||||
@@ -667,7 +667,7 @@ export default class DIDView extends Vue {
|
||||
|
||||
/**
|
||||
* Prompts user to confirm visibility change for a contact
|
||||
*
|
||||
*
|
||||
* @param contact - Contact to modify visibility for
|
||||
* @param visibility - New visibility state to set
|
||||
*/
|
||||
@@ -694,7 +694,7 @@ export default class DIDView extends Vue {
|
||||
|
||||
/**
|
||||
* Updates contact visibility on server and local database
|
||||
*
|
||||
*
|
||||
* @param contact - Contact to update visibility for
|
||||
* @param visibility - New visibility state
|
||||
* @param showSuccessAlert - Whether to show success notification
|
||||
@@ -752,7 +752,7 @@ export default class DIDView extends Vue {
|
||||
/**
|
||||
* Checks current visibility status of contact on server
|
||||
* Updates local database with current status
|
||||
*
|
||||
*
|
||||
* @param contact - Contact to check visibility for
|
||||
*/
|
||||
async checkVisibility(contact: Contact) {
|
||||
|
||||
@@ -429,9 +429,8 @@ import {
|
||||
retrieveAccountDids,
|
||||
GiverReceiverInputInfo,
|
||||
OnboardPage,
|
||||
registerSaveAndActivatePasskey,
|
||||
} from "../libs/util";
|
||||
import { GiveSummaryRecord} from "../interfaces";
|
||||
import { GiveSummaryRecord } from "../interfaces";
|
||||
interface GiveRecordWithContactInfo extends GiveSummaryRecord {
|
||||
jwtId: string;
|
||||
giver: {
|
||||
@@ -451,7 +450,7 @@ interface GiveRecordWithContactInfo extends GiveSummaryRecord {
|
||||
|
||||
/**
|
||||
* HomeView - Main view component for the application's home page
|
||||
*
|
||||
*
|
||||
* Workflow:
|
||||
* 1. On mount, initializes user identity, settings, and data
|
||||
* 2. Handles user registration status
|
||||
@@ -552,7 +551,10 @@ export default class HomeView extends Vue {
|
||||
this.allMyDids = [newDid];
|
||||
}
|
||||
} catch (error) {
|
||||
logConsoleAndDb("Error retrieving all account DIDs on home page:" + error, true);
|
||||
logConsoleAndDb(
|
||||
"Error retrieving all account DIDs on home page:" + error,
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +577,8 @@ export default class HomeView extends Vue {
|
||||
this.isFeedFilteredByNearby = !!settings.filterFeedByNearby;
|
||||
this.isRegistered = !!settings.isRegistered;
|
||||
this.lastAckedOfferToUserJwtId = settings.lastAckedOfferToUserJwtId;
|
||||
this.lastAckedOfferToUserProjectsJwtId = settings.lastAckedOfferToUserProjectsJwtId;
|
||||
this.lastAckedOfferToUserProjectsJwtId =
|
||||
settings.lastAckedOfferToUserProjectsJwtId;
|
||||
this.searchBoxes = settings.searchBoxes || [];
|
||||
this.showShortcutBvc = !!settings.showShortcutBvc;
|
||||
this.isAnyFeedFilterOn = checkIsAnyFeedFilterOn(settings);
|
||||
@@ -598,12 +601,16 @@ export default class HomeView extends Vue {
|
||||
private async checkRegistrationStatus() {
|
||||
if (!this.isRegistered && this.activeDid) {
|
||||
try {
|
||||
const resp = await fetchEndorserRateLimits(this.apiServer, this.axios, this.activeDid);
|
||||
const resp = await fetchEndorserRateLimits(
|
||||
this.apiServer,
|
||||
this.axios,
|
||||
this.activeDid,
|
||||
);
|
||||
if (resp.status === 200) {
|
||||
await updateAccountSettings(this.activeDid, {
|
||||
apiServer: this.apiServer,
|
||||
isRegistered: true,
|
||||
...await retrieveSettingsForActiveAccount()
|
||||
...(await retrieveSettingsForActiveAccount()),
|
||||
});
|
||||
this.isRegistered = true;
|
||||
}
|
||||
@@ -635,7 +642,7 @@ export default class HomeView extends Vue {
|
||||
this.axios,
|
||||
this.apiServer,
|
||||
this.activeDid,
|
||||
this.lastAckedOfferToUserJwtId
|
||||
this.lastAckedOfferToUserJwtId,
|
||||
);
|
||||
this.numNewOffersToUser = offersToUserData.data.length;
|
||||
this.newOffersToUserHitLimit = offersToUserData.hitLimit;
|
||||
@@ -644,7 +651,7 @@ export default class HomeView extends Vue {
|
||||
this.axios,
|
||||
this.apiServer,
|
||||
this.activeDid,
|
||||
this.lastAckedOfferToUserProjectsJwtId
|
||||
this.lastAckedOfferToUserProjectsJwtId,
|
||||
);
|
||||
this.numNewOffersToUserProjects = offersToUserProjects.data.length;
|
||||
this.newOffersToUserProjectsHitLimit = offersToUserProjects.hitLimit;
|
||||
@@ -675,9 +682,11 @@ export default class HomeView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: err.userMessage || "There was an error retrieving your settings or the latest activity.",
|
||||
text:
|
||||
err.userMessage ||
|
||||
"There was an error retrieving your settings or the latest activity.",
|
||||
},
|
||||
5000
|
||||
5000,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user