@legalplace/wizardx-core 4.42.9 → 4.42.10-nightly.20251125115613
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 +376 -1
- package/dist/App.d.ts +1 -6
- package/dist/App.js +2 -7
- package/dist/Loader.d.ts +1 -1
- package/dist/Loader.js +1 -1
- package/dist/PluginLoader.d.ts +21 -36
- package/dist/PluginLoader.js +90 -227
- package/dist/Shimmer.d.ts +8 -11
- package/dist/Shimmer.js +4 -4
- package/dist/ThemeLoader.d.ts +8 -8
- package/dist/WizardCore.d.ts +25 -0
- package/dist/WizardCore.js +119 -0
- package/dist/app.entry.d.ts +2 -0
- package/dist/app.entry.js +1 -0
- package/dist/components/PluginRoute.d.ts +2 -2
- package/dist/components/PluginRoute.js +3 -4
- package/dist/components/SmartScript.d.ts +2 -6
- package/dist/components/SmartScript.js +1 -1
- package/dist/components/UserLocked/UserLockedComponent.js +2 -2
- package/dist/components/View.d.ts +3 -3
- package/dist/components/View.js +5 -7
- package/dist/componentsConnectors/connectBox.d.ts +4 -6
- package/dist/componentsConnectors/connectDocument.d.ts +4 -6
- package/dist/componentsConnectors/connectHeader.d.ts +4 -6
- package/dist/componentsConnectors/connectMetaTitle.d.ts +3 -7
- package/dist/componentsConnectors/connectOption.d.ts +5 -7
- package/dist/componentsConnectors/connectPagination.d.ts +5 -7
- package/dist/componentsConnectors/connectPreview.d.ts +3 -7
- package/dist/componentsConnectors/connectProgress.d.ts +4 -6
- package/dist/componentsConnectors/connectRootOption.d.ts +5 -7
- package/dist/componentsConnectors/connectSection.d.ts +4 -6
- package/dist/componentsConnectors/connectSummary.d.ts +5 -9
- package/dist/componentsConnectors/connectSummaryItem.d.ts +4 -6
- package/dist/componentsConnectors/connectTermsheet.js +1 -1
- package/dist/componentsConnectors/connectVariable.d.ts +6 -8
- package/dist/componentsConnectors/connectWizardWrapper.d.ts +4 -6
- package/dist/componentsConnectors/connector/componentConnector.d.ts +7 -10
- package/dist/componentsConnectors/connector/componentConnector.js +3 -3
- package/dist/componentsConnectors/library.d.ts +47 -81
- package/dist/helpers/activitiesHelper.d.ts +3 -3
- package/dist/helpers/autocomplete.helper.d.ts +2 -2
- package/dist/helpers/autocomplete.helper.js +1 -1
- package/dist/helpers/autosave.helper.d.ts +3 -13
- package/dist/helpers/autosave.helper.js +3 -70
- package/dist/helpers/inpiCitiesHelper.js +1 -1
- package/dist/helpers/outputsParsing.d.ts +9 -9
- package/dist/hooks/useDispatch.d.ts +1 -1
- package/dist/hooks/usePrevious.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/libs/ConditionsRunner.d.ts +1 -1
- package/dist/libs/Formatter/FormatAddress.d.ts +1 -1
- package/dist/libs/InputsInitiator.d.ts +1 -1
- package/dist/libs/PathReader.d.ts +96 -1
- package/dist/libs/PathReader.js +1 -2
- package/dist/libs/SmartScriptStore.d.ts +6 -6
- package/dist/redux/actions/app.d.ts +1 -1
- package/dist/redux/actions/inputs.d.ts +1 -1
- package/dist/redux/actions/library.d.ts +15 -21
- package/dist/redux/actions/references.d.ts +2 -2
- package/dist/redux/actions/sagas/data.d.ts +1 -1
- package/dist/redux/actions/sagas/user.d.ts +1 -1
- package/dist/redux/listeners/subscriber.d.ts +1 -1
- package/dist/redux/middlewares/conditionsWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/multiplesActionsMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/paginationWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/pluginsHookMiddleware.d.ts +1 -2
- package/dist/redux/middlewares/pluginsHookMiddleware.js +1 -7
- package/dist/redux/middlewares/prefillerWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/smartscriptMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/smartscriptMiddleware.js +2 -2
- package/dist/redux/middlewares/thirdpartyScriptsMiddleware.d.ts +1 -1
- package/dist/redux/reducers/app/pagination/updateAvailableAppStates.js +1 -2
- package/dist/redux/reducers/app.d.ts +6 -6
- package/dist/redux/reducers/references.js +2 -0
- package/dist/redux/selectors/inputs.d.ts +1 -1
- package/dist/redux/selectors/selectors.d.ts +4 -4
- package/dist/redux/store.d.ts +2 -2
- package/dist/routing/adapters/nextjs.adapter.d.ts +3 -0
- package/dist/routing/adapters/nextjs.adapter.js +63 -0
- package/dist/routing/adapters/reactRouter.adapter.d.ts +2 -0
- package/dist/routing/adapters/reactRouter.adapter.js +19 -0
- package/dist/routing/context.d.ts +14 -0
- package/dist/routing/context.js +25 -0
- package/dist/routing/index.d.ts +4 -0
- package/dist/routing/index.js +4 -0
- package/dist/routing/types.d.ts +26 -0
- package/dist/service/api.manager.d.ts +2 -2
- package/dist/service/autocomplete.manager.d.ts +3 -3
- package/dist/service/autocomplete.manager.js +3 -3
- package/dist/tests-misc/plugins/jestTestPlugin/after.js +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/before.js +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/title.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +1 -1
- package/dist/types/Actions.type.d.ts +70 -6
- package/dist/types/Components.type.d.ts +3 -2
- package/dist/types/PluginConfig.type.d.ts +18 -52
- package/dist/types/State.type.d.ts +2 -2
- package/dist/types/config.type.d.ts +1 -1
- package/dist/types/getActions.type.d.ts +1 -1
- package/dist/types/getConnectors.type.d.ts +2 -2
- package/dist/types/getSelectors.type.d.ts +1 -1
- package/dist/wizardcore.entry.d.ts +3 -0
- package/dist/wizardcore.entry.js +2 -0
- package/package.json +40 -17
- package/dist/App.test.js +0 -37
- package/dist/PluginLoader.test.d.ts +0 -1
- package/dist/PluginLoader.test.js +0 -52
- package/dist/ThemeLoader.test.d.ts +0 -2
- package/dist/ThemeLoader.test.js +0 -65
- package/dist/components/View.test.d.ts +0 -2
- package/dist/components/View.test.js +0 -84
- package/dist/componentsConnectors/connectBox.test.d.ts +0 -1
- package/dist/componentsConnectors/connectBox.test.js +0 -218
- package/dist/componentsConnectors/connectDocument.test.d.ts +0 -1
- package/dist/componentsConnectors/connectDocument.test.js +0 -95
- package/dist/componentsConnectors/connectMetaTitle.test.d.ts +0 -1
- package/dist/componentsConnectors/connectMetaTitle.test.js +0 -32
- package/dist/config.test.d.ts +0 -1
- package/dist/config.test.js +0 -54
- package/dist/libs/NumAuto.test.d.ts +0 -1
- package/dist/libs/NumAuto.test.js +0 -43
- package/dist/libs/SectionValidity.test.d.ts +0 -1
- package/dist/libs/SectionValidity.test.js +0 -116
- package/dist/redux/actions/app.test.d.ts +0 -1
- package/dist/redux/actions/app.test.js +0 -90
- package/dist/redux/actions/conditions.test.d.ts +0 -1
- package/dist/redux/actions/conditions.test.js +0 -68
- package/dist/redux/actions/inputs.test.d.ts +0 -1
- package/dist/redux/actions/inputs.test.js +0 -53
- package/dist/redux/actions/references.test.d.ts +0 -1
- package/dist/redux/actions/references.test.js +0 -43
- package/dist/redux/actions/sagas/data.test.d.ts +0 -1
- package/dist/redux/actions/sagas/data.test.js +0 -11
- package/dist/redux/actions/sagas/model.test.d.ts +0 -1
- package/dist/redux/actions/sagas/model.test.js +0 -11
- package/dist/redux/actions/user.test.d.ts +0 -1
- package/dist/redux/actions/user.test.js +0 -16
- package/dist/redux/listeners/subscriber.test.d.ts +0 -1
- package/dist/redux/listeners/subscriber.test.js +0 -31
- package/dist/redux/middlewares/conditionsWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/conditionsWatcherMiddleware.test.js +0 -330
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.test.js +0 -242
- package/dist/redux/middlewares/multiplesActionsMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/multiplesActionsMiddleware.test.js +0 -209
- package/dist/redux/middlewares/prefillerWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/prefillerWatcherMiddleware.test.js +0 -84
- package/dist/redux/reducers/app/instance.test.d.ts +0 -1
- package/dist/redux/reducers/app/instance.test.js +0 -75
- package/dist/redux/reducers/app/meta.test.d.ts +0 -1
- package/dist/redux/reducers/app/meta.test.js +0 -70
- package/dist/redux/reducers/app/pagination.test.d.ts +0 -1
- package/dist/redux/reducers/app/pagination.test.js +0 -134
- package/dist/redux/reducers/app/wizard.test.d.ts +0 -1
- package/dist/redux/reducers/app/wizard.test.js +0 -53
- package/dist/redux/reducers/app.test.d.ts +0 -1
- package/dist/redux/reducers/app.test.js +0 -175
- package/dist/redux/reducers/conditions/addMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/addMultipleOccurency.test.js +0 -108
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.test.js +0 -77
- package/dist/redux/reducers/conditions/updateDocumentConditions.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateDocumentConditions.test.js +0 -35
- package/dist/redux/reducers/conditions/updateOptionValidatorCondition.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateOptionValidatorCondition.test.js +0 -35
- package/dist/redux/reducers/conditions/updateVariableValidatorCondition.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateVariableValidatorCondition.test.js +0 -35
- package/dist/redux/reducers/conditions.test.d.ts +0 -1
- package/dist/redux/reducers/conditions.test.js +0 -196
- package/dist/redux/reducers/inputs/addMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/inputs/addMultipleOccurency.test.js +0 -101
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.test.js +0 -56
- package/dist/redux/reducers/inputs.test.d.ts +0 -1
- package/dist/redux/reducers/inputs.test.js +0 -171
- package/dist/redux/reducers/user.test.d.ts +0 -1
- package/dist/redux/reducers/user.test.js +0 -42
- package/dist/redux/routerHistore.test.d.ts +0 -1
- package/dist/redux/routerHistore.test.js +0 -15
- package/dist/redux/sagas/fetchModel.test.d.ts +0 -1
- package/dist/redux/sagas/fetchModel.test.js +0 -127
- package/dist/redux/sagas/runner.test.d.ts +0 -1
- package/dist/redux/sagas/runner.test.js +0 -10
- package/dist/redux/sagas/saveData.test.d.ts +0 -1
- package/dist/redux/sagas/saveData.test.js +0 -74
- package/dist/redux/sagas/setDefaults.test.d.ts +0 -1
- package/dist/redux/sagas/setDefaults.test.js +0 -73
- package/dist/redux/selectors/app.test.d.ts +0 -1
- package/dist/redux/selectors/app.test.js +0 -99
- package/dist/redux/selectors/conditions.test.d.ts +0 -1
- package/dist/redux/selectors/conditions.test.js +0 -70
- package/dist/redux/selectors/inputs.test.d.ts +0 -1
- package/dist/redux/selectors/inputs.test.js +0 -44
- package/dist/redux/selectors/references.test.d.ts +0 -1
- package/dist/redux/selectors/references.test.js +0 -471
- package/dist/redux/selectors/selectors.test.d.ts +0 -1
- package/dist/redux/selectors/selectors.test.js +0 -16
- package/dist/redux/selectors/user.test.d.ts +0 -1
- package/dist/redux/selectors/user.test.js +0 -29
- package/dist/redux/store.test.d.ts +0 -1
- package/dist/redux/store.test.js +0 -16
- /package/dist/{App.test.d.ts → routing/types.js} +0 -0
package/README.md
CHANGED
|
@@ -1 +1,376 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @legalplace/wizardx-core
|
|
2
|
+
|
|
3
|
+
Core library for WizardX - A powerful, themeable, and extensible wizard framework for React applications.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Themeable**: Fully customizable UI with multiple theme support
|
|
8
|
+
- 🔌 **Plugin System**: Extensible architecture with dynamic plugin loading
|
|
9
|
+
- 📱 **Responsive**: Mobile-first design
|
|
10
|
+
- 🔄 **State Management**: Redux-based state management with sagas
|
|
11
|
+
- 🎯 **Type-Safe**: Full TypeScript support
|
|
12
|
+
- 🚀 **Multi-Router Support**: Works with React Router (CRA) and Next.js App Router
|
|
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.)
|
|
21
|
+
|
|
22
|
+
## 📦 Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add @legalplace/wizardx-core
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Start
|
|
29
|
+
|
|
30
|
+
### For Create React App (existing)
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { App } from "@legalplace/wizardx-core";
|
|
34
|
+
import { createRoot } from "react-dom/client";
|
|
35
|
+
|
|
36
|
+
const root = createRoot(document.getElementById("root"));
|
|
37
|
+
root.render(
|
|
38
|
+
<App
|
|
39
|
+
historyType="browser"
|
|
40
|
+
loadPlugin={loadPlugin}
|
|
41
|
+
loadTheme={loadTheme}
|
|
42
|
+
wizardParams={wizardParams}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### For Next.js 15 (new)
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
'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";
|
|
54
|
+
|
|
55
|
+
export default function WizardPage() {
|
|
56
|
+
const adapter = createNextJSAdapter(
|
|
57
|
+
useRouter(),
|
|
58
|
+
usePathname(),
|
|
59
|
+
useSearchParams(),
|
|
60
|
+
useParams()
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<WizardCore
|
|
65
|
+
routerAdapter={adapter}
|
|
66
|
+
loadPlugin={loadPlugin}
|
|
67
|
+
loadTheme={loadTheme}
|
|
68
|
+
wizardParams={wizardParams}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 📚 Documentation
|
|
75
|
+
|
|
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
|
|
80
|
+
|
|
81
|
+
### Architecture & Technical Details
|
|
82
|
+
- **[Routing Guide](./README-ROUTING.md)** - In-depth routing architecture
|
|
83
|
+
- **[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
|
|
86
|
+
|
|
87
|
+
## 🎯 Core Concepts
|
|
88
|
+
|
|
89
|
+
### Components
|
|
90
|
+
|
|
91
|
+
#### `App` Component
|
|
92
|
+
The original React Router-based component. Use this for CRA applications.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import { App } from "@legalplace/wizardx-core";
|
|
96
|
+
|
|
97
|
+
<App
|
|
98
|
+
historyType="browser" // or "memory"
|
|
99
|
+
loadPlugin={loadPlugin}
|
|
100
|
+
loadTheme={loadTheme}
|
|
101
|
+
wizardParams={wizardParams}
|
|
102
|
+
model={initialModel}
|
|
103
|
+
user={user}
|
|
104
|
+
/>
|
|
105
|
+
```
|
|
106
|
+
|
|
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
|
+
### Themes
|
|
123
|
+
|
|
124
|
+
Themes control the visual appearance of the wizard. Load themes dynamically:
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
const loadTheme = async (theme: string) => {
|
|
128
|
+
switch(theme) {
|
|
129
|
+
case 'legacy':
|
|
130
|
+
return import('./themes/legacy');
|
|
131
|
+
case 'qonto':
|
|
132
|
+
return import('./themes/qonto');
|
|
133
|
+
default:
|
|
134
|
+
throw new Error(`Theme "${theme}" not found`);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Plugins
|
|
140
|
+
|
|
141
|
+
Plugins extend wizard functionality. Load plugins dynamically:
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
const loadPlugin = async (plugin: string) => {
|
|
145
|
+
switch(plugin) {
|
|
146
|
+
case 'checkoutX':
|
|
147
|
+
return import('./plugins/checkoutX');
|
|
148
|
+
case 'authentication':
|
|
149
|
+
return import('./plugins/authentication');
|
|
150
|
+
default:
|
|
151
|
+
throw new Error(`Plugin "${plugin}" not found`);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Configuration
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
const wizardParams = {
|
|
160
|
+
apiEndpoint: "https://api.example.com/v1",
|
|
161
|
+
|
|
162
|
+
router: {
|
|
163
|
+
wizardPath: "/contrats/:prefix?/:permalink/creer/:page?",
|
|
164
|
+
wizardInstancePath: "/contrats/:prefix?/:permalink/continuer/:uniqid/:page?",
|
|
165
|
+
notFoundPath: "/404",
|
|
166
|
+
smartscriptPath: "/contrats/:permalink/smartscript/:uniqid?",
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
plugins: {
|
|
170
|
+
checkoutX: "1.0.0",
|
|
171
|
+
authentication: "1.0.0",
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
theme: {
|
|
175
|
+
name: "legacy",
|
|
176
|
+
params: {
|
|
177
|
+
ui: { topbar: { previewBtn: true } }
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
appStates: ["wizard", "email", "termsheet"],
|
|
182
|
+
};
|
|
183
|
+
```
|
|
184
|
+
|
|
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
|
+
## 📦 Exports
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
// Components
|
|
226
|
+
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
|
+
|
|
240
|
+
// Configuration
|
|
241
|
+
export { getConfig, updateConfig } from "@legalplace/wizardx-core";
|
|
242
|
+
|
|
243
|
+
// Redux
|
|
244
|
+
export { getStore, createAppStore } from "@legalplace/wizardx-core";
|
|
245
|
+
|
|
246
|
+
// Theme & Plugins
|
|
247
|
+
export { loadThemeComponent, addOnThemeLoadCallback } from "@legalplace/wizardx-core";
|
|
248
|
+
export { loadPlugin, clearPlugins } from "@legalplace/wizardx-core";
|
|
249
|
+
|
|
250
|
+
// ... and many more
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## 🏗️ Architecture
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
┌─────────────────────────────────────┐
|
|
257
|
+
│ Application (CRA or Next.js) │
|
|
258
|
+
└──────────────┬──────────────────────┘
|
|
259
|
+
│
|
|
260
|
+
▼
|
|
261
|
+
┌─────────────────────────────────────┐
|
|
262
|
+
│ Router Adapter (Optional) │
|
|
263
|
+
│ React Router | Next.js | Custom │
|
|
264
|
+
└──────────────┬──────────────────────┘
|
|
265
|
+
│
|
|
266
|
+
▼
|
|
267
|
+
┌─────────────────────────────────────┐
|
|
268
|
+
│ WizardCore / App │
|
|
269
|
+
│ (Business Logic Layer) │
|
|
270
|
+
└──────────────┬──────────────────────┘
|
|
271
|
+
│
|
|
272
|
+
▼
|
|
273
|
+
┌─────────────────────────────────────┐
|
|
274
|
+
│ Redux Store + Sagas │
|
|
275
|
+
└──────────────┬──────────────────────┘
|
|
276
|
+
│
|
|
277
|
+
▼
|
|
278
|
+
┌─────────────────────────────────────┐
|
|
279
|
+
│ Themes & Plugins (Dynamic) │
|
|
280
|
+
└─────────────────────────────────────┘
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## 🔄 State Management
|
|
284
|
+
|
|
285
|
+
WizardX Core uses Redux for state management with the following slices:
|
|
286
|
+
|
|
287
|
+
- `app`: Application state (meta, instance, pagination)
|
|
288
|
+
- `user`: User information
|
|
289
|
+
- `inputs`: Variables and options
|
|
290
|
+
- `conditions`: Conditional logic
|
|
291
|
+
- `references`: External references
|
|
292
|
+
- `mandatories`: Required fields validation
|
|
293
|
+
- `smartscript`: SmartScript state
|
|
294
|
+
|
|
295
|
+
## 🎨 Available Themes
|
|
296
|
+
|
|
297
|
+
- `legacy` - Classic theme
|
|
298
|
+
- `qonto` - Qonto-styled theme
|
|
299
|
+
- `kpmg` - KPMG-styled theme
|
|
300
|
+
- `shine` - Shine-styled theme
|
|
301
|
+
- `social` - Social-styled theme
|
|
302
|
+
- `compact` - Compact theme
|
|
303
|
+
|
|
304
|
+
## 🔌 Available Plugins
|
|
305
|
+
|
|
306
|
+
- `checkoutX` - Checkout flow
|
|
307
|
+
- `authentication` - User authentication
|
|
308
|
+
- `b2c_actions` - B2C specific actions
|
|
309
|
+
- `datalayer` - Analytics data layer
|
|
310
|
+
- `kanoon` - Kanoon integration
|
|
311
|
+
- And more...
|
|
312
|
+
|
|
313
|
+
## 🧪 Development
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Install dependencies
|
|
317
|
+
pnpm install
|
|
318
|
+
|
|
319
|
+
# Build
|
|
320
|
+
pnpm build
|
|
321
|
+
|
|
322
|
+
# Watch mode
|
|
323
|
+
pnpm start
|
|
324
|
+
|
|
325
|
+
# Lint
|
|
326
|
+
pnpm lint
|
|
327
|
+
|
|
328
|
+
# Type check
|
|
329
|
+
pnpm tsc --noEmit
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## 📝 TypeScript
|
|
333
|
+
|
|
334
|
+
Full TypeScript support with exported types:
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import type {
|
|
338
|
+
AppProps,
|
|
339
|
+
WizardCoreProps,
|
|
340
|
+
IWizardParams,
|
|
341
|
+
IRouterAdapter,
|
|
342
|
+
StateType,
|
|
343
|
+
} from "@legalplace/wizardx-core";
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## 🤝 Contributing
|
|
347
|
+
|
|
348
|
+
1. Create a feature branch
|
|
349
|
+
2. Make your changes
|
|
350
|
+
3. Run tests and linting
|
|
351
|
+
4. Submit a pull request
|
|
352
|
+
|
|
353
|
+
## 📄 License
|
|
354
|
+
|
|
355
|
+
MIT
|
|
356
|
+
|
|
357
|
+
## 🔗 Related Packages
|
|
358
|
+
|
|
359
|
+
- `@legalplace/wizardx-app` - Main application using wizardx-core
|
|
360
|
+
- `@legalplace/storybook` - UI components library
|
|
361
|
+
- `@legalplace/typeorm-entities` - Database entities
|
|
362
|
+
- `@legalplace/types` - Shared TypeScript types
|
|
363
|
+
|
|
364
|
+
## 📞 Support
|
|
365
|
+
|
|
366
|
+
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
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
**Version**: 4.42.9+
|
|
374
|
+
**Last Updated**: Nov 25, 2025
|
|
375
|
+
**Status**: ✅ Production Ready
|
|
376
|
+
**Multi-Router Support**: ✅ Stable
|
package/dist/App.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ModelV3 } from "@legalplace/models-v3-types";
|
|
3
|
-
import "@legalplace/storybook/assets/inter.css";
|
|
4
|
-
import "@legalplace/storybook/assets/circularstd.css";
|
|
5
|
-
import "@legalplace/storybook/assets/polysans.css";
|
|
6
|
-
import "@legalplace/storybook/assets/rebondgrotesk.css";
|
|
7
|
-
import "@legalplace/storybook/assets/rubik.css";
|
|
8
3
|
import type { StateType } from "./types/State.type";
|
|
9
4
|
import type { IWizardParams } from "./types/config.type";
|
|
10
5
|
export interface AppProps {
|
|
@@ -24,6 +19,6 @@ declare class WizardXCore extends React.Component<AppProps, {
|
|
|
24
19
|
constructor(props: AppProps);
|
|
25
20
|
componentDidMount(): void;
|
|
26
21
|
componentWillUnmount(): void;
|
|
27
|
-
render(): JSX.Element;
|
|
22
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
28
23
|
}
|
|
29
24
|
export default WizardXCore;
|
package/dist/App.js
CHANGED
|
@@ -3,11 +3,6 @@ import React from "react";
|
|
|
3
3
|
import { Route, Switch, Redirect } from "react-router-dom";
|
|
4
4
|
import { Provider } from "react-redux";
|
|
5
5
|
import { ConnectedRouter } from "connected-react-router";
|
|
6
|
-
import "@legalplace/storybook/assets/inter.css";
|
|
7
|
-
import "@legalplace/storybook/assets/circularstd.css";
|
|
8
|
-
import "@legalplace/storybook/assets/polysans.css";
|
|
9
|
-
import "@legalplace/storybook/assets/rebondgrotesk.css";
|
|
10
|
-
import "@legalplace/storybook/assets/rubik.css";
|
|
11
6
|
import { getStore, createAppStore } from "./redux/store";
|
|
12
7
|
import { getHistory } from "./redux/routerHistory";
|
|
13
8
|
import Globals, { setGlobals } from "./Globals";
|
|
@@ -32,7 +27,7 @@ const RedirectHandler = () => {
|
|
|
32
27
|
else {
|
|
33
28
|
window.location.href = NOT_FOUND_PAGE_LINK;
|
|
34
29
|
}
|
|
35
|
-
return _jsx(Redirect, { to: getConfig().router.notFoundPath }
|
|
30
|
+
return _jsx(Redirect, { to: getConfig().router.notFoundPath });
|
|
36
31
|
};
|
|
37
32
|
class WizardXCore extends React.Component {
|
|
38
33
|
constructor(props) {
|
|
@@ -82,7 +77,7 @@ class WizardXCore extends React.Component {
|
|
|
82
77
|
getStore().dispatch(resetStateAction());
|
|
83
78
|
}
|
|
84
79
|
render() {
|
|
85
|
-
return (_jsx(Provider,
|
|
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 }))] }) }) }));
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
83
|
export default WizardXCore;
|
package/dist/Loader.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Loader: () => JSX.Element;
|
|
1
|
+
export declare const Loader: () => import("react/jsx-runtime").JSX.Element;
|
package/dist/Loader.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const Loader = () => (_jsx("div",
|
|
2
|
+
export const Loader = () => (_jsx("div", { className: "lps-container", children: _jsxs("div", { className: "lds-ripple", children: [_jsx("div", {}), _jsx("div", {})] }) }));
|
package/dist/PluginLoader.d.ts
CHANGED
|
@@ -1,46 +1,31 @@
|
|
|
1
|
-
import type { Props } from "react";
|
|
2
1
|
import React from "react";
|
|
3
|
-
import type {
|
|
4
|
-
import type { Action, AnyAction, CombinedState, Reducer } from "redux";
|
|
2
|
+
import type { Reducer } from "redux";
|
|
5
3
|
import type { Saga } from "redux-saga";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const getPluginsStoreReducers: () => Readonly<typeof pluginsStoreReducers>;
|
|
9
|
-
export declare const getPluginsStoreSagas: () => Readonly<typeof pluginsStoreSagas>;
|
|
10
|
-
export declare type PluginAppStatesRegisterFunction = (currentAppStates: string[]) => string[];
|
|
11
|
-
export declare type PluginsPageAppStatesType = Record<string, string>;
|
|
12
|
-
export declare type actionOverrideFunction = (action: Action) => Action;
|
|
13
|
-
export interface IPluginsAppStatesComponents {
|
|
14
|
-
[key: string]: LoadableComponent<any>;
|
|
15
|
-
}
|
|
16
|
-
export interface PluginsAppStatesDeclarations {
|
|
17
|
-
register: PluginAppStatesRegisterFunction;
|
|
18
|
-
pageAppState: PluginsPageAppStatesType;
|
|
19
|
-
components: IPluginsAppStatesComponents;
|
|
20
|
-
additionalRoutes?: Record<string, ReactComponent<any>>[];
|
|
21
|
-
}
|
|
22
|
-
declare let PluginsPageAppStates: PluginsPageAppStatesType;
|
|
23
|
-
export declare const registerPluginsAppStates: PluginAppStatesRegisterFunction;
|
|
24
|
-
export declare const loadPluginComponent: (name: string) => LoadableComponent<any> | undefined;
|
|
25
|
-
export declare const pluginPageAppState: (page: string) => string | false;
|
|
26
|
-
export declare const getPluginsPageAppStates: () => Readonly<typeof PluginsPageAppStates>;
|
|
27
|
-
export declare const loadPlugins: (plugins?: Record<string, string> | undefined) => Promise<void>;
|
|
28
|
-
export declare const pluginsLoaded: () => boolean;
|
|
4
|
+
import type { IPlugin, IPluginConfig } from "./types/PluginConfig.type";
|
|
5
|
+
type TPluginLoader = React.FC<PluginLoaderProps>;
|
|
29
6
|
export interface PluginLoaderProps {
|
|
30
7
|
anchor: string[];
|
|
31
|
-
props?:
|
|
8
|
+
props?: Record<string, any>;
|
|
9
|
+
children?: React.ReactNode;
|
|
32
10
|
}
|
|
33
|
-
export
|
|
34
|
-
export declare type TPluginLoader<T = {}> = React.FC<T & PluginLoaderProps>;
|
|
11
|
+
export type ReactComponent<T> = React.ComponentClass<T> | React.FC<T>;
|
|
35
12
|
export declare const PluginLoader: TPluginLoader;
|
|
36
|
-
export declare function replaceComponent<T = {}>(replacerName: string | string[], OriginalComponent: ReactComponent<T>, componentName?: string):
|
|
37
|
-
export
|
|
13
|
+
export declare function replaceComponent<T = {}>(replacerName: string | string[], OriginalComponent: ReactComponent<T>, componentName?: string): any;
|
|
14
|
+
export type ReplaceFragmentPropsType = {
|
|
38
15
|
replacerName: string | string[];
|
|
39
16
|
fragmentName?: string;
|
|
17
|
+
children?: React.ReactNode;
|
|
40
18
|
};
|
|
41
|
-
export declare const ReplaceFragment:
|
|
42
|
-
export declare function
|
|
43
|
-
export declare function
|
|
44
|
-
export declare
|
|
45
|
-
export declare
|
|
19
|
+
export declare const ReplaceFragment: ({ replacerName, fragmentName, children, }: ReplaceFragmentPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function registerReplacer(replacerName: string, Replacer: ReactComponent<any>): void;
|
|
21
|
+
export declare function loadPlugins(plugins: Record<string, () => Promise<IPlugin>>): Promise<any>;
|
|
22
|
+
export declare function getPluginsReducers(): Record<string, Reducer<Record<string, any>, any>>;
|
|
23
|
+
export declare function getPluginsAdditionalRoutes(): IPluginConfig[];
|
|
24
|
+
export declare function getPluginsSagas(): Saga[];
|
|
25
|
+
export declare function clearPlugins(): void;
|
|
26
|
+
export declare const RunActionAnchor: () => void;
|
|
27
|
+
export declare const RunOverrideActionAnchor: () => void;
|
|
28
|
+
export declare const registerPluginsAppStates: () => void;
|
|
29
|
+
export declare const getPluginsStoreReducers: typeof getPluginsReducers;
|
|
30
|
+
export declare const getPluginsStoreSagas: typeof getPluginsSagas;
|
|
46
31
|
export {};
|