Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add wallet and account to appZi feedback for debugging #5472

Merged
merged 3 commits into from
Mar 4, 2025

Conversation

anxolin
Copy link
Contributor

@anxolin anxolin commented Mar 4, 2025

Summary

This PR adds the wallet address and the wallet name to appZi button.

Users ask for help on various issues, this additional context gives support important information to help the user.

image

To Test

  • Conect your wallet
  • Send feedback using the feedback button
  • Check your feedback in appzi. Make sure it has your account

Additional tests

  • Verify it still works if you are not connected
  • Use different wallets to see if the wallet name is recognise

Summary by CodeRabbit

  • New Features
    • Enhanced feedback and survey interactions by incorporating wallet identification for a more personalized experience.
  • Refactor
    • Updated survey triggers now utilize account information during order processing for improved contextual engagement.
  • Style
    • Refined visual transitions in the feedback interface for smoother and more consistent interactions.

Copy link

vercel bot commented Mar 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
cowfi ✅ Ready (Inspect) Visit Preview Mar 4, 2025 8:11pm
explorer-dev ✅ Ready (Inspect) Visit Preview Mar 4, 2025 8:11pm
swap-dev ✅ Ready (Inspect) Visit Preview Mar 4, 2025 8:11pm
3 Skipped Deployments
Name Status Preview Updated (UTC)
cosmos ⬜️ Ignored (Inspect) Visit Preview Mar 4, 2025 8:11pm
sdk-tools ⬜️ Ignored (Inspect) Visit Preview Mar 4, 2025 8:11pm
widget-configurator ⬜️ Ignored (Inspect) Visit Preview Mar 4, 2025 8:11pm

Copy link

coderabbitai bot commented Mar 4, 2025

Walkthrough

This change updates the feedback and survey functionalities by extending the data structures and function signatures. The AppziCustomSettings type now includes an optional walletName, and the openFeedbackAppzi function accepts an object with account, walletName, and chainId. The UI component (AppziButton) now retrieves wallet details and passes them accordingly. Additionally, the pending orders updater’s _triggerNps function has been modified to accept an account parameter and forward it to triggerAppziSurvey. A minor formatting update (a trailing comma) was also applied.

Changes

File(s) Change Summary
apps/cowswap-frontend/src/appzi.ts
apps/cowswap-frontend/src/legacy/components/AppziButton/index.tsx
- Added optional walletName?: string to AppziCustomSettings.
- Updated openFeedbackAppzi to accept an object with account, walletName, and chainId.
- Modified AppziButton to use wallet hooks (useWalletDetails, useWalletInfo) and pass wallet info.
- Added a trailing comma in the triggerAppziSurvey parameter.
apps/cowswap-frontend/src/common/updaters/orders/PendingOrdersUpdater.ts - Updated _triggerNps function signature to include an account: string parameter.
- Modified _updateOrders to pass the account parameter.
- Forwarded the account information to triggerAppziSurvey when triggering surveys.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant AB as AppziButton
    participant O as openFeedbackAppzi
    participant US as updateAppziSettings
    U->>AB: Click feedback button
    AB->>AB: Retrieve wallet details (account, walletName, chainId)
    AB->>O: Invoke showFeedbackModal with wallet info
    O->>US: Call updateAppziSettings with account, walletName, chainId
Loading
sequenceDiagram
    participant UO as _updateOrders
    participant TN as _triggerNps
    participant TS as triggerAppziSurvey
    UO->>TN: Call _triggerNps(pending, chainId, account)
    TN->>TS: Invoke triggerAppziSurvey with account & settings
Loading

Possibly related PRs

  • Add clickable token address #5462: The changes in the main PR, which modify the openFeedbackAppzi function to include an account parameter, are related to this PR as both involve passing account information to functions that trigger surveys or feedback mechanisms, specifically through the triggerAppziSurvey function.

Suggested labels

preview-widget-cfg

Suggested reviewers

  • elena-zh
  • fairlighteth
  • shoom3301

Poem

I’m a rabbit skipping through code so free,
With wallet and account joined in harmony.
New parameters hop into place with glee,
Feedback flows smoother for you and me.
In a byte-sized world, I cheer each change—
A joyful tap dance through the code range! 🐰

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/cowswap-frontend/src/appzi.ts (1)

132-132: Add trailing comma for consistent parameter styling.

This is a minor stylistic change that enhances readability and helps with future parameter additions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8d47da and 06478f8.

📒 Files selected for processing (3)
  • apps/cowswap-frontend/src/appzi.ts (3 hunks)
  • apps/cowswap-frontend/src/common/updaters/orders/PendingOrdersUpdater.ts (3 hunks)
  • apps/cowswap-frontend/src/legacy/components/AppziButton/index.tsx (4 hunks)
🧰 Additional context used
🪛 GitHub Actions: CI
apps/cowswap-frontend/src/legacy/components/AppziButton/index.tsx

[error] 6-6: There should be at least one empty line between import groups (import/order)


[error] 7-7: There should be at least one empty line between import groups (import/order)


