@secmia/openui-flow 4.0.0 → 4.1.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.
- package/AGENTS.md +5 -0
- package/README.md +99 -1
- package/dist/index.d.mts +58 -7
- package/dist/index.d.ts +58 -7
- package/dist/index.js +256 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +254 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/AGENTS.md
CHANGED
|
@@ -35,9 +35,12 @@ Core evaluation APIs:
|
|
|
35
35
|
Primary component and types:
|
|
36
36
|
|
|
37
37
|
- AdaptiveFlow
|
|
38
|
+
- useAdaptiveFlow
|
|
38
39
|
- AdaptiveFlowProps
|
|
39
40
|
- AdaptiveFlowAdapter
|
|
40
41
|
- AdaptiveFlowValidators
|
|
42
|
+
- AdaptiveFlowSchemas
|
|
43
|
+
- AdaptiveFlowFieldErrors
|
|
41
44
|
- AdaptiveFlowPersistence
|
|
42
45
|
- AdaptiveFlowStyles
|
|
43
46
|
- AdaptiveFlowClassNames
|
|
@@ -117,6 +120,8 @@ Validation:
|
|
|
117
120
|
- Configure via validators prop
|
|
118
121
|
- Supports email, otp, password, profile, tos validators
|
|
119
122
|
- Validators may be sync or async
|
|
123
|
+
- Validators can return string or { field, message } for field-level error mapping
|
|
124
|
+
- Optional schemas prop supports schema objects with safeParse/parse (Zod-friendly)
|
|
120
125
|
|
|
121
126
|
## Recommended Agent Workflow
|
|
122
127
|
|
package/README.md
CHANGED
|
@@ -489,7 +489,97 @@ Use `renderStep` for full step-body ownership. You can still reuse `defaultView`
|
|
|
489
489
|
|
|
490
490
|
### Level 4: fully custom UI for everything (headless mode)
|
|
491
491
|
|
|
492
|
-
If you want total control over shell, header, footer, button layout, and every interaction, use engine APIs directly.
|
|
492
|
+
If you want total control over shell, header, footer, button layout, and every interaction, use `useAdaptiveFlow` (or engine APIs directly).
|
|
493
|
+
|
|
494
|
+
### Headless hook (`useAdaptiveFlow`)
|
|
495
|
+
|
|
496
|
+
`useAdaptiveFlow` exposes the flow lifecycle without rendering any UI.
|
|
497
|
+
|
|
498
|
+
```tsx
|
|
499
|
+
'use client';
|
|
500
|
+
|
|
501
|
+
import { useAdaptiveFlow, type AdaptiveContextBase } from '@secmia/openui-flow';
|
|
502
|
+
|
|
503
|
+
type Ctx = AdaptiveContextBase & {
|
|
504
|
+
selectedPlan: 'starter' | 'pro' | null;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export default function FullyCustomFlow() {
|
|
508
|
+
const {
|
|
509
|
+
step,
|
|
510
|
+
context,
|
|
511
|
+
missingRequirements,
|
|
512
|
+
busy,
|
|
513
|
+
fieldErrors,
|
|
514
|
+
handleEmail,
|
|
515
|
+
handleOtp,
|
|
516
|
+
handlePassword,
|
|
517
|
+
handleProfile,
|
|
518
|
+
handleTos,
|
|
519
|
+
setContextPatch,
|
|
520
|
+
} = useAdaptiveFlow<Ctx>({
|
|
521
|
+
requirements: ['has_email', 'email_verified', 'has_password', 'has_first_name', 'accepted_tos', 'selected_plan'],
|
|
522
|
+
completeStep: 'COMPLETE',
|
|
523
|
+
initialValue: { selectedPlan: null },
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
return (
|
|
527
|
+
<div>
|
|
528
|
+
<h2>Step: {step}</h2>
|
|
529
|
+
<p>Pending: {missingRequirements.length}</p>
|
|
530
|
+
{fieldErrors.email ? <p>{fieldErrors.email}</p> : null}
|
|
531
|
+
|
|
532
|
+
<button disabled={busy} onClick={() => handleEmail('user@company.com')}>Submit Email</button>
|
|
533
|
+
<button disabled={busy} onClick={() => handleOtp('123456')}>Submit OTP</button>
|
|
534
|
+
<button disabled={busy} onClick={() => handlePassword('secure-password')}>Submit Password</button>
|
|
535
|
+
<button disabled={busy} onClick={() => handleProfile({ firstName: 'A', lastName: 'B', jobTitle: null })}>Save Profile</button>
|
|
536
|
+
<button disabled={busy} onClick={() => handleTos()}>Accept TOS</button>
|
|
537
|
+
<button onClick={() => setContextPatch({ selectedPlan: 'pro' })}>Select Plan</button>
|
|
538
|
+
<pre>{JSON.stringify(context, null, 2)}</pre>
|
|
539
|
+
</div>
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
You can still bypass the hook and use pure engine APIs if you need lower-level control.
|
|
545
|
+
|
|
546
|
+
### Optional schema validation (Zod-friendly)
|
|
547
|
+
|
|
548
|
+
`AdaptiveFlow` and `useAdaptiveFlow` accept a `schemas` object. Any schema with `safeParse` or `parse` is supported (including Zod schemas).
|
|
549
|
+
|
|
550
|
+
```tsx
|
|
551
|
+
import { z } from 'zod';
|
|
552
|
+
|
|
553
|
+
const emailSchema = z.string().email();
|
|
554
|
+
const profileSchema = z.object({
|
|
555
|
+
firstName: z.string().min(1),
|
|
556
|
+
lastName: z.string().min(1),
|
|
557
|
+
jobTitle: z.string().nullable(),
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
<AdaptiveFlow
|
|
561
|
+
schemas={{
|
|
562
|
+
email: emailSchema,
|
|
563
|
+
profile: profileSchema,
|
|
564
|
+
}}
|
|
565
|
+
/>
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### Field-level validation errors
|
|
569
|
+
|
|
570
|
+
Validators can return either a string or `{ field, message }`.
|
|
571
|
+
|
|
572
|
+
```ts
|
|
573
|
+
const validators = {
|
|
574
|
+
password: (value: string) => {
|
|
575
|
+
if (value.length < 12) {
|
|
576
|
+
return { field: 'password', message: 'Password must be at least 12 characters.' };
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
};
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Default UI now binds field errors to the matching input and sets `aria-invalid` automatically.
|
|
493
583
|
|
|
494
584
|
```tsx
|
|
495
585
|
'use client';
|
|
@@ -749,6 +839,7 @@ Evaluation loop:
|
|
|
749
839
|
|
|
750
840
|
Primary exports:
|
|
751
841
|
- `AdaptiveFlow`
|
|
842
|
+
- `useAdaptiveFlow`
|
|
752
843
|
- `defaultRequirements`
|
|
753
844
|
- `initialContext`
|
|
754
845
|
- `defaultRequirementResolvers`
|
|
@@ -762,7 +853,14 @@ Primary exports:
|
|
|
762
853
|
Important types:
|
|
763
854
|
- `AdaptiveFlowProps`
|
|
764
855
|
- `AdaptiveFlowAdapter`
|
|
856
|
+
- `UseAdaptiveFlowOptions`
|
|
857
|
+
- `UseAdaptiveFlowResult`
|
|
765
858
|
- `AdaptiveFlowValidators`
|
|
859
|
+
- `AdaptiveFlowValidationResult`
|
|
860
|
+
- `AdaptiveFlowValidationIssue`
|
|
861
|
+
- `AdaptiveFlowFieldErrors`
|
|
862
|
+
- `AdaptiveFlowSchemas`
|
|
863
|
+
- `AdaptiveFlowSchema`
|
|
766
864
|
- `AdaptiveFlowPersistence`
|
|
767
865
|
- `AdaptiveStepRegistry`
|
|
768
866
|
- `AdaptiveStepRendererArgs`
|
package/dist/index.d.mts
CHANGED
|
@@ -103,16 +103,42 @@ type PersistedAdaptiveFlowState<TContext extends AdaptiveContextBase = AdaptiveC
|
|
|
103
103
|
type AdaptiveFlowValidationContext<TContext extends AdaptiveContextBase = AdaptiveContextBase> = {
|
|
104
104
|
context: TContext;
|
|
105
105
|
};
|
|
106
|
+
type AdaptiveFlowValidationIssue = {
|
|
107
|
+
message: string;
|
|
108
|
+
field?: string;
|
|
109
|
+
};
|
|
110
|
+
type AdaptiveFlowValidationResult = string | AdaptiveFlowValidationIssue | void | Promise<string | AdaptiveFlowValidationIssue | void>;
|
|
111
|
+
type AdaptiveFlowSchema<TValue> = {
|
|
112
|
+
safeParse?: (value: TValue) => {
|
|
113
|
+
success: boolean;
|
|
114
|
+
error?: {
|
|
115
|
+
message?: string;
|
|
116
|
+
issues?: Array<{
|
|
117
|
+
message?: string;
|
|
118
|
+
path?: Array<string | number>;
|
|
119
|
+
}>;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
parse?: (value: TValue) => unknown;
|
|
123
|
+
};
|
|
124
|
+
type AdaptiveFlowSchemas = {
|
|
125
|
+
email?: AdaptiveFlowSchema<string>;
|
|
126
|
+
otp?: AdaptiveFlowSchema<string>;
|
|
127
|
+
password?: AdaptiveFlowSchema<string>;
|
|
128
|
+
profile?: AdaptiveFlowSchema<AdaptiveContextBase["profile"]>;
|
|
129
|
+
tos?: AdaptiveFlowSchema<boolean>;
|
|
130
|
+
};
|
|
131
|
+
type AdaptiveFlowFieldErrors = Partial<Record<string, string>>;
|
|
106
132
|
type AdaptiveFlowValidators<TContext extends AdaptiveContextBase = AdaptiveContextBase> = {
|
|
107
|
-
email?: (input: string, payload: AdaptiveFlowValidationContext<TContext>) =>
|
|
133
|
+
email?: (input: string, payload: AdaptiveFlowValidationContext<TContext>) => AdaptiveFlowValidationResult;
|
|
108
134
|
otp?: (input: string, payload: AdaptiveFlowValidationContext<TContext> & {
|
|
109
135
|
email: string;
|
|
110
|
-
}) =>
|
|
136
|
+
}) => AdaptiveFlowValidationResult;
|
|
111
137
|
password?: (input: string, payload: AdaptiveFlowValidationContext<TContext> & {
|
|
112
138
|
hasPassword: boolean;
|
|
113
|
-
}) =>
|
|
114
|
-
profile?: (input: AdaptiveContextBase["profile"], payload: AdaptiveFlowValidationContext<TContext>) =>
|
|
115
|
-
tos?: (accepted: boolean, payload: AdaptiveFlowValidationContext<TContext>) =>
|
|
139
|
+
}) => AdaptiveFlowValidationResult;
|
|
140
|
+
profile?: (input: AdaptiveContextBase["profile"], payload: AdaptiveFlowValidationContext<TContext>) => AdaptiveFlowValidationResult;
|
|
141
|
+
tos?: (accepted: boolean, payload: AdaptiveFlowValidationContext<TContext>) => AdaptiveFlowValidationResult;
|
|
116
142
|
};
|
|
117
143
|
type AdaptiveStepTransition<TStep extends string = AdaptiveStep> = {
|
|
118
144
|
from: TStep | null;
|
|
@@ -126,6 +152,7 @@ type AdaptiveStepRendererArgs<TContext extends AdaptiveContextBase, TRequirement
|
|
|
126
152
|
busy: boolean;
|
|
127
153
|
message: string | null;
|
|
128
154
|
errorMessage: string | null;
|
|
155
|
+
fieldErrors: AdaptiveFlowFieldErrors;
|
|
129
156
|
missingRequirements: TRequirement[];
|
|
130
157
|
requirements: readonly TRequirement[];
|
|
131
158
|
setContextPatch: (patch: Partial<TContext>) => void;
|
|
@@ -140,6 +167,7 @@ type AdaptiveStepRenderArgs<TContext extends AdaptiveContextBase = AdaptiveConte
|
|
|
140
167
|
busy: boolean;
|
|
141
168
|
message: string | null;
|
|
142
169
|
errorMessage: string | null;
|
|
170
|
+
fieldErrors: AdaptiveFlowFieldErrors;
|
|
143
171
|
missingRequirements: TRequirement[];
|
|
144
172
|
requirements: readonly TRequirement[];
|
|
145
173
|
defaultView: React.ReactNode;
|
|
@@ -172,7 +200,30 @@ type AdaptiveFlowProps<TContext extends AdaptiveContextBase = AdaptiveContext, T
|
|
|
172
200
|
unstyled?: boolean;
|
|
173
201
|
persistence?: AdaptiveFlowPersistence<TContext>;
|
|
174
202
|
validators?: AdaptiveFlowValidators<TContext>;
|
|
203
|
+
schemas?: AdaptiveFlowSchemas;
|
|
204
|
+
};
|
|
205
|
+
type UseAdaptiveFlowOptions<TContext extends AdaptiveContextBase = AdaptiveContext, TRequirement extends string = AppRequirement, TStep extends string = AdaptiveStep> = Omit<AdaptiveFlowProps<TContext, TRequirement, TStep>, "stepTitles" | "renderStep" | "stepRegistry" | "className" | "classNames" | "styles" | "unstyled">;
|
|
206
|
+
type UseAdaptiveFlowResult<TContext extends AdaptiveContextBase, TRequirement extends string, TStep extends string> = {
|
|
207
|
+
context: TContext;
|
|
208
|
+
step: TStep;
|
|
209
|
+
completeStep: TStep;
|
|
210
|
+
requirements: readonly TRequirement[];
|
|
211
|
+
missingRequirements: TRequirement[];
|
|
212
|
+
transitions: AdaptiveStepTransition<TStep>[];
|
|
213
|
+
busy: boolean;
|
|
214
|
+
message: string | null;
|
|
215
|
+
errorMessage: string | null;
|
|
216
|
+
fieldErrors: AdaptiveFlowFieldErrors;
|
|
217
|
+
setContextPatch: (patch: Partial<TContext>) => void;
|
|
218
|
+
run: (job: () => Promise<void>) => Promise<void>;
|
|
219
|
+
handleEmail: (emailInput: string) => void;
|
|
220
|
+
handleOtp: (code: string) => void;
|
|
221
|
+
handlePassword: (password: string) => void;
|
|
222
|
+
handleProfile: (profile: AdaptiveContextBase["profile"]) => void;
|
|
223
|
+
handleTos: () => void;
|
|
224
|
+
handleOAuth: (provider: OAuthProvider) => void;
|
|
175
225
|
};
|
|
176
|
-
declare function
|
|
226
|
+
declare function useAdaptiveFlow<TContext extends AdaptiveContextBase = AdaptiveContext, TRequirement extends string = AppRequirement, TStep extends string = AdaptiveStep>({ adapter, requirements, requirementGraph, requirementGraphConfig, requirementResolvers, completeStep, initialValue, onComplete, onError, onStepTransition, persistence, validators, schemas, }: UseAdaptiveFlowOptions<TContext, TRequirement, TStep>): UseAdaptiveFlowResult<TContext, TRequirement, TStep>;
|
|
227
|
+
declare function AdaptiveFlow<TContext extends AdaptiveContextBase = AdaptiveContext, TRequirement extends string = AppRequirement, TStep extends string = AdaptiveStep>({ adapter, requirements, requirementGraph, requirementGraphConfig, requirementResolvers, completeStep, stepTitles, renderStep, stepRegistry, initialValue, onComplete, onError, onStepTransition, className, classNames, styles, unstyled, persistence, validators, schemas, }: AdaptiveFlowProps<TContext, TRequirement, TStep>): react_jsx_runtime.JSX.Element;
|
|
177
228
|
|
|
178
|
-
export { type AdaptiveContext, type AdaptiveContextBase, AdaptiveFlow, type AdaptiveFlowAdapter, type AdaptiveFlowClassNames, type AdaptiveFlowPersistence, type AdaptiveFlowProps, type AdaptiveFlowStorageDriver, type AdaptiveFlowStyleSlot, type AdaptiveFlowStyles, type AdaptiveFlowValidationContext, type AdaptiveFlowValidators, type AdaptiveStep, type AdaptiveStepRegistry, type AdaptiveStepRenderArgs, type AdaptiveStepRendererArgs, type AdaptiveStepTransition, type AppRequirement, type DefaultAdaptiveStep, DefaultAdaptiveSteps, type DefaultAppRequirement, DefaultAppRequirements, type IdentityResolution, type MaybePromise, type OAuthProvider, type PersistedAdaptiveFlowState, type RequirementGraph, type RequirementGraphNode, type RequirementResolver, createDefaultRequirementGraph, createRequirementGraph, defaultRequirementResolvers, defaultRequirements, evaluateNextStep, getMissingRequirements, initialContext };
|
|
229
|
+
export { type AdaptiveContext, type AdaptiveContextBase, AdaptiveFlow, type AdaptiveFlowAdapter, type AdaptiveFlowClassNames, type AdaptiveFlowFieldErrors, type AdaptiveFlowPersistence, type AdaptiveFlowProps, type AdaptiveFlowSchema, type AdaptiveFlowSchemas, type AdaptiveFlowStorageDriver, type AdaptiveFlowStyleSlot, type AdaptiveFlowStyles, type AdaptiveFlowValidationContext, type AdaptiveFlowValidationIssue, type AdaptiveFlowValidationResult, type AdaptiveFlowValidators, type AdaptiveStep, type AdaptiveStepRegistry, type AdaptiveStepRenderArgs, type AdaptiveStepRendererArgs, type AdaptiveStepTransition, type AppRequirement, type DefaultAdaptiveStep, DefaultAdaptiveSteps, type DefaultAppRequirement, DefaultAppRequirements, type IdentityResolution, type MaybePromise, type OAuthProvider, type PersistedAdaptiveFlowState, type RequirementGraph, type RequirementGraphNode, type RequirementResolver, type UseAdaptiveFlowOptions, type UseAdaptiveFlowResult, createDefaultRequirementGraph, createRequirementGraph, defaultRequirementResolvers, defaultRequirements, evaluateNextStep, getMissingRequirements, initialContext, useAdaptiveFlow };
|
package/dist/index.d.ts
CHANGED
|
@@ -103,16 +103,42 @@ type PersistedAdaptiveFlowState<TContext extends AdaptiveContextBase = AdaptiveC
|
|
|
103
103
|
type AdaptiveFlowValidationContext<TContext extends AdaptiveContextBase = AdaptiveContextBase> = {
|
|
104
104
|
context: TContext;
|
|
105
105
|
};
|
|
106
|
+
type AdaptiveFlowValidationIssue = {
|
|
107
|
+
message: string;
|
|
108
|
+
field?: string;
|
|
109
|
+
};
|
|
110
|
+
type AdaptiveFlowValidationResult = string | AdaptiveFlowValidationIssue | void | Promise<string | AdaptiveFlowValidationIssue | void>;
|
|
111
|
+
type AdaptiveFlowSchema<TValue> = {
|
|
112
|
+
safeParse?: (value: TValue) => {
|
|
113
|
+
success: boolean;
|
|
114
|
+
error?: {
|
|
115
|
+
message?: string;
|
|
116
|
+
issues?: Array<{
|
|
117
|
+
message?: string;
|
|
118
|
+
path?: Array<string | number>;
|
|
119
|
+
}>;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
parse?: (value: TValue) => unknown;
|
|
123
|
+
};
|
|
124
|
+
type AdaptiveFlowSchemas = {
|
|
125
|
+
email?: AdaptiveFlowSchema<string>;
|
|
126
|
+
otp?: AdaptiveFlowSchema<string>;
|
|
127
|
+
password?: AdaptiveFlowSchema<string>;
|
|
128
|
+
profile?: AdaptiveFlowSchema<AdaptiveContextBase["profile"]>;
|
|
129
|
+
tos?: AdaptiveFlowSchema<boolean>;
|
|
130
|
+
};
|
|
131
|
+
type AdaptiveFlowFieldErrors = Partial<Record<string, string>>;
|
|
106
132
|
type AdaptiveFlowValidators<TContext extends AdaptiveContextBase = AdaptiveContextBase> = {
|
|
107
|
-
email?: (input: string, payload: AdaptiveFlowValidationContext<TContext>) =>
|
|
133
|
+
email?: (input: string, payload: AdaptiveFlowValidationContext<TContext>) => AdaptiveFlowValidationResult;
|
|
108
134
|
otp?: (input: string, payload: AdaptiveFlowValidationContext<TContext> & {
|
|
109
135
|
email: string;
|
|
110
|
-
}) =>
|
|
136
|
+
}) => AdaptiveFlowValidationResult;
|
|
111
137
|
password?: (input: string, payload: AdaptiveFlowValidationContext<TContext> & {
|
|
112
138
|
hasPassword: boolean;
|
|
113
|
-
}) =>
|
|
114
|
-
profile?: (input: AdaptiveContextBase["profile"], payload: AdaptiveFlowValidationContext<TContext>) =>
|
|
115
|
-
tos?: (accepted: boolean, payload: AdaptiveFlowValidationContext<TContext>) =>
|
|
139
|
+
}) => AdaptiveFlowValidationResult;
|
|
140
|
+
profile?: (input: AdaptiveContextBase["profile"], payload: AdaptiveFlowValidationContext<TContext>) => AdaptiveFlowValidationResult;
|
|
141
|
+
tos?: (accepted: boolean, payload: AdaptiveFlowValidationContext<TContext>) => AdaptiveFlowValidationResult;
|
|
116
142
|
};
|
|
117
143
|
type AdaptiveStepTransition<TStep extends string = AdaptiveStep> = {
|
|
118
144
|
from: TStep | null;
|
|
@@ -126,6 +152,7 @@ type AdaptiveStepRendererArgs<TContext extends AdaptiveContextBase, TRequirement
|
|
|
126
152
|
busy: boolean;
|
|
127
153
|
message: string | null;
|
|
128
154
|
errorMessage: string | null;
|
|
155
|
+
fieldErrors: AdaptiveFlowFieldErrors;
|
|
129
156
|
missingRequirements: TRequirement[];
|
|
130
157
|
requirements: readonly TRequirement[];
|
|
131
158
|
setContextPatch: (patch: Partial<TContext>) => void;
|
|
@@ -140,6 +167,7 @@ type AdaptiveStepRenderArgs<TContext extends AdaptiveContextBase = AdaptiveConte
|
|
|
140
167
|
busy: boolean;
|
|
141
168
|
message: string | null;
|
|
142
169
|
errorMessage: string | null;
|
|
170
|
+
fieldErrors: AdaptiveFlowFieldErrors;
|
|
143
171
|
missingRequirements: TRequirement[];
|
|
144
172
|
requirements: readonly TRequirement[];
|
|
145
173
|
defaultView: React.ReactNode;
|
|
@@ -172,7 +200,30 @@ type AdaptiveFlowProps<TContext extends AdaptiveContextBase = AdaptiveContext, T
|
|
|
172
200
|
unstyled?: boolean;
|
|
173
201
|
persistence?: AdaptiveFlowPersistence<TContext>;
|
|
174
202
|
validators?: AdaptiveFlowValidators<TContext>;
|
|
203
|
+
schemas?: AdaptiveFlowSchemas;
|
|
204
|
+
};
|
|
205
|
+
type UseAdaptiveFlowOptions<TContext extends AdaptiveContextBase = AdaptiveContext, TRequirement extends string = AppRequirement, TStep extends string = AdaptiveStep> = Omit<AdaptiveFlowProps<TContext, TRequirement, TStep>, "stepTitles" | "renderStep" | "stepRegistry" | "className" | "classNames" | "styles" | "unstyled">;
|
|
206
|
+
type UseAdaptiveFlowResult<TContext extends AdaptiveContextBase, TRequirement extends string, TStep extends string> = {
|
|
207
|
+
context: TContext;
|
|
208
|
+
step: TStep;
|
|
209
|
+
completeStep: TStep;
|
|
210
|
+
requirements: readonly TRequirement[];
|
|
211
|
+
missingRequirements: TRequirement[];
|
|
212
|
+
transitions: AdaptiveStepTransition<TStep>[];
|
|
213
|
+
busy: boolean;
|
|
214
|
+
message: string | null;
|
|
215
|
+
errorMessage: string | null;
|
|
216
|
+
fieldErrors: AdaptiveFlowFieldErrors;
|
|
217
|
+
setContextPatch: (patch: Partial<TContext>) => void;
|
|
218
|
+
run: (job: () => Promise<void>) => Promise<void>;
|
|
219
|
+
handleEmail: (emailInput: string) => void;
|
|
220
|
+
handleOtp: (code: string) => void;
|
|
221
|
+
handlePassword: (password: string) => void;
|
|
222
|
+
handleProfile: (profile: AdaptiveContextBase["profile"]) => void;
|
|
223
|
+
handleTos: () => void;
|
|
224
|
+
handleOAuth: (provider: OAuthProvider) => void;
|
|
175
225
|
};
|
|
176
|
-
declare function
|
|
226
|
+
declare function useAdaptiveFlow<TContext extends AdaptiveContextBase = AdaptiveContext, TRequirement extends string = AppRequirement, TStep extends string = AdaptiveStep>({ adapter, requirements, requirementGraph, requirementGraphConfig, requirementResolvers, completeStep, initialValue, onComplete, onError, onStepTransition, persistence, validators, schemas, }: UseAdaptiveFlowOptions<TContext, TRequirement, TStep>): UseAdaptiveFlowResult<TContext, TRequirement, TStep>;
|
|
227
|
+
declare function AdaptiveFlow<TContext extends AdaptiveContextBase = AdaptiveContext, TRequirement extends string = AppRequirement, TStep extends string = AdaptiveStep>({ adapter, requirements, requirementGraph, requirementGraphConfig, requirementResolvers, completeStep, stepTitles, renderStep, stepRegistry, initialValue, onComplete, onError, onStepTransition, className, classNames, styles, unstyled, persistence, validators, schemas, }: AdaptiveFlowProps<TContext, TRequirement, TStep>): react_jsx_runtime.JSX.Element;
|
|
177
228
|
|
|
178
|
-
export { type AdaptiveContext, type AdaptiveContextBase, AdaptiveFlow, type AdaptiveFlowAdapter, type AdaptiveFlowClassNames, type AdaptiveFlowPersistence, type AdaptiveFlowProps, type AdaptiveFlowStorageDriver, type AdaptiveFlowStyleSlot, type AdaptiveFlowStyles, type AdaptiveFlowValidationContext, type AdaptiveFlowValidators, type AdaptiveStep, type AdaptiveStepRegistry, type AdaptiveStepRenderArgs, type AdaptiveStepRendererArgs, type AdaptiveStepTransition, type AppRequirement, type DefaultAdaptiveStep, DefaultAdaptiveSteps, type DefaultAppRequirement, DefaultAppRequirements, type IdentityResolution, type MaybePromise, type OAuthProvider, type PersistedAdaptiveFlowState, type RequirementGraph, type RequirementGraphNode, type RequirementResolver, createDefaultRequirementGraph, createRequirementGraph, defaultRequirementResolvers, defaultRequirements, evaluateNextStep, getMissingRequirements, initialContext };
|
|
229
|
+
export { type AdaptiveContext, type AdaptiveContextBase, AdaptiveFlow, type AdaptiveFlowAdapter, type AdaptiveFlowClassNames, type AdaptiveFlowFieldErrors, type AdaptiveFlowPersistence, type AdaptiveFlowProps, type AdaptiveFlowSchema, type AdaptiveFlowSchemas, type AdaptiveFlowStorageDriver, type AdaptiveFlowStyleSlot, type AdaptiveFlowStyles, type AdaptiveFlowValidationContext, type AdaptiveFlowValidationIssue, type AdaptiveFlowValidationResult, type AdaptiveFlowValidators, type AdaptiveStep, type AdaptiveStepRegistry, type AdaptiveStepRenderArgs, type AdaptiveStepRendererArgs, type AdaptiveStepTransition, type AppRequirement, type DefaultAdaptiveStep, DefaultAdaptiveSteps, type DefaultAppRequirement, DefaultAppRequirements, type IdentityResolution, type MaybePromise, type OAuthProvider, type PersistedAdaptiveFlowState, type RequirementGraph, type RequirementGraphNode, type RequirementResolver, type UseAdaptiveFlowOptions, type UseAdaptiveFlowResult, createDefaultRequirementGraph, createRequirementGraph, defaultRequirementResolvers, defaultRequirements, evaluateNextStep, getMissingRequirements, initialContext, useAdaptiveFlow };
|