@legalplace/wizardx-core 4.22.2 → 4.23.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.
@@ -27,5 +27,9 @@ declare global {
27
27
  initTriggers: (callback: TInitTriggersCallback, inputs: StateType.Inputs, newInstance: boolean) => void;
28
28
  }
29
29
  }
30
- declare const SmartScriptComponent: () => JSX.Element;
31
- export default SmartScriptComponent;
30
+ declare const _default: import("react-redux").ConnectedComponent<({ inpiActivities }: {
31
+ inpiActivities?: never[] | undefined;
32
+ }) => JSX.Element, import("react-redux").Omit<{
33
+ inpiActivities?: never[] | undefined;
34
+ }, never>>;
35
+ export default _default;
@@ -3,11 +3,13 @@ import { useEffect, useState } from "react";
3
3
  import { useParams } from "react-router-dom";
4
4
  import queryString from "query-string";
5
5
  import moment from "moment-business-days";
6
+ import { connect } from "react-redux";
6
7
  import { getConfig } from "../config";
7
8
  import { SmartScriptStore } from "../libs/SmartScriptStore";
8
9
  import { smartScriptLoadedMessage } from "../constants/smartscript";
10
+ import { selectDataSmartscript } from "../redux";
9
11
  let initTriggersCallback = null;
10
- const SmartScriptComponent = () => {
12
+ const SmartScriptComponent = ({ inpiActivities = [] }) => {
11
13
  const [smartScriptLoaded, setSmartScriptLoaded] = useState(false);
12
14
  const [isNewInstance, setIsNewInstance] = useState(true);
13
15
  window.onInit = SmartScriptStore.onInit;
@@ -32,7 +34,7 @@ const SmartScriptComponent = () => {
32
34
  const { permalink, uniqid } = useParams();
33
35
  const modelVersion = queryString.parse(window.location.search).version;
34
36
  useEffect(() => {
35
- if (!smartScriptLoaded) {
37
+ if (inpiActivities.length && !smartScriptLoaded) {
36
38
  const src = `${apiEndpoint}wizard/contractv1/smartscript/${permalink}${uniqid ? `/${uniqid}` : ""}${modelVersion ? `?version=${modelVersion}` : ""}`;
37
39
  const scriptElement = document.createElement("script");
38
40
  scriptElement.setAttribute("src", src);
@@ -56,6 +58,7 @@ const SmartScriptComponent = () => {
56
58
  permalink,
57
59
  uniqid,
58
60
  isNewInstance,
61
+ inpiActivities,
59
62
  ]);
60
63
  useEffect(() => {
61
64
  if (smartScriptLoaded) {
@@ -91,4 +94,10 @@ const SmartScriptComponent = () => {
91
94
  };
92
95
  return _jsx(_Fragment, { children: smartScriptLoaded ? "SmartScript" : "Loading..." }, void 0);
93
96
  };
94
- export default SmartScriptComponent;
97
+ const mapStateToProps = () => {
98
+ const inpiActivities = selectDataSmartscript();
99
+ return {
100
+ inpiActivities,
101
+ };
102
+ };
103
+ export default connect(mapStateToProps, null)(SmartScriptComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.22.2",
3
+ "version": "4.23.0",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -24,7 +24,7 @@
24
24
  "@legalplace/lp-events": "1.14.0",
25
25
  "@legalplace/lplogic": "2.3.1",
26
26
  "@legalplace/model-healthcheck": "^1.1.5",
27
- "@legalplace/referencesparser": "^3.1.23",
27
+ "@legalplace/referencesparser": "^3.1.24",
28
28
  "@legalplace/storybook": "2.298.0",
29
29
  "@legalplace/typeorm-constants": "^3.38.0",
30
30
  "@loadable/component": "^5.15.0",
@@ -54,11 +54,11 @@
54
54
  "xss": "^1.0.9"
55
55
  },
56
56
  "devDependencies": {
57
- "@legalplace/data-gouv": "^1.5.31",
57
+ "@legalplace/data-gouv": "^1.5.32",
58
58
  "@legalplace/eslint-config": "^2.2.0",
59
59
  "@legalplace/models-v3-types": "^5.12.2",
60
60
  "@legalplace/prettier-config": "^2.1.3",
61
- "@legalplace/typeorm-entities": "^5.34.0",
61
+ "@legalplace/typeorm-entities": "^5.34.1",
62
62
  "@swc-node/jest": "^1.3.2",
63
63
  "@swc/core": "^1.2.93",
64
64
  "@swc/jest": "^0.2.4",
@@ -96,5 +96,5 @@
96
96
  "*.test.ts",
97
97
  "*.test.tsx"
98
98
  ],
99
- "gitHead": "44716d36d7708d5b8efe5204faeccf07ca67804e"
99
+ "gitHead": "e5b97a9f432b60158e45af86d2e8bb45d752276c"
100
100
  }