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. 27
      src/views/HomeView.vue

8
src/services/deepLinks.ts

@ -111,17 +111,17 @@ export class DeepLinkHandler {
): Promise<void> { ): Promise<void> {
const routeMap: Record<string, string> = { const routeMap: Record<string, string> = {
"user-profile": "user-profile", "user-profile": "user-profile",
"project": "project", project: "project",
"onboard-meeting-setup": "onboard-meeting-setup", "onboard-meeting-setup": "onboard-meeting-setup",
"invite-one-accept": "invite-one-accept", "invite-one-accept": "invite-one-accept",
"contact-import": "contact-import", "contact-import": "contact-import",
"confirm-gift": "confirm-gift", "confirm-gift": "confirm-gift",
"claim": "claim", claim: "claim",
"claim-cert": "claim-cert", "claim-cert": "claim-cert",
"claim-add-raw": "claim-add-raw", "claim-add-raw": "claim-add-raw",
"contact-edit": "contact-edit", "contact-edit": "contact-edit",
"contacts": "contacts", contacts: "contacts",
"did": "did" did: "did",
}; };
const routeName = routeMap[path]; 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 // Parameter validation schemas for each route type
export const deepLinkSchemas = { export const deepLinkSchemas = {
"user-profile": z.object({ "user-profile": z.object({
id: z.string() id: z.string(),
}), }),
"project-details": z.object({ "project-details": z.object({
id: z.string() id: z.string(),
}), }),
"onboard-meeting-setup": z.object({ "onboard-meeting-setup": z.object({
id: z.string() id: z.string(),
}), }),
"invite-one-accept": z.object({ "invite-one-accept": z.object({
id: z.string() id: z.string(),
}), }),
"contact-import": z.object({ "contact-import": z.object({
jwt: z.string() jwt: z.string(),
}), }),
"confirm-gift": z.object({ "confirm-gift": z.object({
id: z.string() id: z.string(),
}), }),
"claim": z.object({ claim: z.object({
id: z.string() id: z.string(),
}), }),
"claim-cert": z.object({ "claim-cert": z.object({
id: z.string() id: z.string(),
}), }),
"claim-add-raw": z.object({ "claim-add-raw": z.object({
id: z.string(), id: z.string(),
claim: z.string().optional(), claim: z.string().optional(),
claimJwtId: z.string().optional() claimJwtId: z.string().optional(),
}), }),
"contact-edit": z.object({ "contact-edit": z.object({
did: z.string() did: z.string(),
}), }),
"contacts": z.object({ contacts: z.object({
contacts: z.string() // JSON string of contacts array contacts: z.string(), // JSON string of contacts array
}), }),
did: z.object({ did: z.object({
id: z.string() id: z.string(),
}) }),
}; };
export type DeepLinkParams = { 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); const url = this.apiServer + urlPath + encodeURIComponent(claimJwtId);
try { try {
const response = await this.fetchClaimData(url, claimJwtId); const response = await this.fetchClaimData(url);
this.formatClaimResponse(response, claimJwtId); this.formatClaimResponse(response, claimJwtId);
} catch (error: unknown) { } catch (error: unknown) {
this.handleClaimError(error); this.handleClaimError(error);
@ -133,7 +133,7 @@ export default class ClaimAddRawView extends Vue {
/** /**
* Fetch claim data from API * Fetch claim data from API
*/ */
private async fetchClaimData(url: string, claimJwtId: string) { private async fetchClaimData(url: string) {
const headers = await serverUtil.getHeaders(this.activeDid); const headers = await serverUtil.getHeaders(this.activeDid);
return await this.axios.get(url, { headers }); return await this.axios.get(url, { headers });
} }

32
src/views/ConfirmGiftView.vue

@ -430,13 +430,11 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { AxiosError } from "axios";
import * as yaml from "js-yaml"; import * as yaml from "js-yaml";
import * as R from "ramda"; import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { useClipboard } from "@vueuse/core"; import { useClipboard } from "@vueuse/core";
import { RouteLocationNormalizedLoaded, Router } from "vue-router"; import { RouteLocationNormalizedLoaded, Router } from "vue-router";
import { GenericVerifiableCredential } from "../interfaces";
import QuickNav from "../components/QuickNav.vue"; import QuickNav from "../components/QuickNav.vue";
import { NotificationIface } from "../constants/app"; import { NotificationIface } from "../constants/app";
import { db, retrieveSettingsForActiveAccount } from "../db/index"; import { db, retrieveSettingsForActiveAccount } from "../db/index";
@ -445,7 +443,7 @@ import * as serverUtil from "../libs/endorserServer";
import { GiveSummaryRecord } from "../interfaces"; import { GiveSummaryRecord } from "../interfaces";
import { displayAmount } from "../libs/endorserServer"; import { displayAmount } from "../libs/endorserServer";
import * as libsUtil from "../libs/util"; import * as libsUtil from "../libs/util";
import { isGiveAction, retrieveAccountDids } from "../libs/util"; import { retrieveAccountDids } from "../libs/util";
import TopMessage from "../components/TopMessage.vue"; import TopMessage from "../components/TopMessage.vue";
/** /**
@ -545,7 +543,9 @@ export default class ConfirmGiftView extends Vue {
* Loads and processes claim from URL parameters * Loads and processes claim from URL parameters
*/ */
private async loadClaimFromUrl() { private async loadClaimFromUrl() {
const pathParam = window.location.pathname.substring("/confirm-gift/".length); const pathParam = window.location.pathname.substring(
"/confirm-gift/".length,
);
if (!pathParam) { if (!pathParam) {
throw new Error("No claim ID was provided."); throw new Error("No claim ID was provided.");
} }
@ -563,7 +563,8 @@ export default class ConfirmGiftView extends Vue {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error", 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, 3000,
); );
@ -683,7 +684,10 @@ export default class ConfirmGiftView extends Vue {
if (this.giveDetails?.fullClaim.image) { if (this.giveDetails?.fullClaim.image) {
this.urlForNewGive += `&image=${encodeURIComponent(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)}`; this.urlForNewGive += `&offerId=${encodeURIComponent(this.giveDetails.fulfillsHandleId)}`;
} }
if (this.giveDetails?.fulfillsPlanHandleId) { 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 * Retrieves human-readable name for a DID
* Falls back to DID if no name available * Falls back to DID if no name available
@ -831,10 +824,7 @@ export default class ConfirmGiftView extends Vue {
* @param prefix - Optional prefix to add * @param prefix - Optional prefix to add
* @returns Formatted string * @returns Formatted string
*/ */
capitalizeAndInsertSpacesBeforeCapsWithAPrefix( capitalizeAndInsertSpacesBeforeCapsWithAPrefix(text: string): string {
text: string,
prefix?: string
): string {
const word = this.capitalizeAndInsertSpacesBeforeCaps(text); const word = this.capitalizeAndInsertSpacesBeforeCaps(text);
if (word) { if (word) {
// if the word starts with a vowel, use "an" instead of "a" // if the word starts with a vowel, use "an" instead of "a"

27
src/views/HomeView.vue

@ -429,7 +429,6 @@ import {
retrieveAccountDids, retrieveAccountDids,
GiverReceiverInputInfo, GiverReceiverInputInfo,
OnboardPage, OnboardPage,
registerSaveAndActivatePasskey,
} from "../libs/util"; } from "../libs/util";
import { GiveSummaryRecord } from "../interfaces"; import { GiveSummaryRecord } from "../interfaces";
interface GiveRecordWithContactInfo extends GiveSummaryRecord { interface GiveRecordWithContactInfo extends GiveSummaryRecord {
@ -552,7 +551,10 @@ export default class HomeView extends Vue {
this.allMyDids = [newDid]; this.allMyDids = [newDid];
} }
} catch (error) { } 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.isFeedFilteredByNearby = !!settings.filterFeedByNearby;
this.isRegistered = !!settings.isRegistered; this.isRegistered = !!settings.isRegistered;
this.lastAckedOfferToUserJwtId = settings.lastAckedOfferToUserJwtId; this.lastAckedOfferToUserJwtId = settings.lastAckedOfferToUserJwtId;
this.lastAckedOfferToUserProjectsJwtId = settings.lastAckedOfferToUserProjectsJwtId; this.lastAckedOfferToUserProjectsJwtId =
settings.lastAckedOfferToUserProjectsJwtId;
this.searchBoxes = settings.searchBoxes || []; this.searchBoxes = settings.searchBoxes || [];
this.showShortcutBvc = !!settings.showShortcutBvc; this.showShortcutBvc = !!settings.showShortcutBvc;
this.isAnyFeedFilterOn = checkIsAnyFeedFilterOn(settings); this.isAnyFeedFilterOn = checkIsAnyFeedFilterOn(settings);
@ -598,12 +601,16 @@ export default class HomeView extends Vue {
private async checkRegistrationStatus() { private async checkRegistrationStatus() {
if (!this.isRegistered && this.activeDid) { if (!this.isRegistered && this.activeDid) {
try { 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) { if (resp.status === 200) {
await updateAccountSettings(this.activeDid, { await updateAccountSettings(this.activeDid, {
apiServer: this.apiServer, apiServer: this.apiServer,
isRegistered: true, isRegistered: true,
...await retrieveSettingsForActiveAccount() ...(await retrieveSettingsForActiveAccount()),
}); });
this.isRegistered = true; this.isRegistered = true;
} }
@ -635,7 +642,7 @@ export default class HomeView extends Vue {
this.axios, this.axios,
this.apiServer, this.apiServer,
this.activeDid, this.activeDid,
this.lastAckedOfferToUserJwtId this.lastAckedOfferToUserJwtId,
); );
this.numNewOffersToUser = offersToUserData.data.length; this.numNewOffersToUser = offersToUserData.data.length;
this.newOffersToUserHitLimit = offersToUserData.hitLimit; this.newOffersToUserHitLimit = offersToUserData.hitLimit;
@ -644,7 +651,7 @@ export default class HomeView extends Vue {
this.axios, this.axios,
this.apiServer, this.apiServer,
this.activeDid, this.activeDid,
this.lastAckedOfferToUserProjectsJwtId this.lastAckedOfferToUserProjectsJwtId,
); );
this.numNewOffersToUserProjects = offersToUserProjects.data.length; this.numNewOffersToUserProjects = offersToUserProjects.data.length;
this.newOffersToUserProjectsHitLimit = offersToUserProjects.hitLimit; this.newOffersToUserProjectsHitLimit = offersToUserProjects.hitLimit;
@ -675,9 +682,11 @@ export default class HomeView extends Vue {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error", 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