Skip to content

Commit

Permalink
Shared monorepo tsconfig (#1622)
Browse files Browse the repository at this point in the history
* feat: removed scoping of create or update as the prisma types validates it already

* fixed tests

* ran format

* New monorepo tsconfig (#1640)

* feat(backoffice-v2): checkpoint

* feat(packages/config): added tsconfigs for monorepo use

* refactor(backoffice-v2): now using shared monorepo tsconfig

* refactor(kyb-app): now using shared monorepo tsconfig

* refactor(workflows-dashboard): now using shared tsconfig

* fix(*): added missing vite plugin to make ts paths work

* refactor(blocks): using shared monorepo tsconfig

* refactor(packages/common): now using shared monorepo tsconfig

* refactor(packages/rules-engine): now using shared monorepo tsconfig

* refactor(packages/ui): now using shared tsconfig

* refactor(packages/workflow-core): now using shared tsconfig

* feat(workflows-service): wip - now using shared tsconfig

* refactor(workflows-service): now using shared tsconfig

* refactor(*): moved temporary typescript settings to the shared configs

* refactor(workflow-node-sdk): now using shared tsconfig

* refactor(websites/docs): docs now uses shared tsconfig

* fix(*): fixed minimum amount of typescript errors to make ci pass

* refactor(backoffice-v2): removed temp mock

* fix(*): pnpm-lockfile

* ci(*): re-run ci

* fix(*): pnpm-lockfile

* New monorepo tsconfig (#1642)

* feat(backoffice-v2): checkpoint

* feat(packages/config): added tsconfigs for monorepo use

* refactor(backoffice-v2): now using shared monorepo tsconfig

* refactor(kyb-app): now using shared monorepo tsconfig

* refactor(workflows-dashboard): now using shared tsconfig

* fix(*): added missing vite plugin to make ts paths work

* refactor(blocks): using shared monorepo tsconfig

* refactor(packages/common): now using shared monorepo tsconfig

* refactor(packages/rules-engine): now using shared monorepo tsconfig

* refactor(packages/ui): now using shared tsconfig

* refactor(packages/workflow-core): now using shared tsconfig

* feat(workflows-service): wip - now using shared tsconfig

* refactor(workflows-service): now using shared tsconfig

* refactor(*): moved temporary typescript settings to the shared configs

* refactor(websites/docs): docs now uses shared tsconfig

* fix(*): fixed minimum amount of typescript errors to make ci pass

* refactor(backoffice-v2): removed temp mock

* fix(*): pnpm-lockfile

* fix(*): pnpm-lockfile

* refactor(config): turned config to an npm package

* fix(*): reverted changes that shouldn't be in dev

* fix(*): fixed tests failing due to types

* fix(workflows-dashboard): added ts-ignore to broken react-query types

* fix(workflows-dashboard): remaining react-query types

* New monorepo tsconfig (#1643)

* feat(backoffice-v2): checkpoint

* feat(packages/config): added tsconfigs for monorepo use

* refactor(backoffice-v2): now using shared monorepo tsconfig

* refactor(kyb-app): now using shared monorepo tsconfig

* refactor(workflows-dashboard): now using shared tsconfig

* fix(*): added missing vite plugin to make ts paths work

* refactor(blocks): using shared monorepo tsconfig

* refactor(packages/common): now using shared monorepo tsconfig

* refactor(packages/rules-engine): now using shared monorepo tsconfig

* refactor(packages/ui): now using shared tsconfig

* refactor(packages/workflow-core): now using shared tsconfig

* feat(workflows-service): wip - now using shared tsconfig

* refactor(workflows-service): now using shared tsconfig

* refactor(*): moved temporary typescript settings to the shared configs

* refactor(websites/docs): docs now uses shared tsconfig

* fix(*): fixed minimum amount of typescript errors to make ci pass

* refactor(backoffice-v2): removed temp mock

* fix(*): pnpm-lockfile

* fix(*): pnpm-lockfile

* refactor(config): turned config to an npm package

* fix(*): reverted changes that shouldn't be in dev

* fix(*): fixed tests failing due to types

* fix(workflows-dashboard): added ts-ignore to broken react-query types

* fix(workflows-dashboard): remaining react-query types

* fix(*): fixed issues which caused ci actions to fail

---------

Co-authored-by: Ballerine <117271342+ballerine-dev@users.noreply.github.com>

* feat(backoffice-v2): checkpoint

* feat(packages/config): added tsconfigs for monorepo use

* refactor(backoffice-v2): now using shared monorepo tsconfig

* refactor(kyb-app): now using shared monorepo tsconfig

* refactor(workflows-dashboard): now using shared tsconfig

* fix(*): added missing vite plugin to make ts paths work

* refactor(blocks): using shared monorepo tsconfig

* refactor(packages/common): now using shared monorepo tsconfig

* refactor(packages/rules-engine): now using shared monorepo tsconfig

* refactor(packages/ui): now using shared tsconfig

* refactor(packages/workflow-core): now using shared tsconfig

* feat(workflows-service): wip - now using shared tsconfig

* refactor(workflows-service): now using shared tsconfig

* refactor(*): moved temporary typescript settings to the shared configs

* refactor(websites/docs): docs now uses shared tsconfig

* fix(*): fixed minimum amount of typescript errors to make ci pass

* refactor(backoffice-v2): removed temp mock

* fix(*): pnpm-lockfile

* fix(*): pnpm-lockfile

* refactor(config): turned config to an npm package

* fix(*): fixed issues which caused ci actions to fail

* fix(workflows-dashboard): added ts-ignore to lines failing ci

* fix(*): fixed lockfile

* feat(*): added changeset

* fix(*): pnpm lockfile

* fix(*): tests failed due to types

* fix(*): fixed tests which failed

---------

Co-authored-by: blokh <danielblokhi@gmail.com>
Co-authored-by: Ballerine <117271342+ballerine-dev@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 23, 2023
1 parent 5af7593 commit 8c888ce
Show file tree
Hide file tree
Showing 511 changed files with 11,499 additions and 18,777 deletions.
12 changes: 12 additions & 0 deletions .changeset/popular-geese-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@ballerine/workflow-browser-sdk': patch
'@ballerine/workflow-core': patch
'@ballerine/workflow-node-sdk': patch
'@ballerine/rules-engine-lib': patch
'@ballerine/blocks': patch
'@ballerine/common': patch
'@ballerine/config': patch
'@ballerine/ui': patch
---

Updated tsconfig and types
2 changes: 2 additions & 0 deletions apps/backoffice-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"zod": "^3.22.3"
},
"devDependencies": {
"@ballerine/config": "^1.0.0",
"@cspell/cspell-types": "^6.31.1",
"@faker-js/faker": "^7.6.0",
"@playwright/test": "^1.32.1",
Expand Down Expand Up @@ -145,6 +146,7 @@
"typescript": "^4.9.3",
"vite": "^4.3.9",
"vite-plugin-mkcert": "^1.16.0",
"vite-tsconfig-paths": "^4.0.7",
"vitest": "^0.29.8"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as SelectPrimitive from '@radix-ui/react-select';

export const Select = SelectPrimitive.Root;
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import * as SeparatorPrimitive from '@radix-ui/react-separator';
import { ctw } from '../../../utils/ctw/ctw';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const Item: FunctionComponent<IItemProps> = ({
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3 }}
className={ctw(`indicator-center indicator-item indicator-middle`, {
className={ctw(`indicator-item indicator-center indicator-middle`, {
hidden: !isRejected && !isApproved,
'text-success': isApproved,
'text-error': isRejected,
Expand Down
21 changes: 3 additions & 18 deletions apps/backoffice-v2/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
{
"extends": "@ballerine/config/tsconfig.react.json",
"compilerOptions": {
"outDir": "./dist",
"baseUrl": ".",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"paths": {
"app/*": ["src/app/*"],
"components/*": ["src/components/*"],
"hooks/*": ["src/hooks/*"]
"@/*": ["src/*"]
},
"types": ["vite-plugin-terminal/client"]
},
Expand Down
10 changes: 2 additions & 8 deletions apps/backoffice-v2/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import react from '@vitejs/plugin-react-swc';
import { resolve } from 'path';
import { defineConfig } from 'vitest/config';
import terminal from 'vite-plugin-terminal';
import tsconfigPaths from 'vite-tsconfig-paths';

export default defineConfig(configEnv => {
const isDevelopment = configEnv.mode === 'development';
Expand All @@ -23,15 +23,9 @@ export default defineConfig(configEnv => {
strip: false,
}),
react(),
tsconfigPaths(),
// mkcert(),
],
resolve: {
alias: {
app: resolve(__dirname, 'src', 'app'),
components: resolve(__dirname, 'src', 'components'),
hooks: resolve(__dirname, 'src', 'hooks'),
},
},
css: {
modules: {
generateScopedName: isDevelopment ? '[name]__[local]__[hash:base64:5]' : '[hash:base64:5]',
Expand Down
14 changes: 7 additions & 7 deletions apps/kyb-app/DynamicElements/DynamicElements.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ActionHandler } from '@app/components/organisms/DynamicUI/StateManager/components/ActionsHandler/action-handlers/action-handler.abstract';
import { DynamicUIRendererContext } from '@app/components/organisms/DynamicElements/context';
import { useActionsHandler } from '@app/components/organisms/DynamicUI/StateManager/components/ActionsHandler/hooks/useActionsHandler';
import { useContext } from '@app/components/organisms/DynamicElements/hooks/useContext';
import { ActionHandler } from '@/components/organisms/DynamicUI/StateManager/components/ActionsHandler/action-handlers/action-handler.abstract';
import { DynamicUIRendererContext } from '@/components/organisms/DynamicElements/context';
import { useActionsHandler } from '@/components/organisms/DynamicUI/StateManager/components/ActionsHandler/hooks/useActionsHandler';
import { useContext } from '@/components/organisms/DynamicElements/hooks/useContext';
import { AnyObject } from '@ballerine/ui';
import { useMemo } from 'react';
import { dynamicUIRendererContext } from './context';
import { UIElementComponent } from '@app/components/organisms/DynamicElements/types';
import { UIElementsList } from '@app/components/organisms/DynamicElements/components/UIElementsList';
import { Action, UIElement } from '@app/domains/collection-flow';
import { UIElementComponent } from '@/components/organisms/DynamicElements/types';
import { UIElementsList } from '@/components/organisms/DynamicElements/components/UIElementsList';
import { Action, UIElement } from '@/domains/collection-flow';

const { Provider } = dynamicUIRendererContext;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDynamicUIContext } from '@app/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { UIElementComponent } from '@app/components/organisms/DynamicElements/types';
import { UIElement } from '@app/domains/collection-flow';
import { useDynamicUIContext } from '@/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { UIElementComponent } from '@/components/organisms/DynamicElements/types';
import { UIElement } from '@/domains/collection-flow';

interface Props {
elements: Record<string, UIElementComponent>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamicUIRendererContext } from '@app/components/organisms/DynamicElements/context/types';
import { DynamicUIRendererContext } from '@/components/organisms/DynamicElements/context/types';
import { createContext } from 'react';

export const dynamicUIRendererContext = createContext({} as DynamicUIRendererContext<any>);
2 changes: 1 addition & 1 deletion apps/kyb-app/DynamicElements/context/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, UIElement } from '@app/domains/collection-flow';
import { Action, UIElement } from '@/domains/collection-flow';
import { AnyObject } from '@ballerine/ui';

export interface DynamicUIRendererContext<TContext> {
Expand Down
4 changes: 2 additions & 2 deletions apps/kyb-app/DynamicElements/engines.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsonLogicRuleEngine } from '@app/components/organisms/DynamicElements/engines/json-logic.rule-engine';
import { RuleEngine } from '@app/components/organisms/DynamicElements/engines/rule-engine.abstract';
import { JsonLogicRuleEngine } from '@/components/organisms/DynamicElements/engines/json-logic.rule-engine';
import { RuleEngine } from '@/components/organisms/DynamicElements/engines/rule-engine.abstract';

export const ruleEngines: RuleEngine[] = [new JsonLogicRuleEngine()];
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UIElement } from '@app/domains/collection-flow';
import { UIElement } from '@/domains/collection-flow';
import { AnyObject } from '@ballerine/ui';
import { useCallback, useEffect, useRef, useState } from 'react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
DynamicUIRendererContext,
dynamicUIRendererContext,
} from '@app/components/organisms/DynamicElements/context';
} from '@/components/organisms/DynamicElements/context';
import { useContext } from 'react';

export const useDynamicUIContext = <TContext>() =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isEventRule } from '@app/components/organisms/DynamicElements/helpers/is-event-rule';
import { useDynamicUIContext } from '@app/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { Action, UIElement } from '@app/domains/collection-flow';
import { isEventRule } from '@/components/organisms/DynamicElements/helpers/is-event-rule';
import { useDynamicUIContext } from '@/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { Action, UIElement } from '@/domains/collection-flow';
import { AnyObject } from '@ballerine/ui';
import { useMemo } from 'react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ruleEngines } from '@app/components/organisms/DynamicElements/engines';
import { EngineManager } from '@app/components/organisms/DynamicElements/helpers/engine-manager';
import { ruleEngines } from '@/components/organisms/DynamicElements/engines';
import { EngineManager } from '@/components/organisms/DynamicElements/helpers/engine-manager';
import { AnyObject } from '@ballerine/ui';
import { useMemo } from 'react';
import get from 'lodash/get';
import { useDynamicUIContext } from '@app/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { UIElement } from '@app/domains/collection-flow';
import { useDynamicUIContext } from '@/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { UIElement } from '@/domains/collection-flow';

export const useProperties = <TContext>(definition: UIElement<AnyObject>, context: TContext) => {
const { errors } = useDynamicUIContext();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useHandlers } from '@app/components/organisms/DynamicElements/hooks/useUIElement/hooks/useHandlers';
import { useProperties } from '@app/components/organisms/DynamicElements/hooks/useUIElement/hooks/useProperties';
import { Action, UIElement } from '@app/domains/collection-flow';
import { useHandlers } from '@/components/organisms/DynamicElements/hooks/useUIElement/hooks/useHandlers';
import { useProperties } from '@/components/organisms/DynamicElements/hooks/useUIElement/hooks/useProperties';
import { Action, UIElement } from '@/domains/collection-flow';

export const useUIElement = <TInputParams, TContext>(
definition: UIElement<TInputParams>,
Expand Down
2 changes: 1 addition & 1 deletion apps/kyb-app/DynamicElements/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, UIElement } from '@app/domains/collection-flow';
import { Action, UIElement } from '@/domains/collection-flow';
import { AnyObject } from '@ballerine/ui';

export type UIElementType = 'text' | 'button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDynamicUIContext } from '@app/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { useUIElement } from '@app/components/organisms/DynamicElements/hooks/useUIElement';
import { UIElementComponent } from '@app/components/organisms/DynamicElements/types';
import { useDynamicUIContext } from '@/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { useUIElement } from '@/components/organisms/DynamicElements/hooks/useUIElement';
import { UIElementComponent } from '@/components/organisms/DynamicElements/types';
import { AnyObject, Input, Label } from '@ballerine/ui';

export interface NumberInputParams {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDynamicUIContext } from '@app/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { useUIElement } from '@app/components/organisms/DynamicElements/hooks/useUIElement';
import { UIElementComponent } from '@app/components/organisms/DynamicElements/types';
import { useDynamicUIContext } from '@/components/organisms/DynamicElements/hooks/useDynamicUIContext';
import { useUIElement } from '@/components/organisms/DynamicElements/hooks/useUIElement';
import { UIElementComponent } from '@/components/organisms/DynamicElements/types';
import { AnyObject, Input, Label } from '@ballerine/ui';
import get from 'lodash/get';

Expand Down
3 changes: 3 additions & 0 deletions apps/kyb-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@ballerine/blocks": "0.1.20",
"@ballerine/common": "^0.7.22",
"@ballerine/ui": "0.3.14",
"@ballerine/workflow-browser-sdk": "0.5.21",
"@lukemorales/query-key-factory": "^1.0.3",
Expand Down Expand Up @@ -51,6 +52,7 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@ballerine/config": "^1.0.0",
"@sentry/vite-plugin": "^2.9.0",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^13.3.0",
Expand All @@ -77,6 +79,7 @@
"typescript": "^5.0.2",
"vite": "^4.4.0",
"vite-plugin-checker": "^0.6.1",
"vite-tsconfig-paths": "^4.0.7",
"vitest": "^0.34.6"
}
}
16 changes: 8 additions & 8 deletions apps/kyb-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import '@ballerine/ui/dist/style.css';
import { AppLoadingContainer } from '@app/components/organisms/AppLoadingContainer';
import { useCustomerQuery } from '@app/hooks/useCustomerQuery';
import { useUISchemasQuery } from '@app/hooks/useUISchemasQuery';
import { useFlowContextQuery } from '@app/hooks/useFlowContextQuery';
import { CustomerProvider } from '@app/components/providers/CustomerProvider';
import { LoadingScreen } from '@app/common/components/molecules/LoadingScreen';
import { CustomerProviderFallback } from '@app/components/molecules/CustomerProviderFallback';
import { AppLoadingContainer } from '@/components/organisms/AppLoadingContainer';
import { useCustomerQuery } from '@/hooks/useCustomerQuery';
import { useUISchemasQuery } from '@/hooks/useUISchemasQuery';
import { useFlowContextQuery } from '@/hooks/useFlowContextQuery';
import { CustomerProvider } from '@/components/providers/CustomerProvider';
import { LoadingScreen } from '@/common/components/molecules/LoadingScreen';
import { CustomerProviderFallback } from '@/components/molecules/CustomerProviderFallback';
import { RouterProvider } from 'react-router-dom';
import { router } from '@app/router';
import { router } from '@/router';
import * as Sentry from '@sentry/react';

export const App = () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/kyb-app/src/Head.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Helmet } from 'react-helmet';
import { useCustomerQuery } from '@app/hooks/useCustomerQuery';
import { useCustomerQuery } from '@/hooks/useCustomerQuery';

export const Head = () => {
const { customer } = useCustomerQuery();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Head } from '@app/Head';
import { SettingsProvider } from '@app/common/providers/SettingsProvider/SettingsProvider';
import { ThemeProvider } from '@app/common/providers/ThemeProvider';
import { queryClient } from '@app/common/utils/query-client';
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';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SelectInputOption } from '@app/common/components/atoms/SelectInput/types';
import { SelectInputOption } from '@/common/components/atoms/SelectInput/types';
import {
Button,
Command,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LoadingSpinner } from '@app/common/components/atoms/LoadingSpinner';
import { LoadingSpinner } from '@/common/components/atoms/LoadingSpinner';

export const LoadingScreen = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import styles from './ProgressBar.module.css';
import { Chip } from '@app/common/components/atoms/Chip';
import { LoadingSpinner } from '@app/common/components/atoms/LoadingSpinner';
import { Chip } from '@/common/components/atoms/Chip';
import { LoadingSpinner } from '@/common/components/atoms/LoadingSpinner';
import { Check } from 'lucide-react';
import clsx from 'clsx';
import { useDynamicUIContext } from '@app/components/organisms/DynamicUI/hooks/useDynamicUIContext';
import { useDynamicUIContext } from '@/components/organisms/DynamicUI/hooks/useDynamicUIContext';

interface Props {
className?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
PrevStepActionPayload,
UpdateStepDataAction,
WarningStepActionPayload,
} from '@app/common/hooks/useStepper/hooks/useStepsManager/types';
import { IStep } from '@app/common/hooks/useStepper/types';
} from '@/common/hooks/useStepper/hooks/useStepsManager/types';
import { IStep } from '@/common/hooks/useStepper/types';

export const completeCurrentStepAction = (): CompleteCurrentStepActionPayload => ({
type: 'COMPLETE-CURRENT',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
StepsManagerActions,
StepsRepositoryState,
} from '@app/common/hooks/useStepper/hooks/useStepsManager/types';
} from '@/common/hooks/useStepper/hooks/useStepsManager/types';

const initialState: StepsRepositoryState = {
activeStep: 0,
Expand All @@ -16,7 +16,7 @@ export function stepsRepisotoryReducer(
if (action.type === 'NEXT') {
const nextStepIndex = state.activeStep + 1;
const stepToNavigate = state.steps[nextStepIndex];
const isInRange = Boolean(stepToNavigate) && !stepToNavigate.hidden;
const isInRange = Boolean(stepToNavigate) && !stepToNavigate?.hidden;

return {
...state,
Expand All @@ -27,7 +27,7 @@ export function stepsRepisotoryReducer(
if (action.type === 'PREV') {
const prevStepIndex = state.activeStep - 1;
const stepToNavigate = state.steps[prevStepIndex];
const isInRange = Boolean(stepToNavigate) && !stepToNavigate.hidden;
const isInRange = Boolean(stepToNavigate) && !stepToNavigate?.hidden;

return {
...state,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IStep, StepIndex, StepMetadata } from '@app/common/hooks/useStepper/types';
import { IStep, StepIndex, StepMetadata } from '@/common/hooks/useStepper/types';

export interface StepsRepositoryState {
activeStep: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
nextStepAction,
updateStepDataAction,
overrideStepsAction,
} from '@app/common/hooks/useStepper/hooks/useStepsManager/actions';
import { stepsRepisotoryReducer } from '@app/common/hooks/useStepper/hooks/useStepsManager/reducer';
import { StepsRepositoryState } from '@app/common/hooks/useStepper/hooks/useStepsManager/types';
} from '@/common/hooks/useStepper/hooks/useStepsManager/actions';
import { stepsRepisotoryReducer } from '@/common/hooks/useStepper/hooks/useStepsManager/reducer';
import { StepsRepositoryState } from '@/common/hooks/useStepper/hooks/useStepsManager/types';
import { useReducer } from 'react';

export const useStepsRepository = (initialState: StepsRepositoryState) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/kyb-app/src/common/hooks/useStepper/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StepStatus } from '@app/components/atoms/Stepper/types';
import { StepStatus } from '@/components/atoms/Stepper/types';

export type StepIndex = number;

Expand Down Expand Up @@ -34,7 +34,7 @@ export interface StepperParams {

export interface UseStepperHookCallResult {
steps: IStep[];
currentStep: IStep;
currentStep: IStep | undefined;
prevStep: () => IStep | null;
nextStep: () => IStep | null;
warning: (index: number, reason?: string) => void;
Expand Down
Loading

0 comments on commit 8c888ce

Please sign in to comment.