@overmap-ai/core 1.0.58-qr-code-field-fix.0 → 1.0.58-sign-up-hotfix.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.
@@ -6,7 +6,7 @@ import { FieldOptions } from "./typings";
6
6
  import { FormikUserFormRevision } from "../../builder";
7
7
  export declare abstract class BaseFormElement<TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> {
8
8
  readonly type: TIdentifier;
9
- protected readonly identifier: string;
9
+ readonly identifier: string;
10
10
  readonly description: string | null;
11
11
  protected constructor(options: BaseSerializedObject);
12
12
  getId(): string;
@@ -47,4 +47,6 @@ export declare abstract class BaseField<TValue extends FieldValue, TIdentifier e
47
47
  abstract serialize(): ISerializedOnlyField;
48
48
  getFieldValidators(): InputFieldLevelValidator<TValue>[];
49
49
  getFormValidators(): InputFormLevelValidator<TValue>[];
50
+ encodeValueToJson(value: TValue): string;
51
+ decodeJsonToValue(json: string): TValue;
50
52
  }
@@ -2,8 +2,8 @@ import { BaseField, ChildFieldOptions } from "../BaseField";
2
2
  import { GetInputProps, InputFieldLevelValidator } from "../typings";
3
3
  import { ChangeEvent, ReactNode } from "react";
4
4
  import { RiListCheck } from "react-icons/ri";
5
- import { ISerializedField, SelectFieldOption, SerializedMultiStringField } from "../../typings";
6
- type MultiStringFieldOptions = ChildFieldOptions<SelectFieldOption[]> & {
5
+ import { ISerializedField, SerializedMultiStringField } from "../../typings";
6
+ type MultiStringFieldOptions = ChildFieldOptions<string[]> & {
7
7
  minimum_length?: number;
8
8
  maximum_length?: number;
9
9
  placeholder?: string;
@@ -21,7 +21,7 @@ export declare const emptyMultiStringField: {
21
21
  * - Specifying the options of a SelectField (used in `SelectField.getFieldCreationSchema`
22
22
  * - Listing serial numbers and similar
23
23
  */
24
- export declare class MultiStringField extends BaseField<SelectFieldOption[], "multi-string"> {
24
+ export declare class MultiStringField extends BaseField<string[], "multi-string"> {
25
25
  static readonly fieldTypeName = "Multi-string";
26
26
  static readonly fieldTypeDescription = "Allows the user to provide multiple unique strings.";
27
27
  readonly minLength: number;
@@ -30,11 +30,11 @@ export declare class MultiStringField extends BaseField<SelectFieldOption[], "mu
30
30
  readonly placeholder: string;
31
31
  static Icon: typeof RiListCheck;
32
32
  constructor(options: MultiStringFieldOptions);
33
- getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | SelectFieldOption[]): SelectFieldOption[];
33
+ getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | string[]): string[];
34
34
  getInput(props: GetInputProps<this>): ReactNode;
35
35
  serialize(): SerializedMultiStringField;
36
- protected isBlank(value: SelectFieldOption[]): boolean;
37
- getFieldValidators(): InputFieldLevelValidator<SelectFieldOption[]>[];
36
+ protected isBlank(value: string[]): boolean;
37
+ getFieldValidators(): InputFieldLevelValidator<string[]>[];
38
38
  static deserialize(data: ISerializedField): MultiStringField;
39
39
  }
40
40
  export {};
@@ -23,5 +23,5 @@ export interface ComponentProps<TField extends BaseFormElement> extends Omit<HTM
23
23
  showInputOnly?: boolean;
24
24
  }
25
25
  export type GetInputProps<TField extends BaseFormElement> = Omit<ComponentProps<TField>, "field">;
26
- export type AnyField = BaseField<any>;
26
+ export type AnyField = BaseField<any, any>;
27
27
  export type ISerializedOnlyField = Exclude<ISerializedField, SerializedFieldSection>;
@@ -10,5 +10,8 @@ export declare const deserializeField: (serializedField: ISerializedOnlyField) =
10
10
  export declare const deserialize: (serialized: ISerializedField) => AnyField | FieldSection;
11
11
  export type PartialFormRevision = Pick<UserFormRevision, "title" | "fields" | "description"> & Partial<UserFormRevision>;
12
12
  export declare function formRevisionToSchema(formRevision: PartialFormRevision, meta?: Partial<SchemaMeta>): ISchema;
13
+ export declare function flattenFields(schema: ISchema): AnyField[];
14
+ export declare function decodeFormValues(schema: ISchema, values: Record<string, string>): Record<string, FieldValue>;
15
+ export declare function encodeFormValues(schema: ISchema, values: Record<string, FieldValue>): Record<string, string>;
13
16
  export declare function valueIsFile(v: FieldValue | Promise<File>[] | undefined): v is File[] | Promise<File>[];
14
17
  export declare function isConditionMet<TValue extends FieldValue | Promise<File>[]>(condition: TValue extends FieldValue ? SerializedCondition<TValue> | null : null, value: TValue): boolean;
@@ -2,3 +2,4 @@ export * from "./typings";
2
2
  export * from "./builder";
3
3
  export * from "./fields";
4
4
  export * from "./renderer";
5
+ export { validateForm, initialFormValues } from "./utils";
@@ -28,7 +28,7 @@ export interface BaseSerializedField<TIdentifier extends FieldTypeIdentifier = F
28
28
  image?: File | Promise<File>;
29
29
  }
30
30
  /** All the possible field values */
31
- export type FieldValue = string | number | boolean | string[] | SelectFieldOption[] | File[] | Date | Marker | null;
31
+ export type FieldValue = string | number | boolean | string[] | File[] | Date | Marker | null;
32
32
  export interface SerializedCondition<TValue extends FieldValue = FieldValue> {
33
33
  identifier: string;
34
34
  value: TValue;