Skip to content

[LWD] feat(tracking): add tracking contact send flow lwd - #21465

Draft
dilaouid wants to merge 1 commit into
developfrom
chore/analytics-contact-send-lwd
Draft

[LWD] feat(tracking): add tracking contact send flow lwd#21465
dilaouid wants to merge 1 commit into
developfrom
chore/analytics-contact-send-lwd

Conversation

@dilaouid

@dilaouid dilaouid commented Sep 2, 2026

Copy link
Copy Markdown
Member

📝 Description

This PR adds contacts-related analytics to the Send flow for LWD. It introduces SendFlowTrackingContext and shared helpers to track recipient resolution, input method, contact actions, and related properties across recipient, amount, confirmation, and add-contact steps

🔗 Context

Copilot AI lite review requested due to automatic review settings September 2, 2026 17:01
@live-github-bot live-github-bot Bot added the desktop Has changes in LLD label Sep 2, 2026
@live-github-bot live-github-bot Bot changed the title feat(tracking): add tracking contact send flow lwd [LWD] feat(tracking): add tracking contact send flow lwd Sep 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Recipient resolution misclassifies ENS→contact-address matches due to comparing the contact address against the raw ENS query string.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds contacts-related analytics to the Ledger Wallet Desktop (LWD) Send MVVM flow by introducing a flow-scoped tracking context and recipient/contact resolution helpers, then wiring new track / trackPage events across recipient selection, contact add flows, amount, and confirmation.

Changes:

  • Added SendFlowTrackingContext to persist recipient input method + recipient resolution metadata across the whole Send flow.
  • Introduced contactTracking utilities (getRecipientResolution, getSendFlowTrackingPage) and integrated them into recipient/contact steps for consistent analytics properties.
  • Updated recipient/contact UI + view models to capture additional analytics (contact selection, address rank, unsupported network tooltip) and added/updated unit tests.
File summaries
File Description
apps/ledger-live-desktop/src/mvvm/features/Send/utils/contactTracking.ts New helper for tracking page names and recipient resolution classification.
apps/ledger-live-desktop/src/mvvm/features/Send/utils/tests/contactTracking.test.ts Unit tests for recipient resolution + page name normalization.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/hooks/useRecipientScreenViewModel.ts Adds contacts-derived tracking properties and moves initial trackPage to an effect.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/hooks/useRecipientAddressModalViewModel.ts Adds recipient-result tracking, contact/address selection tracking, and recipient-resolution propagation into context.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/hooks/useAddressMatchedSectionViewModel.ts Extends VM to accept onUnsupportedNetwork handler for recipient card tooltip interactions.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/hooks/tests/useRecipientScreenViewModel.test.ts Updates mocks/assertions for new contacts tracking props.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/hooks/tests/useRecipientAddressModalViewModel.test.ts Adds assertions for “recipient result” tracking and updated contact-address selection signature.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/components/RecipientContactAddressSelection.tsx Passes full address object + rank to selection handler for richer analytics.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/components/RecipientCard.tsx Adds unsupported-network pointer interaction hook for analytics when add-contact is disabled.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/components/RecipientAddressModalView.tsx Updates prop types for contact-address selection (address + rank).
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/components/AddressMatchedSection.tsx Wires onUnsupportedNetwork into RecipientCard.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/components/tests/RecipientContactAddressSelection.test.tsx Updates expectations for new (address, rank) selection callback.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Recipient/components/tests/AddressMatchedSection.test.tsx Updates test container to provide onUnsupportedNetwork.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Confirmation/hooks/useConfirmationViewModel.ts Adds recipientType + savedContactDuringFlow to confirmation tracking and tracks close click.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Confirmation/hooks/tests/useConfirmationViewModel.test.tsx Updates mocks/assertions for new confirmation tracking properties.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/Amount/hooks/useAmountScreen.ts Adds recipientType to amount-step tracking properties.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/AddToExistingContact/hooks/useAddToExistingContactViewModel.ts Tracks page view + contact selection in “select existing contact” step.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/AddToExistingContact/hooks/tests/useAddToExistingContactViewModel.test.tsx Updates mocks/wrapping and adds required contacts-feature mock.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/AddNewContact/hooks/useAddNewContactViewModel.ts Reworks add-contact VM to use flow-contacts add-contact VM and adds tracking for open/confirm/error/success.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/AddNewContact/hooks/tests/useAddNewContactViewModel.test.tsx Updates test to new add-contact VM API and wiring.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/AddContact/hooks/useAddContactViewModel.ts Tracks page view and button clicks in add-contact options step.
apps/ledger-live-desktop/src/mvvm/features/Send/screens/AddContact/hooks/tests/useAddContactViewModel.test.ts Adds SendFlowContext mock required by new tracking properties usage.
apps/ledger-live-desktop/src/mvvm/features/Send/index.tsx Wraps Send flow UI in SendFlowTrackingProvider.
apps/ledger-live-desktop/src/mvvm/features/Send/hooks/useSendPrefillAddAddressFlow.ts Adds tracking for name/review/signing steps of prefilled add-address flow + persists “saved during flow” flag.
apps/ledger-live-desktop/src/mvvm/features/Send/hooks/useSendHeaderModel.ts Adds close/paste/QR tracking and uses tracking context for recipient input method + close metadata.
apps/ledger-live-desktop/src/mvvm/features/Send/hooks/tests/useSendHeaderModel.test.tsx Updates mocks for new tracking context usage and reformats test inputs.
apps/ledger-live-desktop/src/mvvm/features/Send/context/SendFlowTrackingContext.tsx New context/provider to persist send-flow tracking metadata.
apps/ledger-live-desktop/src/mvvm/features/Send/context/tests/SendFlowTrackingContext.test.tsx Unit test validating send-flow tracking context state updates.
apps/ledger-live-desktop/src/mvvm/features/Send/components/SendHeader.tsx Routes dialog close + paste events through the header model (enabling tracking).
apps/ledger-live-desktop/src/mvvm/features/Send/components/SendFlowLayout.tsx Adds recipientType + normalized page naming to dialog-close tracking.
apps/ledger-live-desktop/src/mvvm/features/Send/components/tests/SendHeader.test.tsx Updates header-model mock shape to include close/paste handlers.
.changeset/violet-flowers-try.md Declares a minor changeset for the desktop package for this tracking feature.
Review details
  • Files reviewed: 32/32 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dilaouid
dilaouid force-pushed the chore/analytics-contact-send-lwd branch from ba928dd to 2025770 Compare September 2, 2026 21:28
Copilot AI review requested due to automatic review settings September 2, 2026 21:28
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Web Tools Build Status

Build Status Deployment
Web Tools Build ⏭️ Skipped

@dilaouid
dilaouid force-pushed the chore/analytics-contact-send-lwd branch 2 times, most recently from 3fb6266 to 063f8b5 Compare September 2, 2026 21:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Close analytics can be mis-attributed during the “select contact address” subview when closing via ESC/click-outside, which undermines the PR’s tracking accuracy goals.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 32/32 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines 39 to 47
const handleDialogOpenChange = useCallback(
(open: boolean) => {
if (!open) {
track("button_clicked", {
button: "close",
page: `step ${wizard.currentStep}`,
page: getSendFlowTrackingPage(wizard.currentStep),
recipientType,
...sendFlowTrackingProperties,
});
Copilot AI review requested due to automatic review settings September 2, 2026 21:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There is at least one confirmed functional regression risk in the Recipient contact-selection path (memo handling bypass) and an analytics-page inconsistency for close events during nested contact-address selection.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

apps/ledger-live-desktop/src/mvvm/features/Send/components/SendFlowLayout.tsx:46

  • The close tracking here uses getSendFlowTrackingPage(wizard.currentStep) without the isSelectingContactAddress flag. As a result, closing the modal via overlay/escape while in the nested “select contact address” UI will be tracked as “step recipient”, while other close paths (e.g. the header close) can correctly report “select contact address”, leading to inconsistent analytics for the same UI state.
        track("button_clicked", {
          button: "close",
          page: getSendFlowTrackingPage(wizard.currentStep),
          recipientType,
          ...sendFlowTrackingProperties,
  • Files reviewed: 32/32 changed files
  • Comments generated: 1
  • Review effort level: Lite

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 7 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
desktop-main 2.5 MB - 0 -
desktop-preloader 7.1 KB - 0 -
desktop-renderer 82.4 MB - +8.3 KB (0.0%) -
desktop-webviewDappPreloader 36.9 KB - ❓ 0 -
desktop-webviewPreloader 200.0 B - 0 -
desktop-workers 36.8 KB - 0 -
mobile 129.5 MB - 0 -
📋 Detailed Reports (Click to expand)

📁 desktop-renderer

Path: rsdoctor/desktop-renderer/rsdoctor-data.json

📌 Baseline Commit: d80a0e0f653302623aa09406ab8ff0358546386b | PR: #21398

Metric Current Baseline Change
📊 Total Size 82.4 MB 82.4 MB +8.3 KB (0.0%)
🗜️ Gzip Size - - -
📄 JavaScript 30.6 MB 30.6 MB +8.3 KB (0.0%)
🎨 CSS 188.4 KB 188.4 KB 0
🌐 HTML 1.8 KB 1.8 KB 0
📁 Other Assets 51.7 MB 51.7 MB 0

📦 Download Diff Report: desktop-renderer Bundle Diff

Generated by Rsdoctor GitHub Action

Copilot AI review requested due to automatic review settings September 2, 2026 21:47
@dilaouid
dilaouid force-pushed the chore/analytics-contact-send-lwd branch from 063f8b5 to cb2caec Compare September 2, 2026 21:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are scoped to analytics enrichment, avoid leaking raw recipient input, and include targeted unit-test updates for the new helpers and tracking behavior.

Review details
  • Files reviewed: 32/32 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Has changes in LLD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants