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: implemented redirects using context.config #2755

Merged
merged 6 commits into from
Oct 8, 2024

Conversation

chesterkmr
Copy link
Collaborator

@chesterkmr chesterkmr commented Oct 8, 2024

Summary by CodeRabbit

  • New Features

    • Added a config prop to the StateManager component for enhanced state management configuration.
    • Introduced a new endpoint for resubmitting workflows.
    • Enhanced fetchFlowContext to return comprehensive context and configuration data.
    • Added optional uiOptions to configuration schemas for improved user interface behavior.
  • Bug Fixes

    • Improved clarity and consistency in handling context data across various components.
  • Documentation

    • Updated type definitions to include new configuration options.
  • Chores

    • Updated internal logic and structure for better data handling and traceability.
    • Incremented version numbers and updated dependencies across multiple packages.

@chesterkmr chesterkmr requested a review from alonp99 October 8, 2024 11:04
Copy link

changeset-bot bot commented Oct 8, 2024

⚠️ No Changeset found

Latest commit: d33145c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

Walkthrough

The changes in this pull request involve modifications to the StateManager component and its associated types, enhancing the state management capabilities of the application. A new config prop has been added to the StateManager, which is integrated into the context object. Additionally, the fetchFlowContext function has been updated to return a more comprehensive data structure. Other updates include the introduction of new types and properties, adjustments to existing hooks, and enhancements to the workflow controller and schema definitions.

Changes

File Change Summary
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx Added config prop to StateManagerProps and updated context handling with useMemo.
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.ts Added config property to StateManagerContext and StateManagerProps.
apps/kyb-app/src/domains/collection-flow/collection-flow.api.ts Updated fetchFlowContext return type and logic to include config in the returned data.
apps/kyb-app/src/domains/collection-flow/types/flow-context.types.ts Introduced CollectionFlowConfig and CollectionFlowContextData interfaces.
apps/kyb-app/src/hooks/useUIOptionsRedirect/useUIOptionsRedirect.ts Modified hook to prioritize configuration options from state manager context.
apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx Renamed context to contextData for clarity and updated related logic.
services/workflows-service/prisma/data-migrations Updated subproject commit reference.
services/workflows-service/src/collection-flow/controllers/collection-flow.controller.ts Updated getContext method to include config and added resubmitFlow endpoint.
services/workflows-service/src/workflow/schemas/zod-schemas.ts Added uiOptions property to ConfigSchema.

Possibly related PRs

  • Added buildFlat to @ballerine/blocks #2376: The changes in the StateManager component and the addition of the config prop may relate to the updates in the @ballerine/blocks package, which also involves structural changes and enhancements in functionality.
  • feat: updated readme #2430: The updates in the CollectionFlow component regarding context management may connect with changes in the @ballerine/react-pdf-toolkit, which also deals with context and configuration updates.
  • Sanctions out of onboarding flow #2434: The modifications in the BlocksVariant component and the introduction of new checks for variants may relate to the changes in the StateManager component, as both involve managing different states and configurations.
  • Updated ballerine-nestjs-typebox #2440: The updates in the ballerine-nestjs-typebox dependency may indirectly relate to the changes in the StateManager component, as both involve dependency management and updates to the underlying structure.
  • Common version release #2447: The version updates in the @ballerine/common package may connect with the changes in the StateManager component, as both involve enhancements to the overall functionality and compatibility of the application.
  • feat: business Report in Backoffice updates #2450: The updates in the business-report.module.ts file may relate to the changes in the StateManager component, as both involve managing complex data structures and enhancing functionality.
  • Removed risk score from UI elements #2491: The removal of risk scores from UI elements may connect with the changes in the StateManager component, as both involve adjustments to how data is presented and managed within the application.
  • Ecosystem and Transactions tab update #2698: The introduction of new components like PremiumFeature and Transactions may relate to the changes in the StateManager component, as both aim to enhance user engagement and functionality.
  • feature/refresh_backoffice_packages #2704: The updates to the @ballerine/ui package may connect with the changes in the StateManager component, as both involve improvements to the user interface and overall application performance.
  • wf service version bump #2710: The version bump in the workflows service may relate to the changes in the StateManager component, as both involve maintaining and updating dependencies for better functionality.
  • feat: implemented redirects handling #2715: The implementation of redirects handling may connect with the changes in the StateManager component, as both involve managing application state and user navigation.
  • Version bump #2722: The version bump in the workflows service may relate to the changes in the StateManager component, as both involve updates to dependencies and overall application structure.
  • fix(schemas): adding risk evaluation plugin output to context schema: #2729: The addition of the risk evaluation plugin output to the context schema may connect with the changes in the StateManager component, as both involve enhancing the context management capabilities of the application.
  • feat: added format fallback to date input in ui package #2736: The updates to the date input handling may relate to the changes in the StateManager component, as both involve improving user input handling and overall application functionality.
  • version bump #2738: The version bump in the backoffice may connect with the changes in the StateManager component, as both involve updates to dependencies and overall application structure.
  • feat: trying to fix prisma lock #2751: The changes in the Prisma service may relate to the updates in the StateManager component, as both involve enhancing the functionality and performance of the application.
  • Illiar/fix/select input placeholder color & text input #2752: The fix for the select input placeholder color may connect with the changes in the StateManager component, as both involve improving the user interface and overall user experience.

Suggested reviewers

  • tomer-shvadron

Poem

In the land of code where rabbits play,
A config prop hops in to brighten the day.
With context and flows, we dance and we sing,
Enhancing our state, oh what joy it will bring!
So let’s celebrate changes, both big and small,
For in this code garden, we flourish for all! 🐇✨


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>, please review it.
    • 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 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 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 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 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 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: 1

🧹 Outside diff range and nitpick comments (13)
apps/kyb-app/src/domains/collection-flow/types/flow-context.types.ts (3)

15-17: LGTM: New CollectionFlowConfig interface

The CollectionFlowConfig interface is well-defined and follows the existing naming conventions. The optional uiOptions property allows for flexible UI configurations.

Consider adding a brief JSDoc comment to describe the purpose of this interface for better documentation:

/**
 * Configuration options for the Collection Flow UI.
 */
export interface CollectionFlowConfig {
  uiOptions?: UIOptions;
}

18-21: LGTM: New CollectionFlowContextData interface

The CollectionFlowContextData interface is well-structured, combining both the context and configuration data for the collection flow. It correctly uses the previously defined types, ensuring type consistency throughout the application.

Consider adding a brief JSDoc comment to describe the purpose of this interface for better documentation:

/**
 * Combines the context and configuration data for the Collection Flow.
 */
export interface CollectionFlowContextData {
  context: CollectionFlowContext;
  config: CollectionFlowConfig;
}

Line range hint 1-21: Summary: Enhanced type definitions for Collection Flow

These changes introduce new type definitions that enhance the state management capabilities of the Collection Flow. The new CollectionFlowConfig and CollectionFlowContextData interfaces provide a structured way to handle UI options and combine context with configuration data.

These additions align with the PR objectives and support the implementation of redirects using context.config, although the specific redirect functionality is not visible in this file.

Ensure that these new type definitions are consistently used throughout the application, particularly in components and functions that handle the collection flow state and UI configuration.

apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.ts (1)

Line range hint 1-28: Summary: Consistent and backward-compatible changes to StateManager types.

The changes to this file are well-structured and maintain backward compatibility:

  1. Added import of CollectionFlowConfig.
  2. Added optional config property to StateManagerContext interface.
  3. Added optional config property to StateManagerProps interface.

These changes enhance the flexibility of the StateManager component by allowing the inclusion of configuration data related to collection flows. The optional nature of the new properties ensures that existing code won't break.

To ensure a smooth integration, please:

  1. Review the components that consume StateManagerContext.
  2. Check the usage of the StateManager component in the codebase.
  3. Update the documentation to reflect these new configuration options.
  4. Consider adding unit tests to cover scenarios with and without the new config property.
