Browse Source

fix linting

pull/127/head
Trent Larson 2 days ago
parent
commit
d53de5e79b
  1. 8
      src/services/deepLinks.ts
  2. 30
      src/types/deepLinks.ts
  3. 4
      src/views/ClaimAddRawView.vue
  4. 32
      src/views/ConfirmGiftView.vue
  5. 29
      src/views/HomeView.vue

8
src/services/deepLinks.ts

@ -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];

30
src/types/deepLinks.ts

@ -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 = {

4
src/views/ClaimAddRawView.vue

@ -123,7 +123,7 @@ export default class ClaimAddRawView extends Vue {
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 });
}

32
src/views/ConfirmGiftView.vue

@ -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,7 +443,7 @@ 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";
/**
@ -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,
);
@ -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) {
@ -725,17 +729,6 @@ 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
@ -831,10 +824,7 @@ export default class ConfirmGiftView extends Vue {
* @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"

29
src/views/HomeView.vue

@ -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: {
@ -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,
);
}

Loading…
Cancel
Save