@legalplace/wizardx-core 4.42.10-nightly.20251125120616 → 4.42.10-nightly.20251125123510

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.
@@ -16,14 +16,12 @@ export interface WizardCoreProps {
16
16
  routerAdapter?: IRouterAdapter;
17
17
  routing?: IWizardCoreRouterProps;
18
18
  }
19
- declare class WizardCore extends React.Component<WizardCoreProps, {
20
- initialized: boolean;
21
- }> {
19
+ declare class WizardCore extends React.Component<WizardCoreProps> {
22
20
  private storeInitialized;
23
21
  constructor(props: WizardCoreProps);
24
- private initializeStore;
25
22
  componentDidMount(): void;
26
23
  componentWillUnmount(): void;
24
+ private initializeStore;
27
25
  render(): import("react/jsx-runtime").JSX.Element | null;
28
26
  }
29
27
  export default WizardCore;
@@ -18,7 +18,6 @@ import { autoSave } from "./helpers/autosave.helper";
18
18
  import { NOT_FOUND_PAGE_LINK } from "./constants/links.constant";
19
19
  import { RouterProvider } from "./routing/context";
20
20
  const getRouteComponent = (pathname, params) => {
21
- const config = getConfig();
22
21
  if (pathname.startsWith("/p/")) {
23
22
  const pluginPath = params.path || pathname.replace("/p/", "");
24
23
  return {
@@ -40,23 +39,51 @@ const RedirectHandler = ({ navigate, }) => {
40
39
  React.useEffect(() => {
41
40
  const matchedPartner = Object.keys(externalPartnerRedirectUrl).find((partner) => window.location.origin.toLowerCase().includes(partner));
42
41
  if (matchedPartner) {
43
- window.location.href = externalPartnerRedirectUrl[matchedPartner];
42
+ navigate === null || navigate === void 0 ? void 0 : navigate(externalPartnerRedirectUrl[matchedPartner]);
44
43
  }
45
44
  else {
46
- window.location.href = NOT_FOUND_PAGE_LINK;
45
+ navigate === null || navigate === void 0 ? void 0 : navigate(NOT_FOUND_PAGE_LINK);
47
46
  }
48
- }, []);
47
+ }, [navigate]);
49
48
  return null;
50
49
  };
51
50
  class WizardCore extends React.Component {
52
51
  constructor(props) {
53
52
  super(props);
54
53
  this.storeInitialized = false;
55
- this.state = {
56
- initialized: false,
57
- };
58
54
  this.initializeStore(props);
59
55
  }
56
+ componentDidMount() {
57
+ if (!this.storeInitialized) {
58
+ this.initializeStore(this.props);
59
+ }
60
+ setTimeout(() => {
61
+ try {
62
+ const { dispatch, getState } = getStore();
63
+ const state = getState();
64
+ let parent = null;
65
+ window.addEventListener("message", ({ data, source }) => {
66
+ if (parent === null || data.from === "BO") {
67
+ parent = source;
68
+ }
69
+ if (data.from && data.from === "BO") {
70
+ const { variables } = data;
71
+ autoSave(variables, getStore());
72
+ }
73
+ });
74
+ dispatch(callInitDataSmartscriptAction());
75
+ if (!PathReader.isSmartScriptPath()) {
76
+ dispatch(fetchModelPrerequisitesAction(getConfig().permalink || state.app.meta.permalink, getConfig().prefix || state.app.meta.prefix || ""));
77
+ }
78
+ }
79
+ catch (error) {
80
+ console.error("Error during component mount:", error);
81
+ }
82
+ }, 0);
83
+ }
84
+ componentWillUnmount() {
85
+ getStore().dispatch(resetStateAction());
86
+ }
60
87
  initializeStore(props) {
61
88
  var _a;
62
89
  if (this.storeInitialized)
@@ -89,38 +116,6 @@ class WizardCore extends React.Component {
89
116
  console.error("Failed to initialize store:", error);
90
117
  }
91
118
  }
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
119
  render() {
125
120
  if (!this.storeInitialized) {
126
121
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.42.10-nightly.20251125120616",
3
+ "version": "4.42.10-nightly.20251125123510",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [