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

SB <- DEV #2207

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @ballerine/backoffice-v2

## 0.5.58

### Patch Changes

- @ballerine/[email protected]
- @ballerine/[email protected]

## 0.5.57

### Patch Changes

- @ballerine/[email protected]
- @ballerine/[email protected]

## 0.5.56

### 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.5.56",
"version": "0.5.58",
"description": "Ballerine - Backoffice",
"homepage": "https://github.com/ballerine-io/ballerine",
"repository": {
Expand Down Expand Up @@ -53,8 +53,8 @@
"@ballerine/blocks": "0.1.29",
"@ballerine/common": "0.7.49",
"@ballerine/ui": "^0.3.31",
"@ballerine/workflow-browser-sdk": "0.5.50",
"@ballerine/workflow-node-sdk": "0.5.50",
"@ballerine/workflow-browser-sdk": "0.5.52",
"@ballerine/workflow-node-sdk": "0.5.52",
"@fontsource/inter": "^4.5.15",
"@formkit/auto-animate": "1.0.0-beta.5",
"@hookform/resolvers": "^3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const WorkflowDefinitionConfigSchema = z

export const WorkflowDefinitionByIdSchema = ObjectWithIdSchema.extend({
name: z.string(),
displayName: z.string().nullable(),
version: z.number(),
variant: z.string().default(WorkflowDefinitionVariant.DEFAULT),
contextSchema: z.record(z.any(), z.any()).nullable(),
Expand Down
8 changes: 4 additions & 4 deletions apps/backoffice-v2/src/pages/Entities/Entities.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Entities: FunctionComponent = () => {
totalPages,
caseCount,
skeletonEntities,
showCaseCreation,
isManualCaseCreationEnabled,
} = useEntities();

return (
Expand All @@ -39,8 +39,8 @@ export const Entities: FunctionComponent = () => {
>
<MotionScrollArea
className={ctw({
'h-[calc(100vh-300px)]': showCaseCreation,
'h-[calc(100vh-240px)]': !showCaseCreation,
'h-[calc(100vh-300px)]': isManualCaseCreationEnabled,
'h-[calc(100vh-240px)]': !isManualCaseCreationEnabled,
})}
>
<Cases.List>
Expand Down Expand Up @@ -72,7 +72,7 @@ export const Entities: FunctionComponent = () => {
<div className={`divider my-0 px-4`}></div>
<div className="flex flex-col gap-5 px-4">
<Pagination onPaginate={onPaginate} page={page} totalPages={totalPages} />
<CaseCreation />
{isManualCaseCreationEnabled && <CaseCreation />}
</div>
</Cases>
{/* Display skeleton individual when loading the entities list */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import { withCaseCreation } from '@/pages/Entities/components/CaseCreation/conte
import { useCaseCreationContext } from '@/pages/Entities/components/CaseCreation/context/case-creation-context/hooks/useCaseCreationContext';
import { useCaseCreationWorkflowDefinition } from '@/pages/Entities/components/CaseCreation/hooks/useCaseCreationWorkflowDefinition';
import { Plus } from 'lucide-react';
import { valueOrNA } from '@/common/utils/value-or-na/value-or-na';
import { ctw } from '@/common/utils/ctw/ctw';
import { titleCase } from 'string-ts';

export const CaseCreation = withCaseCreation(() => {
const { workflowDefinition, isLoading, error } = useCaseCreationWorkflowDefinition();
const { isOpen, setIsOpen: setOpen } = useCaseCreationContext();

if (!workflowDefinition?.config?.enableManualCreation) return null;
const workflowDefinitionName =
workflowDefinition?.displayName || titleCase(workflowDefinition?.name ?? '');

return (
<Sheet open={isOpen} onOpenChange={setOpen}>
Expand All @@ -29,13 +32,25 @@ export const CaseCreation = withCaseCreation(() => {
{!isLoading && workflowDefinition ? (
<div className="flex flex-col px-[60px] py-[72px]">
<div className="flex flex-col">
<span className="pb-3 text-base font-bold capitalize">
{workflowDefinition?.name?.replaceAll('_', ' ')}
<span
className={ctw('pb-3 text-base font-bold capitalize', {
'text-slate-400': !workflowDefinitionName,
})}
>
{valueOrNA(workflowDefinitionName)}
</span>
<h1 className="leading-0 pb-5 text-3xl font-bold">Add a Case</h1>
<p className="pb-10">
Create a {workflowDefinition?.name} case by filling in the information below. Please
ensure all the required fields are filled out correctly.
Create a{' '}
<span
className={ctw({
'text-slate-400': !workflowDefinitionName,
})}
>
{valueOrNA(workflowDefinitionName)}
</span>{' '}
case by filling in the information below. Please ensure all the required fields are
filled out correctly.
</p>
<div className="flex flex-col gap-6">
<h2 className="fontbold text-2xl">Case information</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export const useEntities = () => {
onFilter: onFilterChange,
onSortBy: onSortByChange,
onSortDirToggle,
showCaseCreation: workflowDefinition?.config?.enableManualCreation,
search: searchValue,
cases: data?.data,
caseCount: data?.meta?.totalItems || 0,
Expand All @@ -106,5 +105,6 @@ export const useEntities = () => {
totalPages,
skeletonEntities,
entity,
isManualCaseCreationEnabled: workflowDefinition?.config?.enableManualCreation,
};
};
12 changes: 12 additions & 0 deletions apps/kyb-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# kyb-app

## 0.1.53

### Patch Changes

- @ballerine/[email protected]

## 0.1.52

### Patch Changes

- @ballerine/[email protected]

## 0.1.51

### 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.1.51",
"version": "0.1.53",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -17,7 +17,7 @@
"@ballerine/blocks": "0.1.29",
"@ballerine/common": "^0.7.49",
"@ballerine/ui": "0.3.31",
"@ballerine/workflow-browser-sdk": "0.5.50",
"@ballerine/workflow-browser-sdk": "0.5.52",
"@lukemorales/query-key-factory": "^1.0.3",
"@radix-ui/react-icons": "^1.3.0",
"@rjsf/core": "^5.9.0",
Expand Down
12 changes: 12 additions & 0 deletions examples/headless-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @ballerine/headless-example

## 0.1.52

### Patch Changes

- @ballerine/[email protected]

## 0.1.51

### Patch Changes

- @ballerine/[email protected]

## 0.1.50

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/headless-example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/headless-example",
"private": true,
"version": "0.1.50",
"version": "0.1.52",
"type": "module",
"scripts": {
"spellcheck": "cspell \"*\"",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"dependencies": {
"@ballerine/common": "0.7.49",
"@ballerine/workflow-browser-sdk": "0.5.50",
"@ballerine/workflow-browser-sdk": "0.5.52",
"@felte/reporter-svelte": "^1.1.5",
"@felte/validator-zod": "^1.0.13",
"@fontsource/inter": "^4.5.15",
Expand Down
12 changes: 12 additions & 0 deletions packages/workflow-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @ballerine/workflow-core

## 0.5.52

### Patch Changes

- fix invoked at

## 0.5.51

### Patch Changes

- added set time helper

## 0.5.50

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/workflow-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/workflow-core",
"author": "Ballerine <[email protected]>",
"version": "0.5.50",
"version": "0.5.52",
"description": "workflow-core",
"module": "./dist/esm/index.js",
"main": "./dist/cjs/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,29 @@ describe('Helper transform', () => {
});
});
});

describe('#setTimeToRecordUTC', () => {
it('sets the time to the path', async () => {
const data = { data: { object: 'test', test: 'object' }, mergeValue: 'test' };

const transformer = new HelpersTransformer([
{
source: 'data.invokedAt',
target: 'data.invokedAt',
method: 'setTimeToRecordUTC',
},
]);

const response = await transformer.transform(data);

expect(response).toEqual({
data: { object: 'test', test: 'object', invokedAt: expect.any(Number) },
mergeValue: 'test',
});

expect(new Date((response as { data: { invokedAt: number } }).data.invokedAt)).toEqual(
expect.any(Date),
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export type THelperMethod =
| 'imageUrlToBase64'
| 'remove'
| 'mergeArrayEachItemWithValue'
| 'omit';
| 'omit'
| 'setTimeToRecordUTC';
export class HelpersTransformer extends BaseContextTransformer {
name = 'helpers-transformer';
mapping: THelperFormatingLogic;
Expand Down Expand Up @@ -71,6 +72,15 @@ export class HelpersTransformer extends BaseContextTransformer {
return undefined;
}

setTimeToRecordUTC(
_context: Parameters<typeof this.transform>[0],
attribute: string,
value: string,
_options: unknown,
) {
return new Date().getUTCDate();
}

regex(
_context: Parameters<typeof this.transform>[0],
attribute: string,
Expand Down
Loading
Loading