apps/kyb-app/src/domains/collection-flow/collection-flow.api.ts (1)

71-78: LGTM: Enhanced fetchFlowContext function.

The changes to the fetchFlowContext function improve its functionality by returning both context and configuration data. This aligns well with the PR objective of implementing redirects using context.config.

Consider adding error handling to the function. For example:

 export const fetchFlowContext = async (): Promise<CollectionFlowContextData> => {
-  const result = await request.get('collection-flow/context');
-  const resultJson = await result.json<{
-    context: CollectionFlowContext;
-    config: CollectionFlowConfig;
-  }>();
-
-  return resultJson;
+  try {
+    const result = await request.get('collection-flow/context');
+    const resultJson = await result.json<{
+      context: CollectionFlowContext;
+      config: CollectionFlowConfig;
+    }>();
+    return resultJson;
+  } catch (error) {
+    console.error('Error fetching flow context:', error);
+    throw error;
+  }
 };

This will help with debugging and provide a cleaner way to handle potential errors.

apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx (2)

35-35: Consider the necessity of this empty line.

While the addition of this empty line doesn't affect functionality and may slightly improve readability, consider if it's truly necessary. Consistent spacing throughout the codebase is generally preferable.


Optimize useMemo Dependency Array

The addition of config to the dependency array is correct and ensures that the context is updated when the configuration changes.

However, getState, sendEvent, invokePlugin, setContext, and getContext are memoized using useCallback and therefore have stable references. Their inclusion in the dependency array is unnecessary and may lead to unnecessary re-renders.

Consider removing these functions from the dependency array:

  const context: StateManagerContext = useMemo(() => {
    // ... (rest of the code remains the same)
  }, [
    state,
    contextPayload,
    isPluginLoading,
    config,
-   getState,
-   sendEvent,
-   invokePlugin,
-   setContext,
-   getContext,
  ]);
🔗 Analysis chain

Line range hint 74-79: Verify the necessity of additional dependencies in the useMemo hook.

The addition of config to the dependency array is correct and ensures that the context is updated when the configuration changes.

However, the inclusion of getState, sendEvent, invokePlugin, setContext, and getContext in the dependency array might be unnecessary. These functions are likely stable references from the useStateLogic hook. Including stable references can lead to unnecessary re-renders.

Please verify if these functions are indeed changing between renders. If they are stable, consider removing them from the dependency array:

If the functions are stable, you can refactor the code as follows:

  const context: StateManagerContext = useMemo(() => {
    // ... (rest of the code remains the same)
  }, [
    state,
    contextPayload,
    isPluginLoading,
    config,
-   getState,
-   sendEvent,
-   invokePlugin,
-   setContext,
-   getContext,
  ]);
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the functions from useStateLogic are memoized or recreated on each render

# Test: Search for the useStateLogic implementation
rg --type typescript 'export const useStateLogic' -A 20

Length of output: 92


Script:

#!/bin/bash
# Description: Check if the functions from useStateLogic are memoized or recreated on each render

# Test: Search for the useStateLogic implementation
rg --type ts 'export const useStateLogic' -A 20

Length of output: 2853


Script:

#!/bin/bash
# Description: Check if the functions from useStateLogic are memoized using useCallback

# Test: Search for the declarations of getState, sendEvent, invokePlugin, setContext, getContext wrapped with useCallback
rg --type ts '(getState|sendEvent|invokePlugin|setContext|getContext)\s*=\s*useCallback' apps/kyb-app/src/components/organisms/DynamicUI/StateManager/hooks/useStateLogic/useStateLogic.ts -A 5

Length of output: 1021

services/workflows-service/src/workflow/schemas/zod-schemas.ts (1)

66-73: LGTM! Consider adding a description for the new uiOptions property.

The addition of the uiOptions property with redirectUrls is well-structured and aligns with the PR objective of implementing redirects using context.config. The use of optional fields maintains backward compatibility and provides flexibility.

For consistency with other properties in the schema, consider adding a .describe() method to provide a brief description of the uiOptions property. For example:

 uiOptions: z
   .object({
     redirectUrls: z.object({
       success: z.string().url().optional(),
       failure: z.string().url().optional(),
     }),
   })
-  .optional(),
+  .optional()
+  .describe('UI options including redirect URLs for success and failure cases'),

This addition would improve the self-documentation of the schema.

services/workflows-service/src/collection-flow/controllers/collection-flow.controller.ts (2)

65-67: LGTM! Consider adding a comment for clarity.

The addition of config to the selection criteria is a good change that aligns with the PR objectives. It will now return the configuration data along with the context and state.

Consider adding a brief comment explaining why config was added to the selection criteria. This will help future developers understand the purpose of this change. For example:

 async getContext(@TokenScope() tokenScope: ITokenScope) {
   return await this.workflowService.getWorkflowRuntimeDataById(
     tokenScope.workflowRuntimeDataId,
+    // Include config in the selection to support redirect functionality
     { select: { context: true, state: true, config: true } },
     [tokenScope.projectId],
   );
 }

Line range hint 146-153: LGTM! Consider adding error handling.

The new resubmitFlow method is a good addition that aligns with the PR objectives. It provides a way to resubmit a flow by triggering a 'RESUBMITTED' event.

Consider adding error handling to provide more informative responses in case of failures. For example:

 @common.Post('resubmit')
 async resubmitFlow(@TokenScope() tokenScope: ITokenScope) {
-  await this.workflowService.event(
-    { id: tokenScope.workflowRuntimeDataId, name: 'RESUBMITTED' },
-    [tokenScope.projectId],
-    tokenScope.projectId,
-  );
+  try {
+    await this.workflowService.event(
+      { id: tokenScope.workflowRuntimeDataId, name: 'RESUBMITTED' },
+      [tokenScope.projectId],
+      tokenScope.projectId,
+    );
+    return { message: 'Flow resubmitted successfully' };
+  } catch (error) {
+    throw new common.InternalServerErrorException('Failed to resubmit flow');
+  }
 }

This change will provide a success message on successful resubmission and throw a more specific exception if the resubmission fails.

apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx (1)

104-104: LGTM: Improved null safety, consider further enhancement

The change to use contextData ?? {} as an argument for usePageErrors is a good defensive programming practice. It ensures that an empty object is passed if contextData is null or undefined.

Consider using optional chaining for added safety:

const pageErrors = usePageErrors(contextData?.context ?? {}, elements || []);

This ensures that we're passing the context property of contextData if it exists, or an empty object otherwise.

apps/kyb-app/src/hooks/useUIOptionsRedirect/useUIOptionsRedirect.ts (2)

11-18: Re-evaluate the necessity of useMemo for uiOptions

The useMemo hook is used to memoize uiOptions, but since the computation involves simple conditional logic with minimal performance impact, useMemo might not be necessary here. Unless there is a performance issue, consider removing useMemo to simplify the code.


20-24: Re-evaluate the necessity of useMemo for redirectUrls

Similarly, the useMemo hook for redirectUrls may not be necessary as it performs a straightforward property access. Consider removing useMemo to simplify the code unless memoization provides a clear benefit.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4020965 and 613625c.

