/** * **Deprecated:** A form for creating an RSVP to an event. * * **Deprecation note:** The `RsvpForm` object is being deprecated. Use * the `Form()` object instead. * * Using an `RsvpForm`, you can build custom RSVP experiences for your events. * * You will need to have at least one existing event to create an `RsvpForm`. * * ### Typical Custom RSVP Form Lifecycle * * 1. In the Dashboard, [set up a registration form](https://support.wix.com/en/article/setting-up-your-registration-form-page-in-wix-events) for an event. * 1. Retrieve the ID of an event from the **Events/Events** collection. * 1. Create a new `RsvpForm` using the [`createEventRsvpForm()`](events.html#createEventRsvpForm) * function with the ID retrieved above. * 1. Retrieve information about the RSVP form inputs in the form using the [`getRsvpData()`](#getRsvpData) function. * 1. In the Editor, add user input elements for each form inputs retrieved above. * You may want to set the elements IDs to match the names of form input retrieved above. * 1. In the Editor, add a button that will be used to submit the form value to create * a new RSVP. * 1. When the submit button is clicked, gather the values entered into the form in * a `FormValue` array and use the [`submit()`](#submit) function * to submit the values. */ export interface RsvpForm { /** * **Deprecated:** Gets information about the event's RSVP form and status. * * **Deprecation note:** The `getRsvpData` function of the `RsvpForm` object is being * deprecated. Use the [`formData`](events.Form.html#formData) property of * the [`Form`](events.Form.html) object instead. * * The `getRsvpData()` function returns a Promise that resolves to an * `RsvpData` object containing all the information you need to create * a custom RSVP form for the specified event. * * This information includes: * * + The event's registration status, such as whether registration is * open, closed, or guests will be placed on a waitlist. * + Which statuses guests can RSVP with, such as yes, no, or to be added * to the waitlist. * + Information about the RSVP form's fields, such as their names, * descriptive labels, and whether they are required. * * > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality. * * @returns Fulfilled - Information about the RSVP form's input fields and status options. * @servicePath wix-events-frontend.RsvpForm.RsvpData */ getRsvpData(): Promise; /** * **Deprecated:** Submits an RSVP form and adds the new guests to the event's guest list. * * **Deprecation note:** The `submit()` function of the `RsvpForm` object is being deprecated. * Use the [`createRsvp()`](events.Rsvp.html#createRsvp) function of the [`Rsvp`](events.Rsvp.html) * object instead. * * The `submit()` function returns a Promise that resolves to an `RsvpResponse` * when the guests in the specified form values have been added to the event's guest list. * * The list of `FormValue` objects you pass to `submit()` must include * a form value for the `rsvpStatus`. Which statuses you can return depends on the * `rsvpStatusOptions` returned from the [`getRsvpData()`](#getRsvpData) function * as follows: * * + `"YES_AND_NO"`: Send an `rsvpStatus` of `"YES"` or `"NO"`. * + `"YES_ONLY"`: Send an `rsvpStatus` of `"YES"`. * + `"OPEN_RSVP_WAITLIST"`: Send an `rsvpStatus` of `"WAITING"` * to add a guest to the waitlist. * * * When submitting an RSVP form with `rsvpStatus` of `"WAITING"` or `"NO"`, * the list of `FormValue` objects should only contain * items for `"firstName"`, `"lastName"`, `"email"`, and `"rsvpStatus"`. * No other fields should be passed. * * When a form contains an input for adding more guests to an RSVP, format * the guest names for submission in an array where each element is the * full name of a guest. * * When a form contains an address, the way you format the address information * for submission depends on what type of input elements you use to gather that * information as follows: * * + If the address is input using a Wix address input element, no special formatting * is needed. * + If the address is input using another type of input element, such as a text input, * format the input's value in an array. * + If the address is input using a number of input elements, each for a different part * of the address, format the input values as elements in an array. * * > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality. * @param formValues - List of field names and values for an RSVP form. * @requiredField formValues * @servicePath wix-events-frontend.RsvpForm.FormValue * @returns Fulfilled - Information about the RSVP that was created. * Rejected - Error information. * One of: * * + `SubmissionError` * + `FieldValidationError` * + `ValueValidationError` * @servicePath wix-events-frontend.RsvpForm.RsvpResponse */ submit(formValues: FormValue[]): Promise; /** * **Deprecated:** Validates form fields and values against the registration form as defined in the site Dashboard. * * **Deprecation note:** The `validate()` function of the `RsvpForm` object is being deprecated. * Use the [`validate()`](events.Form.html#validate) function of the [`Form`](events.Form.html) * object instead. * * The `validate()` function returns a Promise that resolves to `{valid: true}` * if the fields and values in the RSVP form are valid or rejects if there are * invalid fields or values. * * You can validate your form explicitly using the `validate()` function. Validation * is also implicitly performed when you call the [`submit()`](#submit) function. When * the `validate()` function is called, explicitly or implicitly, the [`validateInput()`](#validateInput) * function also runs for all your form fields. * * The following are invalid when checked against the event's registration form * as defined in the site Dashboard: * * + The specified form values contain a field that does not exist in the event's registration form. * + The specified form values are missing a field that exists in the event's registration form. You * must also include non-required fields even if their values are empty. * * > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality. * @param formValues - Field names and values for an RSVP form. * @requiredField formValues * @servicePath wix-events-frontend.RsvpForm.FormValue * @returns Fulfilled - Validation result when validation passes. * Rejected - `FieldValidationError` when validation fails. * @servicePath wix-events-frontend.RsvpForm.ValidationResult */ validate(formValues: FormValue[]): Promise; /** * **Deprecated:** Validates an input form field value against the registration form as defined in the site Dashboard. * * **Deprecation note:** The `validateInput()` function of the `RsvpForm` object is being deprecated. * Use the [`validateInput()`](events.Form.html#validateInput) function of the [`Form`](events.Form.html) * object instead. * * The `validateInput()` function returns a Promise that resolves to `{valid: true}` * if the value in the specified field is valid or rejects if it is not valid. * * You can validate your form's values explicitly using the `validateInput()` function. * Value validation is also implicitly performed when you call the [`submit()`](#submit) * function or the [`validate()`](#validate) function. * * You may want to call the `validateInput()` function in an input element's * `onCustomValidation()` event * handler to validate an input while the form is being filled out. * * > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality. * @param inputName - Name of the input field to validate. * @requiredField inputName * @param formValues - Field names and values for an RSVP form. * @requiredField formValues * @servicePath wix-events-frontend.RsvpForm.FormValue * @returns Fulfilled - Validation result when validation passes. * Rejected - `ValueValidationError` when validation fails. * @servicePath wix-events-frontend.RsvpForm.ValidationResult */ validateInput(inputName: string, formValues: FormValue[]): Promise; } /** * **Deprecated:** An object containing information about a label for a complex input field type. */ export interface AdditionalLabel { /** * Additional label name. * @requiredField name */ name: string; /** * Additional label value. * @requiredField label */ label: string; } /** * **Deprecated:** An object representing an error that occurred during validation of an RSVP form's fields. */ export interface FieldValidationError { /** * Error message. * @requiredField message */ message: string; /** * List of fields that caused the error when the form does not pass validation. * @requiredField fields */ fields: string[]; } /** * **Deprecated:** An object containing information about form value to submit. */ export interface FormValue { /** * Form field name. * @requiredField name */ name: string; /** * Form field value. * @requiredField value */ value: string; } /** * **Deprecated:** An object representing a guest on an event RSVP. */ export interface Guest { /** * Index of the guest in the RSVP guest list. Indices are zero-based. * @requiredField index */ index: number; /** * Guest ID, which is unique within the RSVP. * @requiredField id */ id: number; /** * Full name of the guest. * @requiredField fullName */ fullName: string; } /** * **Deprecated:** An object representing a submitted RSVP form input value. */ export interface InputValue { /** * Name of the form input. * @requiredField inputName */ inputName: string; /** * Value of the form input, when there is just one value. * @requiredField value */ value: string; /** * Value of the form input, when there are multiple values. * @requiredField values */ values: string[]; } /** * **Deprecated:** An object representing the details needed to create an RSVP form for an event. */ export interface RsvpData { /** * Information about the input fields needed to create an RSVP form. * @requiredField rsvpFormInputs * @servicePath wix-events-frontend.RsvpForm.RsvpInputItem */ rsvpFormInputs: RsvpInputItem[]; /** * Allowed RSVP statuses for an event. * One of: * * + `"YES_AND_NO"`: Guests can RSVP for the event with a "Yes" or "No". * + `"YES_ONLY"`: Guests can only RSVP for the event with a "Yes". * + `"WAITING"`: The guest limit has been reached, but there is an open waitlist. * @requiredField rsvpStatusOptions */ rsvpStatusOptions: string; /** * Event registration status. * One of: * * + `"OPEN_RSVP"`: Registration is open and guest limit has not been reached. * + `"OPEN_RSVP_WAITLIST"`: Registration is open, guest limit has been reached, * and additional registering guests are added to the waitlist. * + `"CLOSED"`: Registration is closed because the guest limit has been reached. * + `"CLOSED_MANUALLY"`: Registration was closed manually. * @requiredField registrationStatus */ registrationStatus: string; } /** * **Deprecated:** An object representing a submitted RSVP form. */ export interface RsvpForm { /** * Values that were entered in the RSVP form. * @requiredField inputValues * @servicePath wix-events-frontend.RsvpForm.InputValue */ inputValues: InputValue[]; } /** * **Deprecated:** An object containing information about an input field in an RSVP form. */ export interface RsvpInputItem { /** * Unique input identifier. * @requiredField _id */ _id: string; /** * Whether the input field's value is an array. * @requiredField array */ array: boolean; /** * Input field display label. * @requiredField label */ label: string; /** * Addition field display labels for complex fields. * @requiredField additionalLabels * @servicePath wix-events-frontend.RsvpForm.AdditionalLabel */ additionalLabels: AdditionalLabel[]; /** * List of value options where applicable. * @requiredField options */ options: string[]; /** * Maximum length of the input field's value. A value of `0` indicates no maximum length. * @requiredField maxLength */ maxLength: number; /** * Input field name. * @requiredField name */ name: string; /** * Whether the input field is required. * @requiredField required */ required: boolean; /** * The type of the input field. * One of: * * + `"NAME"` * + `"INPUT"` * + `"RADIO"` * + `"CHECKBOX"` * + `"DROPDOWN"` * + `"GUEST_CONTROL"` * + `"ADDRESS_FULL"` * + `"TEXTAREA"` * + `"DATE"` * @requiredField controlType */ controlType: string; } /** * **Deprecated:** An object representing a response to submitting an RSVP. */ export interface RsvpResponse { /** * RSVP ID * @requiredField id */ id: string; /** * Indicates whether the guest's personal information has been deleted or not. * @requiredField anonymized */ anonymized: boolean; /** * Contact ID of the guest who submitted the RSVP form. * @requiredField contactId */ contactId: string; /** * Date when the RSVP was submitted. * @requiredField createdDate */ createdDate: Date; /** * Email address to the guest who submitted the RSVP form. * @requiredField email */ email: string; /** * ID of the event the RSVP is for. * @requiredField eventId */ eventId: string; /** * First name of the guest who submitted the RSVP form. * @requiredField firstName */ firstName: string; /** * Last name of the guest who submitted the RSVP form. * @requiredField lastName */ lastName: string; /** * All of the guests included in the RSVP. * @requiredField guests * @servicePath wix-events-frontend.RsvpForm.Guest */ guests: Guest[]; /** * A representation of the RSVP form that was submitted. * @requiredField rsvpForm * @servicePath wix-events-frontend.RsvpForm.RsvpForm */ rsvpForm: RsvpForm; /** * Member ID of the guest who submitted the RSVP form if the guest is a site member. * @requiredField memberId */ memberId: string; /** * Date when RSVP was last modified. * @requiredField updatedDate */ updatedDate: Date; /** * RSVP status. * @requiredField status */ status: string; /** * Total number of guests included in the RSVP. * @requiredField totalGuests */ totalGuests: number; } /** * **Deprecated:** An object representing an error that occurred during an RSVP form submission. */ export interface SubmissionError { /** * Error message. * @requiredField message */ message: string; /** * Error type. * One of: * * + `"RSVP_CLOSED"`: Event registration is closed. * + `"GUEST_LIMIT_REACHED"`: The maximum number of guests has already been reached. * + `"MEMBER_ALREADY_REGISTERED"`: The current registrant is already registered as a guest. * + `"WAITING_LIST_UNAVAILABLE"`: The maximum number of guests has already been reached and * there is no waitlist. * + `"UNKNOWN_ERROR"`: Unknown error. * @requiredField errorType */ errorType: string; } /** * **Deprecated:** An object representing the result of a form validation. */ export interface ValidationResult { /** * Indicates that the RSVP form fields are valid. * @requiredField valid */ valid: boolean; } /** * **Deprecated:** An object representing an error that occurred during validation of an RSVP form's values. */ export interface ValueValidationError { /** * Error message. * @requiredField message */ message: string; /** * ID of the input field that failed validation. * @requiredField inputId */ inputId: string; /** * Error type. * One of: * * + `"EMPTY_INPUT"`: A required field is missing its value. * + `"INVALID_INPUT_VALUE"`: The value is not valid for the field type. * + `"INPUT_TOO_LONG"`: The value is too long. * + `"INVALID_OPTION"`: The value does not match one of the defined options for the field. * + `"INVALID_STATUS"`: The status value is not valid. * + `"INVALID_NUMBER_OF_GUESTS"`: The number of guests does not match the number defined for the form. * @requiredField errorType */ errorType: string; } /** * **Deprecated:** Gets information about the event's RSVP form and status. * * **Deprecation note:** The `getRsvpData` function of the `RsvpForm` object is being * deprecated. Use the [`formData`](events.Form.html#formData) property of * the [`Form`](events.Form.html) object instead. * * The `getRsvpData()` function returns a Promise that resolves to an * `RsvpData` object containing all the information you need to create * a custom RSVP form for the specified event. * * This information includes: * * + The event's registration status, such as whether registration is * open, closed, or guests will be placed on a waitlist. * + Which statuses guests can RSVP with, such as yes, no, or to be added * to the waitlist. * + Information about the RSVP form's fields, such as their names, * descriptive labels, and whether they are required. * * > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality. * * @returns Fulfilled - Information about the RSVP form's input fields and status options. * @servicePath wix-events-frontend.RsvpForm.RsvpData */ export function getRsvpData(): Promise; /** * **Deprecated:** Submits an RSVP form and adds the new guests to the event's guest list. * * **Deprecation note:** The `submit()` function of the `RsvpForm` object is being deprecated. * Use the [`createRsvp()`](events.Rsvp.html#createRsvp) function of the [`Rsvp`](events.Rsvp.html) * object instead. * * The `submit()` function returns a Promise that resolves to an `RsvpResponse` * when the guests in the specified form values have been added to the event's guest list. * * The list of `FormValue` objects you pass to `submit()` must include * a form value for the `rsvpStatus`. Which statuses you can return depends on the * `rsvpStatusOptions` returned from the [`getRsvpData()`](#getRsvpData) function * as follows: * * + `"YES_AND_NO"`: Send an `rsvpStatus` of `"YES"` or `"NO"`. * + `"YES_ONLY"`: Send an `rsvpStatus` of `"YES"`. * + `"OPEN_RSVP_WAITLIST"`: Send an `rsvpStatus` of `"WAITING"` * to add a guest to the waitlist. * * * When submitting an RSVP form with `rsvpStatus` of `"WAITING"` or `"NO"`, * the list of `FormValue` objects should only contain * items for `"firstName"`, `"lastName"`, `"email"`, and `"rsvpStatus"`. * No other fields should be passed. * * When a form contains an input for adding more guests to an RSVP, format * the guest names for submission in an array where each element is the * full name of a guest. * * When a form contains an address, the way you format the address information * for submission depends on what type of input elements you use to gather that * information as follows: * * + If the address is input using a Wix address input element, no special formatting * is needed. * + If the address is input using another type of input element, such as a text input, * format the input's value in an array. * + If the address is input using a number of input elements, each for a different part * of the address, format the input values as elements in an array. * * > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality. * @param formValues - List of field names and values for an RSVP form. * @requiredField formValues * @servicePath wix-events-frontend.RsvpForm.FormValue * @returns Fulfilled - Information about the RSVP that was created. * Rejected - Error information. * One of: * * + `SubmissionError` * + `FieldValidationError` * + `ValueValidationError` * @servicePath wix-events-frontend.RsvpForm.RsvpResponse */ export function submit(formValues: FormValue[]): Promise; /** * **Deprecated:** Validates form fields and values against the registration form as defined in the site Dashboard. * * **Deprecation note:** The `validate()` function of the `RsvpForm` object is being deprecated. * Use the [`validate()`](events.Form.html#validate) function of the [`Form`](events.Form.html) * object instead. * * The `validate()` function returns a Promise that resolves to `{valid: true}` * if the fields and values in the RSVP form are valid or rejects if there are * invalid fields or values. * * You can validate your form explicitly using the `validate()` function. Validation * is also implicitly performed when you call the [`submit()`](#submit) function. When * the `validate()` function is called, explicitly or implicitly, the [`validateInput()`](#validateInput) * function also runs for all your form fields. * * The following are invalid when checked against the event's registration form * as defined in the site Dashboard: * * + The specified form values contain a field that does not exist in the event's registration form. * + The specified form values are missing a field that exists in the event's registration form. You * must also include non-required fields even if their values are empty. * * > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality. * @param formValues - Field names and values for an RSVP form. * @requiredField formValues * @servicePath wix-events-frontend.RsvpForm.FormValue * @returns Fulfilled - Validation result when validation passes. * Rejected - `FieldValidationError` when validation fails. * @servicePath wix-events-frontend.RsvpForm.ValidationResult */ export function validate(formValues: FormValue[]): Promise; /** * **Deprecated:** Validates an input form field value against the registration form as defined in the site Dashboard. * * **Deprecation note:** The `validateInput()` function of the `RsvpForm` object is being deprecated. * Use the [`validateInput()`](events.Form.html#validateInput) function of the [`Form`](events.Form.html) * object instead. * * The `validateInput()` function returns a Promise that resolves to `{valid: true}` * if the value in the specified field is valid or rejects if it is not valid. * * You can validate your form's values explicitly using the `validateInput()` function. * Value validation is also implicitly performed when you call the [`submit()`](#submit) * function or the [`validate()`](#validate) function. * * You may want to call the `validateInput()` function in an input element's * `onCustomValidation()` event * handler to validate an input while the form is being filled out. * * > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality. * @param inputName - Name of the input field to validate. * @requiredField inputName * @param formValues - Field names and values for an RSVP form. * @requiredField formValues * @servicePath wix-events-frontend.RsvpForm.FormValue * @returns Fulfilled - Validation result when validation passes. * Rejected - `ValueValidationError` when validation fails. * @servicePath wix-events-frontend.RsvpForm.ValidationResult */ export function validateInput(inputName: string, formValues: FormValue[]): Promise;