@legalplace/wizardx-core 4.42.9 → 4.42.10-nightly.20251125120616
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/README.md +376 -1
- package/dist/App.d.ts +1 -6
- package/dist/App.js +2 -7
- package/dist/Loader.d.ts +1 -1
- package/dist/Loader.js +1 -1
- package/dist/PluginLoader.d.ts +21 -36
- package/dist/PluginLoader.js +90 -227
- package/dist/Shimmer.d.ts +8 -11
- package/dist/Shimmer.js +4 -4
- package/dist/ThemeLoader.d.ts +8 -8
- package/dist/WizardCore.d.ts +29 -0
- package/dist/WizardCore.js +153 -0
- package/dist/app.entry.d.ts +2 -0
- package/dist/app.entry.js +1 -0
- package/dist/components/PluginRoute.d.ts +2 -2
- package/dist/components/PluginRoute.js +3 -4
- package/dist/components/SmartScript.d.ts +2 -6
- package/dist/components/SmartScript.js +1 -1
- package/dist/components/UserLocked/UserLockedComponent.js +2 -2
- package/dist/components/View.d.ts +3 -3
- package/dist/components/View.js +5 -7
- package/dist/componentsConnectors/connectBox.d.ts +4 -6
- package/dist/componentsConnectors/connectDocument.d.ts +4 -6
- package/dist/componentsConnectors/connectHeader.d.ts +4 -6
- package/dist/componentsConnectors/connectMetaTitle.d.ts +3 -7
- package/dist/componentsConnectors/connectOption.d.ts +5 -7
- package/dist/componentsConnectors/connectPagination.d.ts +5 -7
- package/dist/componentsConnectors/connectPreview.d.ts +3 -7
- package/dist/componentsConnectors/connectProgress.d.ts +4 -6
- package/dist/componentsConnectors/connectRootOption.d.ts +5 -7
- package/dist/componentsConnectors/connectSection.d.ts +4 -6
- package/dist/componentsConnectors/connectSummary.d.ts +5 -9
- package/dist/componentsConnectors/connectSummaryItem.d.ts +4 -6
- package/dist/componentsConnectors/connectTermsheet.js +1 -1
- package/dist/componentsConnectors/connectVariable.d.ts +6 -8
- package/dist/componentsConnectors/connectWizardWrapper.d.ts +4 -6
- package/dist/componentsConnectors/connector/componentConnector.d.ts +7 -10
- package/dist/componentsConnectors/connector/componentConnector.js +3 -3
- package/dist/componentsConnectors/library.d.ts +47 -81
- package/dist/helpers/activitiesHelper.d.ts +3 -3
- package/dist/helpers/autocomplete.helper.d.ts +2 -2
- package/dist/helpers/autocomplete.helper.js +1 -1
- package/dist/helpers/autosave.helper.d.ts +3 -13
- package/dist/helpers/autosave.helper.js +3 -70
- package/dist/helpers/inpiCitiesHelper.js +1 -1
- package/dist/helpers/outputsParsing.d.ts +9 -9
- package/dist/hooks/useDispatch.d.ts +1 -1
- package/dist/hooks/usePrevious.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/libs/ConditionsRunner.d.ts +1 -1
- package/dist/libs/Formatter/FormatAddress.d.ts +1 -1
- package/dist/libs/InputsInitiator.d.ts +1 -1
- package/dist/libs/PathReader.d.ts +96 -1
- package/dist/libs/PathReader.js +1 -2
- package/dist/libs/SmartScriptStore.d.ts +6 -6
- package/dist/redux/actions/app.d.ts +1 -1
- package/dist/redux/actions/inputs.d.ts +1 -1
- package/dist/redux/actions/library.d.ts +15 -21
- package/dist/redux/actions/references.d.ts +2 -2
- package/dist/redux/actions/sagas/data.d.ts +1 -1
- package/dist/redux/actions/sagas/user.d.ts +1 -1
- package/dist/redux/listeners/subscriber.d.ts +1 -1
- package/dist/redux/middlewares/conditionsWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/multiplesActionsMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/paginationWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/pluginsHookMiddleware.d.ts +1 -2
- package/dist/redux/middlewares/pluginsHookMiddleware.js +1 -7
- package/dist/redux/middlewares/prefillerWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/smartscriptMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/smartscriptMiddleware.js +2 -2
- package/dist/redux/middlewares/thirdpartyScriptsMiddleware.d.ts +1 -1
- package/dist/redux/reducers/app/pagination/updateAvailableAppStates.js +1 -2
- package/dist/redux/reducers/app.d.ts +6 -6
- package/dist/redux/reducers/references.js +2 -0
- package/dist/redux/selectors/inputs.d.ts +1 -1
- package/dist/redux/selectors/selectors.d.ts +4 -4
- package/dist/redux/store.d.ts +5 -3
- package/dist/redux/store.js +2 -1
- package/dist/routing/adapters/nextjs.adapter.d.ts +3 -0
- package/dist/routing/adapters/nextjs.adapter.js +61 -0
- package/dist/routing/adapters/reactRouter.adapter.d.ts +2 -0
- package/dist/routing/adapters/reactRouter.adapter.js +16 -0
- package/dist/routing/context.d.ts +14 -0
- package/dist/routing/context.js +23 -0
- package/dist/routing/index.d.ts +4 -0
- package/dist/routing/index.js +4 -0
- package/dist/routing/types.d.ts +26 -0
- package/dist/service/api.manager.d.ts +2 -2
- package/dist/service/autocomplete.manager.d.ts +3 -3
- package/dist/service/autocomplete.manager.js +3 -3
- package/dist/tests-misc/plugins/jestTestPlugin/after.js +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/before.js +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/title.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +1 -1
- package/dist/types/Actions.type.d.ts +70 -6
- package/dist/types/Components.type.d.ts +3 -2
- package/dist/types/PluginConfig.type.d.ts +18 -52
- package/dist/types/State.type.d.ts +2 -2
- package/dist/types/config.type.d.ts +1 -1
- package/dist/types/getActions.type.d.ts +1 -1
- package/dist/types/getConnectors.type.d.ts +2 -2
- package/dist/types/getSelectors.type.d.ts +1 -1
- package/dist/wizardcore.entry.d.ts +3 -0
- package/dist/wizardcore.entry.js +2 -0
- package/package.json +40 -17
- package/dist/App.test.js +0 -37
- package/dist/PluginLoader.test.d.ts +0 -1
- package/dist/PluginLoader.test.js +0 -52
- package/dist/ThemeLoader.test.d.ts +0 -2
- package/dist/ThemeLoader.test.js +0 -65
- package/dist/components/View.test.d.ts +0 -2
- package/dist/components/View.test.js +0 -84
- package/dist/componentsConnectors/connectBox.test.d.ts +0 -1
- package/dist/componentsConnectors/connectBox.test.js +0 -218
- package/dist/componentsConnectors/connectDocument.test.d.ts +0 -1
- package/dist/componentsConnectors/connectDocument.test.js +0 -95
- package/dist/componentsConnectors/connectMetaTitle.test.d.ts +0 -1
- package/dist/componentsConnectors/connectMetaTitle.test.js +0 -32
- package/dist/config.test.d.ts +0 -1
- package/dist/config.test.js +0 -54
- package/dist/libs/NumAuto.test.d.ts +0 -1
- package/dist/libs/NumAuto.test.js +0 -43
- package/dist/libs/SectionValidity.test.d.ts +0 -1
- package/dist/libs/SectionValidity.test.js +0 -116
- package/dist/redux/actions/app.test.d.ts +0 -1
- package/dist/redux/actions/app.test.js +0 -90
- package/dist/redux/actions/conditions.test.d.ts +0 -1
- package/dist/redux/actions/conditions.test.js +0 -68
- package/dist/redux/actions/inputs.test.d.ts +0 -1
- package/dist/redux/actions/inputs.test.js +0 -53
- package/dist/redux/actions/references.test.d.ts +0 -1
- package/dist/redux/actions/references.test.js +0 -43
- package/dist/redux/actions/sagas/data.test.d.ts +0 -1
- package/dist/redux/actions/sagas/data.test.js +0 -11
- package/dist/redux/actions/sagas/model.test.d.ts +0 -1
- package/dist/redux/actions/sagas/model.test.js +0 -11
- package/dist/redux/actions/user.test.d.ts +0 -1
- package/dist/redux/actions/user.test.js +0 -16
- package/dist/redux/listeners/subscriber.test.d.ts +0 -1
- package/dist/redux/listeners/subscriber.test.js +0 -31
- package/dist/redux/middlewares/conditionsWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/conditionsWatcherMiddleware.test.js +0 -330
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.test.js +0 -242
- package/dist/redux/middlewares/multiplesActionsMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/multiplesActionsMiddleware.test.js +0 -209
- package/dist/redux/middlewares/prefillerWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/prefillerWatcherMiddleware.test.js +0 -84
- package/dist/redux/reducers/app/instance.test.d.ts +0 -1
- package/dist/redux/reducers/app/instance.test.js +0 -75
- package/dist/redux/reducers/app/meta.test.d.ts +0 -1
- package/dist/redux/reducers/app/meta.test.js +0 -70
- package/dist/redux/reducers/app/pagination.test.d.ts +0 -1
- package/dist/redux/reducers/app/pagination.test.js +0 -134
- package/dist/redux/reducers/app/wizard.test.d.ts +0 -1
- package/dist/redux/reducers/app/wizard.test.js +0 -53
- package/dist/redux/reducers/app.test.d.ts +0 -1
- package/dist/redux/reducers/app.test.js +0 -175
- package/dist/redux/reducers/conditions/addMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/addMultipleOccurency.test.js +0 -108
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.test.js +0 -77
- package/dist/redux/reducers/conditions/updateDocumentConditions.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateDocumentConditions.test.js +0 -35
- package/dist/redux/reducers/conditions/updateOptionValidatorCondition.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateOptionValidatorCondition.test.js +0 -35
- package/dist/redux/reducers/conditions/updateVariableValidatorCondition.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateVariableValidatorCondition.test.js +0 -35
- package/dist/redux/reducers/conditions.test.d.ts +0 -1
- package/dist/redux/reducers/conditions.test.js +0 -196
- package/dist/redux/reducers/inputs/addMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/inputs/addMultipleOccurency.test.js +0 -101
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.test.js +0 -56
- package/dist/redux/reducers/inputs.test.d.ts +0 -1
- package/dist/redux/reducers/inputs.test.js +0 -171
- package/dist/redux/reducers/user.test.d.ts +0 -1
- package/dist/redux/reducers/user.test.js +0 -42
- package/dist/redux/routerHistore.test.d.ts +0 -1
- package/dist/redux/routerHistore.test.js +0 -15
- package/dist/redux/sagas/fetchModel.test.d.ts +0 -1
- package/dist/redux/sagas/fetchModel.test.js +0 -127
- package/dist/redux/sagas/runner.test.d.ts +0 -1
- package/dist/redux/sagas/runner.test.js +0 -10
- package/dist/redux/sagas/saveData.test.d.ts +0 -1
- package/dist/redux/sagas/saveData.test.js +0 -74
- package/dist/redux/sagas/setDefaults.test.d.ts +0 -1
- package/dist/redux/sagas/setDefaults.test.js +0 -73
- package/dist/redux/selectors/app.test.d.ts +0 -1
- package/dist/redux/selectors/app.test.js +0 -99
- package/dist/redux/selectors/conditions.test.d.ts +0 -1
- package/dist/redux/selectors/conditions.test.js +0 -70
- package/dist/redux/selectors/inputs.test.d.ts +0 -1
- package/dist/redux/selectors/inputs.test.js +0 -44
- package/dist/redux/selectors/references.test.d.ts +0 -1
- package/dist/redux/selectors/references.test.js +0 -471
- package/dist/redux/selectors/selectors.test.d.ts +0 -1
- package/dist/redux/selectors/selectors.test.js +0 -16
- package/dist/redux/selectors/user.test.d.ts +0 -1
- package/dist/redux/selectors/user.test.js +0 -29
- package/dist/redux/store.test.d.ts +0 -1
- package/dist/redux/store.test.js +0 -16
- /package/dist/{App.test.d.ts → routing/types.js} +0 -0
package/dist/PluginLoader.js
CHANGED
|
@@ -1,253 +1,116 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
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
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
2
|
import React from "react";
|
|
12
|
-
import PropTypes from "prop-types";
|
|
13
|
-
import { getConfig } from "./config";
|
|
14
3
|
import { getStore } from "./redux/store";
|
|
15
|
-
import { getHistory } from "./redux/routerHistory";
|
|
16
|
-
import Globals from "./Globals";
|
|
17
|
-
import { INIT_PLUGINS } from "./redux/constants/app";
|
|
18
|
-
let globalAnchors = {};
|
|
19
|
-
let reduxAnchors = {};
|
|
20
|
-
let actionOverrideAnchor = {};
|
|
21
|
-
let replacers = {};
|
|
22
4
|
let pluginsStoreReducers = {};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export const getPluginsStoreSagas = () => pluginsStoreSagas;
|
|
26
|
-
let PluginsAppStatesRegistrers = [];
|
|
27
|
-
let PluginsPageAppStates = {};
|
|
28
|
-
let PluginsAppStatesComponents = {};
|
|
29
|
-
let PluginAdditionRoutes = {};
|
|
30
|
-
const pluginAppStates = (declaration) => {
|
|
31
|
-
PluginsAppStatesRegistrers.push(declaration.register);
|
|
32
|
-
if (typeof declaration.pageAppState === "object")
|
|
33
|
-
Object.keys(declaration.pageAppState).forEach((appState) => {
|
|
34
|
-
if (typeof declaration.pageAppState[appState] === "string") {
|
|
35
|
-
const page = declaration.pageAppState[appState];
|
|
36
|
-
if (Object.prototype.hasOwnProperty.call(PluginsPageAppStates, appState)) {
|
|
37
|
-
throw new Error(`Plugins AppState "${appState}" already declared.`);
|
|
38
|
-
}
|
|
39
|
-
const samePageAppStates = Object.keys(PluginsPageAppStates).filter((currentAppState) => PluginsPageAppStates[currentAppState] === page);
|
|
40
|
-
if (samePageAppStates.length > 0)
|
|
41
|
-
throw new Error(`Plugins AppState page "${page}" already declared.`);
|
|
42
|
-
PluginsPageAppStates[appState] = page;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
Object.keys(declaration.components).forEach((appState) => {
|
|
46
|
-
if (Object.prototype.hasOwnProperty.call(declaration, appState) === true)
|
|
47
|
-
throw new Error(`Plugin's appState ${appState} already declared previously`);
|
|
48
|
-
PluginsAppStatesComponents[appState] = declaration.components[appState];
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
export const registerPluginsAppStates = (currentAppStates) => {
|
|
52
|
-
let appStates = [...currentAppStates];
|
|
53
|
-
PluginsAppStatesRegistrers.forEach((register) => {
|
|
54
|
-
appStates = register(appStates);
|
|
55
|
-
});
|
|
56
|
-
return appStates;
|
|
57
|
-
};
|
|
58
|
-
export const loadPluginComponent = (name) => {
|
|
59
|
-
if (Object.prototype.hasOwnProperty.call(PluginsAppStatesComponents, name) ===
|
|
60
|
-
false) {
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
return PluginsAppStatesComponents[name];
|
|
64
|
-
};
|
|
65
|
-
export const pluginPageAppState = (page) => {
|
|
66
|
-
const appStates = Object.keys(PluginsPageAppStates).filter((appState) => PluginsPageAppStates[appState] === page);
|
|
67
|
-
if (appStates.length === 1)
|
|
68
|
-
return appStates[0];
|
|
69
|
-
if (appStates.length > 1)
|
|
70
|
-
throw new Error("Found multipled appStates when checking for plugins page name");
|
|
71
|
-
return false;
|
|
72
|
-
};
|
|
73
|
-
export const getPluginsPageAppStates = () => PluginsPageAppStates;
|
|
74
|
-
const loadPluginFiles = (pluginsList) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
const plugins = Object.keys(pluginsList);
|
|
76
|
-
const pluginModules = yield Promise.all(plugins.map((plugin) => Globals.loadPlugin(plugin)));
|
|
77
|
-
plugins.forEach((plugin, index) => {
|
|
78
|
-
const pluginModule = pluginModules[index];
|
|
79
|
-
const anchors = pluginModule.default;
|
|
80
|
-
const { loader } = pluginModule;
|
|
81
|
-
if (loader !== undefined) {
|
|
82
|
-
loader(getStore().dispatch, getHistory(), getConfig());
|
|
83
|
-
}
|
|
84
|
-
Object.keys(anchors).forEach((anchor) => {
|
|
85
|
-
if (anchor === "replace") {
|
|
86
|
-
Object.keys(anchors[anchor]).forEach((replacer) => {
|
|
87
|
-
if (!Object.prototype.hasOwnProperty.call(replacers, replacer)) {
|
|
88
|
-
replacers[replacer] = [];
|
|
89
|
-
}
|
|
90
|
-
replacers[replacer].push(anchors[anchor][replacer]);
|
|
91
|
-
});
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (anchor === "appstates") {
|
|
95
|
-
pluginAppStates(anchors.appstates);
|
|
96
|
-
}
|
|
97
|
-
if (anchor === "redux") {
|
|
98
|
-
Object.keys(anchors[anchor]).forEach((action) => {
|
|
99
|
-
if (reduxAnchors[action] === undefined)
|
|
100
|
-
reduxAnchors[action] = [];
|
|
101
|
-
reduxAnchors[action].push(anchors[anchor][action]);
|
|
102
|
-
});
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (anchor === "actionOverride") {
|
|
106
|
-
Object.keys(anchors[anchor]).forEach((action) => {
|
|
107
|
-
if (actionOverrideAnchor[action] === undefined)
|
|
108
|
-
actionOverrideAnchor[action] = [];
|
|
109
|
-
actionOverrideAnchor[action].push(anchors[anchor][action]);
|
|
110
|
-
});
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if (anchor === "additionalRoutes") {
|
|
114
|
-
Object.keys(anchors[anchor]).forEach((route) => {
|
|
115
|
-
PluginAdditionRoutes[anchors[anchor][route].path] =
|
|
116
|
-
anchors[anchor][route].component;
|
|
117
|
-
});
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (anchor === "reduxStore" && anchors[anchor].reducer) {
|
|
121
|
-
pluginsStoreReducers[plugin] = anchors[anchor].reducer;
|
|
122
|
-
}
|
|
123
|
-
if (anchor === "reduxStore" && anchors[anchor].sagas) {
|
|
124
|
-
pluginsStoreSagas[plugin] = anchors[anchor].sagas;
|
|
125
|
-
}
|
|
126
|
-
if (!Object.prototype.hasOwnProperty.call(globalAnchors, anchor))
|
|
127
|
-
globalAnchors[anchor] = [];
|
|
128
|
-
globalAnchors[anchor].push(anchors[anchor]);
|
|
129
|
-
});
|
|
130
|
-
if (typeof anchors.onLoad === "function")
|
|
131
|
-
anchors.onLoad();
|
|
132
|
-
});
|
|
133
|
-
if (Object.keys(pluginsStoreReducers).length > 0 ||
|
|
134
|
-
Object.keys(pluginsStoreSagas).length > 0) {
|
|
135
|
-
getStore().dispatch({ type: INIT_PLUGINS });
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
let pluginsLoadingDone = false;
|
|
139
|
-
export const loadPlugins = (plugins) => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
-
let pluginsList;
|
|
141
|
-
if (!plugins)
|
|
142
|
-
pluginsList = getConfig().plugins;
|
|
143
|
-
else
|
|
144
|
-
pluginsList = plugins;
|
|
145
|
-
if (pluginsList === undefined) {
|
|
146
|
-
pluginsList = getConfig().plugins;
|
|
147
|
-
}
|
|
148
|
-
yield loadPluginFiles(pluginsList);
|
|
149
|
-
pluginsLoadingDone = true;
|
|
150
|
-
});
|
|
151
|
-
export const pluginsLoaded = () => pluginsLoadingDone;
|
|
5
|
+
let pluginsSagas = [];
|
|
6
|
+
const replacers = {};
|
|
152
7
|
export const PluginLoader = (props) => {
|
|
153
8
|
const { anchor } = props;
|
|
154
|
-
const
|
|
9
|
+
const plugins = getStore().getState().pluginsStore;
|
|
155
10
|
let Plugins = [];
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
...Plugins,
|
|
163
|
-
...currentPlugins.map((Plugin) => (_jsx(React.Suspense, Object.assign({ fallback: null }, { children: _jsx(Plugin, Object.assign({}, props.props), void 0) }), `lpwp-${currentAnchor}-${Math.random()}`))),
|
|
164
|
-
];
|
|
11
|
+
const matchedPlugins = plugins.config.filter((p) => {
|
|
12
|
+
if (p.anchor.length !== anchor.length)
|
|
13
|
+
return false;
|
|
14
|
+
for (let i = 0; i < anchor.length; i += 1) {
|
|
15
|
+
if (p.anchor[i] !== anchor[i] && p.anchor[i] !== "*")
|
|
16
|
+
return false;
|
|
165
17
|
}
|
|
18
|
+
return true;
|
|
19
|
+
});
|
|
20
|
+
if (matchedPlugins.length > 0) {
|
|
21
|
+
Plugins = matchedPlugins.map((p, i) => (_jsx(p.component, Object.assign({}, (props.props || {})), i)));
|
|
166
22
|
}
|
|
167
|
-
|
|
168
|
-
return _jsx(_Fragment, { children: Plugins }, void 0);
|
|
169
|
-
}
|
|
170
|
-
return null;
|
|
171
|
-
};
|
|
172
|
-
PluginLoader.propTypes = {
|
|
173
|
-
anchor: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
|
|
174
|
-
props: PropTypes.object,
|
|
23
|
+
return _jsx(_Fragment, { children: Plugins });
|
|
175
24
|
};
|
|
176
|
-
PluginLoader.defaultProps = {
|
|
177
|
-
props: {},
|
|
178
|
-
};
|
|
179
|
-
let cache = {};
|
|
180
25
|
export function replaceComponent(replacerName, OriginalComponent, componentName) {
|
|
181
|
-
const displayName = componentName ||
|
|
182
|
-
OriginalComponent.displayName ||
|
|
183
|
-
OriginalComponent.name ||
|
|
184
|
-
"Component";
|
|
185
|
-
const anchorsList = !Array.isArray(replacerName)
|
|
186
|
-
? [replacerName]
|
|
187
|
-
: replacerName;
|
|
188
26
|
let Replacer = null;
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
|
|
27
|
+
const name = componentName || OriginalComponent.displayName;
|
|
28
|
+
if (Array.isArray(replacerName)) {
|
|
29
|
+
replacerName.forEach((r) => {
|
|
30
|
+
if (replacers[r])
|
|
31
|
+
Replacer = r;
|
|
32
|
+
});
|
|
192
33
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (Object.prototype.hasOwnProperty.call(replacers, currentAnchor)) {
|
|
196
|
-
Replacer = currentAnchor;
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
34
|
+
else if (replacers[replacerName]) {
|
|
35
|
+
Replacer = replacerName;
|
|
199
36
|
}
|
|
200
|
-
let FinalComponent;
|
|
201
37
|
if (Replacer !== null) {
|
|
202
|
-
const BaseComponent = (props) => (_jsx(OriginalComponent, Object.assign({}, props, { children: props.children })
|
|
38
|
+
const BaseComponent = (props) => (_jsx(OriginalComponent, Object.assign({}, props, { children: props.children })));
|
|
203
39
|
const FinalReplacedComponent = replacers[Replacer].reduce((PreviousReplacer, CurrentReplacer) => {
|
|
204
|
-
const ReplacedComponent = (props) => (_jsx(React.Suspense,
|
|
40
|
+
const ReplacedComponent = (props) => (_jsx(React.Suspense, { fallback: null, children: _jsx(CurrentReplacer, Object.assign({}, props, { OriginalComponent: PreviousReplacer, children: props.children })) }));
|
|
205
41
|
return ReplacedComponent;
|
|
206
42
|
}, BaseComponent);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
FinalComponent = OriginalComponent;
|
|
212
|
-
FinalComponent.displayName = `originalComponent(${displayName})`;
|
|
43
|
+
if (name) {
|
|
44
|
+
FinalReplacedComponent.displayName = `Replaced(${name})`;
|
|
45
|
+
}
|
|
46
|
+
return FinalReplacedComponent;
|
|
213
47
|
}
|
|
214
|
-
|
|
215
|
-
return cache[cacheKey];
|
|
48
|
+
return OriginalComponent;
|
|
216
49
|
}
|
|
217
50
|
export const ReplaceFragment = ({ replacerName, fragmentName, children, }) => {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if (Object.prototype.hasOwnProperty.call(reduxAnchors, anchor) &&
|
|
224
|
-
reduxAnchors[anchor].length > 0) {
|
|
225
|
-
reduxAnchors[anchor].forEach((currentFn) => {
|
|
226
|
-
currentFn.call(null, ...args);
|
|
51
|
+
let Replacer = null;
|
|
52
|
+
if (Array.isArray(replacerName)) {
|
|
53
|
+
replacerName.forEach((r) => {
|
|
54
|
+
if (replacers[r])
|
|
55
|
+
Replacer = r;
|
|
227
56
|
});
|
|
228
57
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
let overridedAction = action;
|
|
232
|
-
if (Object.prototype.hasOwnProperty.call(actionOverrideAnchor, action.type) &&
|
|
233
|
-
actionOverrideAnchor[action.type].length > 0) {
|
|
234
|
-
actionOverrideAnchor[action.type].forEach((currentFn) => {
|
|
235
|
-
overridedAction = currentFn.call(null, overridedAction);
|
|
236
|
-
});
|
|
58
|
+
else if (replacers[replacerName]) {
|
|
59
|
+
Replacer = replacerName;
|
|
237
60
|
}
|
|
238
|
-
|
|
61
|
+
if (Replacer !== null) {
|
|
62
|
+
const Fragment = (props) => _jsx(_Fragment, { children: props.children });
|
|
63
|
+
const FinalReplacedComponent = replacers[Replacer].reduce((PreviousReplacer, CurrentReplacer) => {
|
|
64
|
+
const ReplacedComponent = (props) => (_jsx(React.Suspense, { fallback: null, children: _jsx(CurrentReplacer, Object.assign({}, props, { OriginalComponent: PreviousReplacer, children: props.children })) }));
|
|
65
|
+
return ReplacedComponent;
|
|
66
|
+
}, Fragment);
|
|
67
|
+
if (fragmentName) {
|
|
68
|
+
FinalReplacedComponent.displayName = `Replaced(${fragmentName})`;
|
|
69
|
+
}
|
|
70
|
+
return _jsx(FinalReplacedComponent, { children: children });
|
|
71
|
+
}
|
|
72
|
+
return _jsx(_Fragment, { children: children });
|
|
73
|
+
};
|
|
74
|
+
export function registerReplacer(replacerName, Replacer) {
|
|
75
|
+
if (!replacers[replacerName])
|
|
76
|
+
replacers[replacerName] = [];
|
|
77
|
+
replacers[replacerName].push(Replacer);
|
|
78
|
+
}
|
|
79
|
+
export function loadPlugins(plugins) {
|
|
80
|
+
const promises = [];
|
|
81
|
+
const store = getStore();
|
|
82
|
+
Object.keys(plugins).forEach((key) => {
|
|
83
|
+
promises.push(plugins[key]().then((plugin) => {
|
|
84
|
+
if (plugin.redux) {
|
|
85
|
+
pluginsStoreReducers = Object.assign(Object.assign({}, pluginsStoreReducers), { [key]: plugin.redux.reducer });
|
|
86
|
+
pluginsSagas = [...pluginsSagas, ...plugin.redux.sagas];
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
});
|
|
90
|
+
return Promise.all(promises);
|
|
91
|
+
}
|
|
92
|
+
export function getPluginsReducers() {
|
|
93
|
+
return pluginsStoreReducers;
|
|
239
94
|
}
|
|
240
|
-
export
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
95
|
+
export function getPluginsAdditionalRoutes() {
|
|
96
|
+
const routes = [];
|
|
97
|
+
const plugins = getStore().getState().pluginsStore;
|
|
98
|
+
plugins.config.forEach((p) => {
|
|
99
|
+
if (p.anchor[0] === "routes") {
|
|
100
|
+
routes.push(p);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return routes;
|
|
104
|
+
}
|
|
105
|
+
export function getPluginsSagas() {
|
|
106
|
+
return pluginsSagas;
|
|
107
|
+
}
|
|
108
|
+
export function clearPlugins() {
|
|
252
109
|
pluginsStoreReducers = {};
|
|
253
|
-
|
|
110
|
+
pluginsSagas = [];
|
|
111
|
+
}
|
|
112
|
+
export const RunActionAnchor = () => { };
|
|
113
|
+
export const RunOverrideActionAnchor = () => { };
|
|
114
|
+
export const registerPluginsAppStates = () => { };
|
|
115
|
+
export const getPluginsStoreReducers = getPluginsReducers;
|
|
116
|
+
export const getPluginsStoreSagas = getPluginsSagas;
|
package/dist/Shimmer.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { StateType } from "./types/State.type";
|
|
2
3
|
declare const _default: import("react-redux").ConnectedComponent<React.FC<{
|
|
3
|
-
fetchStatus: "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
raw: string;
|
|
7
|
-
} | undefined;
|
|
4
|
+
fetchStatus: StateType.App.Meta["fetchStatus"];
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
report: StateType.App.Meta["report"];
|
|
8
7
|
}>, import("react-redux").Omit<{
|
|
9
|
-
fetchStatus: "
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} | undefined;
|
|
14
|
-
}, "fetchStatus" | "report">>;
|
|
8
|
+
fetchStatus: StateType.App.Meta["fetchStatus"];
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
report: StateType.App.Meta["report"];
|
|
11
|
+
}, "children" | "fetchStatus" | "report">>;
|
|
15
12
|
export default _default;
|
package/dist/Shimmer.js
CHANGED
|
@@ -9,7 +9,7 @@ const Shimmer = (props) => {
|
|
|
9
9
|
const [themeLoaded, setThemeloaded] = useState(false);
|
|
10
10
|
if (props.fetchStatus === "succeeded" ||
|
|
11
11
|
props.fetchStatus === "nonBlocking") {
|
|
12
|
-
return _jsx(_Fragment, { children: props.children }
|
|
12
|
+
return _jsx(_Fragment, { children: props.children });
|
|
13
13
|
}
|
|
14
14
|
addOnThemeLoadCallback(() => {
|
|
15
15
|
if (!themeLoaded)
|
|
@@ -48,10 +48,10 @@ const Shimmer = (props) => {
|
|
|
48
48
|
borderRadius: "4px",
|
|
49
49
|
};
|
|
50
50
|
if (ThemeShimmer !== null && props.fetchStatus === "waiting") {
|
|
51
|
-
return _jsx(ThemeShimmer, {}
|
|
51
|
+
return _jsx(ThemeShimmer, {});
|
|
52
52
|
}
|
|
53
|
-
return (_jsxs(_Fragment, { children: [["waiting", "failed"].includes(props.fetchStatus) && (_jsxs("div",
|
|
54
|
-
"Une erreur a eu lieu pendant le chargement du questionnaire"] })
|
|
53
|
+
return (_jsxs(_Fragment, { children: [["waiting", "failed"].includes(props.fetchStatus) && (_jsxs("div", { style: style, children: [props.fetchStatus === "waiting" && (_jsxs("div", { className: "lds-ripple", children: [_jsx("div", {}), _jsx("div", {})] })), props.fetchStatus === "failed" &&
|
|
54
|
+
"Une erreur a eu lieu pendant le chargement du questionnaire"] })), props.fetchStatus === "userLocked" && (_jsxs(_Fragment, { children: [_jsx(PluginLoader, { anchor: ["userLockedScreen"], props: props }), _jsx(UserLockedComponent, { unhealthyStyle: unhealthyStyle })] })), props.fetchStatus === "unhealthy" && (_jsxs("div", { style: unhealthyStyle, children: ["Le mod\u00E8le semble contenir des erreurs", _jsx("pre", { style: unhealthyStylePre, children: (_a = props.report) === null || _a === void 0 ? void 0 : _a.raw })] }))] }));
|
|
55
55
|
};
|
|
56
56
|
const mapStateToProps = (state) => ({
|
|
57
57
|
fetchStatus: state.app.meta.fetchStatus === "succeeded"
|
package/dist/ThemeLoader.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
2
|
import type { IWizardParamsTheme } from "./types/config.type";
|
|
3
|
-
export declare const loadTheme: (theme?: string
|
|
3
|
+
export declare const loadTheme: (theme?: string, force?: boolean) => Promise<void>;
|
|
4
4
|
export declare const getThemeShimmer: () => React.LazyExoticComponent<React.FC<{}>> | null;
|
|
5
5
|
export declare const setWizardTheme: (theme: IWizardParamsTheme) => Promise<void>;
|
|
6
6
|
export declare const getThemeParams: () => {
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
ui?: {
|
|
9
|
-
[key: string]: any;
|
|
10
9
|
topbar: {
|
|
11
|
-
[key: string]: any;
|
|
12
10
|
previewBtn: boolean;
|
|
11
|
+
[key: string]: any;
|
|
13
12
|
};
|
|
14
|
-
} | undefined;
|
|
15
|
-
sidebar?: {
|
|
16
13
|
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
sidebar?: {
|
|
17
16
|
default: import("./types/config.type").SideBarType;
|
|
18
17
|
states: {
|
|
19
|
-
[key: string]: import("./types/config.type").SideBarType;
|
|
20
18
|
wizard?: import("./types/config.type").SideBarType;
|
|
21
19
|
email?: import("./types/config.type").SideBarType;
|
|
20
|
+
[key: string]: import("./types/config.type").SideBarType;
|
|
22
21
|
};
|
|
23
|
-
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
24
|
fonts?: any;
|
|
25
|
-
style?: Record<string, any
|
|
25
|
+
style?: Record<string, any>;
|
|
26
26
|
};
|
|
27
27
|
export declare const loadThemeComponent: (name: string) => React.LazyExoticComponent<React.FC<{}>>;
|
|
28
28
|
export declare const addOnThemeLoadCallback: (cb: () => void) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ModelV3 } from "@legalplace/models-v3-types";
|
|
3
|
+
import type { StateType } from "./types/State.type";
|
|
4
|
+
import type { IWizardParams } from "./types/config.type";
|
|
5
|
+
import type { IRouterAdapter, IWizardCoreRouterProps } from "./routing/types";
|
|
6
|
+
export interface WizardCoreProps {
|
|
7
|
+
historyType?: "browser" | "memory";
|
|
8
|
+
model?: ModelV3;
|
|
9
|
+
meta?: StateType.App.Meta;
|
|
10
|
+
instance?: StateType.App.Instance;
|
|
11
|
+
user?: StateType.User;
|
|
12
|
+
wizardParams?: IWizardParams;
|
|
13
|
+
preloadTheme?: boolean;
|
|
14
|
+
loadPlugin: (plugin: string) => Promise<any>;
|
|
15
|
+
loadTheme: (theme: string) => Promise<any>;
|
|
16
|
+
routerAdapter?: IRouterAdapter;
|
|
17
|
+
routing?: IWizardCoreRouterProps;
|
|
18
|
+
}
|
|
19
|
+
declare class WizardCore extends React.Component<WizardCoreProps, {
|
|
20
|
+
initialized: boolean;
|
|
21
|
+
}> {
|
|
22
|
+
private storeInitialized;
|
|
23
|
+
constructor(props: WizardCoreProps);
|
|
24
|
+
private initializeStore;
|
|
25
|
+
componentDidMount(): void;
|
|
26
|
+
componentWillUnmount(): void;
|
|
27
|
+
render(): import("react/jsx-runtime").JSX.Element | null;
|
|
28
|
+
}
|
|
29
|
+
export default WizardCore;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Provider } from "react-redux";
|
|
4
|
+
import { getStore, createAppStore } from "./redux/store";
|
|
5
|
+
import Globals, { setGlobals } from "./Globals";
|
|
6
|
+
import { getConfig, updateConfig } from "./config";
|
|
7
|
+
import { fetchModelPrerequisitesAction } from "./redux/actions/sagas/model";
|
|
8
|
+
import { preloadTheme } from "./helpers/preloadTheme";
|
|
9
|
+
import ViewComponent from "./components/View";
|
|
10
|
+
import PluginRoute from "./components/PluginRoute";
|
|
11
|
+
import SmartScriptComponent from "./components/SmartScript";
|
|
12
|
+
import { clearPlugins } from "./PluginLoader";
|
|
13
|
+
import { PathReader } from "./libs/PathReader";
|
|
14
|
+
import { resetStateAction } from "./redux/actions/app";
|
|
15
|
+
import { callInitDataSmartscriptAction } from "./redux";
|
|
16
|
+
import { externalPartnerRedirectUrl } from "./helpers/redirectionConfig";
|
|
17
|
+
import { autoSave } from "./helpers/autosave.helper";
|
|
18
|
+
import { NOT_FOUND_PAGE_LINK } from "./constants/links.constant";
|
|
19
|
+
import { RouterProvider } from "./routing/context";
|
|
20
|
+
const getRouteComponent = (pathname, params) => {
|
|
21
|
+
const config = getConfig();
|
|
22
|
+
if (pathname.startsWith("/p/")) {
|
|
23
|
+
const pluginPath = params.path || pathname.replace("/p/", "");
|
|
24
|
+
return {
|
|
25
|
+
component: PluginRoute,
|
|
26
|
+
props: { match: { params: { path: pluginPath } } },
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (pathname.includes("/smartscript/")) {
|
|
30
|
+
return { component: SmartScriptComponent };
|
|
31
|
+
}
|
|
32
|
+
const wizardInstanceRegex = /\/contrats\/.*\/continuer\//;
|
|
33
|
+
const wizardRegex = /\/contrats\/.*\/creer\//;
|
|
34
|
+
if (wizardInstanceRegex.test(pathname) || wizardRegex.test(pathname)) {
|
|
35
|
+
return { component: ViewComponent };
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
const RedirectHandler = ({ navigate, }) => {
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
const matchedPartner = Object.keys(externalPartnerRedirectUrl).find((partner) => window.location.origin.toLowerCase().includes(partner));
|
|
42
|
+
if (matchedPartner) {
|
|
43
|
+
window.location.href = externalPartnerRedirectUrl[matchedPartner];
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
window.location.href = NOT_FOUND_PAGE_LINK;
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
return null;
|
|
50
|
+
};
|
|
51
|
+
class WizardCore extends React.Component {
|
|
52
|
+
constructor(props) {
|
|
53
|
+
super(props);
|
|
54
|
+
this.storeInitialized = false;
|
|
55
|
+
this.state = {
|
|
56
|
+
initialized: false,
|
|
57
|
+
};
|
|
58
|
+
this.initializeStore(props);
|
|
59
|
+
}
|
|
60
|
+
initializeStore(props) {
|
|
61
|
+
var _a;
|
|
62
|
+
if (this.storeInitialized)
|
|
63
|
+
return;
|
|
64
|
+
clearPlugins();
|
|
65
|
+
const historyType = typeof props.historyType === "string" ? props.historyType : "browser";
|
|
66
|
+
const params = Object.assign(Object.assign({}, Globals), { loadTheme: props.loadTheme, loadPlugin: props.loadPlugin });
|
|
67
|
+
if (props.model) {
|
|
68
|
+
params.model = props.model;
|
|
69
|
+
}
|
|
70
|
+
if (props.meta) {
|
|
71
|
+
params.meta = props.meta;
|
|
72
|
+
}
|
|
73
|
+
if (props.instance) {
|
|
74
|
+
params.instance = props.instance;
|
|
75
|
+
}
|
|
76
|
+
if (props.user) {
|
|
77
|
+
params.user = props.user;
|
|
78
|
+
}
|
|
79
|
+
setGlobals(params);
|
|
80
|
+
if (props.wizardParams)
|
|
81
|
+
updateConfig(props.wizardParams);
|
|
82
|
+
if (props.preloadTheme && ((_a = props.wizardParams) === null || _a === void 0 ? void 0 : _a.theme.name))
|
|
83
|
+
preloadTheme(props.wizardParams.theme.name);
|
|
84
|
+
try {
|
|
85
|
+
createAppStore(historyType);
|
|
86
|
+
this.storeInitialized = true;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error("Failed to initialize store:", error);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
componentDidMount() {
|
|
93
|
+
if (!this.storeInitialized) {
|
|
94
|
+
this.initializeStore(this.props);
|
|
95
|
+
}
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
try {
|
|
98
|
+
const { dispatch, getState } = getStore();
|
|
99
|
+
const state = getState();
|
|
100
|
+
let parent = null;
|
|
101
|
+
window.addEventListener("message", ({ data, source }) => {
|
|
102
|
+
if (parent === null || data.from === "BO") {
|
|
103
|
+
parent = source;
|
|
104
|
+
}
|
|
105
|
+
if (data.from && data.from === "BO") {
|
|
106
|
+
const { variables } = data;
|
|
107
|
+
autoSave(variables, getStore());
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
dispatch(callInitDataSmartscriptAction());
|
|
111
|
+
if (!PathReader.isSmartScriptPath()) {
|
|
112
|
+
dispatch(fetchModelPrerequisitesAction(getConfig().permalink || state.app.meta.permalink, getConfig().prefix || state.app.meta.prefix || ""));
|
|
113
|
+
}
|
|
114
|
+
this.setState({ initialized: true });
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.error("Error during component mount:", error);
|
|
118
|
+
}
|
|
119
|
+
}, 0);
|
|
120
|
+
}
|
|
121
|
+
componentWillUnmount() {
|
|
122
|
+
getStore().dispatch(resetStateAction());
|
|
123
|
+
}
|
|
124
|
+
render() {
|
|
125
|
+
if (!this.storeInitialized) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const { routerAdapter, routing } = this.props;
|
|
129
|
+
try {
|
|
130
|
+
const store = getStore();
|
|
131
|
+
if (routing) {
|
|
132
|
+
const { pathname, params, navigate } = routing;
|
|
133
|
+
const routeMatch = getRouteComponent(pathname, params);
|
|
134
|
+
if (routeMatch) {
|
|
135
|
+
const RouteComponent = routeMatch.component;
|
|
136
|
+
return (_jsx(Provider, { store: store, children: _jsx(RouteComponent, Object.assign({}, (routeMatch.props || {}))) }));
|
|
137
|
+
}
|
|
138
|
+
return (_jsx(Provider, { store: store, children: _jsx(RedirectHandler, { navigate: navigate }) }));
|
|
139
|
+
}
|
|
140
|
+
if (routerAdapter) {
|
|
141
|
+
return (_jsx(Provider, { store: store, children: _jsx(RouterProvider, { adapter: routerAdapter, children: _jsx(WizardCoreContent, {}) }) }));
|
|
142
|
+
}
|
|
143
|
+
console.warn("WizardCore: No routing mechanism provided. Pass either 'routerAdapter' or 'routing' props.");
|
|
144
|
+
return (_jsx(Provider, { store: store, children: _jsx("div", { children: "No routing configured" }) }));
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.error("Error rendering WizardCore:", error);
|
|
148
|
+
return _jsx("div", { children: "Error initializing wizard. Check console for details." });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const WizardCoreContent = () => (_jsx(ViewComponent, {}));
|
|
153
|
+
export default WizardCore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as App } from "./App";
|
|
@@ -2,6 +2,6 @@ import type { RouteComponentProps } from "react-router-dom";
|
|
|
2
2
|
export interface IRouteProps {
|
|
3
3
|
path: string;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
6
|
-
declare const PluginRoute: ({ match: { params: { path }, }, }: IProps) => JSX.Element;
|
|
5
|
+
export type IProps = RouteComponentProps<IRouteProps>;
|
|
6
|
+
declare const PluginRoute: ({ match: { params: { path }, }, }: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default PluginRoute;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
11
|
import { Suspense, useCallback, useEffect, useState } from "react";
|
|
12
|
-
import { getPluginsAdditionalRoutes
|
|
12
|
+
import { getPluginsAdditionalRoutes } from "../PluginLoader";
|
|
13
13
|
import Shimmer from "../Shimmer";
|
|
14
14
|
const PluginRoute = ({ match: { params: { path }, }, }) => {
|
|
15
15
|
const [RenderComponent, setRenderComponent] = useState(null);
|
|
@@ -17,10 +17,9 @@ const PluginRoute = ({ match: { params: { path }, }, }) => {
|
|
|
17
17
|
try {
|
|
18
18
|
let routes = getPluginsAdditionalRoutes();
|
|
19
19
|
if (!routes.length) {
|
|
20
|
-
yield loadPlugins({ authentication: "1.0.0" });
|
|
21
20
|
routes = getPluginsAdditionalRoutes();
|
|
22
21
|
}
|
|
23
|
-
if (routes[routePath])
|
|
22
|
+
if (false && routes[routePath])
|
|
24
23
|
setRenderComponent(routes[routePath]);
|
|
25
24
|
}
|
|
26
25
|
catch (error) {
|
|
@@ -30,6 +29,6 @@ const PluginRoute = ({ match: { params: { path }, }, }) => {
|
|
|
30
29
|
useEffect(() => {
|
|
31
30
|
loadRouteComponent(path);
|
|
32
31
|
}, [path, loadRouteComponent]);
|
|
33
|
-
return (_jsx(Suspense,
|
|
32
|
+
return (_jsx(Suspense, { fallback: _jsx(Shimmer, {}), children: _jsx(_Fragment, { children: RenderComponent && _jsx(RenderComponent, {}) }) }));
|
|
34
33
|
};
|
|
35
34
|
export default PluginRoute;
|