@digiform/wizard 0.1.7 → 0.2.2
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/FormWizard.d.ts +10 -0
- package/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.d.ts +23 -0
- package/features/api-integration/index.d.ts +12 -0
- package/features/api-integration/services/ActionExecutor.d.ts +18 -0
- package/features/api-integration/services/ApiCallExecutor.d.ts +2 -0
- package/features/api-integration/services/ApiCallService.d.ts +40 -0
- package/features/api-integration/services/DialogExecutor.d.ts +2 -0
- package/features/api-integration/services/GenericTriggerService.d.ts +118 -0
- package/features/api-integration/services/NavigationExecutor.d.ts +2 -0
- package/features/dialog-system/components/ActionDialog/ActionDialog.d.ts +11 -0
- package/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.d.ts +11 -0
- package/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.d.ts +11 -0
- package/features/dialog-system/index.d.ts +8 -0
- package/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.d.ts +19 -0
- package/features/form-runtime/FormWizard/FormWizard.d.ts +10 -0
- package/features/form-runtime/components/FormField.d.ts +7 -0
- package/features/form-runtime/components/FormFooter.d.ts +5 -0
- package/features/form-runtime/components/FormHeader.d.ts +9 -0
- package/features/form-runtime/components/FormSection/FormSection.d.ts +6 -0
- package/features/form-runtime/components/FormStep/FormStep.d.ts +2 -0
- package/features/form-runtime/components/ProgressLoaderRuntime.d.ts +12 -0
- package/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.d.ts +2 -0
- package/features/form-runtime/components/displayValue/displayValue.d.ts +21 -0
- package/features/form-runtime/components/index.d.ts +3 -0
- package/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.d.ts +7 -0
- package/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.d.ts +13 -0
- package/features/form-runtime/config/configResolver.d.ts +14 -0
- package/features/form-runtime/config/index.d.ts +9 -0
- package/features/form-runtime/config/templateConfig.d.ts +148 -0
- package/features/form-runtime/config/templateLoader.d.ts +25 -0
- package/features/form-runtime/config/templateUtils.d.ts +12 -0
- package/features/form-runtime/context/LoaderContext.d.ts +31 -0
- package/features/form-runtime/hooks/index.d.ts +1 -0
- package/features/form-runtime/hooks/useApiActions.d.ts +42 -0
- package/features/form-runtime/hooks/useComponentTriggers.d.ts +42 -0
- package/features/form-runtime/hooks/useComponentVisibility.d.ts +13 -0
- package/features/form-runtime/hooks/useFieldEventHandlers.d.ts +14 -0
- package/features/form-runtime/hooks/useFormContext.d.ts +4 -0
- package/features/form-runtime/hooks/useFormFieldState.d.ts +13 -0
- package/features/form-runtime/hooks/useValidationEvents.d.ts +13 -0
- package/features/form-runtime/index.d.ts +12 -0
- package/features/form-runtime/utils/componentDisplayValue.d.ts +9 -0
- package/features/form-runtime/utils/errorUtils.d.ts +13 -0
- package/features/form-runtime/utils/fieldHelpers.d.ts +38 -0
- package/features/form-runtime/utils/formDataBuilder.d.ts +7 -0
- package/features/form-runtime/utils/formDirtyStateSync.d.ts +77 -0
- package/features/form-runtime/utils/formSaver.d.ts +22 -0
- package/features/form-runtime/utils/index.d.ts +4 -0
- package/features/form-runtime/utils/logger.d.ts +70 -0
- package/features/form-runtime/utils/validation.d.ts +3 -0
- package/features/form-runtime/utils/validationUX.d.ts +70 -0
- package/features/form-runtime/utils/visibilityUtils.d.ts +13 -0
- package/features/index.d.ts +11 -0
- package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +9 -0
- package/features/state-management/index.d.ts +8 -0
- package/features/state-management/machines/__tests__/setup.d.ts +0 -0
- package/features/state-management/machines/__tests__/testUtils.d.ts +78 -0
- package/features/state-management/machines/__tests__/vitest.config.d.ts +2 -0
- package/features/state-management/machines/actions/componentActions.d.ts +10 -0
- package/features/state-management/machines/actions/navigationActions.d.ts +50 -0
- package/features/state-management/machines/actions/saveActions.d.ts +38 -0
- package/features/state-management/machines/actions/validationActions.d.ts +68 -0
- package/features/state-management/machines/componentTriggerEngine.d.ts +90 -0
- package/features/state-management/machines/formMachine.d.ts +216 -0
- package/features/state-management/machines/guards/navigationGuards.d.ts +32 -0
- package/features/state-management/machines/guards/saveGuards.d.ts +55 -0
- package/features/state-management/machines/guards/triggerGuards.d.ts +24 -0
- package/features/state-management/machines/helpers/triggerHelpers.d.ts +14 -0
- package/features/state-management/machines/index.d.ts +4 -0
- package/features/state-management/machines/lazyLoading.d.ts +34 -0
- package/features/state-management/machines/performance.d.ts +80 -0
- package/features/state-management/machines/types.d.ts +315 -0
- package/features/state-management/machines/useFormMachine.d.ts +1508 -0
- package/features/state-management/machines/validation/index.d.ts +5 -0
- package/features/state-management/machines/validation/validateField.d.ts +2 -0
- package/features/state-management/machines/validation/validateForm.d.ts +2 -0
- package/features/state-management/machines/validation/validateSection.d.ts +2 -0
- package/features/state-management/machines/validation/validateStep.d.ts +2 -0
- package/features/state-management/machines/validation/validationTypes.d.ts +1 -0
- package/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.d.ts +8 -0
- package/features/trigger-action-system/components/ActionManager.d.ts +6 -0
- package/features/trigger-action-system/components/ComponentAlert/ComponentAlert.d.ts +10 -0
- package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +20 -0
- package/features/trigger-action-system/index.d.ts +10 -0
- package/features/trigger-action-system/utils/GenericTriggerEngine.d.ts +118 -0
- package/features/trigger-action-system/utils/triggerActionSystem.d.ts +193 -0
- package/features/validation-system/components/ValidationDebugger.d.ts +2 -0
- package/features/validation-system/index.d.ts +7 -0
- package/features/validation-system/validation/ActionValidation.d.ts +54 -0
- package/features/validation-system/validation/SchemaBuilder.d.ts +36 -0
- package/features/validation-system/validation/ValidationCache.d.ts +36 -0
- package/features/validation-system/validation/ValidationEngine.d.ts +86 -0
- package/features/validation-system/validation/ValidationExecutor.d.ts +36 -0
- package/features/validation-system/validation/index.d.ts +38 -0
- package/features/validation-system/validation/secureValidatorEngine.d.ts +64 -0
- package/features/validation-system/validation/tanstackSchemaAdapter.d.ts +15 -0
- package/features/validation-system/validation/validationService.d.ts +43 -0
- package/index.cjs +231 -284
- package/index.cjs.map +1 -1
- package/index.d.ts +8 -0
- package/index.js +231 -284
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/index.d.ts +0 -0
- package/styles.css +10 -18
package/FormWizard.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form Wizard Component - Legacy export file for backward compatibility
|
|
3
|
+
*
|
|
4
|
+
* This file maintains backward compatibility for existing imports.
|
|
5
|
+
* New code should import from the features directory structure.
|
|
6
|
+
*/
|
|
7
|
+
export * from '../../core/src/index.ts';
|
|
8
|
+
export * from '../../ui/src/index.ts';
|
|
9
|
+
export * from './features/form-runtime';
|
|
10
|
+
export { FormWizard as default } from './features/form-runtime';
|
package/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ActionTrigger, DialogConfig, FormAction, FormData, NavigationConfig } from '../../../../../../core/src/index.ts';
|
|
2
|
+
interface ActionExecutorProps {
|
|
3
|
+
actions: FormAction[];
|
|
4
|
+
trigger: ActionTrigger;
|
|
5
|
+
formData: FormData;
|
|
6
|
+
onComplete: (results: Record<string, unknown>) => void;
|
|
7
|
+
onError: (error: Error) => void;
|
|
8
|
+
onFieldUpdate: (fieldPath: string, value: unknown) => void;
|
|
9
|
+
onShowDialog: (dialogConfig: DialogConfig) => void;
|
|
10
|
+
onNavigate: (navigationConfig: NavigationConfig) => void;
|
|
11
|
+
machineRef?: {
|
|
12
|
+
send: (event: {
|
|
13
|
+
type: string;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Enhanced ActionExecutor that uses React Query for better API state management
|
|
20
|
+
*/
|
|
21
|
+
declare const EnhancedActionExecutor: import('react').NamedExoticComponent<ActionExecutorProps>;
|
|
22
|
+
export { EnhancedActionExecutor };
|
|
23
|
+
export default EnhancedActionExecutor;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Integration Feature
|
|
3
|
+
*
|
|
4
|
+
* Services for API calls and external integrations
|
|
5
|
+
*/
|
|
6
|
+
export { default as ActionExecutor } from './services/ActionExecutor';
|
|
7
|
+
export { default as ApiCallExecutor } from './services/ApiCallExecutor';
|
|
8
|
+
export { default as ApiCallService } from './services/ApiCallService';
|
|
9
|
+
export { default as DialogExecutor } from './services/DialogExecutor';
|
|
10
|
+
export { default as EnhancedActionExecutor } from './components/EnhancedActionExecutor/EnhancedActionExecutor';
|
|
11
|
+
export { default as GenericTriggerService } from './services/GenericTriggerService';
|
|
12
|
+
export { default as NavigationExecutor } from './services/NavigationExecutor';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormMachineEvents } from '../../state-management';
|
|
2
|
+
import { ActionTrigger, DialogConfig, FormAction, FormData, NavigationConfig } from '../../../../../core/src/index.ts';
|
|
3
|
+
interface ActionExecutorProps {
|
|
4
|
+
actions: FormAction[];
|
|
5
|
+
trigger: ActionTrigger;
|
|
6
|
+
formData: FormData;
|
|
7
|
+
onComplete: (results: Record<string, unknown>) => void;
|
|
8
|
+
onError: (error: Error) => void;
|
|
9
|
+
onFieldUpdate: (fieldPath: string, value: unknown) => void;
|
|
10
|
+
onShowDialog: (dialogConfig: DialogConfig) => void;
|
|
11
|
+
onNavigate: (navigationConfig: NavigationConfig) => void;
|
|
12
|
+
machineRef?: {
|
|
13
|
+
send: (event: FormMachineEvents) => void;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare const ActionExecutor: import('react').NamedExoticComponent<ActionExecutorProps>;
|
|
17
|
+
export { ActionExecutor };
|
|
18
|
+
export default ActionExecutor;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApiCallConfig, FormData } from '../../../../../core/src/index.ts';
|
|
2
|
+
interface ApiCallServiceOptions {
|
|
3
|
+
onFieldUpdate?: (fieldPath: string, value: unknown) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare class ApiCallService {
|
|
6
|
+
private options;
|
|
7
|
+
constructor(options?: ApiCallServiceOptions);
|
|
8
|
+
generateCacheKey(config: ApiCallConfig, formData: FormData): string;
|
|
9
|
+
createQueryOptions(config: ApiCallConfig, formData: FormData): {
|
|
10
|
+
queryKey: string[];
|
|
11
|
+
queryFn: () => Promise<unknown>;
|
|
12
|
+
gcTime: number;
|
|
13
|
+
staleTime: number;
|
|
14
|
+
retry: number;
|
|
15
|
+
throwOnError: boolean;
|
|
16
|
+
};
|
|
17
|
+
executeApiCall(config: ApiCallConfig, formData: FormData): Promise<unknown>;
|
|
18
|
+
private makeApiCall;
|
|
19
|
+
/**
|
|
20
|
+
* Detects if an error is likely a CORS error
|
|
21
|
+
*/
|
|
22
|
+
private isCorsError;
|
|
23
|
+
/**
|
|
24
|
+
* Detects if an error is a network-related error (but not CORS)
|
|
25
|
+
*/
|
|
26
|
+
private isNetworkError;
|
|
27
|
+
private applyFlattenedResponseMappings;
|
|
28
|
+
/**
|
|
29
|
+
* Extract the actual field name from a template string
|
|
30
|
+
* E.g., "${step-1.username}" -> "username"
|
|
31
|
+
*/
|
|
32
|
+
private extractFieldNameFromTemplate;
|
|
33
|
+
private getValueFromPath;
|
|
34
|
+
private buildHeaders;
|
|
35
|
+
private buildQueryParams;
|
|
36
|
+
private interpolateTemplate;
|
|
37
|
+
}
|
|
38
|
+
export declare function useApiCall(config: ApiCallConfig, formData: FormData, options?: ApiCallServiceOptions): import('@tanstack/react-query').UseQueryResult<unknown, Error>;
|
|
39
|
+
export declare function useApiMutation(config: ApiCallConfig, options?: ApiCallServiceOptions): import('@tanstack/react-query').UseMutationResult<unknown, Error, FormData, unknown>;
|
|
40
|
+
export default ApiCallService;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { FormWizardConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
import { ExtendedTriggerActionContainer, ExtendedTriggerType } from '../../trigger-action-system/utils/triggerActionSystem';
|
|
3
|
+
interface FormMachineContext {
|
|
4
|
+
data: Record<string, unknown>;
|
|
5
|
+
errors: Record<string, string[]>;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
interface FormMachineSnapshot {
|
|
9
|
+
context: FormMachineContext;
|
|
10
|
+
}
|
|
11
|
+
interface FormMachine {
|
|
12
|
+
send(event: FormMachineEvent): void;
|
|
13
|
+
getSnapshot(): FormMachineSnapshot;
|
|
14
|
+
}
|
|
15
|
+
type FormMachineEvent = {
|
|
16
|
+
type: "GO_TO_STEP";
|
|
17
|
+
stepId: string;
|
|
18
|
+
behavior?: "replace" | "push";
|
|
19
|
+
} | {
|
|
20
|
+
type: "NEXT";
|
|
21
|
+
skipValidation?: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
type: "PREVIOUS";
|
|
24
|
+
skipValidation?: boolean;
|
|
25
|
+
} | {
|
|
26
|
+
type: "SHOW_COMPONENT_ALERT";
|
|
27
|
+
componentId: string;
|
|
28
|
+
alert: ComponentAlert;
|
|
29
|
+
} | {
|
|
30
|
+
type: "SHOW_ACTION_DIALOG";
|
|
31
|
+
dialogConfig: DialogConfig;
|
|
32
|
+
} | {
|
|
33
|
+
type: "HIDE_ACTION_DIALOG";
|
|
34
|
+
} | {
|
|
35
|
+
type: "UPDATE_COMPONENT_VALUE";
|
|
36
|
+
componentId: string;
|
|
37
|
+
value: unknown;
|
|
38
|
+
} | {
|
|
39
|
+
type: "UPDATE_FIELD";
|
|
40
|
+
field: string;
|
|
41
|
+
value: unknown;
|
|
42
|
+
} | {
|
|
43
|
+
type: "VALIDATE_FIELD";
|
|
44
|
+
fieldId: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: "VALIDATE_SECTION";
|
|
47
|
+
sectionId: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: "VALIDATE_STEP";
|
|
50
|
+
stepId: string;
|
|
51
|
+
};
|
|
52
|
+
interface ComponentAlert {
|
|
53
|
+
message: string;
|
|
54
|
+
type: "info" | "warning" | "error" | "success";
|
|
55
|
+
position: "inline" | "tooltip" | "sidebar";
|
|
56
|
+
dismissible: boolean;
|
|
57
|
+
autoHide?: boolean;
|
|
58
|
+
autoHideDelay?: number;
|
|
59
|
+
}
|
|
60
|
+
interface DialogConfig {
|
|
61
|
+
type: "email-verification" | "confirmation" | "custom";
|
|
62
|
+
title?: string;
|
|
63
|
+
content?: string;
|
|
64
|
+
templateMetadata?: Record<string, unknown>;
|
|
65
|
+
buttons?: DialogButton[];
|
|
66
|
+
}
|
|
67
|
+
interface DialogButton {
|
|
68
|
+
label: string;
|
|
69
|
+
variant: "default" | "secondary" | "destructive" | "outline" | "ghost";
|
|
70
|
+
action: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Main Generic Trigger Service
|
|
74
|
+
*/
|
|
75
|
+
export declare class GenericTriggerService {
|
|
76
|
+
private engine;
|
|
77
|
+
private services;
|
|
78
|
+
constructor(formMachine: FormMachine);
|
|
79
|
+
/**
|
|
80
|
+
* Initialize triggers from form configuration
|
|
81
|
+
*/
|
|
82
|
+
initializeFromConfig(config: FormWizardConfig): void;
|
|
83
|
+
/**
|
|
84
|
+
* Trigger evaluation for form events
|
|
85
|
+
*/
|
|
86
|
+
evaluateFormTrigger(triggerType: ExtendedTriggerType, formId: string, formData: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Trigger evaluation for step events
|
|
89
|
+
*/
|
|
90
|
+
evaluateStepTrigger(triggerType: ExtendedTriggerType, stepId: string, formData: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Trigger evaluation for section events
|
|
93
|
+
*/
|
|
94
|
+
evaluateSectionTrigger(triggerType: ExtendedTriggerType, sectionId: string, formData: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Trigger evaluation for component events
|
|
97
|
+
*/
|
|
98
|
+
evaluateComponentTrigger(triggerType: ExtendedTriggerType, componentId: string, currentValue: unknown, previousValue: unknown, formData: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Register additional triggers dynamically
|
|
101
|
+
*/
|
|
102
|
+
registerTriggers(targetId: string, triggerContainer: ExtendedTriggerActionContainer): void;
|
|
103
|
+
/**
|
|
104
|
+
* Cleanup resources
|
|
105
|
+
*/
|
|
106
|
+
dispose(): void;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* React Hook for using the Generic Trigger Service
|
|
110
|
+
*/
|
|
111
|
+
export declare function useGenericTriggerService(formMachine: FormMachine): {
|
|
112
|
+
triggerService: GenericTriggerService;
|
|
113
|
+
evaluateFormTrigger: (triggerType: ExtendedTriggerType, formId: string, formData: Record<string, unknown>, metadata?: Record<string, unknown>) => Promise<void>;
|
|
114
|
+
evaluateStepTrigger: (triggerType: ExtendedTriggerType, stepId: string, formData: Record<string, unknown>, metadata?: Record<string, unknown>) => Promise<void>;
|
|
115
|
+
evaluateSectionTrigger: (triggerType: ExtendedTriggerType, sectionId: string, formData: Record<string, unknown>, metadata?: Record<string, unknown>) => Promise<void>;
|
|
116
|
+
evaluateComponentTrigger: (triggerType: ExtendedTriggerType, componentId: string, currentValue: unknown, previousValue: unknown, formData: Record<string, unknown>, metadata?: Record<string, unknown>) => Promise<void>;
|
|
117
|
+
};
|
|
118
|
+
export default GenericTriggerService;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DialogButton, DialogConfig, FormData } from '../../../../../../core/src/index.ts';
|
|
2
|
+
interface ActionDialogProps {
|
|
3
|
+
config: DialogConfig | null;
|
|
4
|
+
formData: FormData;
|
|
5
|
+
onButtonClick: (buttonAction: DialogButton["action"]) => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const ActionDialog: import('react').NamedExoticComponent<ActionDialogProps>;
|
|
10
|
+
export { ActionDialog };
|
|
11
|
+
export default ActionDialog;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DialogButtonAction, DialogConfig, FormData } from '../../../../../../core/src/index.ts';
|
|
2
|
+
interface ConfirmationDialogProps {
|
|
3
|
+
config: DialogConfig;
|
|
4
|
+
formData: FormData;
|
|
5
|
+
onButtonClick: (buttonAction: DialogButtonAction) => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const ConfirmationDialog: import('react').NamedExoticComponent<ConfirmationDialogProps>;
|
|
10
|
+
export { ConfirmationDialog };
|
|
11
|
+
export default ConfirmationDialog;
|
package/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DialogButtonAction, DialogConfig, FormData } from '../../../../../../core/src/index.ts';
|
|
2
|
+
interface EmailVerificationDialogProps {
|
|
3
|
+
config: DialogConfig;
|
|
4
|
+
formData: FormData;
|
|
5
|
+
onButtonClick: (buttonAction: DialogButtonAction) => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const EmailVerificationDialog: import('react').NamedExoticComponent<EmailVerificationDialogProps>;
|
|
10
|
+
export { EmailVerificationDialog };
|
|
11
|
+
export default EmailVerificationDialog;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dialog System Feature
|
|
3
|
+
*
|
|
4
|
+
* Components for various dialog types (confirmation, email verification, etc.)
|
|
5
|
+
*/
|
|
6
|
+
export { default as ActionDialog } from './components/ActionDialog/ActionDialog';
|
|
7
|
+
export { default as ConfirmationDialog } from './components/ConfirmationDialog/ConfirmationDialog';
|
|
8
|
+
export { default as EmailVerificationDialog } from './components/EmailVerificationDialog/EmailVerificationDialog';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormErrors, ComponentConfig as FormWizardComponentConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
import { ComponentValue } from '../../../../../ui/src/index.ts';
|
|
3
|
+
/**
|
|
4
|
+
* This adapter bridges the gap between the form wizard component config and the flow component config
|
|
5
|
+
* It converts the simpler form wizard component config to the format expected by the component registry
|
|
6
|
+
*
|
|
7
|
+
* Performance optimizations:
|
|
8
|
+
* - Uses memoized type mappings
|
|
9
|
+
* - Caches non-form field types array
|
|
10
|
+
* - Optimized object spread operations
|
|
11
|
+
*/
|
|
12
|
+
export declare const adaptComponentForRegistry: (component: FormWizardComponentConfig, value: ComponentValue, onChange: (value: ComponentValue) => void, readOnly?: boolean, onBlur?: () => void, errors?: FormErrors, state?: {
|
|
13
|
+
context?: {
|
|
14
|
+
fieldStates?: Record<string, {
|
|
15
|
+
error?: string;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
}) => React.ReactNode;
|
|
19
|
+
export default adaptComponentForRegistry;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { formWizardQueryClient } from '../../../../../ui/src/index.ts';
|
|
2
|
+
import { FormData, FormWizardConfig } from '../../../../../core/src/index.ts';
|
|
3
|
+
export interface FormWizardProps {
|
|
4
|
+
config: FormWizardConfig;
|
|
5
|
+
initialData?: FormData;
|
|
6
|
+
onSubmit?: (data: FormData) => Promise<void> | void;
|
|
7
|
+
queryClient?: typeof formWizardQueryClient;
|
|
8
|
+
}
|
|
9
|
+
declare const FormWizard: React.FC<FormWizardProps>;
|
|
10
|
+
export default FormWizard;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormHeaderProps } from '../../../../../ui/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* User-facing FormHeader that gets data from form context
|
|
4
|
+
* This component is used in the user-facing form wizard
|
|
5
|
+
*/
|
|
6
|
+
declare const FormHeader: React.FC<Omit<FormHeaderProps, "children"> & {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
export default FormHeader;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ProgressLoaderProperties } from '../../../../../core/src/index.ts';
|
|
2
|
+
export interface ProgressLoaderRuntimeProps {
|
|
3
|
+
/** Component configuration */
|
|
4
|
+
properties: ProgressLoaderProperties;
|
|
5
|
+
/** Additional className */
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Runtime Progress Loader that auto-starts and signals completion via context
|
|
10
|
+
*/
|
|
11
|
+
export declare const ProgressLoaderRuntime: import('react').NamedExoticComponent<ProgressLoaderRuntimeProps>;
|
|
12
|
+
export default ProgressLoaderRuntime;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentConfig, ComponentValue } from '../../../../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Default display value renderer for components that don't have custom logic
|
|
4
|
+
*/
|
|
5
|
+
export declare const renderDefaultDisplayValue: (component: ComponentConfig, value: ComponentValue) => React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Display value renderer for text-based components (text, email, number)
|
|
8
|
+
*/
|
|
9
|
+
export declare const renderTextDisplayValue: (_component: ComponentConfig, value: ComponentValue) => React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Display value renderer for checkbox components
|
|
12
|
+
*/
|
|
13
|
+
export declare const renderCheckboxDisplayValue: (_component: ComponentConfig, value: ComponentValue) => React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Display value renderer for radio group components
|
|
16
|
+
*/
|
|
17
|
+
export declare const renderRadioGroupDisplayValue: (component: ComponentConfig, value: ComponentValue) => React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Display value renderer for dropdown/select components
|
|
20
|
+
*/
|
|
21
|
+
export declare const renderDropdownDisplayValue: (component: ComponentConfig, value: ComponentValue) => React.ReactNode;
|
package/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentConfig, ComponentValue } from '../../../../../../../core/src/index.ts';
|
|
2
|
+
interface DisplayModeRendererProps {
|
|
3
|
+
component: ComponentConfig;
|
|
4
|
+
fieldValue: ComponentValue;
|
|
5
|
+
}
|
|
6
|
+
export declare const DisplayModeRenderer: React.FC<DisplayModeRendererProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentConfig, FormFieldApi } from '../../../../../../../core/src/index.ts';
|
|
2
|
+
import { ComponentValue as RegistryComponentValue } from '../../../../../../../ui/src/index.ts';
|
|
3
|
+
interface InteractiveFieldRendererProps {
|
|
4
|
+
component: ComponentConfig;
|
|
5
|
+
field: FormFieldApi;
|
|
6
|
+
readOnly: boolean;
|
|
7
|
+
needsFormFieldWrapper: boolean;
|
|
8
|
+
isSubmitAttempted: boolean;
|
|
9
|
+
onChange: (value: RegistryComponentValue) => void;
|
|
10
|
+
onBlur: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const InteractiveFieldRenderer: React.FC<InteractiveFieldRendererProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormWizardConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a form wizard configuration, expanding any template step references
|
|
4
|
+
* to their full step configurations
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveFormWizardConfig(config: FormWizardConfig): Promise<FormWizardConfig>;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a configuration contains template step references
|
|
9
|
+
*/
|
|
10
|
+
export declare function hasTemplateSteps(config: FormWizardConfig): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Gets template IDs used in a configuration
|
|
13
|
+
*/
|
|
14
|
+
export declare function getUsedTemplateIds(config: FormWizardConfig): string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form Runtime Configuration
|
|
3
|
+
*
|
|
4
|
+
* Configuration resolvers and template utilities
|
|
5
|
+
*/
|
|
6
|
+
export * from './configResolver';
|
|
7
|
+
export * from './templateConfig';
|
|
8
|
+
export * from './templateLoader';
|
|
9
|
+
export { getAvailableGenericTemplatesSync, getTemplateInfo, validateTemplateReferences, } from './templateUtils';
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FormStepConfig, TemplateStepConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
export type TemplateType = "generic" | "team" | null;
|
|
3
|
+
/**
|
|
4
|
+
* Template permissions configuration
|
|
5
|
+
*/
|
|
6
|
+
export interface TemplatePermissions {
|
|
7
|
+
/** Can add new components to sections */
|
|
8
|
+
canAddComponents: boolean;
|
|
9
|
+
/** Can remove existing components */
|
|
10
|
+
canRemoveComponents: boolean;
|
|
11
|
+
/** Can edit component properties */
|
|
12
|
+
canEditComponentProperties: boolean;
|
|
13
|
+
/** Can add new sections */
|
|
14
|
+
canAddSections: boolean;
|
|
15
|
+
/** Can remove existing sections */
|
|
16
|
+
canRemoveSections: boolean;
|
|
17
|
+
/** Can edit section properties */
|
|
18
|
+
canEditSectionProperties: boolean;
|
|
19
|
+
/** Can edit step title */
|
|
20
|
+
canEditStepTitle: boolean;
|
|
21
|
+
/** Can edit navigation settings */
|
|
22
|
+
canEditNavigation: boolean;
|
|
23
|
+
/** Can add/edit actions */
|
|
24
|
+
canEditActions: boolean;
|
|
25
|
+
/** Can duplicate the step */
|
|
26
|
+
canDuplicate: boolean;
|
|
27
|
+
/** Can delete the step */
|
|
28
|
+
canDelete: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Template display configuration
|
|
32
|
+
*/
|
|
33
|
+
export interface TemplateDisplayConfig {
|
|
34
|
+
/** Template type for UI display */
|
|
35
|
+
type: TemplateType;
|
|
36
|
+
/** Whether template is readonly */
|
|
37
|
+
isReadonly: boolean;
|
|
38
|
+
/** Whether to show lock icon */
|
|
39
|
+
showLockIcon: boolean;
|
|
40
|
+
/** CSS classes for theme styling */
|
|
41
|
+
themeClass: string;
|
|
42
|
+
/** Icon color classes */
|
|
43
|
+
iconColor: string;
|
|
44
|
+
/** Tooltip text for locked templates */
|
|
45
|
+
lockTooltip?: string;
|
|
46
|
+
/** Badge text for template type */
|
|
47
|
+
badgeText?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Complete template configuration
|
|
51
|
+
*/
|
|
52
|
+
export interface TemplateConfig {
|
|
53
|
+
permissions: TemplatePermissions;
|
|
54
|
+
display: TemplateDisplayConfig;
|
|
55
|
+
rules: {
|
|
56
|
+
/** Message shown when user tries to edit locked content */
|
|
57
|
+
lockMessage: string;
|
|
58
|
+
/** Whether this template type supports multiple steps */
|
|
59
|
+
supportsMultipleSteps: boolean;
|
|
60
|
+
/** Default navigation behavior */
|
|
61
|
+
defaultNavigation: {
|
|
62
|
+
next: {
|
|
63
|
+
label: string;
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
};
|
|
66
|
+
previous: {
|
|
67
|
+
label: string;
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Gets the complete template configuration for a given template ID or step
|
|
75
|
+
*/
|
|
76
|
+
export declare function getTemplateConfig(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): TemplateConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Gets template permissions for a given template ID or step
|
|
79
|
+
*/
|
|
80
|
+
export declare function getTemplatePermissions(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): TemplatePermissions;
|
|
81
|
+
/**
|
|
82
|
+
* Gets template display configuration for a given template ID or step
|
|
83
|
+
*/
|
|
84
|
+
export declare function getTemplateDisplayConfig(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): TemplateDisplayConfig;
|
|
85
|
+
/**
|
|
86
|
+
* Checks if a specific action is allowed for a template or step
|
|
87
|
+
*/
|
|
88
|
+
export declare function isActionAllowed(templateIdOrStep: string | FormStepConfig | TemplateStepConfig, action: keyof TemplatePermissions): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Checks if a step is locked for editing
|
|
91
|
+
*/
|
|
92
|
+
export declare function isStepLocked(step: FormStepConfig | TemplateStepConfig, templateOrigin?: {
|
|
93
|
+
templateId: string;
|
|
94
|
+
stepIndex?: number;
|
|
95
|
+
}): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the lock message for a template
|
|
98
|
+
*/
|
|
99
|
+
export declare function getLockMessage(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): string;
|
|
100
|
+
/**
|
|
101
|
+
* Validates if a template action should be blocked and returns appropriate message
|
|
102
|
+
*/
|
|
103
|
+
export declare function validateTemplateAction(templateIdOrStep: string | FormStepConfig | TemplateStepConfig, action: keyof TemplatePermissions): {
|
|
104
|
+
allowed: boolean;
|
|
105
|
+
message?: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Gets template type from various input formats
|
|
109
|
+
*/
|
|
110
|
+
export declare function getTemplateTypeFromInput(input: string | FormStepConfig | TemplateStepConfig): TemplateType;
|
|
111
|
+
/**
|
|
112
|
+
* Utility to check if input represents a generic template
|
|
113
|
+
*/
|
|
114
|
+
export declare function isGenericTemplateInput(input: string | FormStepConfig | TemplateStepConfig): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Utility to check if input represents a team template
|
|
117
|
+
*/
|
|
118
|
+
export declare function isTeamTemplateInput(input: string | FormStepConfig | TemplateStepConfig): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Creates a comprehensive template info object for UI components
|
|
121
|
+
*/
|
|
122
|
+
export declare function getTemplateInfo(templateIdOrStep: string | FormStepConfig | TemplateStepConfig): {
|
|
123
|
+
type: TemplateType;
|
|
124
|
+
permissions: TemplatePermissions;
|
|
125
|
+
display: TemplateDisplayConfig;
|
|
126
|
+
rules: {
|
|
127
|
+
/** Message shown when user tries to edit locked content */
|
|
128
|
+
lockMessage: string;
|
|
129
|
+
/** Whether this template type supports multiple steps */
|
|
130
|
+
supportsMultipleSteps: boolean;
|
|
131
|
+
/** Default navigation behavior */
|
|
132
|
+
defaultNavigation: {
|
|
133
|
+
next: {
|
|
134
|
+
label: string;
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
};
|
|
137
|
+
previous: {
|
|
138
|
+
label: string;
|
|
139
|
+
enabled: boolean;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
isLocked: boolean;
|
|
144
|
+
canEdit: boolean;
|
|
145
|
+
isGeneric: boolean;
|
|
146
|
+
isTeam: boolean;
|
|
147
|
+
isRegularStep: boolean;
|
|
148
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FormStepConfig, FormTemplate, StepNavigation, TemplateStepConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Loads a template by ID, handling both generic and team templates
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadTemplate(templateId: string): Promise<FormTemplate>;
|
|
6
|
+
/**
|
|
7
|
+
* Resolves a template step reference to a full FormStepConfig
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveTemplateStep(templateStep: TemplateStepConfig, defaultNavigation?: StepNavigation, stepIndex?: number): Promise<FormStepConfig>;
|
|
10
|
+
/**
|
|
11
|
+
* Gets template metadata without loading the full template
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTemplateMetadata(templateId: string): Promise<import('../../../../../core/src/index.ts').TemplateMetadata>;
|
|
14
|
+
/**
|
|
15
|
+
* Lists available templates from both generic and team sources
|
|
16
|
+
*/
|
|
17
|
+
export declare function getAvailableTemplates(): Promise<string[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Lists available generic templates only (for backward compatibility)
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAvailableGenericTemplates(): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Clears the template cache (useful for development/testing)
|
|
24
|
+
*/
|
|
25
|
+
export declare function clearTemplateCache(): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loader-specific template functions for form-wizard-component
|
|
3
|
+
*
|
|
4
|
+
* This file only contains functions that depend on the local templateLoader.
|
|
5
|
+
* All other template utilities should be imported directly from @libs/shared/utils
|
|
6
|
+
*/
|
|
7
|
+
export declare const getAvailableGenericTemplatesSync: () => string[];
|
|
8
|
+
export declare const getTemplateInfo: (templateId: string) => Promise<any>;
|
|
9
|
+
export declare const validateTemplateReferences: (config: import('../../../../../core/src/index.ts').FormWizardConfig) => Promise<{
|
|
10
|
+
isValid: boolean;
|
|
11
|
+
errors: string[];
|
|
12
|
+
}>;
|