diff --git a/src/controller.test.ts b/src/controller.test.ts index fca5582..15a7fc8 100644 --- a/src/controller.test.ts +++ b/src/controller.test.ts @@ -10,7 +10,6 @@ const getOptions = ( presets: { createProject: { name: 'Creating project', - description: '', steps: [ { slug: 'openBoard', @@ -31,7 +30,6 @@ const getOptions = ( }, createQueue: { name: 'Creating queue', - description: '', steps: [], }, }, diff --git a/src/hooks.tsx b/src/hooks.tsx index b5a61aa..3e11012 100644 --- a/src/hooks.tsx +++ b/src/hooks.tsx @@ -39,9 +39,14 @@ export function getHooks { + await controller.resetPresetProgress([preset]); + }; + return { addPreset, finishPreset, + resetPresetProgress, }; }; diff --git a/src/index.ts b/src/index.ts index a23afa5..d753c63 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,11 +51,16 @@ export function createOnboarding>(options: const {useOnboarding, useOnboardingPreset, useOnboardingStep, useOnboardingHint} = getHooks(controller); + const presetsNames = Object.keys( + controller.options.config.presets, + ) as unknown as keyof typeof controller.options.config.presets; + return { useOnboardingStep, useOnboardingPreset, useOnboardingHint, useOnboarding, controller, + presetsNames, }; } diff --git a/src/types.ts b/src/types.ts index 3f364ba..8200519 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,4 @@ +import type {ReactNode} from 'react'; import type {LoggerOptions} from './logger'; type HintPlacement = @@ -30,7 +31,7 @@ export type PresetStep = { export type Preset = { name: string; - description: string; + description?: ReactNode[]; type?: 'default' | 'hidden'; steps: PresetStep[]; hidden?: boolean;