@legalplace/wizardx-core 4.42.10-nightly.20251125161338 → 4.42.10-nightly.20251126105226

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/README.md CHANGED
@@ -9,15 +9,9 @@ Core library for WizardX - A powerful, themeable, and extensible wizard framewor
9
9
  - 📱 **Responsive**: Mobile-first design
10
10
  - 🔄 **State Management**: Redux-based state management with sagas
11
11
  - 🎯 **Type-Safe**: Full TypeScript support
12
- - 🚀 **Multi-Router Support**: Works with React Router (CRA) and Next.js App Router
12
+ - 🚀 **React Router**: Client-side routing with React Router v5
13
13
  - 📦 **Tree-Shakeable**: Optimized bundle size
14
-
15
- ## 🆕 NEW: Multi-Router Support
16
-
17
- WizardX Core now supports multiple routing solutions! Use it with:
18
- - ✅ **React Router v5** (CRA) - Existing implementation
19
- - ✅ **Next.js 15 App Router** - New support
20
- - 🔮 Extensible to other routers (Remix, Tanstack Router, etc.)
14
+ - ⚡ **Next.js Compatible**: Works with Next.js using URL rewrites
21
15
 
22
16
  ## 📦 Installation
23
17
 
@@ -27,7 +21,7 @@ pnpm add @legalplace/wizardx-core
27
21
 
28
22
  ## 🚀 Quick Start
29
23
 
30
- ### For Create React App (existing)
24
+ ### For Create React App
31
25
 
32
26
  ```tsx
33
27
  import { App } from "@legalplace/wizardx-core";
@@ -44,25 +38,17 @@ root.render(
44
38
  );
45
39
  ```
46
40
 
47
- ### For Next.js 15 (new)
41
+ ### For Next.js (with URL Rewrite)
48
42
 
49
43
  ```tsx
44
+ // app/wizard/page.tsx
50
45
  'use client';
51
- import { WizardCore } from "@legalplace/wizardx-core";
52
- import { createNextJSAdapter } from "@legalplace/wizardx-core/routing";
53
- import { useRouter, usePathname, useSearchParams, useParams } from "next/navigation";
46
+ import { App } from "@legalplace/wizardx-core";
54
47
 
55
48
  export default function WizardPage() {
56
- const adapter = createNextJSAdapter(
57
- useRouter(),
58
- usePathname(),
59
- useSearchParams(),
60
- useParams()
61
- );
62
-
63
49
  return (
64
- <WizardCore
65
- routerAdapter={adapter}
50
+ <App
51
+ historyType="browser"
66
52
  loadPlugin={loadPlugin}
67
53
  loadTheme={loadTheme}
68
54
  wizardParams={wizardParams}
@@ -71,25 +57,20 @@ export default function WizardPage() {
71
57
  }
72
58
  ```
73
59
 
74
- ## 📚 Documentation
60
+ See [NEXTJS-INTEGRATION.md](./NEXTJS-INTEGRATION.md) for complete Next.js setup including URL rewrites.
75
61
 
76
- ### Getting Started
77
- - **[Quick Start - Next.js](./QUICK-START-NEXTJS.md)** - 5-minute setup guide for Next.js
78
- - **[Migration Guide](./MIGRATION-NEXTJS.md)** - Complete migration guide from CRA to Next.js
79
- - **[Examples](./examples/)** - Working examples and code samples
62
+ ## 📚 Documentation
80
63
 
81
- ### Architecture & Technical Details
82
- - **[Routing Guide](./README-ROUTING.md)** - In-depth routing architecture
64
+ - **[Next.js Integration](./NEXTJS-INTEGRATION.md)** - Complete guide for Next.js integration with URL rewrites
83
65
  - **[Architecture Diagram](./ARCHITECTURE-DIAGRAM.md)** - Visual architecture overview
84
- - **[Changelog - Routing](./CHANGELOG-ROUTING.md)** - Multi-router feature changelog
85
- - **[Solution Summary](./ROUTING-SOLUTION-SUMMARY.md)** - Complete solution overview
66
+ - **[Changelog](./CHANGELOG.md)** - Version history and changes
86
67
 
87
68
  ## 🎯 Core Concepts
88
69
 
89
70
  ### Components
90
71
 
91
72
  #### `App` Component
92
- The original React Router-based component. Use this for CRA applications.
73
+ The main component that uses React Router for client-side routing.
93
74
 
94
75
  ```tsx
95
76
  import { App } from "@legalplace/wizardx-core";
@@ -104,21 +85,6 @@ import { App } from "@legalplace/wizardx-core";
104
85
  />
105
86
  ```
106
87
 
107
- #### `WizardCore` Component (New)
108
- Router-agnostic component that works with any routing solution.
109
-
110
- ```tsx
111
- import { WizardCore } from "@legalplace/wizardx-core";
112
- import { createNextJSAdapter } from "@legalplace/wizardx-core/routing";
113
-
114
- <WizardCore
115
- routerAdapter={adapter} // or use 'routing' prop for manual control
116
- loadPlugin={loadPlugin}
117
- loadTheme={loadTheme}
118
- wizardParams={wizardParams}
119
- />
120
- ```
121
-
122
88
  ### Themes
123
89
 
124
90
  Themes control the visual appearance of the wizard. Load themes dynamically:
@@ -182,60 +148,11 @@ const wizardParams = {
182
148
  };
183
149
  ```
184
150
 
185
- ## 🔌 Router Adapters
186
-
187
- ### React Router Adapter
188
-
189
- ```tsx
190
- import { createReactRouterAdapter } from "@legalplace/wizardx-core/routing";
191
-
192
- const adapter = createReactRouterAdapter();
193
- ```
194
-
195
- ### Next.js Adapter
196
-
197
- ```tsx
198
- import { createNextJSAdapter } from "@legalplace/wizardx-core/routing";
199
- import { useRouter, usePathname, useSearchParams, useParams } from "next/navigation";
200
-
201
- const adapter = createNextJSAdapter(
202
- useRouter(),
203
- usePathname(),
204
- useSearchParams(),
205
- useParams()
206
- );
207
- ```
208
-
209
- ### Custom Adapter
210
-
211
- Implement the `IRouterAdapter` interface:
212
-
213
- ```tsx
214
- interface IRouterAdapter {
215
- useParams: <T = any>() => T;
216
- useNavigate: () => (path: string) => void;
217
- useLocation: () => { pathname: string; search: string };
218
- Link: ComponentType<LinkProps>;
219
- }
220
- ```
221
-
222
151
  ## 📦 Exports
223
152
 
224
153
  ```typescript
225
154
  // Components
226
155
  export { App } from "@legalplace/wizardx-core";
227
- export { WizardCore } from "@legalplace/wizardx-core";
228
-
229
- // Routing
230
- export {
231
- createReactRouterAdapter,
232
- createNextJSAdapter,
233
- RouterProvider,
234
- useRouterAdapter,
235
- useParams,
236
- useNavigate,
237
- useLocation,
238
- } from "@legalplace/wizardx-core/routing";
239
156
 
240
157
  // Configuration
241
158
  export { getConfig, updateConfig } from "@legalplace/wizardx-core";
@@ -247,6 +164,12 @@ export { getStore, createAppStore } from "@legalplace/wizardx-core";
247
164
  export { loadThemeComponent, addOnThemeLoadCallback } from "@legalplace/wizardx-core";
248
165
  export { loadPlugin, clearPlugins } from "@legalplace/wizardx-core";
249
166
 
167
+ // Connectors & Helpers
168
+ export * from "@legalplace/wizardx-core/componentsConnectors";
169
+ export * from "@legalplace/wizardx-core/helpers";
170
+ export * from "@legalplace/wizardx-core/hooks";
171
+ export * from "@legalplace/wizardx-core/types";
172
+
250
173
  // ... and many more
251
174
  ```
252
175
 
@@ -259,14 +182,8 @@ export { loadPlugin, clearPlugins } from "@legalplace/wizardx-core";
259
182
 
260
183
 
261
184
  ┌─────────────────────────────────────┐
262
- Router Adapter (Optional)
263
- React Router | Next.js | Custom
264
- └──────────────┬──────────────────────┘
265
-
266
-
267
- ┌─────────────────────────────────────┐
268
- │ WizardCore / App │
269
- │ (Business Logic Layer) │
185
+ App Component
186
+ (React Router v5)
270
187
  └──────────────┬──────────────────────┘
271
188
 
272
189
 
@@ -336,9 +253,7 @@ Full TypeScript support with exported types:
336
253
  ```typescript
337
254
  import type {
338
255
  AppProps,
339
- WizardCoreProps,
340
256
  IWizardParams,
341
- IRouterAdapter,
342
257
  StateType,
343
258
  } from "@legalplace/wizardx-core";
344
259
  ```
@@ -364,13 +279,11 @@ MIT
364
279
  ## 📞 Support
365
280
 
366
281
  For issues and questions:
367
- 1. Check the [documentation](./QUICK-START-NEXTJS.md)
368
- 2. Review [examples](./examples/)
369
- 3. Open an issue on GitLab
282
+ 1. Check the [documentation](./NEXTJS-INTEGRATION.md)
283
+ 2. Open an issue on GitLab
370
284
 
371
285
  ---
372
286
 
373
- **Version**: 4.42.9+
374
- **Last Updated**: Nov 25, 2025
375
- **Status**: ✅ Production Ready
376
- **Multi-Router Support**: ✅ Stable
287
+ **Version**: 4.43.0+
288
+ **Last Updated**: Nov 26, 2025
289
+ **Status**: ✅ Production Ready
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 (_jsxs(Provider, { store: getStore(), children: [_jsx("h1", { children: "IAM APP" }), _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 }))] }) })] }));
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;
@@ -108,10 +108,22 @@ export function loadPlugins(plugins) {
108
108
  return;
109
109
  }
110
110
  promises.push(pluginPromise.then((plugin) => {
111
- if (plugin && plugin.redux) {
111
+ if (!plugin)
112
+ return;
113
+ if (plugin.redux) {
112
114
  pluginsStoreReducers = Object.assign(Object.assign({}, pluginsStoreReducers), { [key]: plugin.redux.reducer });
113
115
  pluginsSagas = [...pluginsSagas, ...plugin.redux.sagas];
114
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
+ }
115
127
  }).catch((error) => {
116
128
  console.error(`Failed to load plugin "${key}":`, error);
117
129
  }));
@@ -139,6 +151,15 @@ export function getPluginsSagas() {
139
151
  export function clearPlugins() {
140
152
  pluginsStoreReducers = {};
141
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
+ }
142
163
  }
143
164
  export const RunActionAnchor = () => { };
144
165
  export const RunOverrideActionAnchor = () => { };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  export { default as App } from "./App";
2
2
  export * from "./App";
3
- export { default as WizardCore } from "./WizardCore";
4
- export * from "./WizardCore";
5
- export * from "./routing";
6
3
  export * from "./config";
7
4
  export * from "./Globals";
8
5
  export * from "./PluginLoader";
package/dist/index.js CHANGED
@@ -1,8 +1,5 @@
1
1
  export { default as App } from "./App";
2
2
  export * from "./App";
3
- export { default as WizardCore } from "./WizardCore";
4
- export * from "./WizardCore";
5
- export * from "./routing";
6
3
  export * from "./config";
7
4
  export * from "./Globals";
8
5
  export * from "./PluginLoader";
@@ -6,6 +6,9 @@ const initialState = {
6
6
  export const pluginsStoreReducer = (state = initialState, action) => {
7
7
  if (action.type === RESET_STATE)
8
8
  return initialState;
9
+ if (action.type === "@@PLUGIN/ADD_CONFIG") {
10
+ return Object.assign(Object.assign({}, state), { config: action.payload.config });
11
+ }
9
12
  const pluginsStoreReducers = getPluginsStoreReducers();
10
13
  const plugins = Object.keys(pluginsStoreReducers);
11
14
  const newState = Object.assign({}, state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.42.10-nightly.20251125161338",
3
+ "version": "4.42.10-nightly.20251126105226",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -23,18 +23,6 @@
23
23
  "require": "./dist/App.js",
24
24
  "default": "./dist/App.js"
25
25
  },
26
- "./WizardCore": {
27
- "types": "./dist/WizardCore.d.ts",
28
- "import": "./dist/WizardCore.js",
29
- "require": "./dist/WizardCore.js",
30
- "default": "./dist/WizardCore.js"
31
- },
32
- "./routing": {
33
- "types": "./dist/routing/index.d.ts",
34
- "import": "./dist/routing/index.js",
35
- "require": "./dist/routing/index.js",
36
- "default": "./dist/routing/index.js"
37
- },
38
26
  "./package.json": "./package.json"
39
27
  },
40
28
  "scripts": {
@@ -1,27 +0,0 @@
1
- import React from "react";
2
- import type { ModelV3 } from "@legalplace/models-v3-types";
3
- import type { StateType } from "./types/State.type";
4
- import type { IWizardParams } from "./types/config.type";
5
- import type { IRouterAdapter, IWizardCoreRouterProps } from "./routing/types";
6
- export interface WizardCoreProps {
7
- historyType?: "browser" | "memory";
8
- model?: ModelV3;
9
- meta?: StateType.App.Meta;
10
- instance?: StateType.App.Instance;
11
- user?: StateType.User;
12
- wizardParams?: IWizardParams;
13
- preloadTheme?: boolean;
14
- loadPlugin: (plugin: string) => Promise<any>;
15
- loadTheme: (theme: string) => Promise<any>;
16
- routerAdapter?: IRouterAdapter;
17
- routing?: IWizardCoreRouterProps;
18
- }
19
- declare class WizardCore extends React.Component<WizardCoreProps> {
20
- private storeInitialized;
21
- constructor(props: WizardCoreProps);
22
- componentDidMount(): void;
23
- componentWillUnmount(): void;
24
- private initializeStore;
25
- render(): import("react/jsx-runtime").JSX.Element | null;
26
- }
27
- export default WizardCore;
@@ -1,149 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from "react";
3
- import { Provider } from "react-redux";
4
- import { getStore, createAppStore } from "./redux/store";
5
- import Globals, { setGlobals } from "./Globals";
6
- import { getConfig, updateConfig } from "./config";
7
- import { fetchModelPrerequisitesAction } from "./redux/actions/sagas/model";
8
- import { preloadTheme } from "./helpers/preloadTheme";
9
- import ViewComponent from "./components/View";
10
- import PluginRoute from "./components/PluginRoute";
11
- import SmartScriptComponent from "./components/SmartScript";
12
- import { clearPlugins } from "./PluginLoader";
13
- import { PathReader } from "./libs/PathReader";
14
- import { resetStateAction } from "./redux/actions/app";
15
- import { callInitDataSmartscriptAction } from "./redux";
16
- import { externalPartnerRedirectUrl } from "./helpers/redirectionConfig";
17
- import { autoSave } from "./helpers/autosave.helper";
18
- import { NOT_FOUND_PAGE_LINK } from "./constants/links.constant";
19
- import { RouterProvider } from "./routing/context";
20
- const getRouteComponent = (pathname, params) => {
21
- if (pathname.startsWith("/p/")) {
22
- const pluginPath = params.path || pathname.replace("/p/", "");
23
- return {
24
- component: PluginRoute,
25
- props: { match: { params: { path: pluginPath } } },
26
- };
27
- }
28
- if (pathname.includes("/smartscript/")) {
29
- return { component: SmartScriptComponent };
30
- }
31
- const wizardInstanceRegex = /\/contrats\/.*\/continuer\//;
32
- const wizardRegex = /\/contrats\/.*\/creer\//;
33
- if (wizardInstanceRegex.test(pathname) || wizardRegex.test(pathname)) {
34
- return { component: ViewComponent };
35
- }
36
- return null;
37
- };
38
- const RedirectHandler = ({ navigate, }) => {
39
- React.useEffect(() => {
40
- const matchedPartner = Object.keys(externalPartnerRedirectUrl).find((partner) => window.location.origin.toLowerCase().includes(partner));
41
- if (matchedPartner) {
42
- navigate === null || navigate === void 0 ? void 0 : navigate(externalPartnerRedirectUrl[matchedPartner]);
43
- }
44
- else {
45
- navigate === null || navigate === void 0 ? void 0 : navigate(NOT_FOUND_PAGE_LINK);
46
- }
47
- }, [navigate]);
48
- return null;
49
- };
50
- class WizardCore extends React.Component {
51
- constructor(props) {
52
- super(props);
53
- this.storeInitialized = false;
54
- this.initializeStore(props);
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
- }
87
- initializeStore(props) {
88
- var _a;
89
- if (this.storeInitialized)
90
- return;
91
- clearPlugins();
92
- const historyType = typeof props.historyType === "string" ? props.historyType : "browser";
93
- const params = Object.assign(Object.assign({}, Globals), { loadTheme: props.loadTheme, loadPlugin: props.loadPlugin });
94
- if (props.model) {
95
- params.model = props.model;
96
- }
97
- if (props.meta) {
98
- params.meta = props.meta;
99
- }
100
- if (props.instance) {
101
- params.instance = props.instance;
102
- }
103
- if (props.user) {
104
- params.user = props.user;
105
- }
106
- setGlobals(params);
107
- if (props.wizardParams)
108
- updateConfig(props.wizardParams);
109
- if (props.preloadTheme && ((_a = props.wizardParams) === null || _a === void 0 ? void 0 : _a.theme.name))
110
- preloadTheme(props.wizardParams.theme.name);
111
- try {
112
- createAppStore(historyType);
113
- console.log("Store initialized");
114
- this.storeInitialized = true;
115
- }
116
- catch (error) {
117
- console.error("Failed to initialize store:", error);
118
- }
119
- }
120
- render() {
121
- if (!this.storeInitialized) {
122
- return null;
123
- }
124
- const { routerAdapter, routing } = this.props;
125
- try {
126
- const store = getStore();
127
- if (routing) {
128
- const { pathname, params, navigate } = routing;
129
- const routeMatch = getRouteComponent(pathname, params);
130
- if (routeMatch) {
131
- const RouteComponent = routeMatch.component;
132
- return (_jsx(Provider, { store: store, children: _jsx(RouteComponent, Object.assign({}, (routeMatch.props || {}))) }));
133
- }
134
- return (_jsx(Provider, { store: store, children: _jsx(RedirectHandler, { navigate: navigate }) }));
135
- }
136
- if (routerAdapter) {
137
- return (_jsx(Provider, { store: store, children: _jsx(RouterProvider, { adapter: routerAdapter, children: _jsx(WizardCoreContent, {}) }) }));
138
- }
139
- console.warn("WizardCore: No routing mechanism provided. Pass either 'routerAdapter' or 'routing' props.");
140
- return (_jsx(Provider, { store: store, children: _jsx("div", { children: "No routing configured" }) }));
141
- }
142
- catch (error) {
143
- console.error("Error rendering WizardCore:", error);
144
- return _jsx("div", { children: "Error initializing wizard. Check console for details." });
145
- }
146
- }
147
- }
148
- const WizardCoreContent = () => (_jsx(ViewComponent, {}));
149
- export default WizardCore;
@@ -1,3 +0,0 @@
1
- import type { IRouterAdapter } from "../types";
2
- export declare const createNextJSAdapter: (router: any, pathname: string, searchParams: URLSearchParams | null, params: Record<string, string | string[]>) => IRouterAdapter;
3
- export declare const useNextJSAdapter: () => IRouterAdapter;
@@ -1,61 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { useMemo } from "react";
14
- export const createNextJSAdapter = (router, pathname, searchParams, params) => {
15
- const normalizedParams = useMemo(() => {
16
- const normalized = {};
17
- Object.entries(params).forEach(([key, value]) => {
18
- normalized[key] = Array.isArray(value) ? value[0] : value;
19
- });
20
- return normalized;
21
- }, [params]);
22
- return {
23
- useParams: () => normalizedParams,
24
- useNavigate: () => (path) => {
25
- if (router === null || router === void 0 ? void 0 : router.push) {
26
- router.push(path);
27
- }
28
- },
29
- useLocation: () => ({
30
- pathname,
31
- search: searchParams ? `?${searchParams.toString()}` : "",
32
- }),
33
- Link: (_a) => {
34
- var { to, children } = _a, props = __rest(_a, ["to", "children"]);
35
- return (_jsx("a", Object.assign({ href: to, onClick: (e) => {
36
- e.preventDefault();
37
- if (router === null || router === void 0 ? void 0 : router.push) {
38
- router.push(to);
39
- }
40
- } }, props, { children: children })));
41
- },
42
- };
43
- };
44
- export const useNextJSAdapter = () => {
45
- const params = {};
46
- const pathname = "";
47
- return {
48
- useParams: () => params,
49
- useNavigate: () => (path) => {
50
- console.warn("useNextJSAdapter: Navigation not available. Use createNextJSAdapter with Next.js router instead.");
51
- },
52
- useLocation: () => ({
53
- pathname,
54
- search: "",
55
- }),
56
- Link: (_a) => {
57
- var { to, children } = _a, props = __rest(_a, ["to", "children"]);
58
- return (_jsx("a", Object.assign({ href: to }, props, { children: children })));
59
- },
60
- };
61
- };
@@ -1,2 +0,0 @@
1
- import type { IRouterAdapter } from "../types";
2
- export declare const createReactRouterAdapter: () => IRouterAdapter;
@@ -1,16 +0,0 @@
1
- import { useParams as useParamsRR, useHistory, useLocation as useLocationRR, Link as LinkRR, } from "react-router-dom";
2
- export const createReactRouterAdapter = () => ({
3
- useParams: () => useParamsRR(),
4
- useNavigate: () => {
5
- const history = useHistory();
6
- return (path) => history.push(path);
7
- },
8
- useLocation: () => {
9
- const location = useLocationRR();
10
- return {
11
- pathname: location.pathname,
12
- search: location.search,
13
- };
14
- },
15
- Link: LinkRR,
16
- });
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import type { IRouterAdapter } from "./types";
3
- export interface RouterProviderProps {
4
- adapter: IRouterAdapter;
5
- children: React.ReactNode;
6
- }
7
- export declare const RouterProvider: React.FC<RouterProviderProps>;
8
- export declare const useRouterAdapter: () => IRouterAdapter;
9
- export declare const useParams: <T = any>() => T;
10
- export declare const useNavigate: () => (path: string) => void;
11
- export declare const useLocation: () => {
12
- pathname: string;
13
- search: string;
14
- };
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
3
- const RouterContext = createContext(null);
4
- export const RouterProvider = ({ adapter, children, }) => (_jsx(RouterContext.Provider, { value: adapter, children: children }));
5
- export const useRouterAdapter = () => {
6
- const adapter = useContext(RouterContext);
7
- if (!adapter) {
8
- throw new Error("useRouterAdapter must be used within a RouterProvider or use native react-router hooks directly");
9
- }
10
- return adapter;
11
- };
12
- export const useParams = () => {
13
- const adapter = useRouterAdapter();
14
- return adapter.useParams();
15
- };
16
- export const useNavigate = () => {
17
- const adapter = useRouterAdapter();
18
- return adapter.useNavigate();
19
- };
20
- export const useLocation = () => {
21
- const adapter = useRouterAdapter();
22
- return adapter.useLocation();
23
- };
@@ -1,4 +0,0 @@
1
- export * from "./types";
2
- export * from "./context";
3
- export { createReactRouterAdapter } from "./adapters/reactRouter.adapter";
4
- export { createNextJSAdapter, useNextJSAdapter, } from "./adapters/nextjs.adapter";
@@ -1,4 +0,0 @@
1
- export * from "./types";
2
- export * from "./context";
3
- export { createReactRouterAdapter } from "./adapters/reactRouter.adapter";
4
- export { createNextJSAdapter, useNextJSAdapter, } from "./adapters/nextjs.adapter";
@@ -1,26 +0,0 @@
1
- import type { ReactNode, ComponentType } from "react";
2
- export interface IRouterAdapter {
3
- useParams: <T = any>() => T;
4
- useNavigate: () => (path: string) => void;
5
- useLocation: () => {
6
- pathname: string;
7
- search: string;
8
- };
9
- Link: ComponentType<{
10
- to: string;
11
- children: ReactNode;
12
- [key: string]: any;
13
- }>;
14
- }
15
- export interface IRouteConfig {
16
- path: string;
17
- component: ComponentType<any>;
18
- exact?: boolean;
19
- strict?: boolean;
20
- }
21
- export interface IWizardCoreRouterProps {
22
- pathname: string;
23
- search?: string;
24
- params: Record<string, string | undefined>;
25
- navigate: (path: string) => void;
26
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export { default as WizardCore } from "./WizardCore";
2
- export type { WizardCoreProps } from "./WizardCore";
3
- export * from "./routing";
@@ -1,2 +0,0 @@
1
- export { default as WizardCore } from "./WizardCore";
2
- export * from "./routing";