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

Licensing Portal: Add company details form #63100

Merged
merged 16 commits into from May 25, 2022
Merged

Conversation

kallehauge
Copy link
Contributor

@kallehauge kallehauge commented Apr 27, 2022

Summary

This PR aims to add a new page to the Licensing Portal where partners can update their company details like company name or company address, so they have up-to-date information on their invoices.

Changes proposed in this Pull Request

  • Add a new page Company Details page (/partner-portal/company-details).
Context
  • 1201902532330136-as-1201955149001159
  • pdpAdu-bj-p2

Testing instructions

Submit new data
  • Apply D79508-code and point your DNS to your sandbox
  • Spin up the branch
  • Go to http://jetpack.cloud.localhost:3000/partner-portal/company-details
  • Add address information (could be Automattics address)
  • Submit the form and (hopefully) you should now see a success message
  • Hard refresh the page to check if the data was persistent
Tracking
  • Verify that your submission shows up in tracks as a calypso_partner_portal_update_company_details_submit event (there might be a 10min delay): 2c4d2-pb

Screenshot

Screenshot 2022-05-19 at 11 06 51

@matticbot
Copy link
Contributor

matticbot commented Apr 27, 2022

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~47 bytes added 📈 [gzipped])

name           parsed_size           gzip_size
entry-stepper       +204 B  (+0.0%)      +47 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~1442 bytes added 📈 [gzipped])

name                          parsed_size           gzip_size
jetpack-cloud-partner-portal      +5557 B  (+1.3%)    +1442 B  (+1.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@kallehauge kallehauge marked this pull request as ready for review April 28, 2022 10:02
@kallehauge kallehauge requested a review from a team April 28, 2022 10:03
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 28, 2022
Copy link
Member

@atanas-dev atanas-dev left a comment

Choose a reason for hiding this comment

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

The dropdowns can go out of bounds on mobile when closed:
Screen Shot 2022-04-28 at 17 31 26

city?: string;
line1?: string;
line2?: string;
postal_code?: string | number;
Copy link
Member

Choose a reason for hiding this comment

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

Let's stick with camelCase when dealing with data inside Calypso so API responses are API* interfaces (e.g. APIPartner) which we transform into camelCase interfaces (e.g. Partner) immediately upon receiving them and we flip them to snake_case when we send requests. It's annoying but it also helps to differentiate API data vs internal Calypso data and with being consistent in both environments in terms of naming conventions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd love to get your take on this direction: 736ec3e (the actual implementation gives TS errors because I'm messing with the interface values. I guess I could work around it by defining the properties as <unknown> first 😅 )

When we format the partner, we convert it to postalCode so it will be camelCase when we work with it in the code itself, but we keep the payload as postal_code.
I kinda like the idea of specifying the exact payload we need to provide + doing it this way we don't have to convert the value in 2 places:

  • mutationUpdateCompanyDetails as highlighted here.
  • When we record the calypso_partner_portal_update_company_details_submit track - the track expect snake and/or kebab case formatting).

Copy link
Member

Choose a reason for hiding this comment

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

The way I think about this is based on what is internal and what is external.
Anything in Calypso should be in Calypso's format. Anything coming in from the "outside" or going out should be in whatever format the "outside" in that case uses.

As such, JSON coming in from the WPCOM API is in snake_case and when it enters Calypso's domain, it should be converted to an appropriate format for Calypso.
When data needs to go out to the WPCOM API it should be in snake_case as that is what the API uses, even if that means we have to convert it back to snake_case.
The same logic applies to Tracks - it's an "outside" domain and we need to convert it if that is what that domain expects.

For argument's sake, let's say that Stripe used kebab-case and Tracks used MACRO_CASE - which one would we use? Would we allow our Calypso state to be littered with 4 different cases because of where that data originally comes from? Even if that data comes from someplace else the moment it enters Calypso's domain, it becomes Calypso's data and should be treated as such.

Isolating and converting data's structure at the entry and exit points makes the most sense to me, even if that means some extra work on converting the data's structure on the way in and on the way out.

@kallehauge
Copy link
Contributor Author

I have re-ordered some of the fields to better match the i3 "create partner" experience (p1HpG7-fQT-p2)

@atanas-dev
Copy link
Member

Some replies on outdated files are appearing on their own instead of in their threads so I think you'll have to expand the previous set of feedback items in order to see the full context 😩

@atanas-dev
Copy link
Member

I've taken over the task and have addressed my feedback.

Copy link
Contributor

@heydemoura heydemoura left a comment

Choose a reason for hiding this comment

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

LGTM :shipit:

@atanas-dev atanas-dev merged commit ef16387 into trunk May 25, 2022
@atanas-dev atanas-dev deleted the add/portal-company-details branch May 25, 2022 15:47
@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 May 25, 2022
@a8ci18n
Copy link

a8ci18n commented May 25, 2022

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7331543

Thank you @kallehauge for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented Jun 2, 2022

Translation for this Pull Request has now been finished.

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.

None yet

5 participants