diff --git a/.github/workflows/db-ops.yaml b/.github/workflows/db-ops.yaml index 3ac73e61c1..90bd64becb 100644 --- a/.github/workflows/db-ops.yaml +++ b/.github/workflows/db-ops.yaml @@ -165,6 +165,7 @@ jobs: runs-on: ubuntu-latest needs: [update-helm-chart,build-and-push-ee-image] if: ${{ needs.update-helm-chart.result == 'success' }} + environment: ${{ github.event.client_payload.environment }} permissions: contents: read packages: write diff --git a/.github/workflows/deploy-wf-service.yml b/.github/workflows/deploy-wf-service.yml index b63ae57fdc..086d510694 100644 --- a/.github/workflows/deploy-wf-service.yml +++ b/.github/workflows/deploy-wf-service.yml @@ -256,6 +256,7 @@ jobs: runs-on: ubuntu-latest needs: [update-helm-chart,build-and-push-ee-image] if: ${{ needs.update-helm-chart.result == 'success' }} + environment: ${{ inputs.environment }} permissions: contents: read packages: write diff --git a/.github/workflows/hotfix-wf-service.yml b/.github/workflows/hotfix-wf-service.yml index 38bb066649..2f4c9f4ee2 100644 --- a/.github/workflows/hotfix-wf-service.yml +++ b/.github/workflows/hotfix-wf-service.yml @@ -329,6 +329,7 @@ jobs: send-to-slack: runs-on: ubuntu-latest needs: [update-helm-chart,build-and-push-ee-image,build-and-push-image] + environment: ${{ inputs.environment }} if: ${{ needs.update-helm-chart.result == 'success' }} permissions: contents: read diff --git a/apps/backoffice-v2/CHANGELOG.md b/apps/backoffice-v2/CHANGELOG.md index 9b02151e9a..d8ffb11998 100644 --- a/apps/backoffice-v2/CHANGELOG.md +++ b/apps/backoffice-v2/CHANGELOG.md @@ -1,5 +1,18 @@ # @ballerine/backoffice-v2 +## 0.7.81 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/blocks@0.2.29 + - @ballerine/common@0.9.58 + - @ballerine/react-pdf-toolkit@1.2.50 + - @ballerine/ui@0.5.50 + - @ballerine/workflow-browser-sdk@0.6.77 + - @ballerine/workflow-node-sdk@0.6.77 + ## 0.7.80 ### Patch Changes diff --git a/apps/backoffice-v2/package.json b/apps/backoffice-v2/package.json index 0ea1465368..e72821f055 100644 --- a/apps/backoffice-v2/package.json +++ b/apps/backoffice-v2/package.json @@ -1,6 +1,6 @@ { "name": "@ballerine/backoffice-v2", - "version": "0.7.80", + "version": "0.7.81", "description": "Ballerine - Backoffice", "homepage": "https://github.com/ballerine-io/ballerine", "type": "module", @@ -51,12 +51,12 @@ "preview": "vite preview" }, "dependencies": { - "@ballerine/blocks": "0.2.28", - "@ballerine/common": "0.9.57", - "@ballerine/react-pdf-toolkit": "^1.2.48", - "@ballerine/ui": "^0.5.48", - "@ballerine/workflow-browser-sdk": "0.6.76", - "@ballerine/workflow-node-sdk": "0.6.76", + "@ballerine/blocks": "0.2.29", + "@ballerine/common": "0.9.58", + "@ballerine/react-pdf-toolkit": "^1.2.50", + "@ballerine/ui": "^0.5.50", + "@ballerine/workflow-browser-sdk": "0.6.77", + "@ballerine/workflow-node-sdk": "0.6.77", "@botpress/webchat": "^2.1.10", "@botpress/webchat-generator": "^0.2.9", "@fontsource/inter": "^4.5.15", @@ -145,11 +145,11 @@ "tesseract.js": "^4.0.1", "ts-pattern": "^5.0.8", "vite-plugin-terminal": "^1.1.0", - "zod": "^3.22.3" + "zod": "^3.23.4" }, "devDependencies": { - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config-react": "^2.0.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config-react": "^2.0.27", "@cspell/cspell-types": "^6.31.1", "@faker-js/faker": "^7.6.0", "@playwright/test": "^1.32.1", @@ -162,8 +162,9 @@ "@storybook/react-vite": "^7.0.0-rc.10", "@storybook/testing-library": "^0.0.14-next.1", "@tanstack/react-query-devtools": "4.22.0", - "@testing-library/jest-dom": "^5.16.4", - "@testing-library/react": "^13.3.0", + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.1.0", + "@testing-library/user-event": "^14.5.2", "@total-typescript/ts-reset": "^0.5.1", "@types/d3-hierarchy": "^3.1.7", "@types/dompurify": "^3.0.5", @@ -173,7 +174,6 @@ "@types/qs": "^6.9.7", "@types/react": "^18.0.14", "@types/react-dom": "^18.0.5", - "@types/testing-library__jest-dom": "^5.14.5", "@typescript-eslint/eslint-plugin": "^5.30.0", "@typescript-eslint/parser": "^5.30.0", "@vitejs/plugin-react-swc": "^3.0.1", @@ -199,7 +199,7 @@ "vite-plugin-mkcert": "^1.16.0", "vite-plugin-top-level-await": "^1.4.4", "vite-tsconfig-paths": "^5.0.1", - "vitest": "^0.29.8" + "vitest": "^2.1.8" }, "peerDependencies": { "react": "^17.0.0", diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/EditableDetailsV2.tsx b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/EditableDetailsV2.tsx index 286298bf75..47709c7051 100644 --- a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/EditableDetailsV2.tsx +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/EditableDetailsV2.tsx @@ -7,9 +7,9 @@ import { FunctionComponent } from 'react'; import { FormItem } from '../Form/Form.Item'; import { FormLabel } from '../Form/Form.Label'; import { FormMessage } from '../Form/Form.Message'; -import { useNewEditableDetailsLogic } from './hooks/useEditableDetailsV2Logic/useEditableDetailsV2Logic'; +import { useEditableDetailsV2Logic } from './hooks/useEditableDetailsV2Logic/useEditableDetailsV2Logic'; import { EditableDetailsV2Options } from './components/EditableDetailsV2Options'; -import { EditableDetailV2 } from './components/EditableDetailV2'; +import { EditableDetailV2 } from './components/EditableDetailV2/EditableDetailV2'; import { IEditableDetailsV2Props } from './types'; export const EditableDetailsV2: FunctionComponent = ({ @@ -24,9 +24,10 @@ export const EditableDetailsV2: FunctionComponent = ({ throw new Error('Cannot provide both blacklist and whitelist'); } - const { form, handleSubmit, filteredFields } = useNewEditableDetailsLogic({ + const { form, handleSubmit, handleCancel, filteredFields } = useEditableDetailsV2Logic({ fields, onSubmit, + onCancel, config, }); @@ -50,9 +51,7 @@ export const EditableDetailsV2: FunctionComponent = ({
{title} - {filteredFields.map(({ title, path, props }) => { - const originalValue = form.watch(path); - + {filteredFields.map(({ title, value, path, props }) => { return ( = ({ {titleCase(title ?? '')} @@ -91,7 +97,7 @@ export const EditableDetailsV2: FunctionComponent = ({ type="button" className={`aria-disabled:pointer-events-none aria-disabled:opacity-50`} aria-disabled={config.actions.cancel.disabled} - onClick={onCancel} + onClick={handleCancel} > Cancel diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2.tsx b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2.tsx deleted file mode 100644 index 2db981898a..0000000000 --- a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2.tsx +++ /dev/null @@ -1,188 +0,0 @@ -import { FunctionComponent, ComponentProps, useCallback, ChangeEvent } from 'react'; -import { FieldValues, UseFormReturn } from 'react-hook-form'; -import { ExtendedJson } from '@/common/types'; -import { isValidDatetime } from '@/common/utils/is-valid-datetime'; -import { FileJson2 } from 'lucide-react'; -import { JsonDialog, ctw, BallerineLink, checkIsDate } from '@ballerine/ui'; -import { isObject, isNullish, checkIsIsoDate, checkIsUrl } from '@ballerine/common'; -import { Input } from '@ballerine/ui'; -import { Select } from '../../../atoms/Select/Select'; -import { SelectTrigger } from '../../../atoms/Select/Select.Trigger'; -import { SelectValue } from '../../../atoms/Select/Select.Value'; -import { SelectContent } from '../../../atoms/Select/Select.Content'; -import { SelectItem } from '../../../atoms/Select/Select.Item'; -import { keyFactory } from '@/common/utils/key-factory/key-factory'; -import { Checkbox_ } from '../../../atoms/Checkbox_/Checkbox_'; -import dayjs from 'dayjs'; -import { ReadOnlyDetailV2 } from './ReadOnlyDetailV2'; -import { getDisplayValue } from '../utils/get-display-value'; -import { FormField } from '../../Form/Form.Field'; -import { FormControl } from '../../Form/Form.Control'; -import { getInputType } from '../utils/get-input-type'; - -export const EditableDetailV2: FunctionComponent<{ - isEditable: boolean; - className?: string; - options?: Array<{ - label: string; - value: string; - }>; - form: UseFormReturn; - field: Parameters['render']>[0]['field']; - valueAlias?: string; - originalValue: ExtendedJson; - type: string | undefined; - format: string | undefined; - minimum?: number; - maximum?: number; - pattern?: string; - parse?: { - date?: boolean; - isoDate?: boolean; - datetime?: boolean; - boolean?: boolean; - url?: boolean; - nullish?: boolean; - }; -}> = ({ - isEditable, - className, - options, - originalValue, - form, - field, - valueAlias, - type, - format, - minimum, - maximum, - pattern, - parse, -}) => { - const displayValue = getDisplayValue({ value: field.value, originalValue, isEditable }); - const onInputChange = useCallback( - (event: ChangeEvent) => { - const value = event.target.value === 'N/A' ? '' : event.target.value; - - form.setValue(field.name, value); - }, - [field.name, form], - ); - - if (Array.isArray(field.value) || isObject(field.value)) { - return ( -
- } - dialogButtonText={`View Information`} - json={JSON.stringify(field.value)} - /> -
- ); - } - - if (isEditable && options) { - return ( - - ); - } - - if (parse?.boolean && (typeof field.value === 'boolean' || type === 'boolean')) { - return ( - - - - ); - } - - if (isEditable) { - const inputType = getInputType({ format, type, value: originalValue }); - - return ( - - - - ); - } - - if (typeof field.value === 'boolean' || type === 'boolean') { - return {`${field.value}`}; - } - - if (parse?.url && checkIsUrl(field.value)) { - return ( - - {valueAlias ?? field.value} - - ); - } - - if (parse?.datetime && (isValidDatetime(field.value) || type === 'date-time')) { - const value = field.value.endsWith(':00') ? field.value : `${field.value}:00`; - - return ( - - {dayjs(value).utc().format('DD/MM/YYYY HH:mm')} - - ); - } - - if ( - (parse?.date && checkIsDate(field.value, { isStrict: false })) || - (parse?.isoDate && checkIsIsoDate(field.value)) || - (type === 'date' && (parse?.date || parse?.isoDate)) - ) { - return ( - - {dayjs(field.value).format('DD/MM/YYYY')} - - ); - } - - if (parse?.nullish && isNullish(field.value)) { - return {field.value}; - } - - if (isNullish(field.value)) { - return {`${field.value}`}; - } - - return {field.value}; -}; diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2/EditableDetailV2.test.tsx b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2/EditableDetailV2.test.tsx new file mode 100644 index 0000000000..88ddbce22c --- /dev/null +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2/EditableDetailV2.test.tsx @@ -0,0 +1,315 @@ +import { afterEach, describe, expect, it } from 'vitest'; +import { cleanup, render, screen } from '@testing-library/react'; +import { EditableDetailV2 } from './EditableDetailV2'; +import { Form } from '@/common/components/organisms/Form/Form'; +import { useForm } from 'react-hook-form'; +import { FormField } from '@/common/components/organisms/Form/Form.Field'; +import dayjs from 'dayjs'; +import { FormLabel } from '@/common/components/organisms/Form/Form.Label'; +import { FormItem } from '@/common/components/organisms/Form/Form.Item'; + +afterEach(() => { + cleanup(); +}); + +describe.skip('EditableDetailV2', () => { + describe('datetime', () => { + describe('when isEditable is false', () => { + it('renders ISO dates', () => { + // Arrange + const fieldName = 'isoDate'; + const fieldValue = '1864-01-12T12:34:56Z'; + const WithSetup = () => { + const form = useForm({ + defaultValues: { + [fieldName]: fieldValue, + }, + }); + + return ( + + ( + + {field.name} + + + )} + name={fieldName} + /> + + ); + }; + + render(); + + // Act + const element = screen.getByRole('textbox'); + + // Assert + expect(element).toHaveAttribute('aria-readonly', 'true'); + expect(element).toHaveTextContent(dayjs(fieldValue).local().format('DD/MM/YYYY HH:mm')); + }); + + it('renders a format of YYYY-MM-DD HH:mm:ss', () => { + // Arrange + const fieldName = 'customFormat'; + const fieldValue = '1864-01-12 12:34:56'; + const WithSetup = () => { + const form = useForm({ + defaultValues: { + [fieldName]: fieldValue, + }, + }); + + return ( +
+ ( + + {field.name} + + + )} + name={fieldName} + /> + + ); + }; + + render(); + + // Act + const element = screen.getByRole('textbox'); + + // Assert + expect(element).toHaveAttribute('aria-readonly', 'true'); + expect(element).toHaveTextContent(dayjs(fieldValue).local().format('DD/MM/YYYY HH:mm')); + }); + }); + + describe('when isEditable is true', () => { + it('renders ISO dates', () => { + // Arrange + const fieldName = 'isoDate'; + const fieldValue = '1864-01-12T12:34:56Z'; + const WithSetup = () => { + const form = useForm({ + defaultValues: { + [fieldName]: fieldValue, + }, + }); + + return ( +
+ ( + + {field.name} + + + )} + name={fieldName} + /> + + ); + }; + + render(); + + // Act + const element = screen.getByLabelText(fieldName); + + // Assert + expect(element).toHaveAttribute('type', 'datetime-local'); + expect(element).toHaveValue(dayjs(fieldValue).local().format('YYYY-MM-DDTHH:mm:ss.000')); + }); + + it('renders a format of YYYY-MM-DD HH:mm:ss', () => { + // Arrange + const fieldName = 'customFormat'; + const fieldValue = '1864-01-12 12:34:56'; + const WithSetup = () => { + const form = useForm({ + defaultValues: { + [fieldName]: fieldValue, + }, + }); + + return ( +
+ ( + + {field.name} + + + )} + name={fieldName} + /> + + ); + }; + + render(); + + // Act + const element = screen.getByLabelText(fieldName); + + // Assert + expect(element).toHaveAttribute('type', 'datetime-local'); + expect(element).toHaveValue(dayjs(fieldValue).local().format('YYYY-MM-DDTHH:mm:ss.000')); + }); + }); + }); + + describe('date', () => { + describe('when isEditable is false', () => { + it('renders YYYY-DD-MM dates', () => { + // Arrange + const fieldName = 'date'; + const fieldValue = '1864-01-12'; + const WithSetup = () => { + const form = useForm({ + defaultValues: { + [fieldName]: fieldValue, + }, + }); + + return ( +
+ ( + + {field.name} + + + )} + name={fieldName} + /> + + ); + }; + + render(); + + // Act + const element = screen.getByRole('textbox'); + + // Assert + expect(element).toHaveAttribute('aria-readonly', 'true'); + expect(element).toHaveTextContent(dayjs(fieldValue).local().format('DD/MM/YYYY')); + }); + }); + + describe('when isEditable is true', () => { + it('renders YYYY-DD-MM dates', () => { + // Arrange + const fieldName = 'date'; + const fieldValue = '1864-01-12'; + const WithSetup = () => { + const form = useForm({ + defaultValues: { + [fieldName]: fieldValue, + }, + }); + + return ( +
+ ( + + {field.name} + + + )} + name={fieldName} + /> + + ); + }; + + render(); + + // Act + const element = screen.getByLabelText(fieldName); + + // Assert + expect(element).toHaveAttribute('type', 'date'); + expect(element).toHaveValue(dayjs(fieldValue).local().format('YYYY-MM-DD')); + }); + }); + }); +}); diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2/EditableDetailV2.tsx b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2/EditableDetailV2.tsx new file mode 100644 index 0000000000..516a88032c --- /dev/null +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/components/EditableDetailV2/EditableDetailV2.tsx @@ -0,0 +1,207 @@ +import { ChangeEvent, useCallback } from 'react'; +import { checkIsFormattedDatetime } from '@/common/utils/check-is-formatted-datetime'; +import { FileJson2 } from 'lucide-react'; +import { BallerineLink, ctw, Input, JsonDialog } from '@ballerine/ui'; +import { checkIsUrl, isNullish, isObject } from '@ballerine/common'; +import { Select } from '../../../../atoms/Select/Select'; +import { SelectTrigger } from '../../../../atoms/Select/Select.Trigger'; +import { SelectValue } from '../../../../atoms/Select/Select.Value'; +import { SelectContent } from '../../../../atoms/Select/Select.Content'; +import { SelectItem } from '../../../../atoms/Select/Select.Item'; +import { keyFactory } from '@/common/utils/key-factory/key-factory'; +import { Checkbox_ } from '../../../../atoms/Checkbox_/Checkbox_'; +import dayjs from 'dayjs'; +import { ReadOnlyDetailV2 } from '../ReadOnlyDetailV2'; +import { getDisplayValue } from '../../utils/get-display-value'; +import { FormControl } from '../../../Form/Form.Control'; +import { getInputType } from '../../utils/get-input-type'; +import { checkIsDate } from '@/common/components/organisms/EditableDetailsV2/utils/check-is-date'; +import { checkIsDatetime } from '@/common/components/organisms/EditableDetailsV2/utils/check-is-datetime'; + +export const EditableDetailV2 = ({ + isEditable, + className, + options, + formValue, + onInputChange, + onOptionChange, + name, + value, + valueAlias, + type, + format, + minimum, + maximum, + pattern, + inputType, + parse, +}: { + isEditable: boolean; + className?: string; + options?: Array<{ + label: string; + value: string; + }>; + name: string; + value: any; + onInputChange: (name: string, value: unknown) => void; + onOptionChange: (...event: any[]) => void; + valueAlias?: string; + formValue: any; + type: string | undefined; + format: string | undefined; + minimum?: number; + maximum?: number; + pattern?: string; + inputType?: string; + parse?: { + date?: boolean; + isoDate?: boolean; + datetime?: boolean; + boolean?: boolean; + url?: boolean; + nullish?: boolean; + }; +}) => { + const displayValue = getDisplayValue({ value, formValue, isEditable }); + const handleInputChange = useCallback( + (event: ChangeEvent) => { + const getValue = () => { + if (event.target.value === 'N/A') { + return ''; + } + + const isValidDatetime = dayjs( + event.target.value, + ['YYYY-MM-DDTHH:mm', 'YYYY-MM-DDTHH:mm:ss'], + true, + ).isValid(); + + if (isValidDatetime) { + return dayjs(event.target.value).toISOString(); + } + + return event.target.value; + }; + const value = getValue(); + + onInputChange(name, value); + }, + [name, onInputChange], + ); + const isValidDatetime = [ + checkIsDatetime(value), + checkIsFormattedDatetime(value), + type === 'date-time', + ].some(Boolean); + const isValidIsoDate = checkIsDatetime(value); + + if (Array.isArray(value) || isObject(value)) { + return ( +
+ } + dialogButtonText={`View Information`} + json={JSON.stringify(value)} + /> +
+ ); + } + + if (isEditable && options) { + return ( + + ); + } + + if ( + parse?.boolean && + (typeof value === 'boolean' || type === 'boolean' || inputType === 'checkbox') + ) { + return ( + + + + ); + } + + if (isEditable) { + const computedInputType = inputType ?? getInputType({ format, type, value }); + + return ( + + + + ); + } + + if (typeof value === 'boolean' || type === 'boolean') { + return {`${value}`}; + } + + if (parse?.url && checkIsUrl(value)) { + return ( + + {valueAlias ?? value} + + ); + } + + if ((parse?.datetime && isValidDatetime) || (parse?.isoDate && isValidIsoDate)) { + return ( + + {dayjs(value).local().format('DD/MM/YYYY HH:mm')} + + ); + } + + if (parse?.date && (checkIsDate(value) || type === 'date')) { + return ( + {dayjs(value).format('DD/MM/YYYY')} + ); + } + + if (parse?.nullish && isNullish(value)) { + return {value}; + } + + if (isNullish(value)) { + return {`${value}`}; + } + + return {value}; +}; diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/hooks/useEditableDetailsV2Logic/useEditableDetailsV2Logic.tsx b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/hooks/useEditableDetailsV2Logic/useEditableDetailsV2Logic.tsx index 4732a640f7..e9d99a686e 100644 --- a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/hooks/useEditableDetailsV2Logic/useEditableDetailsV2Logic.tsx +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/hooks/useEditableDetailsV2Logic/useEditableDetailsV2Logic.tsx @@ -1,16 +1,20 @@ import { ComponentProps, useCallback, useMemo } from 'react'; -import { useForm, SubmitHandler } from 'react-hook-form'; +import { SubmitHandler, useForm } from 'react-hook-form'; import { EditableDetailsV2 } from '../../EditableDetailsV2'; import { isPathMatch } from '../../utils/is-path-match'; import { isObject } from '@ballerine/common'; -import { set, get } from 'lodash-es'; +import { get, set } from 'lodash-es'; import { sortData } from '@/lib/blocks/utils/sort-data'; -export const useNewEditableDetailsLogic = ({ +export const useEditableDetailsV2Logic = ({ fields, onSubmit, + onCancel, config, -}: Pick, 'fields' | 'onSubmit' | 'config'>) => { +}: Pick< + ComponentProps, + 'fields' | 'onSubmit' | 'onCancel' | 'config' +>) => { const sortedFields = useMemo( () => sortData({ @@ -133,9 +137,15 @@ export const useNewEditableDetailsLogic = ({ [fields, defaultValues, onSubmit], ); + const handleCancel = useCallback(() => { + form.reset(defaultValues); + onCancel(); + }, [defaultValues, form.reset, onCancel]); + return { form, handleSubmit, + handleCancel, filteredFields, }; }; diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/types.ts b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/types.ts index c26882fe22..ef03c12655 100644 --- a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/types.ts +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/types.ts @@ -30,6 +30,7 @@ export interface IBaseEditableDetailsV2Config { disabled: boolean; }; }; + inputTypes?: Record; } export interface IEditableDetailsV2ConfigWithBlacklist extends IBaseEditableDetailsV2Config { diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/check-is-date.ts b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/check-is-date.ts new file mode 100644 index 0000000000..8a27888cfd --- /dev/null +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/check-is-date.ts @@ -0,0 +1,6 @@ +import { isType } from '@ballerine/common'; +import { z } from 'zod'; + +export const checkIsDate = (value: unknown): value is string => { + return isType(z.string().date())(value); +}; diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/check-is-datetime.ts b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/check-is-datetime.ts new file mode 100644 index 0000000000..c7fb0c4795 --- /dev/null +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/check-is-datetime.ts @@ -0,0 +1,6 @@ +import { isType } from '@ballerine/common'; +import { z } from 'zod'; + +export const checkIsDatetime = (value: unknown): value is string => { + return isType(z.string().datetime())(value); +}; diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/get-display-value.ts b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/get-display-value.ts index 8bef9ebaf3..98c1d756da 100644 --- a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/get-display-value.ts +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/get-display-value.ts @@ -1,16 +1,25 @@ import { isNullish } from '@ballerine/common'; +import { checkIsDatetime } from '@/common/components/organisms/EditableDetailsV2/utils/check-is-datetime'; +import dayjs from 'dayjs'; +import utc from 'dayjs/plugin/utc'; -export const getDisplayValue = ({ +dayjs.extend(utc); + +export const getDisplayValue = ({ value, - originalValue, + formValue, isEditable, }: { value: TValue; - originalValue: TOriginalValue; + formValue: TFormValue; isEditable: boolean; }) => { + if (isEditable && checkIsDatetime(formValue)) { + return dayjs(formValue).local().format('YYYY-MM-DDTHH:mm:ss'); + } + if (isEditable) { - return originalValue; + return formValue; } if (isNullish(value) || value === '') { diff --git a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/get-input-type.ts b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/get-input-type.ts index 1157e3f4bb..ef3f171037 100644 --- a/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/get-input-type.ts +++ b/apps/backoffice-v2/src/common/components/organisms/EditableDetailsV2/utils/get-input-type.ts @@ -1,6 +1,6 @@ -import { isValidDatetime } from '@/common/utils/is-valid-datetime'; -import { checkIsIsoDate } from '@ballerine/common'; -import { checkIsDate } from '@ballerine/ui'; +import { checkIsFormattedDatetime } from '@/common/utils/check-is-formatted-datetime'; +import { checkIsDate } from '@/common/components/organisms/EditableDetailsV2/utils/check-is-date'; +import { checkIsDatetime } from '@/common/components/organisms/EditableDetailsV2/utils/check-is-datetime'; export const getInputType = ({ format, @@ -11,7 +11,7 @@ export const getInputType = ({ type: string | undefined; value: unknown; }) => { - if (format === 'date-time' || isValidDatetime(value)) { + if (format === 'date-time' || checkIsDatetime(value) || checkIsFormattedDatetime(value)) { return 'datetime-local'; } @@ -27,7 +27,7 @@ export const getInputType = ({ return 'number'; } - if (checkIsDate(value, { isStrict: false }) || checkIsIsoDate(value) || type === 'date') { + if (checkIsDate(value) || type === 'date') { return 'date'; } diff --git a/apps/backoffice-v2/src/common/utils/check-is-formatted-datetime/check-is-formatted-datetime.ts b/apps/backoffice-v2/src/common/utils/check-is-formatted-datetime/check-is-formatted-datetime.ts new file mode 100644 index 0000000000..b352cd4d8d --- /dev/null +++ b/apps/backoffice-v2/src/common/utils/check-is-formatted-datetime/check-is-formatted-datetime.ts @@ -0,0 +1,9 @@ +/** + * @description Checks if a passed value is a string that match the format YYYY-MM-DD HH:MM:SS. + * @param value + */ +export const checkIsFormattedDatetime = (value: unknown): value is string => { + if (typeof value !== 'string') return false; + + return /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(value); +}; diff --git a/apps/backoffice-v2/src/common/utils/check-is-formatted-datetime/index.ts b/apps/backoffice-v2/src/common/utils/check-is-formatted-datetime/index.ts new file mode 100644 index 0000000000..162a192dae --- /dev/null +++ b/apps/backoffice-v2/src/common/utils/check-is-formatted-datetime/index.ts @@ -0,0 +1 @@ +export { checkIsFormattedDatetime } from './check-is-formatted-datetime'; diff --git a/apps/backoffice-v2/src/domains/notes/Notes.tsx b/apps/backoffice-v2/src/domains/notes/Notes.tsx index 951d57c617..68822d8384 100644 --- a/apps/backoffice-v2/src/domains/notes/Notes.tsx +++ b/apps/backoffice-v2/src/domains/notes/Notes.tsx @@ -88,7 +88,7 @@ export const Notes = ({ size={`sm`} aria-disabled={isLoading} className={ - 'mt-3 h-5 self-end p-4 text-sm font-medium aria-disabled:pointer-events-none aria-disabled:opacity-50' + 'mt-3 h-5 self-end p-4 text-sm font-medium enabled:bg-primary enabled:hover:bg-primary/90 aria-disabled:pointer-events-none aria-disabled:opacity-50' } > diff --git a/apps/backoffice-v2/src/index.css b/apps/backoffice-v2/src/index.css index 4965a08679..1e85734aa2 100644 --- a/apps/backoffice-v2/src/index.css +++ b/apps/backoffice-v2/src/index.css @@ -318,10 +318,7 @@ } } -a.bpComposerPoweredBy { +a.bpComposerPoweredBy, +div.bpHeaderExpandedContentDescriptionItemsPoweredBy { display: none !important; } - -button.bpModalDialogNewConversationButton { - background-color: var(--bpPrimary-500) !important; -} diff --git a/apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/CallToActionLegacy.tsx b/apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/CallToActionLegacy.tsx index c62acd5d0a..cd4da51747 100644 --- a/apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/CallToActionLegacy.tsx +++ b/apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/CallToActionLegacy.tsx @@ -189,7 +189,10 @@ export const CallToActionLegacy: FunctionComponent = ( size="wide" variant="warning" disabled={disabled} - className={ctw({ 'flex gap-2': isReuploadResetable })} + className={ctw( + { 'flex gap-2': isReuploadResetable }, + 'enabled:bg-warning enabled:hover:bg-warning/90', + )} > {value.text} {isReuploadResetable && ( @@ -253,9 +256,11 @@ export const CallToActionLegacy: FunctionComponent = ( } close={ @@ -57,9 +61,11 @@ export const DefaultActions = () => {
diff --git a/apps/backoffice-v2/src/tests-setup.ts b/apps/backoffice-v2/src/tests-setup.ts index 86779502e1..bb02c60cd0 100644 --- a/apps/backoffice-v2/src/tests-setup.ts +++ b/apps/backoffice-v2/src/tests-setup.ts @@ -1,4 +1 @@ -import { expect } from 'vitest'; -import matchers from '@testing-library/jest-dom/matchers'; - -expect.extend(matchers); +import '@testing-library/jest-dom/vitest'; diff --git a/apps/kyb-app/CHANGELOG.md b/apps/kyb-app/CHANGELOG.md index 680ebf1ef2..84b3716849 100644 --- a/apps/kyb-app/CHANGELOG.md +++ b/apps/kyb-app/CHANGELOG.md @@ -1,5 +1,16 @@ # kyb-app +## 0.3.93 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/blocks@0.2.29 + - @ballerine/common@0.9.58 + - @ballerine/ui@0.5.50 + - @ballerine/workflow-browser-sdk@0.6.77 + ## 0.3.92 ### Patch Changes diff --git a/apps/kyb-app/package.json b/apps/kyb-app/package.json index 86bd4c6c05..1ad628ec17 100644 --- a/apps/kyb-app/package.json +++ b/apps/kyb-app/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/kyb-app", "private": true, - "version": "0.3.92", + "version": "0.3.93", "type": "module", "scripts": { "dev": "vite", @@ -15,10 +15,10 @@ "test:dev": "vitest" }, "dependencies": { - "@ballerine/blocks": "0.2.28", - "@ballerine/common": "^0.9.57", - "@ballerine/ui": "0.5.49", - "@ballerine/workflow-browser-sdk": "0.6.76", + "@ballerine/blocks": "0.2.29", + "@ballerine/common": "^0.9.58", + "@ballerine/ui": "0.5.50", + "@ballerine/workflow-browser-sdk": "0.6.77", "@lukemorales/query-key-factory": "^1.0.3", "@radix-ui/react-icons": "^1.3.0", "@rjsf/core": "^5.9.0", @@ -64,8 +64,8 @@ "zod": "^3.23.4" }, "devDependencies": { - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config-react": "^2.0.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config-react": "^2.0.27", "@jest/globals": "^29.7.0", "@sentry/vite-plugin": "^2.9.0", "@testing-library/jest-dom": "^6.1.4", diff --git a/apps/kyb-app/src/common/components/atoms/StepperProgress/StepperProgress.tsx b/apps/kyb-app/src/common/components/atoms/StepperProgress/StepperProgress.tsx index 0ac3eb9318..736fa0b9d4 100644 --- a/apps/kyb-app/src/common/components/atoms/StepperProgress/StepperProgress.tsx +++ b/apps/kyb-app/src/common/components/atoms/StepperProgress/StepperProgress.tsx @@ -8,5 +8,16 @@ interface Props { export const StepperProgress = ({ currentStep, totalSteps }: Props) => { const { t } = useTranslation(); - return {`${t('step')} ${currentStep} / ${totalSteps}`}; + return ( +
+
+ {t('step')} +
+ {currentStep} + / + {totalSteps} +
+
+
+ ); }; diff --git a/apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx b/apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx index 37bd012c26..b4c79d42dd 100644 --- a/apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx +++ b/apps/kyb-app/src/pages/CollectionFlow/CollectionFlow.tsx @@ -246,19 +246,43 @@ export const CollectionFlow = withSessionProtected(() => { {localStorage.getItem('devmode') ? ( -
- DEBUG -
- {currentPage - ? currentPage.stateName - : 'Page not found and state ' + state} +
+
+
+ + Debug Mode Active +
-
- -
diff --git a/apps/workflows-dashboard/CHANGELOG.md b/apps/workflows-dashboard/CHANGELOG.md index d58f067941..b241ebdf69 100644 --- a/apps/workflows-dashboard/CHANGELOG.md +++ b/apps/workflows-dashboard/CHANGELOG.md @@ -1,5 +1,14 @@ # @ballerine/workflows-dashboard +## 0.2.27 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/common@0.9.58 + - @ballerine/ui@0.5.50 + ## 0.2.26 ### Patch Changes diff --git a/apps/workflows-dashboard/package.json b/apps/workflows-dashboard/package.json index 17901d6496..29e8cd441a 100644 --- a/apps/workflows-dashboard/package.json +++ b/apps/workflows-dashboard/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/workflows-dashboard", "private": false, - "version": "0.2.26", + "version": "0.2.27", "type": "module", "scripts": { "spellcheck": "cspell \"*\"", @@ -15,8 +15,8 @@ "test": "NODE_ENV=test jest" }, "dependencies": { - "@ballerine/common": "^0.9.55", - "@ballerine/ui": "^0.5.48", + "@ballerine/common": "^0.9.58", + "@ballerine/ui": "^0.5.50", "@lukemorales/query-key-factory": "^1.0.3", "@radix-ui/react-avatar": "^1.0.3", "@radix-ui/react-dialog": "1.0.4", @@ -63,8 +63,8 @@ "zod": "^3.22.3" }, "devDependencies": { - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config-react": "^2.0.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config-react": "^2.0.27", "@cspell/cspell-types": "^6.31.1", "@types/axios": "^0.14.0", "@types/classnames": "^2.3.1", diff --git a/apps/workflows-dashboard/src/components/molecules/WorkflowsTable/columns.tsx b/apps/workflows-dashboard/src/components/molecules/WorkflowsTable/columns.tsx index 0150446af9..f171874ff6 100644 --- a/apps/workflows-dashboard/src/components/molecules/WorkflowsTable/columns.tsx +++ b/apps/workflows-dashboard/src/components/molecules/WorkflowsTable/columns.tsx @@ -7,16 +7,49 @@ import { WorkflowTableColumnDef } from '@/components/molecules/WorkflowsTable/ty import { IWorkflow } from '@/domains/workflows/api/workflow'; import { formatDate } from '@/utils/format-date'; import { getWorkflowHealthStatus } from '@/utils/get-workflow-health-status'; +import { Eye } from 'lucide-react'; +import { toast } from 'sonner'; -export const defaultColumns: WorkflowTableColumnDef[] = [ +export const defaultColumns: Array> = [ { accessorKey: 'id', - cell: info => info.getValue(), - header: () => 'ID', + cell: info => ( +
+ {info.getValue()} + +
+ ), + header: () => ID, }, { accessorKey: 'workflowDefinitionName', - cell: info => info.getValue(), + cell: info => {info.getValue()}, header: ({ column }) => ( ), @@ -24,14 +57,14 @@ export const defaultColumns: WorkflowTableColumnDef[] = [ { accessorKey: 'workflowDefinitionId', cell: info => ()} />, - header: '', + header: () => '', }, { accessorKey: 'status', cell: info => ( -
+
- {info.getValue() || ''} + {info.getValue() || ''}
), header: ({ column }) => , @@ -50,34 +83,47 @@ export const defaultColumns: WorkflowTableColumnDef[] = [ { accessorKey: 'assignee', accessorFn: row => (row.assignee ? `${row.assignee.firstName} ${row.assignee.lastName}` : '-'), - cell: info => info.getValue(), + cell: info => {info.getValue()}, header: ({ column }) => , }, { accessorKey: 'context', accessorFn: row => JSON.stringify(row.context), - cell: info => ()} />, - header: () => 'Context', + cell: info => ( +
+ + } + json={info.getValue()} + /> +
+ ), + header: () => Context, }, { accessorKey: 'view-workflow', accessorFn: row => row.id, cell: () => '-', - header: () => 'Workflow', + header: () => Workflow, }, { accessorKey: 'resolvedAt', - cell: info => (info.getValue() ? formatDate(info.getValue()) : '-'), + cell: info => ( + + {info.getValue() ? formatDate(info.getValue()) : '-'} + + ), header: ({ column }) => , }, { accessorKey: 'createdBy', - cell: info => info.getValue(), + cell: info => {info.getValue()}, header: ({ column }) => , }, { accessorKey: 'createdAt', - cell: info => formatDate(info.getValue()), + cell: info => {formatDate(info.getValue())}, header: ({ column }) => , }, ]; diff --git a/apps/workflows-dashboard/src/domains/filters/filters.api.ts b/apps/workflows-dashboard/src/domains/filters/filters.api.ts index a31129269f..007df59010 100644 --- a/apps/workflows-dashboard/src/domains/filters/filters.api.ts +++ b/apps/workflows-dashboard/src/domains/filters/filters.api.ts @@ -1,4 +1,8 @@ -import { GetFiltersListDto, GetFiltersResponse } from '@/domains/filters/filters.types'; +import { + CreateFilterDto, + GetFiltersListDto, + GetFiltersResponse, +} from '@/domains/filters/filters.types'; import { request } from '@/lib/request'; export const fetchFiltersList = async (query: GetFiltersListDto) => { @@ -8,3 +12,9 @@ export const fetchFiltersList = async (query: GetFiltersListDto) => { return result.data; }; + +export const createFilter = async (dto: CreateFilterDto) => { + const result = await request.post('/external/filters', dto); + + return result.data; +}; diff --git a/apps/workflows-dashboard/src/domains/filters/filters.types.ts b/apps/workflows-dashboard/src/domains/filters/filters.types.ts index d88c05e5e1..47e053780e 100644 --- a/apps/workflows-dashboard/src/domains/filters/filters.types.ts +++ b/apps/workflows-dashboard/src/domains/filters/filters.types.ts @@ -4,6 +4,7 @@ export interface IFilter { entity: string; query: object; createdAt: string; + projectId: string; } export interface GetFiltersListDto { @@ -18,3 +19,19 @@ export interface GetFiltersResponse { pages: number; }; } +export interface CreateFilterDto { + name: string; + entity: string; + query: { + where: { + businessId: { + not: null; + }; + workflowDefinitionId: { + in: string[]; + }; + }; + select: object; + }; + projectId: string; +} diff --git a/apps/workflows-dashboard/src/domains/filters/query-keys.ts b/apps/workflows-dashboard/src/domains/filters/query-keys.ts index dc34a06fdc..0fd91d50cd 100644 --- a/apps/workflows-dashboard/src/domains/filters/query-keys.ts +++ b/apps/workflows-dashboard/src/domains/filters/query-keys.ts @@ -1,5 +1,5 @@ -import { fetchFiltersList } from '@/domains/filters/filters.api'; -import { GetFiltersListDto } from '@/domains/filters/filters.types'; +import { createFilter, fetchFiltersList } from '@/domains/filters/filters.api'; +import { CreateFilterDto, GetFiltersListDto } from '@/domains/filters/filters.types'; import { createQueryKeys } from '@lukemorales/query-key-factory'; export const filtersQueryKeys = createQueryKeys('filters', { @@ -7,4 +7,8 @@ export const filtersQueryKeys = createQueryKeys('filters', { queryKey: [{ query }], queryFn: () => fetchFiltersList(query), }), + create: () => ({ + queryKey: ['create'], + queryFn: (dto: CreateFilterDto) => createFilter(dto), + }), }); diff --git a/apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.api.ts b/apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.api.ts index 4da9402985..367ee6a706 100644 --- a/apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.api.ts +++ b/apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.api.ts @@ -21,7 +21,11 @@ export const updateUIDefinition = async (dto: UpdateUIDefinitionDto) => { }; export const copyUIDefinition = async (dto: CopyUIDefinitionDto) => { - const result = await request.post(`/ui-definition/${dto.uiDefinitionId}/copy`); + const result = await request.post(`/ui-definition/${dto.uiDefinitionId}/copy`, { + name: dto.name, + }); + + return result.data; }; export const fetchUIDefinition = async (dto: GetUIDefinitionByIdDto) => { diff --git a/apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts b/apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts index 33a92dacbb..93c4b7d9f0 100644 --- a/apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts +++ b/apps/workflows-dashboard/src/domains/ui-definitions/ui-definitions.types.ts @@ -13,6 +13,8 @@ export interface IUIDefinition { uiSchema: IUISchema; locales?: object; createdAt: string; + name: string; + theme?: object; } export interface UpdateUIDefinitionDto { @@ -23,6 +25,7 @@ export interface UpdateUIDefinitionDto { export interface CopyUIDefinitionDto { uiDefinitionId: string; + name: string; } export interface GetUIDefinitionByIdDto { uiDefinitionId: string; diff --git a/apps/workflows-dashboard/src/pages/Filters/Filters.tsx b/apps/workflows-dashboard/src/pages/Filters/Filters.tsx index c6a00a8298..f59428f852 100644 --- a/apps/workflows-dashboard/src/pages/Filters/Filters.tsx +++ b/apps/workflows-dashboard/src/pages/Filters/Filters.tsx @@ -9,15 +9,165 @@ import { useFiltersQuery } from '@/pages/Filters/hooks/useFiltersQuery'; import { FiltersPageFilterValues } from '@/pages/Filters/types/filters-filter-values'; import { WorkflowsLayout } from '@/pages/Workflows/components/layouts/WorkflowsLayout'; import { NumberParam, withDefault } from 'use-query-params'; +import { Button } from '@/components/atoms/Button'; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from '@/components/atoms/Dialog'; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/components/atoms/Select'; +import { Input } from '@/components/atoms/Input'; +import { useState } from 'react'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useWorkflowDefinitionsQuery } from '../WorkflowDefinitions/hooks/useWorkflowDefinitionsQuery'; +import { createFilter } from '@/domains/filters/filters.api'; +import { CreateFilterDto } from '@/domains/filters/filters.types'; export const Filters = withFilters, FiltersPageFilterValues>( ({ filters }) => { const { data, isLoading } = useFiltersQuery(filters); const { handlePageChange, page, total } = useFiltersPagePagination(); + const [isOpen, setIsOpen] = useState(false); + const [filterName, setFilterName] = useState(''); + const [selectedWorkflow, setSelectedWorkflow] = useState(''); + + const { data: workflowDefinitions } = useWorkflowDefinitionsQuery(); + + const queryClient = useQueryClient(); + + const createFilterMutation = useMutation({ + mutationFn: async (data: CreateFilterDto) => { + return await createFilter(data); + }, + onSuccess: () => { + void queryClient.invalidateQueries({ queryKey: ['filters'] }); + setIsOpen(false); + setFilterName(''); + setSelectedWorkflow(''); + }, + }); + + const handleSubmit = () => { + if (!filterName || !selectedWorkflow) return; + + createFilterMutation.mutate({ + name: filterName, + entity: 'businesses', + projectId: data?.items[0]?.projectId ?? '', + query: { + where: { + businessId: { + not: null, + }, + workflowDefinitionId: { + in: [selectedWorkflow], + }, + }, + select: { + id: true, + tags: true, + state: true, + status: true, + context: true, + assignee: { + select: { + id: true, + lastName: true, + avatarUrl: true, + firstName: true, + }, + }, + business: { + select: { + id: true, + email: true, + address: true, + website: true, + industry: true, + createdAt: true, + documents: true, + legalForm: true, + updatedAt: true, + vatNumber: true, + companyName: true, + phoneNumber: true, + approvalState: true, + businessPurpose: true, + numberOfEmployees: true, + registrationNumber: true, + dateOfIncorporation: true, + shareholderStructure: true, + countryOfIncorporation: true, + taxIdentificationNumber: true, + }, + }, + createdAt: true, + assigneeId: true, + workflowDefinition: { + select: { + id: true, + name: true, + config: true, + version: true, + definition: true, + contextSchema: true, + documentsSchema: true, + }, + }, + childWorkflowsRuntimeData: true, + }, + }, + }); + }; return ( +
+ + + + + + + Create New Filter + +
+ setFilterName(e.target.value)} + /> + + +
+
+
+
diff --git a/apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/FiltersTable.tsx b/apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/FiltersTable.tsx index 3180dc1f3b..6286ba5dbb 100644 --- a/apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/FiltersTable.tsx +++ b/apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/FiltersTable.tsx @@ -21,6 +21,7 @@ interface Props { onSort?: (key: string, direction: 'asc' | 'desc') => void; } +// eslint-disable-next-line react/display-name export const FiltersTable = memo(({ items, isFetching, sorting, onSort }: Props) => { const table = useReactTable({ columns: filtersTableColumns, diff --git a/apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx b/apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx index 26100d12b3..3a10e14bed 100644 --- a/apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx +++ b/apps/workflows-dashboard/src/pages/Filters/components/FiltersTable/columns.tsx @@ -3,35 +3,89 @@ import { IFilter } from '@/domains/filters'; import { formatDate } from '@/utils/format-date'; import { createColumnHelper } from '@tanstack/react-table'; import { Eye } from 'lucide-react'; +import { valueOrNA } from '@/utils/value-or-na'; +import { toast } from 'sonner'; const columnHelper = createColumnHelper(); export const filtersTableColumns = [ columnHelper.accessor('id', { - cell: info => info.getValue(), - header: () => 'ID', + cell: info => ( +
+ {info.getValue()} + +
+ ), + header: () => ID, }), columnHelper.accessor('name', { - cell: info => info.getValue(), - header: () => 'Name', + cell: info => {info.getValue()}, + header: () => Name, }), columnHelper.accessor('entity', { - cell: info => info.getValue(), - header: () => 'Entity', + cell: info => ( + + {valueOrNA(info.getValue())} + + ), + header: () => Entity, }), columnHelper.accessor('query', { cell: info => ( -
+
} + trigger={ + + } json={JSON.stringify(info.getValue())} />
), - header: () => 'Definition', + header: () => Definition, }), + columnHelper.accessor( + row => { + const query = row.query as { where?: { workflowDefinitionId?: { in?: string[] } } }; + return query.where?.workflowDefinitionId?.in?.[0] ?? ''; + }, + { + id: 'workflowDefinitionId', + cell: info => ( + + {valueOrNA(info.getValue())} + + ), + header: () => Workflow ID, + }, + ), columnHelper.accessor('createdAt', { - cell: info => formatDate(info.getValue()), - header: () => 'Created At', + cell: info => {formatDate(info.getValue())}, + header: () => Created At, }), ]; diff --git a/apps/workflows-dashboard/src/pages/Filters/helpers/deserialize-query-params.ts b/apps/workflows-dashboard/src/pages/Filters/helpers/deserialize-query-params.ts index 190998e424..d7734092ad 100644 --- a/apps/workflows-dashboard/src/pages/Filters/helpers/deserialize-query-params.ts +++ b/apps/workflows-dashboard/src/pages/Filters/helpers/deserialize-query-params.ts @@ -5,6 +5,7 @@ export const deserializeQueryParams = (query: FiltersPageFilterQuery) => { const filters: FiltersPageFilterValues = { page: query.page as number, limit: query.limit as number, + projectId: query.projectId as string, }; return filters; diff --git a/apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/index.ts b/apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/index.ts new file mode 100644 index 0000000000..44a7c0e402 --- /dev/null +++ b/apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/index.ts @@ -0,0 +1 @@ +export * from './useCreateFilterMutation'; diff --git a/apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/useCreateFilterMutation.ts b/apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/useCreateFilterMutation.ts new file mode 100644 index 0000000000..9847242e7e --- /dev/null +++ b/apps/workflows-dashboard/src/pages/Filters/hooks/useCreateFilterMutation/useCreateFilterMutation.ts @@ -0,0 +1,16 @@ +import { filtersQueryKeys, GetFiltersListDto } from '@/domains/filters'; +import { useQuery } from '@tanstack/react-query'; + +export const useFiltersQuery = (query: GetFiltersListDto) => { + const { isLoading, data } = useQuery({ + ...filtersQueryKeys.list(query), + // @ts-ignore + retry: false, + keepPreviousData: true, + }); + + return { + isLoading, + data, + }; +}; diff --git a/apps/workflows-dashboard/src/pages/Filters/types/filters-filter-values.ts b/apps/workflows-dashboard/src/pages/Filters/types/filters-filter-values.ts index 98170b2c69..3b9a2283e0 100644 --- a/apps/workflows-dashboard/src/pages/Filters/types/filters-filter-values.ts +++ b/apps/workflows-dashboard/src/pages/Filters/types/filters-filter-values.ts @@ -1,4 +1,5 @@ export interface FiltersPageFilterValues { + projectId: string; page: number; limit: number; } diff --git a/apps/workflows-dashboard/src/pages/Filters/types/filters-query-params.ts b/apps/workflows-dashboard/src/pages/Filters/types/filters-query-params.ts index 2c8d92c3c4..44fe641574 100644 --- a/apps/workflows-dashboard/src/pages/Filters/types/filters-query-params.ts +++ b/apps/workflows-dashboard/src/pages/Filters/types/filters-query-params.ts @@ -1,4 +1,5 @@ export interface FiltersPageFilterQuery { + projectId: string; page?: number; limit?: number; } diff --git a/apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx b/apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx index 2cbf3b57eb..c498456e04 100644 --- a/apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx +++ b/apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/columns.tsx @@ -2,75 +2,132 @@ import { JSONViewButton } from '@/components/molecules/JSONViewButton'; import { IUIDefinition } from '@/domains/ui-definitions'; import { CloneUIDefinitionButton } from '@/pages/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton'; import { formatDate } from '@/utils/format-date'; +import { valueOrNA } from '@/utils/value-or-na'; import { createColumnHelper } from '@tanstack/react-table'; import { ArrowRightCircleIcon, Eye } from 'lucide-react'; import { Link } from 'react-router-dom'; +import { toast } from 'sonner'; const columnHelper = createColumnHelper(); export const uiDefinitionTableColumnns = [ columnHelper.accessor('id', { - cell: info => info.getValue(), - header: () => 'ID', + cell: info => ( +
+ {info.getValue()} + +
+ ), + header: () => ID, }), - columnHelper.accessor('workflowDefinitionId', { - cell: info => info.getValue(), - header: () => 'Workflow Definition ID', + columnHelper.accessor('name', { + cell: info => {info.getValue()}, + header: () => Name, }), + columnHelper.accessor('uiContext', { - cell: info => info.getValue(), - header: () => 'UI Context', + cell: info => ( + + {info.getValue()} + + ), + header: () => UI Context, }), columnHelper.accessor('definition', { cell: info => ( -
+
} + trigger={ + + } json={JSON.stringify(info.getValue())} />
), - header: () => 'Definition', + header: () => Definition, }), columnHelper.accessor('uiSchema', { cell: info => ( -
+
} + trigger={ + + } json={JSON.stringify(info.getValue())} />
), - header: () => 'UI Schema', + header: () => UI Schema, }), columnHelper.accessor('locales', { cell: info => { const locales = info.getValue() ? JSON.stringify(info.getValue()) : null; return ( -
+
{locales ? ( - } json={locales} /> + + } + json={locales} + /> ) : ( - 'N/A' + N/A )}
); }, - header: () => 'Translations', + header: () => Translations, + }), + columnHelper.accessor('workflowDefinitionId', { + cell: info => ( + {valueOrNA(info.getValue())} + ), + header: () => Default Workflow Definition ID, }), columnHelper.accessor('createdAt', { - cell: info => formatDate(info.getValue()), - header: () => 'Created At', + cell: info => {formatDate(info.getValue())}, + header: () => Created At, }), columnHelper.accessor('id', { - cell: info => , + cell: info => ( +
+ +
+ ), header: () => '', }), columnHelper.accessor('id', { cell: info => ( - - + + ), header: () => '', diff --git a/apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton/CloneUIDefinitionButton.tsx b/apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton/CloneUIDefinitionButton.tsx index 335e44ab10..84ed17d53a 100644 --- a/apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton/CloneUIDefinitionButton.tsx +++ b/apps/workflows-dashboard/src/pages/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton/CloneUIDefinitionButton.tsx @@ -1,6 +1,26 @@ import { Button } from '@/components/atoms/Button'; +import { Dialog, DialogContent, DialogTrigger } from '@/components/atoms/Dialog'; import { useCloneUIDefinitionMutation } from '@/pages/UIDefinitions/hooks/useCloneUIDefinitionMutation'; -import { FunctionComponent } from 'react'; +import { DynamicForm } from '@ballerine/ui'; +import { RJSFSchema } from '@rjsf/utils'; +import { FunctionComponent, useCallback, useEffect, useState } from 'react'; + +const formSchema = { + type: 'object', + required: ['name'], + properties: { + name: { + type: 'string', + title: 'Name', + }, + }, +}; + +const uiSchema = { + name: { + 'ui:placeholder': 'Enter name', + }, +}; interface ICLoneUIDefinitionButtonProps { uiDefinitionId: string; @@ -9,11 +29,36 @@ interface ICLoneUIDefinitionButtonProps { export const CloneUIDefinitionButton: FunctionComponent = ({ uiDefinitionId, }) => { - const { mutate, isLoading } = useCloneUIDefinitionMutation(); + const [isDialogOpen, setIsDialogOpen] = useState(false); + const { mutate, isLoading, isSuccess } = useCloneUIDefinitionMutation(); + + const handleSubmit = useCallback( + async (formData: Record) => { + const values: { name: string } = formData as any; + mutate({ uiDefinitionId, ...values }); + }, + [uiDefinitionId, mutate], + ); + + useEffect(() => { + if (isSuccess) { + setIsDialogOpen(false); + } + }, [isSuccess]); return ( - + + + + + + + + ); }; diff --git a/apps/workflows-dashboard/src/pages/UIDefinitions/helpers/deserialize-query-params.ts b/apps/workflows-dashboard/src/pages/UIDefinitions/helpers/deserialize-query-params.ts index 190998e424..d7734092ad 100644 --- a/apps/workflows-dashboard/src/pages/UIDefinitions/helpers/deserialize-query-params.ts +++ b/apps/workflows-dashboard/src/pages/UIDefinitions/helpers/deserialize-query-params.ts @@ -5,6 +5,7 @@ export const deserializeQueryParams = (query: FiltersPageFilterQuery) => { const filters: FiltersPageFilterValues = { page: query.page as number, limit: query.limit as number, + projectId: query.projectId as string, }; return filters; diff --git a/apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx b/apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx index 2644ed8f53..d8d20b40cf 100644 --- a/apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx +++ b/apps/workflows-dashboard/src/pages/WorkflowDefinition/WorkflowDefinition.tsx @@ -13,6 +13,44 @@ import { useWorkflowDefinitionExtensionsEdit } from '@/pages/WorkflowDefinition/ import { ViewWorkflow } from '@/pages/Workflows/components/organisms/WorkflowsList/components/ViewWorkflow'; import { isAxiosError } from 'axios'; import { Link, useParams } from 'react-router-dom'; +import { Dialog } from '@/components/atoms/Dialog'; +import { useState } from 'react'; +import { Button } from '@/components/atoms/Button'; + +export const VENDOR_DETAILS = { + 'dow-jones': { + logoUrl: 'https://cdn.ballerine.io/logos/Dow_Jones_Logo.png', + description: 'Dow Jones provides sanctions screening and risk data for individuals', + }, + 'comply-advantage': { + logoUrl: 'https://cdn.ballerine.io/logos/comply-advantage-logo.png', + description: + 'ComplyAdvantage offers AI-driven sanctions screening and monitoring for individuals', + }, + 'asia-verify': { + logoUrl: 'https://cdn.ballerine.io/logos/AsiaVerify_Logo.png', + description: + 'AsiaVerify provides company screening, UBO verification and registry information services focused on APAC region', + }, + veriff: { + logoUrl: 'https://cdn.ballerine.io/logos/Veriff_logo.svg.png', + description: 'Veriff provides KYC verification and identity proofing services', + }, + ballerine: { + logoUrl: 'https://cdn.ballerine.io/logos/ballerine-logo.png', + description: 'Ballerine provides merchant monitoring services', + }, + kyckr: { + logoUrl: 'https://cdn.ballerine.io/logos/kyckr-logo.png', + description: 'Kyckr provides UBO verification and company registry information services', + }, + test: { + logoUrl: 'https://cdn.ballerine.io/logos/ballerine-logo.png', + description: 'Test vendor for development purposes', + }, +} as const; + +export type VendorId = keyof typeof VENDOR_DETAILS; export const WorkflowDefinition = () => { const id = useParams<{ id: string }>().id; @@ -22,6 +60,11 @@ export const WorkflowDefinition = () => { useWorkflowDefinitionExtensionsEdit(data); const { mutate: upgradeWorkflowDefinitionVersion } = useUpgradeWorkflowDefinitionVersionMutation(); + const [isIntegrationCatalogOpen, setIsIntegrationCatalogOpen] = useState(false); + + const copyToClipboard = (text: string) => { + navigator.clipboard.writeText(text); + }; if (isLoading) { return ( @@ -58,66 +101,291 @@ export const WorkflowDefinition = () => { if (!data) return null; return ( - -
-
-
- - - X-State Visualizer - - - - - - -
-
- -
-
-
-
- + <> + +
+
+
+ + +

X-State Visualizer

+ +
+ + + +
+
+
+ +
-
- { - console.log('changed value', value); - }} - onUpgrade={() => upgradeWorkflowDefinitionVersion({ workflowDefinitionId: data.id! })} - /> +
+
+ +
+
+ { + console.log('changed value', value); + }} + onUpgrade={() => + upgradeWorkflowDefinitionVersion({ workflowDefinitionId: data.id! }) + } + /> +
-
-
-
- upgradeWorkflowDefinitionVersion({ workflowDefinitionId: data.id! })} - /> -
-
- { - console.log('changed value', value); - }} - onUpgrade={() => upgradeWorkflowDefinitionVersion({ workflowDefinitionId: data.id! })} - /> +
+
+ + upgradeWorkflowDefinitionVersion({ workflowDefinitionId: data.id! }) + } + enableViewMode={true} + viewDialogContent={ +
+
+ +
+ {isIntegrationCatalogOpen && ( +
+ +
+
+
+

Integration Catalog

+ +
+
+ {Object.entries(VENDOR_DETAILS).map(([vendorKey, vendorInfo]) => ( +
+
+
+ {vendorKey} { + e.currentTarget.src = + 'https://cdn.ballerine.io/logos/ballerine-logo.png'; + }} + /> +
+
+
+

+ {vendorKey + .split('-') + .map( + word => + word.charAt(0).toUpperCase() + word.slice(1), + ) + .join(' ')} +

+ +
+

+ {vendorInfo.description} +

+
+
+
+ ))} +
+
+
+
+
+ )} + {Object.entries(workflowDefinitionExtensions || {}).map( + ([category, plugins]) => ( +
+

+
+ {category + .split(/(?=[A-Z])/) + .join(' ') + .replace('Plugins', '') + .replace(/^\w/, c => c.toUpperCase())}{' '} + Plugins +

+
+ {(plugins as any[]).map(plugin => ( +
+
+
+ {plugin.vendor === 'test' ? ( +
+ + Test + +
+ ) : plugin.vendor ? ( + {plugin.vendor} { + e.currentTarget.src = + 'https://cdn.ballerine.io/logos/ballerine-logo.png'; + }} + /> + ) : ( + Ballerine + )} +
+
+

+ {(plugin.displayName || plugin.name) + .split(/(?=[A-Z])/) + .join(' ')} +

+
+

+ {plugin.pluginKind} +

+ {plugin.vendor && ( +

+ by {plugin.vendor} +

+ )} +
+
+
+ + {plugin.stateNames?.length > 0 && ( +
+ {plugin.stateNames?.map((state: string) => ( + + {state} + + ))} +
+ )} + +
+ {plugin.successAction && ( +
+ Success: + + {plugin.successAction} + +
+ )} + + {plugin.errorAction && ( +
+ Error: + + {plugin.errorAction} + +
+ )} +
+
+ ))} +
+
+ ), + )} +
+ } + /> +
+
+ { + console.log('changed value', value); + }} + onUpgrade={() => + upgradeWorkflowDefinitionVersion({ workflowDefinitionId: data.id! }) + } + /> +
-
- + + ); }; diff --git a/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/EditorCard/EditorCard.tsx b/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/EditorCard/EditorCard.tsx index 2b0b2b56ad..d645f81215 100644 --- a/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/EditorCard/EditorCard.tsx +++ b/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/EditorCard/EditorCard.tsx @@ -2,30 +2,46 @@ import { Button } from '@/components/atoms/Button'; import { Card, CardContent, CardHeader } from '@/components/atoms/Card'; import { Dialog, DialogContent, DialogTrigger } from '@/components/atoms/Dialog'; import { JSONEditorComponent } from '@/components/organisms/JsonEditor'; -import { Pencil } from 'lucide-react'; +import { Code, Eye, Pencil } from 'lucide-react'; import { FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react'; interface IEditorCardProps { value: object; title: string; dialogContent?: React.ReactNode | React.ReactNode[]; + viewDialogContent?: React.ReactNode; + rawEditDialogContent?: React.ReactNode; + noCodeDialogContent?: React.ReactNode; onChange?: (value: object) => void; onSave?: (value: object) => void; onOpenChange?: (open: boolean) => void; onUpgrade?: () => void; } -export const EditorCard: FunctionComponent = ({ +export const EditorCard: FunctionComponent< + IEditorCardProps & { + enableViewMode?: boolean; + enableNoCodeMode?: boolean; + } +> = ({ value, title, dialogContent, + viewDialogContent, + rawEditDialogContent, + noCodeDialogContent, onChange, onSave, onOpenChange, onUpgrade, + enableViewMode = false, + enableNoCodeMode = false, }) => { const [valueSnapshot, setSnapshot] = useState(value); const [internalValue, setInternalValue] = useState(valueSnapshot); + const [dialogMode, setDialogMode] = useState<'view' | 'raw-edit' | 'no-code' | undefined>( + undefined, + ); useEffect(() => { setInternalValue(value); @@ -38,58 +54,154 @@ export const EditorCard: FunctionComponent = ({ const handleChange = useCallback( (value: object) => { setInternalValue(value); - onChange && onChange(value); + onChange?.(value); }, [onChange], ); const handleSave = useCallback(() => { setSnapshot(internalValue); - onSave && onSave(internalValue); + onSave?.(internalValue); }, [internalValue, onSave]); + const renderDialogContent = () => { + if (dialogContent) return dialogContent; + + switch (dialogMode) { + case 'view': + return ( + + {viewDialogContent ? ( + viewDialogContent + ) : ( +
+
+ +
+
+ )} +
+ ); + + case 'raw-edit': + return ( + + {rawEditDialogContent ? ( + rawEditDialogContent + ) : ( +
+
+ +
+ {onSave && ( +
+ + +
+ )} +
+ )} +
+ ); + + case 'no-code': + return ( + + {noCodeDialogContent ? ( + noCodeDialogContent + ) : ( +
+
+ {/* TODO: Implement no-code editor UI */} +
No-code editor coming soon
+
+ {onSave && ( +
+ + +
+ )} +
+ )} +
+ ); + + default: + return null; + } + }; + return ( { if (!open) { setSnapshot(value); setInternalValue(value); + setDialogMode(undefined); } - onOpenChange && onOpenChange(open); + + onOpenChange?.(open); }} > - - - {title} - - - + + + {title} +
+ enableViewMode && setDialogMode('view')} + > + + + + enableNoCodeMode && setDialogMode('no-code')} + > + + + setDialogMode('raw-edit')}> + - +
- +
- {dialogContent ? ( - dialogContent - ) : ( - -
-
- -
- {onSave && ( -
- - -
- )} -
-
- )} + + {renderDialogContent()}
); }; diff --git a/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx b/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx index 3f9b41e5d3..34d546ff20 100644 --- a/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx +++ b/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/UIDefinitionEditor/UIDefinitionEditor.tsx @@ -31,46 +31,194 @@ export const UIDefinitionEditor: FunctionComponent = ({ reset(); } }} - dialogContent={ - - - - All - {uiSchema.elements.map(element => { - return ( - - {element.stateName} - - ); - })} - - - - + enableViewMode={true} + viewDialogContent={ +
+
+ {uiDefinition.uiSchema.elements.map((element: any, index: number) => ( +
+
+
+
+ + {index + 1} + +

{element.name}

+
+

State: {element.stateName}

+
+
+ +
+ {element.elements?.length > 0 && ( +
+

Form Elements

+
+ {element.elements.map((el: any, i: number) => { + // Helper function to render form elements + const renderFormElement = (element: any) => { + if (!element.type?.startsWith('json-form:')) return null; + + const valueDestination = element.valueDestination?.split('.')?.pop(); + + return ( +
+
+ {valueDestination || element.name || element.type} +
+ {element.options?.label && ( +
+ {element.options.label} +
+ )} +
+ ); + }; + + // Handle direct json-form elements + if (el.type?.startsWith('json-form:')) { + return
{renderFormElement(el)}
; + } + + // Handle nested elements + if (el.elements) { + return ( +
+ {el.elements.map((nestedEl: any, j: number) => { + if (nestedEl.type?.startsWith('json-form:')) { + return
{renderFormElement(nestedEl)}
; + } + + // Recursively check deeper nested elements + if (nestedEl.elements) { + return nestedEl.elements.map((deepEl: any, k: number) => { + if (deepEl.type?.startsWith('json-form:')) { + return ( +
{renderFormElement(deepEl)}
+ ); + } + + return null; + }); + } + + return null; + })} +
+ ); + } + + return null; + })} +
+
+ )} + + {element.actions?.length > 0 && ( +
+

Actions

+
+ {element.actions.map((action: any, i: number) => ( +
+
+ {action.type} + {action.params && ( + + {action.params.eventName || action.params.pluginName} + + )} +
+
+ ))} +
+
+ )} + + {element.pageValidation?.length > 0 && ( +
+

Validations

+
+ {element.pageValidation.map((validation: any, i: number) => ( +
+
+ {validation.type} +
+
+ ))} +
+
+ )} +
+
+ ))} +
+
+ } + rawEditDialogContent={ + + + All {uiSchema.elements.map(element => { return ( - - - + + {element.stateName} + ); })} -
- - -
-
-
+ theme + locales + + + + + {uiSchema.elements.map(element => { + return ( + + + + ); + })} + + + handleUIDefinitionChange({ + ...uiDefinitionValue, + theme: value, + }) + } + /> + + + + handleUIDefinitionChange({ + ...uiDefinitionValue, + locales: value, + }) + } + /> + +
+ + +
+ } /> ); diff --git a/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx b/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx index 9aff7dad85..e3dc8d42be 100644 --- a/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx +++ b/apps/workflows-dashboard/src/pages/WorkflowDefinition/components/WorkflowDefinitionSummaryCard/WorkflowDefinitionSummaryCard.tsx @@ -2,6 +2,7 @@ import { Card, CardContent, CardHeader } from '@/components/atoms/Card'; import { IWorkflowDefinition } from '@/domains/workflow-definitions'; import { valueOrNA } from '@/utils/value-or-na'; import { FunctionComponent } from 'react'; +import dayjs from 'dayjs'; interface IWorkflowDefinitionSummaryCardProps { workflowDefinition: IWorkflowDefinition; @@ -11,39 +12,42 @@ export const WorkflowDefinitionSummaryCard: FunctionComponent< IWorkflowDefinitionSummaryCardProps > = ({ workflowDefinition }) => { return ( - - - Summary + + +

Workflow Summary

- -
- ID: - {workflowDefinition.id} -
-
- Name: - {workflowDefinition.name} -
-
- Display Name: - {valueOrNA(workflowDefinition.displayName)} -
-
- Version: - {valueOrNA(workflowDefinition.version)} -
-
- Variant: - {valueOrNA(workflowDefinition.variant)} -
-
- Created At: - {new Date(workflowDefinition.createdAt as string).toISOString()} -
-
- Is Public: - {workflowDefinition.isPublic ? 'Yes' : 'No'} -
+ + {[ + { label: 'ID', value: workflowDefinition.id }, + { label: 'Name', value: workflowDefinition.name }, + { label: 'Display Name', value: valueOrNA(workflowDefinition.displayName) }, + { label: 'Version', value: valueOrNA(workflowDefinition.version) }, + { label: 'Variant', value: valueOrNA(workflowDefinition.variant) }, + { + label: 'Created At', + value: dayjs(workflowDefinition.createdAt).format('MMM D, YYYY h:mm A'), + }, + { + label: 'Is Public', + value: workflowDefinition.isPublic ? ( + + Yes + + ) : ( + + No + + ), + }, + ].map(({ label, value }, index) => ( +
+ {label} + {value} +
+ ))}
); diff --git a/apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/WorkflowDefinitionsTable.tsx b/apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/WorkflowDefinitionsTable.tsx index 0a2cb08639..3b54eed9ad 100644 --- a/apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/WorkflowDefinitionsTable.tsx +++ b/apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/WorkflowDefinitionsTable.tsx @@ -117,3 +117,5 @@ export const WorkflowDefinitionsTable = memo(({ items, isFetching, sorting, onSo
); }); + +WorkflowDefinitionsTable.displayName = 'WorkflowDefinitionsTable'; diff --git a/apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx b/apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx index 4ba6410762..da02387dac 100644 --- a/apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx +++ b/apps/workflows-dashboard/src/pages/WorkflowDefinitions/components/molecules/WorkflowDefinitionsTable/columns.tsx @@ -5,84 +5,152 @@ import { valueOrNA } from '@/utils/value-or-na'; import { createColumnHelper } from '@tanstack/react-table'; import { ArrowRightCircleIcon, Eye, Pencil } from 'lucide-react'; import { Link } from 'react-router-dom'; +import { toast } from 'sonner'; const columnHelper = createColumnHelper(); export const workflowDefinitionsTableColumns = [ columnHelper.accessor('id', { - cell: info => info.getValue(), - header: () => 'ID', + cell: info => ( +
+ {info.getValue()} + +
+ ), + header: () => ID, }), columnHelper.accessor('name', { - cell: info => info.getValue(), - header: () => 'Name', + cell: info => {info.getValue()}, + header: () => Name, }), columnHelper.accessor('displayName', { - cell: info => valueOrNA(info.getValue()), - header: () => 'Display Name', + cell: info => {valueOrNA(info.getValue())}, + header: () => Display Name, + }), + columnHelper.accessor('isPublic', { + cell: info => ( + () + ? 'bg-emerald-100 text-emerald-700 hover:bg-emerald-200' + : 'bg-slate-100 text-slate-700 hover:bg-slate-200' + }`} + > + {info.getValue() ? 'Public' : 'Private'} + + ), + header: () => Visibility, }), columnHelper.accessor('definitionType', { - cell: info => info.getValue(), - header: () => 'Definition Type', + cell: info => ( + + {info.getValue()} + + ), + header: () => Definition Type, }), columnHelper.accessor('variant', { - cell: info => info.getValue(), - header: () => 'Variant', + cell: info => ( + + {info.getValue()} + + ), + header: () => Variant, }), columnHelper.accessor('definition', { cell: info => ( -
+
} + trigger={ + + } json={JSON.stringify(info.getValue())} /> - +
), - header: () => 'Definition', + header: () => Definition, }), columnHelper.accessor('contextSchema', { cell: info => ( -
+
} + trigger={ + + } json={JSON.stringify(info.getValue())} /> - +
), - header: () => 'Context Schema', + header: () => Context Schema, }), columnHelper.accessor('config', { cell: info => ( -
+
} + trigger={ + + } json={JSON.stringify(info.getValue())} /> - +
), - header: () => 'Config', + header: () => Config, }), columnHelper.accessor('version', { - cell: info => info.getValue(), - header: () => 'Version', + cell: info => ( + + v{info.getValue()} + + ), + header: () => Version, }), columnHelper.accessor('id', { - cell: info => , + cell: info => ( +
+ +
+ ), header: () => '', }), columnHelper.accessor('id', { cell: info => ( - - + + ), header: () => '', diff --git a/examples/headless-example/CHANGELOG.md b/examples/headless-example/CHANGELOG.md index d154aa501b..fe70c47c47 100644 --- a/examples/headless-example/CHANGELOG.md +++ b/examples/headless-example/CHANGELOG.md @@ -1,5 +1,14 @@ # @ballerine/headless-example +## 0.3.76 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/common@0.9.58 + - @ballerine/workflow-browser-sdk@0.6.77 + ## 0.3.75 ### Patch Changes diff --git a/examples/headless-example/package.json b/examples/headless-example/package.json index de76066110..9f33151a1b 100644 --- a/examples/headless-example/package.json +++ b/examples/headless-example/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/headless-example", "private": true, - "version": "0.3.75", + "version": "0.3.76", "type": "module", "scripts": { "spellcheck": "cspell \"*\"", @@ -34,8 +34,8 @@ "vite": "^4.5.3" }, "dependencies": { - "@ballerine/common": "0.9.57", - "@ballerine/workflow-browser-sdk": "0.6.76", + "@ballerine/common": "0.9.58", + "@ballerine/workflow-browser-sdk": "0.6.77", "@felte/reporter-svelte": "^1.1.5", "@felte/validator-zod": "^1.0.13", "@fontsource/inter": "^4.5.15", diff --git a/examples/report-generation-example/CHANGELOG.md b/examples/report-generation-example/CHANGELOG.md index a4e1553975..ccf6d6e41b 100644 --- a/examples/report-generation-example/CHANGELOG.md +++ b/examples/report-generation-example/CHANGELOG.md @@ -1,5 +1,13 @@ # @ballerine/report-generation-example +## 0.2.26 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/react-pdf-toolkit@1.2.50 + ## 0.2.25 ### Patch Changes diff --git a/examples/report-generation-example/package.json b/examples/report-generation-example/package.json index 32bfd336f7..388e8c8f1f 100644 --- a/examples/report-generation-example/package.json +++ b/examples/report-generation-example/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/report-generation-example", "private": false, - "version": "0.2.25", + "version": "0.2.26", "type": "module", "scripts": { "dev": "vite", @@ -10,7 +10,7 @@ "preview": "vite preview" }, "dependencies": { - "@ballerine/react-pdf-toolkit": "^1.2.48", + "@ballerine/react-pdf-toolkit": "^1.2.50", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/packages/blocks/CHANGELOG.md b/packages/blocks/CHANGELOG.md index 2e7d4dde98..62c93f0354 100644 --- a/packages/blocks/CHANGELOG.md +++ b/packages/blocks/CHANGELOG.md @@ -1,5 +1,13 @@ # @ballerine/blocks +## 0.2.29 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/common@0.9.58 + ## 0.2.28 ### Patch Changes diff --git a/packages/blocks/package.json b/packages/blocks/package.json index 4a8042d7b1..08aaaad59b 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -2,7 +2,7 @@ "private": false, "name": "@ballerine/blocks", "author": "Ballerine ", - "version": "0.2.28", + "version": "0.2.29", "description": "blocks", "module": "./dist/esm/index.js", "main": "./dist/cjs/index.js", @@ -42,8 +42,8 @@ "@babel/preset-env": "7.16.11", "@babel/preset-react": "^7.22.5", "@babel/preset-typescript": "7.16.7", - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config": "^1.1.27", "@rollup/plugin-babel": "5.3.1", "@rollup/plugin-commonjs": "^24.0.1", "@rollup/plugin-json": "^6.0.0", @@ -91,6 +91,6 @@ "vitest": "^0.33.0" }, "dependencies": { - "@ballerine/common": "^0.9.55" + "@ballerine/common": "^0.9.58" } } diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 253268d018..3b649c5132 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,11 @@ # @ballerine/common +## 0.9.58 + +### Patch Changes + +- Bump + ## 0.9.57 ### Patch Changes diff --git a/packages/common/package.json b/packages/common/package.json index c4212a1d93..1c738eb968 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -2,7 +2,7 @@ "private": false, "name": "@ballerine/common", "author": "Ballerine ", - "version": "0.9.57", + "version": "0.9.58", "description": "common", "module": "./dist/esm/index.js", "main": "./dist/cjs/index.js", @@ -38,8 +38,8 @@ "@babel/core": "7.17.9", "@babel/preset-env": "7.16.11", "@babel/preset-typescript": "7.16.7", - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config": "^1.1.27", "@cspell/cspell-types": "^6.31.1", "@rollup/plugin-babel": "5.3.1", "@rollup/plugin-commonjs": "^24.0.1", diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index 025ad3614a..0308545f0e 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,11 @@ # @ballerine/config +## 1.1.27 + +### Patch Changes + +- Bump + ## 1.1.26 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index c29dd59406..34febe082b 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "@ballerine/config", - "version": "1.1.26", + "version": "1.1.27", "description": "", "main": "index.js", "scripts": {}, diff --git a/packages/eslint-config-react/CHANGELOG.md b/packages/eslint-config-react/CHANGELOG.md index 633953c0e0..c90b954605 100644 --- a/packages/eslint-config-react/CHANGELOG.md +++ b/packages/eslint-config-react/CHANGELOG.md @@ -1,5 +1,13 @@ # @ballerine/eslint-config-react +## 2.0.27 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/eslint-config@1.1.27 + ## 2.0.26 ### Patch Changes diff --git a/packages/eslint-config-react/package.json b/packages/eslint-config-react/package.json index a0f11d87fd..b459b25f27 100644 --- a/packages/eslint-config-react/package.json +++ b/packages/eslint-config-react/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "@ballerine/eslint-config-react", - "version": "2.0.26", + "version": "2.0.27", "description": "", "main": "index.js", "scripts": {}, @@ -10,7 +10,7 @@ "license": "ISC", "peerDependencies": { "eslint-plugin-react": "^7.33.2", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/eslint-config": "^1.1.27", "eslint-plugin-react-hooks": "^4.6.0" } } diff --git a/packages/eslint-config/CHANGELOG.md b/packages/eslint-config/CHANGELOG.md index 000f31120f..552473a0cf 100644 --- a/packages/eslint-config/CHANGELOG.md +++ b/packages/eslint-config/CHANGELOG.md @@ -1,5 +1,11 @@ # @ballerine/eslint-config +## 1.1.27 + +### Patch Changes + +- Bump + ## 1.1.26 ### Patch Changes diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index d26db10f3c..712462dcc3 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "@ballerine/eslint-config", - "version": "1.1.26", + "version": "1.1.27", "description": "", "main": "index.js", "scripts": {}, diff --git a/packages/react-pdf-toolkit/CHANGELOG.md b/packages/react-pdf-toolkit/CHANGELOG.md index 4bdf41f0d6..685a9a1fe4 100644 --- a/packages/react-pdf-toolkit/CHANGELOG.md +++ b/packages/react-pdf-toolkit/CHANGELOG.md @@ -1,5 +1,14 @@ # @ballerine/react-pdf-toolkit +## 1.2.50 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/config@1.1.27 + - @ballerine/ui@0.5.50 + ## 1.2.49 ### Patch Changes diff --git a/packages/react-pdf-toolkit/package.json b/packages/react-pdf-toolkit/package.json index aed3624c1b..1d6861ccaa 100644 --- a/packages/react-pdf-toolkit/package.json +++ b/packages/react-pdf-toolkit/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/react-pdf-toolkit", "private": false, - "version": "1.2.49", + "version": "1.2.50", "types": "./dist/build.d.ts", "main": "./dist/react-pdf-toolkit.js", "module": "./dist/react-pdf-toolkit.mjs", @@ -26,8 +26,8 @@ "build-storybook": "storybook build" }, "dependencies": { - "@ballerine/config": "^1.1.26", - "@ballerine/ui": "0.5.49", + "@ballerine/config": "^1.1.27", + "@ballerine/ui": "0.5.50", "@react-pdf/renderer": "^3.1.14", "@sinclair/typebox": "^0.31.7", "ajv": "^8.12.0", diff --git a/packages/rules-engine/CHANGELOG.md b/packages/rules-engine/CHANGELOG.md index f82f3ab206..fd2c171a9e 100644 --- a/packages/rules-engine/CHANGELOG.md +++ b/packages/rules-engine/CHANGELOG.md @@ -1,5 +1,11 @@ # @ballerine/rules-engine-lib +## 0.5.27 + +### Patch Changes + +- Bump + ## 0.5.26 ### Patch Changes diff --git a/packages/rules-engine/package.json b/packages/rules-engine/package.json index 614a80eeaf..8e82449925 100644 --- a/packages/rules-engine/package.json +++ b/packages/rules-engine/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/rules-engine-lib", "author": "Ballerine ", - "version": "0.5.26", + "version": "0.5.27", "description": "rules-engine-lib", "module": "./dist/esm/index.js", "main": "./dist/cjs/index.js", @@ -34,9 +34,9 @@ "@babel/core": "7.17.9", "@babel/preset-env": "7.16.11", "@babel/preset-typescript": "7.16.7", - "@ballerine/config": "^1.1.26", + "@ballerine/config": "^1.1.27", "@cspell/cspell-types": "^6.31.1", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/eslint-config": "^1.1.27", "@rollup/plugin-babel": "5.3.1", "@rollup/plugin-commonjs": "^24.0.1", "@rollup/plugin-node-resolve": "13.2.1", diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index 0d6dc272d5..c03b9ee462 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -1,5 +1,13 @@ # @ballerine/ui +## 0.5.50 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/common@0.9.58 + ## 0.5.49 ### Patch Changes diff --git a/packages/ui/package.json b/packages/ui/package.json index 33e69dc746..f6337f48ec 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/ui", "private": false, - "version": "0.5.49", + "version": "0.5.50", "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -26,7 +26,7 @@ "test": "vitest run" }, "dependencies": { - "@ballerine/common": "^0.9.55", + "@ballerine/common": "^0.9.58", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@mui/material": "^5.14.2", @@ -65,8 +65,8 @@ "zod": "^3.23.4" }, "devDependencies": { - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config-react": "^2.0.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config-react": "^2.0.27", "@cspell/cspell-types": "^6.31.1", "@storybook/addon-essentials": "^7.0.26", "@storybook/addon-interactions": "^7.0.26", diff --git a/packages/workflow-core/CHANGELOG.md b/packages/workflow-core/CHANGELOG.md index 0fe54f24a6..76f7577b0f 100644 --- a/packages/workflow-core/CHANGELOG.md +++ b/packages/workflow-core/CHANGELOG.md @@ -1,5 +1,13 @@ # @ballerine/workflow-core +## 0.6.77 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/common@0.9.58 + ## 0.6.76 ### Patch Changes diff --git a/packages/workflow-core/package.json b/packages/workflow-core/package.json index 98a6a0be95..39ac9176cd 100644 --- a/packages/workflow-core/package.json +++ b/packages/workflow-core/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/workflow-core", "author": "Ballerine ", - "version": "0.6.76", + "version": "0.6.77", "description": "workflow-core", "module": "./dist/esm/index.js", "main": "./dist/cjs/index.js", @@ -31,7 +31,7 @@ "node": ">=12" }, "dependencies": { - "@ballerine/common": "0.9.57", + "@ballerine/common": "0.9.58", "ajv": "^8.12.0", "country-state-city": "^3.1.4", "i18n-iso-countries": "^7.6.0", @@ -48,8 +48,8 @@ "@babel/core": "7.17.9", "@babel/preset-env": "7.16.11", "@babel/preset-typescript": "7.16.7", - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config": "^1.1.27", "@cspell/cspell-types": "^6.31.1", "@rollup/plugin-babel": "5.3.1", "@rollup/plugin-commonjs": "^24.0.1", diff --git a/packages/workflow-core/src/lib/built-in-event.ts b/packages/workflow-core/src/lib/built-in-event.ts index f2fc695a3c..01487be510 100644 --- a/packages/workflow-core/src/lib/built-in-event.ts +++ b/packages/workflow-core/src/lib/built-in-event.ts @@ -1,6 +1,7 @@ export const BUILT_IN_EVENT = { UPDATE_CONTEXT: 'UPDATE_CONTEXT', DEEP_MERGE_CONTEXT: 'DEEP_MERGE_CONTEXT', + NO_OP: 'NO_OP', } as const; export type BuiltInEvent = (typeof BUILT_IN_EVENT)[keyof typeof BUILT_IN_EVENT]; diff --git a/packages/workflow-core/src/lib/plugins/common-plugin/types.ts b/packages/workflow-core/src/lib/plugins/common-plugin/types.ts index a8ef64f463..3a12bb1b09 100644 --- a/packages/workflow-core/src/lib/plugins/common-plugin/types.ts +++ b/packages/workflow-core/src/lib/plugins/common-plugin/types.ts @@ -105,10 +105,13 @@ export interface WorkflowTokenPluginParams { expireInMinutes?: number; stateNames: string[]; action: (workflowTokenCallbackInput: WorkflowTokenCallbackInput) => Promise<{ - token: string; - customerName: string; - collectionFlowUrl: string; - customerNormalizedName: string; + collectionFlow: object; + metadata: { + token: string; + customerName: string; + collectionFlowUrl: string; + customerNormalizedName: string; + }; }>; successAction?: string; errorAction?: string; diff --git a/packages/workflow-core/src/lib/plugins/common-plugin/workflow-token-plugin.ts b/packages/workflow-core/src/lib/plugins/common-plugin/workflow-token-plugin.ts index 8a74aa345a..b03f609e6e 100644 --- a/packages/workflow-core/src/lib/plugins/common-plugin/workflow-token-plugin.ts +++ b/packages/workflow-core/src/lib/plugins/common-plugin/workflow-token-plugin.ts @@ -19,7 +19,7 @@ export class WorkflowTokenPlugin { this.action = pluginParams.action; this.successAction = pluginParams.successAction; this.errorAction = pluginParams.errorAction; - this.persistResponseDestination = 'metadata'; + this.persistResponseDestination = ''; } async invoke(context: TContext) { diff --git a/packages/workflow-core/src/lib/utils/definition-validator/states-validator.ts b/packages/workflow-core/src/lib/utils/definition-validator/states-validator.ts index b2d03a5747..6b54f71b20 100644 --- a/packages/workflow-core/src/lib/utils/definition-validator/states-validator.ts +++ b/packages/workflow-core/src/lib/utils/definition-validator/states-validator.ts @@ -9,10 +9,11 @@ type TTransitionOption = | { target: string; cond?: TDefintionRules; + actions?: string; } | { - actions: string; - } + actions: string; + } | string; type TTransitionOptions = TTransitionOption[]; export const statesValidator = ( @@ -77,13 +78,18 @@ export const validateTransitionOnEvent = ({ } throw Error(`Unexpected transition object: ${JSON.stringify(transition)}`); - } - const targetState = getTargetState(); + }; - if (isObject(transition) && 'actions' in transition && transition.actions === BUILT_IN_EVENT.NO_OP) { + if ( + isObject(transition) && + 'actions' in transition && + transition.actions === BUILT_IN_EVENT.NO_OP + ) { return; } + const targetState = getTargetState(); + if (!stateNames.includes(targetState)) { throw new Error(`Invalid transition from ${currentState} to ${targetState}`); } diff --git a/packages/workflow-core/src/lib/workflow-runner.ts b/packages/workflow-core/src/lib/workflow-runner.ts index bf52c79416..d63e3bdfae 100644 --- a/packages/workflow-core/src/lib/workflow-runner.ts +++ b/packages/workflow-core/src/lib/workflow-runner.ts @@ -553,6 +553,7 @@ export class WorkflowRunner { return createMachine( { predictableActionArguments: true, + ...definition, on: { [BUILT_IN_EVENT.UPDATE_CONTEXT]: { actions: updateContext, @@ -560,8 +561,8 @@ export class WorkflowRunner { [BUILT_IN_EVENT.DEEP_MERGE_CONTEXT]: { actions: deepMergeContext, }, + ...definition.on, }, - ...definition, }, { actions, guards }, ); @@ -921,8 +922,12 @@ export class WorkflowRunner { mergeToContext( sourceContext: Record, informationToPersist: Record, - pathToPersist: string, + pathToPersist?: string, ) { + if (!pathToPersist) { + return this.deepMerge(informationToPersist, sourceContext); + } + const keys = pathToPersist.split('.') as Array; let obj = sourceContext; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 43cd490a38..81cbcc56a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,22 +73,22 @@ importers: apps/backoffice-v2: dependencies: '@ballerine/blocks': - specifier: 0.2.28 + specifier: 0.2.29 version: link:../../packages/blocks '@ballerine/common': - specifier: 0.9.57 + specifier: 0.9.58 version: link:../../packages/common '@ballerine/react-pdf-toolkit': - specifier: ^1.2.48 + specifier: ^1.2.50 version: link:../../packages/react-pdf-toolkit '@ballerine/ui': - specifier: ^0.5.48 + specifier: ^0.5.50 version: link:../../packages/ui '@ballerine/workflow-browser-sdk': - specifier: 0.6.76 + specifier: 0.6.77 version: link:../../sdks/workflow-browser-sdk '@ballerine/workflow-node-sdk': - specifier: 0.6.76 + specifier: 0.6.77 version: link:../../sdks/workflow-node-sdk '@botpress/webchat': specifier: ^2.1.10 @@ -355,14 +355,14 @@ importers: specifier: ^1.1.0 version: 1.1.0(vite@5.3.5) zod: - specifier: ^3.22.3 - version: 3.22.4 + specifier: ^3.23.4 + version: 3.23.4 devDependencies: '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/config '@ballerine/eslint-config-react': - specifier: ^2.0.26 + specifier: ^2.0.27 version: link:../../packages/eslint-config-react '@cspell/cspell-types': specifier: ^6.31.1 @@ -401,11 +401,14 @@ importers: specifier: 4.22.0 version: 4.22.0(@tanstack/react-query@4.36.1)(react-dom@18.2.0)(react@18.2.0) '@testing-library/jest-dom': - specifier: ^5.16.4 - version: 5.17.0 + specifier: ^6.6.3 + version: 6.6.3 '@testing-library/react': - specifier: ^13.3.0 - version: 13.4.0(react-dom@18.2.0)(react@18.2.0) + specifier: ^16.1.0 + version: 16.1.0(@testing-library/dom@10.4.0)(@types/react-dom@18.2.15)(@types/react@18.2.37)(react-dom@18.2.0)(react@18.2.0) + '@testing-library/user-event': + specifier: ^14.5.2 + version: 14.5.2(@testing-library/dom@10.4.0) '@total-typescript/ts-reset': specifier: ^0.5.1 version: 0.5.1 @@ -433,9 +436,6 @@ importers: '@types/react-dom': specifier: ^18.0.5 version: 18.2.15 - '@types/testing-library__jest-dom': - specifier: ^5.14.5 - version: 5.14.9 '@typescript-eslint/eslint-plugin': specifier: ^5.30.0 version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.22.0)(typescript@5.5.4) @@ -512,22 +512,22 @@ importers: specifier: ^5.0.1 version: 5.0.1(typescript@5.5.4)(vite@5.3.5) vitest: - specifier: ^0.29.8 - version: 0.29.8 + specifier: ^2.1.8 + version: 2.1.8(@types/node@18.17.19)(msw@1.3.2) apps/kyb-app: dependencies: '@ballerine/blocks': - specifier: 0.2.28 + specifier: 0.2.29 version: link:../../packages/blocks '@ballerine/common': - specifier: ^0.9.57 + specifier: ^0.9.58 version: link:../../packages/common '@ballerine/ui': - specifier: 0.5.49 + specifier: 0.5.50 version: link:../../packages/ui '@ballerine/workflow-browser-sdk': - specifier: 0.6.76 + specifier: 0.6.77 version: link:../../sdks/workflow-browser-sdk '@lukemorales/query-key-factory': specifier: ^1.0.3 @@ -660,10 +660,10 @@ importers: version: 3.23.4 devDependencies: '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/config '@ballerine/eslint-config-react': - specifier: ^2.0.26 + specifier: ^2.0.27 version: link:../../packages/eslint-config-react '@jest/globals': specifier: ^29.7.0 @@ -768,10 +768,10 @@ importers: apps/workflows-dashboard: dependencies: '@ballerine/common': - specifier: ^0.9.55 + specifier: ^0.9.58 version: link:../../packages/common '@ballerine/ui': - specifier: ^0.5.48 + specifier: ^0.5.50 version: link:../../packages/ui '@lukemorales/query-key-factory': specifier: ^1.0.3 @@ -907,10 +907,10 @@ importers: version: 3.22.4 devDependencies: '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/config '@ballerine/eslint-config-react': - specifier: ^2.0.26 + specifier: ^2.0.27 version: link:../../packages/eslint-config-react '@cspell/cspell-types': specifier: ^6.31.1 @@ -1000,10 +1000,10 @@ importers: examples/headless-example: dependencies: '@ballerine/common': - specifier: 0.9.57 + specifier: 0.9.58 version: link:../../packages/common '@ballerine/workflow-browser-sdk': - specifier: 0.6.76 + specifier: 0.6.77 version: link:../../sdks/workflow-browser-sdk '@felte/reporter-svelte': specifier: ^1.1.5 @@ -1097,7 +1097,7 @@ importers: examples/report-generation-example: dependencies: '@ballerine/react-pdf-toolkit': - specifier: ^1.2.48 + specifier: ^1.2.50 version: link:../../packages/react-pdf-toolkit react: specifier: ^18.2.0 @@ -1140,7 +1140,7 @@ importers: packages/blocks: dependencies: '@ballerine/common': - specifier: ^0.9.55 + specifier: ^0.9.58 version: link:../common devDependencies: '@babel/core': @@ -1156,10 +1156,10 @@ importers: specifier: 7.16.7 version: 7.16.7(@babel/core@7.17.9) '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../config '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../eslint-config '@rollup/plugin-babel': specifier: 5.3.1 @@ -1238,7 +1238,7 @@ importers: version: 3.7.2(eslint@8.54.0)(typescript@5.1.6) eslint-plugin-import: specifier: ^2.22.0 - version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) eslint-plugin-storybook: specifier: ^0.6.13 version: 0.6.15(eslint@8.54.0)(typescript@5.1.6) @@ -1337,10 +1337,10 @@ importers: specifier: 7.16.7 version: 7.16.7(@babel/core@7.17.9) '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../config '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../eslint-config '@cspell/cspell-types': specifier: ^6.31.1 @@ -1416,7 +1416,7 @@ importers: version: 3.7.2(eslint@8.54.0)(typescript@4.9.5) eslint-plugin-import: specifier: ^2.22.0 - version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) eslint-plugin-unused-imports: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint@8.54.0) @@ -1489,7 +1489,7 @@ importers: packages/eslint-config-react: dependencies: '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../eslint-config eslint-plugin-react: specifier: ^7.33.2 @@ -1501,10 +1501,10 @@ importers: packages/react-pdf-toolkit: dependencies: '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../config '@ballerine/ui': - specifier: 0.5.49 + specifier: 0.5.50 version: link:../ui '@react-pdf/renderer': specifier: ^3.1.14 @@ -1623,10 +1623,10 @@ importers: specifier: 7.16.7 version: 7.16.7(@babel/core@7.17.9) '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../config '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../eslint-config '@cspell/cspell-types': specifier: ^6.31.1 @@ -1684,7 +1684,7 @@ importers: version: 3.7.2(eslint@8.54.0)(typescript@4.9.5) eslint-plugin-import: specifier: ^2.22.0 - version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) eslint-plugin-unused-imports: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint@8.54.0) @@ -1728,7 +1728,7 @@ importers: packages/ui: dependencies: '@ballerine/common': - specifier: ^0.9.55 + specifier: ^0.9.58 version: link:../common '@emotion/react': specifier: ^11.11.1 @@ -1840,10 +1840,10 @@ importers: version: 3.23.4 devDependencies: '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../config '@ballerine/eslint-config-react': - specifier: ^2.0.26 + specifier: ^2.0.27 version: link:../eslint-config-react '@cspell/cspell-types': specifier: ^6.31.1 @@ -1951,7 +1951,7 @@ importers: packages/workflow-core: dependencies: '@ballerine/common': - specifier: 0.9.57 + specifier: 0.9.58 version: link:../common ajv: specifier: ^8.12.0 @@ -1997,10 +1997,10 @@ importers: specifier: 7.16.7 version: 7.16.7(@babel/core@7.17.9) '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../config '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../eslint-config '@cspell/cspell-types': specifier: ^6.31.1 @@ -2082,7 +2082,7 @@ importers: version: 3.7.2(eslint@8.54.0)(typescript@5.1.6) eslint-plugin-import: specifier: ^2.22.0 - version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) eslint-plugin-unused-imports: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint@8.54.0) @@ -2141,7 +2141,7 @@ importers: sdks/web-ui-sdk: dependencies: '@ballerine/common': - specifier: 0.9.57 + specifier: 0.9.58 version: link:../../packages/common '@zerodevx/svelte-toast': specifier: ^0.8.0 @@ -2268,10 +2268,10 @@ importers: sdks/workflow-browser-sdk: dependencies: '@ballerine/common': - specifier: 0.9.57 + specifier: 0.9.58 version: link:../../packages/common '@ballerine/workflow-core': - specifier: 0.6.76 + specifier: 0.6.77 version: link:../../packages/workflow-core xstate: specifier: ^4.37.0 @@ -2287,10 +2287,10 @@ importers: specifier: 7.16.7 version: 7.16.7(@babel/core@7.17.9) '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/config '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/eslint-config '@cspell/cspell-types': specifier: ^6.31.1 @@ -2357,7 +2357,7 @@ importers: version: 3.7.2(eslint@8.54.0)(typescript@4.9.5) eslint-plugin-import: specifier: ^2.22.0 - version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) eslint-plugin-unused-imports: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint@8.54.0) @@ -2410,7 +2410,7 @@ importers: sdks/workflow-node-sdk: dependencies: '@ballerine/workflow-core': - specifier: 0.6.76 + specifier: 0.6.77 version: link:../../packages/workflow-core json-logic-js: specifier: ^2.0.2 @@ -2429,10 +2429,10 @@ importers: specifier: 7.16.7 version: 7.16.7(@babel/core@7.17.9) '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/config '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/eslint-config '@cspell/cspell-types': specifier: ^6.31.1 @@ -2493,7 +2493,7 @@ importers: version: 3.7.2(eslint@8.54.0)(typescript@5.1.6) eslint-plugin-import: specifier: ^2.22.0 - version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) eslint-plugin-unused-imports: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint@8.54.0) @@ -2655,13 +2655,13 @@ importers: specifier: 3.347.1 version: 3.347.1 '@ballerine/common': - specifier: 0.9.57 + specifier: 0.9.58 version: link:../../packages/common '@ballerine/workflow-core': - specifier: 0.6.76 + specifier: 0.6.77 version: link:../../packages/workflow-core '@ballerine/workflow-node-sdk': - specifier: 0.6.76 + specifier: 0.6.77 version: link:../../sdks/workflow-node-sdk '@faker-js/faker': specifier: ^7.6.0 @@ -2839,10 +2839,10 @@ importers: version: 3.23.4 devDependencies: '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/config '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/eslint-config '@cspell/cspell-types': specifier: ^6.31.1 @@ -3004,7 +3004,7 @@ importers: specifier: ^4.0.0 version: 4.0.0(astro@3.3.3)(tailwindcss@3.3.5)(ts-node@10.9.1) '@ballerine/common': - specifier: ^0.9.57 + specifier: ^0.9.58 version: link:../../packages/common astro: specifier: 3.3.3 @@ -3017,10 +3017,10 @@ importers: version: 0.14.5 devDependencies: '@ballerine/config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/config '@ballerine/eslint-config': - specifier: ^1.1.26 + specifier: ^1.1.27 version: link:../../packages/eslint-config eslint: specifier: ^8.46.0 @@ -3057,6 +3057,10 @@ packages: resolution: {integrity: sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg==} dev: true + /@adobe/css-tools@4.4.1: + resolution: {integrity: sha512-12WGKBQzjUAI4ayyF4IAtfw2QR/IDoqk6jTddXDhtYTJF9ASmoE1zst7cVtP0aL/F1jUJL5r+JxKXKEgHNbEUQ==} + dev: true + /@alloc/quick-lru@5.2.0: resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} engines: {node: '>=10'} @@ -10157,7 +10161,7 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/set-array': 1.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@jridgewell/trace-mapping': 0.3.20 /@jridgewell/gen-mapping@0.3.5: @@ -10219,7 +10223,7 @@ packages: resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} dependencies: '@jridgewell/resolve-uri': 3.1.1 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 /@jsdevtools/ono@7.1.3: resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} @@ -17538,6 +17542,20 @@ packages: seedrandom: 2.4.3 dev: false + /@testing-library/dom@10.4.0: + resolution: {integrity: sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==} + engines: {node: '>=18'} + dependencies: + '@babel/code-frame': 7.24.7 + '@babel/runtime': 7.23.8 + '@types/aria-query': 5.0.4 + aria-query: 5.3.0 + chalk: 4.1.2 + dom-accessibility-api: 0.5.16 + lz-string: 1.5.0 + pretty-format: 27.5.1 + dev: true + /@testing-library/dom@8.20.1: resolution: {integrity: sha512-/DiOQ5xBxgdYRC8LNk7U+RWat0S3qRLeIw3ZIkMQ9kkVlRmwD/Eg8k8CqIpD6GW7u20JIUOfMKbxtiLutpjQ4g==} engines: {node: '>=12'} @@ -17613,6 +17631,19 @@ packages: vitest: 0.34.6(jsdom@20.0.3) dev: true + /@testing-library/jest-dom@6.6.3: + resolution: {integrity: sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==} + engines: {node: '>=14', npm: '>=6', yarn: '>=1'} + dependencies: + '@adobe/css-tools': 4.4.1 + aria-query: 5.3.0 + chalk: 3.0.0 + css.escape: 1.5.1 + dom-accessibility-api: 0.6.3 + lodash: 4.17.21 + redent: 3.0.0 + dev: true + /@testing-library/react@13.4.0(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-sXOGON+WNTh3MLE9rve97ftaZukN3oNf2KjDy7YTx6hcTO2uuLHuCGynMDhFwGw/jYf4OJ2Qk0i4i79qMNNkyw==} engines: {node: '>=12'} @@ -17627,6 +17658,29 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: true + /@testing-library/react@16.1.0(@testing-library/dom@10.4.0)(@types/react-dom@18.2.15)(@types/react@18.2.37)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-Q2ToPvg0KsVL0ohND9A3zLJWcOXXcO8IDu3fj11KhNt0UlCWyFyvnCIBkd12tidB2lkiVRG8VFqdhcqhqnAQtg==} + engines: {node: '>=18'} + peerDependencies: + '@testing-library/dom': ^10.0.0 + '@types/react': ^18.0.0 || ^19.0.0 + '@types/react-dom': ^18.0.0 || ^19.0.0 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + dependencies: + '@babel/runtime': 7.23.8 + '@testing-library/dom': 10.4.0 + '@types/react': 18.2.37 + '@types/react-dom': 18.2.15 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: true + /@testing-library/svelte@3.2.2(svelte@3.59.2): resolution: {integrity: sha512-IKwZgqbekC3LpoRhSwhd0JswRGxKdAGkf39UiDXTywK61YyLXbCYoR831e/UUC6EeNW4hiHPY+2WuovxOgI5sw==} engines: {node: '>= 10'} @@ -17656,6 +17710,15 @@ packages: '@testing-library/dom': 9.3.3 dev: true + /@testing-library/user-event@14.5.2(@testing-library/dom@10.4.0): + resolution: {integrity: sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ==} + engines: {node: '>=12', npm: '>=6'} + peerDependencies: + '@testing-library/dom': '>=7.21.4' + dependencies: + '@testing-library/dom': 10.4.0 + dev: true + /@tiptap/core@2.9.1(@tiptap/pm@2.9.1): resolution: {integrity: sha512-tifnLL/ARzQ6/FGEJjVwj9UT3v+pENdWHdk9x6F3X0mB1y0SeCjV21wpFLYESzwNdBPAj8NMp8Behv7dBnhIfw==} peerDependencies: @@ -20224,7 +20287,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.3) '@types/babel__core': 7.20.4 react-refresh: 0.14.0 - vite: 4.5.3(@types/node@18.17.19) + vite: 4.5.3(@types/node@20.9.2) transitivePeerDependencies: - supports-color dev: true @@ -20294,14 +20357,6 @@ packages: chai: 4.3.10 dev: true - /@vitest/expect@0.29.8: - resolution: {integrity: sha512-xlcVXn5I5oTq6NiZSY3ykyWixBxr5mG8HYtjvpgg6KaqHm0mvhX18xuwl5YGxIRNt/A5jidd7CWcNHrSvgaQqQ==} - dependencies: - '@vitest/spy': 0.29.8 - '@vitest/utils': 0.29.8 - chai: 4.3.10 - dev: true - /@vitest/expect@0.33.0: resolution: {integrity: sha512-sVNf+Gla3mhTCxNJx+wJLDPp/WcstOe0Ksqz4Vec51MmgMth/ia0MGFEkIZmVGeTL5HtjYR4Wl/ZxBxBXZJTzQ==} dependencies: @@ -20318,18 +20373,43 @@ packages: chai: 4.3.10 dev: true - /@vitest/runner@0.28.5: - resolution: {integrity: sha512-NKkHtLB+FGjpp5KmneQjTcPLWPTDfB7ie+MmF1PnUBf/tGe2OjGxWyB62ySYZ25EYp9krR5Bw0YPLS/VWh1QiA==} + /@vitest/expect@2.1.8: + resolution: {integrity: sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==} dependencies: - '@vitest/utils': 0.28.5 - p-limit: 4.0.0 - pathe: 1.1.1 + '@vitest/spy': 2.1.8 + '@vitest/utils': 2.1.8 + chai: 5.1.2 + tinyrainbow: 1.2.0 + dev: true + + /@vitest/mocker@2.1.8(msw@1.3.2)(vite@5.3.5): + resolution: {integrity: sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + dependencies: + '@vitest/spy': 2.1.8 + estree-walker: 3.0.3 + magic-string: 0.30.15 + msw: 1.3.2(typescript@5.5.4) + vite: 5.3.5(@types/node@18.17.19) dev: true - /@vitest/runner@0.29.8: - resolution: {integrity: sha512-FzdhnRDwEr/A3Oo1jtIk/B952BBvP32n1ObMEb23oEJNO+qO5cBet6M2XWIDQmA7BDKGKvmhUf2naXyp/2JEwQ==} + /@vitest/pretty-format@2.1.8: + resolution: {integrity: sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==} dependencies: - '@vitest/utils': 0.29.8 + tinyrainbow: 1.2.0 + dev: true + + /@vitest/runner@0.28.5: + resolution: {integrity: sha512-NKkHtLB+FGjpp5KmneQjTcPLWPTDfB7ie+MmF1PnUBf/tGe2OjGxWyB62ySYZ25EYp9krR5Bw0YPLS/VWh1QiA==} + dependencies: + '@vitest/utils': 0.28.5 p-limit: 4.0.0 pathe: 1.1.1 dev: true @@ -20350,6 +20430,13 @@ packages: pathe: 1.1.1 dev: true + /@vitest/runner@2.1.8: + resolution: {integrity: sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==} + dependencies: + '@vitest/utils': 2.1.8 + pathe: 1.1.2 + dev: true + /@vitest/snapshot@0.33.0: resolution: {integrity: sha512-tJjrl//qAHbyHajpFvr8Wsk8DIOODEebTu7pgBrP07iOepR5jYkLFiqLq2Ltxv+r0uptUb4izv1J8XBOwKkVYA==} dependencies: @@ -20366,14 +20453,16 @@ packages: pretty-format: 29.7.0 dev: true - /@vitest/spy@0.28.5: - resolution: {integrity: sha512-7if6rsHQr9zbmvxN7h+gGh2L9eIIErgf8nSKYDlg07HHimCxp4H6I/X/DPXktVPPLQfiZ1Cw2cbDIx9fSqDjGw==} + /@vitest/snapshot@2.1.8: + resolution: {integrity: sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==} dependencies: - tinyspy: 1.1.1 + '@vitest/pretty-format': 2.1.8 + magic-string: 0.30.15 + pathe: 1.1.2 dev: true - /@vitest/spy@0.29.8: - resolution: {integrity: sha512-VdjBe9w34vOMl5I5mYEzNX8inTxrZ+tYUVk9jxaZJmHFwmDFC/GV3KBFTA/JKswr3XHvZL+FE/yq5EVhb6pSAw==} + /@vitest/spy@0.28.5: + resolution: {integrity: sha512-7if6rsHQr9zbmvxN7h+gGh2L9eIIErgf8nSKYDlg07HHimCxp4H6I/X/DPXktVPPLQfiZ1Cw2cbDIx9fSqDjGw==} dependencies: tinyspy: 1.1.1 dev: true @@ -20390,22 +20479,19 @@ packages: tinyspy: 2.2.0 dev: true - /@vitest/utils@0.28.5: - resolution: {integrity: sha512-UyZdYwdULlOa4LTUSwZ+Paz7nBHGTT72jKwdFSV4IjHF1xsokp+CabMdhjvVhYwkLfO88ylJT46YMilnkSARZA==} + /@vitest/spy@2.1.8: + resolution: {integrity: sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==} dependencies: - cli-truncate: 3.1.0 - diff: 5.1.0 - loupe: 2.3.7 - picocolors: 1.0.0 - pretty-format: 27.5.1 + tinyspy: 3.0.2 dev: true - /@vitest/utils@0.29.8: - resolution: {integrity: sha512-qGzuf3vrTbnoY+RjjVVIBYfuWMjn3UMUqyQtdGNZ6ZIIyte7B37exj6LaVkrZiUTvzSadVvO/tJm8AEgbGCBPg==} + /@vitest/utils@0.28.5: + resolution: {integrity: sha512-UyZdYwdULlOa4LTUSwZ+Paz7nBHGTT72jKwdFSV4IjHF1xsokp+CabMdhjvVhYwkLfO88ylJT46YMilnkSARZA==} dependencies: cli-truncate: 3.1.0 diff: 5.1.0 loupe: 2.3.7 + picocolors: 1.0.0 pretty-format: 27.5.1 dev: true @@ -20425,6 +20511,14 @@ packages: pretty-format: 29.7.0 dev: true + /@vitest/utils@2.1.8: + resolution: {integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==} + dependencies: + '@vitest/pretty-format': 2.1.8 + loupe: 3.1.2 + tinyrainbow: 1.2.0 + dev: true + /@volar/language-core@2.3.4: resolution: {integrity: sha512-wXBhY11qG6pCDAqDnbBRFIDSIwbqkWI7no+lj5+L7IlA7HRIjRP7YQLGzT0LF4lS6eHkMSsclXqy9DwYJasZTQ==} dependencies: @@ -21433,6 +21527,11 @@ packages: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} dev: true + /assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + dev: true + /ast-types@0.15.2: resolution: {integrity: sha512-c27loCv9QkZinsa5ProX751khO9DJl/AcB5c2KNtA6NRvHKS0PgLfcftz72KVq504vB0Gku5s2kUZzDBvQWvHg==} engines: {node: '>=4'} @@ -22343,6 +22442,17 @@ packages: type-detect: 4.0.8 dev: true + /chai@5.1.2: + resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} + engines: {node: '>=12'} + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.1.2 + pathval: 2.0.0 + dev: true + /chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -22425,6 +22535,11 @@ packages: get-func-name: 2.0.2 dev: true + /check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + dev: true + /chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} @@ -23898,6 +24013,18 @@ packages: dependencies: ms: 2.1.2 + /debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.3 + dev: true + /decamelize-keys@1.1.1: resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} engines: {node: '>=0.10.0'} @@ -23955,6 +24082,11 @@ packages: type-detect: 4.0.8 dev: true + /deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + dev: true + /deep-equal@2.2.3: resolution: {integrity: sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==} engines: {node: '>= 0.4'} @@ -24250,6 +24382,10 @@ packages: resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} dev: true + /dom-accessibility-api@0.6.3: + resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==} + dev: true + /dom-css@2.1.0: resolution: {integrity: sha512-w9kU7FAbaSh3QKijL6n59ofAhkkmMJ31GclJIz/vyQdjogfyxcB6Zf8CZyibOERI5o0Hxz30VmJS7+7r5fEj2Q==} dependencies: @@ -24661,6 +24797,10 @@ packages: /es-module-lexer@1.4.1: resolution: {integrity: sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w==} + /es-module-lexer@1.5.4: + resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==} + dev: true + /es-set-tostringtag@2.0.2: resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} engines: {node: '>= 0.4'} @@ -25286,6 +25426,35 @@ packages: - supports-color dev: true + /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.54.0): + resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} + engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint: '*' + eslint-import-resolver-node: '*' + eslint-import-resolver-typescript: '*' + eslint-import-resolver-webpack: '*' + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + eslint: + optional: true + eslint-import-resolver-node: + optional: true + eslint-import-resolver-typescript: + optional: true + eslint-import-resolver-webpack: + optional: true + dependencies: + '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@5.1.6) + debug: 3.2.7 + eslint: 8.54.0 + eslint-import-resolver-node: 0.3.9 + transitivePeerDependencies: + - supports-color + dev: true + /eslint-plugin-astro@0.28.0(eslint@8.54.0): resolution: {integrity: sha512-fZ3B93nXLSXMmEYSAnHkDRBKDbUFuIkWj5CoKE4fxjPnE/EZEHu6zxtX2UJZeclJKu33Uf2mWdeCJKFufyracg==} engines: {node: ^14.18.0 || >=16.0.0} @@ -25444,6 +25613,41 @@ packages: - supports-color dev: true + /eslint-plugin-import@2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0): + resolution: {integrity: sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==} + engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + dependencies: + '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@5.1.6) + array-includes: 3.1.7 + array.prototype.findlastindex: 1.2.3 + array.prototype.flat: 1.3.2 + array.prototype.flatmap: 1.3.2 + debug: 3.2.7 + doctrine: 2.1.0 + eslint: 8.54.0 + eslint-import-resolver-node: 0.3.9 + eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.54.0) + hasown: 2.0.0 + is-core-module: 2.13.1 + is-glob: 4.0.3 + minimatch: 3.1.2 + object.fromentries: 2.0.7 + object.groupby: 1.0.1 + object.values: 1.1.7 + semver: 6.3.1 + tsconfig-paths: 3.14.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + dev: true + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@5.62.0)(eslint@8.54.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} @@ -25463,7 +25667,7 @@ packages: doctrine: 2.1.0 eslint: 8.54.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.54.0) hasown: 2.0.0 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -25736,7 +25940,7 @@ packages: '@typescript-eslint/eslint-plugin': optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0)(typescript@4.9.5) + '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0)(typescript@5.1.6) eslint: 8.54.0 eslint-rule-composer: 0.3.0 dev: true @@ -26138,7 +26342,6 @@ packages: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} dependencies: '@types/estree': 1.0.5 - dev: false /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} @@ -26249,6 +26452,11 @@ packages: homedir-polyfill: 1.0.3 dev: true + /expect-type@1.1.0: + resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} + engines: {node: '>=12.0.0'} + dev: true + /expect@29.7.0: resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -30016,6 +30224,10 @@ packages: get-func-name: 2.0.2 dev: true + /loupe@3.1.2: + resolution: {integrity: sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==} + dev: true + /lower-case@2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} dependencies: @@ -30133,6 +30345,12 @@ packages: '@jridgewell/sourcemap-codec': 1.5.0 dev: true + /magic-string@0.30.15: + resolution: {integrity: sha512-zXeaYRgZ6ldS1RJJUrMrYgNJ4fdwnyI6tVqoiIhyCyv5IVTK9BU8Ic2l253GGETQHxI4HNUwhJ3fjDhKqEoaAw==} + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + dev: true + /magic-string@0.30.5: resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} engines: {node: '>=12'} @@ -31636,7 +31854,6 @@ packages: transitivePeerDependencies: - encoding - supports-color - dev: false /muggle-string@0.4.1: resolution: {integrity: sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==} @@ -32628,10 +32845,19 @@ packages: resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} dev: true + /pathe@1.1.2: + resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + dev: true + /pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} dev: true + /pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} + dev: true + /pause@0.0.1: resolution: {integrity: sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==} dev: false @@ -35571,6 +35797,10 @@ packages: resolution: {integrity: sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA==} dev: true + /std-env@3.8.0: + resolution: {integrity: sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==} + dev: true + /stdin-discarder@0.1.0: resolution: {integrity: sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -36491,13 +36721,16 @@ packages: resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} dev: true - /tinypool@0.3.1: - resolution: {integrity: sha512-zLA1ZXlstbU2rlpA4CIeVaqvWq41MTWqLY3FfsAXgC8+f7Pk7zroaJQxDgxn1xNudKW6Kmj4808rPFShUlIRmQ==} - engines: {node: '>=14.0.0'} + /tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + dev: true + + /tinyexec@0.3.1: + resolution: {integrity: sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==} dev: true - /tinypool@0.4.0: - resolution: {integrity: sha512-2ksntHOKf893wSAH4z/+JbPpi92esw8Gn9N2deXX+B0EO92hexAVI9GIZZPx7P5aYo5KULfeOSt3kMOmSOy6uA==} + /tinypool@0.3.1: + resolution: {integrity: sha512-zLA1ZXlstbU2rlpA4CIeVaqvWq41MTWqLY3FfsAXgC8+f7Pk7zroaJQxDgxn1xNudKW6Kmj4808rPFShUlIRmQ==} engines: {node: '>=14.0.0'} dev: true @@ -36511,6 +36744,16 @@ packages: engines: {node: '>=14.0.0'} dev: true + /tinypool@1.0.2: + resolution: {integrity: sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==} + engines: {node: ^18.0.0 || >=20.0.0} + dev: true + + /tinyrainbow@1.2.0: + resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==} + engines: {node: '>=14.0.0'} + dev: true + /tinyspy@1.1.1: resolution: {integrity: sha512-UVq5AXt/gQlti7oxoIg5oi/9r0WpF7DGEVwXgqWSMmyN16+e3tl5lIvTaOpJ3TAtu5xFzWccFRM4R5NaWHF+4g==} engines: {node: '>=14.0.0'} @@ -36521,6 +36764,11 @@ packages: engines: {node: '>=14.0.0'} dev: true + /tinyspy@3.0.2: + resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} + engines: {node: '>=14.0.0'} + dev: true + /tippy.js@6.3.7: resolution: {integrity: sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==} dependencies: @@ -38025,9 +38273,9 @@ packages: - terser dev: true - /vite-node@0.29.8(@types/node@18.17.19): - resolution: {integrity: sha512-b6OtCXfk65L6SElVM20q5G546yu10/kNrhg08afEoWlFRJXFq9/6glsvSVY+aI6YeC1tu2TtAqI2jHEQmOmsFw==} - engines: {node: '>=v14.16.0'} + /vite-node@0.33.0(@types/node@18.17.19): + resolution: {integrity: sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw==} + engines: {node: '>=v14.18.0'} hasBin: true dependencies: cac: 6.7.14 @@ -38047,8 +38295,8 @@ packages: - terser dev: true - /vite-node@0.33.0(@types/node@18.17.19): - resolution: {integrity: sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw==} + /vite-node@0.34.6(@types/node@18.17.19): + resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} engines: {node: '>=v14.18.0'} hasBin: true dependencies: @@ -38069,17 +38317,16 @@ packages: - terser dev: true - /vite-node@0.34.6(@types/node@18.17.19): - resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} - engines: {node: '>=v14.18.0'} + /vite-node@2.1.8(@types/node@18.17.19): + resolution: {integrity: sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.6 - mlly: 1.4.2 - pathe: 1.1.1 - picocolors: 1.0.0 - vite: 4.5.3(@types/node@18.17.19) + debug: 4.4.0 + es-module-lexer: 1.5.4 + pathe: 1.1.2 + vite: 5.3.5(@types/node@18.17.19) transitivePeerDependencies: - '@types/node' - less @@ -38137,7 +38384,7 @@ packages: strip-ansi: 6.0.1 tiny-invariant: 1.3.1 typescript: 5.1.6 - vite: 4.5.3(@types/node@18.17.19) + vite: 4.5.3(@types/node@20.9.2) vscode-languageclient: 7.0.0 vscode-languageserver: 7.0.0 vscode-languageserver-textdocument: 1.0.11 @@ -38268,7 +38515,7 @@ packages: kolorist: 1.8.0 sirv: 2.0.3 ufo: 1.3.2 - vite: 4.5.3(@types/node@18.17.19) + vite: 4.5.3(@types/node@20.9.2) transitivePeerDependencies: - rollup - supports-color @@ -38347,7 +38594,7 @@ packages: debug: 4.3.4(supports-color@8.1.1) globrex: 0.1.2 tsconfck: 2.1.2(typescript@5.1.6) - vite: 4.5.3(@types/node@18.17.19) + vite: 4.5.3(@types/node@20.9.2) transitivePeerDependencies: - supports-color - typescript @@ -38655,9 +38902,9 @@ packages: - terser dev: true - /vitest@0.29.8: - resolution: {integrity: sha512-JIAVi2GK5cvA6awGpH0HvH/gEG9PZ0a/WoxdiV3PmqK+3CjQMf8c+J/Vhv4mdZ2nRyXFw66sAg6qz7VNkaHfDQ==} - engines: {node: '>=v14.16.0'} + /vitest@0.33.0: + resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==} + engines: {node: '>=v14.18.0'} hasBin: true peerDependencies: '@edge-runtime/vm': '*' @@ -38689,26 +38936,26 @@ packages: '@types/chai': 4.3.10 '@types/chai-subset': 1.3.5 '@types/node': 18.17.19 - '@vitest/expect': 0.29.8 - '@vitest/runner': 0.29.8 - '@vitest/spy': 0.29.8 - '@vitest/utils': 0.29.8 + '@vitest/expect': 0.33.0 + '@vitest/runner': 0.33.0 + '@vitest/snapshot': 0.33.0 + '@vitest/spy': 0.33.0 + '@vitest/utils': 0.33.0 acorn: 8.11.2 acorn-walk: 8.3.0 cac: 6.7.14 chai: 4.3.10 debug: 4.3.4(supports-color@8.1.1) local-pkg: 0.4.3 + magic-string: 0.30.5 pathe: 1.1.1 picocolors: 1.0.0 - source-map: 0.6.1 std-env: 3.5.0 strip-literal: 1.3.0 tinybench: 2.5.1 - tinypool: 0.4.0 - tinyspy: 1.1.1 + tinypool: 0.6.0 vite: 4.5.3(@types/node@18.17.19) - vite-node: 0.29.8(@types/node@18.17.19) + vite-node: 0.33.0(@types/node@18.17.19) why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -38720,8 +38967,8 @@ packages: - terser dev: true - /vitest@0.33.0: - resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==} + /vitest@0.34.6(jsdom@20.0.3): + resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} engines: {node: '>=v14.18.0'} hasBin: true peerDependencies: @@ -38754,16 +39001,17 @@ packages: '@types/chai': 4.3.10 '@types/chai-subset': 1.3.5 '@types/node': 18.17.19 - '@vitest/expect': 0.33.0 - '@vitest/runner': 0.33.0 - '@vitest/snapshot': 0.33.0 - '@vitest/spy': 0.33.0 - '@vitest/utils': 0.33.0 + '@vitest/expect': 0.34.6 + '@vitest/runner': 0.34.6 + '@vitest/snapshot': 0.34.6 + '@vitest/spy': 0.34.6 + '@vitest/utils': 0.34.6 acorn: 8.11.2 acorn-walk: 8.3.0 cac: 6.7.14 chai: 4.3.10 debug: 4.3.4(supports-color@8.1.1) + jsdom: 20.0.3 local-pkg: 0.4.3 magic-string: 0.30.5 pathe: 1.1.1 @@ -38771,9 +39019,9 @@ packages: std-env: 3.5.0 strip-literal: 1.3.0 tinybench: 2.5.1 - tinypool: 0.6.0 + tinypool: 0.7.0 vite: 4.5.3(@types/node@18.17.19) - vite-node: 0.33.0(@types/node@18.17.19) + vite-node: 0.34.6(@types/node@18.17.19) why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -38785,22 +39033,22 @@ packages: - terser dev: true - /vitest@0.34.6(jsdom@20.0.3): - resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} - engines: {node: '>=v14.18.0'} + /vitest@2.1.8(@types/node@18.17.19)(msw@1.3.2): + resolution: {integrity: sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' - '@vitest/browser': '*' - '@vitest/ui': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': 2.1.8 + '@vitest/ui': 2.1.8 happy-dom: '*' jsdom: '*' - playwright: '*' - safaridriver: '*' - webdriverio: '*' peerDependenciesMeta: '@edge-runtime/vm': optional: true + '@types/node': + optional: true '@vitest/browser': optional: true '@vitest/ui': @@ -38809,41 +39057,32 @@ packages: optional: true jsdom: optional: true - playwright: - optional: true - safaridriver: - optional: true - webdriverio: - optional: true dependencies: - '@types/chai': 4.3.10 - '@types/chai-subset': 1.3.5 '@types/node': 18.17.19 - '@vitest/expect': 0.34.6 - '@vitest/runner': 0.34.6 - '@vitest/snapshot': 0.34.6 - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 - acorn: 8.11.2 - acorn-walk: 8.3.0 - cac: 6.7.14 - chai: 4.3.10 - debug: 4.3.4(supports-color@8.1.1) - jsdom: 20.0.3 - local-pkg: 0.4.3 - magic-string: 0.30.5 - pathe: 1.1.1 - picocolors: 1.0.0 - std-env: 3.5.0 - strip-literal: 1.3.0 - tinybench: 2.5.1 - tinypool: 0.7.0 - vite: 4.5.3(@types/node@18.17.19) - vite-node: 0.34.6(@types/node@18.17.19) - why-is-node-running: 2.2.2 + '@vitest/expect': 2.1.8 + '@vitest/mocker': 2.1.8(msw@1.3.2)(vite@5.3.5) + '@vitest/pretty-format': 2.1.8 + '@vitest/runner': 2.1.8 + '@vitest/snapshot': 2.1.8 + '@vitest/spy': 2.1.8 + '@vitest/utils': 2.1.8 + chai: 5.1.2 + debug: 4.4.0 + expect-type: 1.1.0 + magic-string: 0.30.15 + pathe: 1.1.2 + std-env: 3.8.0 + tinybench: 2.9.0 + tinyexec: 0.3.1 + tinypool: 1.0.2 + tinyrainbow: 1.2.0 + vite: 5.3.5(@types/node@18.17.19) + vite-node: 2.1.8(@types/node@18.17.19) + why-is-node-running: 2.3.0 transitivePeerDependencies: - less - lightningcss + - msw - sass - stylus - sugarss @@ -39233,6 +39472,15 @@ packages: stackback: 0.0.2 dev: true + /why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + dev: true + /wide-align@1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} dependencies: diff --git a/sdks/web-ui-sdk/CHANGELOG.md b/sdks/web-ui-sdk/CHANGELOG.md index e24546d7b6..a9c09f33a4 100644 --- a/sdks/web-ui-sdk/CHANGELOG.md +++ b/sdks/web-ui-sdk/CHANGELOG.md @@ -1,5 +1,13 @@ # web-ui-sdk +## 1.5.59 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/common@0.9.58 + ## 1.5.58 ### Patch Changes diff --git a/sdks/web-ui-sdk/package.json b/sdks/web-ui-sdk/package.json index ee6cb9bee8..38e11d3052 100644 --- a/sdks/web-ui-sdk/package.json +++ b/sdks/web-ui-sdk/package.json @@ -21,7 +21,7 @@ "types": "dist/index.d.ts", "name": "@ballerine/web-ui-sdk", "private": false, - "version": "1.5.58", + "version": "1.5.59", "type": "module", "files": [ "dist" @@ -96,7 +96,7 @@ "vitest": "^0.24.5" }, "dependencies": { - "@ballerine/common": "0.9.57", + "@ballerine/common": "0.9.58", "@zerodevx/svelte-toast": "^0.8.0", "compressorjs": "^1.1.1", "deepmerge": "^4.3.0", diff --git a/sdks/workflow-browser-sdk/CHANGELOG.md b/sdks/workflow-browser-sdk/CHANGELOG.md index 63ccb655c4..98664fc202 100644 --- a/sdks/workflow-browser-sdk/CHANGELOG.md +++ b/sdks/workflow-browser-sdk/CHANGELOG.md @@ -1,5 +1,14 @@ # @ballerine/workflow-browser-sdk +## 0.6.77 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/workflow-core@0.6.77 + - @ballerine/common@0.9.58 + ## 0.6.76 ### Patch Changes diff --git a/sdks/workflow-browser-sdk/package.json b/sdks/workflow-browser-sdk/package.json index f0cde7d1c7..192eb83656 100644 --- a/sdks/workflow-browser-sdk/package.json +++ b/sdks/workflow-browser-sdk/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/workflow-browser-sdk", "author": "Ballerine ", - "version": "0.6.76", + "version": "0.6.77", "description": "workflow-browser-sdk", "module": "./dist/esm/index.js", "main": "./dist/cjs/index.js", @@ -33,17 +33,17 @@ "node": ">=12" }, "dependencies": { - "@ballerine/common": "0.9.57", - "@ballerine/workflow-core": "0.6.76", + "@ballerine/common": "0.9.58", + "@ballerine/workflow-core": "0.6.77", "xstate": "^4.37.0" }, "devDependencies": { "@babel/core": "7.17.9", "@babel/preset-env": "7.16.11", "@babel/preset-typescript": "7.16.7", - "@ballerine/config": "^1.1.26", + "@ballerine/config": "^1.1.27", "@cspell/cspell-types": "^6.31.1", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/eslint-config": "^1.1.27", "@rollup/plugin-babel": "5.3.1", "@rollup/plugin-commonjs": "^24.0.1", "@rollup/plugin-json": "^6.0.0", diff --git a/sdks/workflow-node-sdk/CHANGELOG.md b/sdks/workflow-node-sdk/CHANGELOG.md index cf58b3cb9f..6eb421c38c 100644 --- a/sdks/workflow-node-sdk/CHANGELOG.md +++ b/sdks/workflow-node-sdk/CHANGELOG.md @@ -1,5 +1,13 @@ # @ballerine/workflow-node-sdk +## 0.6.77 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/workflow-core@0.6.77 + ## 0.6.76 ### Patch Changes diff --git a/sdks/workflow-node-sdk/package.json b/sdks/workflow-node-sdk/package.json index 5cb194bf7f..2eaaf6ef8c 100644 --- a/sdks/workflow-node-sdk/package.json +++ b/sdks/workflow-node-sdk/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/workflow-node-sdk", "author": "Ballerine ", - "version": "0.6.76", + "version": "0.6.77", "description": "workflow-node-sdk", "module": "./dist/esm/index.js", "main": "./dist/cjs/index.js", @@ -28,7 +28,7 @@ "node": ">=12" }, "dependencies": { - "@ballerine/workflow-core": "0.6.76", + "@ballerine/workflow-core": "0.6.77", "json-logic-js": "^2.0.2", "xstate": "^4.36.0" }, @@ -36,9 +36,9 @@ "@babel/core": "7.17.9", "@babel/preset-env": "7.16.11", "@babel/preset-typescript": "7.16.7", - "@ballerine/config": "^1.1.26", + "@ballerine/config": "^1.1.27", "@cspell/cspell-types": "^6.31.1", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/eslint-config": "^1.1.27", "@rollup/plugin-babel": "5.3.1", "@rollup/plugin-commonjs": "^24.0.1", "@rollup/plugin-json": "^6.0.0", diff --git a/services/websocket-service/CHANGELOG.md b/services/websocket-service/CHANGELOG.md index 1e9973f08f..ad77bb20ae 100644 --- a/services/websocket-service/CHANGELOG.md +++ b/services/websocket-service/CHANGELOG.md @@ -1,5 +1,11 @@ # @ballerine/websocket-service +## 0.1.27 + +### Patch Changes + +- Bump + ## 0.1.26 ### Patch Changes diff --git a/services/websocket-service/package.json b/services/websocket-service/package.json index 9e13691ef7..85e87b97b4 100644 --- a/services/websocket-service/package.json +++ b/services/websocket-service/package.json @@ -1,6 +1,6 @@ { "name": "@ballerine/websocket-service", - "version": "0.1.26", + "version": "0.1.27", "description": "websocket-service", "private": false, "scripts": { diff --git a/services/workflows-service/CHANGELOG.md b/services/workflows-service/CHANGELOG.md index 8ac2c59a85..46b74e9bb8 100644 --- a/services/workflows-service/CHANGELOG.md +++ b/services/workflows-service/CHANGELOG.md @@ -1,5 +1,15 @@ # @ballerine/workflows-service +## 0.7.81 + +### Patch Changes + +- Bump +- Updated dependencies + - @ballerine/workflow-core@0.6.77 + - @ballerine/common@0.9.58 + - @ballerine/workflow-node-sdk@0.6.77 + ## 0.7.80 ### Patch Changes diff --git a/services/workflows-service/package.json b/services/workflows-service/package.json index c9c06c3d11..ca48a9ebe8 100644 --- a/services/workflows-service/package.json +++ b/services/workflows-service/package.json @@ -1,7 +1,7 @@ { "name": "@ballerine/workflows-service", "private": false, - "version": "0.7.80", + "version": "0.7.81", "description": "workflow-service", "scripts": { "spellcheck": "cspell \"*\"", @@ -49,9 +49,9 @@ "@aws-sdk/client-secrets-manager": "^3.620.1", "@aws-sdk/lib-storage": "3.347.1", "@aws-sdk/s3-request-presigner": "3.347.1", - "@ballerine/common": "0.9.57", - "@ballerine/workflow-core": "0.6.76", - "@ballerine/workflow-node-sdk": "0.6.76", + "@ballerine/common": "0.9.58", + "@ballerine/workflow-core": "0.6.77", + "@ballerine/workflow-node-sdk": "0.6.77", "@faker-js/faker": "^7.6.0", "@nestjs/axios": "^2.0.0", "@nestjs/common": "^9.3.12", @@ -112,8 +112,8 @@ "zod": "^3.23.4" }, "devDependencies": { - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config": "^1.1.27", "@cspell/cspell-types": "^6.31.1", "@nestjs/cli": "9.3.0", "@nestjs/swagger": "7.4.0", diff --git a/services/workflows-service/prisma/data-migrations b/services/workflows-service/prisma/data-migrations index 17476c0a06..1b7508555c 160000 --- a/services/workflows-service/prisma/data-migrations +++ b/services/workflows-service/prisma/data-migrations @@ -1 +1 @@ -Subproject commit 17476c0a067832644fe254cbd0fee811aefd6373 +Subproject commit 1b7508555c1f354619b11197d94fab8a2252ce29 diff --git a/services/workflows-service/src/auth/workflow-token/workflow-token.service.ts b/services/workflows-service/src/auth/workflow-token/workflow-token.service.ts index bad936460e..e6c37a79a9 100644 --- a/services/workflows-service/src/auth/workflow-token/workflow-token.service.ts +++ b/services/workflows-service/src/auth/workflow-token/workflow-token.service.ts @@ -41,32 +41,43 @@ export class WorkflowTokenService { transaction, ); - const [uiDefinition, customer] = await Promise.all([ - this.uiDefinitionService.getByWorkflowDefinitionId( - workflowDefinitionId, - UiDefinitionContext.collection_flow, - [projectId], - ), - this.customerService.getByProjectId(projectId), - ]); - - const collectionFlow = buildCollectionFlowState({ - apiUrl: env.APP_API_URL, - steps: uiDefinition?.definition - ? getOrderedSteps( - (uiDefinition?.definition as Prisma.JsonObject)?.definition as Record< - string, - Record - >, - { finalStates: [...WORKFLOW_FINAL_STATES] }, - ).map(stepName => ({ - stateName: stepName, - })) - : [], - additionalInformation: { - customerCompany: customer.displayName, - }, - }); + let collectionFlow; + try { + const [uiDefinition, customer] = await Promise.all([ + this.uiDefinitionService.getByWorkflowDefinitionId( + workflowDefinitionId, + UiDefinitionContext.collection_flow, + [projectId], + ), + this.customerService.getByProjectId(projectId), + ]); + + collectionFlow = buildCollectionFlowState({ + apiUrl: env.APP_API_URL, + steps: uiDefinition?.definition + ? getOrderedSteps( + (uiDefinition?.definition as Prisma.JsonObject)?.definition as Record< + string, + Record + >, + { finalStates: [...WORKFLOW_FINAL_STATES] }, + ).map(stepName => ({ + stateName: stepName, + })) + : [], + additionalInformation: { + customerCompany: customer.displayName, + }, + }); + } catch (error) { + collectionFlow = buildCollectionFlowState({ + apiUrl: env.APP_API_URL, + steps: [], + additionalInformation: { + customerCompany: '', + }, + }); + } await this.workflowRuntimeDataRepository.updateStateById( workflowRuntimeDataId, diff --git a/services/workflows-service/src/filter/filter.controller.external.ts b/services/workflows-service/src/filter/filter.controller.external.ts index 9bb072bec6..0e48622646 100644 --- a/services/workflows-service/src/filter/filter.controller.external.ts +++ b/services/workflows-service/src/filter/filter.controller.external.ts @@ -90,7 +90,6 @@ export class FilterControllerExternal { } @common.Post() - @UseCustomerAuthGuard() @swagger.ApiCreatedResponse({ type: FilterModel }) @swagger.ApiForbiddenResponse() @UsePipes(new ZodValidationPipe(FilterCreateSchema, 'body')) diff --git a/services/workflows-service/src/ui-definition/ui-definition.controller.ts b/services/workflows-service/src/ui-definition/ui-definition.controller.ts index 7dfac9cf5e..08347f6d88 100644 --- a/services/workflows-service/src/ui-definition/ui-definition.controller.ts +++ b/services/workflows-service/src/ui-definition/ui-definition.controller.ts @@ -35,14 +35,21 @@ export class UIDefinitionController { name: 'id', schema: UIDefinitionWhereUniqueInputSchema, }, + { + type: 'body', + schema: Type.Object({ + name: Type.String(), + }), + }, ], response: Type.Any(), }) @common.Post(':id/copy') async copyUIDefinition( @common.Param('id') id: string, + @common.Body() body: { name: string }, @CurrentProject() currentProjectId: TProjectId, ) { - return this.uiDefinitionService.cloneUIDefinitionById(id, currentProjectId); + return this.uiDefinitionService.cloneUIDefinitionById(id, currentProjectId, body.name); } } diff --git a/services/workflows-service/src/ui-definition/ui-definition.repository.ts b/services/workflows-service/src/ui-definition/ui-definition.repository.ts index 57ef81f08e..167b6b189f 100644 --- a/services/workflows-service/src/ui-definition/ui-definition.repository.ts +++ b/services/workflows-service/src/ui-definition/ui-definition.repository.ts @@ -51,11 +51,11 @@ export class UiDefinitionRepository { ...args, where: { OR: [ + ...(args?.where ? [args.where] : []), { workflowDefinitionId, uiContext: uiContext, }, - ...(args?.where ? [args.where] : []), ], }, }, diff --git a/services/workflows-service/src/ui-definition/ui-definition.service.ts b/services/workflows-service/src/ui-definition/ui-definition.service.ts index 9f4426f7ae..46a3e62583 100644 --- a/services/workflows-service/src/ui-definition/ui-definition.service.ts +++ b/services/workflows-service/src/ui-definition/ui-definition.service.ts @@ -83,16 +83,22 @@ export class UiDefinitionService { ); } - async cloneUIDefinitionById(id: string, projectId: TProjectId) { + async cloneUIDefinitionById(id: string, projectId: TProjectId, newName: string) { const { createdAt, updatedAt, id: _, + crossEnvKey, + name, ...uiDefinition } = await this.repository.findById(id, {}, [projectId]); - //@ts-ignore - const uiDefinitionCopy = await this.create({ data: replaceNullsWithUndefined(uiDefinition) }); + const uiDefinitionCopy = await this.create({ + data: replaceNullsWithUndefined({ + ...uiDefinition, + name: newName, + }), + }); return uiDefinitionCopy; } diff --git a/services/workflows-service/src/workflow-defintion/workflow-definition.service.ts b/services/workflows-service/src/workflow-defintion/workflow-definition.service.ts index 5a01b35777..742f1e0102 100644 --- a/services/workflows-service/src/workflow-defintion/workflow-definition.service.ts +++ b/services/workflows-service/src/workflow-defintion/workflow-definition.service.ts @@ -111,6 +111,8 @@ export class WorkflowDefinitionService { merge(restArgs, { name, displayName, + projectId, + isPublic: false, version: 1, }), ) as Prisma.WorkflowDefinitionCreateArgs['data']; diff --git a/services/workflows-service/src/workflow/workflow.service.ts b/services/workflows-service/src/workflow/workflow.service.ts index 97dec21803..f4455f8687 100644 --- a/services/workflows-service/src/workflow/workflow.service.ts +++ b/services/workflows-service/src/workflow/workflow.service.ts @@ -1554,15 +1554,25 @@ export class WorkflowService { } const nowPlus30Days = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000); - const workflowToken = await this.workflowTokenService.create( - currentProjectId, - { + let workflowToken; + try { + workflowToken = await this.workflowTokenService.create( + currentProjectId, + { + workflowRuntimeDataId: workflowRuntimeData.id, + endUserId: endUserId ?? null, + expiresAt: nowPlus30Days, + }, + transaction, + ); + } catch (error) { + this.logger.error('Failed to create workflow token', { + error, workflowRuntimeDataId: workflowRuntimeData.id, - endUserId: endUserId ?? null, - expiresAt: nowPlus30Days, - }, - transaction, - ); + endUserId, + }); + this.sentry.captureException(error as Error); + } const collectionFlow = buildCollectionFlowState({ apiUrl: env.APP_API_URL, @@ -1591,7 +1601,7 @@ export class WorkflowService { collectionFlow, metadata: { ...(workflowRuntimeData.context.metadata ?? {}), - token: workflowToken.token, + token: workflowToken?.token, collectionFlowUrl: env.COLLECTION_FLOW_URL, webUiSDKUrl: env.WEB_UI_SDK_URL, }, @@ -2099,6 +2109,24 @@ export class WorkflowService { transaction, ); + const collectionFlow = buildCollectionFlowState({ + apiUrl: env.APP_API_URL, + steps: uiDefinition?.definition + ? getOrderedSteps( + (uiDefinition?.definition as Prisma.JsonObject)?.definition as Record< + string, + Record + >, + { finalStates: [...WORKFLOW_FINAL_STATES] }, + ).map(stepName => ({ + stateName: stepName, + })) + : [], + additionalInformation: { + customerCompany: customer.displayName, + }, + }); + await this.workflowRuntimeDataRepository.updateById( workflowRuntimeId, { @@ -2110,10 +2138,13 @@ export class WorkflowService { ); return { - token: token, - customerName: customer.displayName, - collectionFlowUrl: env.COLLECTION_FLOW_URL!, - customerNormalizedName: customer.name, + collectionFlow, + metadata: { + token: token, + customerName: customer.displayName, + collectionFlowUrl: env.COLLECTION_FLOW_URL!, + customerNormalizedName: customer.name, + }, }; }, }); diff --git a/websites/docs/package.json b/websites/docs/package.json index ad9c17f937..2234d7aa81 100644 --- a/websites/docs/package.json +++ b/websites/docs/package.json @@ -17,14 +17,14 @@ "dependencies": { "@astrojs/starlight": "0.11.1", "@astrojs/tailwind": "^4.0.0", - "@ballerine/common": "^0.9.57", + "@ballerine/common": "^0.9.58", "astro": "3.3.3", "sharp": "^0.32.4", "shiki": "^0.14.3" }, "devDependencies": { - "@ballerine/config": "^1.1.26", - "@ballerine/eslint-config": "^1.1.26", + "@ballerine/config": "^1.1.27", + "@ballerine/eslint-config": "^1.1.27", "eslint": "^8.46.0", "eslint-config-prettier": "^9.0.0", "eslint-config-standard-with-typescript": "^37.0.0",