@rilaykit/workflow 3.0.0 → 5.0.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/dist/index.d.mts CHANGED
@@ -1,27 +1,133 @@
1
- import { ril, FormConfiguration, StepLifecycleHooks, StepPermissions, CustomStepRenderer, DynamicStepConfig, NavigationConfig, PersistenceConfig, WorkflowAnalytics, CompletionConfig, WorkflowPlugin, StepConfig, WorkflowConfig, WorkflowContext, ValidationError, ValidationResult, RendererChildrenFunction, WorkflowNextButtonRendererProps, WorkflowPreviousButtonRendererProps, WorkflowSkipButtonRendererProps, WorkflowStepperRendererProps } from '@rilaykit/core';
1
+ import { ril, FormConfiguration, CustomStepRenderer, StepDataHelper, WorkflowContext, WorkflowAnalytics, WorkflowPlugin, StepConfig, WorkflowConfig, ComponentRendererBaseProps, WorkflowNextButtonRendererProps, WorkflowPreviousButtonRendererProps, WorkflowSkipButtonRendererProps, WorkflowStepperRendererProps } from '@rilaykit/core';
2
2
  export * from '@rilaykit/core';
3
- export { createZodValidator, ril } from '@rilaykit/core';
4
3
  import { form } from '@rilaykit/forms';
5
4
  export { form } from '@rilaykit/forms';
6
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
- import * as react from 'react';
8
- import react__default from 'react';
6
+ import React from 'react';
9
7
 
8
+ /**
9
+ * Enhanced step configuration interface for better type safety and simplicity
10
+ *
11
+ * This interface defines the structure for creating workflow steps with all
12
+ * necessary configuration options. It provides a clean API for step definition
13
+ * while maintaining flexibility for complex workflows.
14
+ *
15
+ * @interface StepDefinition
16
+ */
10
17
  interface StepDefinition {
11
- id: string;
18
+ /**
19
+ * Unique identifier for the step
20
+ * If not provided, will be auto-generated using the internal ID generator
21
+ */
22
+ id?: string;
23
+ /**
24
+ * Display title for the step
25
+ * This will be shown to users in the workflow interface
26
+ */
12
27
  title: string;
28
+ /**
29
+ * Optional description providing additional context about the step
30
+ * Useful for complex workflows where steps need explanation
31
+ */
13
32
  description?: string;
33
+ /**
34
+ * Form configuration for the step
35
+ * Can be either a built FormConfiguration or a form builder instance
36
+ */
14
37
  formConfig: FormConfiguration | form;
38
+ /**
39
+ * Whether users can skip this step
40
+ * @default false
41
+ */
15
42
  allowSkip?: boolean;
43
+ /**
44
+ * Whether this step is required to complete the workflow
45
+ * @default true
46
+ */
16
47
  requiredToComplete?: boolean;
17
- hooks?: StepLifecycleHooks;
18
- permissions?: StepPermissions;
48
+ /**
49
+ * Custom renderer for the step
50
+ * Allows complete customization of step presentation
51
+ */
19
52
  renderer?: CustomStepRenderer;
20
- dynamicConfig?: DynamicStepConfig;
53
+ /**
54
+ * Callback function that executes after successful validation and before moving to next step
55
+ * Provides clean helper methods for modifying workflow data and pre-filling subsequent steps
56
+ *
57
+ * @param stepData - The validated data from the current step
58
+ * @param helper - Helper object with methods to modify workflow data cleanly
59
+ * @param context - Full workflow context for reference
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * onAfterValidation: async (stepData, helper, context) => {
64
+ * // API call based on current step data
65
+ * const companyInfo = await fetchCompanyBySiren(stepData.siren);
66
+ *
67
+ * // Pre-fill next step with clean helper methods
68
+ * helper.setNextStepFields({
69
+ * companyName: companyInfo.name,
70
+ * address: companyInfo.address,
71
+ * industry: companyInfo.sector
72
+ * });
73
+ *
74
+ * // Or set data for a specific step
75
+ * helper.setStepFields('company-details', {
76
+ * legalForm: companyInfo.legalForm,
77
+ * foundedYear: companyInfo.creation_date
78
+ * });
79
+ * }
80
+ * ```
81
+ */
82
+ onAfterValidation?: (stepData: Record<string, any>, helper: StepDataHelper, context: WorkflowContext) => void | Promise<void>;
83
+ }
84
+ /**
85
+ * Configuration options for workflow behavior and features
86
+ *
87
+ * This interface consolidates all workflow-level configuration options
88
+ * into a single, easy-to-use structure for the configure() method.
89
+ *
90
+ * @interface WorkflowOptions
91
+ */
92
+ interface WorkflowOptions {
93
+ /** Analytics and tracking configuration */
94
+ analytics?: WorkflowAnalytics;
21
95
  }
