@legalplace/wizardx-core 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +1 -0
- package/dist/App.d.ts +2 -0
- package/dist/App.js +28 -9
- package/dist/Globals.d.ts +1 -0
- package/dist/PluginLoader.d.ts +2 -1
- package/dist/PluginLoader.js +23 -12
- package/dist/Shimmer.js +6 -8
- package/dist/ThemeLoader.js +2 -2
- package/dist/components/View.js +3 -5
- package/dist/componentsConnectors/connectPagination.js +4 -6
- package/dist/config.d.ts +0 -1
- package/dist/config.js +2 -17
- package/dist/config.test.js +38 -20
- package/dist/libs/OvcConverter.js +1 -3
- package/dist/polyfills/objectValues.js +1 -3
- package/dist/polyfills/prepend.js +2 -2
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.js +1 -3
- package/dist/redux/middlewares/smartscriptMiddleware.js +16 -4
- package/dist/redux/reducers/app/meta/fetchModelFailed.js +1 -3
- package/dist/redux/reducers/app/meta/fetchModelNonBlocking.js +1 -3
- package/dist/redux/reducers/app/meta/fetchModelSucceeded.js +1 -3
- package/dist/redux/reducers/app/meta/fetchModelUserLocked.js +1 -3
- package/dist/redux/routerHistory.js +6 -1
- package/dist/redux/sagas/fetchModel.js +2 -6
- package/dist/redux/selectors/app.js +2 -4
- package/dist/redux/selectors/conditions.js +4 -12
- package/dist/redux/selectors/references.js +1 -3
- package/dist/service/pardot.service.js +3 -5
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +1 -3
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +1 -3
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +1 -3
- package/dist/types/config.type.d.ts +5 -0
- package/dist/wizard-params.js +1 -0
- package/package.json +5 -4
- package/src/Shimmer.tsx +7 -9
- package/src/ThemeLoader.tsx +2 -3
- package/src/components/View.tsx +5 -5
- package/src/componentsConnectors/connectPagination.tsx +4 -6
- package/src/config.ts +3 -6
- package/src/libs/OvcConverter.ts +3 -3
- package/src/polyfills/objectValues.ts +2 -3
- package/src/polyfills/prepend.ts +2 -2
- package/src/redux/middlewares/mandatoriesWatcherMiddleware.ts +3 -3
- package/src/redux/reducers/app/meta/fetchModelFailed.ts +7 -9
- package/src/redux/reducers/app/meta/fetchModelNonBlocking.ts +7 -9
- package/src/redux/reducers/app/meta/fetchModelSucceeded.ts +7 -9
- package/src/redux/reducers/app/meta/fetchModelUserLocked.ts +7 -9
- package/src/redux/sagas/fetchModel.ts +2 -5
- package/src/redux/selectors/app.ts +3 -6
- package/src/redux/selectors/conditions.ts +12 -12
- package/src/redux/selectors/references.ts +2 -3
- package/src/service/pardot.service.ts +3 -5
- package/src/tests-misc/themes/jestTestTheme/components/EmailComponent.tsx +1 -3
- package/src/tests-misc/themes/jestTestTheme/components/TermsheetComponent.tsx +1 -3
- package/src/tests-misc/themes/jestTestTheme/components/WizardComponent.tsx +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.2](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.1.1...@legalplace/wizardx-core@1.1.2) (2021-10-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix eslint conflicts api[#4349](https://git.legalplace.eu/legalplace/monorepo/issues/4349) ([f145d26](https://git.legalplace.eu/legalplace/monorepo/commits/f145d26819d267a65bb4d9643a9e494d195f27de))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.1.1](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.1.0...@legalplace/wizardx-core@1.1.1) (2021-10-29)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* fix CI api[#4349](https://git.legalplace.eu/legalplace/monorepo/issues/4349) ([205674d](https://git.legalplace.eu/legalplace/monorepo/commits/205674d19f08ea9e5e7183cc9570e2a21f1922f0))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [1.1.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@1.0.1...@legalplace/wizardx-core@1.1.0) (2021-10-28)
|
|
7
29
|
|
|
8
30
|
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Wizardx-Core
|
package/dist/App.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ModelV3 } from '@legalplace/models-v3-types';
|
|
3
3
|
import { StateType } from './types/State.type';
|
|
4
|
+
import { IWizardParams } from './types/config.type';
|
|
4
5
|
export interface AppProps {
|
|
5
6
|
historyType: 'browser' | 'memory';
|
|
6
7
|
model?: ModelV3;
|
|
7
8
|
meta?: StateType.App.Meta;
|
|
8
9
|
instance?: StateType.App.Instance;
|
|
9
10
|
user?: StateType.User;
|
|
11
|
+
wizardParams?: IWizardParams;
|
|
10
12
|
loadPlugin: (plugin: string) => Promise<any>;
|
|
11
13
|
loadTheme: (theme: string) => Promise<any>;
|
|
12
14
|
}
|
package/dist/App.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Route, Switch, Redirect } from 'react-router-dom';
|
|
2
|
+
import { Route, Switch, Redirect, generatePath } from 'react-router-dom';
|
|
3
3
|
import { Provider } from 'react-redux';
|
|
4
4
|
import { ConnectedRouter } from 'connected-react-router';
|
|
5
5
|
import { getStore, createAppStore } from './redux/store';
|
|
6
6
|
import { getHistory } from './redux/routerHistory';
|
|
7
7
|
import { setGlobals } from './Globals';
|
|
8
|
-
import { getConfig } from './config';
|
|
8
|
+
import { getConfig, updateConfig } from './config';
|
|
9
9
|
import { fetchModelPrerequisitesAction } from './redux/actions/sagas/model';
|
|
10
10
|
import ViewComponent from './components/View';
|
|
11
11
|
import SmartScriptComponent from './components/SmartScript';
|
|
12
12
|
import { PluginRoute } from './components/PluginRoute';
|
|
13
|
+
import { clearPlugins } from './PluginLoader';
|
|
13
14
|
class WizardXCore extends React.Component {
|
|
14
15
|
constructor(props) {
|
|
15
16
|
super(props);
|
|
17
|
+
clearPlugins();
|
|
16
18
|
const historyType = typeof props.historyType === 'string' ? props.historyType : 'browser';
|
|
17
19
|
const params = {
|
|
18
20
|
model: null,
|
|
@@ -35,12 +37,30 @@ class WizardXCore extends React.Component {
|
|
|
35
37
|
params.user = props.user;
|
|
36
38
|
}
|
|
37
39
|
setGlobals(params);
|
|
40
|
+
if (props.wizardParams)
|
|
41
|
+
updateConfig(props.wizardParams);
|
|
38
42
|
createAppStore(historyType);
|
|
39
43
|
}
|
|
40
44
|
componentDidMount() {
|
|
45
|
+
if (getConfig().permalink) {
|
|
46
|
+
const { permalink, prefix, uniqid } = getConfig();
|
|
47
|
+
if (uniqid === null || uniqid === void 0 ? void 0 : uniqid.trim().length) {
|
|
48
|
+
getHistory().push(generatePath(getConfig().router.wizardInstancePath, {
|
|
49
|
+
prefix: (prefix === null || prefix === void 0 ? void 0 : prefix.trim().length) ? prefix : undefined,
|
|
50
|
+
permalink,
|
|
51
|
+
uniqid,
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
getHistory().push(generatePath(getConfig().router.wizardPath, {
|
|
56
|
+
prefix: (prefix === null || prefix === void 0 ? void 0 : prefix.trim().length) ? prefix : undefined,
|
|
57
|
+
permalink,
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
41
61
|
const { dispatch, getState } = getStore();
|
|
42
62
|
const state = getState();
|
|
43
|
-
dispatch(fetchModelPrerequisitesAction(state.app.meta.permalink, state.app.meta.prefix || ''));
|
|
63
|
+
dispatch(fetchModelPrerequisitesAction(getConfig().permalink || state.app.meta.permalink, getConfig().prefix || state.app.meta.prefix || ''));
|
|
44
64
|
}
|
|
45
65
|
render() {
|
|
46
66
|
return (React.createElement(Provider, { store: getStore() },
|
|
@@ -49,12 +69,11 @@ class WizardXCore extends React.Component {
|
|
|
49
69
|
React.createElement(Route, { path: "/p/:path", component: PluginRoute }),
|
|
50
70
|
React.createElement(Route, { path: getConfig().router.wizardInstancePath, component: ViewComponent }),
|
|
51
71
|
React.createElement(Route, { path: getConfig().router.wizardPath, component: ViewComponent }),
|
|
52
|
-
React.createElement(Route, { path:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} })
|
|
57
|
-
React.createElement(Redirect, { to: getConfig().router.notFoundPath || '/not_found' })))));
|
|
72
|
+
React.createElement(Route, { path: getConfig().router.smartscriptRoute ||
|
|
73
|
+
'/contrats/:permalink/smartscript/:uniqid?', component: SmartScriptComponent }),
|
|
74
|
+
React.createElement(Redirect, { to: {
|
|
75
|
+
pathname: getConfig().router.notFoundPath,
|
|
76
|
+
} })))));
|
|
58
77
|
}
|
|
59
78
|
}
|
|
60
79
|
export default WizardXCore;
|
package/dist/Globals.d.ts
CHANGED
package/dist/PluginLoader.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface PluginsAppStatesDeclarations {
|
|
|
13
13
|
components: IPluginsAppStatesComponents;
|
|
14
14
|
additionalRoutes?: Record<string, ReactComponent<any>>[];
|
|
15
15
|
}
|
|
16
|
-
declare
|
|
16
|
+
declare let PluginsPageAppStates: PluginsPageAppStatesType;
|
|
17
17
|
export declare const registerPluginsAppStates: PluginAppStatesRegisterFunction;
|
|
18
18
|
export declare const loadPluginComponent: (name: string) => LoadableComponent<any> | undefined;
|
|
19
19
|
export declare const pluginPageAppState: (page: string) => string | false;
|
|
@@ -31,4 +31,5 @@ export declare function ReplaceComponent<T = {}>(replacerName: string | string[]
|
|
|
31
31
|
export declare function RunActionAnchor(anchor: string, ...args: any[]): void;
|
|
32
32
|
export declare function RunOverrideActionAnchor(action: Action): Action<any>;
|
|
33
33
|
export declare const getPluginsAdditionalRoutes: () => Record<string, ReactComponent<any>>;
|
|
34
|
+
export declare const clearPlugins: () => void;
|
|
34
35
|
export {};
|
package/dist/PluginLoader.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import { getConfig
|
|
12
|
+
import { getConfig } from './config';
|
|
13
13
|
import * as connectorActions from './redux/actions';
|
|
14
14
|
import { getStore } from './redux/store';
|
|
15
15
|
import { getHistory } from './redux/routerHistory';
|
|
@@ -17,14 +17,14 @@ import { EventsTracking } from './libs/EventsTracking';
|
|
|
17
17
|
import Globals from './Globals';
|
|
18
18
|
import * as selectorsList from './redux/selectors';
|
|
19
19
|
import * as connectorsList from './componentsConnectors';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
let globalAnchors = {};
|
|
21
|
+
let reduxAnchors = {};
|
|
22
|
+
let actionOverrideAnchor = {};
|
|
23
|
+
let replacers = {};
|
|
24
|
+
let PluginsAppStatesRegistrers = [];
|
|
25
|
+
let PluginsPageAppStates = {};
|
|
26
|
+
let PluginsAppStatesComponents = {};
|
|
27
|
+
let PluginAdditionRoutes = {};
|
|
28
28
|
const pluginAppStates = (declaration) => {
|
|
29
29
|
PluginsAppStatesRegistrers.push(declaration.register);
|
|
30
30
|
if (typeof declaration.pageAppState === 'object')
|
|
@@ -126,8 +126,7 @@ export const loadPlugins = (plugins) => __awaiter(void 0, void 0, void 0, functi
|
|
|
126
126
|
else
|
|
127
127
|
pluginsList = plugins;
|
|
128
128
|
if (pluginsList === undefined) {
|
|
129
|
-
|
|
130
|
-
pluginsList = config.plugins;
|
|
129
|
+
pluginsList = getConfig().plugins;
|
|
131
130
|
}
|
|
132
131
|
yield loadPluginFiles(pluginsList, selectorsList, connectorsList);
|
|
133
132
|
pluginsLoadingDone = true;
|
|
@@ -161,7 +160,7 @@ PluginLoader.propTypes = {
|
|
|
161
160
|
PluginLoader.defaultProps = {
|
|
162
161
|
props: {},
|
|
163
162
|
};
|
|
164
|
-
|
|
163
|
+
let cache = {};
|
|
165
164
|
export function ReplaceComponent(replacerName, OriginalComponent, componentName) {
|
|
166
165
|
const displayName = componentName ||
|
|
167
166
|
OriginalComponent.displayName ||
|
|
@@ -216,3 +215,15 @@ export function RunOverrideActionAnchor(action) {
|
|
|
216
215
|
return overridedAction;
|
|
217
216
|
}
|
|
218
217
|
export const getPluginsAdditionalRoutes = () => PluginAdditionRoutes;
|
|
218
|
+
export const clearPlugins = () => {
|
|
219
|
+
globalAnchors = {};
|
|
220
|
+
reduxAnchors = {};
|
|
221
|
+
actionOverrideAnchor = {};
|
|
222
|
+
replacers = {};
|
|
223
|
+
PluginsAppStatesRegistrers = [];
|
|
224
|
+
PluginsPageAppStates = {};
|
|
225
|
+
PluginsAppStatesComponents = {};
|
|
226
|
+
PluginAdditionRoutes = {};
|
|
227
|
+
cache = {};
|
|
228
|
+
pluginsLoadingDone = false;
|
|
229
|
+
};
|
package/dist/Shimmer.js
CHANGED
|
@@ -55,12 +55,10 @@ const Shimmer = (props) => {
|
|
|
55
55
|
"Le mod\u00E8le semble contenir des erreurs",
|
|
56
56
|
React.createElement("pre", { style: unhealthyStylePre }, (_a = props.report) === null || _a === void 0 ? void 0 : _a.raw)))));
|
|
57
57
|
};
|
|
58
|
-
const mapStateToProps = (state) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
65
|
-
};
|
|
58
|
+
const mapStateToProps = (state) => ({
|
|
59
|
+
fetchStatus: state.app.meta.fetchStatus === 'succeeded'
|
|
60
|
+
? 'nonBlocking'
|
|
61
|
+
: state.app.meta.fetchStatus,
|
|
62
|
+
report: state.app.meta.report,
|
|
63
|
+
});
|
|
66
64
|
export default connect(mapStateToProps)(Shimmer);
|
package/dist/ThemeLoader.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import loadable from '@loadable/component';
|
|
11
|
-
import { getConfig,
|
|
11
|
+
import { getConfig, updateConfig } from './config';
|
|
12
12
|
import * as connectorSelectors from './redux/selectors';
|
|
13
13
|
import * as connectors from './componentsConnectors';
|
|
14
14
|
import Globals from './Globals';
|
|
@@ -24,7 +24,7 @@ export const loadTheme = (theme, force) => __awaiter(void 0, void 0, void 0, fun
|
|
|
24
24
|
currentTheme = theme;
|
|
25
25
|
}
|
|
26
26
|
if (currentTheme === undefined) {
|
|
27
|
-
const config =
|
|
27
|
+
const config = getConfig();
|
|
28
28
|
wizardTheme = config.theme.name;
|
|
29
29
|
themeParams = config.theme.params;
|
|
30
30
|
currentTheme = wizardTheme;
|
package/dist/components/View.js
CHANGED
|
@@ -83,9 +83,7 @@ const mapStateToProps = () => {
|
|
|
83
83
|
currentAppState,
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
-
const mapDispatchToProps = (dispatch) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
};
|
|
86
|
+
const mapDispatchToProps = (dispatch) => ({
|
|
87
|
+
goPage: (page) => dispatch(goPageAction(page)),
|
|
88
|
+
});
|
|
91
89
|
export default connect(mapStateToProps, mapDispatchToProps)(ViewComponent);
|
|
@@ -24,12 +24,10 @@ const stateToProps = (selectors) => () => {
|
|
|
24
24
|
currentPage,
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
const dispatchToProps = (actions) => (dispatch) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
};
|
|
27
|
+
const dispatchToProps = (actions) => (dispatch) => ({
|
|
28
|
+
goNextPage: () => dispatch(actions.goNextPageAction()),
|
|
29
|
+
goPreviousPage: () => dispatch(actions.goPreviousPageAction()),
|
|
30
|
+
});
|
|
33
31
|
export const connectPagination = componentConnector({
|
|
34
32
|
componentName: 'Pagination',
|
|
35
33
|
stateToProps,
|
package/dist/config.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ import type { IWizardParams } from './types/config.type';
|
|
|
2
2
|
export declare const getConfig: () => IWizardParams;
|
|
3
3
|
export declare const updateConfig: (newConfig: IWizardParams) => void;
|
|
4
4
|
export declare const isConfigReady: () => boolean | undefined;
|
|
5
|
-
export declare const loadConfig: () => Promise<IWizardParams>;
|
package/dist/config.js
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import config from './wizard-params';
|
|
11
|
-
let updatedConfig = config;
|
|
1
|
+
let updatedConfig;
|
|
12
2
|
export const getConfig = () => updatedConfig;
|
|
13
3
|
export const updateConfig = (newConfig) => {
|
|
14
4
|
updatedConfig = newConfig;
|
|
15
5
|
};
|
|
16
|
-
export const isConfigReady = () =>
|
|
17
|
-
return getConfig().fixedConfig && getConfig().fixedConfig === true;
|
|
18
|
-
};
|
|
19
|
-
export const loadConfig = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
return getConfig();
|
|
21
|
-
});
|
|
6
|
+
export const isConfigReady = () => getConfig().fixedConfig && getConfig().fixedConfig === true;
|
package/dist/config.test.js
CHANGED
|
@@ -7,30 +7,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { getConfig,
|
|
11
|
-
jest.mock('./wizard-params', () => ({
|
|
12
|
-
apiEndpoint: 'some-endpoint/',
|
|
13
|
-
plugins: {
|
|
14
|
-
jestTestPlugin: '1.0.0',
|
|
15
|
-
},
|
|
16
|
-
theme: {
|
|
17
|
-
name: 'test',
|
|
18
|
-
params: {},
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
10
|
+
import { getConfig, updateConfig } from './config';
|
|
21
11
|
describe('Config loader', () => {
|
|
22
|
-
it('
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
it('Updates config properly', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const config = {
|
|
14
|
+
apiEndpoint: process.env.REACT_APP_API_ENDPOINT || '',
|
|
15
|
+
enableShadowInstance: false,
|
|
16
|
+
router: {
|
|
17
|
+
wizardPath: '/contrats/:prefix?/:permalink/creer/:page?',
|
|
18
|
+
wizardInstancePath: '/contrats/:prefix?/:permalink/continuer/:uniqid([0-9a-zA-Z]+)/:page?',
|
|
19
|
+
notFoundUrl: '/contrats/conditions-generales-de-vente/creer',
|
|
20
|
+
appStatesPages: {
|
|
21
|
+
termsheet: 'resume',
|
|
22
|
+
email: 'email',
|
|
23
|
+
},
|
|
24
|
+
smartscriptRoute: '/contrats/:permalink/smartscript/:uniqid?',
|
|
25
|
+
},
|
|
27
26
|
plugins: {
|
|
28
|
-
|
|
27
|
+
b2c_actions: '1.0.0',
|
|
28
|
+
datalayer: '1.0.0',
|
|
29
|
+
checkoutX: '1.0.0',
|
|
30
|
+
authentication: '1.0.0',
|
|
29
31
|
},
|
|
30
32
|
theme: {
|
|
31
|
-
name: '
|
|
32
|
-
params: {
|
|
33
|
+
name: 'legacy',
|
|
34
|
+
params: {
|
|
35
|
+
ui: {
|
|
36
|
+
topbar: {
|
|
37
|
+
previewBtn: false,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
sidebar: {
|
|
41
|
+
default: 'preview',
|
|
42
|
+
states: {
|
|
43
|
+
wizard: 'summary',
|
|
44
|
+
email: 'summary',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
33
48
|
},
|
|
34
|
-
|
|
49
|
+
appStates: ['wizard', 'email'],
|
|
50
|
+
};
|
|
51
|
+
updateConfig(config);
|
|
52
|
+
expect(getConfig()).toStrictEqual(config);
|
|
35
53
|
}));
|
|
36
54
|
});
|
|
@@ -168,9 +168,7 @@ class _OvcConverter {
|
|
|
168
168
|
const result = Object.assign({}, inputOptions);
|
|
169
169
|
const intId = typeof id === 'number' ? id : parseInt(id, 10);
|
|
170
170
|
const { options } = references.relations.options[intId].children;
|
|
171
|
-
const staticOptions = options.filter((childId) =>
|
|
172
|
-
return references.options[childId].meta.type === 'static';
|
|
173
|
-
});
|
|
171
|
+
const staticOptions = options.filter((childId) => references.options[childId].meta.type === 'static');
|
|
174
172
|
staticOptions.forEach((childId) => {
|
|
175
173
|
if (!Object.prototype.hasOwnProperty.call(result, childId)) {
|
|
176
174
|
result[childId] = new Array(occurences).fill(false);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const objectToValuesPolyfill = (object) =>
|
|
2
|
-
return Object.keys(object).map((key) => object[key]);
|
|
3
|
-
};
|
|
1
|
+
const objectToValuesPolyfill = (object) => Object.keys(object).map((key) => object[key]);
|
|
4
2
|
Object.values = Object.values || objectToValuesPolyfill;
|
|
5
3
|
export default true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function (arr) {
|
|
2
|
-
arr.forEach(
|
|
2
|
+
arr.forEach((item) => {
|
|
3
3
|
if (item.hasOwnProperty('prepend')) {
|
|
4
4
|
return;
|
|
5
5
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
value: function prepend() {
|
|
11
11
|
const argArr = Array.prototype.slice.call(arguments);
|
|
12
12
|
const docFrag = document.createDocumentFragment();
|
|
13
|
-
argArr.forEach(
|
|
13
|
+
argArr.forEach((argItem) => {
|
|
14
14
|
const isNode = argItem instanceof Node;
|
|
15
15
|
docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem)));
|
|
16
16
|
});
|
|
@@ -52,9 +52,7 @@ const validateSectionMandatory = (mpi, sectionId) => {
|
|
|
52
52
|
];
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
childVariables = childVariables.filter((item, pos, self) =>
|
|
56
|
-
return self.indexOf(item) === pos;
|
|
57
|
-
});
|
|
55
|
+
childVariables = childVariables.filter((item, pos, self) => self.indexOf(item) === pos);
|
|
58
56
|
childOptions = childOptions.filter((childId) => Object.prototype.hasOwnProperty.call(mpi.getState().mandatories.options, childId));
|
|
59
57
|
childVariables = childVariables.filter((childId) => Object.prototype.hasOwnProperty.call(mpi.getState().mandatories.variables, childId));
|
|
60
58
|
const sectionOptionsValues = childOptions.reduce((previousValue, currentOptionId) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
+
import { generatePath } from 'react-router-dom';
|
|
3
|
+
import { getConfig } from '../../config';
|
|
2
4
|
import { ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, UPDATE_OPTION_INPUT, UPDATE_VARIABLE_INPUT, } from '../constants/inputs';
|
|
3
5
|
import { ENABLE_SMARTSCRIPT } from '../constants/smartscript';
|
|
4
6
|
import { PathReader } from '../../libs/PathReader';
|
|
@@ -9,14 +11,24 @@ const watchEnableSmartScript = (mpi, next, action) => {
|
|
|
9
11
|
iframe = document.createElement('iframe');
|
|
10
12
|
iframe.id = 'lp-smartscript';
|
|
11
13
|
iframe.setAttribute('style', 'position: absolute; width:0; height:0; border:0;');
|
|
12
|
-
const { permalink } = mpi.getState().app.meta;
|
|
14
|
+
const { permalink, prefix } = mpi.getState().app.meta;
|
|
13
15
|
const { uniqid } = mpi.getState().app.instance;
|
|
14
16
|
const { modelVersion } = new PathReader(mpi.getState());
|
|
15
|
-
|
|
17
|
+
if (getConfig().router.smartscriptRoute) {
|
|
18
|
+
const path = generatePath(getConfig().router.smartscriptRoute, {
|
|
19
|
+
permalink,
|
|
20
|
+
prefix: prefix.trim().length > 0 ? prefix : undefined,
|
|
21
|
+
uniqid: uniqid.trim().length > 0 ? uniqid : undefined,
|
|
22
|
+
});
|
|
23
|
+
iframe.src = `${window.location.protocol}//${window.location.host}${path}${modelVersion ? `?version=${modelVersion}` : ''}`;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
iframe.src = `${window.location.protocol}//${window.location.host}/contrats/${permalink}/smartscript/${uniqid || ''}${modelVersion ? `?version=${modelVersion}` : ''}`;
|
|
27
|
+
}
|
|
16
28
|
const isNewInstance = !(typeof uniqid === 'string' && uniqid.trim().length > 0);
|
|
17
29
|
iframe.onload = () => {
|
|
18
|
-
var _a;
|
|
19
|
-
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.initTriggers((triggers, actions) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
(_b = (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.initTriggers) === null || _b === void 0 ? void 0 : _b.call(_a, (triggers, actions) => {
|
|
20
32
|
mpi.dispatch(initSmartscriptTriggersAction(triggers));
|
|
21
33
|
if (Array.isArray(actions)) {
|
|
22
34
|
actions.forEach((_action) => {
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export const fetchModelFailedReducer = (state) => {
|
|
2
|
-
return Object.assign(Object.assign({}, state), { meta: Object.assign(Object.assign({}, state.meta), { fetchStatus: 'failed' }) });
|
|
3
|
-
};
|
|
1
|
+
export const fetchModelFailedReducer = (state) => (Object.assign(Object.assign({}, state), { meta: Object.assign(Object.assign({}, state.meta), { fetchStatus: 'failed' }) }));
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export const fetchModelNonBlockingReducer = (state) => {
|
|
2
|
-
return Object.assign(Object.assign({}, state), { meta: Object.assign(Object.assign({}, state.meta), { fetchStatus: 'nonBlocking' }) });
|
|
3
|
-
};
|
|
1
|
+
export const fetchModelNonBlockingReducer = (state) => (Object.assign(Object.assign({}, state), { meta: Object.assign(Object.assign({}, state.meta), { fetchStatus: 'nonBlocking' }) }));
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export const fetchModelSucceededReducer = (state) => {
|
|
2
|
-
return Object.assign(Object.assign({}, state), { meta: Object.assign(Object.assign({}, state.meta), { fetchStatus: 'succeeded' }) });
|
|
3
|
-
};
|
|
1
|
+
export const fetchModelSucceededReducer = (state) => (Object.assign(Object.assign({}, state), { meta: Object.assign(Object.assign({}, state.meta), { fetchStatus: 'succeeded' }) }));
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export const fetchModelUserLockedReducer = (state) => {
|
|
2
|
-
return Object.assign(Object.assign({}, state), { meta: Object.assign(Object.assign({}, state.meta), { fetchStatus: 'userLocked' }) });
|
|
3
|
-
};
|
|
1
|
+
export const fetchModelUserLockedReducer = (state) => (Object.assign(Object.assign({}, state), { meta: Object.assign(Object.assign({}, state.meta), { fetchStatus: 'userLocked' }) }));
|
|
@@ -2,7 +2,12 @@ import { createMemoryHistory, createBrowserHistory, } from 'history';
|
|
|
2
2
|
let history;
|
|
3
3
|
export const createHistory = (historyType) => {
|
|
4
4
|
history =
|
|
5
|
-
historyType === 'memory'
|
|
5
|
+
historyType === 'memory'
|
|
6
|
+
? createMemoryHistory({
|
|
7
|
+
initialEntries: ['/one', '/two'],
|
|
8
|
+
initialIndex: 1,
|
|
9
|
+
})
|
|
10
|
+
: createBrowserHistory();
|
|
6
11
|
return history;
|
|
7
12
|
};
|
|
8
13
|
export const getHistory = () => {
|
|
@@ -24,11 +24,7 @@ import { enableSmartscriptAction } from '../actions/smartscript';
|
|
|
24
24
|
import { FETCH_MODEL, FETCH_MODEL_PREREQUISITES, } from '../constants/sagas/model';
|
|
25
25
|
import { fetchModelAction } from '../actions/sagas/model';
|
|
26
26
|
const cookies = new Cookies();
|
|
27
|
-
const getValues = (arr1, arr2) =>
|
|
28
|
-
return arr1.map((v, index) => {
|
|
29
|
-
return arr2[index] || v;
|
|
30
|
-
});
|
|
31
|
-
};
|
|
27
|
+
const getValues = (arr1, arr2) => arr1.map((v, index) => arr2[index] || v);
|
|
32
28
|
function* setFetchModelToNonBlocking(firstCurrentAppState) {
|
|
33
29
|
yield put(initPaginationAction({
|
|
34
30
|
currentPage: 1,
|
|
@@ -230,7 +226,7 @@ function* fetchModelPrerequisites(action) {
|
|
|
230
226
|
const { permalink, prefix } = action;
|
|
231
227
|
if (!permalink && window.location.href.includes('smartscript'))
|
|
232
228
|
return;
|
|
233
|
-
const uniqid = selectInstanceUniqid();
|
|
229
|
+
const uniqid = selectInstanceUniqid() || getConfig().uniqid;
|
|
234
230
|
const uniqidParam = uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : '';
|
|
235
231
|
const urlParams = new URLSearchParams(window.location.search);
|
|
236
232
|
const state = yield select((s) => s);
|
|
@@ -5,10 +5,8 @@ export const selectAvailableAppStates = createSelector((state) => state.app.pagi
|
|
|
5
5
|
export const selectCurrentAppState = createSelector((state) => state.app.pagination.currentAppState, (state) => state.app.pagination.currentAppState);
|
|
6
6
|
export const selectIsFirstPage = createSelector((state) => state.app.pagination.isFirstPage, (state) => state.app.pagination.isFirstPage.toString());
|
|
7
7
|
export const selectIsLastPage = createSelector((state) => state.app.pagination.isLastPage, (state) => state.app.pagination.isLastPage.toString());
|
|
8
|
-
export const selectIsLastWizardPage = createSelector((state) =>
|
|
9
|
-
|
|
10
|
-
state.app.wizard.availableSections.length);
|
|
11
|
-
}, (state) => state.app.pagination.currentPage.toString());
|
|
8
|
+
export const selectIsLastWizardPage = createSelector((state) => state.app.pagination.currentPage ===
|
|
9
|
+
state.app.wizard.availableSections.length, (state) => state.app.pagination.currentPage.toString());
|
|
12
10
|
export const selectGreatestPage = createSelector((state) => state.app.pagination.greatestPage, (state) => state.app.pagination.greatestPage);
|
|
13
11
|
export const selectCurrentSectionId = createSelector((state) => state.app.wizard.currentSectionId, (state) => state.app.wizard.currentSectionId);
|
|
14
12
|
export const selectAvailableSections = createSelector((state) => [...state.app.wizard.availableSections], (state) => state.app.wizard.availableSections.reduce((p, c) => p + c, 0));
|
|
@@ -105,12 +105,8 @@ export function selectVariableValidatorConditionValue(id, index) {
|
|
|
105
105
|
export const selectIsOptionDisplayed = createSelector((state, id, index) => {
|
|
106
106
|
const optionCondition = selectOptionConditionValue(id, index) !== false;
|
|
107
107
|
const optionParents = selectOptionParents(id);
|
|
108
|
-
const parentsConditions = optionParents.map((optionId) =>
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
const parentsInputs = optionParents.map((optionId) => {
|
|
112
|
-
return selectOptionInputByIndex(optionId, index);
|
|
113
|
-
});
|
|
108
|
+
const parentsConditions = optionParents.map((optionId) => selectOptionConditionValue(optionId, index) !== false);
|
|
109
|
+
const parentsInputs = optionParents.map((optionId) => selectOptionInputByIndex(optionId, index));
|
|
114
110
|
const parentSectionId = selectOptionParentSection(id);
|
|
115
111
|
const parentSectionCondition = selectSectionConditionValue(parentSectionId) !== false;
|
|
116
112
|
return ([
|
|
@@ -123,12 +119,8 @@ export const selectIsOptionDisplayed = createSelector((state, id, index) => {
|
|
|
123
119
|
export const selectIsVariableDisplayed = createSelector((state, id, index) => {
|
|
124
120
|
const variableCondition = selectVariableConditionValue(id, index) !== false;
|
|
125
121
|
const variableParents = selectVariableParents(id);
|
|
126
|
-
const parentsConditions = variableParents.map((optionId) =>
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
const parentsInputs = variableParents.map((optionId) => {
|
|
130
|
-
return selectOptionInputByIndex(optionId, index);
|
|
131
|
-
});
|
|
122
|
+
const parentsConditions = variableParents.map((optionId) => selectOptionConditionValue(optionId, index) !== false);
|
|
123
|
+
const parentsInputs = variableParents.map((optionId) => selectOptionInputByIndex(optionId, index));
|
|
132
124
|
const parentSectionId = selectVariableParentSection(id);
|
|
133
125
|
const parentSectionCondition = selectSectionConditionValue(parentSectionId) !== false;
|
|
134
126
|
return ([
|
|
@@ -99,9 +99,7 @@ export const selectDocumentConditionsObject = createSelector((state, name) => {
|
|
|
99
99
|
return undefined;
|
|
100
100
|
return state.references.conditions.documents[name];
|
|
101
101
|
}, (state, name) => (!state.references ? Math.random() : name));
|
|
102
|
-
export const selectSectionConditionsObject = createSelector((state, id, document = 'main') => {
|
|
103
|
-
return state.references.conditions.sections[document][id];
|
|
104
|
-
}, (state, id, document = 'main') => !state.references ? Math.random() : `${id}-${document}`);
|
|
102
|
+
export const selectSectionConditionsObject = createSelector((state, id, document = 'main') => state.references.conditions.sections[document][id], (state, id, document = 'main') => !state.references ? Math.random() : `${id}-${document}`);
|
|
105
103
|
export const selectPrefillerConditionsObject = createSelector((state, id) => {
|
|
106
104
|
if (typeof state.references === 'undefined')
|
|
107
105
|
return undefined;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import Cookies from 'universal-cookie';
|
|
2
2
|
const cookies = new Cookies();
|
|
3
|
-
export const pardotAttributes = () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
};
|
|
3
|
+
export const pardotAttributes = () => ({
|
|
4
|
+
visitorId: cookies.get('visitor_id906092'),
|
|
5
|
+
});
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
const EmailComponent = () =>
|
|
3
|
-
return React.createElement("h1", null, "Wizard test theme, EmailComponent");
|
|
4
|
-
};
|
|
2
|
+
const EmailComponent = () => React.createElement("h1", null, "Wizard test theme, EmailComponent");
|
|
5
3
|
export default EmailComponent;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
const TermsheetComponent = () =>
|
|
3
|
-
return React.createElement("h1", null, "Wizard test theme, TermsheetComponent");
|
|
4
|
-
};
|
|
2
|
+
const TermsheetComponent = () => React.createElement("h1", null, "Wizard test theme, TermsheetComponent");
|
|
5
3
|
export default TermsheetComponent;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
const WizardComponent = () =>
|
|
3
|
-
return React.createElement("h1", null, "Wizard test theme, WizardComponent");
|
|
4
|
-
};
|
|
2
|
+
const WizardComponent = () => React.createElement("h1", null, "Wizard test theme, WizardComponent");
|
|
5
3
|
export default WizardComponent;
|
|
@@ -32,6 +32,7 @@ export interface IWizardParams {
|
|
|
32
32
|
fixedConfig?: boolean;
|
|
33
33
|
router: {
|
|
34
34
|
wizardPath: string;
|
|
35
|
+
smartscriptRoute: string;
|
|
35
36
|
wizardInstancePath: string;
|
|
36
37
|
notFoundUrl: string;
|
|
37
38
|
notFoundPath?: string;
|
|
@@ -45,4 +46,8 @@ export interface IWizardParams {
|
|
|
45
46
|
appStates: string[];
|
|
46
47
|
ovcBucket?: string;
|
|
47
48
|
documentBucket?: string;
|
|
49
|
+
permalink?: string;
|
|
50
|
+
prefix?: string;
|
|
51
|
+
uniqid?: string;
|
|
52
|
+
metadata?: Record<string, any>;
|
|
48
53
|
}
|
package/dist/wizard-params.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"xss": "^1.0.9"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@legalplace/eslint-config": "^
|
|
48
|
+
"@legalplace/eslint-config": "^2.0.0",
|
|
49
49
|
"@legalplace/models-v3-types": "^3.6.0",
|
|
50
|
-
"@legalplace/prettier-config": "^
|
|
50
|
+
"@legalplace/prettier-config": "^2.0.0",
|
|
51
51
|
"@swc-node/jest": "^1.3.2",
|
|
52
52
|
"@swc/core": "^1.2.93",
|
|
53
53
|
"@swc/jest": "^0.2.4",
|
|
@@ -81,5 +81,6 @@
|
|
|
81
81
|
"eslintIgnore": [
|
|
82
82
|
"*.test.ts",
|
|
83
83
|
"*.test.tsx"
|
|
84
|
-
]
|
|
84
|
+
],
|
|
85
|
+
"gitHead": "331f6d572669d9e4e1d1b81b7bdf136ec3e99798"
|
|
85
86
|
}
|
package/src/Shimmer.tsx
CHANGED
|
@@ -84,14 +84,12 @@ const mapStateToProps = (
|
|
|
84
84
|
): {
|
|
85
85
|
fetchStatus: StateType.App.Meta['fetchStatus'];
|
|
86
86
|
report: StateType.App.Meta['report'];
|
|
87
|
-
} => {
|
|
88
|
-
|
|
89
|
-
fetchStatus
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
};
|
|
87
|
+
} => ({
|
|
88
|
+
fetchStatus:
|
|
89
|
+
state.app.meta.fetchStatus === 'succeeded'
|
|
90
|
+
? 'nonBlocking'
|
|
91
|
+
: state.app.meta.fetchStatus,
|
|
92
|
+
report: state.app.meta.report,
|
|
93
|
+
});
|
|
96
94
|
|
|
97
95
|
export default connect(mapStateToProps)(Shimmer);
|
package/src/ThemeLoader.tsx
CHANGED
|
@@ -87,11 +87,10 @@ const importThemeComponent = async (
|
|
|
87
87
|
/**
|
|
88
88
|
* Theme component's loader
|
|
89
89
|
*/
|
|
90
|
-
export const getThemeShimmer = () =>
|
|
91
|
-
|
|
90
|
+
export const getThemeShimmer = () =>
|
|
91
|
+
getConfig().theme?.shimmer === true
|
|
92
92
|
? loadable(() => importThemeComponent('ShimmerComponent'))
|
|
93
93
|
: null;
|
|
94
|
-
};
|
|
95
94
|
|
|
96
95
|
export const setWizardTheme = async (theme: IWizardParamsTheme) => {
|
|
97
96
|
const { name, params } = theme;
|
package/src/components/View.tsx
CHANGED
|
@@ -107,10 +107,10 @@ const mapStateToProps = () => {
|
|
|
107
107
|
};
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
const mapDispatchToProps: MapDispatchToPropsFunction<any, any> = (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
110
|
+
const mapDispatchToProps: MapDispatchToPropsFunction<any, any> = (
|
|
111
|
+
dispatch
|
|
112
|
+
) => ({
|
|
113
|
+
goPage: (page: number) => dispatch(goPageAction(page)),
|
|
114
|
+
});
|
|
115
115
|
|
|
116
116
|
export default connect(mapStateToProps, mapDispatchToProps)(ViewComponent);
|
|
@@ -87,12 +87,10 @@ const stateToProps: ConnectorStateToProps<
|
|
|
87
87
|
const dispatchToProps: ConnectorDispatchProps<
|
|
88
88
|
ConnectPaginationOwnProps,
|
|
89
89
|
ConnectPaginationDispatchProps
|
|
90
|
-
> = (actions) => (dispatch) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
};
|
|
90
|
+
> = (actions) => (dispatch) => ({
|
|
91
|
+
goNextPage: () => dispatch(actions.goNextPageAction()),
|
|
92
|
+
goPreviousPage: () => dispatch(actions.goPreviousPageAction()),
|
|
93
|
+
});
|
|
96
94
|
|
|
97
95
|
/**
|
|
98
96
|
* Creating our component connector
|
package/src/config.ts
CHANGED
|
@@ -8,10 +8,7 @@ export const updateConfig = (newConfig: IWizardParams) => {
|
|
|
8
8
|
updatedConfig = newConfig;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export const isConfigReady = () =>
|
|
12
|
-
|
|
13
|
-
};
|
|
11
|
+
export const isConfigReady = () =>
|
|
12
|
+
getConfig().fixedConfig && getConfig().fixedConfig === true;
|
|
14
13
|
|
|
15
|
-
export const loadConfig = async () =>
|
|
16
|
-
return getConfig();
|
|
17
|
-
};
|
|
14
|
+
export const loadConfig = async () => getConfig();
|
package/src/libs/OvcConverter.ts
CHANGED
|
@@ -267,9 +267,9 @@ class _OvcConverter {
|
|
|
267
267
|
const { options } = references.relations.options[intId].children;
|
|
268
268
|
|
|
269
269
|
// Getting static children
|
|
270
|
-
const staticOptions = options.filter(
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
const staticOptions = options.filter(
|
|
271
|
+
(childId) => references.options[childId].meta.type === 'static'
|
|
272
|
+
);
|
|
273
273
|
|
|
274
274
|
staticOptions.forEach((childId) => {
|
|
275
275
|
// Creating input if it doesn't exist
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const objectToValuesPolyfill = (object: any) =>
|
|
2
|
-
|
|
3
|
-
};
|
|
1
|
+
const objectToValuesPolyfill = (object: any) =>
|
|
2
|
+
Object.keys(object).map((key) => object[key]);
|
|
4
3
|
Object.values = Object.values || objectToValuesPolyfill;
|
|
5
4
|
export default true;
|
package/src/polyfills/prepend.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable no-prototype-builtins */
|
|
4
4
|
// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/prepend()/prepend().md
|
|
5
5
|
(function (arr) {
|
|
6
|
-
arr.forEach(
|
|
6
|
+
arr.forEach((item) => {
|
|
7
7
|
if (item.hasOwnProperty('prepend')) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
const argArr = Array.prototype.slice.call(arguments);
|
|
16
16
|
const docFrag = document.createDocumentFragment();
|
|
17
17
|
|
|
18
|
-
argArr.forEach(
|
|
18
|
+
argArr.forEach((argItem) => {
|
|
19
19
|
const isNode = argItem instanceof Node;
|
|
20
20
|
docFrag.appendChild(
|
|
21
21
|
isNode ? argItem : document.createTextNode(String(argItem))
|
|
@@ -115,9 +115,9 @@ const validateSectionMandatory = (
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
// Delete Duplication of variablesIds
|
|
118
|
-
childVariables = childVariables.filter(
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
childVariables = childVariables.filter(
|
|
119
|
+
(item, pos, self) => self.indexOf(item) === pos
|
|
120
|
+
);
|
|
121
121
|
|
|
122
122
|
// Filtring children with mandatory displayed children only
|
|
123
123
|
childOptions = childOptions.filter((childId) =>
|
|
@@ -2,12 +2,10 @@ import { StateType } from '../../../../types/State.type';
|
|
|
2
2
|
|
|
3
3
|
export const fetchModelFailedReducer = (
|
|
4
4
|
state: StateType.App
|
|
5
|
-
): StateType.App => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
meta
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
};
|
|
5
|
+
): StateType.App => ({
|
|
6
|
+
...state,
|
|
7
|
+
meta: {
|
|
8
|
+
...state.meta,
|
|
9
|
+
fetchStatus: 'failed',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -2,12 +2,10 @@ import { StateType } from '../../../../types/State.type';
|
|
|
2
2
|
|
|
3
3
|
export const fetchModelNonBlockingReducer = (
|
|
4
4
|
state: StateType.App
|
|
5
|
-
): StateType.App => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
meta
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
};
|
|
5
|
+
): StateType.App => ({
|
|
6
|
+
...state,
|
|
7
|
+
meta: {
|
|
8
|
+
...state.meta,
|
|
9
|
+
fetchStatus: 'nonBlocking',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -2,12 +2,10 @@ import { StateType } from '../../../../types/State.type';
|
|
|
2
2
|
|
|
3
3
|
export const fetchModelSucceededReducer = (
|
|
4
4
|
state: StateType.App
|
|
5
|
-
): StateType.App => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
meta
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
};
|
|
5
|
+
): StateType.App => ({
|
|
6
|
+
...state,
|
|
7
|
+
meta: {
|
|
8
|
+
...state.meta,
|
|
9
|
+
fetchStatus: 'succeeded',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -2,12 +2,10 @@ import { StateType } from '../../../../types/State.type';
|
|
|
2
2
|
|
|
3
3
|
export const fetchModelUserLockedReducer = (
|
|
4
4
|
state: StateType.App
|
|
5
|
-
): StateType.App => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
meta
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
};
|
|
5
|
+
): StateType.App => ({
|
|
6
|
+
...state,
|
|
7
|
+
meta: {
|
|
8
|
+
...state.meta,
|
|
9
|
+
fetchStatus: 'userLocked',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -68,11 +68,8 @@ import {
|
|
|
68
68
|
|
|
69
69
|
const cookies = new Cookies();
|
|
70
70
|
|
|
71
|
-
const getValues = (arr1: boolean[], arr2: boolean[]) =>
|
|
72
|
-
|
|
73
|
-
return arr2[index] || v;
|
|
74
|
-
});
|
|
75
|
-
};
|
|
71
|
+
const getValues = (arr1: boolean[], arr2: boolean[]) =>
|
|
72
|
+
arr1.map((v, index) => arr2[index] || v);
|
|
76
73
|
|
|
77
74
|
function* setFetchModelToNonBlocking(firstCurrentAppState?: string) {
|
|
78
75
|
yield put(
|
|
@@ -43,12 +43,9 @@ export const selectIsLastPage = createSelector(
|
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
export const selectIsLastWizardPage = createSelector(
|
|
46
|
-
(state: StateType) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
state.app.wizard.availableSections.length
|
|
50
|
-
);
|
|
51
|
-
},
|
|
46
|
+
(state: StateType) =>
|
|
47
|
+
state.app.pagination.currentPage ===
|
|
48
|
+
state.app.wizard.availableSections.length,
|
|
52
49
|
(state: StateType) => state.app.pagination.currentPage.toString()
|
|
53
50
|
);
|
|
54
51
|
|
|
@@ -244,12 +244,12 @@ export const selectIsOptionDisplayed = createSelector(
|
|
|
244
244
|
(state, id: number, index: number) => {
|
|
245
245
|
const optionCondition = selectOptionConditionValue(id, index) !== false;
|
|
246
246
|
const optionParents = selectOptionParents(id);
|
|
247
|
-
const parentsConditions = optionParents.map(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const parentsInputs = optionParents.map((optionId) =>
|
|
251
|
-
|
|
252
|
-
|
|
247
|
+
const parentsConditions = optionParents.map(
|
|
248
|
+
(optionId) => selectOptionConditionValue(optionId, index) !== false
|
|
249
|
+
);
|
|
250
|
+
const parentsInputs = optionParents.map((optionId) =>
|
|
251
|
+
selectOptionInputByIndex(optionId, index)
|
|
252
|
+
);
|
|
253
253
|
const parentSectionId = selectOptionParentSection(id);
|
|
254
254
|
const parentSectionCondition =
|
|
255
255
|
selectSectionConditionValue(parentSectionId) !== false;
|
|
@@ -270,12 +270,12 @@ export const selectIsVariableDisplayed = createSelector(
|
|
|
270
270
|
(state, id: number, index: number) => {
|
|
271
271
|
const variableCondition = selectVariableConditionValue(id, index) !== false;
|
|
272
272
|
const variableParents = selectVariableParents(id);
|
|
273
|
-
const parentsConditions = variableParents.map(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const parentsInputs = variableParents.map((optionId) =>
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
const parentsConditions = variableParents.map(
|
|
274
|
+
(optionId) => selectOptionConditionValue(optionId, index) !== false
|
|
275
|
+
);
|
|
276
|
+
const parentsInputs = variableParents.map((optionId) =>
|
|
277
|
+
selectOptionInputByIndex(optionId, index)
|
|
278
|
+
);
|
|
279
279
|
const parentSectionId = selectVariableParentSection(id);
|
|
280
280
|
const parentSectionCondition =
|
|
281
281
|
selectSectionConditionValue(parentSectionId) !== false;
|
|
@@ -253,9 +253,8 @@ export const selectDocumentConditionsObject = createSelector(
|
|
|
253
253
|
);
|
|
254
254
|
|
|
255
255
|
export const selectSectionConditionsObject = createSelector(
|
|
256
|
-
(state: StateType, id: number, document = 'main') =>
|
|
257
|
-
|
|
258
|
-
},
|
|
256
|
+
(state: StateType, id: number, document = 'main') =>
|
|
257
|
+
state.references.conditions.sections[document][id],
|
|
259
258
|
(state: StateType, id: number, document = 'main') =>
|
|
260
259
|
!state.references ? Math.random() : `${id}-${document}`
|
|
261
260
|
);
|
|
@@ -5,8 +5,6 @@ const cookies = new Cookies();
|
|
|
5
5
|
export interface IPardotAttributes {
|
|
6
6
|
visitorId: number;
|
|
7
7
|
}
|
|
8
|
-
export const pardotAttributes = (): IPardotAttributes => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
};
|
|
8
|
+
export const pardotAttributes = (): IPardotAttributes => ({
|
|
9
|
+
visitorId: cookies.get('visitor_id906092'),
|
|
10
|
+
});
|