Skip to content

Commit

Permalink
Merge branch 'dev' into epic/feat/admin-tools2
Browse files Browse the repository at this point in the history
  • Loading branch information
alonp99 authored Jun 16, 2024
2 parents 59ca5f7 + 39776fc commit 436d41c
Show file tree
Hide file tree
Showing 243 changed files with 6,670 additions and 1,181 deletions.
14 changes: 13 additions & 1 deletion .github/actions/test-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ runs:

- name: Test
shell: bash
run: pnpm test
run: pnpm test -- --verbose false
env:
ENVIRONMENT_NAME: test
JEST_HTML_REPORTER_PAGE_TITLE: ${{ github.ref_name }}

- name: Store test result
uses: actions/[email protected]
id: artifact-upload-step
with:
name: test-report.html
path: services/workflows-service/ci/test-report.html
retention-days: 7

1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ jobs:

- name: Test
uses: ./.github/actions/test-action

test_windows:
runs-on: windows-latest
timeout-minutes: 60
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/publish-workflows-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ env:
IMAGE_NAME: ${{ github.repository_owner }}/workflows-service

jobs:

determine_branch:
runs-on: ubuntu-latest
outputs:
Expand All @@ -47,7 +48,7 @@ jobs:
build-and-push-image:
runs-on: ubuntu-latest
needs: determine_branch
needs: [determine_branch]
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -296,7 +297,10 @@ jobs:
cd services/workflows-service/prisma/data-migrations
git fetch --no-tags --depth=1 origin +refs/heads/dev:refs/remotes/origin/${{ needs.determine_branch.outputs.branch }}
git checkout -b ${{ needs.determine_branch.outputs.branch }} origin/${{ needs.determine_branch.outputs.branch }}
git pull origin ${{ needs.determine_branch.outputs.branch }}
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git reset --hard HEAD
git pull origin ${{ needs.determine_branch.outputs.branch }} --rebase
is_exists=$(git ls-remote --exit-code --heads -t --ref -q origin "${{ needs.determine_branch.outputs.branch }}" | wc -l)
Expand Down Expand Up @@ -345,7 +349,10 @@ jobs:
cd services/workflows-service/prisma/data-migrations
git fetch --no-tags --depth=1 origin +refs/heads/dev:refs/remotes/origin/${{ needs.determine_branch.outputs.branch }}
git checkout -b ${{ needs.determine_branch.outputs.branch }} origin/${{ needs.determine_branch.outputs.branch }}
git pull origin ${{ needs.determine_branch.outputs.branch }}
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git reset --hard HEAD
git pull origin ${{ needs.determine_branch.outputs.branch }} --rebase
WF_M_SHORT_SHA=$(git rev-parse --short HEAD)
echo "sha_short=$WF_M_SHORT_SHA"
echo "wf_m_sha_short=$WF_M_SHORT_SHA" >> $GITHUB_OUTPUT
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ deploy/caddy/caddy_data
deploy/caddy/caddy_config

