Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illiar/feat/collection flow customization #2479

Open
wants to merge 34 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9419c25
feat: updated collection flow schema update endpoint & updated theme
chesterkmr Jun 20, 2024
c7a5a6d
fix: fixed update
chesterkmr Jun 23, 2024
426ee82
feat: reworked ui definition update method(WIP)
chesterkmr Jun 24, 2024
aabec56
feat: refactored endpoints & added new deep merge method to wf sdk
chesterkmr Jun 25, 2024
468e20c
fix: reworked put endpoint
chesterkmr Jun 26, 2024
c587d95
feat: workflow core bump
chesterkmr Jun 26, 2024
b5e661c
feat: added initial collection flow docs
chesterkmr Jun 27, 2024
804d605
feat: added iframe integration docs
chesterkmr Jun 27, 2024
ccf1cd8
feat(ci-cd): add node heap to test run
alonp99 Jun 27, 2024
f7f834a
feat: added screenshots to theming section
chesterkmr Jun 27, 2024
c1bec6a
feat: added pallete explanation
chesterkmr Jun 27, 2024
a3d7e10
feat(demo): adding is demo feature flag
alonp99 Jun 27, 2024
d7692f9
Merge branch 'dev' into illiar/feat/collection-flow-customization
chesterkmr Jul 2, 2024
017b72b
Merge branch 'dev' into illiar/feat/collection-flow-customization
alonp99 Jul 10, 2024
decaf2c
Merge branch 'dev' into illiar/feat/collection-flow-customization
chesterkmr Sep 3, 2024
8819b4a
feat: added stepper customization & updated pallete classes
chesterkmr Sep 5, 2024
778877c
feat: reworked document field design
chesterkmr Sep 5, 2024
f2d24c7
feat: added clear field functionality
chesterkmr Sep 5, 2024
ad36d08
Merge branch 'illiar/feat/document-field-variant' into illiar/feat/co…
chesterkmr Sep 5, 2024
7f95837
feat: implemented dynamic powered by logo & added white poweredby
chesterkmr Sep 5, 2024
9a1e7a2
fix: fixed & clean
chesterkmr Sep 5, 2024
3dbbea4
fix: cleaned console logs
chesterkmr Sep 5, 2024
0b29975
feat: refactor
chesterkmr Sep 5, 2024
7a60682
fix: lock fix
chesterkmr Sep 5, 2024
5355a89
Merge branch 'dev' into illiar/feat/collection-flow-customization
chesterkmr Sep 5, 2024
6fd9808
fix: lock fix
chesterkmr Sep 5, 2024
6055b47
feat: added logo to theme definition
chesterkmr Sep 16, 2024
5448fe5
Merge branch 'dev' into illiar/feat/collection-flow-customization
chesterkmr Sep 19, 2024
0783b84
fix: lock fix
chesterkmr Sep 19, 2024
28d3b25
feat: implemented visibleOn for nested inputs
chesterkmr Sep 28, 2024
312de13
Merge branch 'dev' into illiar/feat/collection-flow-customization
chesterkmr Oct 1, 2024
95cbe75
fix: fixed typos
chesterkmr Oct 1, 2024
078a76f
Merge branch 'dev' into illiar/feat/collection-flow-customization
chesterkmr Oct 1, 2024
0cc12f1
fix: deleted theme
chesterkmr Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

### Patch Changes

- @ballerine/workflow-browser-sdk@0.6.15
- @ballerine/workflow-node-sdk@0.6.15
- Updated dependencies
- @ballerine/common@0.9.9
- @ballerine/workflow-browser-sdk@0.6.15
Expand Down
1 change: 1 addition & 0 deletions apps/kyb-app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

### Patch Changes

