Show current user in ContactGiftingView #155

Merged
jose merged 13 commits from contact-gifting-current-user into master 2025-08-26 09:00:10 +00:00
Owner
  • "You" is displayed conditionally, similar to GiftedDialog behavior
  • "Show All" is hidden in GiftedDialog when accessed from ContactGiftingView (redundant)
- "You" is displayed conditionally, similar to GiftedDialog behavior - "Show All" is hidden in GiftedDialog when accessed from ContactGiftingView (redundant)
jose added 1 commit 2025-07-31 13:40:54 +00:00
- "You" is displayed conditionally, similar to GiftedDialog behavior
- "Show All" is hidden in GiftedDialog when accessed from ContactGiftingView (redundant)
jose changed target branch from build-improvement to master 2025-08-11 10:40:25 +00:00
jose added 88 commits 2025-08-11 11:01:06 +00:00
Reviewed-on: #145
Reviewed-on: #148
Replace manual emits declarations with proper @Emit decorator usage across components:
- ActivityListItem: Add @Emit methods for viewImage, loadClaim, confirmClaim
- ContactInputForm: Convert handleQRScan to use @Emit("qr-scan")
- ContactBulkActions: Add @Emit methods for toggle-all-selection, copy-selected
- ContactListHeader: Add @Emit methods for all 5 emitted events
- MembersList: Add @Emit("error") method for error handling
- LargeIdenticonModal: Add @Emit("close") method
- ContactListItem: Add @Emit methods for all 4 emitted events

Update all templates to call emit methods instead of direct $emit calls.
Fix TypeScript type issues with optional parameters.
Resolves Vue warning about undeclared emitted events.

Follows vue-facing-decorator best practices and improves code consistency.
- Add _convertSettingsForStorage helper method to handle Settings → SettingsWithJsonStrings conversion
- Fix $saveSettings and $saveUserSettings to properly convert searchBoxes arrays to JSON strings before database storage
- Update SearchAreaView.vue to use array format instead of manual JSON.stringify conversion
- Add comprehensive test UI in PlatformServiceMixinTest.vue with visual feedback and clear demonstration of conversion process
- Document migration strategy for consolidating $updateSettings into $saveSettings to reduce code duplication
- Add deprecation notices to $updateSettings method with clear migration guidance

The fix ensures that searchBoxes arrays are properly converted to JSON strings before database storage, preventing data corruption and maintaining consistency with the SettingsWithJsonStrings type definition. The enhanced test interface provides clear visualization of the conversion process and database storage format.

Migration Strategy:
- $saveSettings:  KEEP (will be primary method after consolidation)
- $updateSettings: ⚠️ DEPRECATED (will be removed in favor of $saveSettings)
- Future: Consolidate to single $saveSettings(changes, did?) method

Files changed:
- src/utils/PlatformServiceMixin.ts: Add conversion helper, fix save methods, add deprecation notices
- src/views/SearchAreaView.vue: Remove manual JSON conversion
- src/test/PlatformServiceMixinTest.vue: Add comprehensive test UI with highlighting
- docs/migration-templates/updateSettings-consolidation-plan.md: Document future consolidation strategy
- Remove src/types/global.d.ts and src/types/modules.d.ts (unused duplicates)
- Keep essential type files: sql.js.d.ts and absurd-sql.d.ts
- Maintain all existing type definitions and functionality

The removed files contained broken import paths and duplicate type declarations
that were never actually used by the codebase. All necessary type support for
@jlongster/sql.js and absurd-sql modules is preserved in the remaining files.

Files removed:
- src/types/global.d.ts (unused, had broken imports)
- src/types/modules.d.ts (unused, had broken imports)

Files kept:
- src/types/sql.js.d.ts (comprehensive @jlongster/sql.js types)
- src/types/absurd-sql.d.ts (comprehensive absurd-sql types)
- src/interfaces/database.ts (core database types)
I believe logger is not an option. https://playwright.dev/docs/api/class-testoptions
- Add description, amountInput, and unitCode parameters to GiftedDialog.open()
- Pass offer details to GiftedDialog in ProjectViewView
- Update ContactsView to handle new GiftedDialog parameters
- Replace @Emit decorator with direct $emit calls in ContactListItem
- Fix DID comparison from loose to strict equality in nameForDid function
- Resolve issue where giver/recipient names showed as "this unnamed user"