todo.md
services/workflows-service/test-report.html
services/workflows-service/ci/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ We believe in enabling companies to manage user identity and risk according to
**Getting started**
To set up a local environment, follow these steps:
1. #### Install prerequisites:
- Node.js ([Install NVM](https://github.com/nvm-sh/nvm))
- Node.js ([Install NVM](https://github.com/nvm-sh/nvm), then install node "nvm install --lts")
- Latest PNPM version ([Install PNPM](https://pnpm.io/installation))
- Docker and docker compose ([Docker](https://docs.docker.com/desktop), [Docker Compose](https://docs.docker.com/compose/install))

Expand Down
41 changes: 41 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# @ballerine/backoffice-v2

## 0.7.13

### Patch Changes

- Updated dependencies
- @ballerine/common@0.9.8
- @ballerine/workflow-browser-sdk@0.6.14
- @ballerine/workflow-node-sdk@0.6.14

## 0.7.12

### Patch Changes

- @ballerine/workflow-browser-sdk@0.6.13
- @ballerine/workflow-node-sdk@0.6.13

## 0.7.11

### Patch Changes

- Updated dependencies
- @ballerine/common@0.9.7
- @ballerine/ui@0.5.3
- @ballerine/workflow-browser-sdk@0.6.12
- @ballerine/workflow-node-sdk@0.6.12

## 0.7.10

### Patch Changes

- Updated dependencies
- @ballerine/workflow-browser-sdk@0.6.11
- @ballerine/workflow-node-sdk@0.6.11

## 0.7.9

### Patch Changes

- @ballerine/workflow-browser-sdk@0.6.10
- @ballerine/workflow-node-sdk@0.6.10

## 0.7.8

### Patch Changes
Expand Down
12 changes: 7 additions & 5 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.8",
"version": "0.7.13",
"description": "Ballerine - Backoffice",
"homepage": "https://github.com/ballerine-io/ballerine",
"repository": {
Expand Down Expand Up @@ -50,11 +50,11 @@
"preview": "vite preview"
},
"dependencies": {
"@ballerine/common": "0.9.6",
"@ballerine/blocks": "0.2.3",
"@ballerine/ui": "^0.5.1",
"@ballerine/workflow-browser-sdk": "0.6.9",
"@ballerine/workflow-node-sdk": "0.6.9",
"@ballerine/common": "0.9.8",
"@ballerine/ui": "^0.5.3",
"@ballerine/workflow-browser-sdk": "0.6.14",
"@ballerine/workflow-node-sdk": "0.6.14",
"@fontsource/inter": "^4.5.15",
"@formkit/auto-animate": "1.0.0-beta.5",
"@hookform/resolvers": "^3.1.0",
Expand Down Expand Up @@ -97,8 +97,10 @@
"qs": "^6.11.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.13",
"react-hook-form": "^7.43.9",
"react-i18next": "^12.1.4",
"react-image": "^4.1.0",
"react-image-crop": "^10.0.9",
"react-json-view": "^1.21.3",
"react-leaflet": "^4.2.1",
Expand Down
5 changes: 5 additions & 0 deletions apps/backoffice-v2/public/locales/en/toast.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,10 @@
"revert_decision_alerts": {
"success": "The alerts decision have been reverted successfully.",
"error": "Error occurred while reverting the alerts decision."
},
"business_report_creation": {
"success": "Merchant check created successfully.",
"error": "Error occurred while creating a merchant check.",
"is_example": "Please contact Ballerine at [email protected] for access to this feature."
}
}
25 changes: 25 additions & 0 deletions apps/backoffice-v2/src/Router/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import { TransactionMonitoring } from '@/pages/TransactionMonitoring/Transaction
import { TransactionMonitoringAlertsAnalysisPage } from '@/pages/TransactionMonitoringAlertsAnalysis/TransactionMonitoringAlertsAnalysis.page';
import { Profiles } from '@/pages/Profiles/Profiles.page';
import { Individuals } from '@/pages/Profiles/Individuals/Individuals.page';
import { MerchantMonitoring } from '@/pages/MerchantMonitoring/MerchantMonitoring.page';
import { MerchantMonitoringCreateCheckPage } from '@/pages/MerchantMonitoringCreateCheck/MerchantMonitoringCreateCheck.page';
import { MerchantMonitoringBusinessReport } from '@/pages/MerchantMonitoringBusinessReport/MerchantMonitoringBusinessReport.page';
import { MerchantMonitoringLayout } from '@/domains/business-reports/components/MerchantMonitoringLayout/MerchantMonitoringLayout';

const router = createBrowserRouter([
{
Expand Down Expand Up @@ -69,6 +73,27 @@ const router = createBrowserRouter([
element: <Locale />,
errorElement: <RouteError />,
children: [
{
element: <MerchantMonitoringLayout />,
errorElement: <RouteError />,
children: [
{
path: '/:locale/merchant-monitoring',
element: <MerchantMonitoring />,
errorElement: <RouteError />,
},
{
path: '/:locale/merchant-monitoring/:businessReportId',
element: <MerchantMonitoringBusinessReport />,
errorElement: <RouteError />,
},
{
path: '/:locale/merchant-monitoring/create-check',
element: <MerchantMonitoringCreateCheckPage />,
errorElement: <RouteError />,
},
],
},
{
path: '/:locale/case-management',
element: <CaseManagement />,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { ComponentProps, ElementType, forwardRef, ReactNode } from 'react';
import {
PolymorphicComponentProps,
PolymorphicComponentPropsWithRef,
PolymorphicRef,
} from '@/common/types';
import { checkIsUrl } from '@/common/utils/check-is-url/check-is-url';
import { BallerineLink } from '@/common/components/atoms/BallerineLink/BallerineLink';

export type TAnchorIfUrl = <TElement extends ElementType = 'span'>(
props: PolymorphicComponentPropsWithRef<TElement> & ComponentProps<'a'>,
) => ReactNode;

export const AnchorIfUrl: TAnchorIfUrl = forwardRef(
<TElement extends ElementType = 'span'>(
{ as, children, ...props }: PolymorphicComponentProps<TElement> & ComponentProps<'a'>,
ref?: PolymorphicRef<TElement>,
) => {
const Component = as ?? 'span';

if (checkIsUrl(children)) {
return (
<BallerineLink ref={ref} {...props}>
{children}
</BallerineLink>
);
}

return (
<Component ref={ref} {...props}>
{children}
</Component>
);
},
);

// @ts-ignore
AnchorIfUrl.displayName = 'AnchorIfUrl';
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { buttonVariants } from '@/common/components/atoms/Button/Button';
import React, { ComponentProps, FunctionComponent } from 'react';
import { ctw } from '@/common/utils/ctw/ctw';

export const BallerineLink: FunctionComponent<ComponentProps<'a'>> = ({
className,
href,
children,
...props
}) => {
return (
<a
className={ctw(
buttonVariants({
variant: 'link',
}),
'h-[unset] cursor-pointer !p-0 !text-blue-500',
className,
)}
target={'_blank'}
rel={'noopener noreferrer'}
href={href}
>
{children}
</a>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export const Checkbox_ = forwardRef<
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
));

Checkbox_.displayName = CheckboxPrimitive.Root.displayName;
27 changes: 27 additions & 0 deletions apps/backoffice-v2/src/common/components/atoms/Image/BaseImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { ElementRef, forwardRef } from 'react';
import { ImageProps } from '@/common/components/atoms/Image/interfaces';
import { useImage } from 'react-image';
import { ctw } from '@/common/utils/ctw/ctw';

export const BaseImage = forwardRef<ElementRef<'img'>, ImageProps>(
({ className, alt, width, height, src: srcList, useImageProps, ...props }, ref) => {
const { src } = useImage({
...useImageProps,
srcList,
});

return (
<img
alt={alt}
src={src}
width={width}
height={height}
className={ctw(`rounded-md object-contain`, className)}
{...props}
ref={ref}
/>
);
},
);

BaseImage.displayName = 'BaseImage';
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Image } from './Image';
import { Meta, StoryObj } from '@storybook/react';

type Story = StoryObj<typeof Image>;

export default {
component: Image,
} satisfies Meta<typeof Image>;

export const Default = {
args: {
src: 'https://picsum.photos/150',
alt: 'Placeholder',
width: '150px',
height: '150px',
},
} satisfies Story;
39 changes: 39 additions & 0 deletions apps/backoffice-v2/src/common/components/atoms/Image/Image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { ImageIcon } from 'lucide-react';
import { Skeleton } from '@/common/components/atoms/Skeleton/Skeleton';
import { BaseImage } from '@/common/components/atoms/Image/BaseImage';
import { ComponentProps, ElementRef, forwardRef, Suspense } from 'react';
import { ErrorBoundary } from 'react-error-boundary';

export const Image = forwardRef<ElementRef<'img'>, ComponentProps<typeof BaseImage>>(
({ width, height, ...props }, ref) => {
return (
<ErrorBoundary
fallback={
<figure
className={`flex flex-col items-center justify-center space-y-2 rounded-md border border-destructive p-1`}
style={{ width, height }}
aria-live={`polite`}
>
<ImageIcon className={`h-[calc(1rem+15%)] w-[calc(1rem+15%)] stroke-destructive`} />
<figcaption className={`text-destructive`}>
An error occurred while loading the image
</figcaption>
</figure>
}
>
<Suspense
fallback={
<figure aria-live={`polite`} style={{ width, height }}>
<Skeleton className={`h-full w-full`} />
<figcaption className={`sr-only`}>Loading image...</figcaption>
</figure>
}
>
<BaseImage width={width} height={height} {...props} ref={ref} />
</Suspense>
</ErrorBoundary>
);
},
);

Image.displayName = 'Image';
2 changes: 2 additions & 0 deletions apps/backoffice-v2/src/common/components/atoms/Image/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Image';
export * from './interfaces';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { CSSProperties, ImgHTMLAttributes } from 'react';
import { useImageProps } from 'react-image';

export interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'src'> {
src: useImageProps['srcList'];
useImageProps?: Omit<useImageProps, 'srcList'>;
width: CSSProperties['width'];
height: CSSProperties['height'];
}
Loading

0 comments on commit 436d41c

Please sign in to comment.