kinde-auth-react
kinde-auth-react copied to clipboard
feat: ProfileLink
Explain your changes
Feat: adds support for ProfileLink to access hosted user profile pages
Checklist
- [x] I have read the “Pull requests” section in the contributing guidelines.
- [x] I agree to the terms within the code of conduct.
🛟 If you need help, consider asking for advice over in the Kinde community.
## Walkthrough
A new `PortalLink` React component was introduced, along with its type definitions and unit tests. The central components index now exports `PortalLink`. The authentication context and provider were updated to support a `generatePortalUrl` method, which `PortalLink` uses to generate and navigate to a portal URL. Type definitions were extended accordingly.
## Changes
| File(s) | Change Summary |
|----------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
| src/components/PortalLink.tsx | Added new `PortalLink` React component that generates and navigates to a portal URL via the authentication context. |
| src/components/PortalLink.test.tsx | Added unit tests for the `PortalLink` component using Vitest and React Testing Library. |
| src/components/index.ts | Exported `PortalLink` from the central components index. |
| src/state/KindeContext.ts | Added `generatePortalUrl` method to the `KindeContextProps` interface. |
| src/state/KindeProvider.tsx | Implemented the `generatePortalUrl` method in the provider and exposed it via context. |
| src/state/types.ts | Added `PortalLinkProps` interface for the new component, extending button and portal URL parameter types. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant User
participant PortalLink (Component)
participant useKindeAuth (Hook)
participant KindeContext
participant generatePortalUrl (Function)
User->>PortalLink: Clicks button
PortalLink->>useKindeAuth: Accesses auth context
PortalLink->>KindeContext: Calls generatePortalUrl(options)
KindeContext->>generatePortalUrl: Calls with domain and options
generatePortalUrl-->>KindeContext: Returns { url }
KindeContext-->>PortalLink: Returns { url }
PortalLink->>User: Redirects window.location.href to url
Suggested reviewers
- DaveOrDead
- peterphanouvong
<!-- walkthrough_end -->
---
<details>
<summary>📜 Recent review details</summary>
**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 1967f4337c53058df9f53a10feb3f35d4c43471d and 38012764bd57ebecafc770c3aa223ee26e92b537.
</details>
<details>
<summary>⛔ Files ignored due to path filters (1)</summary>
* `package.json` is excluded by `!**/*.json`
</details>
<details>
<summary>📒 Files selected for processing (3)</summary>
* `CHANGELOG.md` (1 hunks)
* `src/components/PortalLink.test.tsx` (1 hunks)
* `src/components/PortalLink.tsx` (1 hunks)
</details>
<details>
<summary>✅ Files skipped from review due to trivial changes (1)</summary>
* CHANGELOG.md
</details>
<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (2)</summary>
* src/components/PortalLink.tsx
* src/components/PortalLink.test.tsx
</details>
</details>
<!-- internal state start -->
<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAMxJqLit8Clw0LwAZeAwAa2jIAHc0ZAcBZnUaejkw2A9sREpIABFMeBIvG0lKZGLrOwxHAUaARgAWAA4ULFxavxJufER1FPkc7KUwRcQAejWMDbQ8WDB/NDENGARkWyncCkVsBml0SHICyHjqbH8a6nRaWglbDcBapD4pawpNKZbI5AA0kDIKi82SI6AYT0QyAIkFgi0qPC81FiKWYPDQpEQF3ckCUiAYFHg3HE+CwiG4ongsTa2NgfxmHgYfIwpBQyBJDHqUVZPHuEngtFRNVQbw+2AwYngrPS6lk1NmTAwd3gAjwEMN3IobHoaFotX8Go8OIFsvwIjEAHJkNxvL5/EEQpAiNgFe1ss9MPQmEp+LEFPtHppLh4btkGF5sHSXkLRDkUYhQut4AxqEqZvyDazjaaCHw+chTvQXf5IhJMKFDdW8EraPhJWwjaWZZH0ER/M9nZWY/g44baImLgA5fD/RUsjDpFDMbiRAdpde0khpeBeZDm4WUyBDWSspuzW1rrVYGeQ1LpLK5ezA0GhZweXj4PKSj0NkNQeHSDJMuu+opnYJZYEMczyiQBRRBWHgAKo2BkXCwLguDcIgHDbNsRDqLA2ACBoTDMLs6wkJsWJ0fsDGHDMJwJGI2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qFryKSBYaFqBAMbprIaoaoAWr2rAQuqSAeraBWrxJrqgA== -->
<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->
<details open="true">
<summary>✨ Finishing Touches</summary>
- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings
</details>
<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->
---
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
<details>
<summary>❤️ Share</summary>
- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
</details>
<details>
<summary>🪧 Tips</summary>
### Chat
There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=kinde-oss/kinde-auth-react&utm_content=148):
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
- `I pushed a fix in commit <commit_id>, please review it.`
- `Explain this complex logic.`
- `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
- `@coderabbitai explain this code block.`
- `@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
- `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
- `@coderabbitai read src/utils.ts and explain its main purpose.`
- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
- `@coderabbitai help me debug CodeRabbit configuration file.`
### Support
Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
### CodeRabbit Commands (Invoked using PR comments)
- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.
### Other keywords and placeholders
- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.
### CodeRabbit Configuration File (`.coderabbit.yaml`)
- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`
### Documentation and Community
- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
</details>
<!-- tips_end -->