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

NPS v2: Add the skeleton of the marketing package, including the empty NPS component #95046

Closed
wants to merge 9 commits into from

Conversation

southp
Copy link
Contributor

@southp southp commented Oct 1, 2024

Related to #94874

Proposed Changes

This PR establishes the foundational package structure of the marketing package with NPS v2 as the first component within it. Following the discussions in #94874, this PR attempts the direction of an isolated package with all the NPS v2 related components and data-related hooks consolidated inside.

  • The package itself is initiated by the following way:
    • The package outline was generated by yarn run generate
    • Added the placeholder CHANGELOG.md
    • Adjusted several dependencies in the generated template as the peer dependencies since those should be managed by the parent project in my opinion.
    • Added calypso-build as a peer dependency so copy-assets is available.
  • NPS v2 resides in src/nps.
  • The hooks are separated into queries and mutations. The unit tests are located in the respected __tests__ directories, following the current jest.config setting.
  • Added the basic configuration of Storybook. There are currently two placeholder stories: desktop and mobile, since I expect I'd need to iterate on the both layout the most.

Why are these changes being made?

It's the foundation of the NPS v2 project.

Testing Instructions

  • The most important factor is to verify if the package structure makes sense.
  • yarn run test-packages -- marketing should run the newly added two tests here and they should pass.
  • yarn run @automattic/marketing storybook should run the storybook instance. Note that the NPS component is meant to be rough for now:

CleanShot 2024-10-08 at 14 39 13@2x

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@southp southp added [Status] In Progress NPS v2 Tasks related to the Net Promoter Score v2 project labels Oct 1, 2024
@southp southp self-assigned this Oct 1, 2024
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@southp southp marked this pull request as ready for review October 8, 2024 06:46
@southp southp added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Oct 8, 2024
@southp southp requested review from a team, jeyip and chriskmnds October 8, 2024 06:50
Copy link
Contributor

@chriskmnds chriskmnds left a comment

Choose a reason for hiding this comment

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

Looks great! Left some comments, but not sure if anything critical.

{
"name": "@automattic/marketing",
"version": "1.0.0",
"description": "The package where the marketing components related to Automattic products are located.",
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this, overall. It means we can add stuff from JP/eslsewhere here too.

However, if that's not the intention - then it could also be @automattic/wpcom-marketting for consideration.

Copy link
Contributor

Choose a reason for hiding this comment

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

Have we considered adding a nps slice to @automattic/data-stores? It has pros & cons. I think it's tempting as a model of separation, so we keep all data-related stuff under there. It might be easier that way to focus on updates, keeping things consistent with other related data hooks, etc. But I can see how living here makes sense.

On a scale from 0–10, how likely are you to recommend WordPress.com to a friend or
colleague?
</legend>
<div className="nps-scale">
Copy link
Contributor

Choose a reason for hiding this comment

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

For classnames we should probably follow some convention to avoid clashes. Something like [name of package]-[name of component]__[...]. So for this, maybe marketting-nps__scale?

Which brings up the question whether marketting might be too generic (or not)

colleague?
</legend>
<div className="nps-scale">
<span className="label-left">Not likely</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly. Could be marketting-nps__scale-label-left, etc.

);
}

export function Nps() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Once we get a fully working version, we can keep this as the plain/view only component (that we can also build Stories for), and ship the wrapper as Nps that would also include the handlers for showing/not showing, mutating, etc.

Comment on lines +1 to +2
import { useMutation } from '@tanstack/react-query';
import wpcomRequest from 'wpcom-proxy-request';
Copy link
Contributor

Choose a reason for hiding this comment

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

We are missing these dependencies in package.json 🤔

@southp
Copy link
Contributor Author

southp commented Oct 14, 2024

This PR is now paused for further assessment of the overall project: p5uIfZ-g9B-p2#comment-24070 .

@southp
Copy link
Contributor Author

southp commented Oct 25, 2024

Closing it since there isn't any sign that the work will be picked up again in the near future.

@southp southp closed this Oct 25, 2024
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NPS v2 Tasks related to the Net Promoter Score v2 project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants