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: allow end user to set all url paths (WPB-4676) #16774

Merged
merged 12 commits into from
Feb 13, 2024
Merged

Conversation

V-Gira
Copy link
Contributor

@V-Gira V-Gira commented Feb 6, 2024

TaskWPB-4676 URL_PATHS in webapp have inconsistencies and deprecations

Description

  • get rid of unnecessary logic building urls in externatRoutes.ts
  • avoid using hard coded support urls and subpaths
  • change the release note url from github to medium

Checklist

  • PR has been self reviewed by the author;
  • Hard-to-understand areas of the code have been commented;
  • If it is a core feature, unit tests have been added;

Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (393c5df) 45.84% compared to head (6114793) 45.85%.
Report is 5 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #16774   +/-   ##
=======================================
  Coverage   45.84%   45.85%           
=======================================
  Files         747      747           
  Lines       24443    24442    -1     
  Branches     5578     5578           
=======================================
  Hits        11207    11207           
+ Misses      11818    11812    -6     
- Partials     1418     1423    +5     

Comment on lines -40 to -51
export const URL_PATH = {
CREATE_TEAM: '/create-team/',
DECRYPT_ERROR_1: '/articles/207948115',
DECRYPT_ERROR_2: '/privacy/error-2/',
MANAGE_SERVICES: '/services/',
MANAGE_TEAM: '/login/',
PASSWORD_RESET: '/forgot/',
PRIVACY_HOW: '/privacy/how/',
PRIVACY_UNVERIFIED_USERS: '/articles/202857164',
PRIVACY_WHY: '/articles/207859815',
SUPPORT_USERNAME: '/support/username/',
} as const;
Copy link
Contributor Author

@V-Gira V-Gira Feb 7, 2024

Choose a reason for hiding this comment

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

  • some of those are removed as deprecated
  • support links still in use have been moved with existing ones as environment variables instead of being hardcoded
  • url paths intended to be dynamically appended have been made into the URL_SUBPATH env variables as to be end user configurable

Comment on lines 103 to 114

const addLocaleToHelpCenterUrl = (url?: string): string => {
if (!url) {
return undefined;
}
const language = currentLanguage().slice(0, 2);
const websiteLanguage = language == 'de' ? language : 'en-us';
return url.replace(
`${Config.getConfig().URL.SUPPORT.INDEX}`,
`${Config.getConfig().URL.SUPPORT.INDEX}/hc/${websiteLanguage}`,
);
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

help center links do not need to be localized as they follow the browser locale setting

@V-Gira V-Gira marked this pull request as ready for review February 7, 2024 14:23
@V-Gira V-Gira requested review from otto-the-bot and a team as code owners February 7, 2024 14:23
@CLAassistant
Copy link

CLAassistant commented Feb 12, 2024

CLA assistant check
All committers have signed the CLA.

@V-Gira V-Gira force-pushed the v/appended-paths-config branch from 3292d38 to 9f30b9c Compare February 12, 2024 11:21
Comment on lines +49 to +50
export const getManageServicesUrl = (utmSource?: string): string | undefined =>
getTeamSettingsUrl(URL.URL_PATH.MANAGE_SERVICES, utmSource);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hard to find doc on those UTM sources
we use 2 variations of those in the webapp:

  • client_landing when navigating from the main portion of the app
  • client_settings when navigating from the settings

Do we want to keep that granularity @atomrc ?
Should I had those to the externalUrl object and stop exporting those methods?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah!! I do not know about those utms, honestly. But, since we will be tracking team settings usages soonish, I'm guessing those will be used at some point (if they are not currently).
We should probably keep a way to add utm to some urls I guess

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'll keep the export of the method and add some JSDoc to make the utmSource thing more transparent, how does that sound?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds good to me :)


export const addLocaleToUrl = (url?: string): string => {
export const addLocaleToUrl = (url?: string | undefined): string | undefined => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why url?: string | undefined? :D You append undefined by ? after url :)

@V-Gira V-Gira requested a review from atomrc February 13, 2024 10:44
@V-Gira V-Gira requested a review from przemvs February 13, 2024 10:44
Copy link
Contributor

@przemvs przemvs left a comment

Choose a reason for hiding this comment

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

LGTM! :)

Copy link
Contributor

@atomrc atomrc left a comment

Choose a reason for hiding this comment

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

LGTM 😎

@V-Gira V-Gira merged commit 3419ca2 into dev Feb 13, 2024
11 checks passed
@V-Gira V-Gira deleted the v/appended-paths-config branch February 13, 2024 11:39
V-Gira added a commit that referenced this pull request Sep 6, 2024
* fix: allow end user to set all url paths (WPB-4676)

* add new urls in env variables to config

* remove hard coded path from externalRoutes util

* update components using the externalRoutes util

* update missing components

* remove unused path

* rename subpath to url_path

* expose external urls instead of get methods

* add JS doc to methods appending UTM parameters

* Apply suggestions from code review

Co-authored-by: Przemysław Jóźwik <[email protected]>
---------

Co-authored-by: Virgile <[email protected]>
Co-authored-by: Przemysław Jóźwik <[email protected]>
V-Gira added a commit that referenced this pull request Sep 6, 2024
* fix: allow end user to set all url paths (WPB-4676) (#16774)

* fix: allow end user to set all url paths (WPB-4676)

* add new urls in env variables to config

* remove hard coded path from externalRoutes util

* update components using the externalRoutes util

* update missing components

* remove unused path

* rename subpath to url_path

* expose external urls instead of get methods

* add JS doc to methods appending UTM parameters

* Apply suggestions from code review

Co-authored-by: Przemysław Jóźwik <[email protected]>
---------

Co-authored-by: Virgile <[email protected]>
Co-authored-by: Przemysław Jóźwik <[email protected]>

* chore: bump default config to 0.31.22 [WPB-10937]

---------

Co-authored-by: Virgile <[email protected]>
Co-authored-by: Przemysław Jóźwik <[email protected]>
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.

6 participants