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

feat(MWPW-155317): Add dynamic link transformation component #176

Merged
merged 8 commits into from
Sep 17, 2024

Conversation

sanrai
Copy link
Collaborator

@sanrai sanrai commented Sep 17, 2024

This pull request introduces a new withLinkTransformer higher-order component that dynamically transforms URLs within React components based on configured patterns.

This feature enhances consumers ability to manage links across different environments through config files.

Key features:

  • Higher-order component withLinkTransformer for wrapping existing components
  • Configurable link transformation patterns via config object or localStorage
  • Recursive transformation of nested props
  • Support for multiple transformation patterns
  • Fallback to original URL if no patterns match
  • Error handling for localStorage issues

Changes:

  • Add withLinkTransformer.js component
  • Implement link transformation logic
  • Add unit tests for various scenarios and edge cases
  • Update documentation with usage examples

This feature allows for easier management of environment-specific URLs, improving the development workflow and reducing the risk of incorrect links in production.

Test coverage 100%
image

Closes: https://jira.corp.adobe.com/browse/MWPW-155317

@sanrai sanrai changed the title Link transformer poc feat(MWPW-155317): Add dynamic link transformation component Sep 17, 2024
@sanrai sanrai merged commit 1753693 into main Sep 17, 2024
10 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.

2 participants