[error] 7-7: react import should occur before import of @cowprotocol/assets/cow-swap/feedback.svg (import/order)


[error] 68-68: React Hook "useWalletInfo" is called conditionally. React Hooks must be called in the exact same order in every component render (react-hooks/rules-of-hooks)


[error] 69-69: React Hook "useWalletDetails" is called conditionally. React Hooks must be called in the exact same order in every component render (react-hooks/rules-of-hooks)


[error] 71-71: React Hook "useCallback" is called conditionally. React Hooks must be called in the exact same order in every component render (react-hooks/rules-of-hooks)

🔇 Additional comments (10)
apps/cowswap-frontend/src/legacy/components/AppziButton/index.tsx (4)

3-3: Add wallet-related imports to enhance user feedback context.

The addition of wallet-related hooks provides valuable context for user feedback, making support interactions more effective.


24-26: Improve transition property formatting for better readability.

The transition properties have been properly formatted with line breaks for better readability.


35-37: Improve transition property formatting for better readability.

The transition properties have been properly formatted with line breaks for better readability.


76-76: Improved onClick handler readability with callback abstraction.

The onClick handler now uses a callback function, which improves readability and maintainability.

apps/cowswap-frontend/src/appzi.ts (3)

65-65: Add wallet name to enhance feedback context.

Adding walletName to the settings allows support teams to better understand the user's environment, enhancing troubleshooting capabilities.


93-93: Update call to updateAppziSettings with wallet information.

The function now passes account, chainId, and walletName to provide richer context for user feedback.


89-91:

✅ Verification successful

Function signature updated to include wallet information.

The function now properly accepts wallet-related information, ensuring that feedback contains important context about the user's session.


🏁 Script executed:

#!/bin/bash
# Description: Verify that the openFeedbackAppzi function is called with the correct parameters
# throughout the codebase

# Search for all calls to openFeedbackAppzi to ensure they pass the required parameters
rg -A 3 "openFeedbackAppzi" --type ts --type tsx

Length of output: 76


🏁 Script executed:

#!/bin/bash
# Re-run verification: Search for calls to openFeedbackAppzi in TS and TSX files using explicit globs
rg -A 3 "openFeedbackAppzi" -g "*.ts" -g "*.tsx"

Length of output: 1190


Final verification: Function signature and usage are correct.

  • The openFeedbackAppzi function now accepts wallet-related information as required.
  • Verification confirms that calls (e.g., in apps/cowswap-frontend/src/legacy/components/AppziButton/index.tsx) pass the account, chainId, and walletName parameters.

Approved as is.

apps/cowswap-frontend/src/common/updaters/orders/PendingOrdersUpdater.ts (3)

203-203: Update _triggerNps call to include account information.

The function call now correctly passes the account parameter to _triggerNps, ensuring wallet information is included in user feedback.


343-343: Function signature updated to include account parameter.

The _triggerNps function now accepts an account parameter, allowing it to pass this information to the Appzi feedback system.


357-357: Include account information in NPS survey data.

Adding the account parameter to triggerAppziSurvey ensures that support teams can correctly identify which wallet is experiencing issues with long-pending orders.

Copy link
Contributor

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

Hey @anxolin , great job!
There are some issues (nipicks) like:

  1. wallet shows 'injected' when the app is opened inside a walelt's browser (like imToken, MM). It is a known issue related to this task Detect injected wallet name #792
    image

  2. inside the safe, it does not capture the image (however, it is on Prod also) image

  3. it does not show a connection type (e.g. connected to Safe using WC), just shows a wallet name. Not sure whether we should fix this

@anxolin
Copy link
Contributor Author

anxolin commented Mar 4, 2025

Tanks @elena-zh ! I've added this into our side quests. I agree with the suggestions

@anxolin anxolin enabled auto-merge (squash) March 4, 2025 20:02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/cowswap-frontend/src/legacy/components/AppziButton/index.tsx (2)

25-27: Consider consolidating transition properties for brevity.
The multi-line transitions are fully valid; however, you may consider consolidating properties into single lines to improve readability. This is purely a style preference and doesn’t affect functionality.

Also applies to: 36-38


78-78: Confirm user consent regarding PII.
This button action transmits the wallet address and name. Verify that users are aware of this data sharing for support purposes, and that it aligns with your privacy policies.

Need help creating a modal or tooltip explaining the implications of sharing wallet details?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06478f8 and 4989dfe.

📒 Files selected for processing (1)
  • apps/cowswap-frontend/src/legacy/components/AppziButton/index.tsx (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Cypress
  • GitHub Check: Setup
🔇 Additional comments (1)
apps/cowswap-frontend/src/legacy/components/AppziButton/index.tsx (1)

66-71: Ensure handling of undefined or empty wallet details.
If account, chainId, or walletName might be undefined when the user isn’t connected, verify that openFeedbackAppzi gracefully handles these values without throwing errors or storing unwanted null data.

@anxolin anxolin merged commit 237693e into develop Mar 4, 2025
13 of 14 checks passed
@anxolin anxolin deleted the add-account-to-appzZi-feedback branch March 4, 2025 20:18
@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants