@legalplace/wizardx-core 3.2.1 → 3.3.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 +19 -0
- package/dist/PluginLoader.d.ts +6 -1
- package/dist/PluginLoader.js +6 -1
- package/dist/PluginLoader.test.js +2 -2
- package/dist/components/UserLocked/UserLockedComponent.js +2 -2
- package/dist/componentsConnectors/connectTermsheet.js +2 -2
- package/dist/componentsConnectors/connector/componentConnector.js +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
# [3.3.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.2.2...@legalplace/wizardx-core@3.3.0) (2023-03-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* wip signup page api[#7882](https://git.legalplace.eu/legalplace/monorepo/issues/7882) ([0c3b98f](https://git.legalplace.eu/legalplace/monorepo/commits/0c3b98f09f4858870765b6199eeb012ba80080fa))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.2.2](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.2.1...@legalplace/wizardx-core@3.2.2) (2023-03-22)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @legalplace/wizardx-core
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [3.2.1](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.2.0...@legalplace/wizardx-core@3.2.1) (2023-03-14)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @legalplace/wizardx-core
|
package/dist/PluginLoader.d.ts
CHANGED
|
@@ -33,7 +33,12 @@ export interface PluginLoaderProps {
|
|
|
33
33
|
export declare type ReactComponent<T> = React.ComponentClass<T> | React.FC<T>;
|
|
34
34
|
export declare type TPluginLoader<T = {}> = React.FC<T & PluginLoaderProps>;
|
|
35
35
|
export declare const PluginLoader: TPluginLoader;
|
|
36
|
-
export declare function
|
|
36
|
+
export declare function replaceComponent<T = {}>(replacerName: string | string[], OriginalComponent: ReactComponent<T>, componentName?: string): React.MemoExoticComponent<any>;
|
|
37
|
+
export declare type ReplaceFragmentPropsType = {
|
|
38
|
+
replacerName: string | string[];
|
|
39
|
+
fragmentName?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const ReplaceFragment: React.FC<ReplaceFragmentPropsType>;
|
|
37
42
|
export declare function RunActionAnchor(anchor: string, ...args: any[]): void;
|
|
38
43
|
export declare function RunOverrideActionAnchor(action: Action): Action<any>;
|
|
39
44
|
export declare const getPluginsAdditionalRoutes: () => Record<string, ReactComponent<any>>;
|
package/dist/PluginLoader.js
CHANGED
|
@@ -177,7 +177,7 @@ PluginLoader.defaultProps = {
|
|
|
177
177
|
props: {},
|
|
178
178
|
};
|
|
179
179
|
let cache = {};
|
|
180
|
-
export function
|
|
180
|
+
export function replaceComponent(replacerName, OriginalComponent, componentName) {
|
|
181
181
|
const displayName = componentName ||
|
|
182
182
|
OriginalComponent.displayName ||
|
|
183
183
|
OriginalComponent.name ||
|
|
@@ -214,6 +214,11 @@ export function ReplaceComponent(replacerName, OriginalComponent, componentName)
|
|
|
214
214
|
cache[cacheKey] = React.memo(FinalComponent);
|
|
215
215
|
return cache[cacheKey];
|
|
216
216
|
}
|
|
217
|
+
export const ReplaceFragment = ({ replacerName, fragmentName, children, }) => {
|
|
218
|
+
const Fragment = () => _jsx(_Fragment, { children: children }, void 0);
|
|
219
|
+
const FinalFragment = replaceComponent(replacerName, Fragment, `Fragment::${fragmentName}`);
|
|
220
|
+
return _jsx(FinalFragment, {}, void 0);
|
|
221
|
+
};
|
|
217
222
|
export function RunActionAnchor(anchor, ...args) {
|
|
218
223
|
if (Object.prototype.hasOwnProperty.call(reduxAnchors, anchor) &&
|
|
219
224
|
reduxAnchors[anchor].length > 0) {
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import '@testing-library/jest-dom/extend-expect';
|
|
12
12
|
import { render, waitFor } from '@testing-library/react';
|
|
13
|
-
import {
|
|
13
|
+
import { replaceComponent } from './PluginLoader';
|
|
14
14
|
jest.mock('react', () => {
|
|
15
15
|
const rct = jest.requireActual('react');
|
|
16
16
|
const Loadable = jest.requireActual('@loadable/component');
|
|
@@ -43,7 +43,7 @@ describe('<PluginLoader />', () => {
|
|
|
43
43
|
yield waitFor(() => expect(container).toContainHTML('<div></div>'));
|
|
44
44
|
}));
|
|
45
45
|
it('Loads replacement module', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
const Component =
|
|
46
|
+
const Component = replaceComponent('TitleComponent', () => {
|
|
47
47
|
return _jsx("span", { children: "Original" }, void 0);
|
|
48
48
|
});
|
|
49
49
|
const { container } = render(_jsx(Component, { children: "Replaced" }, void 0));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { replaceComponent } from "../../PluginLoader";
|
|
3
3
|
const UserLockedComponent = ({ unhealthyStyle }) => (_jsx("div", Object.assign({ style: unhealthyStyle }, { children: "Merci d\u2018avoir compl\u00E9t\u00E9 votre questionnaire ! Votre Expert-Comptable a \u00E9t\u00E9 notifi\u00E9 de vos r\u00E9ponses et vous contactera pour la suite de la proc\u00E9dure" }), void 0));
|
|
4
4
|
const UserLockHooc = (Component) => (props) => {
|
|
5
5
|
const replaceAnchors = ["UserLockedComponent"];
|
|
6
|
-
const FinalComponent =
|
|
6
|
+
const FinalComponent = replaceComponent(replaceAnchors, Component);
|
|
7
7
|
return (_jsx(_Fragment, { children: _jsx(FinalComponent, Object.assign({}, props), void 0) }, void 0));
|
|
8
8
|
};
|
|
9
9
|
export default UserLockHooc(UserLockedComponent);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { compose } from "redux";
|
|
3
3
|
import { connect } from "react-redux";
|
|
4
|
-
import { PluginLoader,
|
|
4
|
+
import { PluginLoader, replaceComponent } from "../PluginLoader";
|
|
5
5
|
import { selectAvailableSections } from "../redux/selectors/app";
|
|
6
6
|
import { selectSectionReference, selectOptionReference, selectVariableReference, } from "../redux/selectors/references";
|
|
7
7
|
import { selectOptionInput, selectVariableInputByIndex, selectOptionInputByIndex, } from "../redux/selectors/inputs";
|
|
@@ -175,7 +175,7 @@ const TermsheetHooc = (Component) => (props) => {
|
|
|
175
175
|
const beforeAnchors = ["beforeTermsheet"];
|
|
176
176
|
const afterAnchors = ["afterTermsheet"];
|
|
177
177
|
const replaceAnchors = ["Termsheet"];
|
|
178
|
-
const FinalComponent =
|
|
178
|
+
const FinalComponent = replaceComponent(replaceAnchors, Component);
|
|
179
179
|
return (_jsxs(_Fragment, { children: [_jsx(PluginLoader, { anchor: beforeAnchors, props: props }, void 0), _jsx(FinalComponent, Object.assign({}, props), void 0), _jsx(PluginLoader, { anchor: afterAnchors, props: props }, void 0)] }, void 0));
|
|
180
180
|
};
|
|
181
181
|
const mapStateToProps = (state) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
import sha1 from "@cryptography/sha1";
|
|
4
|
-
import { PluginLoader,
|
|
4
|
+
import { PluginLoader, replaceComponent } from "../../PluginLoader";
|
|
5
5
|
import { selectorsLibrary } from "../../redux/selectors/library";
|
|
6
6
|
import { actionsLibrary } from "../../redux/actions/library";
|
|
7
7
|
import { getStore } from "../../redux/store";
|
|
@@ -32,7 +32,7 @@ const PluginWrapper = (props, anchors) => {
|
|
|
32
32
|
const ConnectorHooc = (Component, componentName, additionnalHooks) => {
|
|
33
33
|
const ConnectedComponent = (props) => {
|
|
34
34
|
const { beforeAnchors, afterAnchors, replaceAnchors } = AnchorsHooks(props, componentName, additionnalHooks);
|
|
35
|
-
const FinalComponent =
|
|
35
|
+
const FinalComponent = replaceComponent(replaceAnchors, Component, componentName);
|
|
36
36
|
const BeforePlugings = PluginWrapper(props, beforeAnchors);
|
|
37
37
|
const AfterPlugings = PluginWrapper(props, afterAnchors);
|
|
38
38
|
return (_jsxs(_Fragment, { children: [_jsx(BeforePlugings, {}, void 0), _jsx(FinalComponent, Object.assign({}, props), void 0), _jsx(AfterPlugings, {}, void 0)] }, void 0));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@legalplace/lp-events": "1.14.0",
|
|
25
25
|
"@legalplace/lplogic": "^2.1.6",
|
|
26
26
|
"@legalplace/model-healthcheck": "^1.1.5",
|
|
27
|
-
"@legalplace/referencesparser": "^2.3.
|
|
27
|
+
"@legalplace/referencesparser": "^2.3.16",
|
|
28
28
|
"@legalplace/storybook": "^2.171.0",
|
|
29
|
-
"@legalplace/typeorm-constants": "^2.
|
|
29
|
+
"@legalplace/typeorm-constants": "^2.45.0",
|
|
30
30
|
"@loadable/component": "^5.15.0",
|
|
31
31
|
"@redux-saga/core": "^1.1.3",
|
|
32
32
|
"connected-react-router": "^6.8.0",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@legalplace/eslint-config": "^2.2.0",
|
|
58
|
-
"@legalplace/models-v3-types": "^4.1.
|
|
58
|
+
"@legalplace/models-v3-types": "^4.1.3",
|
|
59
59
|
"@legalplace/prettier-config": "^2.1.3",
|
|
60
|
-
"@legalplace/typeorm-entities": "^4.8.
|
|
60
|
+
"@legalplace/typeorm-entities": "^4.8.5",
|
|
61
61
|
"@swc-node/jest": "^1.3.2",
|
|
62
62
|
"@swc/core": "^1.2.93",
|
|
63
63
|
"@swc/jest": "^0.2.4",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"*.test.ts",
|
|
96
96
|
"*.test.tsx"
|
|
97
97
|
],
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "5565d47a33de2ef4a62c5f9f683778204f451f84"
|
|
99
99
|
}
|