/** * An object containing RSVP functionality. * * Use the RSVP API to create custom RSVP experiences for your events. * * You need to have at least one existing event before getting started. * * ### Typical Custom RSVP 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. Get the event `Form` by calling `getForm()` ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/events/get-form) | [Velo](https://dev.wix.com/docs/velo/apis/wix-events-frontend/get-form)) with the ID retrieved above. * 1. Retrieve information about the form inputs in the form with `formData()`. * 1. In the editor, add user input elements for each form input retrieved above. * You may want to set the elements IDs to match the names of form inputs retrieved above * so that you won't have to map the names later. * 1. In the editor, add a button that will be used to create a new RSVP using the form values * that a site visitor enters. * 1. When the create button is clicked, gather the values entered into the form in * a `FormValue` array and use `createRsvp()` to create an RSVP using the form values. */ export interface Rsvp { /** * **Deprecated.** * This method will be deprecated on March 30, 2026. Replace with [createRsvp()](https://dev.wix.com/docs/sdk/backend-modules/events/rsvp-v2/create-rsvp). * * > **Migration Instructions** * > * > To stay compatible with future changes, migrate to * > [`createRsvp()`](https://dev.wix.com/docs/sdk/backend-modules/events/rsvp-v2/create-rsvp). * > * > To migrate to the new method: * > * > 1. Add a backend file to your site. * > * > 2. Write a code so that it replaces the `createRsvp()` method from the frontend with the `createRsvp()` method from the backend. Export your backend function so that it can be used in the frontend. * > * > 3. Import your backend function into the frontend file. Test your changes to make sure your code behaves as expected. * * The list of `FormValue` objects you pass to * `createRsvp()` must include a form value for the `rsvpStatus`. Which statuses * you can return depends on the `rsvpStatusOptions` returned from the * `FormData` object 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 wait list. * * * When creating an RSVP 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 creating an RSVP that adds additional guests, format * the guest names for submission in an array where each element is the * full name of a guest. * * When creating an RSVP that 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 eventId - ID of the event to create an RSVP for. * @requiredField eventId * @param formValues - List of field names and values for an RSVP form. * @requiredField formValues * @servicePath wix-events-frontend.Rsvp.FormValue * @returns Fulfilled - Information about the RSVP that was created. * Rejected - Error information. * One of: * * + `CreationError` * + `FieldValidationError` * + `ValueValidationError` * @servicePath wix-events-frontend.Rsvp.RsvpResponse */ createRsvp(eventId: string, formValues: FormValue[]): Promise; } /** * An object representing an error that occurred during an RSVP creation. */ export interface CreationError { /** * 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 wait list. * + `"UNKNOWN_ERROR"`: Unknown error. * @requiredField errorType */ errorType: string; } /** * An object containing information about form values. */ export interface FormValue { /** * Form field name. * @requiredField name */ name: string; /** * Form field value. * @requiredField value */ value: string; } /** * 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; } /** * An object representing an RSVP input value. */ export interface InputValue { /** * Name of the input. * @requiredField inputName */ inputName: string; /** * Value of the input, when there is just 1 value. * @requiredField value */ value: string; /** * Value of the input, when there are multiple values. * @requiredField values */ values: string[]; } /** * An object representing an RSVP form. */ export interface RsvpForm { /** * Values that were entered in the RSVP form. * @requiredField inputValues * @servicePath wix-events-frontend.Rsvp.InputValue */ inputValues: InputValue[]; } /** * An object representing a response to creating an RSVP. */ export interface RsvpResponse { /** * RSVP ID * @requiredField id */ id: string; /** * Whether the guest's personal information has been removed. * @requiredField anonymized */ anonymized: boolean; /** * Contact ID of the guest who created the RSVP. * @requiredField contactId */ contactId: string; /** * Date when the RSVP was created. * @requiredField createdDate */ createdDate: Date; /** * Email address to the guest who created the RSVP. * @requiredField email */ email: string; /** * ID of the event the RSVP is for. * @requiredField eventId */ eventId: string; /** * First name of the guest who created the RSVP. * @requiredField firstName */ firstName: string; /** * Last name of the guest who created the RSVP. * @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 created. * @requiredField rsvpForm * @servicePath wix-events-frontend.RsvpForm.RsvpForm */ rsvpForm: RsvpForm; /** * Member ID of the guest who created 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.** * This method will be deprecated on March 30, 2026. Replace with [createRsvp()](https://dev.wix.com/docs/sdk/backend-modules/events/rsvp-v2/create-rsvp). * * > **Migration Instructions** * > * > To stay compatible with future changes, migrate to * > [`createRsvp()`](https://dev.wix.com/docs/sdk/backend-modules/events/rsvp-v2/create-rsvp). * > * > To migrate to the new method: * > * > 1. Add a backend file to your site. * > * > 2. Write a code so that it replaces the `createRsvp()` method from the frontend with the `createRsvp()` method from the backend. Export your backend function so that it can be used in the frontend. * > * > 3. Import your backend function into the frontend file. Test your changes to make sure your code behaves as expected. * * The list of `FormValue` objects you pass to * `createRsvp()` must include a form value for the `rsvpStatus`. Which statuses * you can return depends on the `rsvpStatusOptions` returned from the * `FormData` object 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 wait list. * * * When creating an RSVP 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 creating an RSVP that adds additional guests, format * the guest names for submission in an array where each element is the * full name of a guest. * * When creating an RSVP that 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 eventId - ID of the event to create an RSVP for. * @requiredField eventId * @param formValues - List of field names and values for an RSVP form. * @requiredField formValues * @servicePath wix-events-frontend.Rsvp.FormValue * @returns Fulfilled - Information about the RSVP that was created. * Rejected - Error information. * One of: * * + `CreationError` * + `FieldValidationError` * + `ValueValidationError` * @servicePath wix-events-frontend.Rsvp.RsvpResponse */ export function createRsvp(eventId: string, formValues: FormValue[]): Promise;