📒 Files selected for processing (9)
  • apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx (3 hunks)
  • apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.ts (3 hunks)
  • apps/kyb-app/src/domains/collection-flow/collection-flow.api.ts (2 hunks)
  • apps/kyb-app/src/domains/collection-flow/types/flow-context.types.ts (2 hunks)
  • apps/kyb-app/src/hooks/useUIOptionsRedirect/useUIOptionsRedirect.ts (1 hunks)
  • apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx (4 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
  • services/workflows-service/src/collection-flow/controllers/collection-flow.controller.ts (1 hunks)
  • services/workflows-service/src/workflow/schemas/zod-schemas.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • services/workflows-service/prisma/data-migrations
🧰 Additional context used
🔇 Additional comments (14)
apps/kyb-app/src/domains/collection-flow/types/flow-context.types.ts (1)

1-1: LGTM: New import for UIOptions

The import of UIOptions is correctly added and will be used in the new CollectionFlowConfig interface.

apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.ts (3)

2-5: LGTM: Import addition is consistent with usage.

The addition of CollectionFlowConfig import is appropriate and aligns with its usage in the interfaces below.


28-28: LGTM: StateManagerProps interface update is consistent.

The addition of the optional config property of type CollectionFlowConfig to the StateManagerProps interface is consistent with the changes in the StateManagerContext interface and maintains backward compatibility.

To ensure this change doesn't introduce any issues, please verify the components that use StateManager and pass props to it. Run the following script to find potential usages:

#!/bin/bash
# Description: Find potential usages of StateManager component

# Search for StateManager component usage
rg --type typescript --type tsx -e "<StateManager" -A 10

15-15: LGTM: StateManagerContext interface update is appropriate.

The addition of the optional config property of type CollectionFlowConfig to the StateManagerContext interface is consistent with the import change and allows for backward compatibility.

To ensure this change doesn't introduce any issues, please verify the components that consume this context. Run the following script to find potential consumers:

✅ Verification successful

StateManagerContext config Addition Verified

No consumers of StateManagerContext were found in the codebase. The addition of the optional config property is safe and does not impact existing components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find potential consumers of StateManagerContext

# Search for useContext hooks or Context.Provider usages
rg --type typescript --type tsx -e "useContext\(StateManagerContext\)" -e "StateManagerContext.Provider"

Length of output: 187


Script:

#!/bin/bash
# Description: Find potential consumers of StateManagerContext

# Corrected search for useContext hooks or Context.Provider usages
rg -t typescript -t tsx -e "useContext\(StateManagerContext\)" -e "StateManagerContext.Provider"

Length of output: 131


Script:

#!/bin/bash
# Description: Find potential consumers of StateManagerContext

# Corrected search using glob patterns for TypeScript files
rg -g "*.ts" -g "*.tsx" -e "useContext\(StateManagerContext\)" -e "StateManagerContext.Provider"

Length of output: 96

apps/kyb-app/src/domains/collection-flow/collection-flow.api.ts (2)

10-14: LGTM: Import statements updated correctly.

The new imports for CollectionFlowConfig, CollectionFlowContext, and CollectionFlowContextData are correctly added and align with the changes in the fetchFlowContext function.


Line range hint 1-78: Summary: Improved collection flow API with enhanced context fetching.

The changes in this file successfully implement the PR objective of using context.config for redirects. The fetchFlowContext function now returns a more comprehensive data structure that includes both context and configuration. This enhancement allows for more flexible and powerful state management in the collection flow.

Key improvements:

  1. Updated import statements to include new types.
  2. Enhanced fetchFlowContext to return both context and config data.
  3. Updated return type to reflect the new data structure.

These changes provide a solid foundation for implementing redirects and other features that depend on both context and configuration data.

apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx (3)

18-18: LGTM: Addition of config prop enhances component flexibility.

The inclusion of the config prop in the StateManager component's props is a good addition. It allows for more flexible configuration of the state management logic from the parent components.


65-68: LGTM: Proper integration of config into the context.

The addition of the config prop to the context object is correct and aligns with the component's enhanced flexibility. The empty line after the object creation improves readability.


Line range hint 1-87: Overall, the changes enhance the StateManager component's flexibility.

The addition of the config prop and its integration into the context object aligns with the PR objective of implementing redirects using context.config. While the specific redirect logic is not visible in this file, these changes provide the necessary foundation for such functionality.

The modifications generally improve the component's flexibility and functionality. However, please consider the suggestions regarding the dependency array in the useMemo hook to optimize performance.

Great job on enhancing the state management capabilities!

services/workflows-service/src/workflow/schemas/zod-schemas.ts (1)

66-73: Verify the usage of uiOptions in the workflow logic

The addition of the uiOptions property to the ConfigSchema is a valuable enhancement. To ensure its proper integration:

  1. Verify that the workflow logic correctly handles the new uiOptions property, especially the redirectUrls.
  2. Update any relevant documentation or comments in other files that describe the structure of the workflow configuration.
  3. Consider adding unit tests to validate the behavior with and without the uiOptions property set.

To help verify the integration, you can run the following script to check for usage of uiOptions in the codebase:

This will help identify where the new property is being used and ensure it's properly integrated into the workflow logic.

✅ Verification successful

Regenerating verification scripts to accurately search for uiOptions usage

The previous script encountered issues with the --type typescript flag. Please run the following corrected script to search for uiOptions and redirectUrls usage in TypeScript files:


Verified usage of uiOptions in the workflow logic

The uiOptions property is properly integrated across the codebase, ensuring its correct handling in the workflow logic:

  • Schema and Models:

    • services/workflows-service/src/workflow/schemas/zod-schemas.ts
    • services/workflows-service/src/ui-definition/ui-definition.model.ts
  • Services and Hooks:

    • services/workflows-service/src/collection-flow/collection-flow.service.ts
    • apps/kyb-app/src/hooks/useUIOptionsRedirect/useUIOptionsRedirect.ts
  • Components:

    • apps/kyb-app/src/pages/CollectionFlow/components/pages/Success/Success.tsx
    • apps/kyb-app/src/pages/CollectionFlow/components/pages/Failed/Failed.tsx
  • Type Definitions:

    • apps/kyb-app/src/domains/collection-flow/types/flow-context.types.ts
    • apps/kyb-app/src/domains/collection-flow/types/index.ts

All instances appropriately handle the uiOptions and redirectUrls properties, ensuring the new configuration's seamless integration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usage of uiOptions in the codebase

# Test: Search for uiOptions usage
echo "Searching for uiOptions usage:"
rg --type typescript -i 'uiOptions'

# Test: Search for redirectUrls usage
echo "\nSearching for redirectUrls usage:"
rg --type typescript -i 'redirectUrls'

# Test: Search for config.uiOptions usage
echo "\nSearching for config.uiOptions usage:"
rg --type typescript -i 'config\.uiOptions'

Length of output: 466


Script:

#!/bin/bash
# Description: Corrected search for uiOptions and redirectUrls in TypeScript files

# Search for uiOptions usage
echo "Searching for uiOptions usage in .ts and .tsx files:"
rg --glob '*.ts' --glob '*.tsx' -i 'uiOptions' .

# Search for redirectUrls usage
echo -e "\nSearching for redirectUrls usage in .ts and .tsx files:"
rg --glob '*.ts' --glob '*.tsx' -i 'redirectUrls' .

# Search for config.uiOptions usage
echo -e "\nSearching for config.uiOptions usage in .ts and .tsx files:"
rg --glob '*.ts' --glob '*.tsx' -i 'config\.uiOptions' .

Length of output: 4340

apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx (4)

65-73: LGTM: Improved clarity in context handling

The renaming of context to contextData and the subsequent changes in accessing the context property enhance code readability and maintain consistency. This change aligns well with the modifications described in the AI-generated summary.

Also applies to: 79-83


96-96: LGTM: Consistent naming convention

The renaming of context to contextData in the useFlowContextQuery hook maintains consistency with the changes made in the useCompleteLastStep hook. This improves overall code clarity.


116-116: LGTM: Consistent context access

The changes in accessing the context property from contextData in the initialContext useMemo hook are consistent with the earlier modifications. This ensures that the initial context is correctly derived from the updated data structure.

Also applies to: 122-122, 124-124


132-132: LGTM: Consistent changes and new config prop

The modifications in accessing the context property from contextData in the initialUIState useMemo hook and the component's return statement are consistent with earlier changes, maintaining code clarity.

The addition of the config prop to the DynamicUI.StateManager component appears to be a new feature. This aligns with the PR objective of "implemented redirects using context.config".

Could you provide more information about the purpose and contents of the config prop? This will help ensure it's being used correctly and consistently across the application.

To verify the usage of this new prop, let's run the following script:

Also applies to: 151-151, 159-159

✅ Verification successful

LGTM: Consistent implementation of config prop

The addition of the config prop to the DynamicUI.StateManager component is consistent with existing usage of config objects across the codebase. No other StateManager components currently use the config prop, indicating that this change is a new and isolated implementation aligning with the PR objectives.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of the config prop in StateManager components

# Search for StateManager components with a config prop
echo "Searching for StateManager components with a config prop:"
rg --type typescript --type tsx "StateManager.*config\s*=" -g '!*test*'

# Search for the structure of the config object
echo "\nSearching for the structure of the config object:"
rg --type typescript --type tsx "config\s*:\s*{" -A 10 -g '!*test*'

Length of output: 508


Script:

#!/bin/bash
# Description: Check for other occurrences of the config prop in StateManager components

# Search for StateManager components with a config prop
echo "Searching for StateManager components with a config prop:"
rg -t ts -t tsx 'StateManager.*config\s*=' -g '!(*test*)'

# Search for the structure of the config object
echo "\nSearching for the structure of the config object:"
rg -t ts -t tsx 'config\s*:\s*\{' -A 10 -g '!(*test*)'

Length of output: 410


Script:

#!/bin/bash
# Description: Check for other occurrences of the config prop in StateManager components

# Search for StateManager components with a config prop
echo "Searching for StateManager components with a config prop:"
rg 'StateManager.*config\s*=' -g "*.ts" -g "*.tsx" -g "!*test*"

# Search for the structure of the config object
echo "\nSearching for the structure of the config object:"
rg 'config\s*:\s*\{' -A 10 -g "*.ts" -g "*.tsx" -g "!*test*"

Length of output: 33940

Comment on lines +27 to 31
if (redirectUrls?.[state]) {
const redirectUrl = redirectUrls[state] as string;
console.info(`Collection Flow resolved to ${state}. Redirecting to ${redirectUrl}`);
location.href = redirectUrls[state] as string;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Validate redirect URLs to prevent potential security risks

Since the redirect URLs are sourced from configuration or data, there is a potential risk if these URLs are not validated. To prevent open redirect vulnerabilities, consider adding validation to ensure that the redirectUrl is an allowed domain or matches an expected pattern before performing the redirection.

@alonp99 alonp99 enabled auto-merge (squash) October 8, 2024 18:59
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: 3

🧹 Outside diff range and nitpick comments (7)
services/websocket-service/CHANGELOG.md (1)

3-7: LGTM! Consider more descriptive change messages in the future.

The new changelog entry for version 0.1.21 is correctly formatted and consistent with previous entries. The version number is appropriately incremented.

For future updates, consider providing more descriptive change messages instead of just "bump". This would help users understand what has changed between versions.

packages/common/package.json (1)

5-5: LGTM! Version and dependency updates look good.

The package version has been bumped from 0.9.37 to 0.9.39, and the @ballerine/config and @ballerine/eslint-config dependencies have been updated to version ^1.1.21. These changes are consistent with ongoing package maintenance.

Don't forget to update the CHANGELOG.md file if there are any user-facing changes in this version update.

Also applies to: 41-42

packages/eslint-config-react/CHANGELOG.md (1)

3-17: LGTM! Consider adding more details to changelog entries.

The new changelog entries for versions 2.0.21 and 2.0.20 are consistent with the existing format and provide the necessary information about version bumps and dependency updates. Good job on maintaining consistency!

For improved clarity, consider adding a brief description of any notable changes or the reason for the bump in each entry. For example:

## 2.0.21

### Patch Changes

- Bump for maintenance and dependency alignment
- Updated dependencies
  - @ballerine/eslint-config@1.1.21

This additional context can help users understand the purpose of each release more easily.

packages/common/src/schemas/documents/workflow/config-schema.ts (1)

36-45: Good addition of uiOptions for redirect URL configuration.

The new uiOptions property in WorkflowRuntimeConfigSchema allows for flexible configuration of success and failure redirect URLs. Making it optional maintains backward compatibility.

However, consider enforcing HTTPS for the redirect URLs to enhance security:

 const uiOptions = Type.Optional(
   Type.Object({
     redirectUrls: Type.Optional(
       Type.Object({
-        success: Type.String({ format: 'uri' }),
-        failure: Type.String({ format: 'uri' }),
+        success: Type.String({ format: 'uri', pattern: '^https://' }),
+        failure: Type.String({ format: 'uri', pattern: '^https://' }),
       }),
     ),
   }),
 );

This change would align the security requirements with the SubscriptionSchema.url field.

Also applies to: 51-51

apps/workflows-dashboard/CHANGELOG.md (1)

3-20: LGTM! Consider adding more details to changelog entries.

The new changelog entries for versions 0.2.21 and 0.2.20 are correctly formatted and consistent with previous entries. They provide clear information about version bumps and dependency updates.

To improve the changelog's usefulness, consider adding brief descriptions of notable changes or features introduced in each version, if applicable. This can help users understand the impact of each update more easily.

sdks/workflow-browser-sdk/CHANGELOG.md (2)

3-10: LGTM! Consider adding more details to changelog entries.

The latest version update (0.6.51) follows the established pattern of previous entries, including dependency updates for @ballerine/workflow-core and @ballerine/common. This consistency is good for maintaining a clear version history.

To improve the changelog's usefulness, consider adding brief descriptions of any notable changes, bug fixes, or new features introduced in each version, even for patch updates. This would provide more context for users and developers.


Line range hint 1-1000: Consider enhancing the changelog structure and content.

The changelog provides a comprehensive version history, which is valuable. However, there are a few areas where it could be improved:

  1. Recent entries lack detailed descriptions of changes, making it difficult for users to understand what each version introduces.
  2. There's a mix of patch and minor version updates, but the significance of these updates isn't always clear from the entries.

Consider the following improvements:

  1. Add brief descriptions of notable changes, bug fixes, or new features for each version, even for patch updates.
  2. Clearly differentiate between patch, minor, and major version updates, explaining the reasoning behind each.
  3. Group changes into categories (e.g., "Features", "Bug Fixes", "Performance Improvements") for easier reading.
  4. Maintain a consistent format throughout the changelog, including for older versions.

These changes would make the changelog more informative and useful for both users and developers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 613625c and 487bc8d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (41)
  • apps/backoffice-v2/CHANGELOG.md (1 hunks)
  • apps/backoffice-v2/package.json (3 hunks)
  • apps/kyb-app/CHANGELOG.md (1 hunks)
  • apps/kyb-app/package.json (3 hunks)
  • apps/workflows-dashboard/CHANGELOG.md (1 hunks)
  • apps/workflows-dashboard/package.json (3 hunks)
  • examples/headless-example/CHANGELOG.md (1 hunks)
  • examples/headless-example/package.json (2 hunks)
  • examples/report-generation-example/CHANGELOG.md (1 hunks)
  • examples/report-generation-example/package.json (2 hunks)
  • packages/blocks/CHANGELOG.md (1 hunks)
  • packages/blocks/package.json (3 hunks)
  • packages/common/CHANGELOG.md (1 hunks)
  • packages/common/package.json (2 hunks)
  • packages/common/src/schemas/documents/workflow/config-schema.ts (2 hunks)
  • packages/config/CHANGELOG.md (1 hunks)
  • packages/config/package.json (1 hunks)
  • packages/eslint-config-react/CHANGELOG.md (1 hunks)
  • packages/eslint-config-react/package.json (2 hunks)
  • packages/eslint-config/CHANGELOG.md (1 hunks)
  • packages/eslint-config/package.json (1 hunks)
  • packages/react-pdf-toolkit/CHANGELOG.md (1 hunks)
  • packages/react-pdf-toolkit/package.json (2 hunks)
  • packages/rules-engine/CHANGELOG.md (1 hunks)
  • packages/rules-engine/package.json (2 hunks)
  • packages/ui/CHANGELOG.md (1 hunks)
  • packages/ui/package.json (3 hunks)
  • packages/workflow-core/CHANGELOG.md (1 hunks)
  • packages/workflow-core/package.json (3 hunks)
  • sdks/web-ui-sdk/CHANGELOG.md (1 hunks)
  • sdks/web-ui-sdk/package.json (2 hunks)
  • sdks/workflow-browser-sdk/CHANGELOG.md (1 hunks)
  • sdks/workflow-browser-sdk/package.json (2 hunks)
  • sdks/workflow-node-sdk/CHANGELOG.md (1 hunks)
  • sdks/workflow-node-sdk/package.json (2 hunks)
  • services/websocket-service/CHANGELOG.md (1 hunks)
  • services/websocket-service/package.json (1 hunks)
  • services/workflows-service/CHANGELOG.md (1 hunks)
  • services/workflows-service/package.json (3 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
  • websites/docs/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (23)
  • apps/backoffice-v2/CHANGELOG.md
  • apps/kyb-app/CHANGELOG.md
  • apps/workflows-dashboard/package.json
  • examples/headless-example/CHANGELOG.md
  • examples/headless-example/package.json
  • examples/report-generation-example/CHANGELOG.md
  • examples/report-generation-example/package.json
  • packages/blocks/CHANGELOG.md
  • packages/common/CHANGELOG.md
  • packages/config/CHANGELOG.md
  • packages/config/package.json
  • packages/eslint-config-react/package.json
  • packages/eslint-config/CHANGELOG.md
  • packages/eslint-config/package.json
  • packages/react-pdf-toolkit/CHANGELOG.md
  • packages/rules-engine/CHANGELOG.md
  • packages/ui/CHANGELOG.md
  • packages/workflow-core/CHANGELOG.md
  • sdks/web-ui-sdk/CHANGELOG.md
  • sdks/workflow-node-sdk/CHANGELOG.md
  • services/websocket-service/package.json
  • services/workflows-service/CHANGELOG.md
  • services/workflows-service/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • services/workflows-service/prisma/data-migrations
🧰 Additional context used
🔇 Additional comments (46)
websites/docs/package.json (3)

26-26: LGTM. Patch update for devDependency.

The update of @ballerine/config from ^1.1.19 to ^1.1.21 is a patch version change, which should include bug fixes and minor improvements. This change follows semantic versioning principles and, as a devDependency, should not directly affect the production build.


27-27: LGTM. Patch update for devDependency, consistent with @ballerine/config.

The update of @ballerine/eslint-config from ^1.1.19 to ^1.1.21 is a patch version change, which should include bug fixes and minor improvements. This change follows semantic versioning principles and, as a devDependency, should not directly affect the production build.

Note that this update is identical to the @ballerine/config update, suggesting these packages might be related or updated together.


20-20: LGTM. Verify compatibility with other dependencies.

The update of @ballerine/common from ^0.9.37 to ^0.9.39 is a minor version change, which should introduce new features or non-breaking changes. This change follows semantic versioning principles.

To ensure this update doesn't introduce any conflicts, please run the following command to check for any warnings or errors:

packages/react-pdf-toolkit/package.json (3)

4-4: LGTM: Version update is appropriate.

The version bump from 1.2.36 to 1.2.37 follows semantic versioning principles, indicating minor changes or new features without breaking changes.


30-30: Dependency update looks good, but review changes in @ballerine/ui.

The @ballerine/ui dependency has been updated from 0.5.36 to 0.5.37. This patch version bump should only contain bug fixes. However, it's advisable to review the changes in the @ballerine/ui package to ensure they align with your expectations.

To review the changes in @ballerine/ui, please run the following script:

#!/bin/bash
# Description: Check for changes in @ballerine/ui between versions 0.5.36 and 0.5.37

# Test: Fetch the changelog or commit messages for @ballerine/ui
gh api repos/ballerine-io/ballerine/commits \
  --jq '.[] | select(.commit.message | test("@ballerine/ui.*0\\.5\\.37")) | .commit.message'

# This will display the commit messages related to @ballerine/ui version 0.5.37

29-29: Dependency update looks good, but verify compatibility.

The @ballerine/config dependency has been updated from ^1.1.19 to ^1.1.21. This minor version bump should not introduce breaking changes, but it's always good to verify compatibility.

To ensure there are no breaking changes, please run the following script:

✅ Verification successful

Dependency update verified and approved.

The @ballerine/config dependency has been updated from ^1.1.19 to ^1.1.21. No breaking changes were found in the commit messages.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes in @ballerine/config between versions 1.1.19 and 1.1.21

# Test: Look for BREAKING CHANGE or BREAKING CHANGES in the commit messages
gh api repos/ballerine-io/ballerine/commits \
  --jq '.[] | select(.commit.message | test("@ballerine/config.*1\\.1\\.(20|21)")) | .commit.message' \
  | grep -i "BREAKING CHANGE"

# If the above command doesn't return any results, it means no breaking changes were found in the commit messages.

Length of output: 230


Script:

#!/bin/bash
# Description: Check for any breaking changes in @ballerine/config between versions 1.1.19 and 1.1.21

# Test: Look for BREAKING CHANGE or BREAKING CHANGES in the commit messages
gh api repos/ballerine-io/ballerine/commits \
  --jq '.[] | select(.commit.message | test("@ballerine/config.*1\\.1\\.(19|20|21)")) | .commit.message' \
  | grep -i "BREAKING CHANGE"

# If the above command doesn't return any results, it means no breaking changes were found in the commit messages.

Length of output: 176

packages/rules-engine/package.json (1)

4-4: LGTM! Version updates look good.

The package version and dependency versions have been updated consistently:

  • Package version: 0.5.19 → 0.5.21
  • @ballerine/config: ^1.1.19 → ^1.1.21
  • @ballerine/eslint-config: ^1.1.19 → ^1.1.21

These minor version bumps suggest backward-compatible new features or bug fixes.

To ensure these updates are intentional and align with recent changes, please run the following script:

This script will help verify if there are corresponding changelog entries for these version updates.

Also applies to: 37-37, 39-39

✅ Verification successful

Verified! All version updates have corresponding changelog entries.

The updates in packages/rules-engine/package.json are documented as follows:

  • Package version: 0.5.19 → 0.5.21
  • @ballerine/config: ^1.1.19 → ^1.1.21
  • @ballerine/eslint-config: ^1.1.19 → ^1.1.21

Changelog entries for each updated version have been confirmed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the changelog entries for the updated packages

# Check for changelog entries in @ballerine/config
echo "Checking @ballerine/config changelog:"
rg --type md -i "## 1\.1\.2[01]" "packages/config/CHANGELOG.md" -A 10

echo "Checking @ballerine/eslint-config changelog:"
rg --type md -i "## 1\.1\.2[01]" "packages/eslint-config/CHANGELOG.md" -A 10

echo "Checking @ballerine/rules-engine-lib changelog:"
rg --type md -i "## 0\.5\.2[01]" "packages/rules-engine/CHANGELOG.md" -A 10

Length of output: 874

sdks/workflow-node-sdk/package.json (3)

39-39: DevDependency update for @ballerine/config looks good.

The @ballerine/config devDependency has been updated from ^1.1.19 to ^1.1.21. This patch version update for a development dependency is appropriate and shouldn't affect the runtime behavior of the package.


41-41: DevDependency update for @ballerine/eslint-config looks good.

The @ballerine/eslint-config devDependency has been updated from ^1.1.19 to ^1.1.21, consistent with the @ballerine/config update. This patch version update for a development dependency is appropriate and shouldn't affect the runtime behavior of the package.


31-31: Dependency version update looks good. Verify compatibility.

The @ballerine/workflow-core dependency has been updated to match the new package version (0.6.51). This is consistent with keeping related packages in sync.

Please ensure that the changes in the workflow-core package are compatible with this package. You can verify this by checking the CHANGELOG.md of the workflow-core package:

sdks/workflow-browser-sdk/package.json (6)

4-4: LGTM: Package version updated.

The package version has been incremented from 0.6.49 to 0.6.51, which is consistent with the updates made to the dependencies.


36-36: LGTM: @ballerine/common dependency updated.

The @ballerine/common dependency has been updated from 0.9.37 to 0.9.39, which is a patch version update. This update is consistent with the package version increment.


37-37: LGTM: @ballerine/workflow-core dependency updated and synced.

The @ballerine/workflow-core dependency has been updated from 0.6.49 to 0.6.51, matching the package version update exactly. This synchronization is good practice for closely related packages.


44-44: LGTM: @ballerine/config devDependency updated.

The @ballerine/config development dependency has been updated from ^1.1.19 to ^1.1.21. This patch update ensures the development environment uses the latest compatible version.


46-46: LGTM: @ballerine/eslint-config devDependency updated and synced.

The @ballerine/eslint-config development dependency has been updated from ^1.1.19 to ^1.1.21, matching the @ballerine/config update. This synchronization is good practice for related development tools.


4-4: Summary: Package and dependency versions updated consistently.

The package.json file has been updated with consistent version bumps across the main package and its dependencies:

  1. The package version has been incremented from 0.6.49 to 0.6.51.
  2. Core dependencies (@ballerine/common and @ballerine/workflow-core) have been updated to match or align with the package version.
  3. Development dependencies (@ballerine/config and @ballerine/eslint-config) have been synchronized to ^1.1.21.

These updates maintain version consistency across the project and its dependencies, which is a good practice for ensuring compatibility and incorporating the latest features or bug fixes.

Also applies to: 36-37, 44-44, 46-46

packages/workflow-core/package.json (4)

4-4: Version update looks good.

The package version has been incremented from 0.6.49 to 0.6.51, which is consistent with the addition of a new feature as mentioned in the PR title.


47-47: Dev dependency update for @ballerine/config is appropriate.

The @ballerine/config dev dependency has been updated from ^1.1.19 to ^1.1.21. This patch version update for a development dependency is likely for improved development tools or processes and doesn't affect the runtime behavior of the package.


48-48: Dev dependency update for @ballerine/eslint-config is appropriate.

The @ballerine/eslint-config dev dependency has been updated from ^1.1.19 to ^1.1.21, consistent with the @ballerine/config update. This suggests a coordinated update of related development tools.

As ESLint config updates may involve rule changes, it's recommended to review any potential changes in the ESLint rules. You can do this by running:

#!/bin/bash
# Description: Check for changes in ESLint rules

# Test: Compare ESLint rules between versions
npm info @ballerine/eslint-config@1.1.19 eslintConfig > old_rules.json
npm info @ballerine/eslint-config@1.1.21 eslintConfig > new_rules.json
diff -u old_rules.json new_rules.json || true
rm old_rules.json new_rules.json

Review any differences in the ESLint rules to ensure they align with the project's coding standards.


34-34: Dependency update for @ballerine/common looks good, but verify compatibility.

The @ballerine/common dependency has been updated from 0.9.37 to 0.9.39. This minor version update is likely related to the new feature implementation.

Please ensure that this update is intentional and compatible with the changes in the current package. You can verify this by running the following command:

If any breaking changes are found, please review them carefully to ensure compatibility with the current package.

apps/kyb-app/package.json (8)

4-4: LGTM: Version update is appropriate.

The minor version increment from 0.3.63 to 0.3.64 is consistent with semantic versioning principles for non-breaking changes or small feature additions.


4-4: Overall assessment: Updates look good, but verify compatibility.

The package.json updates include a minor version increment for the project and several dependency updates. While these changes appear to be minor and shouldn't introduce breaking changes, it's crucial to:

  1. Review the changelogs for each updated package to understand the changes introduced.
  2. Run the project's test suite to ensure no regressions.
  3. Perform a manual smoke test of the application to verify that all functionality remains intact.
  4. Update any documentation or README files if necessary to reflect any new features or changes in dependencies.

To ensure overall project stability, please run the following commands:

#!/bin/bash
# Description: Verify project stability after dependency updates

# Test 1: Install dependencies
echo "Installing dependencies..."
npm install

# Test 2: Run test suite
echo "Running test suite..."
npm test

# Test 3: Build the project
echo "Building the project..."
npm run build

# Note: Manual smoke testing should be performed after these steps.

Also applies to: 17-20, 65-66


66-66: LGTM: ESLint config update approved, review linting rules.

The update of @ballerine/eslint-config-react from ^2.0.19 to ^2.0.21 is a minor version increment for the ESLint configuration. While it won't affect runtime behavior, it may introduce changes to linting rules that could impact your development process.

Please review any changes to the ESLint rules that might have been introduced with this update. You can use the following command to check for recent changes and potentially affected files:

#!/bin/bash
# Description: Check for recent changes in the changelog of @ballerine/eslint-config-react and find potentially affected files

# Test 1: Display recent changes in the changelog
echo "Recent changes in @ballerine/eslint-config-react:"
rg -A 5 "## \[2\.0\.(20|21)\]" $(fd -t f "CHANGELOG.md" | grep -i "eslint-config-react")

# Test 2: Find potentially affected files (JavaScript and TypeScript files)
echo -e "\nPotentially affected files:"
fd -e js -e jsx -e ts -e tsx

18-18: LGTM: Dependency update is appropriate.

The update of @ballerine/common from ^0.9.37 to ^0.9.39 is a minor version increment, which may include new features or improvements.

Please review the changelog for any new features or improvements that might be relevant to this project. You can use the following command to check the recent changes:

#!/bin/bash
# Description: Check for recent changes in the changelog of @ballerine/common

# Test: Display recent changes in the changelog
rg -A 10 "## \[0\.9\.(38|39)\]" $(fd -t f "CHANGELOG.md" | grep -i "ballerine-common")

19-19: LGTM: UI dependency update looks good.

The update of @ballerine/ui from 0.5.36 to 0.5.37 is a minor patch version increment, which typically indicates bug fixes or minor improvements.

Please check if there are any relevant bug fixes or improvements in this update that affect your project. You can use the following command to review recent changes:

#!/bin/bash
# Description: Check for recent changes in the changelog of @ballerine/ui

# Test: Display recent changes in the changelog
rg -A 5 "## \[0\.5\.37\]" $(fd -t f "CHANGELOG.md" | grep -i "ballerine-ui")

20-20: LGTM: Workflow SDK update approved, but requires attention.

The update of @ballerine/workflow-browser-sdk from 0.6.49 to 0.6.51 is a minor version increment that spans two patch versions. This could include multiple changes, new features, or improvements.

Given the potential scope of changes, please thoroughly review the changelog for any significant updates or new features that might affect your project. You can use the following command to check the recent changes:

#!/bin/bash
# Description: Check for recent changes in the changelog of @ballerine/workflow-browser-sdk

# Test: Display recent changes in the changelog
rg -A 10 "## \[0\.6\.(50|51)\]" $(fd -t f "CHANGELOG.md" | grep -i "workflow-browser-sdk")

65-65: LGTM: Config devDependency update approved.

The update of @ballerine/config from ^1.1.19 to ^1.1.21 is a minor version increment for a development dependency. While it shouldn't directly affect the runtime behavior, it may impact the build process.

Please review any changes to the build configuration or process that might have been introduced with this update. You can use the following command to check for recent changes:


17-17: LGTM: Dependency update looks good.

The update of @ballerine/blocks from 0.2.21 to 0.2.23 is a minor patch version increment, which typically indicates bug fixes or minor improvements.

Please ensure that this update is compatible with the current implementation and doesn't introduce any breaking changes. You can verify this by running the following command:

✅ Verification successful

Verified: No breaking changes or deprecations found in @ballerine/blocks changelog.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes or deprecations in the changelog of @ballerine/blocks

# Test: Search for breaking changes or deprecations in the changelog
rg -i "breaking change|deprecat" $(fd -t f "CHANGELOG.md" | grep -i "ballerine-blocks")

Length of output: 291


Script:

#!/bin/bash
# Description: Check for any breaking changes or deprecations in the changelog of @ballerine-blocks

# Test: Search for breaking changes or deprecations in the changelog
rg -i "breaking change|deprecat" $(fd -t f "CHANGELOG.md" | grep -i "ballerine-blocks")

Length of output: 8385

packages/blocks/package.json (2)

45-46: DevDependencies updates look good.

The updates to "@ballerine/eslint-config" and "@ballerine/config" from version 1.1.19 to 1.1.21 are minor and likely include bug fixes or small improvements.

To ensure these updates don't introduce any breaking changes or conflicts, please run the following script:

#!/bin/bash
# Install dependencies and run tests
pnpm install
pnpm run test

# Check for any deprecation warnings or errors in the build process
pnpm run build

echo "If all commands completed successfully without errors, the updates are likely compatible."

93-93: Dependency update looks good.

The update to "@ballerine/common" from version 0.9.37 to 0.9.39 is a patch version update and likely includes bug fixes or very small improvements.

To ensure this update doesn't introduce any breaking changes or conflicts, please run the following script:

#!/bin/bash
# Install dependencies and run tests
pnpm install
pnpm run test

# Check for any deprecation warnings or errors in the build process
pnpm run build

# Check if there are any changes in the API of @ballerine/common
if command -v npm-diff &> /dev/null; then
  npm-diff --diff-version "@ballerine/common@0.9.37" "@ballerine/common@0.9.39"
else
  echo "npm-diff is not installed. Consider installing it to check for API changes."
fi

echo "If all commands completed successfully without errors, the update is likely compatible."
packages/common/src/schemas/documents/workflow/config-schema.ts (1)

5-5: Excellent security improvement for the url field!

The updated url field definition in SubscriptionSchema now enforces stricter validation:

  1. It must conform to the 'uri' format, ensuring well-formed URLs.
  2. It must start with 'https://', improving security by mandating HTTPS.

This change enhances both the security and data integrity of the subscription URLs.

packages/ui/package.json (4)

4-4: Version bump looks good.

The minor version increment from 0.5.36 to 0.5.37 is appropriate for new features or non-breaking changes. This change adheres to semantic versioning principles.


29-29: Dependency update for @ballerine/common looks good, but needs verification.

The update of @ballerine/common from ^0.9.37 to ^0.9.39 is a minor version bump. While this should not introduce breaking changes, it's important to verify that this update is intentional and related to the PR's objectives.

Please confirm that this dependency update is necessary for the implementation of redirects using context.config. If it's not directly related, could you explain the reason for this update?


68-68: Dev dependency update for @ballerine/config looks good, but needs verification.

The update of @ballerine/config from ^1.1.19 to ^1.1.21 is a patch version bump for a dev dependency. While this shouldn't affect the runtime behavior of the package, it's important to verify that this update doesn't introduce any issues in the development process.

Could you confirm that this dev dependency update is necessary and doesn't cause any conflicts or issues in the development environment?


69-69: Dev dependency update for @ballerine/eslint-config-react looks good, but needs verification.

The update of @ballerine/eslint-config-react from ^2.0.19 to ^2.0.21 is a patch version bump for a dev dependency. While this shouldn't affect the runtime behavior of the package, it's important to verify that this update doesn't introduce any new linting errors or warnings.

Could you confirm that this ESLint config update is necessary and doesn't introduce any new linting issues in the codebase?

sdks/web-ui-sdk/package.json (2)

99-99: LGTM: Dependency update looks good.

The @ballerine/common dependency has been updated from version 0.9.37 to 0.9.39, which is consistent with keeping dependencies up-to-date.

Let's verify if there are any breaking changes in the @ballerine/common package between versions 0.9.37 and 0.9.39:

#!/bin/bash
# Check for breaking changes in @ballerine/common between 0.9.37 and 0.9.39
echo "Checking for breaking changes in @ballerine/common between 0.9.37 and 0.9.39"
rg -i "breaking changes?" $(fd -t f CHANGELOG.md -p packages/common)

24-24: LGTM: Version bump looks good.

The package version has been updated from 1.5.38 to 1.5.40, which is consistent with a minor update.

Let's verify if there are corresponding changes in the changelog:

apps/backoffice-v2/package.json (9)

3-3: LGTM: Version bump is appropriate.

The project version has been incremented from 0.7.52 to 0.7.54, which is consistent with the changes made in this PR.


129-129: LGTM: DevDependency @ballerine/config updated.

The @ballerine/config package has been updated from ^1.1.19 to ^1.1.21. This minor version update in a development dependency is likely to include improvements or bug fixes for the development environment.


57-57: Verify compatibility with updated @ballerine/workflow-browser-sdk.

The @ballerine/workflow-browser-sdk package has been updated from 0.6.49 to 0.6.51. This minor version update is likely related to the new features or bug fixes in this PR.

Please ensure that the changes in @ballerine/workflow-browser-sdk v0.6.51 are compatible with the current implementation. Run the following command to check for any breaking changes or new features:

#!/bin/bash
# Description: Check for changes in @ballerine/workflow-browser-sdk between versions 0.6.49 and 0.6.51

# Fetch the changelog or commit history for @ballerine/workflow-browser-sdk
gh repo view ballerine-io/ballerine --json url -q .url | xargs -I {} gh api {}/commits?path=packages/workflow-browser-sdk&per_page=50 | jq -r '.[] | select(.commit.message | contains("0.6.5") and (contains("feat") or contains("fix") or contains("BREAKING CHANGE"))) | "- " + .commit.message' | sed 's/^- //' | sed 's/:.*/:/'

3-3: Summary of package.json changes

The changes in this file consist of minor version updates to several @ballerine packages and a project version bump. These updates are likely related to the new features or bug fixes introduced in this PR. While the changes appear to be routine maintenance, it's important to:

  1. Verify compatibility with the updated packages, especially for @ballerine/blocks, @ballerine/common, @ballerine/react-pdf-toolkit, @ballerine/ui, and @ballerine/workflow-browser-sdk.
  2. Run the test suite to ensure that the updates haven't introduced any regressions.
  3. Check the changelogs or commit histories of the updated packages to understand the specific changes and their potential impact on the project.

To ensure overall compatibility and stability, please run the full test suite:

#!/bin/bash
# Description: Run the full test suite to check for any regressions

# Run tests
npm run test

Also applies to: 53-58, 129-130


130-130: Verify linting with updated @ballerine/eslint-config-react.

The @ballerine/eslint-config-react package has been updated from ^2.0.19 to ^2.0.21. This minor version update in the ESLint configuration may introduce new or modified linting rules.

Please run the linter to ensure that the updated ESLint configuration doesn't introduce any new linting errors:

#!/bin/bash
# Description: Run ESLint to check for any new linting errors

# Run ESLint
npm run lint

54-54: Verify compatibility with updated @ballerine/common.

The @ballerine/common package has been updated from 0.9.37 to 0.9.39. This minor version update is likely related to the new features or bug fixes in this PR.

Please ensure that the changes in @ballerine/common v0.9.39 are compatible with the current implementation. Run the following command to check for any breaking changes or new features:

#!/bin/bash
# Description: Check for changes in @ballerine/common between versions 0.9.37 and 0.9.39

# Fetch the changelog or commit history for @ballerine/common
gh repo view ballerine-io/ballerine --json url -q .url | xargs -I {} gh api {}/commits?path=packages/common&per_page=50 | jq -r '.[] | select(.commit.message | contains("0.9.3") and (contains("feat") or contains("fix") or contains("BREAKING CHANGE"))) | "- " + .commit.message' | sed 's/^- //' | sed 's/:.*/:/'

55-55: Verify compatibility with updated @ballerine/react-pdf-toolkit.

The @ballerine/react-pdf-toolkit package has been updated from ^1.2.35 to ^1.2.37. This minor version update may introduce new features or bug fixes.

Please ensure that the changes in @ballerine/react-pdf-toolkit v1.2.37 are compatible with the current implementation. Run the following command to check for any breaking changes or new features:

#!/bin/bash
# Description: Check for changes in @ballerine/react-pdf-toolkit between versions 1.2.35 and 1.2.37

# Fetch the changelog or commit history for @ballerine/react-pdf-toolkit
gh repo view ballerine-io/ballerine --json url -q .url | xargs -I {} gh api {}/commits?path=packages/react-pdf-toolkit&per_page=50 | jq -r '.[] | select(.commit.message | contains("1.2.3") and (contains("feat") or contains("fix") or contains("BREAKING CHANGE"))) | "- " + .commit.message' | sed 's/^- //' | sed 's/:.*/:/'

53-53: Verify compatibility with updated @ballerine/blocks.

The @ballerine/blocks package has been updated from 0.2.21 to 0.2.23. This minor version update is likely related to the new features or bug fixes in this PR.

Please ensure that the changes in @ballerine/blocks v0.2.23 are compatible with the current implementation. Run the following command to check for any breaking changes or new features:


56-56: Verify compatibility with updated @ballerine/ui.

The @ballerine/ui package has been updated from ^0.5.35 to ^0.5.37. This minor version update may introduce new features or bug fixes.

Please ensure that the changes in @ballerine/ui v0.5.37 are compatible with the current implementation. Run the following command to check for any breaking changes or new features:

@@ -1,7 +1,7 @@
{
"name": "@ballerine/workflow-node-sdk",
"author": "Ballerine <dev@ballerine.com>",
"version": "0.6.49",
"version": "0.6.51",
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

**CHANGELOG.md is missing. Please add a CHANGELOG.md and document the changes in version 0.6.51.**

- Add CHANGELOG.md to the repository.
- Document the updates corresponding to version 0.6.51.

🔗 Analysis chain

Version bump looks good. Don't forget to update CHANGELOG.md.

The package version has been incremented from 0.6.49 to 0.6.51, which is appropriate for new features or non-breaking changes.

Please ensure that the CHANGELOG.md file has been updated to reflect the changes in this new version. You can verify this with the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if CHANGELOG.md exists and has been updated with the new version

# Test 1: Check if CHANGELOG.md exists
if [ -f CHANGELOG.md ]; then
  echo "CHANGELOG.md exists."
  
  # Test 2: Check if the new version is mentioned in CHANGELOG.md
  if grep -q "0.6.51" CHANGELOG.md; then
    echo "Version 0.6.51 is mentioned in CHANGELOG.md"
  else
    echo "Warning: Version 0.6.51 is not mentioned in CHANGELOG.md"
  fi
else
  echo "Warning: CHANGELOG.md does not exist in the root directory"
fi

Length of output: 152

@@ -2,7 +2,7 @@
"private": false,
"name": "@ballerine/blocks",
"author": "Ballerine <dev@ballerine.com>",
"version": "0.2.21",
"version": "0.2.23",
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

CHANGELOG.md Missing

The CHANGELOG.md file does not exist in the root directory. Please add a CHANGELOG.md to document the changes related to this version update.

🔗 Analysis chain

Version bump looks good.

The package version has been updated from 0.2.21 to 0.2.23, which is appropriate for new features or non-breaking changes.

Please ensure that the CHANGELOG.md file (if it exists) has been updated to reflect the changes in this new version. You can verify this with the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if CHANGELOG.md exists and if it contains the new version number
if [ -f CHANGELOG.md ]; then
  if grep -q "0.2.23" CHANGELOG.md; then
    echo "CHANGELOG.md has been updated with version 0.2.23"
  else
    echo "CHANGELOG.md exists but does not contain version 0.2.23"
  fi
else
  echo "CHANGELOG.md does not exist in the root directory"
fi

Length of output: 631


Script:

#!/bin/bash
# Check if CHANGELOG.md exists and if it contains version 0.2.23
if [ -f CHANGELOG.md ]; then
  if grep -q "0.2.23" CHANGELOG.md; then
    echo "CHANGELOG.md has been updated with version 0.2.23"
  else
    echo "CHANGELOG.md exists but does not contain version 0.2.23"
  fi
else
  echo "CHANGELOG.md does not exist in the root directory"
fi

Length of output: 134

Comment on lines +36 to +45
const uiOptions = Type.Optional(
Type.Object({
redirectUrls: Type.Optional(
Type.Object({
success: Type.String({ format: 'uri' }),
failure: Type.String({ format: 'uri' }),
}),
),
}),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Impact Verification Required for uiOptions Addition

  • The uiOptions property is utilized in:
    • apps/kyb-app/src/hooks/useUIOptionsRedirect/useUIOptionsRedirect.ts

Please ensure that all other components and functions using WorkflowRuntimeConfigSchema are updated to handle the new uiOptions property appropriately.

🔗 Analysis chain

Verify the impact of adding uiOptions to WorkflowRuntimeConfigSchema.

The addition of uiOptions to WorkflowRuntimeConfigSchema might require updates in other parts of the codebase that use this schema. Please ensure that all relevant components and functions are updated to handle this new option.

Run the following script to check for potential impacts:

Review the results to ensure that all necessary updates have been made to accommodate the new uiOptions property.

Also applies to: 51-51

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usages of WorkflowRuntimeConfigSchema and TWorkflowRuntimeConfig

echo "Searching for WorkflowRuntimeConfigSchema usages:"
rg --type typescript "WorkflowRuntimeConfigSchema"

echo "\nSearching for TWorkflowRuntimeConfig usages:"
rg --type typescript "TWorkflowRuntimeConfig"

echo "\nSearching for potential places where uiOptions might be used:"
rg --type typescript "uiOptions.*redirectUrls"

Length of output: 599


Script:

#!/bin/bash
# Description: Search for usages of WorkflowRuntimeConfigSchema and TWorkflowRuntimeConfig without specifying file type

echo "Searching for WorkflowRuntimeConfigSchema usages in .ts and .tsx files:"
rg "WorkflowRuntimeConfigSchema" --type-add 'ts=**/*.ts**/**.tsx' --type ts

echo "\nSearching for TWorkflowRuntimeConfig usages in .ts and .tsx files:"
rg "TWorkflowRuntimeConfig" --type-add 'ts=**/*.ts**/**.tsx' --type ts

echo "\nSearching for potential places where uiOptions might be used in .ts and .tsx files:"
rg "uiOptions.*redirectUrls" --type-add 'ts=**/*.ts**/**.tsx' --type ts

Length of output: 881


Script:

#!/bin/bash
# Description: Search for usages of WorkflowRuntimeConfigSchema and TWorkflowRuntimeConfig in .ts and .tsx files

echo "Searching for WorkflowRuntimeConfigSchema usages in .ts and .tsx files:"
rg "WorkflowRuntimeConfigSchema" -g "*.ts" -g "*.tsx"

echo "\nSearching for TWorkflowRuntimeConfig usages in .ts and .tsx files:"
rg "TWorkflowRuntimeConfig" -g "*.ts" -g "*.tsx"

echo "\nSearching for potential places where uiOptions might be used in .ts and .tsx files:"
rg "uiOptions.*redirectUrls" -g "*.ts" -g "*.tsx"

Length of output: 1823

@alonp99 alonp99 disabled auto-merge October 8, 2024 19:32
@alonp99 alonp99 merged commit 7ee7582 into dev Oct 8, 2024
9 checks passed
@alonp99 alonp99 deleted the illiar/feat/kyb-config-redirects branch October 8, 2024 19:33
@Omri-Levy Omri-Levy mentioned this pull request Nov 4, 2024
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