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

fix: send origin in query tagging #1585

Conversation

lauramargar
Copy link
Contributor

@lauramargar lauramargar commented Aug 5, 2024

Pull request template

When you click on a brand recommendation, the origin param is not included in the query tagging. That's because the BaseEventButton used on the QueryPreviewButton component emits UserAcceptedAQueryPreview event without any feature param in the metadata so that the origin couldn't be created.

To fix it, we are going to pass the origin through a prop and it will be added to the event metadata.

Motivation and context

  • Dependencies. If any, specify:
  • Open issue. If applicable, link: RST-1853

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to not work as expected)
  • Change requires a documentation update

What is the destination branch of this PR?

  • Main
  • Other. Specify:

How has this been tested?

Click on a brand recommendation and check if the origin customer:no_query is sent in the query tagging.

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review on my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

@lauramargar lauramargar requested a review from a team as a code owner August 5, 2024 10:37
albertjcuac
albertjcuac previously approved these changes Aug 5, 2024
@herrardo
Copy link
Contributor

herrardo commented Aug 6, 2024

Germán 👀

*
* @public
*/
queryFeature: {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think would be better to not limit this to the queryFeature. I'd something like:

      metadata: {
        type: Object as PropType<Omit<WireMetadata, 'moduleName'>>
      }
...
      function emitEvents() {
        Object.entries(props.events).forEach(([event, payload]) =>
          $x.emit(event as XEvent, payload, { target: rootRef.value, ...props.metadata })
        );
      }

I'm not sure if we could have issues with the wiring types. If we do, probably we could even relax them here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right!! 👍🏽

@@ -38,7 +47,7 @@
*/
function emitEvents() {
Object.entries(props.events).forEach(([event, payload]) =>
$x.emit(event as XEvent, payload, { target: rootRef.value })
$x.emit(event as XEvent, payload, { target: rootRef.value, feature: props.queryFeature })
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment above

@diegopf diegopf requested a review from albertjcuac August 8, 2024 07:17
@lauramargar lauramargar merged commit 92efdf7 into main Aug 8, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants