@form-engine-ts/react 5.1.0 → 6.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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _form_engine_ts_core from '@form-engine-ts/core';
2
- import { QuestionType, FormField, ChoiceOption, FormPage, FormSchema, DisplayCondition, JsonValue, SchemaIssue, FormPolicy, Question, FieldOption, TranslationReport, ValidationIssue, ValidationError, FormValues, LocaleOption, TranslationAdapter, AsyncTranslationAdapter, PopulateTranslationOptions, FormValue, AnswerValidationResult, TranslationSlot, FormEngineTranslator, FormEngineMessages, FieldType } from '@form-engine-ts/core';
3
- export { QuestionType } from '@form-engine-ts/core';
2
+ import { QuestionType, FormField, ChoiceOption, FormPage, FormSchema, DisplayCondition, JsonValue, SchemaIssue, FormPolicy, Question, FieldOption, TranslationReport, ValidationIssue, ValidationError, FormValues, LocaleOption, TranslationStatus, CanonicalTranslationMetadata, TranslationSlot, TranslationAdapter, AsyncTranslationAdapter, PopulateTranslationOptions, FormValue, AnswerValidationResult, FormEngineTranslator, FormEngineMessages, TranslationMissingKeyEvent, FieldType } from '@form-engine-ts/core';
3
+ export { FormSubmissionError, FormSubmissionSerializedError, QuestionType } from '@form-engine-ts/core';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, ComponentType, KeyboardEvent, MouseEvent, CSSProperties } from 'react';
6
6
  import { SensitiveDataFinding } from '@form-engine-ts/privacy';
@@ -307,6 +307,7 @@ interface BuilderSlotBaseProps {
307
307
  readonly actions: BuilderSlotActions;
308
308
  readonly components: Required<FormBuilderComponents>;
309
309
  readonly translate: (key: string, params?: Record<string, unknown>) => string;
310
+ readonly onChange?: (schema: FormSchema) => void;
310
311
  }
311
312
  interface BuilderToolbarSlotProps extends BuilderSlotBaseProps {
312
313
  readonly kind: "page" | "field" | "option";
@@ -402,6 +403,58 @@ interface TranslationSlotRowProps {
402
403
  readonly onChange: (text: string) => void;
403
404
  readonly onTranslate: () => void;
404
405
  }
406
+ interface TranslationComparisonItem {
407
+ readonly id: string;
408
+ readonly path: string;
409
+ readonly targetKind: "form" | "page" | "field" | "option";
410
+ readonly targetProperty: "title" | "description" | "label" | "completionMessage";
411
+ readonly nodeTitle?: string;
412
+ readonly sourceText: string;
413
+ readonly translatedText: string;
414
+ readonly status: TranslationStatus;
415
+ readonly metadata?: CanonicalTranslationMetadata;
416
+ readonly translatable: boolean;
417
+ }
418
+ interface TranslationComparisonSummary {
419
+ readonly total: number;
420
+ readonly translated: number;
421
+ readonly missing: number;
422
+ readonly stale: number;
423
+ readonly manual: number;
424
+ }
425
+ interface TranslationComparisonHeaderProps {
426
+ readonly sourceLocale: string;
427
+ readonly targetLocale: string;
428
+ readonly summary: TranslationComparisonSummary;
429
+ readonly onTranslateAll: () => void;
430
+ readonly isTranslating: boolean;
431
+ readonly readOnly: boolean;
432
+ }
433
+ interface TranslationComparisonItemRowProps {
434
+ readonly item: TranslationComparisonItem;
435
+ readonly readOnly: boolean;
436
+ readonly onChange: (text: string) => void;
437
+ readonly onTranslate: () => void;
438
+ }
439
+ interface UseTranslationComparisonOptions {
440
+ readonly schema: FormSchema;
441
+ readonly sourceLocale?: string;
442
+ readonly targetLocale: string;
443
+ readonly translationAdapter?: TranslationAdapter;
444
+ readonly readOnly?: boolean;
445
+ readonly onChange?: (nextSchema: FormSchema) => void;
446
+ readonly onTranslationChange?: (event: TranslationSlotChangeEvent) => void;
447
+ }
448
+ interface UseTranslationComparisonResult {
449
+ readonly sourceLocale: string;
450
+ readonly targetLocale: string;
451
+ readonly items: readonly TranslationComparisonItem[];
452
+ readonly summary: TranslationComparisonSummary;
453
+ readonly isTranslating: boolean;
454
+ readonly updateTranslation: (path: string, text: string) => void;
455
+ readonly translateSingle: (path: string) => Promise<void>;
456
+ readonly translateAll: () => Promise<TranslationReport>;
457
+ }
405
458
  interface LocaleSelectorProps {
406
459
  readonly targetLocale: string;
407
460
  readonly targetLocales: readonly string[];
@@ -417,6 +470,29 @@ interface TranslationWorkspaceActionsProps {
417
470
  readonly isTranslating: boolean;
418
471
  readonly readOnly: boolean;
419
472
  }
473
+ interface TranslationEventPayload {
474
+ readonly sourceLocale: string;
475
+ readonly targetLocale: string;
476
+ readonly mode: "manual" | "automatic";
477
+ readonly updatedSlots: readonly TranslationSlot[];
478
+ readonly skippedSlots: readonly TranslationSlot[];
479
+ readonly missingSlotsCount: number;
480
+ }
481
+ interface TranslationSlotChangeEvent {
482
+ readonly slot: TranslationSlot;
483
+ readonly previousText?: string;
484
+ readonly nextText: string;
485
+ readonly mode: "manual" | "automatic";
486
+ readonly metadata: CanonicalTranslationMetadata;
487
+ }
488
+ interface ConfirmRemoveLocaleSlotProps {
489
+ readonly locale: string;
490
+ readonly localeLabel: string;
491
+ readonly translatedSlotsCount: number;
492
+ readonly isOpen: boolean;
493
+ readonly onConfirm: () => void;
494
+ readonly onCancel: () => void;
495
+ }
420
496
  interface TranslationWorkspaceSlots {
421
497
  readonly renderHeader?: (props: TranslationWorkspaceHeaderProps) => ReactNode;
422
498
  readonly renderSlotRow?: (props: TranslationSlotRowProps) => ReactNode;
@@ -425,6 +501,7 @@ interface TranslationWorkspaceSlots {
425
501
  readonly status: _form_engine_ts_core.TranslationStatus;
426
502
  }) => ReactNode;
427
503
  readonly renderActions?: (props: TranslationWorkspaceActionsProps) => ReactNode;
504
+ readonly confirmRemoveLocale?: (props: ConfirmRemoveLocaleSlotProps) => ReactNode;
428
505
  }
429
506
  interface LocalizationSummaryContext {
430
507
  readonly defaultLocale: string;
@@ -527,10 +604,6 @@ interface FormServerErrorPayload {
527
604
  readonly fieldErrors?: Readonly<Record<string, string>>;
528
605
  readonly formError?: string;
529
606
  }
530
- declare class FormSubmissionError extends Error {
531
- readonly payload: FormServerErrorPayload;
532
- constructor(message: string, payload?: FormServerErrorPayload);
533
- }
534
607
  type FormSubmitHandler = (answers: FormValues, context: SubmitContext) => SubmitResponse | void | Promise<SubmitResponse | undefined> | Promise<void>;
535
608
  type SubmissionGuardResult = {
536
609
  readonly status: "allow";
@@ -747,6 +820,8 @@ interface FieldState {
747
820
  }
748
821
  declare function useField(fieldId: string): FieldState;
749
822
 
823
+ declare function useTranslationComparison({ schema, sourceLocale, targetLocale, translationAdapter, readOnly, onChange, onTranslationChange }: UseTranslationComparisonOptions): UseTranslationComparisonResult;
824
+
750
825
  interface UseTranslationWorkspaceOptions {
751
826
  readonly schema: FormSchema;
752
827
  readonly onChange?: (schema: FormSchema) => void;
@@ -762,6 +837,18 @@ interface UseTranslationWorkspaceOptions {
762
837
  readonly beforeRemoveLocale?: (locale: string, context: {
763
838
  readonly slotCount: number;
764
839
  }) => Promise<boolean> | boolean;
840
+ readonly confirmRemoveLocale?: (props: ConfirmRemoveLocaleSlotProps) => ReactNode;
841
+ readonly slots?: Pick<TranslationWorkspaceSlots, "confirmRemoveLocale">;
842
+ readonly onTranslationStart?: (params: {
843
+ readonly targetLocale: string;
844
+ readonly mode: "manual" | "automatic";
845
+ }) => void;
846
+ readonly onTranslationSuccess?: (payload: TranslationEventPayload) => void;
847
+ readonly onTranslationError?: (params: {
848
+ readonly targetLocale: string;
849
+ readonly error: TranslationWorkspaceError;
850
+ }) => void;
851
+ readonly onTranslationChange?: (event: TranslationSlotChangeEvent) => void;
765
852
  readonly validateLocale?: ((locale: string, currentLocales: readonly string[]) => LocaleValidationResult) | CustomLocaleValidator;
766
853
  }
767
854
  interface LocaleValidationContext {
@@ -827,6 +914,7 @@ interface UseTranslationWorkspaceResult {
827
914
  };
828
915
  readonly isAddLocaleAllowed: (locale: string) => boolean;
829
916
  readonly removeLocale: (locale: string) => boolean | Promise<boolean>;
917
+ readonly removeLocaleConfirmation?: ReactNode;
830
918
  readonly setTranslation: (slot: TranslationSlot, text: string) => void;
831
919
  readonly translateAll: (options?: PopulateTranslationOptions) => Promise<{
832
920
  readonly success: boolean;
@@ -841,7 +929,7 @@ interface UseTranslationWorkspaceResult {
841
929
  readonly error?: TranslationWorkspaceError;
842
930
  }
843
931
  declare const validateLocalePipeline: (locale: string, schema: FormSchema, policy?: FormPolicy, customValidator?: ((locale: string, currentLocales: readonly string[]) => LocaleValidationResult) | CustomLocaleValidator, availableLocales?: readonly (string | LocaleOption)[]) => LocaleValidationResult;
844
- declare function useTranslationWorkspace({ schema, onChange, sourceLocale, targetLocale, translationAdapter, readOnly, policy, availableLocales, onLocaleAdded, onLocaleRemoved, onLocaleChange, beforeRemoveLocale, validateLocale }: UseTranslationWorkspaceOptions): UseTranslationWorkspaceResult;
932
+ declare function useTranslationWorkspace({ schema, onChange, sourceLocale, targetLocale, translationAdapter, readOnly, policy, availableLocales, onLocaleAdded, onLocaleRemoved, onLocaleChange, beforeRemoveLocale, confirmRemoveLocale, slots: workspaceSlots, onTranslationStart, onTranslationSuccess, onTranslationError, onTranslationChange, validateLocale }: UseTranslationWorkspaceOptions): UseTranslationWorkspaceResult;
845
933
 
846
934
  declare const BUILDER_TRANSLATION_KEYS: {
847
935
  readonly ADD_FIELD: "builder.actions.addField";
@@ -872,10 +960,12 @@ interface FormEngineI18nProviderProps {
872
960
  readonly fallbackLocale?: string;
873
961
  readonly messages?: FormEngineMessages;
874
962
  readonly customCatalogs?: Record<string, FormEngineMessages>;
963
+ readonly onMissingKey?: (event: TranslationMissingKeyEvent) => void;
964
+ readonly strict?: boolean;
875
965
  readonly translator?: FormEngineTranslator;
876
966
  readonly children: ReactNode;
877
967
  }
878
- declare function FormEngineI18nProvider({ locale, fallbackLocale, messages, customCatalogs, translator: customTranslator, children }: FormEngineI18nProviderProps): react.JSX.Element;
968
+ declare function FormEngineI18nProvider({ locale, fallbackLocale, messages, customCatalogs, onMissingKey, strict, translator: customTranslator, children }: FormEngineI18nProviderProps): react.JSX.Element;
879
969
  declare function useFormEngineI18n(): FormEngineI18nContextValue;
880
970
 
881
971
  declare function resolveChoiceFieldLayout(type: FieldType, appearance?: FormRendererAppearance, groupedChoiceFieldsLegacy?: boolean): "default" | "grouped";
@@ -931,4 +1021,4 @@ interface StandaloneFormRendererProps extends FormRendererPresentationProps {
931
1021
  type FormRendererProps = FormRendererPresentationProps | StandaloneFormRendererProps;
932
1022
  declare function FormRenderer(props: FormRendererProps): react.JSX.Element;
933
1023
 
934
- export { BUILDER_TRANSLATION_ALIASES, BUILDER_TRANSLATION_KEYS, type BeforeSubmit, type BuilderActionContext, type BuilderActionError, type BuilderActionIconType, type BuilderActionResult, type BuilderButtonProps, type BuilderCheckboxProps, type BuilderErrorMessageProps, type BuilderFactories, type BuilderFieldEditorSlotProps, type BuilderFieldsetProps, type BuilderIconButtonProps, type BuilderIdKind, type BuilderLocalizationSlotProps, type BuilderOptionEditorSlotProps, type BuilderPagesSlotProps, type BuilderPolicy, type BuilderSectionProps, type BuilderSelectOption, type BuilderSelectProps, type BuilderSlotActions, type BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type BuilderTranslationKey, type ChoiceFieldLayoutMode, type ChoiceFieldTypeLayoutMap, type ChoiceGroupSlotProps, type ComponentBaseProps, type CustomLocaleValidator, type FieldComponentProps, type FieldComponents, type FieldEditorControlsConfig, type FieldEditorHeaderSlotProps, type FieldEditorMode, type FieldError, type FieldPropertyControlMode, type FieldState, type FieldTypeSelectOptionsConfig, type FieldTypeSelectOptionsContext, type FieldTypeSelectOptionsSorter, type FieldTypeSelectOptionsTransformer, type FieldTypeSelectSlotProps, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormBuilderSubmissionSettingsOptions, type FormCompletionSlotProps, type FormContextValue, FormEngineI18nContext, type FormEngineI18nContextValue, FormEngineI18nProvider, type FormEngineI18nProviderProps, type FormFieldsSlotProps, FormProvider, type FormProviderProps, FormRenderer, type FormRendererAppearance, type FormRendererMessages, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlotProps, type FormRendererSlots, type FormServerErrorPayload, FormSubmissionError, type FormSubmitHandler, type FormSubmitState, type FormSubmitStatus, type FormSubmittedAnswerItem, type FormSuccessRenderMode, type IconButtonProps, type InputComponentProps, type LocaleSelectorProps, type LocaleValidationContext, type LocaleValidationResult, type LocalizationSummaryContext, type ManualTranslationContext, type ManualTranslationTarget, type RenderSubmitButtonProps, type SelectComponentProps, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationOptions, type SubmissionConfirmationRenderMode, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitContext, type SubmitResponse, type SubmitResult, type SubmitStatus, type TranslationSlotRowProps, type TranslationSummary, type TranslationWorkspaceActionsProps, type TranslationWorkspaceError, type TranslationWorkspaceHeaderProps, type TranslationWorkspaceSlots, type UseFormBuilderOptions, type UseFormBuilderResult, type UseSubmissionReceiptsResult, type UseTranslationWorkspaceOptions, type UseTranslationWorkspaceResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, isTranslationUnresolved, resolveChoiceFieldLayout, resolveFieldEditorControls, resolveFieldTypeSelectOptions, resolveInitialFieldType, resolveTranslation, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useFormEngineI18n, useSubmissionReceipts, useTranslationWorkspace, validateLocalePipeline };
1024
+ export { BUILDER_TRANSLATION_ALIASES, BUILDER_TRANSLATION_KEYS, type BeforeSubmit, type BuilderActionContext, type BuilderActionError, type BuilderActionIconType, type BuilderActionResult, type BuilderButtonProps, type BuilderCheckboxProps, type BuilderErrorMessageProps, type BuilderFactories, type BuilderFieldEditorSlotProps, type BuilderFieldsetProps, type BuilderIconButtonProps, type BuilderIdKind, type BuilderLocalizationSlotProps, type BuilderOptionEditorSlotProps, type BuilderPagesSlotProps, type BuilderPolicy, type BuilderSectionProps, type BuilderSelectOption, type BuilderSelectProps, type BuilderSlotActions, type BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type BuilderTranslationKey, type ChoiceFieldLayoutMode, type ChoiceFieldTypeLayoutMap, type ChoiceGroupSlotProps, type ComponentBaseProps, type ConfirmRemoveLocaleSlotProps, type CustomLocaleValidator, type FieldComponentProps, type FieldComponents, type FieldEditorControlsConfig, type FieldEditorHeaderSlotProps, type FieldEditorMode, type FieldError, type FieldPropertyControlMode, type FieldState, type FieldTypeSelectOptionsConfig, type FieldTypeSelectOptionsContext, type FieldTypeSelectOptionsSorter, type FieldTypeSelectOptionsTransformer, type FieldTypeSelectSlotProps, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormBuilderSubmissionSettingsOptions, type FormCompletionSlotProps, type FormContextValue, FormEngineI18nContext, type FormEngineI18nContextValue, FormEngineI18nProvider, type FormEngineI18nProviderProps, type FormFieldsSlotProps, FormProvider, type FormProviderProps, FormRenderer, type FormRendererAppearance, type FormRendererMessages, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlotProps, type FormRendererSlots, type FormServerErrorPayload, type FormSubmitHandler, type FormSubmitState, type FormSubmitStatus, type FormSubmittedAnswerItem, type FormSuccessRenderMode, type IconButtonProps, type InputComponentProps, type LocaleSelectorProps, type LocaleValidationContext, type LocaleValidationResult, type LocalizationSummaryContext, type ManualTranslationContext, type ManualTranslationTarget, type RenderSubmitButtonProps, type SelectComponentProps, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationOptions, type SubmissionConfirmationRenderMode, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitContext, type SubmitResponse, type SubmitResult, type SubmitStatus, type TranslationComparisonHeaderProps, type TranslationComparisonItem, type TranslationComparisonItemRowProps, type TranslationComparisonSummary, type TranslationEventPayload, type TranslationSlotChangeEvent, type TranslationSlotRowProps, type TranslationSummary, type TranslationWorkspaceActionsProps, type TranslationWorkspaceError, type TranslationWorkspaceHeaderProps, type TranslationWorkspaceSlots, type UseFormBuilderOptions, type UseFormBuilderResult, type UseSubmissionReceiptsResult, type UseTranslationComparisonOptions, type UseTranslationComparisonResult, type UseTranslationWorkspaceOptions, type UseTranslationWorkspaceResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, isTranslationUnresolved, resolveChoiceFieldLayout, resolveFieldEditorControls, resolveFieldTypeSelectOptions, resolveInitialFieldType, resolveTranslation, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useFormEngineI18n, useSubmissionReceipts, useTranslationComparison, useTranslationWorkspace, validateLocalePipeline };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _form_engine_ts_core from '@form-engine-ts/core';
2
- import { QuestionType, FormField, ChoiceOption, FormPage, FormSchema, DisplayCondition, JsonValue, SchemaIssue, FormPolicy, Question, FieldOption, TranslationReport, ValidationIssue, ValidationError, FormValues, LocaleOption, TranslationAdapter, AsyncTranslationAdapter, PopulateTranslationOptions, FormValue, AnswerValidationResult, TranslationSlot, FormEngineTranslator, FormEngineMessages, FieldType } from '@form-engine-ts/core';
3
- export { QuestionType } from '@form-engine-ts/core';
2
+ import { QuestionType, FormField, ChoiceOption, FormPage, FormSchema, DisplayCondition, JsonValue, SchemaIssue, FormPolicy, Question, FieldOption, TranslationReport, ValidationIssue, ValidationError, FormValues, LocaleOption, TranslationStatus, CanonicalTranslationMetadata, TranslationSlot, TranslationAdapter, AsyncTranslationAdapter, PopulateTranslationOptions, FormValue, AnswerValidationResult, FormEngineTranslator, FormEngineMessages, TranslationMissingKeyEvent, FieldType } from '@form-engine-ts/core';
3
+ export { FormSubmissionError, FormSubmissionSerializedError, QuestionType } from '@form-engine-ts/core';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, ComponentType, KeyboardEvent, MouseEvent, CSSProperties } from 'react';
6
6
  import { SensitiveDataFinding } from '@form-engine-ts/privacy';
@@ -307,6 +307,7 @@ interface BuilderSlotBaseProps {
307
307
  readonly actions: BuilderSlotActions;
308
308
  readonly components: Required<FormBuilderComponents>;
309
309
  readonly translate: (key: string, params?: Record<string, unknown>) => string;
310
+ readonly onChange?: (schema: FormSchema) => void;
310
311
  }
311
312
  interface BuilderToolbarSlotProps extends BuilderSlotBaseProps {
312
313
  readonly kind: "page" | "field" | "option";
@@ -402,6 +403,58 @@ interface TranslationSlotRowProps {
402
403
  readonly onChange: (text: string) => void;
403
404
  readonly onTranslate: () => void;
404
405
  }
406
+ interface TranslationComparisonItem {
407
+ readonly id: string;
408
+ readonly path: string;
409
+ readonly targetKind: "form" | "page" | "field" | "option";
410
+ readonly targetProperty: "title" | "description" | "label" | "completionMessage";
411
+ readonly nodeTitle?: string;
412
+ readonly sourceText: string;
413
+ readonly translatedText: string;
414
+ readonly status: TranslationStatus;
415
+ readonly metadata?: CanonicalTranslationMetadata;
416
+ readonly translatable: boolean;
417
+ }
418
+ interface TranslationComparisonSummary {
419
+ readonly total: number;
420
+ readonly translated: number;
421
+ readonly missing: number;
422
+ readonly stale: number;
423
+ readonly manual: number;
424
+ }
425
+ interface TranslationComparisonHeaderProps {
426
+ readonly sourceLocale: string;
427
+ readonly targetLocale: string;
428
+ readonly summary: TranslationComparisonSummary;
429
+ readonly onTranslateAll: () => void;
430
+ readonly isTranslating: boolean;
431
+ readonly readOnly: boolean;
432
+ }
433
+ interface TranslationComparisonItemRowProps {
434
+ readonly item: TranslationComparisonItem;
435
+ readonly readOnly: boolean;
436
+ readonly onChange: (text: string) => void;
437
+ readonly onTranslate: () => void;
438
+ }
439
+ interface UseTranslationComparisonOptions {
440
+ readonly schema: FormSchema;
441
+ readonly sourceLocale?: string;
442
+ readonly targetLocale: string;
443
+ readonly translationAdapter?: TranslationAdapter;
444
+ readonly readOnly?: boolean;
445
+ readonly onChange?: (nextSchema: FormSchema) => void;
446
+ readonly onTranslationChange?: (event: TranslationSlotChangeEvent) => void;
447
+ }
448
+ interface UseTranslationComparisonResult {
449
+ readonly sourceLocale: string;
450
+ readonly targetLocale: string;
451
+ readonly items: readonly TranslationComparisonItem[];
452
+ readonly summary: TranslationComparisonSummary;
453
+ readonly isTranslating: boolean;
454
+ readonly updateTranslation: (path: string, text: string) => void;
455
+ readonly translateSingle: (path: string) => Promise<void>;
456
+ readonly translateAll: () => Promise<TranslationReport>;
457
+ }
405
458
  interface LocaleSelectorProps {
406
459
  readonly targetLocale: string;
407
460
  readonly targetLocales: readonly string[];
@@ -417,6 +470,29 @@ interface TranslationWorkspaceActionsProps {
417
470
  readonly isTranslating: boolean;
418
471
  readonly readOnly: boolean;
419
472
  }
473
+ interface TranslationEventPayload {
474
+ readonly sourceLocale: string;
475
+ readonly targetLocale: string;
476
+ readonly mode: "manual" | "automatic";
477
+ readonly updatedSlots: readonly TranslationSlot[];
478
+ readonly skippedSlots: readonly TranslationSlot[];
479
+ readonly missingSlotsCount: number;
480
+ }
481
+ interface TranslationSlotChangeEvent {
482
+ readonly slot: TranslationSlot;
483
+ readonly previousText?: string;
484
+ readonly nextText: string;
485
+ readonly mode: "manual" | "automatic";
486
+ readonly metadata: CanonicalTranslationMetadata;
487
+ }
488
+ interface ConfirmRemoveLocaleSlotProps {
489
+ readonly locale: string;
490
+ readonly localeLabel: string;
491
+ readonly translatedSlotsCount: number;
492
+ readonly isOpen: boolean;
493
+ readonly onConfirm: () => void;
494
+ readonly onCancel: () => void;
495
+ }
420
496
  interface TranslationWorkspaceSlots {
421
497
  readonly renderHeader?: (props: TranslationWorkspaceHeaderProps) => ReactNode;
422
498
  readonly renderSlotRow?: (props: TranslationSlotRowProps) => ReactNode;
@@ -425,6 +501,7 @@ interface TranslationWorkspaceSlots {
425
501
  readonly status: _form_engine_ts_core.TranslationStatus;
426
502
  }) => ReactNode;
427
503
  readonly renderActions?: (props: TranslationWorkspaceActionsProps) => ReactNode;
504
+ readonly confirmRemoveLocale?: (props: ConfirmRemoveLocaleSlotProps) => ReactNode;
428
505
  }
429
506
  interface LocalizationSummaryContext {
430
507
  readonly defaultLocale: string;
@@ -527,10 +604,6 @@ interface FormServerErrorPayload {
527
604
  readonly fieldErrors?: Readonly<Record<string, string>>;
528
605
  readonly formError?: string;
529
606
  }
530
- declare class FormSubmissionError extends Error {
531
- readonly payload: FormServerErrorPayload;
532
- constructor(message: string, payload?: FormServerErrorPayload);
533
- }
534
607
  type FormSubmitHandler = (answers: FormValues, context: SubmitContext) => SubmitResponse | void | Promise<SubmitResponse | undefined> | Promise<void>;
535
608
  type SubmissionGuardResult = {
536
609
  readonly status: "allow";
@@ -747,6 +820,8 @@ interface FieldState {
747
820
  }
748
821
  declare function useField(fieldId: string): FieldState;
749
822
 
823
+ declare function useTranslationComparison({ schema, sourceLocale, targetLocale, translationAdapter, readOnly, onChange, onTranslationChange }: UseTranslationComparisonOptions): UseTranslationComparisonResult;
824
+
750
825
  interface UseTranslationWorkspaceOptions {
751
826
  readonly schema: FormSchema;
752
827
  readonly onChange?: (schema: FormSchema) => void;
@@ -762,6 +837,18 @@ interface UseTranslationWorkspaceOptions {
762
837
  readonly beforeRemoveLocale?: (locale: string, context: {
763
838
  readonly slotCount: number;
764
839
  }) => Promise<boolean> | boolean;
840
+ readonly confirmRemoveLocale?: (props: ConfirmRemoveLocaleSlotProps) => ReactNode;
841
+ readonly slots?: Pick<TranslationWorkspaceSlots, "confirmRemoveLocale">;
842
+ readonly onTranslationStart?: (params: {
843
+ readonly targetLocale: string;
844
+ readonly mode: "manual" | "automatic";
845
+ }) => void;
846
+ readonly onTranslationSuccess?: (payload: TranslationEventPayload) => void;
847
+ readonly onTranslationError?: (params: {
848
+ readonly targetLocale: string;
849
+ readonly error: TranslationWorkspaceError;
850
+ }) => void;
851
+ readonly onTranslationChange?: (event: TranslationSlotChangeEvent) => void;
765
852
  readonly validateLocale?: ((locale: string, currentLocales: readonly string[]) => LocaleValidationResult) | CustomLocaleValidator;
766
853
  }
767
854
  interface LocaleValidationContext {
@@ -827,6 +914,7 @@ interface UseTranslationWorkspaceResult {
827
914
  };
828
915
  readonly isAddLocaleAllowed: (locale: string) => boolean;
829
916
  readonly removeLocale: (locale: string) => boolean | Promise<boolean>;
917
+ readonly removeLocaleConfirmation?: ReactNode;
830
918
  readonly setTranslation: (slot: TranslationSlot, text: string) => void;
831
919
  readonly translateAll: (options?: PopulateTranslationOptions) => Promise<{
832
920
  readonly success: boolean;
@@ -841,7 +929,7 @@ interface UseTranslationWorkspaceResult {
841
929
  readonly error?: TranslationWorkspaceError;
842
930
  }
843
931
  declare const validateLocalePipeline: (locale: string, schema: FormSchema, policy?: FormPolicy, customValidator?: ((locale: string, currentLocales: readonly string[]) => LocaleValidationResult) | CustomLocaleValidator, availableLocales?: readonly (string | LocaleOption)[]) => LocaleValidationResult;
844
- declare function useTranslationWorkspace({ schema, onChange, sourceLocale, targetLocale, translationAdapter, readOnly, policy, availableLocales, onLocaleAdded, onLocaleRemoved, onLocaleChange, beforeRemoveLocale, validateLocale }: UseTranslationWorkspaceOptions): UseTranslationWorkspaceResult;
932
+ declare function useTranslationWorkspace({ schema, onChange, sourceLocale, targetLocale, translationAdapter, readOnly, policy, availableLocales, onLocaleAdded, onLocaleRemoved, onLocaleChange, beforeRemoveLocale, confirmRemoveLocale, slots: workspaceSlots, onTranslationStart, onTranslationSuccess, onTranslationError, onTranslationChange, validateLocale }: UseTranslationWorkspaceOptions): UseTranslationWorkspaceResult;
845
933
 
846
934
  declare const BUILDER_TRANSLATION_KEYS: {
847
935
  readonly ADD_FIELD: "builder.actions.addField";
@@ -872,10 +960,12 @@ interface FormEngineI18nProviderProps {
872
960
  readonly fallbackLocale?: string;
873
961
  readonly messages?: FormEngineMessages;
874
962
  readonly customCatalogs?: Record<string, FormEngineMessages>;
963
+ readonly onMissingKey?: (event: TranslationMissingKeyEvent) => void;
964
+ readonly strict?: boolean;
875
965
  readonly translator?: FormEngineTranslator;
876
966
  readonly children: ReactNode;
877
967
  }
878
- declare function FormEngineI18nProvider({ locale, fallbackLocale, messages, customCatalogs, translator: customTranslator, children }: FormEngineI18nProviderProps): react.JSX.Element;
968
+ declare function FormEngineI18nProvider({ locale, fallbackLocale, messages, customCatalogs, onMissingKey, strict, translator: customTranslator, children }: FormEngineI18nProviderProps): react.JSX.Element;
879
969
  declare function useFormEngineI18n(): FormEngineI18nContextValue;
880
970
 
881
971
  declare function resolveChoiceFieldLayout(type: FieldType, appearance?: FormRendererAppearance, groupedChoiceFieldsLegacy?: boolean): "default" | "grouped";
@@ -931,4 +1021,4 @@ interface StandaloneFormRendererProps extends FormRendererPresentationProps {
931
1021
  type FormRendererProps = FormRendererPresentationProps | StandaloneFormRendererProps;
932
1022
  declare function FormRenderer(props: FormRendererProps): react.JSX.Element;
933
1023
 
934
- export { BUILDER_TRANSLATION_ALIASES, BUILDER_TRANSLATION_KEYS, type BeforeSubmit, type BuilderActionContext, type BuilderActionError, type BuilderActionIconType, type BuilderActionResult, type BuilderButtonProps, type BuilderCheckboxProps, type BuilderErrorMessageProps, type BuilderFactories, type BuilderFieldEditorSlotProps, type BuilderFieldsetProps, type BuilderIconButtonProps, type BuilderIdKind, type BuilderLocalizationSlotProps, type BuilderOptionEditorSlotProps, type BuilderPagesSlotProps, type BuilderPolicy, type BuilderSectionProps, type BuilderSelectOption, type BuilderSelectProps, type BuilderSlotActions, type BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type BuilderTranslationKey, type ChoiceFieldLayoutMode, type ChoiceFieldTypeLayoutMap, type ChoiceGroupSlotProps, type ComponentBaseProps, type CustomLocaleValidator, type FieldComponentProps, type FieldComponents, type FieldEditorControlsConfig, type FieldEditorHeaderSlotProps, type FieldEditorMode, type FieldError, type FieldPropertyControlMode, type FieldState, type FieldTypeSelectOptionsConfig, type FieldTypeSelectOptionsContext, type FieldTypeSelectOptionsSorter, type FieldTypeSelectOptionsTransformer, type FieldTypeSelectSlotProps, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormBuilderSubmissionSettingsOptions, type FormCompletionSlotProps, type FormContextValue, FormEngineI18nContext, type FormEngineI18nContextValue, FormEngineI18nProvider, type FormEngineI18nProviderProps, type FormFieldsSlotProps, FormProvider, type FormProviderProps, FormRenderer, type FormRendererAppearance, type FormRendererMessages, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlotProps, type FormRendererSlots, type FormServerErrorPayload, FormSubmissionError, type FormSubmitHandler, type FormSubmitState, type FormSubmitStatus, type FormSubmittedAnswerItem, type FormSuccessRenderMode, type IconButtonProps, type InputComponentProps, type LocaleSelectorProps, type LocaleValidationContext, type LocaleValidationResult, type LocalizationSummaryContext, type ManualTranslationContext, type ManualTranslationTarget, type RenderSubmitButtonProps, type SelectComponentProps, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationOptions, type SubmissionConfirmationRenderMode, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitContext, type SubmitResponse, type SubmitResult, type SubmitStatus, type TranslationSlotRowProps, type TranslationSummary, type TranslationWorkspaceActionsProps, type TranslationWorkspaceError, type TranslationWorkspaceHeaderProps, type TranslationWorkspaceSlots, type UseFormBuilderOptions, type UseFormBuilderResult, type UseSubmissionReceiptsResult, type UseTranslationWorkspaceOptions, type UseTranslationWorkspaceResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, isTranslationUnresolved, resolveChoiceFieldLayout, resolveFieldEditorControls, resolveFieldTypeSelectOptions, resolveInitialFieldType, resolveTranslation, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useFormEngineI18n, useSubmissionReceipts, useTranslationWorkspace, validateLocalePipeline };
1024
+ export { BUILDER_TRANSLATION_ALIASES, BUILDER_TRANSLATION_KEYS, type BeforeSubmit, type BuilderActionContext, type BuilderActionError, type BuilderActionIconType, type BuilderActionResult, type BuilderButtonProps, type BuilderCheckboxProps, type BuilderErrorMessageProps, type BuilderFactories, type BuilderFieldEditorSlotProps, type BuilderFieldsetProps, type BuilderIconButtonProps, type BuilderIdKind, type BuilderLocalizationSlotProps, type BuilderOptionEditorSlotProps, type BuilderPagesSlotProps, type BuilderPolicy, type BuilderSectionProps, type BuilderSelectOption, type BuilderSelectProps, type BuilderSlotActions, type BuilderTextAreaProps, type BuilderTextInputProps, type BuilderTextTarget, type BuilderToolbarSlotProps, type BuilderTranslationActionsSlotProps, type BuilderTranslationKey, type ChoiceFieldLayoutMode, type ChoiceFieldTypeLayoutMap, type ChoiceGroupSlotProps, type ComponentBaseProps, type ConfirmRemoveLocaleSlotProps, type CustomLocaleValidator, type FieldComponentProps, type FieldComponents, type FieldEditorControlsConfig, type FieldEditorHeaderSlotProps, type FieldEditorMode, type FieldError, type FieldPropertyControlMode, type FieldState, type FieldTypeSelectOptionsConfig, type FieldTypeSelectOptionsContext, type FieldTypeSelectOptionsSorter, type FieldTypeSelectOptionsTransformer, type FieldTypeSelectSlotProps, FormBuilder, type FormBuilderActions, type FormBuilderComponents, type FormBuilderFeatures, type FormBuilderOptions, type FormBuilderProps, type FormBuilderResult, type FormBuilderSectionName, type FormBuilderSlots, type FormBuilderSubmissionSettingsOptions, type FormCompletionSlotProps, type FormContextValue, FormEngineI18nContext, type FormEngineI18nContextValue, FormEngineI18nProvider, type FormEngineI18nProviderProps, type FormFieldsSlotProps, FormProvider, type FormProviderProps, FormRenderer, type FormRendererAppearance, type FormRendererMessages, type FormRendererPresentationProps, type FormRendererProps, type FormRendererSlotProps, type FormRendererSlots, type FormServerErrorPayload, type FormSubmitHandler, type FormSubmitState, type FormSubmitStatus, type FormSubmittedAnswerItem, type FormSuccessRenderMode, type IconButtonProps, type InputComponentProps, type LocaleSelectorProps, type LocaleValidationContext, type LocaleValidationResult, type LocalizationSummaryContext, type ManualTranslationContext, type ManualTranslationTarget, type RenderSubmitButtonProps, type SelectComponentProps, type StandaloneFormRendererProps, type SubmissionAttempt, type SubmissionAttemptStore, type SubmissionConfirmationOptions, type SubmissionConfirmationRenderMode, type SubmissionConfirmationSlotProps, type SubmissionGuard, type SubmissionGuardResult, type SubmissionProtectionProps, type SubmissionReceipt, type SubmissionReceiptQuery, type SubmissionReceiptStore, type SubmitContext, type SubmitResponse, type SubmitResult, type SubmitStatus, type TranslationComparisonHeaderProps, type TranslationComparisonItem, type TranslationComparisonItemRowProps, type TranslationComparisonSummary, type TranslationEventPayload, type TranslationSlotChangeEvent, type TranslationSlotRowProps, type TranslationSummary, type TranslationWorkspaceActionsProps, type TranslationWorkspaceError, type TranslationWorkspaceHeaderProps, type TranslationWorkspaceSlots, type UseFormBuilderOptions, type UseFormBuilderResult, type UseSubmissionReceiptsResult, type UseTranslationComparisonOptions, type UseTranslationComparisonResult, type UseTranslationWorkspaceOptions, type UseTranslationWorkspaceResult, createLocalStorageSubmissionAttemptStore, createLocalStorageSubmissionReceiptStore, isTranslationUnresolved, resolveChoiceFieldLayout, resolveFieldEditorControls, resolveFieldTypeSelectOptions, resolveInitialFieldType, resolveTranslation, submissionReceiptQueryKey, useField, useForm, useFormBuilder, useFormEngineI18n, useSubmissionReceipts, useTranslationComparison, useTranslationWorkspace, validateLocalePipeline };