@owlmeans/web-flow 0.1.2 → 0.1.4
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 +35 -376
- package/build/service.js +1 -1
- package/build/service.js.map +1 -1
- package/package.json +11 -10
- package/src/service.ts +2 -2
- package/tsconfig.json +6 -11
package/README.md
CHANGED
|
@@ -1,411 +1,70 @@
|
|
|
1
1
|
# @owlmeans/web-flow
|
|
2
2
|
|
|
3
|
-
Web-specific flow
|
|
3
|
+
Web-specific flow service — extends `@owlmeans/client-flow` with URL query parameter persistence and browser navigation.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- **Resource Persistence**: Web-specific flow state persistence using browser storage
|
|
12
|
-
- **Query Parameter Management**: Automatic flow state serialization in URL parameters
|
|
13
|
-
- **Module Integration**: Enhanced module integration for web-based flow transitions
|
|
14
|
-
- **Client-Side Routing**: Seamless integration with React Router for flow navigation
|
|
15
|
-
|
|
16
|
-
This package is part of the OwlMeans flow management quadra:
|
|
17
|
-
- **@owlmeans/flow**: Common flow interfaces and utilities
|
|
18
|
-
- **@owlmeans/client-flow**: Client-side flow implementation
|
|
19
|
-
- **@owlmeans/web-flow**: Web-specific flow implementation *(this package)*
|
|
20
|
-
- **@owlmeans/server-flow**: Server-side flow processing
|
|
7
|
+
- `makeFlowService(alias?)` — creates a flow service that reads/writes flow state from URL query params
|
|
8
|
+
- `appendFlowService(ctx, alias?)` — registers the flow service in the context
|
|
9
|
+
- Adds `goHome(alias?, dryRun?)` to navigate to the configured home service URL
|
|
10
|
+
- `QUERY_PARAM` / `SERVICE_PARAM` — query parameter names for flow and service routing
|
|
21
11
|
|
|
22
12
|
## Installation
|
|
23
13
|
|
|
24
14
|
```bash
|
|
25
|
-
|
|
15
|
+
bun add @owlmeans/web-flow
|
|
26
16
|
```
|
|
27
17
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
### Web Flow Service
|
|
31
|
-
Extends the basic flow service with web-specific capabilities like URL management and browser navigation.
|
|
32
|
-
|
|
33
|
-
### URL State Management
|
|
34
|
-
Flow state is automatically serialized and stored in URL query parameters, allowing flows to survive page reloads and be shareable.
|
|
35
|
-
|
|
36
|
-
### Browser Integration
|
|
37
|
-
Full integration with browser APIs for navigation, history management, and URL manipulation.
|
|
18
|
+
## Usage
|
|
38
19
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Factory Functions
|
|
42
|
-
|
|
43
|
-
#### `makeFlowService(alias?: string): FlowService`
|
|
44
|
-
|
|
45
|
-
Creates a web-specific flow service with enhanced browser integration.
|
|
20
|
+
Register in context setup:
|
|
46
21
|
|
|
47
22
|
```typescript
|
|
48
|
-
import {
|
|
23
|
+
import { appendFlowService } from '@owlmeans/web-flow'
|
|
49
24
|
|
|
50
|
-
|
|
25
|
+
appendFlowService(context)
|
|
51
26
|
```
|
|
52
27
|
|
|
53
|
-
|
|
54
|
-
- `alias`: string (optional) - Service alias for registration, defaults to 'flow'
|
|
55
|
-
|
|
56
|
-
**Returns:** Enhanced FlowService with web-specific capabilities
|
|
57
|
-
|
|
58
|
-
#### `appendWebFlowService<C, T>(context: T, alias?: string): T`
|
|
59
|
-
|
|
60
|
-
Appends a web flow service to the application context with necessary resource setup.
|
|
28
|
+
Use the flow service in a component:
|
|
61
29
|
|
|
62
30
|
```typescript
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
|
|
66
|
-
const context = makeClientContext(config)
|
|
67
|
-
appendWebFlowService(context)
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Parameters:**
|
|
71
|
-
- `context`: T - The client context to append the service to
|
|
72
|
-
- `alias`: string (optional) - Service alias, defaults to 'flow'
|
|
73
|
-
|
|
74
|
-
**Returns:** Enhanced context with web flow service and resources
|
|
75
|
-
|
|
76
|
-
### Enhanced Methods
|
|
77
|
-
|
|
78
|
-
#### `proceed(req?: Partial<AbstractRequest>, dryRun?: boolean): Promise<string>`
|
|
31
|
+
import type { FlowService } from '@owlmeans/web-flow'
|
|
32
|
+
import { STD_OIDC_FLOW } from '@owlmeans/flow'
|
|
79
33
|
|
|
80
|
-
|
|
34
|
+
const flowSrv = context.service<FlowService>('flow')
|
|
35
|
+
await flowSrv.ready()
|
|
81
36
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- Integrates with React Router for seamless transitions
|
|
37
|
+
const flow = await flowSrv.begin(STD_OIDC_FLOW)
|
|
38
|
+
flow.target(IAM_WL)
|
|
39
|
+
flow.entity(entityId)
|
|
40
|
+
const transit = flow.serialize()
|
|
87
41
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
const webFlowService = context.service<FlowService>('flow')
|
|
92
|
-
|
|
93
|
-
// Proceed to next step with automatic URL update
|
|
94
|
-
await webFlowService.proceed({
|
|
95
|
-
body: { userInput: 'data' }
|
|
96
|
-
})
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Configuration
|
|
100
|
-
|
|
101
|
-
#### Flow Configuration Options
|
|
102
|
-
|
|
103
|
-
```typescript
|
|
104
|
-
interface WebFlowConfig extends FlowConfig {
|
|
105
|
-
queryParam?: string // URL query parameter name for flow state
|
|
106
|
-
}
|
|
42
|
+
const url = `${authUrl}?flow=${transit}`
|
|
43
|
+
window.open(url, '_blank')
|
|
107
44
|
```
|
|
108
45
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
#### `QUERY_PARAM`
|
|
112
|
-
Default query parameter name for flow state (`'flow'`).
|
|
113
|
-
|
|
114
|
-
## Usage Examples
|
|
115
|
-
|
|
116
|
-
### Basic Web Flow Setup
|
|
46
|
+
## API
|
|
117
47
|
|
|
118
|
-
|
|
119
|
-
import { appendWebFlowService } from '@owlmeans/web-flow'
|
|
120
|
-
import { makeClientContext } from '@owlmeans/client-context'
|
|
48
|
+
### `makeFlowService(alias?): FlowService`
|
|
121
49
|
|
|
122
|
-
|
|
123
|
-
const context = makeClientContext({
|
|
124
|
-
service: 'my-web-app',
|
|
125
|
-
flowConfig: {
|
|
126
|
-
defaultFlow: 'user-onboarding',
|
|
127
|
-
queryParam: 'state' // Custom query parameter name
|
|
128
|
-
}
|
|
129
|
-
})
|
|
50
|
+
Creates a flow service. On initialization, reads `?flow=` and `?service=` from the current URL to resume in-progress flows.
|
|
130
51
|
|
|
131
|
-
|
|
52
|
+
### `appendFlowService<C, T>(ctx, alias?): T`
|
|
132
53
|
|
|
133
|
-
|
|
134
|
-
await context.configure().init()
|
|
135
|
-
```
|
|
54
|
+
Appends the flow service to the context. Returns the context.
|
|
136
55
|
|
|
137
|
-
###
|
|
56
|
+
### `FlowService`
|
|
138
57
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
import { useSearchParams } from 'react-router-dom'
|
|
142
|
-
import { useEffect, useState } from 'react'
|
|
58
|
+
Extends `ClientFlowService` with:
|
|
59
|
+
- `goHome(alias?, dryRun?): Promise<string>` — navigate to the home URL for the service
|
|
143
60
|
|
|
144
|
-
|
|
145
|
-
const context = useContext()
|
|
146
|
-
const [searchParams] = useSearchParams()
|
|
147
|
-
const [currentStep, setCurrentStep] = useState(null)
|
|
148
|
-
|
|
149
|
-
useEffect(() => {
|
|
150
|
-
const initFlow = async () => {
|
|
151
|
-
const flowService = context.service('flow')
|
|
152
|
-
|
|
153
|
-
// Check if flow state exists in URL
|
|
154
|
-
const flowState = searchParams.get('flow')
|
|
155
|
-
let flow
|
|
156
|
-
|
|
157
|
-
if (flowState) {
|
|
158
|
-
// Restore flow from URL parameter
|
|
159
|
-
flow = await flowService.load(flowState)
|
|
160
|
-
} else {
|
|
161
|
-
// Start new flow
|
|
162
|
-
flow = await flowService.begin('user-onboarding')
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
setCurrentStep(flow.step())
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
initFlow()
|
|
169
|
-
}, [searchParams])
|
|
170
|
-
|
|
171
|
-
const handleNext = async () => {
|
|
172
|
-
const flowService = context.service('flow')
|
|
173
|
-
await flowService.proceed({ action: 'next' })
|
|
174
|
-
|
|
175
|
-
// Flow state is automatically updated in URL
|
|
176
|
-
const updatedFlow = await flowService.state()
|
|
177
|
-
setCurrentStep(updatedFlow?.step())
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<div>
|
|
182
|
-
<h2>Current Step: {currentStep}</h2>
|
|
183
|
-
<button onClick={handleNext}>Next Step</button>
|
|
184
|
-
</div>
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Shareable Flow URLs
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
function ShareableFlow() {
|
|
193
|
-
const context = useContext()
|
|
194
|
-
|
|
195
|
-
const getShareableURL = async () => {
|
|
196
|
-
const flowService = context.service('flow')
|
|
197
|
-
const flow = await flowService.state()
|
|
198
|
-
|
|
199
|
-
if (flow) {
|
|
200
|
-
const currentURL = new URL(window.location.href)
|
|
201
|
-
currentURL.searchParams.set('flow', flow.serialize())
|
|
202
|
-
return currentURL.toString()
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return window.location.href
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const handleShare = async () => {
|
|
209
|
-
const shareableURL = await getShareableURL()
|
|
210
|
-
|
|
211
|
-
if (navigator.share) {
|
|
212
|
-
await navigator.share({
|
|
213
|
-
title: 'Continue Flow',
|
|
214
|
-
url: shareableURL
|
|
215
|
-
})
|
|
216
|
-
} else {
|
|
217
|
-
// Fallback to clipboard
|
|
218
|
-
await navigator.clipboard.writeText(shareableURL)
|
|
219
|
-
alert('URL copied to clipboard!')
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return (
|
|
224
|
-
<button onClick={handleShare}>
|
|
225
|
-
Share Flow Progress
|
|
226
|
-
</button>
|
|
227
|
-
)
|
|
228
|
-
}
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### Browser Navigation Integration
|
|
232
|
-
|
|
233
|
-
```typescript
|
|
234
|
-
import { useNavigate, useLocation } from 'react-router-dom'
|
|
235
|
-
import { useContext } from '@owlmeans/client'
|
|
236
|
-
|
|
237
|
-
function NavigationAwareFlow() {
|
|
238
|
-
const context = useContext()
|
|
239
|
-
const navigate = useNavigate()
|
|
240
|
-
const location = useLocation()
|
|
241
|
-
|
|
242
|
-
useEffect(() => {
|
|
243
|
-
// Listen for browser back/forward navigation
|
|
244
|
-
const handlePopState = async () => {
|
|
245
|
-
const flowService = context.service('flow')
|
|
246
|
-
const searchParams = new URLSearchParams(location.search)
|
|
247
|
-
const flowState = searchParams.get('flow')
|
|
248
|
-
|
|
249
|
-
if (flowState) {
|
|
250
|
-
await flowService.load(flowState)
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
window.addEventListener('popstate', handlePopState)
|
|
255
|
-
return () => window.removeEventListener('popstate', handlePopState)
|
|
256
|
-
}, [location])
|
|
257
|
-
|
|
258
|
-
const proceedToStep = async (stepName: string) => {
|
|
259
|
-
const flowService = context.service('flow')
|
|
260
|
-
await flowService.proceed({ target: stepName })
|
|
261
|
-
|
|
262
|
-
// Navigation is handled automatically by the web flow service
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return (
|
|
266
|
-
<div>
|
|
267
|
-
<button onClick={() => proceedToStep('step1')}>Go to Step 1</button>
|
|
268
|
-
<button onClick={() => proceedToStep('step2')}>Go to Step 2</button>
|
|
269
|
-
<button onClick={() => navigate(-1)}>Browser Back</button>
|
|
270
|
-
</div>
|
|
271
|
-
)
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
### Custom Query Parameter Configuration
|
|
276
|
-
|
|
277
|
-
```typescript
|
|
278
|
-
const context = makeClientContext({
|
|
279
|
-
service: 'custom-app',
|
|
280
|
-
flowConfig: {
|
|
281
|
-
defaultFlow: 'checkout',
|
|
282
|
-
queryParam: 'checkout-state', // Custom parameter name
|
|
283
|
-
services: {
|
|
284
|
-
payment: 'payment-service',
|
|
285
|
-
shipping: 'shipping-service'
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
appendWebFlowService(context)
|
|
291
|
-
|
|
292
|
-
// URLs will look like: /checkout?checkout-state=serialized-flow-data
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### Flow State Persistence
|
|
296
|
-
|
|
297
|
-
```typescript
|
|
298
|
-
class WebFlowManager {
|
|
299
|
-
constructor(private context: ClientContext) {}
|
|
300
|
-
|
|
301
|
-
async saveFlowToURL(): Promise<string> {
|
|
302
|
-
const flowService = this.context.service('flow')
|
|
303
|
-
const flow = await flowService.state()
|
|
304
|
-
|
|
305
|
-
if (flow) {
|
|
306
|
-
const url = new URL(window.location.href)
|
|
307
|
-
url.searchParams.set('flow', flow.serialize())
|
|
308
|
-
|
|
309
|
-
// Update browser URL without navigation
|
|
310
|
-
window.history.replaceState({}, '', url.toString())
|
|
311
|
-
|
|
312
|
-
return url.toString()
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
return window.location.href
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
async loadFlowFromURL(): Promise<boolean> {
|
|
319
|
-
const searchParams = new URLSearchParams(window.location.search)
|
|
320
|
-
const flowState = searchParams.get('flow')
|
|
321
|
-
|
|
322
|
-
if (flowState) {
|
|
323
|
-
const flowService = this.context.service('flow')
|
|
324
|
-
await flowService.load(flowState)
|
|
325
|
-
return true
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return false
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
clearFlowFromURL(): void {
|
|
332
|
-
const url = new URL(window.location.href)
|
|
333
|
-
url.searchParams.delete('flow')
|
|
334
|
-
window.history.replaceState({}, '', url.toString())
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// Usage
|
|
339
|
-
const flowManager = new WebFlowManager(context)
|
|
340
|
-
|
|
341
|
-
// Save current flow state to URL
|
|
342
|
-
await flowManager.saveFlowToURL()
|
|
343
|
-
|
|
344
|
-
// Restore flow from URL on page load
|
|
345
|
-
const restored = await flowManager.loadFlowFromURL()
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
## Integration with React Router
|
|
349
|
-
|
|
350
|
-
```typescript
|
|
351
|
-
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
|
352
|
-
import { appendWebFlowService } from '@owlmeans/web-flow'
|
|
353
|
-
|
|
354
|
-
function App() {
|
|
355
|
-
const context = makeClientContext(config)
|
|
356
|
-
appendWebFlowService(context)
|
|
357
|
-
|
|
358
|
-
return (
|
|
359
|
-
<BrowserRouter>
|
|
360
|
-
<Routes>
|
|
361
|
-
<Route path="/flow/*" element={<FlowRoutes />} />
|
|
362
|
-
<Route path="/dashboard" element={<Dashboard />} />
|
|
363
|
-
</Routes>
|
|
364
|
-
</BrowserRouter>
|
|
365
|
-
)
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
function FlowRoutes() {
|
|
369
|
-
const context = useContext()
|
|
370
|
-
const [searchParams] = useSearchParams()
|
|
371
|
-
|
|
372
|
-
// Flow state is automatically managed through URL
|
|
373
|
-
const flowState = searchParams.get('flow')
|
|
374
|
-
|
|
375
|
-
return (
|
|
376
|
-
<div>
|
|
377
|
-
{flowState ? (
|
|
378
|
-
<ActiveFlowComponent />
|
|
379
|
-
) : (
|
|
380
|
-
<StartFlowComponent />
|
|
381
|
-
)}
|
|
382
|
-
</div>
|
|
383
|
-
)
|
|
384
|
-
}
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
## Best Practices
|
|
388
|
-
|
|
389
|
-
1. **URL Management**: Use meaningful query parameter names for flow state
|
|
390
|
-
2. **Browser Integration**: Respect browser navigation patterns
|
|
391
|
-
3. **State Serialization**: Keep flow state minimal for URL storage
|
|
392
|
-
4. **Error Handling**: Handle URL parsing errors gracefully
|
|
393
|
-
5. **SEO Considerations**: Use appropriate meta tags for flow pages
|
|
394
|
-
6. **Performance**: Optimize flow state serialization for large flows
|
|
395
|
-
7. **User Experience**: Provide clear navigation indicators
|
|
396
|
-
|
|
397
|
-
## Dependencies
|
|
61
|
+
### Constants
|
|
398
62
|
|
|
399
|
-
|
|
400
|
-
-
|
|
401
|
-
- `@owlmeans/client` - React client library
|
|
402
|
-
- `@owlmeans/flow` - Core flow system
|
|
403
|
-
- `react` - React library (peer dependency)
|
|
404
|
-
- `react-router-dom` - React Router DOM (peer dependency)
|
|
63
|
+
- `QUERY_PARAM` — `'flow'` — URL query parameter carrying serialized flow state
|
|
64
|
+
- `SERVICE_PARAM` — `'service'` — URL query parameter for service routing
|
|
405
65
|
|
|
406
66
|
## Related Packages
|
|
407
67
|
|
|
408
|
-
- [`@owlmeans/client-flow`](../client-flow)
|
|
409
|
-
- [`@owlmeans/flow`](../flow)
|
|
410
|
-
- [`@owlmeans/
|
|
411
|
-
- [`@owlmeans/client`](../client) - React client library
|
|
68
|
+
- [`@owlmeans/client-flow`](../client-flow) — `FlowService` base and `createFlowClient`
|
|
69
|
+
- [`@owlmeans/flow`](../flow) — `STD_OIDC_FLOW`, `FlowModel`, `FlowConfig`
|
|
70
|
+
- [`@owlmeans/web-client`](../web-client) — registers this service when `makeContext` is called with flow support
|
package/build/service.js
CHANGED
|
@@ -20,7 +20,7 @@ export const makeFlowService = (alias = DEFAULT_ALIAS) => {
|
|
|
20
20
|
}
|
|
21
21
|
const cfg = service.config();
|
|
22
22
|
const param = cfg.queryParam ?? QUERY_PARAM;
|
|
23
|
-
const module = ctx.
|
|
23
|
+
const module = ctx.entrypoint(step.module);
|
|
24
24
|
const [url] = await module.call({
|
|
25
25
|
...req,
|
|
26
26
|
params: { ...req?.params, [param]: flow.serialize() },
|
package/build/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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M,CAAC,MAAM,iBAAiB,GAAG,CAE/B,GAAM,EAAE,QAAgB,aAAa,EAAK,EAAE;IAC5C,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAEtC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAE5B,oBAAoB,CAAO,GAAG,EAAE,UAAU,CAAC,CAAA;IAE3C,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/web-flow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -21,23 +21,24 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@owlmeans/client": "^0.1.
|
|
25
|
-
"@owlmeans/client-context": "^0.1.
|
|
26
|
-
"@owlmeans/client-flow": "^0.1.
|
|
27
|
-
"@owlmeans/client-
|
|
28
|
-
"@owlmeans/client-resource": "^0.1.
|
|
29
|
-
"@owlmeans/context": "^0.1.
|
|
30
|
-
"@owlmeans/error": "^0.1.
|
|
31
|
-
"@owlmeans/flow": "^0.1.
|
|
24
|
+
"@owlmeans/client": "^0.1.4",
|
|
25
|
+
"@owlmeans/client-context": "^0.1.4",
|
|
26
|
+
"@owlmeans/client-flow": "^0.1.4",
|
|
27
|
+
"@owlmeans/client-entrypoint": "^0.1.4",
|
|
28
|
+
"@owlmeans/client-resource": "^0.1.4",
|
|
29
|
+
"@owlmeans/context": "^0.1.4",
|
|
30
|
+
"@owlmeans/error": "^0.1.4",
|
|
31
|
+
"@owlmeans/flow": "^0.1.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "*",
|
|
35
35
|
"react-router": "^7.*"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@owlmeans/dep-config": "workspace:*",
|
|
38
39
|
"nodemon": "^3.1.11",
|
|
39
40
|
"npm-check": "^6.0.1",
|
|
40
|
-
"typescript": "^
|
|
41
|
+
"typescript": "^6.0.2"
|
|
41
42
|
},
|
|
42
43
|
"publishConfig": {
|
|
43
44
|
"access": "public"
|
package/src/service.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { QUERY_PARAM } from './consts.js'
|
|
|
5
5
|
import { FlowStepMissconfigured, makeFlowModel, UnknownTransition } from '@owlmeans/flow'
|
|
6
6
|
import { ResilientError } from '@owlmeans/error'
|
|
7
7
|
import { assertContext } from '@owlmeans/context'
|
|
8
|
-
import type {
|
|
8
|
+
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
9
9
|
import { appendClientResource } from '@owlmeans/client-resource'
|
|
10
10
|
|
|
11
11
|
export const makeFlowService = (alias: string = DEFAULT_ALIAS): FlowService => {
|
|
@@ -27,7 +27,7 @@ export const makeFlowService = (alias: string = DEFAULT_ALIAS): FlowService => {
|
|
|
27
27
|
const cfg = service.config()
|
|
28
28
|
const param = cfg.queryParam ?? QUERY_PARAM
|
|
29
29
|
|
|
30
|
-
const module = ctx.
|
|
30
|
+
const module = ctx.entrypoint<ClientEntrypoint<string>>(step.module)
|
|
31
31
|
const [url] = await module.call<string>({
|
|
32
32
|
...req,
|
|
33
33
|
params: { ...req?.params, [param]: flow.serialize() },
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": [
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"@owlmeans/dep-config/tsconfig.base.json",
|
|
4
|
+
"@owlmeans/dep-config/tsconfig.react.json"
|
|
5
5
|
],
|
|
6
6
|
"compilerOptions": {
|
|
7
|
-
"rootDir": "./src/",
|
|
8
|
-
"outDir": "./build/"
|
|
9
|
-
"moduleResolution": "Bundler"
|
|
7
|
+
"rootDir": "./src/",
|
|
8
|
+
"outDir": "./build/"
|
|
10
9
|
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
|
|
13
|
-
"./build/**/*",
|
|
14
|
-
"./*.ts"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
10
|
+
"exclude": ["./dist/**/*", "./build/**/*", "./*.ts"]
|
|
11
|
+
}
|