The @Emit decorator was not properly spreading array parameters, causing
the parent component to receive arrays instead of separate string parameters.
Add detailed analysis of GiftedDialog component architecture including:
- DRY and SOLID principles compliance assessment
- Cognitive load analysis with before/after comparisons
- Architectural complexity remediation plan
- Phased implementation strategy (cognitive load → composable architecture)
- Component hierarchy and dependency analysis
- Performance and security considerations

The document provides actionable recommendations for reducing complexity
while maintaining functionality, with specific code examples and metrics.
- Preserve description, amount, and unit code when navigating between gifting steps
- Add form field props to EntitySelectionStep and GiftedDialog components
- Update ContactGiftingView to handle form state persistence in URL parameters
- Add offer context support to gifting flow
- Add offerId prop to EntitySelectionStep for offer fulfillment context
- Pass offerId through GiftedDialog to EntitySelectionStep
- Update ContactGiftingView to handle offerId from route query parameters
- Extract offer details (description, amount, unitCode) for pre-population
- Add type checking to build scripts for production/test builds only
- Fix TypeScript errors in migration service, router, and platform services
- Add electronAPI type declarations for Electron platform
- Remove type checking from development builds for faster hot reload
- Update tsconfig.node.json to resolve configuration conflicts
- Ensure type safety for production while maintaining fast development workflow
- Add recipientEntityTypeOverride prop to GiftedDialog component
- Add data-testid and data-recipient-entity-type-override attributes for testing
- Update updateEntityTypes() to respect recipientEntityTypeOverride when set
- Add watcher for recipientEntityTypeOverride prop changes
- Update ClaimView to pass recipient entity type override based on project context
- Improve recipient determination logic in ClaimView for person vs project recipients
- Change HomeView to use $accountSettings() method which returns correct isRegistered value
- Remove isRegistered: false default that was overriding database values
- Fix settings override issue where empty defaults were overriding activeDid
- Remove excessive settings tracing logs to clean up console output
- Ensure consistent registration status between HomeView and AccountViewView

The HomeView was incorrectly showing users as unregistered while AccountViewView showed them as registered due to using $settings() (returns null) instead of $accountSettings() (returns correct database value).
Replace complex updateEntityTypes() method with explicit giverEntityType and
recipientEntityType props. This makes the component more declarative and
maintainable by removing hidden logic and making entity type relationships
clear at the call site.

- Remove updateEntityTypes() method and related watchers
- Add explicit giverEntityType and recipientEntityType props with defaults
- Update all views to use inline logic for entity type determination
- Fix entity type preservation in navigation flows
- Enhance query parameter passing for better context preservation
- Fix recipient reset issue in ContactGiftingView
- Resolve entity type mismatch in HomeView project button flow

Files changed:
- GiftedDialog.vue: Remove complex logic, add explicit props
- EntitySelectionStep.vue: Enhanced query parameter handling
- ContactGiftingView.vue: Improved context preservation
- HomeView.vue, ProjectViewView.vue, ClaimView.vue, ContactsView.vue:
  Updated to use explicit entity type props
- Add refactoring documentation
- Remove hard-coded PROD_SHARE_DOMAIN from src/constants/app.ts
- Update all sharing functionality to use environment-specific APP_SERVER
- Rewrite domain configuration documentation to reflect unified approach
- Simplify domain management with single APP_SERVER constant
- Update README.md examples to use APP_SERVER for all URL generation

This change eliminates the complexity of separate constants for different
URL types and provides consistent environment-specific configuration for
all functionality including sharing.
- Add ContactMaybeWithJsonStrings type usage for internal database operations
- Implement $normalizeContacts() method to handle both JSON string and array formats
- Update $contacts(), $getContact(), and $getAllContacts() to use normalization
- Fix $updateContact() to properly convert contactMethods arrays to JSON strings
- Add validation to filter out malformed contact method objects
- Update ContactEditView to handle malformed data gracefully

Resolves issue where contactMethods could be stored as JSON strings in database
but expected as arrays in components, causing "Cannot create property 'label' on number '0'" errors.
- Move Android-specific API server logic from common.sh to build-android.sh
- Remove unnecessary ANDROID_BUILD environment variable
- Set localhost:3000 as default in common.sh for all Capacitor builds
- Override to 10.0.2.2:3000 specifically in build-android.sh for Android development
- Fix execution order issue where common.sh ran before ANDROID_BUILD was set
- Maintain proper separation: Android emulator uses 10.0.2.2, iOS simulator uses localhost
Update Android SDK configuration to target API 36 (Android 16):
- Update compileSdkVersion and targetSdkVersion from 35 to 36
- Update suppressUnsupportedCompileSdk from 34 to 36
- Maintains minSdkVersion at 22 for broad device compatibility
- Verified build system compatibility with Gradle 8.13
Implement --api-ip parameter for Android builds with smart defaults:
- Defaults to 10.0.2.2 for emulator development when no IP specified
- Supports custom IP for physical device development
- Added npm scripts for common use cases (dev:custom, test:custom)
- Updated help documentation with usage examples
- Created comprehensive documentation with troubleshooting guide

Usage:
  ./scripts/build-android.sh --dev                    # Default 10.0.2.2
  ./scripts/build-android.sh --dev --api-ip 192.168.1.100  # Custom IP
Extend custom API IP feature to iOS platform with platform-appropriate defaults:
- Android: Defaults to 10.0.2.2 for emulator, custom IP for physical devices
- iOS: Uses localhost for simulator, custom IP for physical devices
- Added npm scripts for iOS custom IP builds (dev:custom, test:custom)
- Updated documentation to cover both platforms with examples
- Consistent --api-ip parameter across Android and iOS build scripts

Usage:
  ./scripts/build-ios.sh --dev                    # Default localhost
  ./scripts/build-ios.sh --dev --api-ip 192.168.1.100  # Custom IP
Add comprehensive documentation explaining the order of precedence for
environment variables in TimeSafari project. Covers shell script overrides,
platform-specific configurations, .env file usage, and API alignment between
claim and partner APIs. Includes troubleshooting guide and best practices
for maintaining consistent environment configuration across development,
test, and production environments.
Update measure_time function to properly handle command exit codes:
- Check command success/failure and return appropriate exit code
- Log failure messages with timing and exit code information
- Ensure TypeScript type checking failures stop the build process
- Maintains timing logs for both success and failure cases

This prevents deployment of code with TypeScript type errors by making
test and production builds fail fast when tsc --noEmit reports issues.
Replace notify.confirm() with $notify() in ProjectsView to support complex modal
with custom Yes/No buttons and routing callbacks for non-registered users.
- Fix navigation to use correct QR code routes (contact-qr/contact-qr-scan-full)
- Replace deep link generation with CSV format QR codes
- Remove unused imports and fix notification method calls
- Aligns with master branch behavior for contact sharing

Resolves issue where Share Your Info showed "not implemented" and generated
localhost deep links instead of proper CSV format QR codes.
- Fixed contactsToExportJson to properly handle contactMethods as arrays
- Fixed contactToCsvLine to correctly stringify contactMethods arrays
- Removed unused parseJsonField function (consolidated with PlatformServiceMixin)
- Resolves issue where contact backup exports showed contactMethods as strings instead of JSON arrays
- Fixed contactsToExportJson to export contactMethods as proper arrays instead of stringified JSON
- Added JSON parsing for contactMethods in _mapColumnsToValues when retrieving from database
- Updated $insertContact to properly handle contactMethods field storage
- Removed unused ContactWithJsonStrings import
ref:  https://app.clickup.com/t/86b63ffpb
Resolves issue where contact backup exports showed contactMethods as "[]" strings instead of proper JSON arrays.
Remove unnecessary contact object mapping in contactsToExportJson function.
The contacts array can be used directly since it already contains all required
fields in the correct format.
- Replace CSV QR value copying with URL generation for better UX
- Add generateEndorserJwtUrlForAccount import and Account type
- Implement proper error handling for URL generation failures
- Maintain consistency with ContactQRScanFullView behavior
- Add documentation for the URL solution implementation

Recipients can now click shared URLs to add contacts directly instead of
manually pasting CSV data into input fields.

addresses:  https://app.clickup.com/t/86b63xhz4
- Add Quick Start for Developers section with most common commands
- Add clean:all command to package.json for cleaning all platforms
- Update BUILDING.md with accurate command descriptions and workflow
- Reorganize sections to prioritize npm commands at the top
- Add comprehensive environment configuration documentation
- Update appendices A and B with current build system information
- Fix port number in development server documentation (8080)
- Add troubleshooting quick fixes and platform-specific guidance
- Document environment variable precedence and loading process
- Add comprehensive Vite configuration documentation in Appendix B
- Replaced error messages in GiftedDetailsView
- Maintained consistency between GiftedDialog and GiftedDetailsView (error message constants, amountInput)
- Add conditional checks for person vs project entity types when setting DID fields
- Simplify project ID assignment logic by removing redundant entity type checks
- Preserve existing recipient context when selecting givers in ContactGiftingView, especially when dealing with "Unnamed" entity
- ContactQRScanShowView: Move notify initialization to created() lifecycle hook
- DIDView: Remove axios getter accessing non-existent platformService.axios
- DIDView: Enhance setVisibility() with proper server API error handling
- Add missing logger import to fix 'Cannot find name logger' error
- Migrate from  to createNotifyHelpers pattern with proper NotificationIface type
- Remove unnecessary SQL query from created() method for cleaner initialization
- Add educational documentation to all methods explaining workflows, API endpoints, and user experience
- Update all notify calls to use new format (error, success, confirm methods)
- Improve code maintainability with detailed method documentation
- Remove unused handleConfirmClick() and emitConfirmClaim() methods from ActivityListItem
- Remove unused canConfirm computed property and confirmerIdList prop
- Remove unused imports: isGiveClaimType, notifyWhyCannotConfirm, containsHiddenDid
- Remove unused confirmClaim() method from HomeView
- Remove unused @confirm-claim event binding and :confirmer-id-list prop
- Remove unused imports: serverUtil, NOTIFY_CONFIRMATION_ERROR

The confirmation functionality was not being used in ActivityListItem as there was no UI to trigger it. Confirmation is handled in other components like ClaimView and ConfirmGiftView.
- Remove unused loadSettings() method (functionality moved to initializeIdentity)
- Remove unused checkRegistrationStatus() method (functionality moved to initializeIdentity)
- Deduplicate ensureCorrectApiServer() calls (now only called once in initializeIdentity)
- Clean up import statement formatting for NOTIFY_CONTACT_LOADING_ISSUE

Reduces code complexity by eliminating 66 lines of dead code while maintaining
all existing functionality. Improves maintainability by consolidating initialization
logic into a single method.
- Remove debug logging and window.__SHARE_CONTACT_DEBUG__ property
- Clean up eslint-disable comments and console.log statements
- Simplify mounted() method to focus on core functionality
- Transferred form validation error handling to an earlier step
- Added validation for negative input (similar to gifting forms)
- Switched amount input to component version for consistency
- Fixed improper referencing for PlatformServiceMixin
- Fixed case where exported data has no contact methods

