function initialize(options) {
  let {
    rootUrl,
    rootElement,
    endpoint,
    retainContainerContent = false,
    wrapRoutes = identity,
    wrapStoreModules = identity,
    wrapWdkDependencies = identity,
    wrapWdkService = identity,
    onLocationChange,
    pluginConfig = [],
    additionalMiddleware
  } = options;

  if (!isString(rootUrl)) throw new Error(`Expected rootUrl to be a string, but got ${typeof rootUrl}.`);
  if (!isString(endpoint)) throw new Error(`Expected endpoint to be a string, but got ${typeof endpoint}.`);

  // define the elements of the Flux architecture

  let history = location.pathname.startsWith(rootUrl) && !retainContainerContent
    ? createBrowserHistory({ basename: rootUrl })
    : createMockHistory({ basename: rootUrl });
  let wdkService = wrapWdkService(getInstance(endpoint));
  let paramValueStore = getParamValueStoreInstance(endpoint, wdkService);
  let transitioner = getTransitioner(history);

  let wdkDependencies = wrapWdkDependencies({
    paramValueStore,
    transitioner,
    wdkService
  });

  let store = createWdkStore(
    wrapStoreModules(storeModules),
    wdkDependencies,
    additionalMiddleware
  );

  // load static WDK data into service cache and view stores that need it
  loadAllStaticData(wdkService, store.dispatch);

  // render the root element once page has completely loaded
  document.addEventListener('DOMContentLoaded', function() {
    let container = rootElement instanceof HTMLElement ? rootElement
      : rootElement ? document.querySelector(rootElement)
      : undefined;
    let handleLocationChange = location => {
      if (onLocationChange) onLocationChange(location);
      store.dispatch(updateLocation(location));
    };
    if (container != null) {
      let applicationElement = createElement(
        Root, {
          rootUrl,
          store,
          history,
          pluginConfig: pluginConfig.concat(defaultPluginConfig),
          routes: wrapRoutes(wdkRoutes),
          onLocationChange: handleLocationChange,
          wdkDependencies,
          staticContent: retainContainerContent ? container.innerHTML : undefined
        });
      ReactDOM.render(applicationElement, container);
    }
    else if (__DEV__) {
      console.debug('Could not resolve rootElement %o. Application will not render automatically.', rootElement);
    }
  });

  // return WDK application components
  return { wdkService, paramValueStore, store, history, pluginConfig };
}
/**
 * Initialize the application.
 *
 * @param {object} options
 * @param {string} options.rootUrl Root URL used by the router. If the current
 *   page's url does not begin with this option's value, the application will
 *   not render automatically.
 * @param {string|HTMLElement} options.rootElement Where to mount the
 *   application. Can be a selector string or an element. If this option does
 *   not resolve to an element after the DOMContentLoaded event is fired, the
 *   application will not render automatically.
 * @param {string} [options.retainContainerContent] If true, the content in the container
 *   will be retained when rendering the application. Optional, defaults to false.
 * @param {string} options.endpoint Base URL for WdkService.
 * @param {Function} [options.wrapRoutes] A function that takes a WDK Routes array
 *   and returns a modified copy.
 * @param {Function} [options.wrapStoreModules] A function that takes WDK StoreModules
 *   and returns a modified copy.
 * @param {Function} [options.wrapWdkDependencies] A function that takes WdkDependencies
 *   and returns a modified copy.
  * @param {Function} [options.wrapWdkService] A function that takes a WdkService
 *   class and returns a sub class.
 * @param {Function} [options.onLocationChange] Callback function called whenever
 *   the location of the page changes. The function is called with a Location
 *   object.
 * @param {ClientPluginRegistryEntry<unknown>[]} [options.pluginConfig]
 * @param {ReduxMiddleware[]} [options.additionalMiddleware]
 */
