Skip to content

Commit

Permalink
feat(UI): enhance dynamic UI input with event emission (#2861)
Browse files Browse the repository at this point in the history
* feat(UI): enhance dynamic UI input with event emission

- Integrate useEffect to emit 'onMount' event for the dynamic input
- Simplify transformer plugin types for better readability
- Add new email template for assisted invitations

(your code is starting to look like it was written in an emotional crisis)

* refactor(types): streamline types with better structure

- Change DocumentsValidatorRule to use an array for value
- Update dispatchOn to use an array type for uiEvents
- Modify elements to use array notation for consistency

(Your type definitions look so confused, they probably need a GPS to find their way)

* chore(deps): update zod to version 3.23.4 and class-variance-authority to 0.7.1

- Upgrade zod dependency for improved type validation
- Update class-variance-authority for better styling management
- Ensure compatibility with recent code changes

(your code is so outdated, it might as well still be using floppy disks)

* chore(deps): update dependencies and bump versions across packages

- Update various package versions to latest compatible releases
- Reflect version bumps in changelogs and package.json files

(your dependency management skills are about as organized as a sock drawer after laundry day)
  • Loading branch information
tomer-shvadron authored Nov 26, 2024
1 parent d5bc3ba commit c83a724
Showing 28 changed files with 210 additions and 88 deletions.
10 changes: 10 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @ballerine/backoffice-v2

## 0.7.72

### Patch Changes

- Updated dependencies
- @ballerine/ui@0.5.47
- @ballerine/workflow-browser-sdk@0.6.68
- @ballerine/workflow-node-sdk@0.6.68
- @ballerine/react-pdf-toolkit@1.2.47

## 0.7.71

### Patch Changes
10 changes: 5 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.71",
"version": "0.7.72",
"description": "Ballerine - Backoffice",
"homepage": "https://github.com/ballerine-io/ballerine",
"type": "module",
@@ -53,10 +53,10 @@
"dependencies": {
"@ballerine/blocks": "0.2.27",
"@ballerine/common": "0.9.53",
"@ballerine/react-pdf-toolkit": "^1.2.46",
"@ballerine/ui": "^0.5.46",
"@ballerine/workflow-browser-sdk": "0.6.67",
"@ballerine/workflow-node-sdk": "0.6.67",
"@ballerine/react-pdf-toolkit": "^1.2.47",
"@ballerine/ui": "^0.5.47",
"@ballerine/workflow-browser-sdk": "0.6.68",
"@ballerine/workflow-node-sdk": "0.6.68",
"@botpress/webchat": "^2.1.10",
"@botpress/webchat-generator": "^0.2.9",
"@fontsource/inter": "^4.5.15",
10 changes: 10 additions & 0 deletions apps/kyb-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# kyb-app

## 0.3.83

### Patch Changes

- version bump
: Please enter a summary for your changes.
- Updated dependencies
- @ballerine/ui@0.5.47
- @ballerine/workflow-browser-sdk@0.6.68

## 0.3.82

### Patch Changes
8 changes: 4 additions & 4 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.82",
"version": "0.3.83",
"type": "module",
"scripts": {
"dev": "vite",
@@ -17,8 +17,8 @@
"dependencies": {
"@ballerine/blocks": "0.2.27",
"@ballerine/common": "^0.9.53",
"@ballerine/ui": "0.5.46",
"@ballerine/workflow-browser-sdk": "0.6.67",
"@ballerine/ui": "0.5.47",
"@ballerine/workflow-browser-sdk": "0.6.68",
"@lukemorales/query-key-factory": "^1.0.3",
"@radix-ui/react-icons": "^1.3.0",
"@rjsf/core": "^5.9.0",
@@ -61,7 +61,7 @@
"uuid": "^9.0.0",
"vite-plugin-terminal": "^1.1.0",
"xstate": "^4.38.2",
"zod": "^3.21.4"
"zod": "^3.23.4"
},
"devDependencies": {
"@ballerine/config": "^1.1.25",
Original file line number Diff line number Diff line change
@@ -25,11 +25,11 @@ export const Multiselect = ({
(params, option) => {
return (
<Chip
key={option.value}
key={option?.value}
className="h-6"
variant={definition?.options.variants?.chip?.wrapper}
>
<Chip.Label text={option.title} variant={definition?.options.variants?.chip?.label} />
<Chip.Label text={option?.title} variant={definition?.options.variants?.chip?.label} />
<Chip.UnselectButton
{...params.unselectButtonProps}
icon={<X className="hover:text-muted-foreground h-3 w-3 text-white" />}
Original file line number Diff line number Diff line change
@@ -10,7 +10,9 @@ import { useUIElementState } from '@/components/organisms/UIRenderer/hooks/useUI
import { UIElement } from '@/domains/collection-flow';
import { AnyObject, ErrorsList, RJSFInputAdapter, RJSFInputProps } from '@ballerine/ui';
import get from 'lodash/get';
import { useCallback, useMemo } from 'react';
import { useCallback, useEffect, useMemo } from 'react';
import { useEventEmitterLogic } from '@/components/organisms/DynamicUI/StateManager/components/ActionsHandler';
import { useRefValue } from '@/hooks/useRefValue';

const findLastDigit = (str: string) => {
const digitRegex = /_(\d+)_/g;
@@ -122,6 +124,13 @@ export const withDynamicUIInput = (

const { validationErrors, warnings } = useUIElementErrors(definition);

const emitEvent = useEventEmitterLogic(definition);
const emitEventRef = useRefValue(emitEvent);

useEffect(() => {
emitEventRef.current('onMount');
}, [emitEventRef]);

return (
<div className="flex flex-col gap-2">
<Component
Original file line number Diff line number Diff line change
@@ -15,12 +15,12 @@ export interface JSONLogicRule extends BaseRule {
value: AnyObject;
}
export interface DocumentsValidatorRule extends BaseRule {
value: {
value: Array<{
documentId: string;
destination: string;
required: boolean | Rule;
errorMessage: string;
}[];
}>;
}

export interface JMESPathRule extends BaseRule {
@@ -43,7 +43,7 @@ export interface BaseActionParams {
export interface Action<TParams = BaseActionParams> {
type: string;
dispatchOn: {
uiEvents: { event: string; uiElementName: string }[];
uiEvents: Array<{ event: string; uiElementName: string }>;
rules: Rule[];
};
params: TParams;
@@ -62,5 +62,5 @@ export interface UIElement<TElementParams = AnyObject> {
required?: boolean;
options: TElementParams;
valueDestination?: UIElementDestination;
elements?: UIElement<AnyObject>[];
elements?: Array<UIElement<AnyObject>>;
}
2 changes: 1 addition & 1 deletion apps/kyb-app/src/pages/SignUpPage/SignUpPage.tsx
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ export const SignUpPage = () => {
}

return (
<Signup themeParams={themeDefinition.signup}>
<Signup themeParams={themeDefinition?.signup}>
<Content>
<Logo />
<Header />
6 changes: 6 additions & 0 deletions examples/headless-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ballerine/headless-example

## 0.3.67

### Patch Changes

- @ballerine/workflow-browser-sdk@0.6.68

## 0.3.66

### Patch Changes
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.3.66",
"version": "0.3.67",
"type": "module",
"scripts": {
"spellcheck": "cspell \"*\"",
@@ -35,7 +35,7 @@
},
"dependencies": {
"@ballerine/common": "0.9.53",
"@ballerine/workflow-browser-sdk": "0.6.67",
"@ballerine/workflow-browser-sdk": "0.6.68",
"@felte/reporter-svelte": "^1.1.5",
"@felte/validator-zod": "^1.0.13",
"@fontsource/inter": "^4.5.15",
7 changes: 7 additions & 0 deletions packages/react-pdf-toolkit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @ballerine/react-pdf-toolkit

## 1.2.47

### Patch Changes

- Updated dependencies
- @ballerine/ui@0.5.47

## 1.2.46

### Patch Changes
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.46",
"version": "1.2.47",
"types": "./dist/build.d.ts",
"main": "./dist/react-pdf-toolkit.js",
"module": "./dist/react-pdf-toolkit.mjs",
@@ -27,7 +27,7 @@
},
"dependencies": {
"@ballerine/config": "^1.1.25",
"@ballerine/ui": "0.5.46",
"@ballerine/ui": "0.5.47",
"@react-pdf/renderer": "^3.1.14",
"@sinclair/typebox": "^0.31.7",
"ajv": "^8.12.0",
7 changes: 7 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @ballerine/ui

## 0.5.47

### Patch Changes

- version bump
: Please enter a summary for your changes.

## 0.5.46

### Patch Changes
2 changes: 1 addition & 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.46",
"version": "0.5.47",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ export const TextField = ({
name,
value: formData || '',
placeholder: uiSchema?.['ui:placeholder'],
disabled,
disabled: disabled || uiSchema?.disabled,
onChange: handleChange,
onBlur: handleBlur,
};
7 changes: 7 additions & 0 deletions packages/workflow-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @ballerine/workflow-core

## 0.6.68

### Patch Changes

- version bump
: Please enter a summary for your changes.

## 0.6.67

### Patch Changes
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.6.67",
"version": "0.6.68",
"description": "workflow-core",
"module": "./dist/esm/index.js",
"main": "./dist/cjs/index.js",
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
import { logger } from '../../logger';
import { ISerializableMappingPluginParams } from '../../plugins/common-plugin/types';
import { SerializableValidatableTransformer } from '../../plugins/external-plugin';
import { HelpersTransformer, TContext, THelperFormatingLogic } from '../../utils';

export interface HelpersTransformerParams {
mapping: THelperFormatingLogic;
}

export type TransformerPluginTransformersType = 'helpers-transformer';
export type TransformerPluginTransformersParams = SerializableValidatableTransformer;

export interface TransformerPluginParams {
name: string;
stateNames: string[];
transformers: { transformer: string; mapping: string | THelperFormatingLogic }[];
transformers: Array<{ transformer: string; mapping: string | THelperFormatingLogic }>;
}

export class TransformerPlugin implements ISerializableMappingPluginParams {
public static pluginType = 'transformer';
public name: string;
stateNames: string[];
transformers: { transformer: string; mapping: string | THelperFormatingLogic }[];
transformers: Array<{ transformer: string; mapping: string | THelperFormatingLogic }>;

constructor(params: TransformerPluginParams) {
this.name = params.name;
@@ -41,6 +33,7 @@ export class TransformerPlugin implements ISerializableMappingPluginParams {
}

logger.log('Transform performed successfully.');

return {};
}

Loading

0 comments on commit c83a724

Please sign in to comment.