From c708716675a1233d3cef29d9577f664e9130248c Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Mon, 24 Feb 2025 11:21:08 +0000 Subject: [PATCH] refactor: migrate interfaces to dedicated directory Reorganizes TypeScript interfaces into a modular structure: - Create dedicated interfaces directory with specialized files - Split interfaces by domain (claims, common, limits, records, user) - Update imports in endorserServer.ts to use new interface locations - Replace 'any' types with 'unknown' for better type safety - Add proper type imports and exports This improves code organization and maintainability by: - Centralizing interface definitions - Reducing file size of endorserServer.ts - Making interface relationships more explicit - Improving type safety with stricter types --- src/App.vue | 16 +- src/components/GiftedDialog.vue | 6 +- src/components/GiftedPrompts.vue | 8 +- src/components/HiddenDidDialog.vue | 4 +- src/components/ImageMethodDialog.vue | 8 +- src/components/ImageViewer.vue | 4 +- src/components/MembersList.vue | 20 +- src/components/OfferDialog.vue | 4 +- src/components/OnboardingDialog.vue | 18 +- src/components/PhotoDialog.vue | 10 +- src/components/PushNotificationPermission.vue | 6 +- src/components/QuickNav.vue | 10 +- src/interfaces/claims-result.ts | 47 +++ src/interfaces/claims.ts | 63 ++++ src/interfaces/common.ts | 41 +++ src/interfaces/index.ts | 6 + src/interfaces/limits.ts | 14 + src/interfaces/records.ts | 90 ++++++ src/interfaces/user.ts | 8 + src/libs/endorserServer.ts | 278 +----------------- src/main.capacitor.ts | 40 +-- src/views/AccountViewView.vue | 36 +-- src/views/ClaimAddRawView.vue | 2 +- src/views/ClaimView.vue | 42 +-- src/views/ConfirmContactView.vue | 2 +- src/views/ConfirmGiftView.vue | 42 +-- src/views/ContactAmountsView.vue | 14 +- src/views/ContactEditView.vue | 8 +- src/views/ContactGiftingView.vue | 6 +- src/views/ContactImportView.vue | 4 +- src/views/ContactQRScanShowView.vue | 2 +- src/views/ContactScanView.vue | 2 +- src/views/ContactsView.vue | 22 +- src/views/DIDView.vue | 24 +- src/views/DiscoverView.vue | 12 +- src/views/GiftedDetailsView.vue | 30 +- src/views/HelpNotificationTypesView.vue | 2 +- src/views/HelpNotificationsView.vue | 8 +- src/views/HelpOnboardingView.vue | 20 +- src/views/HelpView.vue | 28 +- src/views/HomeView.vue | 31 +- src/views/IdentitySwitcherView.vue | 12 +- src/views/ImportAccountView.vue | 2 +- src/views/ImportDerivedAccountView.vue | 10 +- src/views/InviteOneAcceptView.vue | 2 +- src/views/InviteOneView.vue | 8 +- src/views/NewActivityView.vue | 10 +- src/views/NewEditAccountView.vue | 2 +- src/views/NewEditProjectView.vue | 28 +- src/views/NewIdentifierView.vue | 10 +- src/views/OfferDetailsView.vue | 12 +- src/views/OnboardMeetingListView.vue | 4 +- src/views/OnboardMeetingMembersView.vue | 2 +- src/views/OnboardMeetingSetupView.vue | 8 +- src/views/ProjectViewView.vue | 66 ++--- src/views/ProjectsView.vue | 24 +- src/views/QuickActionBvcBeginView.vue | 2 +- src/views/QuickActionBvcEndView.vue | 8 +- src/views/QuickActionBvcView.vue | 2 +- src/views/RecentOffersToUserProjectsView.vue | 8 +- src/views/RecentOffersToUserView.vue | 6 +- src/views/SearchAreaView.vue | 10 +- src/views/SeedBackupView.vue | 6 +- src/views/ShareMyContactInfoView.vue | 4 +- src/views/SharedPhotoView.vue | 8 +- src/views/StartView.vue | 6 +- src/views/StatisticsView.vue | 2 +- src/views/TestView.vue | 2 +- src/views/UserProfileView.vue | 6 +- 69 files changed, 663 insertions(+), 645 deletions(-) create mode 100644 src/interfaces/claims-result.ts create mode 100644 src/interfaces/claims.ts create mode 100644 src/interfaces/common.ts create mode 100644 src/interfaces/index.ts create mode 100644 src/interfaces/limits.ts create mode 100644 src/interfaces/records.ts create mode 100644 src/interfaces/user.ts diff --git a/src/App.vue b/src/App.vue index 00ce8c2..901477f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -40,7 +40,7 @@
- +
@@ -51,7 +51,7 @@ @click="close(notification.id)" class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-slate-200 text-slate-600" > - +
@@ -63,7 +63,7 @@
- +
@@ -74,7 +74,7 @@ @click="close(notification.id)" class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-emerald-200 text-emerald-600" > - +
@@ -86,7 +86,7 @@
- +
@@ -97,7 +97,7 @@ @click="close(notification.id)" class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-amber-200 text-amber-600" > - +
@@ -109,7 +109,7 @@
- +
@@ -120,7 +120,7 @@ @click="close(notification.id)" class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-rose-200 text-rose-600" > - +
diff --git a/src/components/GiftedDialog.vue b/src/components/GiftedDialog.vue index 54bacaf..fedbb50 100644 --- a/src/components/GiftedDialog.vue +++ b/src/components/GiftedDialog.vue @@ -21,7 +21,7 @@ class="border border-r-0 border-slate-400 bg-slate-200 px-4 py-2" @click="amountInput === '0' ? null : decrement()" > - + - +
@@ -62,7 +62,7 @@

