Skip to content

Commit

Permalink
feat: improved traffic visualization (BAL-3271) (#2922)
Browse files Browse the repository at this point in the history
  • Loading branch information
r4zendev authored Jan 1, 2025
1 parent bcd15d5 commit 8fabbc9
Show file tree
Hide file tree
Showing 15 changed files with 317 additions and 85 deletions.
9 changes: 9 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @ballerine/backoffice-v2

## 0.7.88

### Patch Changes

- Updated traffic-related stats in the "Website credibility" tab.
- Updated dependencies
- @ballerine/react-pdf-toolkit@1.2.57
- @ballerine/ui@0.5.57

## 0.7.87

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions apps/backoffice-v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ballerine/backoffice-v2",
"version": "0.7.87",
"version": "0.7.88",
"description": "Ballerine - Backoffice",
"homepage": "https://github.com/ballerine-io/ballerine",
"type": "module",
Expand Down Expand Up @@ -53,10 +53,10 @@
"dependencies": {
"@ballerine/blocks": "0.2.30",
"@ballerine/common": "0.9.63",
"@ballerine/react-pdf-toolkit": "^1.2.54",
"@ballerine/ui": "^0.5.54",
"@ballerine/workflow-browser-sdk": "0.6.82",
"@ballerine/workflow-node-sdk": "0.6.82",
"@ballerine/react-pdf-toolkit": "^1.2.57",
"@ballerine/ui": "^0.5.57",
"@botpress/webchat": "^2.1.10",
"@botpress/webchat-generator": "^0.2.9",
"@fontsource/inter": "^4.5.15",
Expand Down
8 changes: 8 additions & 0 deletions apps/kyb-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# kyb-app

## 0.3.103

### Patch Changes

- Updated traffic-related stats in the "Website credibility" tab.
- Updated dependencies
- @ballerine/ui@0.5.57

## 0.3.102

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions apps/kyb-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/kyb-app",
"private": true,
"version": "0.3.102",
"version": "0.3.103",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -17,8 +17,8 @@
"dependencies": {
"@ballerine/blocks": "0.2.30",
"@ballerine/common": "^0.9.63",
"@ballerine/ui": "0.5.56",
"@ballerine/workflow-browser-sdk": "0.6.82",
"@ballerine/ui": "0.5.57",
"@lukemorales/query-key-factory": "^1.0.3",
"@radix-ui/react-icons": "^1.3.0",
"@rjsf/core": "^5.9.0",
Expand Down
8 changes: 8 additions & 0 deletions packages/react-pdf-toolkit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @ballerine/react-pdf-toolkit

## 1.2.57

### Patch Changes

- Updated traffic-related stats in the "Website credibility" tab.
- Updated dependencies
- @ballerine/ui@0.5.57

## 1.2.56

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/react-pdf-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/react-pdf-toolkit",
"private": false,
"version": "1.2.56",
"version": "1.2.57",
"types": "./dist/build.d.ts",
"main": "./dist/react-pdf-toolkit.js",
"module": "./dist/react-pdf-toolkit.mjs",
Expand All @@ -27,7 +27,7 @@
},
"dependencies": {
"@ballerine/config": "^1.1.28",
"@ballerine/ui": "0.5.56",
"@ballerine/ui": "0.5.57",
"@react-pdf/renderer": "^3.1.14",
"@sinclair/typebox": "^0.31.7",
"ajv": "^8.12.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ballerine/ui

## 0.5.57

### Patch Changes

- Updated traffic-related stats in the "Website credibility" tab.

## 0.5.56

### Patch Changes
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/ui",
"private": false,
"version": "0.5.56",
"version": "0.5.57",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -44,6 +44,7 @@
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-scroll-area": "^1.0.2",
"@radix-ui/react-slot": "^1.0.1",
"@radix-ui/react-tooltip": "^1.0.7",
"@rjsf/core": "^5.9.0",
"@rjsf/utils": "^5.9.0",
"@rjsf/validator-ajv8": "^5.9.0",
Expand All @@ -61,6 +62,7 @@
"react-image": "^4.1.0",
"react-json-view": "^1.21.3",
"react-phone-input-2": "^2.15.1",
"recharts": "^2.7.2",
"string-ts": "^1.2.0",
"tailwind-merge": "^1.10.0",
"zod": "^3.23.4"
Expand Down
29 changes: 29 additions & 0 deletions packages/ui/src/components/atoms/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use client';

import { ctw } from '@/common/utils/ctw';
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
import * as React from 'react';

const Tooltip = TooltipPrimitive.Root;

const TooltipProvider = TooltipPrimitive.Provider;

const TooltipTrigger = TooltipPrimitive.Trigger;

const TooltipContent = React.forwardRef<
React.ElementRef<typeof TooltipPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={ctw(
'z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className,
)}
{...props}
/>
));
TooltipContent.displayName = TooltipPrimitive.Content.displayName;

export { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider };
1 change: 1 addition & 0 deletions packages/ui/src/components/atoms/Tooltip/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Tooltip';
1 change: 1 addition & 0 deletions packages/ui/src/components/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export * from './ScrollArea';
export * from './Skeleton';
export * from './Table';
export * from './TextWithNAFallback';
export * from './Tooltip';
export * from './WarningFilledSvg';
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ const normalizeRiskLevel = (riskTypeLevels: Record<string, SeverityType>) => {
}, {} as Record<string, SeverityType>);
};

const normalizeHyphenedDataString = (str: string) => {
const parts = str.split(' - ');

return {
label: parts.length > 1 ? parts.slice(0, -1).join(' - ') : parts.at(0),
value: parts.at(-1),
};
};

export const reportAdapter = {
DEFAULT: (report: Record<string, any>) => {
return {
Expand Down Expand Up @@ -170,23 +179,17 @@ export const reportAdapter = {
pricingAnalysis: report?.transactionLaundering?.pricingAnalysis?.indicators,
websiteStructureAndContentEvaluation:
report?.transactionLaundering?.websiteStructureEvaluation?.indicators,
trafficAnalysis: [
{
label: 'Estimated Monthly Visits',
items: report?.transactionLaundering?.trafficAnalysis?.montlyVisitsIndicators ?? [],
},
{
label: 'Traffic Sources',
items: report?.transactionLaundering?.trafficAnalysis?.trafficSources ?? [],
},
{
label: 'Engagements',
items: report?.transactionLaundering?.trafficAnalysis?.engagements ?? [],
},
] satisfies Array<{
label: string;
items: string[];
}>,
trafficAnalysis: {
montlyVisitsIndicators: (
report?.transactionLaundering?.trafficAnalysis?.montlyVisitsIndicators ?? []
).map(normalizeHyphenedDataString),
trafficSources: (report?.transactionLaundering?.trafficAnalysis?.trafficSources ?? []).map(
normalizeHyphenedDataString,
),
engagements: (report?.transactionLaundering?.trafficAnalysis?.engagements ?? []).map(
normalizeHyphenedDataString,
),
},
homepageScreenshotUrl: report?.homepageScreenshot,
formattedMcc: report?.lineOfBusiness?.formattedMcc,
};
Expand Down
Loading

0 comments on commit 8fabbc9

Please sign in to comment.