Initialize the application.
@param {object} options
@param {string} options.rootUrl Root URL used by the router. If the current
page's url does not begin with this option's value, the application will
not render automatically.
@param {string|HTMLElement} options.rootElement Where to mount the
application. Can be a selector string or an element. If this option does
not resolve to an element after the DOMContentLoaded event is fired, the
application will not render automatically.
@param {string} [options.retainContainerContent] If true, the content in the container
will be retained when rendering the application. Optional, defaults to false.
@param {string} options.endpoint Base URL for WdkService.
@param {Function} [options.wrapRoutes] A function that takes a WDK Routes array
and returns a modified copy.
@param {Function} [options.wrapStoreModules] A function that takes WDK StoreModules
and returns a modified copy.
@param {Function} [options.wrapWdkDependencies] A function that takes WdkDependencies
and returns a modified copy.
@param {Function} [options.wrapWdkService] A function that takes a WdkService
class and returns a sub class.
@param {Function} [options.onLocationChange] Callback function called whenever
the location of the page changes. The function is called with a Location
object.
Initialize the application . @param { object } options @param { string } options . rootUrl Root URL used by the router . If the current page ' s url does not begin with this option ' s value the application will not render automatically . @param { string|HTMLElement } options . rootElement Where to mount the application . Can be a selector string or an element . If this option does not resolve to an element after the DOMContentLoaded event is fired the application will not render automatically . @param { string } [ options . retainContainerContent ] If true the content in the container will be retained when rendering the application . Optional defaults to false . @param { string } options . endpoint Base URL for WdkService . @param { Function } [ options . wrapRoutes ] A function that takes a WDK Routes array and returns a modified copy . @param { Function } [ options . wrapStoreModules ] A function that takes WDK StoreModules and returns a modified copy . @param { Function } [ options . wrapWdkDependencies ] A function that takes WdkDependencies and returns a modified copy . @param { Function } [ options . wrapWdkService ] A function that takes a WdkService class and returns a sub class . @param { Function } [ options . onLocationChange ] Callback function called whenever the location of the page changes . The function is called with a Location object .
function initialize(options) {
  let {
    rootUrl,
    rootElement,
    endpoint,
    retainContainerContent = false,
    wrapRoutes = identity,
    wrapStoreModules = identity,
    wrapWdkDependencies = identity,
    wrapWdkService = identity,
    onLocationChange,
    pluginConfig = [],
    additionalMiddleware
  } = options;
  if (!isString(rootUrl)) throw new Error(`Expected rootUrl to be a string, but got ${typeof rootUrl}.`);
  if (!isString(endpoint)) throw new Error(`Expected endpoint to be a string, but got ${typeof endpoint}.`);
  let history = location.pathname.startsWith(rootUrl) && !retainContainerContent
    ? createBrowserHistory({ basename: rootUrl })
    : createMockHistory({ basename: rootUrl });
  let wdkService = wrapWdkService(getInstance(endpoint));
  let paramValueStore = getParamValueStoreInstance(endpoint, wdkService);
  let transitioner = getTransitioner(history);
  let wdkDependencies = wrapWdkDependencies({
    paramValueStore,
    transitioner,
    wdkService
  });
  let store = createWdkStore(
    wrapStoreModules(storeModules),
    wdkDependencies,
    additionalMiddleware
  );
  loadAllStaticData(wdkService, store.dispatch);
  document.addEventListener('DOMContentLoaded', function() {
    let container = rootElement instanceof HTMLElement ? rootElement
      : rootElement ? document.querySelector(rootElement)
      : undefined;
    let handleLocationChange = location => {
      if (onLocationChange) onLocationChange(location);
      store.dispatch(updateLocation(location));
    };
    if (container != null) {
      let applicationElement = createElement(
        Root, {
          rootUrl,
          store,
          history,
          pluginConfig: pluginConfig.concat(defaultPluginConfig),
          routes: wrapRoutes(wdkRoutes),
          onLocationChange: handleLocationChange,
          wdkDependencies,
          staticContent: retainContainerContent ? container.innerHTML : undefined
        });
      ReactDOM.render(applicationElement, container);
    }
    else if (__DEV__) {
      console.debug('Could not resolve rootElement %o. Application will not render automatically.', rootElement);
    }
  });
  return { wdkService, paramValueStore, store, history, pluginConfig };
}
function initialize ( options ) { let { rootUrl , rootElement , endpoint , retainContainerContent = false , wrapRoutes = identity , wrapStoreModules = identity , wrapWdkDependencies = identity , wrapWdkService = identity , onLocationChange , pluginConfig = [ ] , additionalMiddleware } = options ; if ( ! isString ( rootUrl ) ) throw new Error ( ` ${ typeof rootUrl } ` ) ; if ( ! isString ( endpoint ) ) throw new Error ( ` ${ typeof endpoint } ` ) ; let history = location . pathname . startsWith ( rootUrl ) && ! retainContainerContent ? createBrowserHistory ( { basename : rootUrl } ) : createMockHistory ( { basename : rootUrl } ) ; let wdkService = wrapWdkService ( getInstance ( endpoint ) ) ; let paramValueStore = getParamValueStoreInstance ( endpoint , wdkService ) ; let transitioner = getTransitioner ( history ) ; let wdkDependencies = wrapWdkDependencies ( { paramValueStore , transitioner , wdkService } ) ; let store = createWdkStore ( wrapStoreModules ( storeModules ) , wdkDependencies , additionalMiddleware ) ; loadAllStaticData ( wdkService , store . dispatch ) ; document . addEventListener ( 'DOMContentLoaded' , function ( ) { let container = rootElement instanceof HTMLElement ? rootElement : rootElement ? document . querySelector ( rootElement ) : undefined ; let handleLocationChange = location => { if ( onLocationChange ) onLocationChange ( location ) ; store . dispatch ( updateLocation ( location ) ) ; } ; if ( container != null ) { let applicationElement = createElement ( Root , { rootUrl , store , history , pluginConfig : pluginConfig . concat ( defaultPluginConfig ) , routes : wrapRoutes ( wdkRoutes ) , onLocationChange : handleLocationChange , wdkDependencies , staticContent : retainContainerContent ? container . innerHTML : undefined } ) ; ReactDOM . render ( applicationElement , container ) ; } else if ( __DEV__ ) { console . debug ( 'Could not resolve rootElement %o. Application will not render automatically.' , rootElement ) ; } } ) ; return { wdkService , paramValueStore , store , history , pluginConfig } ; }
Initialize the application.
Initialize the application .
// define the elements of the Flux architecture // load static WDK data into service cache and view stores that need it // render the root element once page has completely loaded // return WDK application components