1 | declare var __ISOMORPHIC_ID__: any;
|
2 |
|
3 | import React from 'react';
|
4 | import ReactDOM from 'react-dom';
|
5 | import { extractObject, INFRASTRUCTURE_MODES, loadConfigurationFromModule } from '../libs/loader';
|
6 |
|
7 | import { createSinglePageApp } from './routed-app';
|
8 | import Types from '../types';
|
9 | import { renderFromDataLayer } from './datalayer-integration';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | const createApp = () => {
|
15 |
|
16 |
|
17 |
|
18 | const soaConfig = loadConfigurationFromModule(require('__CONFIG_FILE_PATH__'), INFRASTRUCTURE_MODES.RUNTIME);
|
19 |
|
20 |
|
21 | const fCreateApp = soaConfig.dataLayerId !== undefined ? (node) => renderFromDataLayer(
|
22 | node,
|
23 | extractObject(
|
24 | soaConfig,
|
25 | Types.INFRASTRUCTURE_TYPE_COMPONENT,
|
26 | soaConfig.dataLayerId
|
27 | )
|
28 | ) : (node) => {
|
29 | console.log("no data layer present");
|
30 | return node;
|
31 | };
|
32 |
|
33 | ReactDOM.render(
|
34 | fCreateApp(
|
35 | createSinglePageApp(
|
36 | soaConfig.routes,
|
37 | soaConfig.redirects
|
38 | )
|
39 | ),
|
40 | document.getElementById('root')
|
41 | );
|
42 |
|
43 | };
|
44 |
|
45 |
|
46 | export default createApp(); |
\ | No newline at end of file |