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(filters): implement create filter functionality #2881

Merged
merged 8 commits into from
Dec 11, 2024

Conversation

alonp99
Copy link
Collaborator

@alonp99 alonp99 commented Dec 10, 2024

  • Add an API endpoint for creating filters
  • Include UI enhancements for filter creation dialog

(Your filter creation process is so smooth, it's practically butter on a hot knife)

Summary by CodeRabbit

  • New Features

    • Enhanced workflows table with improved cell content, including copy ID functionality and styled displays.
    • Introduced filter creation functionality with a new dialog for user input.
    • Added vendor details display in the Workflow Definition component.
    • Updated UI Definition editor to support new viewing modes and structured layouts.
    • Improved debug mode display in the Collection Flow component with structured information and tooltips.
  • Bug Fixes

    • Improved error handling in various components to enhance robustness.
  • Documentation

    • Updated documentation to reflect changes in method signatures and new parameters.
  • Style

    • Enhanced visual styling across multiple components for better user experience, including navigation buttons and debug information.
  • Tests

    • Added tests to ensure new features function as expected.
  • Chores

    • Cleaned up code and removed commented-out directives for better readability.

- Add an API endpoint for creating filters
- Include UI enhancements for filter creation dialog

(Your filter creation process is so smooth, it's practically butter on a hot knife)
Copy link

changeset-bot bot commented Dec 10, 2024

⚠️ No Changeset found

Latest commit: f1eff03

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 Dec 10, 2024

Walkthrough

The pull request introduces significant enhancements across various components in the workflows dashboard. Key updates include improved rendering and user interaction features in data tables, the addition of new filter creation functionalities, and modifications to UI definition components. The changes also involve updating TypeScript interfaces to accommodate new properties and refining error handling in service methods. Overall, the updates aim to enhance user experience and maintainability while ensuring that existing functionalities remain intact.

Changes

File Path Change Summary
apps/workflows-dashboard/src/components/molecules/WorkflowsTable/columns.tsx Updated defaultColumns for improved cell content and header styling, added copy button for ID, styled spans for various columns. Type declaration changed to Array<WorkflowTableColumnDef<IWorkflow>>.
apps/workflows-dashboard/src/domains/filters/filters.api.ts Introduced createFilter function for creating filters, updated imports to include CreateFilterDto.
apps/workflows-dashboard/src/domains/filters/filters.types.ts Updated IFilter interface to include projectId, added CreateFilterDto interface for filter creation.
apps/workflows-dashboard/src/domains/filters/query-keys.ts Added create method in filtersQueryKeys for creating filters using createFilter.
apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.api.ts Modified copyUIDefinition to include a name in the request payload.
apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts Updated IUIDefinition to include optional theme and required name properties.
apps/workflows-dashboard/src/pages/Filters/Filters.tsx Enhanced Filters component with new UI elements for creating filters, added mutation for filter creation.
apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/FiltersTable.tsx Introduced memoized FiltersTable component with improved sorting and error handling.
apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx Updated filtersTableColumns for improved rendering and interaction, added button for ID copying.
apps/workflows-dashboard/src/pages/Filters/helpers/deserialize-query-params.ts Modified to extract projectId from query parameters.
apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/index.ts Re-exported all entities from useCreateFilterMutation.
apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/useCreateFilterMutation.ts Introduced useFiltersQuery for fetching filter data.
apps/workflows-dashboard/src/pages/Filters/types/filters-filter-values.ts Added projectId property to FiltersPageFilterValues interface.
apps/workflows-dashboard/src/pages/Filters/types/filters-query-params.ts Added projectId property to FiltersPageFilterQuery interface.
apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx Updated uiDefinitionTableColumns for improved rendering and interactivity, added ID copy button.
apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton/CloneUIDefinitionButton.tsx Implemented dialog interface for cloning UI definitions, enhanced user interaction.
apps/workflows-dashboard/src/pages/UIDefinitions/helpers/deserialize-query-params.ts Added projectId to deserializeQueryParams return type.
apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx Introduced VENDOR_DETAILS constant for vendor information, updated layout.
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/EditorCard/EditorCard.tsx Expanded IEditorCardProps with new optional properties for dialog content.
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx Updated to include enableViewMode prop and enhanced UI schema display.
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx Updated layout and presentation, added date formatting with dayjs.
apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/WorkflowDefinitionsTable.tsx Added display name for debugging in React DevTools.
apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx Enhanced workflowDefinitionsTableColumns for improved styling and interactivity.
packages/workflow-core/src/lib/plugins/common-plugin/types.ts Modified WorkflowTokenPluginParams to encapsulate return properties in a metadata object.
packages/workflow-core/src/lib/plugins/common-plugin/workflow-token-plugin.ts Updated persistResponseDestination initialization and enhanced error logging.
packages/workflow-core/src/lib/utils/definition-validator/states-validator.ts Enhanced TTransitionOption type and updated validation logic.
packages/workflow-core/src/lib/workflow-runner.ts Made pathToPersist optional in mergeToContext and updated event handling.
services/workflows-service/prisma/data-migrations Updated subproject commit hash.
services/workflows-service/src/auth/workflow-token/workflow-token.service.ts Added error handling in create method for fetching data.
services/workflows-service/src/filter/filter.controller.external.ts Removed @UseCustomerAuthGuard() from createFilter method.
services/workflows-service/src/ui-definition/ui-definition.controller.ts Updated copyUIDefinition method to accept a new body parameter.
services/workflows-service/src/ui-definition/ui-definition.repository.ts Corrected redundant query condition in findByWorkflowDefinitionId.
services/workflows-service/src/ui-definition/ui-definition.service.ts Updated cloneUIDefinitionById to include a new newName parameter.
services/workflows-service/src/workflow-defintion/workflow-definition.service.ts Updated copyDefinitionVersion to include projectId and isPublic parameters.
services/workflows-service/src/workflow/workflow.service.ts Enhanced error handling in createOrUpdateWorkflowRuntime and updated metadata structure in event method.
apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx Enhanced debug mode display and updated navigation button styling.

Possibly related PRs

Suggested reviewers

  • MatanYadaev

🐰 In a world of workflows, so bright and clear,
With buttons and columns, we bring cheer!
Copy and clone with a hop and a skip,
Enhancements abound, let’s take a trip!
From filters to tables, oh what a delight,
Our dashboard shines with all its might! ✨


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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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: 23

🧹 Outside diff range and nitpick comments (32)
packages/workflow-core/src/lib/plugins/common-plugin/workflow-token-plugin.ts (2)

Line range hint 38-47: Consider enhancing error handling

While the error logging is good, consider these improvements:

  1. Include the actual error object in the logger.error call
  2. Consider adding error type discrimination for more specific handling

Here's a suggested improvement:

    } catch (error) {
      logger.error(`Rules Plugin Failed`, {
        name: this.name,
        ...uiDefinitionCreationArgs,
+       error: error instanceof Error ? error.message : String(error),
+       stack: error instanceof Error ? error.stack : undefined,
      });

      return {
        callbackAction: this.errorAction,
-       error: error,
+       error: error instanceof Error ? error : new Error(String(error)),
      } as const;
    }

Line range hint 25-37: Consider adding input validation

The invoke method accepts workflow parameters but doesn't validate them before use.

Consider adding validation:

  async invoke(context: TContext) {
    const workflowRuntimeId = context.workflowRuntimeId as string;
+   
+   if (!workflowRuntimeId) {
+     throw new Error('WorkflowRuntimeId is required');
+   }
+
+   if (!this.uiDefinitionId) {
+     throw new Error('UiDefinitionId is required');
+   }

    const uiDefinitionCreationArgs = {
      workflowRuntimeId: workflowRuntimeId,
      uiDefinitionId: this.uiDefinitionId,
    };
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx (1)

19-50: Consider adding type safety for mapped items

While the array-based approach is clean and maintainable, we could improve type safety by defining an interface for the mapped items.

Consider adding this type definition:

interface SummaryItem {
  label: string;
  value: string | JSX.Element;
}

const summaryItems: SummaryItem[] = [
  { label: 'ID', value: workflowDefinition.id },
  // ... rest of the items
];
services/workflows-service/src/auth/workflow-token/workflow-token.service.ts (1)

46-53: Consider enhancing error handling granularity

While using Promise.all for parallel execution is efficient, consider handling failures of individual promises separately to provide more specific fallback behaviors.

-const [uiDefinition, customer] = await Promise.all([
-  this.uiDefinitionService.getByWorkflowDefinitionId(
-    workflowDefinitionId,
-    UiDefinitionContext.collection_flow,
-    [projectId],
-  ),
-  this.customerService.getByProjectId(projectId),
-]);
+let uiDefinition;
+let customer;
+try {
+  uiDefinition = await this.uiDefinitionService.getByWorkflowDefinitionId(
+    workflowDefinitionId,
+    UiDefinitionContext.collection_flow,
+    [projectId],
+  );
+} catch (error) {
+  uiDefinition = null;
+}
+try {
+  customer = await this.customerService.getByProjectId(projectId);
+} catch (error) {
+  customer = { displayName: '' };
+}
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/EditorCard/EditorCard.tsx (4)

Line range hint 49-51: Optimize hasChanges computation for performance and accuracy

Comparing stringified JSON objects to detect changes (lines 49-51) can be inefficient and may not handle non-serializable values correctly. Consider using a deep equality check function like lodash.isEqual for a more efficient and accurate comparison.


67-148: Refactor renderDialogContent to separate components

The renderDialogContent function (lines 67-148) is lengthy and handles multiple dialog modes within a single function. Extracting each dialog mode's content into separate components will improve modularity, readability, and maintainability.


86-113: Reduce code duplication between 'raw-edit' and 'no-code' dialog modes

The 'raw-edit' (lines 86-113) and 'no-code' (lines 115-143) cases in renderDialogContent have similar structures. Refactor the common elements into a shared component or function to eliminate duplication and enhance maintainability.

Also applies to: 115-143


167-193: Simplify conditional className constructions

The conditional className strings in the DialogTrigger components (lines 167-193) are complex and may affect readability. Utilize a utility library like classnames or clsx to manage conditional classes more elegantly.

apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx (1)

35-154: Extract complex rendering logic into separate components

The viewDialogContent prop contains deeply nested JSX with complex rendering logic (lines 35-154). Extracting this logic into separate components (e.g., FormElements, Actions, Validations) will enhance readability and make the code easier to maintain and test.

apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (1)

142-240: Extract plugin rendering into a separate PluginCard component

The plugin rendering logic within the viewDialogContent prop (lines 142-240) is extensive and nested. By extracting this logic into a PluginCard component, you can improve code modularity, readability, and make it easier to manage and test individual plugin representations.

apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton/CloneUIDefinitionButton.tsx (3)

36-39: Avoid unnecessary type casting in handleSubmit

In handleSubmit, you're casting formData to any before assigning it to values. Instead, you can directly type formData as { name: string } to avoid casting and improve type safety.

Proposed change:

-const handleSubmit = useCallback(
-  async (formData: Record<string, any>) => {
-    const values: { name: string } = formData as any;
+const handleSubmit = useCallback(
+  async (formData: { name: string }) => {
+    const values = formData;
     mutate({ uiDefinitionId, ...values });
   },
   [uiDefinitionId, mutate],
 );

43-47: Handle errors in mutation to provide user feedback

Currently, if the mutate function fails, the user is not informed. Consider adding error handling using the onError callback of useCloneUIDefinitionMutation to display an error message to the user in case the cloning fails.


55-61: Ensure loading state is reflected in the form

While you disable the form inputs with disabled={isLoading}, ensure that the submit button reflects the loading state, such as showing a spinner or disabling it to prevent duplicate submissions.

apps/workflows-dashboard/src/pages/Filters/Filters.tsx (2)

46-56: Add error handling to createFilterMutation

Currently, if the createFilterMutation fails, the user does not receive any feedback. Consider adding an onError callback to inform the user of any errors that occur during the filter creation process.


149-160: Handle loading state for workflow definitions

If workflowDefinitions data is still loading, the select input may be empty, causing confusion for the user. Consider adding an isLoading check and disabling the select input or displaying a loading state until the data is available.

Proposed change:

+const { data: workflowDefinitions, isLoading: isWorkflowDefinitionsLoading } = useWorkflowDefinitionsQuery();

...

<Select
  value={selectedWorkflow}
  onValueChange={setSelectedWorkflow}
+ disabled={isWorkflowDefinitionsLoading || createFilterMutation.isLoading}
>
packages/common/src/schemas/documents/schemas/entity-schema.ts (1)

96-96: Remove unnecessary comment

The comment // No no seems redundant and may cause confusion. Consider removing it to improve code readability.

Proposed change:

 noownershipPercentage: Type.Optional(Type.Number()), // No no
+noownershipPercentage: Type.Optional(Type.Number()),
services/workflows-service/src/workflow/workflow.service.ts (1)

2112-2129: Refactor duplicated code for building collectionFlow

The logic for building the collectionFlow object is duplicated in several places. To improve maintainability and reduce code duplication, consider extracting this logic into a separate helper function.

Proposed change:

+function buildCollectionFlow(uiDefinition, customer) {
+  return buildCollectionFlowState({
+    apiUrl: env.APP_API_URL,
+    steps: uiDefinition?.definition
+      ? getOrderedSteps(
+          (uiDefinition?.definition as Prisma.JsonObject)?.definition as Record<
+            string,
+            Record<string, unknown>
+          >,
+          { finalStates: [...WORKFLOW_FINAL_STATES] },
+        ).map(stepName => ({
+          stateName: stepName,
+        }))
+      : [],
+    additionalInformation: {
+      customerCompany: customer.displayName,
+    },
+  });
+}

...

// Replace duplicated code with the new helper function
-const collectionFlow = buildCollectionFlowState({ /* ... */ });
+const collectionFlow = buildCollectionFlow(uiDefinition, customer);
apps/workflows-dashboard/src/pages/Filters/helpers/deserialize-query-params.ts (1)

Line range hint 1-11: Consider documenting breaking changes and migration path

While these changes effectively support the new filter creation functionality, the addition of required projectId across interfaces represents a breaking change that should be documented.

Consider:

  1. Adding JSDoc comments explaining the projectId requirement
  2. Creating a migration guide for existing code
  3. Potentially providing a utility function to help migrate existing filter objects to the new format
apps/workflows-dashboard/src/domains/filters/query-keys.ts (1)

10-13: Consider namespacing the create query key

The simple query key ['create'] could potentially conflict with other create operations. Consider adding more context:

  create: () => ({
-   queryKey: ['create'],
+   queryKey: ['filters', 'create'],
    queryFn: (dto: CreateFilterDto) => createFilter(dto),
  }),
services/workflows-service/src/ui-definition/ui-definition.controller.ts (1)

38-43: Enhance name validation schema

Consider adding constraints to the name validation:

  • Min/max length
  • Format/pattern (if specific naming conventions are required)
  • Trim whitespace
 schema: Type.Object({
-  name: Type.String(),
+  name: Type.String({
+    minLength: 1,
+    maxLength: 100,
+    pattern: '^[a-zA-Z0-9-_\s]+$',
+    transform: ['trim'],
+  }),
 }),
packages/workflow-core/src/lib/utils/definition-validator/states-validator.ts (1)

11-11: Add JSDoc documentation for the actions property

Please document the purpose and expected values of the actions property, especially the special NO_OP action.

+/** Actions to be performed during the transition. Special values:
+ * - NO_OP: Bypasses transition validation
+ */
 actions?: string;
services/workflows-service/src/ui-definition/ui-definition.service.ts (1)

96-101: Consider adding input validation

The method could benefit from validating the newName parameter before creating the UI definition.

 async cloneUIDefinitionById(id: string, projectId: TProjectId, newName: string) {
+  if (!newName?.trim()) {
+    throw new Error('New name is required and cannot be empty');
+  }
   const {
     createdAt,
     updatedAt,
apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx (2)

12-34: Enhance accessibility of the copy button

While the copy functionality is well implemented, consider improving accessibility:

 <button
   onClick={() => navigator.clipboard.writeText(info.getValue<string>())}
   className="text-gray-400 hover:text-gray-600"
+  aria-label="Copy ID to clipboard"
+  title="Copy ID to clipboard"
 >

51-58: Consider adding loading state for JSON view

The JSON view button might benefit from a loading state when handling large JSON data:

 <div className="flex flex-row items-center gap-3">
   <JSONViewButton
     trigger={
       <Eye className="h-5 w-5 cursor-pointer text-gray-600 transition-colors hover:text-blue-600" />
     }
     json={JSON.stringify(info.getValue())}
+    loadingTrigger={
+      <Eye className="h-5 w-5 animate-pulse text-gray-400" />
+    }
   />
 </div>
apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/FiltersTable.tsx (3)

24-24: Consider adding prop types validation

The component is memoized but lacks prop types validation. Consider adding PropTypes or making the Props interface more strict with readonly properties.


Line range hint 42-54: Improve error handling in sorting logic

The error handling for invalid sorting states could be more robust. Consider:

  1. Adding error boundary
  2. Providing user feedback for sorting errors
  3. Adding type guards for sorting state validation
 onSortingChange: updater => {
   if (typeof updater === 'function') {
     const newSortingValue = updater(table.getState().sorting);
     table.setSorting(newSortingValue);
   } else {
     const sortingState = updater as SortingState;

     if (!sortingState[0]?.id) {
-      console.error(`Invalid sorting state: ${JSON.stringify(sortingState)}`);
+      const error = new Error(`Invalid sorting state: ${JSON.stringify(sortingState)}`);
+      console.error(error);
+      // Consider adding error reporting service
+      return;
     }

     onSort && onSort(sortingState[0]?.id, sortingState[0]?.desc ? 'desc' : 'asc');
   }
 },

Line range hint 89-106: Optimize table rendering performance

The table body rendering could be optimized:

  1. Consider virtualizing the table for large datasets
  2. Memoize row rendering functions
  3. Add pagination for better performance with large datasets
apps/workflows-dashboard/src/components/molecules/WorkflowsTable/columns.tsx (1)

82-91: Improve JSON viewer trigger accessibility

The Eye icon button needs accessibility improvements:

  1. Add aria-label
  2. Add keyboard interaction support
  3. Consider adding tooltip
 <Eye 
   className="h-5 w-5 cursor-pointer text-gray-600 transition-colors hover:text-blue-600"
+  aria-label="View JSON context"
+  role="button"
+  tabIndex={0}
+  title="View JSON context"
 />
apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx (2)

17-19: Add error handling for clipboard operations

The clipboard operation could fail in certain browsers or contexts. Add error handling to provide feedback to users.

-onClick={() => navigator.clipboard.writeText(info.getValue<string>())}
+onClick={async () => {
+  try {
+    await navigator.clipboard.writeText(info.getValue<string>());
+    // Optional: Add toast notification for success
+  } catch (error) {
+    console.error('Failed to copy to clipboard:', error);
+    // Optional: Add toast notification for failure
+  }
+}}

99-103: Consider adding tooltip for truncated IDs

Long workflow definition IDs might get truncated in the UI. Consider adding a tooltip to show the full ID.

-<span className="font-mono text-sm text-gray-600">{valueOrNA(info.getValue<string>())}</span>
+<span 
+  className="font-mono text-sm text-gray-600" 
+  title={info.getValue<string>() || 'N/A'}
+>
+  {valueOrNA(info.getValue<string>())}
+</span>
apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx (1)

46-58: Consider extracting visibility badge to a reusable component

The visibility badge implementation could be reused across the application where similar status indicators are needed.

// shared/components/StatusBadge.tsx
type StatusVariant = 'success' | 'neutral';

interface StatusBadgeProps {
  variant: StatusVariant;
  label: string;
}

export const StatusBadge = ({ variant, label }: StatusBadgeProps) => {
  const styles = {
    success: 'bg-emerald-100 text-emerald-700 hover:bg-emerald-200',
    neutral: 'bg-slate-100 text-slate-700 hover:bg-slate-200',
  };

  return (
    <span className={`rounded-full px-3 py-1 text-xs font-medium transition-colors ${styles[variant]}`}>
      {label}
    </span>
  );
};
services/workflows-service/src/workflow-defintion/workflow-definition.service.ts (1)

114-115: Add documentation for the new parameters

The addition of projectId and isPublic parameters should be documented to explain their purpose and impact.

Add JSDoc comments to explain the parameters:

/**
 * Creates a copy of an existing workflow definition.
 * @param id - The ID of the workflow definition to copy
 * @param name - The name for the new copy
 * @param displayName - The display name for the new copy
 * @param projectId - The project ID to associate with the copy
 * @param options - Additional options for the copy
 * @param options.isPublic - Whether the copied definition should be public (defaults to false)
 * @returns The newly created workflow definition
 */
async copyDefinitionVersion(
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c8cea9e and 3483c2e.

📒 Files selected for processing (37)
  • apps/workflows-dashboard/src/components/molecules/WorkflowsTable/columns.tsx (2 hunks)
  • apps/workflows-dashboard/src/domains/filters/filters.api.ts (2 hunks)
  • apps/workflows-dashboard/src/domains/filters/filters.types.ts (2 hunks)
  • apps/workflows-dashboard/src/domains/filters/query-keys.ts (1 hunks)
  • apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.api.ts (1 hunks)
  • apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts (2 hunks)
  • apps/workflows-dashboard/src/pages/Filters/Filters.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/FiltersTable.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/Filters/helpers/deserialize-query-params.ts (1 hunks)
  • apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/index.ts (1 hunks)
  • apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/useCreateFilterMutation.ts (1 hunks)
  • apps/workflows-dashboard/src/pages/Filters/types/filters-filter-values.ts (1 hunks)
  • apps/workflows-dashboard/src/pages/Filters/types/filters-query-params.ts (1 hunks)
  • apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx (2 hunks)
  • apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton/CloneUIDefinitionButton.tsx (2 hunks)
  • apps/workflows-dashboard/src/pages/UIDefinitions/helpers/deserialize-query-params.ts (1 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (3 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/components/EditorCard/EditorCard.tsx (2 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx (2 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/WorkflowDefinitionsTable.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx (1 hunks)
  • packages/common/src/schemas/documents/schemas/entity-schema.ts (1 hunks)
  • packages/workflow-core/src/lib/plugins/common-plugin/types.ts (1 hunks)
  • packages/workflow-core/src/lib/plugins/common-plugin/workflow-token-plugin.ts (1 hunks)
  • packages/workflow-core/src/lib/utils/definition-validator/states-validator.ts (2 hunks)
  • packages/workflow-core/src/lib/workflow-runner.ts (3 hunks)
  • services/workflows-service/package.json (0 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
  • services/workflows-service/src/auth/workflow-token/workflow-token.service.ts (1 hunks)
  • services/workflows-service/src/filter/filter.controller.external.ts (0 hunks)
  • services/workflows-service/src/ui-definition/ui-definition.controller.ts (1 hunks)
  • services/workflows-service/src/ui-definition/ui-definition.repository.ts (1 hunks)
  • services/workflows-service/src/ui-definition/ui-definition.service.ts (1 hunks)
  • services/workflows-service/src/workflow-defintion/workflow-definition.service.ts (1 hunks)
  • services/workflows-service/src/workflow/workflow.service.ts (4 hunks)
💤 Files with no reviewable changes (2)
  • services/workflows-service/package.json
  • services/workflows-service/src/filter/filter.controller.external.ts
✅ Files skipped from review due to trivial changes (3)
  • apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/index.ts
  • services/workflows-service/prisma/data-migrations
  • apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/WorkflowDefinitionsTable.tsx
🔇 Additional comments (14)
packages/workflow-core/src/lib/plugins/common-plugin/workflow-token-plugin.ts (1)

22-22: Verify the impact of empty persistResponseDestination

The persistResponseDestination property has been changed from 'metadata' to an empty string ''. This could affect how responses are persisted in the workflow.

Let's verify the usage of this property:

✅ Verification successful

Based on the search results, I can now provide a final response:

Empty persistResponseDestination is safe and intentional

The empty string initialization of persistResponseDestination in WorkflowTokenPlugin is correct. The codebase shows that:

  1. The property is optional in other plugins (ApiPlugin, vendor configurations)
  2. The workflow runner (workflow-runner.ts) has proper null checks before using this value:
    if (apiPlugin.persistResponseDestination && responseBody) {
      // ... handle persistence
    }
  3. Other plugins in the codebase explicitly set specific destinations (e.g., 'entity.data', 'pluginsOutput.businessInformation') when persistence is needed
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check how persistResponseDestination is used across the codebase

# Search for direct property usage
rg "persistResponseDestination" -A 3

# Search for metadata persistence patterns to understand the impact
ast-grep --pattern 'metadata = $_' 

Length of output: 26268

apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx (1)

5-5: LGTM! Enhanced visual hierarchy and readability

The styling improvements with gradients and shadows, along with the more descriptive header text, create a better visual hierarchy and user experience.

Also applies to: 15-17

services/workflows-service/src/auth/workflow-token/workflow-token.service.ts (1)

44-80: Verify the impact on workflow token creation

Let's ensure that the changes don't break existing workflow token creation flows.

✅ Verification successful

Based on the results, I can now generate the final response:

Error handling in workflow token creation is properly implemented

The changes to error handling in the workflow token service follow established patterns across the codebase:

  • The error handling approach aligns with similar patterns found in other services
  • The create method is used correctly in integration tests, showing proper token creation flows
  • The fallback state provides safe defaults when UI definition or customer data is unavailable
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usages of WorkflowTokenService.create
ast-grep --pattern 'workflowTokenService.create($$$)'

# Search for tests related to workflow token creation
rg -l "workflow.*token.*create" -g "*.test.ts" -g "*.spec.ts"

# Check for error handling patterns in similar services
rg "catch \(error\)" -g "*.service.ts" -A 5

Length of output: 12226

apps/workflows-dashboard/src/pages/Filters/types/filters-filter-values.ts (1)

2-2: Verify the impact of adding required projectId

Adding projectId as a required field is a breaking change that could affect existing code using this interface.

✅ Verification successful

No breaking changes detected with projectId addition

The addition of projectId as a required field in FiltersPageFilterValues is safe because:

  1. The interface is only used through deserializeQueryParams which properly handles the projectId field
  2. The source FiltersPageFilterQuery interface already has projectId as a required field
  3. No direct instantiations of FiltersPageFilterValues were found in the codebase
  4. All usages go through the filters provider and query parameter deserialization, which ensures projectId is always present
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for existing usage of FiltersPageFilterValues to identify potential breaking changes
rg -t typescript "FiltersPageFilterValues" -B 2 -A 2

Length of output: 87


Script:

#!/bin/bash
# Search for FiltersPageFilterValues usage with ripgrep, without type restriction
rg "FiltersPageFilterValues" -B 2 -A 2

Length of output: 4790


Script:

#!/bin/bash
# Check the implementation of deserializeQueryParams to see how projectId is handled
cat apps/workflows-dashboard/src/pages/UIDefinitions/helpers/deserialize-query-params.ts apps/workflows-dashboard/src/pages/Filters/helpers/deserialize-query-params.ts

Length of output: 1025


Script:

#!/bin/bash
# Check the query params type definition and its usage
cat apps/workflows-dashboard/src/pages/Filters/types/filters-query-params.ts

# Also check if there are any direct usages of the interface without going through deserializeQueryParams
rg -g '!*.test.*' -g '!*.spec.*' "new.*FiltersPageFilterValues" 

Length of output: 244

apps/workflows-dashboard/src/pages/Filters/types/filters-query-params.ts (1)

2-2: LGTM! Type definition is consistent

The required projectId field aligns with the type definition in FiltersPageFilterValues, maintaining consistency across interfaces.

apps/workflows-dashboard/src/domains/filters/filters.api.ts (1)

16-20: Verify error responses from the API

Let's verify how the API handles various error cases.

apps/workflows-dashboard/src/domains/filters/query-keys.ts (1)

1-2: Verify the createFilter API integration

Let's verify that the createFilter API endpoint is properly implemented and matches the expected DTO structure.

Also applies to: 10-13

✅ Verification successful

Let me gather more information about the DTO structure to complete the verification.


CreateFilter API integration is properly implemented

The implementation aligns perfectly with the expected structure:

  • The API endpoint /external/filters is correctly used in the implementation
  • The CreateFilterDto interface matches the documented request structure with all required fields:
    • name (string)
    • entity (string)
    • query (with where and select objects)
    • projectId (string)
  • The API implementation properly sends the DTO to the endpoint and returns the response data
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for createFilter API implementation
ast-grep --pattern 'export const createFilter = async (dto: CreateFilterDto) => {
  $$$
}'

# Search for API endpoint definition
rg -A 5 "POST.*external/filters"

Length of output: 1381


Script:

#!/bin/bash
# Search for CreateFilterDto definition
ast-grep --pattern 'export interface CreateFilterDto {
  $$$
}'

# Search for request body example in docs
rg -A 10 "example request body for creating a new filter"

Length of output: 2793

apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts (1)

16-16: Verify handling of new required 'name' property

Adding required name properties to existing interfaces IUIDefinition and CopyUIDefinitionDto could break existing code. Please ensure all usages have been updated.

Also applies to: 27-27

✅ Verification successful

Let me try a different search strategy to find usages of these interfaces.


Let me check one more thing to see how these interfaces are being used in the codebase.


Based on the evidence gathered, I can now provide the final response:

The new required 'name' property appears to be properly handled

The name property is correctly used in the codebase:

  • In copyUIDefinition API call where it's properly passed in the request body
  • The mutation hook useCloneUIDefinitionMutation handles the CopyUIDefinitionDto with the required name field
  • All UI Definition data fetching operations (fetchUIDefinition, fetchUIDefinitions) expect the complete IUIDefinition interface including the name field
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for interface usages
ast-grep --pattern 'interface $_ extends IUIDefinition'
ast-grep --pattern 'const $_: IUIDefinition'
ast-grep --pattern 'function $_($$_: IUIDefinition)'

# Search for CopyUIDefinitionDto usages
ast-grep --pattern 'const $_: CopyUIDefinitionDto'
ast-grep --pattern 'function $_($$_: CopyUIDefinitionDto)'

Length of output: 5719


Script:

#!/bin/bash
# Search for files containing IUIDefinition or CopyUIDefinitionDto
rg -l "IUIDefinition|CopyUIDefinitionDto"

# Search for object literals that might be implementing these interfaces
ast-grep --pattern 'const $_ = {
  $$$
} as IUIDefinition'

ast-grep --pattern 'const $_ = {
  $$$
} as CopyUIDefinitionDto'

# Search for variable declarations and function parameters
rg ":\s*(IUIDefinition|CopyUIDefinitionDto)" -A 2

Length of output: 4502


Script:

#!/bin/bash
# Check the content of the files where these interfaces are used
cat apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.api.ts
cat apps/workflows-dashboard/src/pages/UIDefinitions/hooks/useCloneUIDefinitionMutation/useCloneUIDefinitionMutation.tsx

Length of output: 1903

apps/workflows-dashboard/src/domains/filters/filters.types.ts (1)

7-7: Verify handling of new required 'projectId' property

Adding a required projectId property to the existing IFilter interface could break existing code. Please ensure all usages have been updated.

✅ Verification successful

Let me gather more information about IFilter usages with a different approach.


Let me search for actual usages of the IFilter interface to understand how it's being used in the codebase.


Based on the search results, I can now generate the final response. The code shows that the IFilter interface is used in a filters feature where filters are created and managed through a REST API, and the projectId is a required field when creating new filters.

Breaking change concern is valid - update all filter creation code

The addition of the required projectId field to IFilter is indeed a breaking change that needs attention in the following locations:

  • apps/workflows-dashboard/src/domains/filters/filters.api.ts: The createFilter API call
  • services/workflows-service/scripts/seed.ts: The filter creation in seed data
  • apps/workflows-dashboard/src/pages/Filters/Filters.tsx: The filter creation form

The code shows that new filters are already being created with projectId from the existing items: projectId: data?.items[0]?.projectId ?? '', indicating that the change has been properly handled in the UI.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for IFilter interface usages
ast-grep --pattern 'interface $_ extends IFilter'
ast-grep --pattern 'const $_: IFilter'
ast-grep --pattern 'function $_($$_: IFilter)'

Length of output: 2864


Script:

#!/bin/bash
# Search for IFilter usages with ripgrep for broader context
rg "IFilter" -A 3 -B 3

# Also search for filter-related components and hooks that might use IFilter
rg "useFilter|FilterComponent|filter\(" -A 3 -B 3

Length of output: 68135


Script:

#!/bin/bash
# Search for actual implementations and usages of IFilter
rg -A 5 "implements IFilter|extends IFilter|: IFilter \{|: IFilter;|as IFilter"

# Also search for filter-related API calls or hooks that might use IFilter
rg -A 5 "useFilter|getFilter|createFilter|updateFilter"

Length of output: 66802

services/workflows-service/src/ui-definition/ui-definition.controller.ts (1)

50-54: LGTM! Clean implementation following NestJS practices

The implementation correctly handles the new name parameter and follows controller best practices.

services/workflows-service/src/ui-definition/ui-definition.repository.ts (1)

54-54: LGTM! Improved query construction

The change correctly optimizes the OR condition by spreading args?.where only once, eliminating potential duplicate conditions.

services/workflows-service/src/ui-definition/ui-definition.service.ts (1)

86-86: LGTM! Method signature enhancement

The addition of the newName parameter aligns well with the filter creation functionality requirements.

services/workflows-service/src/workflow-defintion/workflow-definition.service.ts (1)

114-115: Verify the impact of hardcoded isPublic value

Setting isPublic: false by default for copied definitions might not be the desired behavior in all cases. Consider making this configurable.

-async copyDefinitionVersion(
-  id: string,
-  name: string,
-  displayName: string,
-  projectId: TProjectId,
-) {
+async copyDefinitionVersion(
+  id: string,
+  name: string,
+  displayName: string,
+  projectId: TProjectId,
+  options: { isPublic?: boolean } = {},
+) {
   // ...
   const createArgs = replaceNullsWithUndefined(
     merge(restArgs, {
       name,
       displayName,
       projectId,
-      isPublic: false,
+      isPublic: options.isPublic ?? false,
       version: 1,
     }),
   ) as Prisma.WorkflowDefinitionCreateArgs['data'];
✅ Verification successful

Based on the search results and schema analysis, I can now provide a final response:

Setting isPublic to false is the correct default behavior

The codebase shows a clear pattern where isPublic is used to distinguish between shared/template workflow definitions (isPublic: true) and project-specific workflow definitions (isPublic: false). The schema enforces this through a constraint: CHECK (("isPublic" = true AND "projectId" IS NULL) OR ("isPublic" = false")).

When copying a workflow definition:

  • If it's meant to be a template, it should be explicitly set as public through a separate process
  • Project-specific copies should remain private by default for security
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any direct references to isPublic in workflow definitions
rg "isPublic.*workflow.*definition" -A 5 -B 5

# Check for any UI components that might be affected by this change
ast-grep --pattern 'isPublic.*=.*true' 

Length of output: 88


Script:

#!/bin/bash
# Let's try a broader search for isPublic in workflow related files
rg "isPublic" -A 5 -B 5 services/workflows-service/

# Check the schema definition to understand the isPublic field
fd "schema.prisma" --exec cat {}

# Check for any existing copy operations
rg "copy.*workflow.*definition" -i

Length of output: 70957

packages/workflow-core/src/lib/workflow-runner.ts (1)

470-472: LGTM! Useful addition for debugging and tracking.

The NO_OP action provides a clean way to track workflow state transitions without side effects.

@alonp99 alonp99 linked an issue Dec 10, 2024 that may be closed by this pull request
…itor

- Ensure components correctly return when encountering undefined types
- Clean up nested element rendering logic for clarity

(if your nested elements were any deeper, they'd need their own zip code)
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 (2)
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx (2)

34-34: Make enableViewMode prop configurable

The enableViewMode prop is hardcoded to true. Consider making it configurable by passing it as a prop from the parent component to allow for more flexibility in different usage contexts.

- enableViewMode={true}
+ enableViewMode={props.enableViewMode}

96-106: Add error boundary for recursive rendering

The deep recursive rendering of nested elements could potentially cause runtime errors. Consider adding an error boundary to gracefully handle such cases.

class ElementErrorBoundary extends React.Component<{ children: React.ReactNode }> {
  state = { hasError: false };

  static getDerivedStateFromError() {
    return { hasError: true };
  }

  render() {
    if (this.state.hasError) {
      return <div className="text-red-500">Error rendering element</div>;
    }
    return this.props.children;
  }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3483c2e and 6fc0667.

📒 Files selected for processing (1)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx (1 hunks)
🔇 Additional comments (1)
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx (1)

Line range hint 1-197: Implementation approved with suggested improvements

The changes successfully implement a view mode for UI definitions with a good separation between view and edit modes. While the core functionality is solid, consider implementing the suggested improvements for better maintainability, type safety, and error handling.

- Add a visual indication for debug mode in the CollectionFlow component
- Introduce theme and locales tabs in the UIDefinitionEditor
- Utilize dayjs for date formatting in the WorkflowDefinitionSummaryCard

(Your code looks nice, but I bet even your cat would prefer a more straightforward UI)
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 (6)
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx (2)

34-34: Avoid hardcoding the view mode value

The enableViewMode prop is hardcoded to true, which reduces component reusability. Consider making it configurable through component props.

- enableViewMode={true}
+ enableViewMode={props.enableViewMode}

180-209: Add loading states for JSON editor operations

The JSON editor operations might be slow with large objects. Consider adding loading states and error boundaries.

const [isEditorLoading, setIsEditorLoading] = useState(false);

const handleEditorChange = async (value: any) => {
  setIsEditorLoading(true);
  try {
    await handleUIDefinitionChange(value);
  } catch (error) {
    // Handle error
  } finally {
    setIsEditorLoading(false);
  }
};

// In JSX
<JSONEditorComponent 
  value={uiDefinitionValue} 
  onChange={handleEditorChange}
  isLoading={isEditorLoading}
/>
apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx (4)

249-258: Add ARIA attributes for better accessibility

The debug mode indicator's accessibility could be improved by adding appropriate ARIA attributes.

-<div className="mb-6 rounded-lg border border-amber-200 bg-amber-50 p-4">
+<div className="mb-6 rounded-lg border border-amber-200 bg-amber-50 p-4" role="alert" aria-label="Debug mode status">
   <div className="mb-4 flex items-center gap-2">
-    <div className="h-2 w-2 animate-pulse rounded-full bg-amber-500" />
+    <div className="h-2 w-2 animate-pulse rounded-full bg-amber-500" role="presentation" />
     <span
       className="cursor-help font-medium text-amber-900 hover:underline"
       data-tooltip-id="debug-mode-tooltip"
       data-tooltip-content="In debug mode you can navigate between steps without validation. Be aware that if required data is missing, plugins may fail when processing data at the end of the flow."
+      role="button"
+      tabIndex={0}
     >

261-272: Consider using a semantic HTML element for state display

The current state display could benefit from using more semantic HTML elements and adding ARIA attributes for better accessibility.

-<div className="mb-3 text-sm text-amber-800">
+<section className="mb-3 text-sm text-amber-800" aria-label="Current debug state">
-  Current State:{' '}
+  <h4 className="inline">Current State: </h4>
   {currentPage ? (
-    <span className="font-medium">
+    <span className="font-medium" role="status" aria-live="polite">
       {currentPage.stateName}
     </span>
   ) : (
-    <span className="italic">
+    <span className="italic" role="status" aria-live="polite">
       Page not found - state: {state}
     </span>
   )}
-</div>
+</section>

274-285: Enhance debug navigation buttons with keyboard handling

The debug navigation buttons should handle keyboard events and have proper ARIA labels.

 <div className="flex gap-3">
   <button
     onClick={() => stateApi.sendEvent('PREVIOUS')}
+    onKeyDown={(e) => e.key === 'Enter' && stateApi.sendEvent('PREVIOUS')}
     className="rounded bg-amber-100 px-3 py-1.5 text-sm font-medium text-amber-900 transition-colors hover:bg-amber-200"
+    aria-label="Go to previous step in debug mode"
   >
     Previous
   </button>
   <button
     onClick={() => stateApi.sendEvent('NEXT')}
+    onKeyDown={(e) => e.key === 'Enter' && stateApi.sendEvent('NEXT')}
     className="rounded bg-amber-100 px-3 py-1.5 text-sm font-medium text-amber-900 transition-colors hover:bg-amber-200"
+    aria-label="Go to next step in debug mode"
   >
     Next
   </button>
 </div>

249-285: Consider environment-based debug mode control

The debug mode is currently controlled via localStorage, which might not be the most secure approach. Consider implementing environment-based control for debug mode activation.

Recommendations:

  1. Add an environment variable (e.g., VITE_ENABLE_DEBUG_MODE) to control debug mode availability
  2. Implement a secure mechanism to enable debug mode (e.g., requiring specific credentials)
  3. Add logging when debug mode is activated to track usage

This would prevent accidental exposure of debug features in production environments.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc0667 and 0cdc02a.

📒 Files selected for processing (4)
  • apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx (1 hunks)
  • apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts (2 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts
🔇 Additional comments (9)
apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx (3)

38-38: Replace 'any' type with proper interfaces

Multiple instances of any type usage reduce type safety. Consider creating proper interfaces for your element types.

Also applies to: 60-60, 90-90, 97-97, 124-124, 144-144


62-79: Extract form element rendering logic into separate components

The current implementation has complex nested rendering logic with multiple levels of element traversal. Consider extracting this logic into separate components for better maintainability and reusability.

Also applies to: 81-115


211-220: Enhance error handling and user feedback for async operations

The upgrade and save operations lack proper loading states and error handling.

apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx (5)

15-18: LGTM! Clean and modern card styling

The card header styling with gradient background and shadow provides good visual hierarchy and follows modern design patterns.


20-50: Well-structured data mapping implementation

The array-based approach for rendering workflow details is clean, maintainable, and provides consistent styling.


28-28: ⚠️ Potential issue

Add null check for date formatting

The current implementation might throw an error if workflowDefinition.createdAt is undefined.

- value: dayjs(workflowDefinition.createdAt).format('MMM D, YYYY h:mm A'),
+ value: workflowDefinition.createdAt 
+   ? dayjs(workflowDefinition.createdAt).format('MMM D, YYYY h:mm A')
+   : 'N/A',

31-40: 🛠️ Refactor suggestion

Reconsider color coding for public/private status

The current color scheme (red for public, green for private) might be counterintuitive as red typically indicates warning/danger states.

- <span className="rounded-full bg-red-100 px-2 py-1 text-sm font-medium text-red-800">
+ <span className="rounded-full bg-blue-100 px-2 py-1 text-sm font-medium text-blue-800">
  Yes
</span>
- <span className="rounded-full bg-green-100 px-2 py-1 text-sm font-medium text-green-800">
+ <span className="rounded-full bg-gray-100 px-2 py-1 text-sm font-medium text-gray-800">
  No
</span>

23-25: Verify the valueOrNA utility implementation

Let's ensure the valueOrNA utility properly handles all edge cases for these fields.

✅ Verification successful

Let me search for the valueOrFallback implementation since valueOrNA is built on top of it.


Let me check the actual implementation of valueOrFallback to ensure it handles all edge cases properly.


The valueOrNA utility implementation is robust and handles edge cases appropriately

The implementation is well-designed and handles all necessary edge cases:

  • Uses ?? operator when checkFalsy: false to handle only null/undefined
  • Uses || operator when checkFalsy: true to handle all falsy values (null, undefined, empty string, 0, etc.)

In the case of valueOrNA, it's configured with checkFalsy: true, which means it will properly handle:

  • null/undefined values
  • Empty strings
  • Other falsy values

This is appropriate for the display fields being used (displayName, version, variant) as it ensures a consistent "N/A" display for any missing or empty data.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for valueOrNA implementation and its tests
rg -A 5 "valueOrNA" --type ts

Length of output: 36468


Script:

#!/bin/bash
# Search for valueOrFallback implementation
rg -A 5 "valueOrFallback" --type ts

Length of output: 6484


Script:

#!/bin/bash
# Get the implementation of valueOrFallback
cat packages/common/src/utils/value-or-fallback/value-or-fallback.ts

Length of output: 633

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

249-285: Verify debug mode state persistence

The debug mode UI relies on localStorage.getItem('devmode') for visibility control. Let's verify the debug mode state management implementation across the codebase.

- Integrate toast notifications for clipboard copy success and failure
- Apply changes across multiple table column components

(your clipboard functionality needed a better alert system than just wishing on a star)
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

🧹 Outside diff range and nitpick comments (6)
apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx (4)

55-59: Add semantic meaning to the UI Context badge

While the styling is visually appealing, the badge could benefit from semantic meaning for screen readers.

Apply this diff to improve accessibility:

-<span className="rounded bg-violet-50 px-2 py-1 text-sm text-violet-700">
+<span 
+  className="rounded bg-violet-50 px-2 py-1 text-sm text-violet-700"
+  role="status"
+  aria-label={`UI Context: ${info.getValue<string>()}`}
+>

62-87: Consider extracting common JSON view pattern

The Definition and UI Schema columns share identical implementation patterns. Consider extracting this into a reusable component to follow DRY principles.

Create a new component like this:

const JsonViewCell = ({ json }: { json: unknown }) => (
  <div className="flex flex-row items-center gap-3">
    <JSONViewButton
      trigger={
        <Eye className="h-5 w-5 cursor-pointer text-gray-600 transition-colors hover:text-blue-600" />
      }
      json={JSON.stringify(json)}
    />
  </div>
);

Then use it in both columns:

 columnHelper.accessor('definition', {
-  cell: info => (
-    <div className="flex flex-row items-center gap-3">
-      <JSONViewButton
-        trigger={
-          <Eye className="h-5 w-5 cursor-pointer text-gray-600 transition-colors hover:text-blue-600" />
-        }
-        json={JSON.stringify(info.getValue())}
-      />
-    </div>
-  ),
+  cell: info => <JsonViewCell json={info.getValue()} />,
   header: () => <span className="font-semibold">Definition</span>,
 }),

88-108: Add type safety to locales handling

While the null handling is good, the code could benefit from explicit typing.

Consider this improvement:

-const locales = info.getValue() ? JSON.stringify(info.getValue()) : null;
+type Locales = Record<string, unknown> | null;
+const locales = info.getValue<Locales>();
+const serializedLocales = locales ? JSON.stringify(locales) : null;

129-131: Enhance navigation link accessibility

The navigation icon should have an accessible label for screen readers.

Apply this diff:

-<Link to={`/ui-definitions/${info.row.original.id}`} className="flex justify-center">
+<Link 
+  to={`/ui-definitions/${info.row.original.id}`} 
+  className="flex justify-center"
+  aria-label={`View UI Definition ${info.row.original.id}`}
+>
   <ArrowRightCircleIcon className="h-6 w-6 text-blue-600 transition-colors hover:text-blue-700" />
 </Link>
apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx (2)

56-68: Extract visibility indicator styling into a reusable component

The visibility indicator uses conditional styling that could be reused for other boolean indicators.

Create a shared component:

// components/atoms/BooleanIndicator.tsx
interface BooleanIndicatorProps {
  value: boolean;
  trueText?: string;
  falseText?: string;
  trueClassName?: string;
  falseClassName?: string;
}

export const BooleanIndicator: React.FC<BooleanIndicatorProps> = ({
  value,
  trueText = 'Public',
  falseText = 'Private',
  trueClassName = 'bg-emerald-100 text-emerald-700 hover:bg-emerald-200',
  falseClassName = 'bg-slate-100 text-slate-700 hover:bg-slate-200'
}) => (
  <span
    className={`rounded-full px-3 py-1 text-xs font-medium transition-colors ${
      value ? trueClassName : falseClassName
    }`}
  >
    {value ? trueText : falseText}
  </span>
);

Then simplify the column implementation:

 cell: info => (
-  <span
-    className={`rounded-full px-3 py-1 text-xs font-medium transition-colors ${
-      info.getValue<boolean>()
-        ? 'bg-emerald-100 text-emerald-700 hover:bg-emerald-200'
-        : 'bg-slate-100 text-slate-700 hover:bg-slate-200'
-    }`}
-  >
-    {info.getValue<boolean>() ? 'Public' : 'Private'}
-  </span>
+  <BooleanIndicator value={info.getValue<boolean>()} />
 )

Line range hint 1-1: Consider implementing a table column factory pattern

There's significant duplication across table column configurations. Consider implementing a factory pattern for common column types:

  1. ID columns with copy functionality
  2. JSON viewer columns
  3. Boolean indicator columns
  4. Date formatter columns
  5. Link columns

This would improve maintainability, ensure consistency, and reduce code duplication across the application.

Example implementation:

// utils/table/columnFactory.ts
export const createTableColumns = {
  idColumn: (options?: IdColumnOptions) => ({
    cell: info => <IdCell value={info.getValue()} {...options} />,
    header: () => <span className="font-semibold">ID</span>,
  }),
  jsonColumn: (options?: JsonColumnOptions) => ({
    cell: info => <JsonViewerCell json={info.getValue()} {...options} />,
    header: () => <span className="font-semibold">{options?.header ?? 'JSON'}</span>,
  }),
  // ... other column factories
};
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0cdc02a and 3bad7b9.

📒 Files selected for processing (4)
  • apps/workflows-dashboard/src/components/molecules/WorkflowsTable/columns.tsx (2 hunks)
  • apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx (1 hunks)
🔇 Additional comments (4)
apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx (3)

18-44: Enhance accessibility of the copy button

The copy button lacks proper accessibility attributes which are essential for screen readers and keyboard navigation.

Apply this diff to improve accessibility:

 <button
   onClick={() => {
     navigator.clipboard
       .writeText(info.getValue<string>())
       .then(() => {
         toast.success('ID copied to clipboard');
       })
       .catch(() => {
         toast.error('Failed to copy ID to clipboard');
       });
   }}
   className="text-gray-400 hover:text-gray-600"
+  aria-label="Copy ID to clipboard"
+  title="Copy ID to clipboard"
+  type="button"
 >

49-52: LGTM!

The name column implementation is clean and uses appropriate styling for visual hierarchy.


109-114: LGTM!

The implementation handles null cases well using the valueOrNA utility and applies appropriate styling.

apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx (1)

72-86: 🛠️ Refactor suggestion

Improve type safety for query access

The current implementation uses type assertion without validation, which could lead to runtime errors if the query structure is unexpected.

Consider adding proper type definitions and validation:

+interface WorkflowDefinitionQuery {
+  where?: {
+    workflowDefinitionId?: {
+      in?: string[];
+    };
+  };
+}

+const getWorkflowId = (query: unknown): string => {
+  const typedQuery = query as WorkflowDefinitionQuery;
+  return typedQuery?.where?.workflowDefinitionId?.in?.[0] ?? '';
+};

 columnHelper.accessor(
-  row => {
-    const query = row.query as { where?: { workflowDefinitionId?: { in?: string[] } } };
-    return query.where?.workflowDefinitionId?.in?.[0] ?? '';
-  },
+  row => getWorkflowId(row.query),
   {
     id: 'workflowDefinitionId',
     // ... rest of the implementation
   }
 )

Likely invalid or redundant comment.

- Update version for backoffice-v2, kyb-app, and workflows-service to 0.7.80
- Upgrade workflow-browser-sdk and workflow-node-sdk to version 0.6.76

(your dependencies have more updates than my social media feed during a trend)
- Replace detailed inline object definitions with separate schemas for individuals and businesses
- Enhance readability and maintainability by utilizing existing schemas

(Your code reduction skills are sharp, just like the corners of the new schema)
- Introduce a Dialog component for viewing the integration catalog
- Implement state management for opening and closing the dialog
- Add copy-to-clipboard functionality for vendor keys

(Your integration catalog is so fancy, it makes a five-star restaurant look like a food truck)
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 (2)
apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (2)

21-54: Consider moving vendor details to a configuration service

The hardcoded vendor details could be better managed through a configuration service for the following reasons:

  • Environment-specific URLs can be managed more effectively
  • Vendor information can be updated without code changes
  • Sensitive vendor information can be properly secured

Consider:

  1. Moving vendor details to a configuration service or environment variables
  2. Implementing a caching mechanism for vendor logos
  3. Adding URL validation for logo URLs

275-286: Reduce code duplication in image error handling

The image error handling logic is duplicated across multiple instances.

Extract to a reusable component:

interface VendorLogoProps {
  vendor: string;
  className?: string;
}

const VendorLogo: React.FC<VendorLogoProps> = ({ vendor, className }) => {
  const fallbackLogo = 'https://cdn.ballerine.io/logos/ballerine-logo.png';
  const logoUrl = VENDOR_DETAILS[vendor as VendorId]?.logoUrl || 
    `https://cdn.ballerine.io/logos/${vendor.toLowerCase()}-logo.png`;

  return (
    <img
      src={logoUrl}
      alt={vendor}
      className={className}
      onError={e => {
        e.currentTarget.src = fallbackLogo;
      }}
    />
  );
};

Also applies to: 282-285

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f64d8db and 316e10b.

📒 Files selected for processing (1)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (3 hunks)
🔇 Additional comments (1)
apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (1)

Line range hint 1-371: Verify relationship with filter creation functionality

While the file contains significant UI enhancements for workflow definition management, it's unclear how these changes relate to the PR's primary objective of implementing filter creation functionality.

Let's verify the connection:

@alonp99 alonp99 enabled auto-merge (squash) December 11, 2024 07:46
- Update version numbers in various packages to their latest releases
- Upgrade dependent packages to maintain compatibility

(your projects are like a fine wine, they really should age before a release)
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: 0

🧹 Outside diff range and nitpick comments (5)
examples/report-generation-example/CHANGELOG.md (1)

3-10: Enhance changelog entry quality and commit message format.

The changelog entries could be more informative by:

  • Following conventional commit format (feat/fix/chore etc.)
  • Including brief descriptions of actual changes
  • Documenting any breaking changes or migration steps if applicable
  • Explaining the reason for dependency updates

Example of a better format:

-## 0.2.26
-
-### Patch Changes
-
-- Bump
-- Updated dependencies
-  - @ballerine/react-pdf-toolkit@1.2.50
+## 0.2.26 (2024-12-XX)
+
+### Patch Changes
+
+- chore(deps): update @ballerine/react-pdf-toolkit to 1.2.50
+  - Includes improvements in PDF rendering performance
+  - No breaking changes
sdks/workflow-browser-sdk/CHANGELOG.md (2)

7-7: Consider providing more descriptive changelog messages.

The message "Bump" is too vague and doesn't provide meaningful context about the changes. Consider following the Conventional Commits format and including a brief description of the actual changes.

Example of a better message:

-Bump
+chore(deps): update workflow-core and common dependencies

3-10: Consider standardizing the changelog format.

The changelog entries are inconsistent in their formatting. Some entries use "bump", others use "version bump", and some just list dependency updates. Consider adopting a consistent format across all entries.

Example of a consistent format:

## [0.6.77] - YYYY-MM-DD

### Changes
- Update @ballerine/workflow-core to 0.6.77
- Update @ballerine/common to 0.9.58

### Description
Brief description of notable changes or the reason for the version bump
apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (1)

20-51: Consider moving vendor details to a configuration file

The VENDOR_DETAILS constant contains vendor-specific information that might need frequent updates. Consider moving this to a separate configuration file for better maintainability and easier updates.

Create a new file config/vendors.ts:

export const VENDOR_DETAILS = {
  'dow-jones': {
    logoUrl: 'https://cdn.ballerine.io/logos/Dow_Jones_Logo.png',
    description: 'Dow Jones provides sanctions screening and risk data for individuals',
  },
  // ... rest of the vendor details
} as const;

export type VendorId = keyof typeof VENDOR_DETAILS;

Then import it in this file:

-export const VENDOR_DETAILS = {
-  // ... vendor details
-} as const;
-
-export type VendorId = keyof typeof VENDOR_DETAILS;
+import { VENDOR_DETAILS, VendorId } from '@/config/vendors';
packages/react-pdf-toolkit/CHANGELOG.md (1)

7-7: Enhance changelog message clarity.

The message "Bump" is too vague. Please provide a more descriptive message that explains what changed in this version. This helps other developers understand the purpose of this release.

Example of a better message:

-Bump
+Updated dependencies to support new filter creation functionality
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 316e10b and f1eff03.

⛔ 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)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (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/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 (32)
  • packages/config/package.json
  • packages/eslint-config/package.json
  • services/websocket-service/package.json
  • packages/common/CHANGELOG.md
  • packages/eslint-config-react/CHANGELOG.md
  • sdks/web-ui-sdk/CHANGELOG.md
  • packages/rules-engine/CHANGELOG.md
  • examples/report-generation-example/package.json
  • packages/workflow-core/CHANGELOG.md
  • packages/eslint-config-react/package.json
  • services/workflows-service/CHANGELOG.md
  • packages/ui/CHANGELOG.md
  • packages/blocks/CHANGELOG.md
  • apps/workflows-dashboard/CHANGELOG.md
  • packages/eslint-config/CHANGELOG.md
  • packages/config/CHANGELOG.md
  • sdks/workflow-node-sdk/CHANGELOG.md
  • packages/common/package.json
  • packages/react-pdf-toolkit/package.json
  • apps/backoffice-v2/CHANGELOG.md
  • apps/kyb-app/CHANGELOG.md
  • examples/headless-example/package.json
  • examples/headless-example/CHANGELOG.md
  • sdks/workflow-node-sdk/package.json
  • packages/rules-engine/package.json
  • packages/workflow-core/package.json
  • packages/blocks/package.json
  • services/websocket-service/CHANGELOG.md
  • services/workflows-service/package.json
  • apps/workflows-dashboard/package.json
  • apps/backoffice-v2/package.json
  • apps/kyb-app/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • services/workflows-service/prisma/data-migrations
🔇 Additional comments (10)
websites/docs/package.json (1)

20-20: LGTM! Consider documenting new features.

The dependency version updates maintain consistency across the monorepo. However, since this PR implements new filter functionality, please ensure the documentation is updated accordingly.

Let's verify if documentation for the new filter functionality exists:

Also applies to: 26-27

✅ Verification successful

Documentation is up to date with filter functionality

The documentation already comprehensively covers filters functionality, including:

  • Detailed API endpoints for creating and managing filters
  • Clear explanation of filters as case queues in the case management system
  • Usage of filters in the dashboard UI
  • Examples of filter implementation in both KYC and KYB workflows

The version updates in the dependencies appear to be routine maintenance and don't introduce new filter functionality that would require documentation updates.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if filter-related documentation exists and if it needs updating

# Search for filter-related documentation files
echo "Searching for filter-related documentation..."
fd -e md -e mdx . websites/docs/src/content/docs/ --exec grep -l -i "filter"

# Search for any TODO comments related to filters in documentation
echo "Checking for TODO comments related to filters..."
rg -i "todo.*filter" websites/docs/src/content/docs/

Length of output: 715


Script:

#!/bin/bash
# Let's check the content of these files to see if they already document the new filter functionality
# or if they need updates

echo "Checking content of filter-related documentation files..."
for file in \
    "websites/docs/src/content/docs/en/learn/add_and_customize_workflows_in_the_case_management.md" \
    "websites/docs/src/content/docs/en/learn/using_the_case_management_dashboard.md" \
    "websites/docs/src/content/docs/en/learn/kyc_manual_review_example.mdx" \
    "websites/docs/src/content/docs/en/learn/kyb_manual_review_example.mdx" \
    "websites/docs/src/content/docs/en/learn/invoking_a_workflow.md"
do
    echo "=== Content of $file ==="
    cat "$file" | grep -A 5 -B 5 -i "filter"
done

# Let's also check what's new in the common package that might need documentation
echo "Checking recent changes in @ballerine/common package..."
rg -l "filter" packages/common/src/ | xargs -I {} echo "=== {}" && rg "filter" packages/common/src/

Length of output: 9192

apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (4)

65-67: Enhance clipboard functionality with error handling and user feedback

The clipboard function should handle potential errors and provide user feedback.


164-262: Extract integration catalog dialog to a separate component

The dialog implementation is quite large and contains complex nested logic.


279-279: Remove any type casting for better type safety

Define proper interfaces for the plugin type instead of using any.


300-304: LGTM! Well-implemented image error handling

The error handling for image loading with a fallback to the default logo is well implemented.

packages/react-pdf-toolkit/CHANGELOG.md (1)

8-10: Verify dependency updates align with filter creation feature.

Let's ensure these dependency updates support the new filter creation functionality mentioned in the PR objectives.

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

4-4: Verify version consistency across the monorepo

The version updates look consistent, but let's verify the version alignment across the monorepo to ensure all packages are properly synchronized.

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

✅ Verification successful

Version alignment verified across the monorepo

All @ballerine packages show consistent version numbers across the monorepo:

  • @ballerine/common: 0.9.58
  • @ballerine/workflow-core: 0.6.77
  • @ballerine/config: 1.1.27
  • @ballerine/eslint-config: 1.1.27

The version updates in workflow-browser-sdk/package.json are properly synchronized with all other packages in the monorepo.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check version consistency across @ballerine packages

# Find all package.json files and extract @ballerine/* dependency versions
echo "Checking @ballerine/* dependency versions across the monorepo..."
rg -g "package.json" "@ballerine/(?:common|workflow-core|config|eslint-config).*\d+\.\d+\.\d+" -A 1

Length of output: 5211

packages/ui/package.json (1)

4-4: Verify the version jump in @ballerine/common dependency

The @ballerine/common dependency is being updated from ^0.9.55 to ^0.9.58, skipping versions 0.9.56 and 0.9.57. Let's verify if there are any breaking changes or important updates in the skipped versions that need to be considered.

Also applies to: 29-29, 68-69

✅ Verification successful

Based on the output from the shell scripts, I can now generate a final response. The CHANGELOG.md entries show that versions 0.9.56 through 0.9.58 of @ballerine/common were regular package updates without any breaking changes. The changes appear to be routine package upgrades across the monorepo's packages.

Version updates in @ballerine/common are routine package upgrades

The version jump from 0.9.55 to 0.9.58 consists of regular package updates without any breaking changes. The CHANGELOG.md entries confirm these were standard upgrades propagated across all dependent packages in the monorepo.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

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

# Look for BREAKING CHANGE or BREAKING CHANGES in commit messages
echo "Checking for breaking changes in @ballerine/common..."
git log --grep="BREAKING CHANGE\|BREAKING CHANGES" -i --since="1 month ago"

# Check changelog entries if they exist
echo "Checking changelog entries..."
rg -g "CHANGELOG.md" "## \[0\.9\.(56|57)\]" -A 10

Length of output: 235


Script:

#!/bin/bash
# Let's try a different approach to check the version changes

# Check package.json in @ballerine/common for version history
echo "Checking @ballerine/common package.json versions..."
fd "package.json" --exec grep -l "@ballerine/common" {} \; | xargs cat

# Look for any recent changes in @ballerine/common
echo "Checking recent changes in common package..."
fd "package.json" -p "packages/common/" --exec cat {}

# Check for any migration guides or upgrade notes
echo "Checking for migration/upgrade documentation..."
rg -g "*.md" -i "upgrade|migration|breaking|0.9.5[6-8]" 

Length of output: 53346

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

24-24: LGTM! Version updates are consistent

The version bump and dependency update are minimal and align with the changes in other packages.

Also applies to: 99-99


Line range hint 1-999: Note: Package updates don't implement filter functionality

While these version updates are necessary for maintaining dependency consistency, they don't directly contribute to the PR's objective of implementing create filter functionality. Are there additional files that contain the actual filter implementation?

@alonp99 alonp99 disabled auto-merge December 11, 2024 08:25
@alonp99 alonp99 enabled auto-merge (squash) December 11, 2024 08:25
@alonp99 alonp99 merged commit b8bf216 into dev Dec 11, 2024
10 checks passed
@alonp99 alonp99 deleted the BAL-3153-customization-dashboard branch December 11, 2024 08:25
@alonp99 alonp99 restored the BAL-3153-customization-dashboard branch December 11, 2024 08:44
Omri-Levy added a commit that referenced this pull request Dec 15, 2024
* feat(filters): implement create filter functionality (#2881)

* style(components): change button state styling to fix disappearing buttons (#2877)

* style(components): enhance button state styling for better UX

- Update button classes to include hover and enabled states
- Remove unused CSS rules to streamline styles

(your buttons now have more states than a soap opera character)

* fix(buttons): update background color for button components

- Change button styles from slate to primary background and hover colors
- Ensure consistency across different components for better UX

(your color choices are so dark, they could be the backdrop for a horror movie)

---------

Co-authored-by: Omri Levy <61207713+Omri-Levy@users.noreply.github.com>

* fix(stepper): improve step display and clean up formatting

- Refactor step display to enhance layout and readability
- Add a new no-op constant to built-in events
- Clean up transition validation logic

(Your transition validation is so confusing, it makes find-and-replace look like a clear path)

* Date input improvements (#2889)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* EditableDetailsV2 input type improvement (#2891)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

* fix(backoffice-v2): no longer looking at form value for input type

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* EditableDetailsV2 added ability to override input type (#2892)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

* fix(backoffice-v2): no longer looking at form value for input type

* feat(backoffice-v2): added a way to override input type

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* Dev 318/action alert delivery (#2893)

* feat: adding changes for sending alerts to specific channel

* fix: added change in hotfix action

---------

Co-authored-by: Alon Peretz <8467965+alonp99@users.noreply.github.com>
Co-authored-by: Shane <66246046+shanegrouber@users.noreply.github.com>
Co-authored-by: Tomer Shvadron <tomers@ballerine.com>
Co-authored-by: Chirag <134513193+codechirag123@users.noreply.github.com>
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.

Cloning UI definition fails with 409 Conflict
2 participants