import { Configuration as FluxConfiguration } from '@storefront/flux-capacitor'; import { ServiceConfiguration } from '../services'; import StoreFront from '../storefront'; import { CustomMixins, GlobalMixin, Structure } from './types'; interface Configuration extends FluxConfiguration { /** * A mapping of variable names to record fields. * * The property names are variable names that can be used in the markup to * display product/article data. * * The values correspond to record fields available in `allMeta`. * * Additional fields can be defined as neeeded. */ structure?: Structure; /** * Default props for configurable Tags. * * The properties are keyed by tag names (without the `gb-` prefix, if any), * and its values are the props to configure for that tag. */ tags?: { [key: string]: any; }; /** * Configuration for services. */ services?: ServiceConfiguration; /** * An optional initial bootstrap function. * This function is run before serivces are initialized. * * @param app The StoreFront app instance. */ bootstrap?: (app: StoreFront) => void; /** * Miscellaneous options. */ options?: { /** * If `true`, apply the base StoreFront structural styling. */ ui?: boolean; /** * If `true`, apply the default basic styling. */ stylish?: boolean; /** * If `true`, use the legacy aliasing pattern instead of provide/consume. * You are encouraged to use the provide/consume pattern for new implementations. */ legacyAliasing?: boolean; /** * If `true`, perform a search on any initial page load. * Search pages will perform a search regardless of the value of this option. */ initialSearch?: boolean; /** * If `true`, apply the standard StoreFront Tag mixin. */ globalMixin?: boolean; /** * The Riot instance to use instead of creating a new one. */ riot?: any; }; /** * Configuration for mixins, which are sets of reusable functions * and properties that can be shared across tags. */ mixins?: { /** * The mixin to apply to all tags. This mixin is automatically applied * after all of the standard StoreFront mixins are applied, so it can be * used to override StoreFront functionality. * * The lifecycle function `init()` cannot be overriden by this global mixin. */ global?: GlobalMixin; /** * Named mixins that are available on-demand to tags. * * To apply one of these mixins, add this to your tag's constructor: * * ```js * this.mixin('name_of_mixin'); * ``` */ custom?: CustomMixins; }; } declare namespace Configuration { namespace Transformer { /** * transform and validate raw configuration */ function transform(rawConfig: Configuration): Configuration; /** * transform to handle graceful deprecation of configuration options */ function deprecationTransform(config: Configuration): Configuration; /** * apply default configuration options */ function applyDefaults(config: Configuration): Configuration; /** * check final configuration for validity */ function validate(config: Configuration): void; } } export default Configuration;