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

Replace ortto External Embedded Webform for Onboarding guide #1657

Merged

Conversation

RamRamez
Copy link
Collaborator

@RamRamez RamRamez commented Jun 26, 2024

#1548

Summary by CodeRabbit

  • New Features

    • Introduced a method to subscribe users to onboarding notifications via email.
    • Added a new onboarding form resolver for handling subscription requests.
  • Enhancements

    • Updated notification event names to include onboarding subscription events.
    • Made user wallet address optional in the notification sending interface.

Copy link
Contributor

coderabbitai bot commented Jun 26, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The changes introduce a new method subscribeOnboarding within several files to handle the onboarding notification process. These modifications include: integrating this method into the MockNotificationAdapter, updating the NotificationAdapterInterface, modifying the NotificationCenterAdapter, adding a corresponding event name in the analytics.ts, and creating a new OnboardingFormResolver class to manage onboarding subscriptions using email addresses.

Changes

File Change Summary
src/adapters/notifications/MockNotificationAdapter.ts Added subscribeOnboarding method that logs a debug message before resolving a promise.
src/adapters/notifications/NotificationAdapterInterface.ts Integrated subscribeOnboarding method into the interface.
src/adapters/notifications/NotificationCenterAdapter.ts Added subscribeOnboarding method to handle subscription notifications and made userWalletAddress optional in SendNotificationBody.
src/analytics/analytics.ts Updated NOTIFICATIONS_EVENT_NAMES enum to include SUBSCRIBE_ONBOARDING.
src/resolvers/onboardingFormResolver.ts Introduced OnboardingFormResolver class with a subscribeOnboarding method.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Resolver as OnboardingFormResolver
    participant NotificationCenter as NotificationCenterAdapter
    participant MockNotification as MockNotificationAdapter
    
    Client->>Resolver: subscribeOnboarding({ email })
    Resolver->>NotificationCenter: subscribeOnboarding({ email })
    NotificationCenter->>MockNotification: subscribeOnboarding({ email })
    MockNotification-->>NotificationCenter: Promise<void>
    NotificationCenter-->>Resolver: Promise<void>
    Resolver-->>Client: Subscription confirmed
Loading

Poem

Amidst the code where logics blend,
A new method we append,
Subscribing to onboarding's might,
With emails sent, the future's bright.
Notifications rise and flow,
In lines of code, success will glow. 🌟


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

export class OnboardingFormResolver {
@Query(_returns => [QfRound], { nullable: true })
async subscribeOnboarding(
@Args()
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the decorator usage.

The static analysis tool flagged an error with the decorator usage on the method parameter. This needs to be corrected to ensure proper functionality.

-   @Args()
+   @Args({ validate: false }) // Assuming validation is not required. Adjust as necessary.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Args()
@Args({ validate: false }) // Assuming validation is not required. Adjust as necessary.
Tools
Biome

[error] 9-9: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

@@ -20,6 +20,7 @@ import { ProjectUserInstantPowerViewResolver } from './instantPowerResolver';
import { AnchorContractAddressResolver } from './anchorContractAddressResolver';
import { RecurringDonationResolver } from './recurringDonationResolver';
import { DraftDonationResolver } from './draftDonationResolver';
import { OnboardingFormResolver } from './onboardingFormResolver';

// eslint-disable-next-line @typescript-eslint/ban-types
export const getResolvers = (): Function[] => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace the generic Function type with a more specific type.

The use of Function as a type is discouraged due to its broad acceptance of any function-like value. Specify a more explicit function type to prevent bugs.

- export const getResolvers = (): Function[] => {
+ export const getResolvers = (): Array<() => any> => { // Adjust the return type based on actual resolver function signatures.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const getResolvers = (): Function[] => {
export const getResolvers = (): Array<() => any> => {
Tools
Biome

[error] 26-26: Don't use 'Function' as a type. (lint/complexity/noBannedTypes)

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

@RamRamez RamRamez requested a review from jainkrati June 30, 2024 12:31
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Comment on lines 12 to 14
} catch (e) {
logger.debug('subscribeOnboarding() error', e);
return e;
Copy link
Contributor

Choose a reason for hiding this comment

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

Improve error handling.

Returning raw error objects can expose sensitive information and lead to security vulnerabilities. Consider returning a boolean or a custom error message instead.

-    } catch (e) {
-      logger.debug('subscribeOnboarding() error', e);
-      return e;
+    } catch (error) {
+      logger.debug('subscribeOnboarding() error', error);
+      return false;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (e) {
logger.debug('subscribeOnboarding() error', e);
return e;
} catch (e) {
logger.debug('subscribeOnboarding() error', e);
return false;

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

src/resolvers/onboardingFormResolver.ts Show resolved Hide resolved
@Resolver()
export class OnboardingFormResolver {
@Query(_returns => Boolean)
async subscribeOnboarding(@Arg('email') email: string): Promise<boolean> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the decorator usage.

The static analysis tool flagged an error with the decorator usage on the method parameter. This needs to be corrected to ensure proper functionality.

-  async subscribeOnboarding(@Arg('email') email: string): Promise<boolean> {
+  async subscribeOnboarding(@Arg('email', { validate: false }) email: string): Promise<boolean> {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async subscribeOnboarding(@Arg('email') email: string): Promise<boolean> {
async subscribeOnboarding(@Arg('email', { validate: false }) email: string): Promise<boolean> {
Tools
Biome

[error] 8-8: Decorators are not valid here.

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

(parse)

@RamRamez RamRamez requested review from mohammadranjbarz and removed request for mohammadranjbarz June 30, 2024 22:08
…d-Webform-for-Onboarding-guide

# Conflicts:
#	src/adapters/notifications/NotificationCenterAdapter.ts
Copy link
Collaborator

@Meriem-BM Meriem-BM left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @RamRamez

@RamRamez RamRamez merged commit 078efce into staging Jul 1, 2024
5 checks passed
@RamRamez RamRamez deleted the Replace-ortto-External-Embedded-Webform-for-Onboarding-guide branch July 1, 2024 10:16
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