AdminUiExtension

AdminUiExtension

AdminUiExtension

Package: @vendure/ui-devkit File: types.ts

Defines extensions to the Admin UI application by specifying additional Angular NgModules which are compiled into the application.

See Extending the Admin UI for detailed instructions.

Signature

interface AdminUiExtension extends Partial<TranslationExtension> {
  id?: string;
  extensionPath: string;
  ngModules: Array<AdminUiExtensionSharedModule | AdminUiExtensionLazyModule>;
  staticAssets?: StaticAssetDefinition[];
}

Extends

Members

id

property
type:
string
An optional ID for the extension module. Only used internally for generating import paths to your module. If not specified, a unique hash will be used as the id.

extensionPath

property
type:
string
The path to the directory containing the extension module(s). The entire contents of this directory will be copied into the Admin UI app, including all TypeScript source files, html templates, scss style sheets etc.

ngModules

One or more Angular modules which extend the default Admin UI.

staticAssets

property
Optional array of paths to static assets which will be copied over to the Admin UI app’s /static directory.

TranslationExtension

Package: @vendure/ui-devkit File: types.ts

Defines extensions to the Admin UI translations. Can be used as a stand-alone extension definition which only adds translations without adding new UI functionality, or as part of a full AdminUiExtension.

Signature

interface TranslationExtension {
  translations: { [languageCode in LanguageCode]?: string };
}

Members

translations

property
type:
{ [languageCode in LanguageCode]?: string }

Optional object defining any translation files for the Admin UI. The value should be an object with the key as a 2-character ISO 639-1 language code, and the value being a glob for any relevant translation files in JSON format.

Example

translations: {
  en: path.join(__dirname, 'translations/*.en.json'),
  de: path.join(__dirname, 'translations/*.de.json'),
}

StaticAssetDefinition

Package: @vendure/ui-devkit File: types.ts

A static asset can be provided as a path to the asset, or as an object containing a path and a new name, which will cause the compiler to copy and then rename the asset.

Signature

type StaticAssetDefinition = string | { path: string; rename: string }

AdminUiExtensionSharedModule

Package: @vendure/ui-devkit File: types.ts

Configuration defining a single NgModule with which to extend the Admin UI.

Signature

interface AdminUiExtensionSharedModule {
  type: 'shared';
  ngModuleFileName: string;
  ngModuleName: string;
}

Members

type

property
type:
'shared'
Shared modules are directly imported into the main AppModule of the Admin UI and should be used to declare custom form components and define custom navigation items.

ngModuleFileName

property
type:
string
The name of the file containing the extension module class.

ngModuleName

property
type:
string
The name of the extension module class.

AdminUiExtensionLazyModule

Package: @vendure/ui-devkit File: types.ts

Configuration defining a single NgModule with which to extend the Admin UI.

Signature

interface AdminUiExtensionLazyModule {
  type: 'lazy';
  route: string;
  ngModuleFileName: string;
  ngModuleName: string;
}

Members

type

property
type:
'lazy'
Lazy modules are lazy-loaded at the /extensions/ route and should be used for modules which define new views for the Admin UI.

route

property
type:
string
The route specifies the route at which the module will be lazy-loaded. E.g. a value of 'foo' will cause the module to lazy-load when the /extensions/foo route is activated.

ngModuleFileName

property
type:
string
The name of the file containing the extension module class.

ngModuleName

property
type:
string
The name of the extension module class.