@legalplace/wizardx-core 3.0.1 → 3.0.3
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
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.0.3](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.0.2...@legalplace/wizardx-core@3.0.3) (2023-02-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* avoir using state to store callback api[#7714](https://git.legalplace.eu/legalplace/monorepo/issues/7714) ([0f63471](https://git.legalplace.eu/legalplace/monorepo/commits/0f634716a5d6138178c0a93d6aa6d5a88abff39a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.0.2](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.0.1...@legalplace/wizardx-core@3.0.2) (2023-02-08)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* fix smartscrip loading api[#7714](https://git.legalplace.eu/legalplace/monorepo/issues/7714) ([7e42cba](https://git.legalplace.eu/legalplace/monorepo/commits/7e42cbac2f65d7815b069d54e8feab8f83bd5467))
|
|
23
|
+
* fix test api[#7714](https://git.legalplace.eu/legalplace/monorepo/issues/7714) ([cdd9dee](https://git.legalplace.eu/legalplace/monorepo/commits/cdd9dee1816f5f61a057bfaabf8edca589dde060))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [3.0.1](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.0.0...@legalplace/wizardx-core@3.0.1) (2023-02-08)
|
|
7
30
|
|
|
8
31
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import type { Action } from "redux";
|
|
3
2
|
import moment from "moment-business-days";
|
|
4
3
|
import { SmartScriptStore } from "../libs/SmartScriptStore";
|
|
@@ -27,13 +26,5 @@ declare global {
|
|
|
27
26
|
initTriggers: (callback: TInitTriggersCallback, inputs: StateType.Inputs, newInstance: boolean) => void;
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
declare const
|
|
31
|
-
|
|
32
|
-
uniqid: string;
|
|
33
|
-
metaFetchStatus: "failed" | "waiting" | "succeeded" | "unhealthy" | "userLocked" | "nonBlocking";
|
|
34
|
-
}>, import("react-redux").Omit<{
|
|
35
|
-
permalink: string;
|
|
36
|
-
uniqid: string;
|
|
37
|
-
metaFetchStatus: "failed" | "waiting" | "succeeded" | "unhealthy" | "userLocked" | "nonBlocking";
|
|
38
|
-
}, "permalink" | "uniqid" | "metaFetchStatus">>;
|
|
39
|
-
export default _default;
|
|
29
|
+
declare const SmartScriptComponent: () => JSX.Element;
|
|
30
|
+
export default SmartScriptComponent;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
+
import { useParams } from "react-router-dom";
|
|
3
4
|
import queryString from "query-string";
|
|
4
5
|
import moment from "moment-business-days";
|
|
5
|
-
import { connect } from "react-redux";
|
|
6
6
|
import { getConfig } from "../config";
|
|
7
7
|
import { SmartScriptStore } from "../libs/SmartScriptStore";
|
|
8
8
|
let initTriggersCallback = null;
|
|
9
|
-
const SmartScriptComponent = (
|
|
9
|
+
const SmartScriptComponent = () => {
|
|
10
10
|
const [smartScriptLoaded, setSmartScriptLoaded] = useState(false);
|
|
11
11
|
const [isNewInstance, setIsNewInstance] = useState(true);
|
|
12
12
|
window.onInit = SmartScriptStore.onInit;
|
|
@@ -27,9 +27,10 @@ const SmartScriptComponent = ({ permalink, uniqid, metaFetchStatus, }) => {
|
|
|
27
27
|
window.displayOption = SmartScriptStore.displayOption;
|
|
28
28
|
window.moment = moment;
|
|
29
29
|
const apiEndpoint = getConfig().apiEndpoint + (/\/$/.test(getConfig().apiEndpoint) ? "" : "/");
|
|
30
|
+
const { permalink, uniqid } = useParams();
|
|
30
31
|
const modelVersion = queryString.parse(window.location.search).version;
|
|
31
32
|
useEffect(() => {
|
|
32
|
-
if (
|
|
33
|
+
if (!smartScriptLoaded) {
|
|
33
34
|
const src = `${apiEndpoint}wizard/contractv1/smartscript/${permalink}${uniqid ? `/${uniqid}` : ""}${modelVersion ? `?version=${modelVersion}` : ""}`;
|
|
34
35
|
const scriptElement = document.createElement("script");
|
|
35
36
|
scriptElement.setAttribute("src", src);
|
|
@@ -53,7 +54,6 @@ const SmartScriptComponent = ({ permalink, uniqid, metaFetchStatus, }) => {
|
|
|
53
54
|
permalink,
|
|
54
55
|
uniqid,
|
|
55
56
|
isNewInstance,
|
|
56
|
-
metaFetchStatus,
|
|
57
57
|
]);
|
|
58
58
|
window.initTriggers = (callback, inputs, newInstance = true) => {
|
|
59
59
|
SmartScriptStore.inputs = inputs;
|
|
@@ -82,11 +82,6 @@ const SmartScriptComponent = ({ permalink, uniqid, metaFetchStatus, }) => {
|
|
|
82
82
|
}
|
|
83
83
|
return SmartScriptStore.grabActions();
|
|
84
84
|
};
|
|
85
|
-
return
|
|
85
|
+
return _jsx(_Fragment, { children: smartScriptLoaded ? "SmartScript" : "Loading..." }, void 0);
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
permalink: state.app.meta.permalink,
|
|
89
|
-
uniqid: state.app.instance.uniqid,
|
|
90
|
-
metaFetchStatus: state.app.meta.fetchStatus,
|
|
91
|
-
});
|
|
92
|
-
export default connect(mapStateToProps)(SmartScriptComponent);
|
|
87
|
+
export default SmartScriptComponent;
|
|
@@ -19,8 +19,10 @@ const watchEnableSmartScript = (mpi, next, action) => {
|
|
|
19
19
|
iframe = document.createElement("iframe");
|
|
20
20
|
iframe.id = "lp-smartscript";
|
|
21
21
|
iframe.setAttribute("style", "position: absolute; width:0; height:0; border:0;");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const state = mpi.getState();
|
|
23
|
+
const permalink = getConfig().permalink || state.app.meta.permalink || "";
|
|
24
|
+
const prefix = getConfig().prefix || state.app.meta.prefix || "";
|
|
25
|
+
const uniqid = getConfig().uniqid || state.app.instance.uniqid || "";
|
|
24
26
|
const { modelVersion } = new PathReader(mpi.getState());
|
|
25
27
|
if (getConfig().router.smartscriptPath) {
|
|
26
28
|
const path = generatePath(getConfig().router.smartscriptPath, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"*.test.ts",
|
|
95
95
|
"*.test.tsx"
|
|
96
96
|
],
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "c9d38c6af3b3f8b194349743c322e8b81981d635"
|
|
98
98
|
}
|