22
96
  /**
23
97
  * Workflow builder class for creating complex multi-step workflows
24
- * Simplified API with auto-build capability
98
+ *
99
+ * The flow class provides a comprehensive API for building multi-step workflows
100
+ * with form-based steps. It follows the builder pattern with method chaining
101
+ * and includes advanced features like dynamic steps, plugins, and analytics.
102
+ *
103
+ * Key Features:
104
+ * - Polymorphic step addition (single or multiple steps)
105
+ * - Plugin system for extensibility
106
+ * - Built-in validation and error handling
107
+ * - Clone and export/import functionality
108
+ * - Comprehensive statistics and analytics
109
+ * - Type-safe configuration management
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * const workflow = flow.create(rilConfig, 'user-onboarding', 'User Onboarding')
114
+ * .addStep({
115
+ * title: 'Personal Information',
116
+ * formConfig: personalInfoForm
117
+ * })
118
+ * .addStep({
119
+ * title: 'Account Setup',
120
+ * formConfig: accountForm,
121
+ * allowSkip: true
122
+ * })
123
+ * .configure({
124
+ * navigation: { allowBackNavigation: true },
125
+ * persistence: { saveOnStepComplete: true }
126
+ * })
127
+ * .build();
128
+ * ```
129
+ *
130
+ * @class flow
25
131
  */