- @ballerine/workflow-browser-sdk@0.6.15
- Updated dependencies
- @ballerine/common@0.9.9
- @ballerine/workflow-browser-sdk@0.6.15
Expand Down
42 changes: 0 additions & 42 deletions apps/kyb-app/settings.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Head } from '@/Head';
import { SettingsProvider } from '@/common/providers/SettingsProvider/SettingsProvider';
import { ThemeProvider } from '@/common/providers/ThemeProvider';
import { queryClient } from '@/common/utils/query-client';
import { AnyChildren } from '@ballerine/ui';
import { QueryClientProvider } from '@tanstack/react-query';
import React from 'react';
import settingsJson from '../../../../settings.json';

interface TestProviderProps {
children: AnyChildren;
Expand All @@ -16,9 +14,7 @@ export const TestProvider = ({ children }: TestProviderProps) => {
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<Head />
<SettingsProvider settings={settingsJson}>
<ThemeProvider theme={settingsJson.theme}>{children}</ThemeProvider>
</SettingsProvider>
<ThemeProvider>{children}</ThemeProvider>
</QueryClientProvider>
</React.StrictMode>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/kyb-app/src/common/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const GlobeIcon = () => (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M17.0313 10.5C17.3074 10.5 17.5313 10.2761 17.5313 10C17.5313 9.72386 17.3074 9.5 17.0313 9.5V10.5ZM17 10C17 13.866 13.866 17 10 17V18C14.4183 18 18 14.4183 18 10H17ZM10 17C6.13401 17 3 13.866 3 10H2C2 14.4183 5.58172 18 10 18V17ZM3 10C3 6.13401 6.13401 3 10 3V2C5.58172 2 2 5.58172 2 10H3ZM10 3C13.866 3 17 6.13401 17 10H18C18 5.58172 14.4183 2 10 2V3ZM10 17C9.71239 17 9.39897 16.8689 9.07032 16.5511C8.73926 16.2311 8.41829 15.7438 8.13788 15.1029C7.57773 13.8225 7.21875 12.0188 7.21875 10H6.21875C6.21875 12.1234 6.5943 14.0696 7.22173 15.5037C7.53512 16.22 7.92119 16.8311 8.37526 17.2701C8.83173 17.7114 9.38152 18 10 18V17ZM7.21875 10C7.21875 7.98121 7.57773 6.17746 8.13788 4.89711C8.41829 4.25619 8.73926 3.76892 9.07032 3.44886C9.39897 3.13113 9.71239 3 10 3V2C9.38152 2 8.83173 2.2886 8.37526 2.72991C7.92119 3.16889 7.53512 3.77997 7.22173 4.49629C6.5943 5.93041 6.21875 7.87665 6.21875 10H7.21875ZM10 18C10.6185 18 11.1683 17.7114 11.6247 17.2701C12.0788 16.8311 12.4649 16.22 12.7783 15.5037C13.4057 14.0696 13.7812 12.1234 13.7812 10H12.7812C12.7812 12.0188 12.4223 13.8225 11.8621 15.1029C11.5817 15.7438 11.2607 16.2311 10.9297 16.5511C10.601 16.8689 10.2876 17 10 17V18ZM13.7812 10C13.7812 7.87665 13.4057 5.93041 12.7783 4.49629C12.4649 3.77997 12.0788 3.16889 11.6247 2.72991C11.1683 2.2886 10.6185 2 10 2V3C10.2876 3 10.601 3.13113 10.9297 3.44886C11.2607 3.76892 11.5817 4.25619 11.8621 4.89711C12.4223 6.17746 12.7812 7.98121 12.7812 10H13.7812ZM2.5 10.5L17.0313 10.5V9.5L2.5 9.5L2.5 10.5Z"
fill="black"
fill="currentColor"
/>
</svg>
);

This file was deleted.

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

Empty file.
30 changes: 25 additions & 5 deletions apps/kyb-app/src/common/providers/ThemeProvider/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
import { useLayoutEffect } from 'react';
import { APP_LANGUAGE_QUERY_KEY } from '@/common/consts/consts';
import { useUISchemasQuery } from '@/hooks/useUISchemasQuery';
import { transformThemeToInlineStyles } from '@/utils/transform-theme-to-inline-styles';
import { ITheme } from '@/common/types/settings';
import { useLayoutEffect, useMemo } from 'react';
import defaultTheme from '../../../../theme.json';

interface Props {
theme: ITheme;
children: React.ReactNode | React.ReactNode[];
}

export const ThemeProvider = ({ theme, children }: Props) => {
export const ThemeProvider = ({ children }: Props) => {
const language = new URLSearchParams(window.location.search).get(APP_LANGUAGE_QUERY_KEY) || 'en';
const { data: uiSchema, isLoading, error } = useUISchemasQuery(language);

const theme = useMemo(() => {
if (isLoading) return null;

if (error) {
console.warn('Failed to load theme', error);

return defaultTheme.theme;
}

if (!uiSchema?.uiSchema?.theme) return defaultTheme.theme;

return uiSchema.uiSchema.theme;
}, [uiSchema, isLoading, error]);

useLayoutEffect(() => {
if (!theme) return;

document
.getElementsByTagName('html')[0]
?.setAttribute('style', transformThemeToInlineStyles(theme));
});
}, [theme]);

return <>{children}</>;
};
6 changes: 3 additions & 3 deletions apps/kyb-app/src/components/layouts/AppShell/AppShell.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Logo } from '@/components/layouts/AppShell/Logo';
import { Content } from '@/components/layouts/AppShell/Content';
import { Sidebar } from '@/components/layouts/AppShell/Sidebar';
import { Navigation } from '@/components/layouts/AppShell/Navigation';
import { FormContainer } from '@/components/layouts/AppShell/FormContainer';
import { LanguagePicker } from '@/components/layouts/AppShell/LanguagePicker';
import { Logo } from '@/components/layouts/AppShell/Logo';
import { Navigation } from '@/components/layouts/AppShell/Navigation';
import { Sidebar } from '@/components/layouts/AppShell/Sidebar';

