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

[Feature] Add analytics passthroughs for Alert #296

Merged
merged 9 commits into from
Apr 23, 2024

Conversation

narin
Copy link
Contributor

@narin narin commented Apr 23, 2024

Description of Change

Add analytics support by adding passthrough functions for expand and collapse. Analytics for buttons should already be covered by the onPresses for each button.

This also includes a fix for the Link background color getting stuck onPress

Testing Packages

N/A

Screenshots/Video

iOS

RPReplay_Final1713893239.MP4

Android

screen-20240423-102900.mp4

Web

Screen.Recording.2024-04-23.at.10.25.43.AM.mov

Testing

  • Tested on iOS
  • Tested on Android
  • Tested on Web

PR Checklist

Code reviewer validation:

  • General
    • PR is linked to ticket(s)
    • PR has changelog label applied if it's to be included in the changelog
    • Acceptance criteria:
      • All satisfied or
      • Documented reason for not being performed or
      • Split to separate ticket and ticket is linked by relevant AC(s)
    • Above PR sections adequately filled out
    • If any breaking changes, in accordance with the pre-1.0.0 versioning guidelines: a CU ticket has been created for the VA Mobile App detailing necessary adjustments with the package version that will be published by this ticket
  • Code
    • Tests are included if appropriate (or split to separate ticket)
    • New functions have proper TSDoc annotations

Publish

If changes warrant a new version per the versioning guidelines and the PR is approved and ready to merge:

@narin narin changed the base branch from main to feature/246-narin-alert-collapsible April 23, 2024 17:38
@narin narin marked this pull request as ready for review April 23, 2024 17:40
@narin narin requested a review from a team as a code owner April 23, 2024 17:40
Base automatically changed from feature/246-narin-alert-collapsible to main April 23, 2024 18:50
@@ -43,13 +43,19 @@ export type AlertProps = {
header: string
/** True if Alert should start expanded. Defaults to false */
initializeExpanded?: boolean
/** Optional passthrough function for expand event */
onExpand?: () => void
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we wanted to have an analytics object like with Link here. I think an object is a good idea for: consistency across components, setting it aside as non-functionality changing set of props, and more flexibility expanding analytics for a component in the future if any edge cases warrant it.

If doing that, probably fine to drop the analytics prop in the general list and not worry about locking down apps sending analytics that aren't possible depending on how they functionally configured it--as it's non-functional, I see no issue dropping them on the floor. It might even simplify how apps leverage it to just have a wrapper that always sends expand/collapse analytics even when they can't be hit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. I was going back and forth on this as well. I think it makes sense to add the analytics object and have it limited to events that don't have their own obvious onPress. Link sort of breaks this proposed pattern since it includes analytics.onPress though. We could potentially remove it if it's not already being used.

Added analytics object and moved onExpand and onCollapse inside.

Copy link
Contributor

Choose a reason for hiding this comment

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

Link sort of breaks this proposed pattern since it includes analytics.onPress though. We could potentially remove it if it's not already being used.

It is needed in Link due to us handling the onPress logic on Link variants where we can. Outside attactments/custom/calendar where they have to, they are unlikely to send custom onPress logic where they could do onPress analytics since doing so would overwrite the built in onPress behavior.

/** Optional passthrough function for expand event */
onExpand?: () => void
/** Optional passthrough function for collapse event */
onCollapse?: () => void
Copy link
Contributor

Choose a reason for hiding this comment

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

Relatedly to the above comment, don't feel strongly but if we go the analytics object route, I wonder if we should include the Buttons? Link had it so they could send it via analytics or their own onPress logic they have to include--not sure if we should retain that flexibility or leave Link as a one-off due to the cases where we handled the onPress and needed a passthrough.

Copy link
Contributor

@TimRoe TimRoe left a comment

Choose a reason for hiding this comment

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

Code-wise looks good; dropping request changes to indicate I'm done with 1st pass and curious about thoughts on the analytics object before moving along.

@narin narin merged commit 710d081 into main Apr 23, 2024
6 of 7 checks passed
@narin narin deleted the feature/201-narin-alert-analytics branch April 23, 2024 21:51
Copy link
Contributor

@TimRoe TimRoe left a comment

Choose a reason for hiding this comment

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

Reaffirming approval w/ minor Link bugfix.

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

Successfully merging this pull request may close these issues.

2 participants