authored-by: Matthew Raymer <matthew.raymer@anomalistdesign.com>
jose added 1 commit 2025-08-11 11:05:45 +00:00
jose added 1 commit 2025-08-11 11:13:38 +00:00
jose changed title from Show current user in ContactGiftingView to WIP: Show current user in ContactGiftingView 2025-08-11 11:50:47 +00:00
jose added 1 commit 2025-08-12 10:33:50 +00:00
- Split openDialog into separate methods to improve code readability and maintainability through method extraction
- Add receiver name fallback in GiftedDialog when receiver exists but has no name
- Enhance shouldShowYouEntity to prevent selecting "You" as both giver and recipient
- Improve labeling of "(No name)" entities while retaining original entity object properties
- Apply special styling to "Unnamed" and "(No Name)" entities
jose added 1 commit 2025-08-12 10:35:09 +00:00
jose changed title from WIP: Show current user in ContactGiftingView to Show current user in ContactGiftingView 2025-08-12 10:42:27 +00:00
trentlarson reviewed 2025-08-14 14:45:38 +00:00
@@ -261,0 +233,4 @@
* Creates an entity object from the contact parameter
*/
private createEntityFromContact(
contact?: GiverReceiverInputInfo | "Unnamed" | "You",
Owner

Let's change this logic a little bit, because there are redundant potential states:

  • The "contact" could be null/undefined. That is the case where "Unnamed" would be used, so we don't need a separate "Unnamed" value. (If we have both potential cases then we have to include similar logic to work with both cases, which makes it more complex.)

  • The contact could be the current user's activeDid, so that's what we should use in the openDialog instead of the word "You". (We should be checking here for the activeDid... and if we also have to check "You" then there is duplicate logic again... again adding to the complexity and difficulty of maintenance.)

Let's change this logic a little bit, because there are redundant potential states: * The "contact" could be null/undefined. That is the case where "Unnamed" would be used, so we don't need a separate "Unnamed" value. (If we have both potential cases then we have to include similar logic to work with both cases, which makes it more complex.) * The contact could be the current user's activeDid, so that's what we should use in the openDialog instead of the word "You". (We should be checking here for the activeDid... and if we also have to check "You" then there is duplicate logic again... again adding to the complexity and difficulty of maintenance.)
trentlarson marked this conversation as resolved
jose added 1 commit 2025-08-15 02:27:38 +00:00
jose added 1 commit 2025-08-15 05:21:51 +00:00
Replace string-based entity type matching with DID-based logic for "You" and "Unnamed" entities. Treat these as regular person entities instead of special types.

- Remove "special" type from EntitySelectionEvent interface
- Update EntityGrid to emit "You" and "Unnamed" as person entities
- Simplify SpecialEntityCard emit structure (remove entityType parameter)
- Refactor GiftedDialog to process all person entities with DID-based logic
- Update ContactGiftingView and HomeView to use DID-based entity creation
- Remove string literals "You" and "Unnamed" from method signatures
Author
Owner

I refactored the entity creation method by eliminating the use of string-type entities, and instead determining those through the logic you mentioned. No more "Unnamed" or "You" special cases, just deduction via DID.

I also looked at related views and components to find similar patterns and refactored those, as well.

I refactored the entity creation method by eliminating the use of string-type entities, and instead determining those through the logic you mentioned. No more "Unnamed" or "You" special cases, just deduction via DID. I also looked at related views and components to find similar patterns and refactored those, as well.
trentlarson reviewed 2025-08-17 15:42:09 +00:00
@@ -161,1 +161,4 @@
/** Whether to hide the "Show All" navigation */
@Prop({ default: false })
hideShowAll!: boolean;
Owner

I see this is only ever set as false. If there are not any cases where it should be true then we can remove this and just set it to the 'false' behavior.

I see this is only ever set as false. If there are not any cases where it should be true then we can remove this and just set it to the 'false' behavior.
Author
Owner

hideShowAll is set to true via HTML attribute hide-show-all when accessing GiftedDialog from ContactGiftingView. This is used to tell GiftedDialog to hide the "Show All" link in that particular context, since "Show All" links to ContactGiftingView just the same.

`hideShowAll` is set to true via HTML attribute `hide-show-all` when accessing `GiftedDialog` from `ContactGiftingView`. This is used to tell GiftedDialog to **hide** the "Show All" link in that particular context, since "Show All" links to ContactGiftingView just the same.
Owner

Ah! I see. Thanks.

Ah! I see. Thanks.
trentlarson marked this conversation as resolved
Owner

Other than that one outstanding conversation for hideShowAll this looks good!

Other than that one outstanding conversation for `hideShowAll` this looks good!
jose added 1 commit 2025-08-18 08:42:16 +00:00
- Projects use handleID, not DID
jose added 1 commit 2025-08-18 12:33:20 +00:00
- "Unnamed/Unknown" simplified into just "Unnamed"
- Phrase variations have their own constants
Owner

This looks great!

One last thing (which I put in ClickUp, too): this reveals some inconsistencies in terms. Let's consolidate:

  • We don't need "member", so remove the UNNAMED_MEMBER and replace usages with SOMEONE_UNNAMED.

  • Change "unnamed user" to "unnamed person". (We only use the words "person" for anyone, and "contact" for people in the contact list... so you could say "unnamed contact" in some places, but that's totally up to you. Simple is fine!)

This looks great! One last thing (which I put in ClickUp, too): this reveals some inconsistencies in terms. Let's consolidate: * We don't need "member", so remove the UNNAMED_MEMBER and replace usages with SOMEONE_UNNAMED. * Change "unnamed user" to "unnamed person". (We only use the words "person" for anyone, and "contact" for people in the contact list... so you could say "unnamed contact" in some places, but that's totally up to you. Simple is fine!)
jose added 1 commit 2025-08-26 08:31:56 +00:00
- Replaced all instances of "Unnamed Member" with "Someone Unnamed"
- Removed unused UNNAMED_MEMBER constant
- Renamed UNNAMED_PERSON to THAT_UNNAMED_PERSON to match its value
- Renamed UNNAMED_USER to UNNAMED_PERSON and changed the value to "unnamed person"
jose added 2 commits 2025-08-26 08:56:54 +00:00
jose merged commit 2c6b787fa2 into master 2025-08-26 09:00:10 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: trent_larson/crowd-funder-for-time-pwa#155