diff --git a/packages/@uppy/box/.npmignore b/packages/@uppy/box/.npmignore new file mode 100644 index 0000000000..6c816673f0 --- /dev/null +++ b/packages/@uppy/box/.npmignore @@ -0,0 +1 @@ +tsconfig.* diff --git a/packages/@uppy/box/src/Box.jsx b/packages/@uppy/box/src/Box.tsx similarity index 59% rename from packages/@uppy/box/src/Box.jsx rename to packages/@uppy/box/src/Box.tsx index bf43e1169a..914684106b 100644 --- a/packages/@uppy/box/src/Box.jsx +++ b/packages/@uppy/box/src/Box.tsx @@ -1,22 +1,55 @@ -import { UIPlugin } from '@uppy/core' -import { Provider, getAllowedHosts, tokenStorage } from '@uppy/companion-client' +import { + Provider, + getAllowedHosts, + tokenStorage, + type CompanionPluginOptions, +} from '@uppy/companion-client' +import { UIPlugin, Uppy } from '@uppy/core' import { ProviderViews } from '@uppy/provider-views' -import { h } from 'preact' +import { h, type ComponentChild } from 'preact' -import locale from './locale.js' +import type { UppyFile, Body, Meta } from '@uppy/utils/lib/UppyFile' +import type { UnknownProviderPluginState } from '@uppy/core/lib/Uppy.ts' +import locale from './locale.ts' +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore We don't want TS to generate types for the package.json import packageJson from '../package.json' -export default class Box extends UIPlugin { +export type BoxOptions = CompanionPluginOptions + +export default class Box extends UIPlugin< + BoxOptions, + M, + B, + UnknownProviderPluginState +> { static VERSION = packageJson.version - constructor (uppy, opts) { + icon: () => JSX.Element + + provider: Provider + + view: ProviderViews + + storage: typeof tokenStorage + + files: UppyFile[] + + constructor(uppy: Uppy, opts: BoxOptions) { super(uppy, opts) this.id = this.opts.id || 'Box' this.type = 'acquirer' this.storage = this.opts.storage || tokenStorage this.files = [] this.icon = () => ( -