Sign & Send to publish to the world - - + @@ -16,7 +16,7 @@ class="rounded-l border border-slate-400 bg-slate-200 px-4 py-2 flex" @click="prevIdea()" > - +

@@ -45,7 +45,7 @@ class="text-center bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md mt-4" @click="nextIdeaPastContacts()" > - Skip Contacts + Skip Contacts @@ -57,7 +57,7 @@ class="rounded-r border border-slate-400 bg-slate-200 px-4 py-2 flex" @click="nextIdea()" > - +
@@ -53,7 +53,7 @@ target="_blank" class="text-blue-500" > - + diff --git a/src/components/ImageMethodDialog.vue b/src/components/ImageMethodDialog.vue index ad05ca8..35b5364 100644 --- a/src/components/ImageMethodDialog.vue +++ b/src/components/ImageMethodDialog.vue @@ -12,14 +12,14 @@ class="text-lg text-center px-2 py-0.5 leading-none absolute right-0 top-0 text-white" @click="close()" > - +
- - - +
diff --git a/src/components/ImageViewer.vue b/src/components/ImageViewer.vue index 6049ac0..635660c 100644 --- a/src/components/ImageViewer.vue +++ b/src/components/ImageViewer.vue @@ -8,7 +8,7 @@ class="text-white text-2xl p-2 rounded-full hover:bg-white/10" @click="close" > - + @@ -17,7 +17,7 @@ class="text-white text-xl p-2 rounded-full hover:bg-white/10" @click="handleShare" > - +
diff --git a/src/components/MembersList.vue b/src/components/MembersList.vue index ea169cd..c63cf2b 100644 --- a/src/components/MembersList.vue +++ b/src/components/MembersList.vue @@ -5,7 +5,7 @@ v-if="isLoading" class="mt-16 text-center text-4xl bg-slate-400 text-white w-14 py-2.5 rounded-full mx-auto" > - + @@ -33,13 +33,13 @@ - + / - + to add/remove them to/from the meeting. @@ -54,7 +54,7 @@ - + to add them to your contacts. @@ -67,7 +67,7 @@ class="w-8 h-8 flex items-center justify-center rounded-full bg-blue-100 text-blue-600 hover:bg-blue-200 hover:text-blue-800 transition-colors" title="Refresh members list" > - +
- +
@@ -117,7 +117,7 @@ member.member.admitted ? 'Remove member' : 'Admit member' " > - @@ -127,7 +127,7 @@ class="mr-2 mb-2 w-6 h-6 flex items-center justify-center rounded-full bg-slate-100 text-slate-500 hover:bg-slate-200 hover:text-slate-800 transition-colors" title="Admission info" > - +
@@ -142,7 +142,7 @@ class="w-8 h-8 flex items-center justify-center rounded-full bg-blue-100 text-blue-600 hover:bg-blue-200 hover:text-blue-800 transition-colors" title="Refresh members list" > - + diff --git a/src/components/OfferDialog.vue b/src/components/OfferDialog.vue index 54d5d5e..5f16ce3 100644 --- a/src/components/OfferDialog.vue +++ b/src/components/OfferDialog.vue @@ -21,7 +21,7 @@ @click="decrement()" v-if="amountInput !== '0'" > - + - +
diff --git a/src/components/OnboardingDialog.vue b/src/components/OnboardingDialog.vue index 1200a6f..c8a6f15 100644 --- a/src/components/OnboardingDialog.vue +++ b/src/components/OnboardingDialog.vue @@ -10,7 +10,7 @@ class="text-lg text-center leading-none absolute right-0 -top-1" @click="onClickClose(true)" > - +
@@ -21,7 +21,7 @@ click on the - + button to express your appreciation for... whatever -- maybe thanks for showing you all these fascinating stories of @@ -40,7 +40,7 @@

