Skip to content

Conversation

Omri-Levy
Copy link
Contributor

@Omri-Levy Omri-Levy commented Jun 25, 2025

  • fix(backoffice-v2): added handling for invalid phone numbers such as emails
  • refactor(*): renamed merchant monitoring and screening plugin display names

Summary by CodeRabbit

  • Style
    • Updated various user interface texts to replace "Merchant Monitoring" with "Web Presence" and "Merchant Screening" with "MATCH Screening" across dashboards, cards, headings, and plugin display names.
  • Documentation
    • Refreshed API documentation and example configurations to reflect the new naming conventions for supported workflows.

Copy link

changeset-bot bot commented Jun 25, 2025

⚠️ No Changeset found

Latest commit: bce098d

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 Jun 25, 2025

Walkthrough

This update standardizes terminology across the codebase by renaming "Merchant Monitoring" to "Web Presence" and "Merchant Screening" to "MATCH Screening" in UI components, plugin configurations, workflow definitions, and API documentation. No logic, control flow, or exported entity signatures were modified; only display names and descriptive strings were updated.

Changes

Files/Paths Change Summary
.../ProcessTracker/trackers/merchant-monitoring/MerchantMonitoringTracker.tsx Changed Tracker.Item title from "Merchant Monitoring" to "Web Presence".
.../DynamicMetricsSection/DynamicMetricsSection.tsx Changed heading from "Merchant Monitoring Risk Analytics" to "Web Presence Risk Analytics".
.../PortfolioRiskStatistics/PortfolioRiskStatistics.tsx Updated card header/description from "Merchant Monitoring Risk" to "Web Presence Risk".
.../WorkflowDefinition/WorkflowDefinition.tsx Updated VENDOR_DETAILS: "Merchant Monitoring" → "Web Presence", "Merchant Screening" → "MATCH Screening".
.../vendor-consts.ts Changed plugin displayName from "Merchant Monitoring" to "Web Presence".
.../prisma/data-migrations Updated subproject commit reference.
.../demo-workflow/eu/kyb-workflow-definition.ts
.../us/kyb-workflow-definition.ts
.../workflow-definition-with-associated.ts
Changed plugin displayNames: "Merchant Monitoring" → "Web Presence", "Merchant Screening" → "MATCH Screening".
.../workflow.controller.external.ts Updated API docs and example: "Merchant Monitoring" → "Web Presence".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI_Component
    participant Plugin_Config
    participant Workflow_Definition
    participant API_Docs

    User->>UI_Component: Sees "Web Presence" (was "Merchant Monitoring")
    UI_Component->>Plugin_Config: Uses updated displayName "Web Presence"
    Plugin_Config->>Workflow_Definition: Reflects new naming in workflow plugins
    User->>API_Docs: Reads "Web Presence" in endpoint descriptions
Loading

Suggested reviewers

  • tomer-shvadron

Poem

In fields of code where changes grow,
"Merchant Monitoring" had to go.
Now "Web Presence" takes the stage,
Across each workflow, doc, and page.
A rabbit hops with cheerful glee,
For naming's now in harmony! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d6bf71 and bce098d.

📒 Files selected for processing (1)
  • apps/backoffice-v2/src/pages/Home/components/PortfolioRiskStatistics/PortfolioRiskStatistics.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/backoffice-v2/src/pages/Home/components/PortfolioRiskStatistics/PortfolioRiskStatistics.tsx
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: test_linux
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: lint
  • GitHub Check: spell_check
  • GitHub Check: format
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation 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

🧹 Nitpick comments (4)
services/workflows-service/prisma/data-migrations (1)

1-1: Confirm the new migration commit is pulled and applied in all environments

Updating the submodule pointer is necessary, but it has no effect until every consuming environment (CI, staging, prod) actually checks out the new commit and runs prisma migrate deploy (or equivalent).

Please verify that:

  1. git submodule update --init --recursive is executed in the CI pipeline after the merge.
  2. Any new SQL produced by e6383e2… is applied or gated behind the usual migration-runner.

If these steps are already covered, feel free to ignore.

apps/backoffice-v2/src/pages/Home/components/DynamicMetricsSection/DynamicMetricsSection.tsx (1)

38-40: Hard-coded heading – consider i18n

"Web Presence Risk Analytics" is hard-coded; previous text was hard-coded too, but since you're already touching this line, it’s a good opportunity to lift the copy into the translation layer (react-i18next, @lingui, etc.) to keep consistency with the rest of the Backoffice.

apps/backoffice-v2/src/pages/Home/components/PortfolioRiskStatistics/PortfolioRiskStatistics.tsx (1)

47-50: Header updated but body copy still says “merchant monitoring”

Line 50 still reads:

<p className={'mb-8'}>Risk levels of all merchant monitoring reports.</p>

If the product terminology is fully shifting to “Web Presence”, update the accompanying description for coherence.

-  <p className={'mb-8'}>Risk levels of all merchant monitoring reports.</p>
+  <p className={'mb-8'}>Risk levels of all web-presence reports.</p>
apps/backoffice-v2/src/common/utils/get-phone-number-formatter/get-phone-number-formatter.unit.test.ts (1)

1-43: Expand test coverage for better validation.

The test structure and approach are solid, following arrange-act-assert pattern and using appropriate vitest framework. The tests cover the main use case from the PR (preventing emails from being processed as phone numbers).

Consider adding tests for edge cases that the regex is designed to handle:

+  describe('when invalid formats are passed', () => {
+    it.each([
+      ['empty string', ''],
+      ['just plus sign', '+'],
+      ['just hyphens', '---'],
+      ['double hyphens', '+972--052-625-3312'],
+      ['starts with hyphen', '-972052625331'],
+      ['ends with hyphen', '+972052625331-'],
+      ['hyphen before plus', '972-+052625331'],
+    ])('should return undefined for %s', (_, value) => {
+      const result = getPhoneNumberFormatter(value);
+      expect(result).toBeUndefined();
+    });
+  });

Also consider testing the actual parsed phone number format for valid inputs:

   describe('when a phone number with a country code is passed', () => {
     it('should return a formatter', () => {
       const value = '+9720526253312';
       const result = getPhoneNumberFormatter(value);
-      expect(result).toBeDefined();
+      expect(result).toBeDefined();
+      expect(result?.country).toBe('IL'); // Assuming this is an Israeli number
     });
   });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b8d1a2 and 6d6bf71.

📒 Files selected for processing (12)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/merchant-monitoring/MerchantMonitoringTracker.tsx (1 hunks)
  • apps/backoffice-v2/src/common/utils/get-phone-number-formatter/get-phone-number-formatter.ts (1 hunks)
  • apps/backoffice-v2/src/common/utils/get-phone-number-formatter/get-phone-number-formatter.unit.test.ts (1 hunks)
  • apps/backoffice-v2/src/pages/Home/components/DynamicMetricsSection/DynamicMetricsSection.tsx (1 hunks)
  • apps/backoffice-v2/src/pages/Home/components/PortfolioRiskStatistics/PortfolioRiskStatistics.tsx (1 hunks)
  • apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx (3 hunks)
  • packages/workflow-core/src/lib/plugins/external-plugin/vendor-consts.ts (1 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
  • services/workflows-service/src/workflow-defintion/demo-workflow/eu/kyb-workflow-definition.ts (2 hunks)
  • services/workflows-service/src/workflow-defintion/demo-workflow/us/kyb-workflow-definition.ts (2 hunks)
  • services/workflows-service/src/workflow-defintion/demo-workflow/workflow-definition-with-associated.ts (1 hunks)
  • services/workflows-service/src/workflow/workflow.controller.external.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`apps/backoffice-v2/**/*.{ts,tsx}`: Use functional components with TypeScript. I...

apps/backoffice-v2/**/*.{ts,tsx}: Use functional components with TypeScript.
Implement smart/dumb component pattern.
Place components in feature-based directories.
Use compound components for complex UIs.
Follow atomic design principles.
Use React Query for server state and API calls.
Use Context for shared state.
Implement state machines for complex flows.
Use local state for UI-only state.
Follow unidirectional data flow.
Use strict TypeScript configuration.
Define interfaces for all props.
Use discriminated unions for state.
Leverage type inference.
Use Radix UI for accessible components.
Implement proper ARIA attributes.
Follow consistent styling patterns.
Use composition over inheritance.
Keep components small and focused.
Use React Hook Form for forms.
Implement Zod for validation.
Handle form submission states.
Show validation feedback.
Use controlled inputs when needed.
Implement proper loading states for data fetching.
Handle error states gracefully.
Cache responses appropriately.
Type API responses.
Use error boundaries.
Implement fallback UI.
Handle async errors.
Show user-friendly error messages.
Log errors appropriately.
Use React.memo wisely.
Implement proper code splitting.
Use lazy loading for routes.
Optimize re-renders.
Profile performance regularly.
Write unit tests for components.
Use React Testing Library.
Mock external dependencies in tests.
Maintain good test coverage.
Follow feature-based organization.
Use index files for exports.
Keep related files together.
Use consistent naming.
Implement barrel exports.
Use Tailwind CSS for styling.
Follow utility-first approach for styling.
Use CSS variables for theming.
Keep styles maintainable.
Use CSS modules when needed.
Document complex logic.
Write clear component documentation.
Keep documentation up to date.
Use JSDoc when helpful.
Follow ESLint rules.
Use consistent formatting.
Write clear variable names.
Keep functions pure.
Use meaningful types.
Validate user input.
Implement proper authentication.
Handle sensitive data carefully.
Follow security best practices.
Use HTTPS for API calls.
Follow WCAG guidelines for accessibility.
Use semantic HTML.
Test with screen readers.
Ensure keyboard navigation.
Provide proper focus management.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/backoffice-v2.mdc)

List of files the instruction was applied to:

  • apps/backoffice-v2/src/pages/Home/components/DynamicMetricsSection/DynamicMetricsSection.tsx
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/merchant-monitoring/MerchantMonitoringTracker.tsx
  • apps/backoffice-v2/src/pages/Home/components/PortfolioRiskStatistics/PortfolioRiskStatistics.tsx
  • apps/backoffice-v2/src/common/utils/get-phone-number-formatter/get-phone-number-formatter.ts
  • apps/backoffice-v2/src/common/utils/get-phone-number-formatter/get-phone-number-formatter.unit.test.ts
`apps/workflows-dashboard/**/*.{ts,tsx}`: Use functional components with TypeScr...

apps/workflows-dashboard/**/*.{ts,tsx}: Use functional components with TypeScript.
Follow feature-based architecture.
Implement container/presenter pattern.
Use compound components when needed.
Keep components focused and small.
Separate business logic into hooks and place hooks in feature directories.
Use custom hooks for reusable logic and follow the 'use' prefix convention.
Keep hooks single-purpose.
Use React Query for API state and data fetching.
Implement Context for shared state.
Use local state for UI elements.
Follow flux architecture.
Keep state normalized.
Use strict mode in TypeScript.
Define clear interfaces and use type inference.
Export types separately.
Use discriminated unions.
Use data visualization libraries for dashboard components.
Implement proper loading, empty, and error states in dashboard components.
Use proper grid layouts in dashboard components.
Implement proper caching for data fetching.
Type API responses.
Implement clear workflow states and handle transitions properly.
Show progress indicators and validate workflow steps.
Handle workflow edge cases.
Use error boundaries and show user-friendly errors.
Log errors appropriately and implement fallbacks.
Handle async errors.
Optimize renders and use virtualization for lists.
Implement code splitting and use lazy loading.
Monitor performance.
Write unit and integration tests, and mock API responses.
Test workflows and error states thoroughly.
Use feature folders and keep related files together.
Use clear naming and implement barrel exports.
Follow consistent file structure.
Use Tailwind CSS and follow the design system.
Use CSS variables and keep styles maintainable.
Use CSS modules when needed.
Use React Hook Form for forms and implement validation.
Show feedback, handle submissions, and use controlled inputs in forms.
Document complex logic and write clear comments.
Keep documentation updated and use JSDoc.
Document APIs.
Follow ESLint rules and use consistent style.
Write clear, maintainable code and review regularly.
Follow WCAG and use semantic HTML for accessibility.
Add ARIA labels, test keyboard navigation, and support screen readers.
Validate inputs and handle authentication properly for security.
Protect sensitive data, follow security best practices, and use secure APIs.
Follow React best practices and keep code DRY.
Handle edge cases and write clean code.
Review code regularly.
Use proper charts and show clear metrics in dashboard.
Implement filters, handle large datasets, and support sorting in dashboard.
Show clear workflow status, use proper icons, implement transitions, show progress, and handle errors in workflow visualization.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/workflows-dashboard.mdc)