26
132
  declare class flow {
27
133
  private config;
@@ -29,91 +135,384 @@ declare class flow {
29
135
  private workflowName;
30
136
  private workflowDescription?;
31
137
  private steps;
32
- private navigation;
33
- private persistence?;
34
- private completion?;
35
138
  private analytics?;
36
139
  private plugins;
140
+ private idGenerator;
141
+ /**
142
+ * Creates a new workflow builder instance
143
+ *
144
+ * @param config - The ril configuration instance
145
+ * @param workflowId - Unique identifier for the workflow
146
+ * @param workflowName - Display name for the workflow
147
+ * @param description - Optional description of the workflow purpose
148
+ */
37
149
  constructor(config: ril, workflowId: string, workflowName: string, description?: string);
150
+ /**
151
+ * Static factory method to create a new workflow builder
152
+ *
153
+ * This is the preferred way to create workflow builders as it provides
154
+ * better type inference and follows the factory pattern.
155
+ *
156
+ * @param config - The ril configuration instance
157
+ * @param workflowId - Unique identifier for the workflow
158
+ * @param workflowName - Display name for the workflow
159
+ * @param description - Optional description of the workflow purpose
160
+ * @returns A new flow builder instance
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * const workflow = flow.create(rilConfig, 'checkout', 'Checkout Process');
165
+ * ```
166
+ */
38
167
  static create(config: ril, workflowId: string, workflowName: string, description?: string): flow;
39
168
  /**
40
169
  * Helper method to create a step configuration from StepDefinition
170
+ *
171
+ * This internal method handles the conversion from the user-friendly
172
+ * StepDefinition interface to the internal StepConfig structure,
173
+ * including ID generation, form configuration processing, and validation setup.
174
+ *
175
+ * @private
176
+ * @param stepDef - The step definition to convert
177
+ * @returns A complete StepConfig object
41
178
  */
42
179
  private createStepFromDefinition;
43
180
  /**
44
- * Add a step using simplified StepDefinition object
181
+ * Universal add method - handles single steps or multiple steps
182
+ *
183
+ * This polymorphic method provides a clean API for adding steps to the workflow.
184
+ * It can handle both single step definitions and arrays of step definitions,
185
+ * making it easy to build workflows programmatically.
186
+ *
187
+ * @param stepDefinition - Single step definition
188
+ * @returns The flow instance for method chaining
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * // Add a single step
193
+ * workflow.addStep({
194
+ * title: 'User Details',
195
+ * formConfig: userForm
196
+ * });
197
+ * ```
45
198
  */
46
199
  addStep(stepDefinition: StepDefinition): this;
47
200
  /**
48
- * Add a dynamic step using StepDefinition with dynamicConfig
201
+ * Universal add method - handles single steps or multiple steps
202
+ *
203
+ * @param stepDefinitions - Array of step definitions
204
+ * @returns The flow instance for method chaining
205
+ *
206
+ * @example
207
+ * ```typescript
208
+ * // Add multiple steps at once
209
+ * workflow.addStep([
210
+ * { title: 'Step 1', formConfig: form1 },
211
+ * { title: 'Step 2', formConfig: form2 }
212
+ * ]);
213
+ * ```
49
214
  */
50
- addDynamicStep(stepDefinition: StepDefinition & {
51
- dynamicConfig: DynamicStepConfig;
52
- }): this;
215
+ addStep(stepDefinitions: StepDefinition[]): this;
53
216
  /**
54
- * Add multiple steps at once
217
+ * Universal configuration method for all workflow options
218
+ *
219
+ * This method replaces individual setter methods with a single consolidated API
220
+ * for configuring all aspects of workflow behavior. It uses deep merging to
221
+ * preserve existing configurations while applying new settings.
222
+ *
223
+ * @param options - Configuration options to apply
224
+ * @returns The flow instance for method chaining
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * workflow.configure({
229
+ * navigation: {
230
+ * allowBackNavigation: true,
231
+ * showProgressBar: true
232
+ * },
233
+ * persistence: {
234
+ * saveOnStepComplete: true,
235
+ * storageKey: 'my-workflow'
236
+ * },
237
+ * analytics: {
238
+ * trackStepCompletion: true,
239
+ * trackFieldInteractions: false
240
+ * }
241
+ * });
242
+ * ```
55
243
  */
56
- addSteps(stepDefinitions: StepDefinition[]): this;
244
+ configure(options: WorkflowOptions): this;
57
245
  /**
58
- * Configuration setters with fluent interface
246
+ * Plugin management with enhanced validation
247
+ *
248
+ * Installs a plugin into the workflow with dependency validation.
249
+ * Plugins can extend workflow functionality, add custom renderers,
250
+ * or integrate with external services.
251
+ *
252
+ * @param plugin - The plugin to install
253
+ * @returns The flow instance for method chaining
254
+ * @throws Error if plugin installation fails or dependencies are missing
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * workflow.use(customPlugin)
259
+ * .use(anotherPlugin);
260
+ * ```
59
261
  */
60
- setNavigation(navigation: NavigationConfig): this;
61
- enableBackNavigation(enabled?: boolean): this;
62
- enableStepSkipping(enabled?: boolean): this;
63
- setPersistence(persistence: PersistenceConfig): this;
64
- setAnalytics(analytics: WorkflowAnalytics): this;
65
- setCompletion(completion: CompletionConfig): this;
262
+ use(plugin: WorkflowPlugin): this;
66
263
  /**
67
- * Plugin management
264
+ * Validates plugin dependencies before installation
265
+ *
266
+ * @private
267
+ * @param plugin - The plugin to validate
268
+ * @throws Error if required dependencies are missing
68
269
  */
69
- use(plugin: WorkflowPlugin): this;
70
270
  private validatePluginDependencies;
271
+ /**
272
+ * Remove a plugin from the workflow
273
+ *
274
+ * @param pluginName - Name of the plugin to remove
275
+ * @returns The flow instance for method chaining
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * workflow.removePlugin('analytics-plugin');
280
+ * ```
281
+ */
71
282
  removePlugin(pluginName: string): this;
72
283
  /**
73
- * Step management
284
+ * Update an existing step configuration
285
+ *
286
+ * Allows modification of step properties after the step has been added.
287
+ * Useful for dynamic workflows or configuration updates based on user input.
288
+ *
289
+ * @param stepId - ID of the step to update
290
+ * @param updates - Partial step configuration updates
291
+ * @returns The flow instance for method chaining
292
+ * @throws Error if step with given ID is not found
293
+ *
294
+ * @example
295
+ * ```typescript
296
+ * workflow.updateStep('step-1', {
297
+ * title: 'Updated Title',
298
+ * allowSkip: true
299
+ * });
300
+ * ```
74
301
  */
75
302
  updateStep(stepId: string, updates: Partial<Omit<StepConfig, 'id'>>): this;
303
+ /**
304
+ * Remove a step from the workflow
305
+ *
306
+ * @param stepId - ID of the step to remove
307
+ * @returns The flow instance for method chaining
308
+ *
309
+ * @example
310
+ * ```typescript
311
+ * workflow.removeStep('optional-step');
312
+ * ```
313
+ */
76
314
  removeStep(stepId: string): this;
315
+ /**
316
+ * Get a specific step by ID
317
+ *
318
+ * @param stepId - ID of the step to retrieve
319
+ * @returns The step configuration or undefined if not found
320
+ *
321
+ * @example
322
+ * ```typescript
323
+ * const step = workflow.getStep('user-details');
324
+ * if (step) {
325
+ * console.log(step.title);
326
+ * }
327
+ * ```
328
+ */
77
329
  getStep(stepId: string): StepConfig | undefined;
330
+ /**
331
+ * Get all steps in the workflow
332
+ *
333
+ * Returns a copy of the steps array to prevent external modification.
334
+ *
335
+ * @returns Array of all step configurations
336
+ *
337
+ * @example
338
+ * ```typescript
339
+ * const allSteps = workflow.getSteps();
340
+ * console.log(`Workflow has ${allSteps.length} steps`);
341
+ * ```
342
+ */
78
343
  getSteps(): StepConfig[];
344
+ /**
345
+ * Clear all steps from the workflow
346
+ *
347
+ * Removes all steps and resets the ID generator. Useful for rebuilding
348
+ * workflows or creating templates.
349
+ *
350
+ * @returns The flow instance for method chaining
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * workflow.clearSteps()
355
+ * .addStep(newStep1)
356
+ * .addStep(newStep2);
357
+ * ```
358
+ */
79
359
  clearSteps(): this;
80
360
  /**
81
361
  * Clone the workflow builder
362
+ *
363
+ * Creates a deep copy of the workflow builder with optional new ID and name.
364
+ * All configuration, steps, and plugins are copied to the new instance.
365
+ *
366
+ * @param newWorkflowId - Optional new workflow ID
367
+ * @param newWorkflowName - Optional new workflow name
368
+ * @returns A new flow instance with copied configuration
369
+ *
370
+ * @example
371
+ * ```typescript
372
+ * const template = workflow.clone('new-workflow', 'New Workflow');
373
+ * template.addStep(additionalStep);
374
+ * ```
82
375
  */
83
376
  clone(newWorkflowId?: string, newWorkflowName?: string): flow;
84
377
  /**
85
- * Validate the workflow configuration
378
+ * Enhanced validation using shared utilities
379
+ *
380
+ * Performs comprehensive validation of the workflow configuration,
381
+ * checking for common issues like missing steps, duplicate IDs,
382
+ * and plugin dependency problems.
383
+ *
384
+ * @returns Array of validation error messages (empty if valid)
385
+ *
386
+ * @example
387
+ * ```typescript
388
+ * const errors = workflow.validate();
389
+ * if (errors.length > 0) {
390
+ * console.error('Validation errors:', errors);
391
+ * }
392
+ * ```
86
393
  */
87
394
  validate(): string[];
88
395
  /**
89
- * Get workflow statistics
396
+ * Get comprehensive workflow statistics
397
+ *
398
+ * Provides detailed analytics about the workflow structure and configuration.
399
+ * Useful for monitoring, optimization, and reporting purposes.
400
+ *
401
+ * @returns Object containing various workflow statistics
402
+ *
403
+ * @example
404
+ * ```typescript
405
+ * const stats = workflow.getStats();
406
+ * console.log(`Workflow has ${stats.totalSteps} steps`);
407
+ * console.log(`Estimated ${stats.estimatedFields} total fields`);
408
+ * ```
90
409
  */
91
410
  getStats(): {
92
411
  totalSteps: number;
93
- dynamicSteps: number;
94
- pluginsInstalled: number;
95
- estimatedFields: number;
96
- hasPersistence: boolean;
412
+ totalFields: number;
413
+ averageFieldsPerStep: number;
414
+ maxFieldsInStep: number;
415
+ minFieldsInStep: number;
97
416
  hasAnalytics: boolean;
98
- allowBackNavigation: boolean;
99
417
  };
100
418
  /**
101
419
  * Build the final workflow configuration
420
+ *
421
+ * Validates the workflow and creates the final configuration object
422
+ * that can be used by the workflow runtime. This method should be
423
+ * called after all configuration is complete.
424
+ *
425
+ * @returns Complete workflow configuration
426
+ * @throws Error if validation fails
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * try {
431
+ * const workflowConfig = workflow.build();
432
+ * // Use workflowConfig with workflow runtime
433
+ * } catch (error) {
434
+ * console.error('Workflow build failed:', error.message);
435
+ * }
436
+ * ```
102
437
  */
103
438
  build(): WorkflowConfig;
104
439
  /**
105
- * Export/Import functionality
440
+ * Export workflow configuration to JSON
441
+ *
442
+ * Serializes the workflow configuration to a JSON-compatible object.
443
+ * Useful for saving workflows, creating templates, or transferring
444
+ * configurations between systems.
445
+ *
446
+ * @returns JSON-serializable workflow configuration
447
+ *
448
+ * @example
449
+ * ```typescript
450
+ * const json = workflow.toJSON();
451
+ * localStorage.setItem('workflow-template', JSON.stringify(json));
452
+ * ```
106
453
  */
107
454
  toJSON(): any;
455
+ /**
456
+ * Import workflow configuration from JSON
457
+ *
458
+ * Loads workflow configuration from a JSON object. This method
459
+ * performs partial updates, only modifying properties that are
460
+ * present in the JSON object.
461
+ *
462
+ * @param json - JSON object containing workflow configuration
463
+ * @returns The flow instance for method chaining
464
+ *
465
+ * @example
466
+ * ```typescript
467
+ * const json = JSON.parse(localStorage.getItem('workflow-template'));
468
+ * workflow.fromJSON(json);
469
+ * ```
470
+ */
108
471
  fromJSON(json: any): this;
109
472
  }
110
473
  /**
111
474
  * Factory function to create a workflow builder directly
475
+ *
476
+ * This is a convenience function that provides an alternative to using
477
+ * the class constructor or static create method. It's particularly useful
478
+ * for functional programming styles or when you prefer function calls
479
+ * over class instantiation.
480
+ *
481
+ * @param config - The ril configuration instance
482
+ * @param workflowId - Unique identifier for the workflow
483
+ * @param workflowName - Display name for the workflow
484
+ * @param description - Optional description of the workflow purpose
485
+ * @returns A new flow builder instance
486
+ *
487
+ * @example
488
+ * ```typescript
489
+ * const workflow = createFlow(rilConfig, 'onboarding', 'User Onboarding');
490
+ * ```
112
491
  */
113
492
  declare function createFlow(config: ril, workflowId: string, workflowName: string, description?: string): flow;
493
+ /**
494
+ * Module augmentation to add createFlow method to ril instances
495
+ *
496
+ * This declaration extends the ril interface to include the createFlow
497
+ * method, allowing for a more integrated API experience where workflows
498
+ * can be created directly from ril configuration instances.
499
+ */
114
500
  declare module '@rilaykit/core' {
115
501
  interface ril {
116
- createFlow(workflowId: string, workflowName: string, description?: string): flow;
502
+ /**
503
+ * Creates a new workflow builder using this ril configuration
504
+ *
505
+ * @param workflowId - Unique identifier for the workflow
506
+ * @param workflowName - Display name for the workflow
507
+ * @param description - Optional description of the workflow purpose
508
+ * @returns A new flow builder instance
509
+ *
510
+ * @example
511
+ * ```typescript
512
+ * const workflow = rilConfig.createFlow('checkout', 'Checkout Process');
513
+ * ```
514
+ */
515
+ flow(workflowId: string, workflowName: string, description?: string): flow;
117
516
  }
118
517
  }
119
518
 
@@ -121,14 +520,9 @@ interface WorkflowState {
121
520
  currentStepIndex: number;
122
521
  allData: Record<string, any>;
123
522
  stepData: Record<string, any>;
124
- errors: Record<string, ValidationError[]>;
125
- touched: Set<string>;
126
- isValidating: Set<string>;
127
523
  visitedSteps: Set<string>;
128
524
  isSubmitting: boolean;
129
525
  isTransitioning: boolean;
130
- persistedData?: any;
131
- resolvedSteps: StepConfig[];
132
526
  }
133
527
  interface WorkflowContextValue {
134
528
  workflowState: WorkflowState;
@@ -142,27 +536,22 @@ interface WorkflowContextValue {
142
536
  skipStep: () => Promise<boolean>;
143
537
  setValue: (fieldId: string, value: any) => void;
144
538
  setStepData: (data: Record<string, any>) => void;
145
- validateCurrentStep: () => Promise<ValidationResult>;
146
539
  submitWorkflow: () => Promise<void>;
147
540
  resetWorkflow: () => void;
148
- saveDraft: () => Promise<void>;
149
- loadDraft: () => Promise<void>;
150
- clearDraft: () => Promise<void>;
151
541
  }
152
542
  interface WorkflowProviderProps {
153
- children: react__default.ReactNode;
543
+ children: React.ReactNode;
154
544
  workflowConfig: WorkflowConfig;
155
545
  defaultValues?: Record<string, any>;
156
546
  onStepChange?: (fromStep: number, toStep: number, context: WorkflowContext) => void;
157
547
  onWorkflowComplete?: (data: Record<string, any>) => void | Promise<void>;
158
548
  className?: string;
159
- user?: any;
160
549
  }
161
- declare function WorkflowProvider({ children, workflowConfig, defaultValues, onStepChange, onWorkflowComplete, className, user, }: WorkflowProviderProps): react_jsx_runtime.JSX.Element;
550
+ declare function WorkflowProvider({ children, workflowConfig, defaultValues, onStepChange, onWorkflowComplete, className, }: WorkflowProviderProps): react_jsx_runtime.JSX.Element;
162
551
  declare function useWorkflowContext(): WorkflowContextValue;
163
552
 
164
553
  type WorkflowProps = Omit<WorkflowProviderProps, 'children' | 'workflowConfig'> & {
165
- children: react__default.ReactNode;
554
+ children: React.ReactNode;
166
555
  workflowConfig: WorkflowConfig | flow;
167
556
  };
168
557
  /**
@@ -179,34 +568,16 @@ declare function Workflow({ children, workflowConfig, ...props }: WorkflowProps)
179
568
  */
180
569
  declare function WorkflowBody(): react_jsx_runtime.JSX.Element | null;
181
570
 
182
- interface WorkflowNextButtonProps {
183
- className?: string;
184
- children?: React.ReactNode | RendererChildrenFunction<WorkflowNextButtonRendererProps>;
185
- renderAs?: 'default' | 'children' | boolean;
186
- }
187
- declare function WorkflowNextButton({ className, children, renderAs }: WorkflowNextButtonProps): react.ReactNode;
571
+ declare function WorkflowNextButton({ className, ...props }: ComponentRendererBaseProps<WorkflowNextButtonRendererProps>): react_jsx_runtime.JSX.Element;
188
572
 
189
- interface WorkflowPreviousButtonProps {
190
- className?: string;
191
- children?: React.ReactNode | RendererChildrenFunction<WorkflowPreviousButtonRendererProps>;
192
- renderAs?: 'default' | 'children' | boolean;
193
- }
194
- declare function WorkflowPreviousButton({ className, children, renderAs, }: WorkflowPreviousButtonProps): react.ReactNode;
573
+ declare function WorkflowPreviousButton({ className, ...props }: ComponentRendererBaseProps<WorkflowPreviousButtonRendererProps>): react_jsx_runtime.JSX.Element;
195
574
 
196
- interface WorkflowSkipButtonProps {
197
- className?: string;
198
- children?: React.ReactNode | RendererChildrenFunction<WorkflowSkipButtonRendererProps>;
199
- renderAs?: 'default' | 'children' | boolean;
200
- }
201
- declare function WorkflowSkipButton({ className, children, renderAs }: WorkflowSkipButtonProps): react.ReactNode;
575
+ declare function WorkflowSkipButton({ className, ...props }: ComponentRendererBaseProps<WorkflowSkipButtonRendererProps>): react_jsx_runtime.JSX.Element;
202
576
 
203
- interface WorkflowStepperProps {
577
+ interface WorkflowStepperProps extends ComponentRendererBaseProps<WorkflowStepperRendererProps> {
204
578
  onStepClick?: (stepIndex: number) => void;
205
- className?: string;
206
- children?: React.ReactNode | RendererChildrenFunction<WorkflowStepperRendererProps>;
207
- renderAs?: 'default' | 'children' | boolean;
208
579
  }
209
- declare function WorkflowStepper({ onStepClick, className, children, renderAs, }: WorkflowStepperProps): react.ReactNode;
580
+ declare function WorkflowStepper({ onStepClick, className, ...props }: WorkflowStepperProps): react_jsx_runtime.JSX.Element;
210
581
 
211
582
  interface LicensePayload {
212
583
  plan: 'ARCHITECT' | 'FOUNDRY';
@@ -276,93 +647,4 @@ declare class RilayLicenseManager {
276
647
  }>;
277
648
  }
278
649
 
279
- interface AnalyticsPluginConfig {
280
- providers: {
281
- googleAnalytics?: {
282
- trackingId: string;
283
- customDimensions?: Record<string, string>;
284
- };
285
- mixpanel?: {
286
- token: string;
287
- options?: any;
288
- };
289
- amplitude?: {
290
- apiKey: string;
291
- options?: any;
292
- };
293
- custom?: {
294
- endpoint: string;
295
- headers?: Record<string, string>;
296
- };
297
- };
298
- eventMapping?: {
299
- workflowStart?: string;
300
- workflowComplete?: string;
301
- stepStart?: string;
302
- stepComplete?: string;
303
- stepSkip?: string;
304
- validationError?: string;
305
- };
306
- includeUserContext?: boolean;
307
- includeFormData?: boolean;
308
- enablePerformanceTracking?: boolean;
309
- }
310
- declare class AnalyticsPlugin implements WorkflowPlugin {
311
- name: string;
312
- version: string;
313
- private config;
314
- private performanceData;
315
- constructor(config: AnalyticsPluginConfig);
316
- install(workflowBuilder: any): void;
317
- private track;
318
- private trackGoogleAnalytics;
319
- private trackMixpanel;
320
- private trackAmplitude;
321
- private trackCustom;
322
- private getContextData;
323
- private calculateCompletionPercentage;
324
- }
325
-
326
- interface ValidationPluginConfig {
327
- schema?: {
328
- type: 'zod' | 'yup' | 'custom';
329
- schema?: any;
330
- };
331
- rules: {
332
- required?: string[];
333
- email?: string[];
334
- phone?: string[];
335
- minLength?: Record<string, number>;
336
- maxLength?: Record<string, number>;
337
- pattern?: Record<string, RegExp>;
338
- custom?: Record<string, (value: any, context: WorkflowContext) => ValidationResult | Promise<ValidationResult>>;
339
- };
340
- crossFieldValidation?: Array<{
341
- fields: string[];
342
- validator: (values: Record<string, any>, context: WorkflowContext) => ValidationResult | Promise<ValidationResult>;
343
- message: string;
344
- }>;
345
- asyncRules?: Record<string, {
346
- url: string;
347
- debounceMs?: number;
348
- method?: 'GET' | 'POST';
349
- headers?: Record<string, string>;
350
- }>;
351
- onValidationComplete?: (result: ValidationResult, context: WorkflowContext) => void;
352
- }
353
- declare class ValidationPlugin implements WorkflowPlugin {
354
- name: string;
355
- version: string;
356
- dependencies: never[];
357
- private config;
358
- private debounceTimers;
359
- constructor(config: ValidationPluginConfig);
360
- install(workflowBuilder: any): void;
361
- private validateStep;
362
- private validateWithSchema;
363
- private validateWithRules;
364
- private validateCrossField;
365
- private validateAsync;
366
- }
367
-
368
- export { AnalyticsPlugin, type LicensePayload, type LicensePlan, type LicenseResult, RilayLicenseManager, type StepDefinition, ValidationPlugin, Workflow, WorkflowBody, type WorkflowContextValue, WorkflowNextButton, type WorkflowNextButtonProps, WorkflowPreviousButton, type WorkflowPreviousButtonProps, WorkflowProvider, type WorkflowProviderProps, WorkflowSkipButton, type WorkflowSkipButtonProps, WorkflowStepper, type WorkflowStepperProps, createFlow, flow, useWorkflowContext };
650
+ export { type LicensePayload, type LicensePlan, type LicenseResult, RilayLicenseManager, type StepDefinition, Workflow, WorkflowBody, type WorkflowContextValue, WorkflowNextButton, WorkflowPreviousButton, WorkflowProvider, WorkflowSkipButton, WorkflowStepper, createFlow, flow, useWorkflowContext };