interface Props {
children: React.ReactNode | React.ReactNode[];
Expand Down
2 changes: 1 addition & 1 deletion apps/kyb-app/src/components/layouts/AppShell/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ interface Props {
}

export const Content = ({ children }: Props) => {
return <div className="h-full w-[100%] overflow-auto bg-[#F2F5FF] p-4">{children}</div>;
return <div className="bg-accent h-full w-[100%] overflow-auto p-4">{children}</div>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Props {
export const FormContainer = ({ children, header }: Props) => {
return (
<ScrollArea orientation="both" className="h-full">
<div className="box-content flex flex-col gap-5 pl-40 pt-20">
<div className="text-primary-foreground box-content flex flex-col gap-5 pl-40 pt-20">
{header ? <div>{header}</div> : null}
<div className="flex-flex-col w-full max-w-[385px]">{children}</div>
</div>
Expand Down
17 changes: 12 additions & 5 deletions apps/kyb-app/src/components/layouts/AppShell/LanguagePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useMemo } from 'react';
import i18next from 'i18next';
import { useMemo } from 'react';

import { GlobeIcon } from '@/common/icons';
import { DropdownInput } from '@ballerine/ui';
import { useUISchemasQuery } from '@/hooks/useUISchemasQuery';
import { LoadingSpinner } from '@/common/components/atoms/LoadingSpinner';
import { GlobeIcon } from '@/common/icons';
import { useLanguageParam } from '@/hooks/useLanguageParam/useLanguageParam';
import { useLanguageQuery } from '@/hooks/useLanguageQuery';
import { useUISchemasQuery } from '@/hooks/useUISchemasQuery';
import { DropdownInput } from '@ballerine/ui';

const countryCodeToLanguage = {
en: 'English',
Expand Down Expand Up @@ -41,7 +41,14 @@ export const LanguagePicker = () => {
props={{
item: { variant: 'inverted' },
content: { className: 'w-[204px] p-1', align: 'start' },
trigger: { icon: <GlobeIcon />, className: 'px-3 gap-x-2 bg-black/5' },
trigger: {
icon: (
<span className="!text-primary-foreground">
<GlobeIcon />
</span>
),
className: 'px-3 gap-x-2 text-primary-foreground bg-primary',
},
}}
onChange={selectedLanguage => {
updateLanguage(selectedLanguage);
Expand Down
2 changes: 1 addition & 1 deletion apps/kyb-app/src/components/layouts/AppShell/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {

export const Sidebar = ({ children }: Props) => {
return (
<div className="bg-primary col-span-2 flex h-screen w-[24%] max-w-[418px] flex-col px-14 pb-4 pt-14">
<div className="bg-primary text-primary-foreground col-span-2 flex h-screen w-[24%] max-w-[418px] flex-col px-14 pb-4 pt-14">
{children}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class JsonSchemaRuleEngine implements RuleEngine {
}

private extractErrorsWithFields(validator: Ajv, definition: UIElement<AnyObject>) {
console.log({ errors: validator.errors, definition });
chesterkmr marked this conversation as resolved.
Show resolved Hide resolved
const result = validator.errors?.map(error => {
const erroredParams = Object.values(error.params) as string[];
const uniqueErroredParams = Array.from(new Set(erroredParams));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { FieldTemplateProps } from '@rjsf/utils';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { FieldTemplateProps } from '@rjsf/utils';

import { UIElement } from '@/domains/collection-flow';
import { AnyObject, FieldLayout } from '@ballerine/ui';
import { useRuleExecutor } from '@/components/organisms/DynamicUI/hooks/useRuleExecutor';
import { useDynamicUIContext } from '@/components/organisms/DynamicUI/hooks/useDynamicUIContext';
import { useStateManagerContext } from '@/components/organisms/DynamicUI/StateManager/components/StateProvider';
import { useDynamicUIContext } from '@/components/organisms/DynamicUI/hooks/useDynamicUIContext';
import { useRuleExecutor } from '@/components/organisms/DynamicUI/hooks/useRuleExecutor';
import { findDefinitionByName } from '@/components/organisms/UIRenderer/elements/JSONForm/helpers/findDefinitionByName';
import { useJSONFormDefinition } from '@/components/organisms/UIRenderer/elements/JSONForm/providers/JSONFormDefinitionProvider/useJSONFormDefinition';
import { UIElement } from '@/domains/collection-flow';
import { AnyObject, FieldLayout } from '@ballerine/ui';

export const FieldTemplate = (props: FieldTemplateProps) => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { Stepper } from '@/components/atoms/Stepper';
import {
BreadcrumbItemInput,
Breadcrumbs,
} from '@/components/atoms/Stepper/components/atoms/Breadcrumbs';
import { VerticalLayout } from '@/components/atoms/Stepper/layouts/Vertical';
import { usePageContext } from '@/components/organisms/DynamicUI/Page';
import { usePageResolverContext } from '@/components/organisms/DynamicUI/PageResolver/hooks/usePageResolverContext';
import { useStateManagerContext } from '@/components/organisms/DynamicUI/StateManager/components/StateProvider';
import { useDynamicUIContext } from '@/components/organisms/DynamicUI/hooks/useDynamicUIContext';
import { useEffect, useMemo, useState } from 'react';
import { usePageContext } from '@/components/organisms/DynamicUI/Page';
import { UIPage } from '@/domains/collection-flow';
import { UIElementState } from '@/components/organisms/DynamicUI/hooks/useUIStateLogic/hooks/useUIElementsStateLogic/types';
import { ErrorField } from '@/components/organisms/DynamicUI/rule-engines';
import { UIPage } from '@/domains/collection-flow';
import { CollectionFlowContext } from '@/domains/collection-flow/types/flow-context.types';
import { isPageCompleted } from '@/helpers/prepareInitialUIState';
import { UIElementState } from '@/components/organisms/DynamicUI/hooks/useUIStateLogic/hooks/useUIElementsStateLogic/types';
import {
BreadcrumbItemInput,
Breadcrumbs,
} from '@/components/atoms/Stepper/components/atoms/Breadcrumbs';
import { ScrollArea, ScrollBar, ctw } from '@ballerine/ui';
import { useEffect, useMemo, useState } from 'react';

export const StepperUI = () => {
const { state: uiState } = useDynamicUIContext();
Expand Down Expand Up @@ -92,7 +92,7 @@ export const StepperUI = () => {
return (
<div
data-breadcrumb-id={itemProps.active ? itemProps.id : undefined}
className={ctw('last:bg- flex flex-row items-center gap-4 first:bg-white')}
className={ctw('last:bg- flex flex-row items-center gap-4')}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review the use of ctw utility in className.

The usage of ctw utility here seems incorrect as it appears to be incomplete or malformed. Ensure that the class string is correctly formed and that ctw is used appropriately.

-                      className={ctw('last:bg- flex flex-row items-center gap-4')}
+                      className={ctw('last:bg-blue-500 flex flex-row items-center gap-4')}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className={ctw('last:bg- flex flex-row items-center gap-4')}
className={ctw('last:bg-blue-500 flex flex-row items-center gap-4')}

key={itemProps.id}
>
<Breadcrumbs.Item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ export const SubmitButton: UIElementComponent<{ text: string }> = ({ definition

return (
<Button
variant="secondary"
onClick={handleClick}
disabled={state.isLoading || uiElementState.isLoading}
data-testid={definition.name}
className="text-primary bg-primary-foreground"
>
{definition.options.text || 'Submit'}
</Button>
Expand Down
2 changes: 2 additions & 0 deletions apps/kyb-app/src/domains/collection-flow/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ITheme } from '@/common/types/settings';
import { Action, Rule, UIElement } from '@/domains/collection-flow/types/ui-schema.types';
import { AnyObject } from '@ballerine/ui';
import { RJSFSchema, UiSchema } from '@rjsf/utils';
Expand Down Expand Up @@ -141,6 +142,7 @@ export interface UISchema {
config: UISchemaConfig;
uiSchema: {
elements: UIPage[];
theme?: ITheme;
chesterkmr marked this conversation as resolved.
Show resolved Hide resolved
};
definition: {
definitionType: string;
Expand Down
2 changes: 2 additions & 0 deletions apps/kyb-app/src/hooks/useAppExit/useAppExit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const useAppExit = () => {
const { trackExit } = useFlowTracking();
const { customer } = useCustomerQuery();

console.log(uiSchema);
chesterkmr marked this conversation as resolved.
Show resolved Hide resolved

const kybOnExitAction = uiSchema?.config?.kybOnExitAction || 'send-event';

const exit = useCallback(() => {
Expand Down
10 changes: 3 additions & 7 deletions apps/kyb-app/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '@total-typescript/ts-reset';

import { SettingsProvider } from '@/common/providers/SettingsProvider/SettingsProvider';
import { ThemeProvider } from '@/common/providers/ThemeProvider/ThemeProvider';
import { queryClient } from '@/common/utils/query-client';
import '@ballerine/ui/dist/style.css';
Expand All @@ -9,7 +8,6 @@ import { QueryClientProvider } from '@tanstack/react-query';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { HelmetProvider } from 'react-helmet-async';
import settingsJson from '../settings.json';
import { App } from './App';
import { Head } from './Head';
import './i18next';
Expand Down Expand Up @@ -60,11 +58,9 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
<HelmetProvider>
<QueryClientProvider client={queryClient}>
<Head />
<SettingsProvider settings={settingsJson}>
<ThemeProvider theme={settingsJson.theme}>
<App />
</ThemeProvider>
</SettingsProvider>
<ThemeProvider>
<App />
</ThemeProvider>
</QueryClientProvider>
</HelmetProvider>
</React.StrictMode>,
Expand Down
1 change: 0 additions & 1 deletion apps/kyb-app/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { fontFamily } = require('tailwindcss/defaultTheme');
const appSettings = require('./settings.json');

/** @type {import('tailwindcss').Config} */
module.exports = {
Expand Down
Loading
Loading