@legalplace/wizardx-core 4.42.10-nightly.20251125161109 → 4.42.10-nightly.20251125161848
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/dist/App.js
CHANGED
|
@@ -77,7 +77,7 @@ class WizardXCore extends React.Component {
|
|
|
77
77
|
getStore().dispatch(resetStateAction());
|
|
78
78
|
}
|
|
79
79
|
render() {
|
|
80
|
-
return (
|
|
80
|
+
return (_jsx(Provider, { store: getStore(), children: _jsx(ConnectedRouter, { history: getHistory(), children: _jsxs(Switch, { children: [_jsx(Route, { path: "/p/:path", component: PluginRoute }), _jsx(Route, { path: getConfig().router.smartscriptPath, exact: true, strict: true, component: SmartScriptComponent }), _jsx(Route, { path: getConfig().router.wizardInstancePath, component: ViewComponent }), _jsx(Route, { path: getConfig().router.wizardPath, component: ViewComponent }), !window.location.href.includes("smartscript") && (_jsx(Route, { component: RedirectHandler }))] }) }) }));
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
export default WizardXCore;
|
package/dist/PluginLoader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { getStore } from "./redux/store";
|
|
4
4
|
let pluginsStoreReducers = {};
|
|
@@ -8,6 +8,9 @@ export const PluginLoader = (props) => {
|
|
|
8
8
|
const { anchor } = props;
|
|
9
9
|
const plugins = getStore().getState().pluginsStore;
|
|
10
10
|
let Plugins = [];
|
|
11
|
+
if (!plugins || !plugins.config || !Array.isArray(plugins.config)) {
|
|
12
|
+
return _jsx(_Fragment, {});
|
|
13
|
+
}
|
|
11
14
|
const matchedPlugins = plugins.config.filter((p) => {
|
|
12
15
|
if (p.anchor.length !== anchor.length)
|
|
13
16
|
return false;
|
|
@@ -105,10 +108,22 @@ export function loadPlugins(plugins) {
|
|
|
105
108
|
return;
|
|
106
109
|
}
|
|
107
110
|
promises.push(pluginPromise.then((plugin) => {
|
|
108
|
-
if (plugin
|
|
111
|
+
if (!plugin)
|
|
112
|
+
return;
|
|
113
|
+
if (plugin.redux) {
|
|
109
114
|
pluginsStoreReducers = Object.assign(Object.assign({}, pluginsStoreReducers), { [key]: plugin.redux.reducer });
|
|
110
115
|
pluginsSagas = [...pluginsSagas, ...plugin.redux.sagas];
|
|
111
116
|
}
|
|
117
|
+
if (plugin.config && Array.isArray(plugin.config)) {
|
|
118
|
+
const currentState = store.getState().pluginsStore;
|
|
119
|
+
const existingConfig = currentState.config || [];
|
|
120
|
+
store.dispatch({
|
|
121
|
+
type: "@@PLUGIN/ADD_CONFIG",
|
|
122
|
+
payload: {
|
|
123
|
+
config: [...existingConfig, ...plugin.config],
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
112
127
|
}).catch((error) => {
|
|
113
128
|
console.error(`Failed to load plugin "${key}":`, error);
|
|
114
129
|
}));
|
|
@@ -121,11 +136,13 @@ export function getPluginsReducers() {
|
|
|
121
136
|
export function getPluginsAdditionalRoutes() {
|
|
122
137
|
const routes = [];
|
|
123
138
|
const plugins = getStore().getState().pluginsStore;
|
|
124
|
-
plugins.config.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
if ((plugins === null || plugins === void 0 ? void 0 : plugins.config) && Array.isArray(plugins.config)) {
|
|
140
|
+
plugins.config.forEach((p) => {
|
|
141
|
+
if (p.anchor[0] === "routes") {
|
|
142
|
+
routes.push(p);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
129
146
|
return routes;
|
|
130
147
|
}
|
|
131
148
|
export function getPluginsSagas() {
|
|
@@ -134,6 +151,15 @@ export function getPluginsSagas() {
|
|
|
134
151
|
export function clearPlugins() {
|
|
135
152
|
pluginsStoreReducers = {};
|
|
136
153
|
pluginsSagas = [];
|
|
154
|
+
const store = getStore(false);
|
|
155
|
+
if (store) {
|
|
156
|
+
store.dispatch({
|
|
157
|
+
type: "@@PLUGIN/ADD_CONFIG",
|
|
158
|
+
payload: {
|
|
159
|
+
config: [],
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
}
|
|
137
163
|
}
|
|
138
164
|
export const RunActionAnchor = () => { };
|
|
139
165
|
export const RunOverrideActionAnchor = () => { };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { getPluginsStoreReducers } from "../../PluginLoader";
|
|
2
2
|
import { RESET_STATE } from "../constants/app";
|
|
3
|
-
|
|
3
|
+
const initialState = {
|
|
4
|
+
config: [],
|
|
5
|
+
};
|
|
6
|
+
export const pluginsStoreReducer = (state = initialState, action) => {
|
|
4
7
|
if (action.type === RESET_STATE)
|
|
5
|
-
return
|
|
8
|
+
return initialState;
|
|
9
|
+
if (action.type === "@@PLUGIN/ADD_CONFIG") {
|
|
10
|
+
return Object.assign(Object.assign({}, state), { config: action.payload.config });
|
|
11
|
+
}
|
|
6
12
|
const pluginsStoreReducers = getPluginsStoreReducers();
|
|
7
13
|
const plugins = Object.keys(pluginsStoreReducers);
|
|
8
14
|
const newState = Object.assign({}, state);
|