The - @@ -84,7 +84,7 @@ class="text-lg text-center leading-none absolute right-0 -top-1" @click="onClickClose(true)" > - + @@ -106,7 +106,7 @@

The - @@ -141,14 +141,14 @@ class="text-lg text-center leading-none absolute right-0 -top-1" @click="onClickClose(true)" > - +

Now you can take a turn: click on the - + button to throw out projects of your own... anything you'd like to see happen. If your first idea doesn't catch anyone, try, try again... and @@ -157,7 +157,7 @@

The - @@ -168,7 +168,7 @@ By the way, one good way to get to know your neighbors and their interests is to offer time directly to them. You can do this on the contacts screen - + which is a great way to get to know a neighbor's interests.

diff --git a/src/components/PhotoDialog.vue b/src/components/PhotoDialog.vue index eb519cf..cd18738 100644 --- a/src/components/PhotoDialog.vue +++ b/src/components/PhotoDialog.vue @@ -15,12 +15,12 @@ class="text-lg text-center px-2 py-0.5 leading-none absolute right-0 top-0 text-white" @click="close()" > - +
- @@ -93,7 +93,7 @@ @click="takeImage()" class="bg-blue-500 hover:bg-blue-700 text-white font-bold p-3 rounded-full text-2xl leading-none" > - +
- +
@@ -111,7 +111,7 @@ @click="switchCamera()" class="bg-blue-500 hover:bg-blue-700 text-white font-bold p-3 rounded-full text-2xl leading-none" > - +
diff --git a/src/components/PushNotificationPermission.vue b/src/components/PushNotificationPermission.vue index edb62e8..a49ca91 100644 --- a/src/components/PushNotificationPermission.vue +++ b/src/components/PushNotificationPermission.vue @@ -25,7 +25,7 @@

Waiting for system initialization, which may take up to 5 seconds... - +

@@ -69,8 +69,8 @@ class="rounded-r border border-slate-400 bg-slate-200 text-center text-blue-500 mt-2 px-2 py-2 w-20" @click="hourAm = !hourAm" > - AM - PM + AM + PM
diff --git a/src/components/QuickNav.vue b/src/components/QuickNav.vue index ade2161..8f813e2 100644 --- a/src/components/QuickNav.vue +++ b/src/components/QuickNav.vue @@ -13,7 +13,7 @@ >
- + feed
@@ -32,7 +32,7 @@ class="block text-center py-2 px-1" >
- + search
@@ -51,7 +51,7 @@ class="block text-center py-2 px-1" >
- + your work
@@ -70,7 +70,7 @@ class="block text-center py-2 px-1" >
- + contacts
@@ -89,7 +89,7 @@ class="block text-center py-2 px-1" >
- +
Reminder Notification -
New Activity Notification -
- Loading + Loading profile...
Public Profile - Usage Limits
- Checking… + Checking…
{{ limitsMessage }} @@ -454,7 +454,7 @@
  • On Android: Choose "Open" and then share - + to your prefered place.
  • @@ -494,7 +494,7 @@ " class="ml-2" > - + Copied
    @@ -510,7 +510,7 @@ " class="ml-2" > - + Copied
    @@ -530,7 +530,7 @@ " class="ml-2" > - + Copied
    @@ -631,7 +631,7 @@ class="w-full px-4 rounded bg-yellow-500 border border-slate-400" @click="onClickSaveApiServer()" > - + Raw Claim diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue index ca467f5..2a2ebe4 100644 --- a/src/views/ClaimView.vue +++ b/src/views/ClaimView.vue @@ -10,7 +10,7 @@ @click="$router.go(-1)" class="text-lg text-center px-2 py-1 absolute -left-2 -top-1" > - + Verifiable Claim Details @@ -36,7 +36,7 @@ title="Edit" data-testId="editClaimButton" > - +
    @@ -45,7 +45,7 @@ class="text-blue-500 mt-2" title="Printable Certificate" > - +
    @@ -56,24 +56,24 @@ copyToClipboard('A link to this page', window.location.href) " > - +
    - + {{ veriClaim.claim?.itemOffered?.description || veriClaim.claim?.description }}
    - + {{ didInfo(veriClaim.issuer) }}
    - + Recorded {{ veriClaim.issuedAt?.replace(/T/, " ").replace(/Z/, " UTC") }}
    @@ -177,13 +177,13 @@
    - + {{ issuerName }} posted that.
    @@ -125,7 +125,7 @@ giveDetails?.fulfillsType || "", ) }} - + @@ -133,7 +133,7 @@
    - + {{ issuerName }} posted that.
    @@ -185,7 +185,7 @@ ) " > - + @@ -228,7 +228,7 @@ ) " > - + @@ -260,8 +260,8 @@ @click="showVeriClaimDump = !showVeriClaimDump" > Details - - + +
    - + The {{ visibleDidPath }} is visible to:
    @@ -342,12 +342,12 @@ copyToClipboard('The DID of ' + visDid, visDid) " > - + , found at - + - + See All Generic Info
    @@ -385,7 +385,7 @@ class="text-blue-500 cursor-pointer" :href="urlForNewGive" > - + Record a Give Similar to the Original
    @@ -397,7 +397,7 @@ class="fixed left-6 bottom-24 text-center text-4xl leading-none bg-slate-400 text-white w-14 py-2.5 rounded-full" v-if="isLoading" > - +
    diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue index 00f3415..9ab8cc8 100644 --- a/src/views/ContactAmountsView.vue +++ b/src/views/ContactAmountsView.vue @@ -11,7 +11,7 @@
    @@ -59,10 +59,10 @@
    {{ displayAmount(record.unit, record.amount) }} - +
    @@ -72,10 +72,10 @@ - + - + @@ -83,14 +83,14 @@
    {{ displayAmount(record.unit, record.amount) }} - +
    diff --git a/src/views/ContactEditView.vue b/src/views/ContactEditView.vue index 53fb11a..e140c29 100644 --- a/src/views/ContactEditView.vue +++ b/src/views/ContactEditView.vue @@ -10,7 +10,7 @@ @click="$router.go(-1)" class="text-lg text-center px-2 py-1 absolute -left-2 -top-1" > - + {{ contact.name || AppString.NO_CONTACT_NAME }} @@ -69,7 +69,7 @@ @click="toggleDropdown(index)" class="px-2 py-1 bg-gray-200 rounded-md" > - +
    @@ -58,7 +58,7 @@ @click="openDialog(contact)" class="block w-full text-center text-sm uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md" > - + diff --git a/src/views/ContactImportView.vue b/src/views/ContactImportView.vue index 27cc28a..fa7a219 100644 --- a/src/views/ContactImportView.vue +++ b/src/views/ContactImportView.vue @@ -7,7 +7,7 @@ class="text-lg text-center px-2 py-1 absolute -left-2 -top-1" @click="$router.back()" > - +
    @@ -17,7 +17,7 @@
    - +
    - +
    diff --git a/src/views/ContactScanView.vue b/src/views/ContactScanView.vue index 7a8a87d..e4fd2cd 100644 --- a/src/views/ContactScanView.vue +++ b/src/views/ContactScanView.vue @@ -7,7 +7,7 @@ Scan Contact diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index 4df8c67..ccfe405 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -28,21 +28,21 @@ :to="{ name: 'invite-one' }" class="flex items-center bg-gradient-to-b from-green-400 to-green-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-1 mr-1 rounded-md" > - + - - - +