import { ServicePluginDefinition } from '@wix/sdk-types'; interface ValidateSubmissionRequest extends ValidateSubmissionRequestActionsOneOf { /** Data for updating an existing submission. */ updateOptions?: UpdateOptions; /** Submission to validate. */ submission: FormSubmission; /** Whether to create or update the submission. */ actionType: ActionType; } /** @oneof */ interface ValidateSubmissionRequestActionsOneOf { /** Data for updating an existing submission. */ updateOptions?: UpdateOptions; } /** Form submission that was created or retrieved. */ interface FormSubmission { /** * Submission ID. * @format GUID * @readonly */ _id?: string | null; /** * ID of the form which the submission belongs to. * @format GUID * @immutable */ formId?: string; /** * The app which the form submissions belong to. A submission inherits the namespace from its form schema, so you can't set it directly. * * For example, a submission of a form visible in the Wix Forms app has the namespace `wix.form_app.form`, the namespace of the Wix Forms app, whose app ID is `225dd912-7dea-4738-8688-4b8c6955ffc2`. * * See a list of namespaces for [apps made by Wix](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/introduction#namespaces-of-apps-made-by-wix) section. * To retrieve the ID for a Wix app, see [Apps Created By Wix](https://dev.wix.com/docs/rest/articles/get-started/apps-created-by-wix). * @minLength 10 * @maxLength 50 * @readonly */ namespace?: string; /** * Status of the submission. * * The status a submission is created with depends on the form's namespace and on whether the form collects payment, so read it from the response rather than assuming. * * A submission for a form that collects payment starts as `PAYMENT_WAITING`. Otherwise, most namespaces record the submission immediately as `CONFIRMED`. Namespaces that need to complete another step first, such as taking payment for a pricing plan, create the submission as `PENDING` and confirm it later with Confirm Submission. * * A `PENDING` submission isn't recorded yet, and is deleted automatically if it isn't confirmed in time. */ status?: SubmissionStatus; /** * Values the visitor submitted. * * Each key is the `target` of a field in the form schema, which is the field's stable storage key rather than its ID or label. Only keys matching a field target are accepted. * * Each value's shape follows that field's `inputType`: `STRING` fields submit a string, `NUMBER` a number, `BOOLEAN` a boolean, and `ARRAY` an array of the selected option values. Date and time fields are strings. A choice field submits an option's `value`, not its ID or its label. * * 3 input types submit structured values: `ADDRESS` submits an address object, `PAYMENT` an array holding 1 product object per item bought, and `SCHEDULING` an appointment object. * * For the full mapping, see [About Submission Values](https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/about-submission-values). */ submissions?: Record; /** * Date and time the form submission was created. * @immutable */ _createdDate?: Date | null; /** * Date and time the form submission was updated. * @readonly */ _updatedDate?: Date | null; /** * Revision number, which increments by 1 each time the form submission is updated. To prevent conflicting changes, the existing revision must be used when updating a form submission. * @readonly */ revision?: string | null; /** * ID of the visitor that submitted the form. * @readonly */ submitter?: Submitter; /** Whether a site owner marked a submission as "seen". */ seen?: boolean; /** Data extension object that holds users' and apps' fields. */ extendedFields?: ExtendedFields; /** * Order details.
* Note: This object is only applicable when submitting a form in the Wix Payments app. */ orderDetails?: OrderDetails; /** * Contact ID of a site visitor who created the submission. * @format GUID * @readonly * @immutable */ contactId?: string | null; /** * Authorized viewer ID. * @format GUID * @immutable */ accessRestriction?: string | null; /** Tag IDs collections associated with the current entity. */ tags?: PublicTags; /** * Appointment details. * This object is only applicable when submitting a form that creates a booking appointment. */ appointmentDetails?: AppointmentDetails; /** * ID of the child site the submission was made on. * * Only present when the form was submitted on a site that shares its data with a parent site. In that case submissions from every child site are stored on the parent site, and this field identifies which child site the submission came from. * @format GUID * @readonly */ childMetaSiteId?: string | null; } declare enum SubmissionStatus { /** A submission is created, but has not yet been recorded in the Wix Forms collection. */ PENDING = "PENDING", /** A submission is recorded in the Wix Forms collection. */ CONFIRMED = "CONFIRMED", /** A form submission requiring payment is created. */ PAYMENT_WAITING = "PAYMENT_WAITING", /** An order of a form submission is canceled. */ PAYMENT_CANCELED = "PAYMENT_CANCELED" } interface Submitter extends SubmitterSubmitterOneOf { /** * Member ID. * @format GUID */ memberId?: string | null; /** * Visitor ID. * @format GUID */ visitorId?: string | null; /** * Application ID. * @maxLength 36 */ applicationId?: string | null; /** * User ID. * @format GUID */ userId?: string | null; } /** @oneof */ interface SubmitterSubmitterOneOf { /** * Member ID. * @format GUID */ memberId?: string | null; /** * Visitor ID. * @format GUID */ visitorId?: string | null; /** * Application ID. * @maxLength 36 */ applicationId?: string | null; /** * User ID. * @format GUID */ userId?: string | null; } interface ExtendedFields { /** * Extended field data. Each key corresponds to the namespace of the app that created the extended fields. * The value of each key is structured according to the schema defined when the extended fields were configured. * * You can only access fields for which you have the appropriate permissions. * * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields). */ namespaces?: Record>; } interface OrderDetails { /** * ID of the order related to submission (only applicable if a form has payments). * @format GUID * @readonly */ orderId?: string | null; /** * Order number. * @readonly */ number?: string | null; /** * Currency. * @format CURRENCY * @readonly */ currency?: string | null; /** * Item subtotal. * @decimalValue options { gte:0.00, maxScale:2 } * @readonly */ itemSubtotal?: string; /** * ID of the checkout related to submission (only applicable if a form has payments). * @format GUID * @readonly */ checkoutId?: string; } interface PublicTags { /** Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. */ tags?: TagList; } interface TagList { /** * List of tag IDs * @maxSize 100 * @maxLength 5 */ tagIds?: string[]; } interface AppointmentDetails { /** * ID of the staff member assigned to the appointment. * @format GUID */ staffMemberId?: string | null; /** * Name of the staff member assigned to the appointment. * @minLength 1 * @maxLength 40 */ staffMemberName?: string | null; } declare enum ActionType { /** Unknown action type. */ UNKNOWN_ACTION = "UNKNOWN_ACTION", /** Update submission. */ UPDATE = "UPDATE", /** Create submission. */ CREATE = "CREATE" } interface UpdateOptions { /** Submission to update. */ currentSubmission?: FormSubmission; } interface ValidateSubmissionResponse { /** * List of validation errors.
* If there are no validation errors, returns an empty array. * @maxSize 100 */ errors?: SubmissionValidationError[]; } interface SubmissionValidationError extends SubmissionValidationErrorErrorMessageOneOf { /** Predefined error type. */ errorType?: SubmissionErrorType; /** * Custom error message. The message is displayed instead of an error type. * @maxLength 500 */ customErrorMessage?: string; /** * Path indicating the source of the error, such as `form.fields.target`. * @maxLength 500 */ errorPath?: string; /** Additional error parameters. */ params?: Record | null; } /** @oneof */ interface SubmissionValidationErrorErrorMessageOneOf { /** Predefined error type. */ errorType?: SubmissionErrorType; /** * Custom error message. The message is displayed instead of an error type. * @maxLength 500 */ customErrorMessage?: string; } declare enum SubmissionErrorType { /** Error is unknown or unsuitable for any of the options below. */ UNKNOWN_ERROR = "UNKNOWN_ERROR", /** Type of submitted value is incorrect. */ TYPE_ERROR = "TYPE_ERROR", /** Value is required to be provided. */ REQUIRED_VALUE_ERROR = "REQUIRED_VALUE_ERROR", /** Value contains additional properties not expected in schema. */ UNKNOWN_VALUE_ERROR = "UNKNOWN_VALUE_ERROR", /** Text value exceeds max length. */ MAX_LENGTH_ERROR = "MAX_LENGTH_ERROR", /** Text value does not reach min length. */ MIN_LENGTH_ERROR = "MIN_LENGTH_ERROR", /** Text value is not applicable for expected pattern. */ PATTERN_ERROR = "PATTERN_ERROR", /** Text value is not applicable for expected format. */ FORMAT_ERROR = "FORMAT_ERROR", /** Number value is too big. */ MAX_VALUE_ERROR = "MAX_VALUE_ERROR", /** Number value is too small. */ MIN_VALUE_ERROR = "MIN_VALUE_ERROR", /** Number value is not a multiple of expected number. */ MULTIPLE_OF_VALUE_ERROR = "MULTIPLE_OF_VALUE_ERROR", /** Array value has too many items. */ MIN_ITEMS_ERROR = "MIN_ITEMS_ERROR", /** Array value has not enough items. */ MAX_ITEMS_ERROR = "MAX_ITEMS_ERROR", /** Value is not in the list of allowed values. */ NOT_ALLOWED_VALUE_ERROR = "NOT_ALLOWED_VALUE_ERROR", /** Submitted form is disabled. */ DISABLED_FORM_ERROR = "DISABLED_FORM_ERROR", /** Country code is not correct or missing from the phone number. */ INVALID_PHONE_COUNTRY_CODE_ERROR = "INVALID_PHONE_COUNTRY_CODE_ERROR", /** Invalid staff member ID on appointment. */ INVALID_STAFF_ID_ERROR = "INVALID_STAFF_ID_ERROR", /** Invalid business location ID on appointment. */ INVALID_LOCATION_ID_ERROR = "INVALID_LOCATION_ID_ERROR", /** Missing service option on service picker field. */ MISSING_SERVICE_OPTION_ERROR = "MISSING_SERVICE_OPTION_ERROR", /** Some of the service options on service picker field are deleted or unavailable. */ INVALID_SERVICE_OPTIONS_ERROR = "INVALID_SERVICE_OPTIONS_ERROR", /** All of the service options on service picker field are deleted or unavailable. */ NO_AVAILABLE_SERVICE_OPTIONS_ERROR = "NO_AVAILABLE_SERVICE_OPTIONS_ERROR", /** Text value does not match the exact required length. */ EXACT_CHARACTER_LENGTH_ERROR = "EXACT_CHARACTER_LENGTH_ERROR", /** Character count is not within the required range. */ CHARACTER_LENGTH_RANGE_ERROR = "CHARACTER_LENGTH_RANGE_ERROR", /** Number is not within the required range. */ VALUE_RANGE_ERROR = "VALUE_RANGE_ERROR", /** Array value does not have the exact number of items selected. */ EXACT_ITEMS_NUMBER_ERROR = "EXACT_ITEMS_NUMBER_ERROR", /** Number has incorrect number of decimal places. */ DECIMAL_POINT_ERROR = "DECIMAL_POINT_ERROR", /** Date value is incomplete or missing required parts. */ INCOMPLETE_DATE_ERROR = "INCOMPLETE_DATE_ERROR", /** Value does not match the required pattern format. */ INVALID_VALUE_FOR_PATTERN_ERROR = "INVALID_VALUE_FOR_PATTERN_ERROR", /** No resource on the site is connected to a video conferencing provider, so the appointment's online meeting format can't be offered. */ NO_CONNECTED_CONFERENCING_RESOURCE_ERROR = "NO_CONNECTED_CONFERENCING_RESOURCE_ERROR" } interface FormSubmissionSpiExtensionConfig { /** * Deployment URI where the endpoints are called. Wix Forms appends the endpoint path to the deployment URI. * For example, to call the Validate Submission endpoint at `https://my-form-submissions.com/v1/validateSubmission`, * the `deploymentUri` you provide here is `https://my-form-submissions.com/`. */ deploymentUri?: SpiBaseUri; /** * Namespace names. * @maxSize 10 */ namespaceConfigs?: FormsSubmissionsExtensionNamespaceConfig[]; } /** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */ interface SpiBaseUri { /** * Base URI for your service plugin. Wix appends each method's path to this URI. * * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`. * @minLength 6 * @maxLength 2048 */ baseUri?: string; /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */ alternativeUris?: AlternativeUri[]; } /** Custom URI for the specified service plugin method. */ interface AlternativeUri { /** * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`. * @minLength 3 * @maxLength 128 */ methodName?: string; /** * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI. * * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`. * @minLength 6 * @maxLength 2048 */ absoluteUri?: string; } interface FormsSubmissionsExtensionNamespaceConfig { /** * The app which the form submissions belong to. For example, the namespace for the Wix Forms app is `wix.form_app.form`. * * Call `Get Submission` to retrieve the namespace. * @minLength 10 * @maxLength 50 */ namespace?: string; /** * The ID of the specific form that will trigger the defined methods when a submission is made. * This field is optional. If not provided, submissions from all forms will trigger the methods. * @format GUID */ formId?: string | null; /** Enable submission validation. */ submissionValidationEnabled?: boolean; } /** * this message is not directly used by any service, * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform. * e.g. SPIs, event-handlers, etc.. * NOTE: this context object MUST be provided as the last argument in each Velo method signature. * * Example: * ```typescript * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) { * ... * } * ``` */ interface Context { /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */ requestId?: string | null; /** * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code. * @format CURRENCY */ currency?: string | null; /** An object that describes the identity that triggered this request. */ identity?: IdentificationData; /** A string representing a language and region in the format of `"xx-XX"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash "-", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `"en-US"`. */ languages?: string[]; /** * The service provider app's instance ID. * @format GUID */ instanceId?: string | null; /** * Extension ID in Dev Center. * @internal * @maxLength 256 */ appExtensionId?: string | null; /** * Extension type in Dev Center. * @internal * @maxLength 256 */ appExtensionType?: string | null; /** * Invoked function. * @internal * @maxLength 256 */ functionName?: string | null; } declare enum IdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } interface IdentificationData extends IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; /** @readonly */ identityType?: IdentityType; } /** @oneof */ interface IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; } interface ValidateSubmissionEnvelope { request: ValidateSubmissionRequest; metadata: Context; } declare const provideHandlers: ServicePluginDefinition<{ /** * * > **Note:** The Form Submission service plugin only works with the Wix Forms app. * * Validates a submission. * * Validates a site visitor's form submission and returns any validation violations. Site visitors can see the validation violations on their forms. For example, invalid fields are highlighted in red. */ validateSubmission(payload: ValidateSubmissionEnvelope): ValidateSubmissionResponse | Promise; }>; export { type AppointmentDetails as A, type Context as C, type ExtendedFields as E, type FormSubmission as F, IdentityType as I, type OrderDetails as O, type PublicTags as P, SubmissionStatus as S, type TagList as T, type UpdateOptions as U, type ValidateSubmissionRequest as V, type ValidateSubmissionRequestActionsOneOf as a, type Submitter as b, type SubmitterSubmitterOneOf as c, ActionType as d, type ValidateSubmissionResponse as e, type SubmissionValidationError as f, type SubmissionValidationErrorErrorMessageOneOf as g, SubmissionErrorType as h, type FormSubmissionSpiExtensionConfig as i, type SpiBaseUri as j, type AlternativeUri as k, type FormsSubmissionsExtensionNamespaceConfig as l, type IdentificationData as m, type IdentificationDataIdOneOf as n, type ValidateSubmissionEnvelope as o, provideHandlers as p };