List of files the instruction was applied to:

  • apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (8)
packages/workflow-core/src/lib/plugins/external-plugin/vendor-consts.ts (2)

513-517: pluginKind appears inconsistent with the enclosing factory key

The object is returned under the 'merchant-monitoring' branch, yet pluginKind is still set to 'api'.
Down-stream consumers that rely on pluginKind === 'merchant-monitoring' for routing or analytics will silently miss this plugin.

-      pluginKind: 'api',
+      pluginKind: 'merchant-monitoring',

Please double-check the contract expected by any schema validations, type-guards, or UI filters before changing.


515-515: Rename looks gooddisplayName now matches the new wording (“Web Presence”).

apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/merchant-monitoring/MerchantMonitoringTracker.tsx (1)

15-17: LGTM – title aligned with the new terminology

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

279-283: Display name updated consistently – no further issues spotted.

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

266-266: Approved: Consistent display name updates

The display name changes from "Merchant Monitoring" to "Web Presence" and "Merchant Screening" to "MATCH Screening" improve naming clarity while preserving all functional aspects of the plugins.

Also applies to: 282-282

services/workflows-service/src/workflow/workflow.controller.external.ts (1)

259-259: Approved: API documentation consistency

The updates to the Swagger documentation and example workflow configuration correctly reflect the new "Web Presence" display name, maintaining consistency with the plugin changes.

Also applies to: 305-305

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

264-264: Approved: Regional consistency maintained

The display name updates match those in the US workflow definition, ensuring consistent naming across different regional configurations while preserving plugin functionality.

Also applies to: 280-280

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

139-139: Approved: UI consistency with backend changes

The vendor details updates align perfectly with the backend workflow definition changes, ensuring users see consistent "Web Presence" and "MATCH Screening" terminology throughout the application interface.

Also applies to: 150-150, 170-170

Comment on lines 9 to 11
if (!/^(?!-)(?!\+?$)(?!-+$)(?!.*-\+)(?!.*--)\+?[\d-]+(?<!-)$/.test(value)) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Document the complex regex pattern for maintainability.

The regex validation is a good addition to prevent invalid inputs like emails from being processed as phone numbers. However, the pattern is quite complex with multiple negative lookaheads and lookbehinds, making it difficult to understand and maintain.

Consider adding a comment explaining the regex logic or extracting it to a named constant:

+// Regex to validate phone number format:
+// - Must not start or end with hyphen
+// - Must not be empty or just a plus sign
+// - Must not contain double hyphens or hyphen before plus
+// - Must contain only digits, hyphens, and optional leading plus
+const PHONE_NUMBER_PATTERN = /^(?!-)(?!\+?$)(?!-+$)(?!.*-\+)(?!.*--)\+?[\d-]+(?<!-)$/;
+
 export const getPhoneNumberFormatter = (value: string) => {
   try {
-    if (!/^(?!-)(?!\+?$)(?!-+$)(?!.*-\+)(?!.*--)\+?[\d-]+(?<!-)$/.test(value)) {
+    if (!PHONE_NUMBER_PATTERN.test(value)) {
       return;
     }
🤖 Prompt for AI Agents
In
apps/backoffice-v2/src/common/utils/get-phone-number-formatter/get-phone-number-formatter.ts
around lines 9 to 11, the regex pattern used for phone number validation is
complex and hard to understand. To improve maintainability, add a clear comment
above the regex explaining its purpose and the key parts of the pattern.
Alternatively, extract the regex into a well-named constant with a descriptive
name and add the explanatory comment there.

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