diff --git a/app/tsconfig.json b/app/tsconfig.json deleted file mode 100644 index 834e525f..00000000 --- a/app/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "useDefineForClassFields": true, - "skipLibCheck": true, - "module": "ESNext", - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx", - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true - } -} diff --git a/bridges/nodejs/src/sdk/types.ts b/bridges/nodejs/src/sdk/types.ts index 88d80cd2..7d0d0f32 100644 --- a/bridges/nodejs/src/sdk/types.ts +++ b/bridges/nodejs/src/sdk/types.ts @@ -22,7 +22,7 @@ export type ActionFunction = (params: ActionParams) => Promise */ export interface Answer { key?: string - widget?: Widget + widget?: Widget data?: AnswerData core?: SkillAnswerCoreData } @@ -30,7 +30,7 @@ export interface TextAnswer extends Answer { key: string } export interface WidgetAnswer extends Answer { - widget: Widget + widget: Widget key?: string } export type AnswerData = Record | null diff --git a/bridges/nodejs/src/sdk/widget-component.ts b/bridges/nodejs/src/sdk/widget-component.ts index 59d5c0e2..84b93dba 100644 --- a/bridges/nodejs/src/sdk/widget-component.ts +++ b/bridges/nodejs/src/sdk/widget-component.ts @@ -1,4 +1,4 @@ -export abstract class WidgetComponent { +export abstract class WidgetComponent { public readonly component: string public readonly props: T diff --git a/bridges/nodejs/src/sdk/widget.ts b/bridges/nodejs/src/sdk/widget.ts index 82f95142..92a6afac 100644 --- a/bridges/nodejs/src/sdk/widget.ts +++ b/bridges/nodejs/src/sdk/widget.ts @@ -2,25 +2,20 @@ import { type WidgetWrapperProps } from '@leon-ai/aurora' import { WidgetComponent } from '@sdk/widget-component' -export interface WidgetOptions { +export interface WidgetOptions { wrapperProps?: Omit - params?: T + params: T } -export abstract class Widget { +export abstract class Widget { public wrapperProps: WidgetOptions['wrapperProps'] public params: WidgetOptions['params'] - protected constructor(options?: WidgetOptions) { + protected constructor(options: WidgetOptions) { if (options?.wrapperProps) { this.wrapperProps = options.wrapperProps } - - if (!options?.params) { - this.params = undefined - } else { - this.params = options.params - } + this.params = options.params } public abstract render(): WidgetComponent diff --git a/skills/unknown/widget-playground/src/actions/run.ts b/skills/unknown/widget-playground/src/actions/run.ts index 370501bd..2c6183da 100644 --- a/skills/unknown/widget-playground/src/actions/run.ts +++ b/skills/unknown/widget-playground/src/actions/run.ts @@ -1,7 +1,7 @@ import type { ActionFunction } from '@sdk/types' import { leon } from '@sdk/leon' -import PlaygroundTestWidget from '../widgets/playground-test' +import { PlaygroundTestWidget } from '../widgets/playground-test' export const run: ActionFunction = async function () { /** diff --git a/skills/unknown/widget-playground/src/widgets/playground-test.ts b/skills/unknown/widget-playground/src/widgets/playground-test.ts index 6ca1a96c..0c4613bc 100644 --- a/skills/unknown/widget-playground/src/widgets/playground-test.ts +++ b/skills/unknown/widget-playground/src/widgets/playground-test.ts @@ -7,20 +7,13 @@ interface Params { value2: string } -export default class PlaygroundTestWidget extends Widget { - constructor(options?: WidgetOptions) { +export class PlaygroundTestWidget extends Widget { + constructor(options: WidgetOptions) { super(options) } - public render(): WidgetComponent { - let children = 'Click me' - - if (this.params) { - children = this.params.value1 + ' ' + this.params.value2 - } - - return new Button({ - children - }) + public render(): WidgetComponent { + const children = this.params.value1 + ' ' + this.params.value2 + return new Button({ children }) } }