@frigade/react 1.33.12 → 1.33.14

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/lib/index.d.ts CHANGED
@@ -414,6 +414,7 @@ interface CustomFormTypeProps {
414
414
  setCanContinue: (canContinue: boolean) => void;
415
415
  onSaveData: (data: object) => void;
416
416
  appearance?: Appearance;
417
+ prefillData?: Record<string, any>;
417
418
  customFormElements?: {
418
419
  [key: string]: (params: FormInputProps) => React__default.ReactNode;
419
420
  };
@@ -439,7 +440,18 @@ interface FrigadeFormProps extends DefaultFrigadeFlowProps {
439
440
  * Map of custom components. The key must match the `type` property of the step defined in `flow-data.yml`
440
441
  */
441
442
  customStepTypes?: {
442
- [key: string]: (params: CustomFormTypeProps) => React__default.ReactNode;
443
+ [key: string]: (params: {
444
+ flowId: string;
445
+ stepData: StepData;
446
+ canContinue: boolean;
447
+ setCanContinue: (canContinue: boolean) => void;
448
+ onSaveData: (data: object) => void;
449
+ appearance?: Appearance;
450
+ prefillData?: Record<string, any>;
451
+ customFormElements?: {
452
+ [key: string]: (params: FormInputProps) => React__default.ReactNode;
453
+ };
454
+ }) => React__default.ReactNode;
443
455
  };
444
456
  /**
445
457
  * Map of custom form components. Can only be used with a step of type `multiInput` (defined in `flow-data.yml`).
@@ -481,9 +493,27 @@ interface FrigadeFormProps extends DefaultFrigadeFlowProps {
481
493
  showFrigadeBranding?: boolean;
482
494
  /**
483
495
  * This function is called when the user submits data in a step.
484
- * If it returns a string, the flow will not proceed to the next step and the string will be displayed as an error message.
496
+ * If it returns a string or explicitly false, the flow will not proceed to the next step.
497
+ * Optionally, if a string is returned it will be displayed as an error message.
498
+ */
499
+ validationHandler?: (step: StepData, index: number, nextStep?: StepData, allFormData?: any, stepSpecificFormData?: any) => Promise<string | null | boolean | undefined>;
500
+ /**
501
+ * Handler that is called when the form data changes.
502
+ */
503
+ onFormDataChange?: (allFormData: any, stepSpecificFormData: any, step: StepData, index: number) => void;
504
+ /**
505
+ * Show or hide the form footer
506
+ */
507
+ showFooter?: boolean;
508
+ /**
509
+ * Data to use for prefilling forms with data.
510
+ * Useful when you want to prefill a form with data from another source.
511
+ * The format of the data maps a step id to the prefill data. Depending on the implementation of the given step type,
512
+ * the value of the data will follow a different structure.
513
+ *
514
+ * For `type` multiInputStep, the value contains another map similar to the structure returned from `onFormDataChange`
485
515
  */
486
- validationHandler?: (step: StepData, index: number, nextStep?: StepData, allFormData?: any, stepSpecificFormData?: object) => Promise<string | null | undefined>;
516
+ prefillData?: Record<string, any>;
487
517
  }
488
518
  declare const FrigadeForm: FC<FrigadeFormProps>;
489
519