/** Extended field that was found or created. */ export interface ExtendedField { /** * Extended field namespace. * * Extended fields created through by calling the Find Or Create Extended Field method * are automatically assigned to the `custom` namespace. * @readonly */ namespace?: string | null; /** * Extended field key. * * When accessing contact data, * extended field data is available at `extendedFields[key]`. * For example, if the key is "custom.notes", * the value can be accessed at `extendedFields["custom.notes"]`. * * `key` is generated when the extended field is created * and can't be modified, even if `displayName` changes. * @readonly */ key?: string; /** Display name shown in the contact list. */ displayName?: string; /** * Type of data the field holds. * @readonly */ dataType?: FieldDataType; /** * Indicates whether the extended field is a system field or custom field. * @readonly */ fieldType?: FieldType; /** * Date and time the field was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the field was last updated. * @readonly */ _updatedDate?: Date | null; /** * Field description, if the field is a system field. * @readonly */ description?: string | null; } export declare enum FieldDataType { /** Accepts strings. */ TEXT = "TEXT", /** Accepts floats. */ NUMBER = "NUMBER", /** Accepts dates formatted as `YYYY-MM-DD`. */ DATE = "DATE", /** Accepts strings. Prepends `https://` if no protocol is included. */ URL = "URL" } export declare enum FieldType { /** Field is a system field managed by Wix. System fields can't be modified by calling the Update Extended Field method. */ SYSTEM = "SYSTEM", /** Field is a custom field and can be modified by calling the Update Extended Field method. */ USER_DEFINED = "USER_DEFINED" } /** Extended field filter options. */ export interface ListExtendedFieldsRequest { /** Filter for fields of the specified type. */ fieldType?: FieldType; /** * Filter for fields in the specified namespace. * Fields created by calling the Find Or Create Extended Field method * are automatically assigned to the `custom` namespace. */ namespace?: string | null; /** Filter for fields where `displayName` starts with the specified case-sensitive string. */ startsWith?: string | null; /** Sorting options. */ sort?: Sorting; /** Paging options. */ paging?: Paging; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** * Sort order. * * Default: `ASC`. */ order?: SortOrder; } export declare enum SortOrder { /** Sort by ascending order. */ ASC = "ASC", /** Sort by descending order. */ DESC = "DESC" } export interface Paging { /** * Number of items to return. * * Defaults to `100`. */ limit?: number | null; /** * Number of items to skip in the current sort order. * * Defaults to `0`. */ offset?: number | null; } /** List of extended fields. */ export interface ListExtendedFieldsResponse { /** List of extended fields. */ fields?: ExtendedField[]; /** Metadata for the page of results. */ metadata?: PagingMetadata; } export interface PagingMetadata { /** Number of items returned. */ count?: number | null; /** Requested offset. */ offset?: number | null; /** Number of items that matched the query. */ total?: number | null; /** * Indicates if `total` calculation timed out before the response was sent. * Typically this happens if there is a large set of results. */ tooManyToCount?: boolean | null; } /** Custom field to find or create. */ export interface FindOrCreateExtendedFieldRequest { /** * Display name to retrieve or create. * * If an existing custom field is an exact match * for the specified display name, * the existing field is returned. * If not, a new field is created and returned. */ displayName: string; /** * Type of data the field holds. * Ignored if an existing field is an exact match * for the specified display name. */ dataType?: FieldDataType; } /** Extended field that was found or created. */ export interface FindOrCreateExtendedFieldResponse { /** Extended field that was found or created. */ field?: ExtendedField; /** * Indicates whether the extended field was just created or already existed. * * Returns `true` if the field was just created. */ newField?: boolean; } export interface GetExtendedFieldRequest { /** * Extended field key. * * When accessing contact data, * extended field values are available at `info.extendedFields.items[key]`. * For example, if the key is "custom.patronus", * the value can be accessed at `info.extendedFields.items["custom.patronus"]`. * * `key` is generated when the extended field is created. * It can't be modified, even if `displayName` is updated. */ key: string; } /** The specified field. */ export interface GetExtendedFieldResponse { /** The specified field. */ field?: ExtendedField; } export interface GetExtendedFieldByLegacyIdRequest { /** Legacy ID of the extended field. */ legacyId?: string; } export interface GetExtendedFieldByLegacyIdResponse { /** The requested extended field. */ field?: ExtendedField; } export interface UpdateExtendedFieldRequest { /** Extended field to rename. */ field?: ExtendedField; } /** Updated extended field. */ export interface UpdateExtendedFieldResponse { /** Renamed extended field. */ field?: ExtendedField; } export interface DeleteExtendedFieldRequest { /** Extended field key. */ key: string; } export interface DeleteExtendedFieldResponse { } export interface PurgeRequest { /** Instance ID of the site. */ instanceId?: string; } export interface PurgeResponse { /** Number of items deleted. */ deletedItems?: number; } export interface GdprListRequest { /** Instance ID of the site. */ instanceId?: string; } export interface GdprListResponse { /** List of extended fields. */ fields?: ExtendedField[]; } export interface QueryExtendedFieldsRequest { /** Query options. */ query?: Query; } export interface Query { /** * ilter object. * * Possible filters: `$eq`, `$gt`, `$gte`, `$in`, `$lt`, `$lte`, `$ne`, `$startsWith`. * * For a detailed list of supported filters, see [sorting and filtering for extended fields](https://dev.wix.com/api/rest/contacts/extended-fields/sort-and-filter). * * Example: `{ "filter": { * "displayName": { * "$startsWith": "Referral" * } * } * }` */ filter?: Record | null; /** * Sorting options. Currently supports sorting on one field only. * * Example: `{ "sort": [{"fieldName": "displayName", "order": "DESC"}] }` */ sort?: Sorting[]; /** Pagination options. */ paging?: Paging; } export interface QueryExtendedFieldsResponse { /** List of extended fields. */ fields?: ExtendedField[]; /** Details on the paged set of results returned. */ pagingMetadata?: PagingMetadata; } export interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ _id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * Example: created/updated/deleted/started/completed/email_opened */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } /** @oneof */ export interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } export interface EntityCreatedEvent { entity?: string; } export interface RestoreInfo { deletedDate?: Date | null; } export interface EntityUpdatedEvent { /** * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff. * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects. * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it. */ currentEntity?: string; } export interface EntityDeletedEvent { /** Entity that was deleted */ deletedEntity?: string | null; } export interface ActionEvent { body?: string; } export interface MessageEnvelope { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; } export interface IdentificationData extends IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; /** @readonly */ identityType?: WebhookIdentityType; } /** @oneof */ export interface IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; } export declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } export interface ExtendedFieldNonNullableFields { key: string; displayName: string; dataType: FieldDataType; fieldType: FieldType; } export interface FindOrCreateExtendedFieldResponseNonNullableFields { field?: ExtendedFieldNonNullableFields; newField: boolean; } export interface GetExtendedFieldResponseNonNullableFields { field?: ExtendedFieldNonNullableFields; } export interface UpdateExtendedFieldResponseNonNullableFields { field?: ExtendedFieldNonNullableFields; } export interface QueryExtendedFieldsResponseNonNullableFields { fields: ExtendedFieldNonNullableFields[]; } export interface BaseEventMetadata { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; } export interface EventMetadata extends BaseEventMetadata { /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ _id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * Example: created/updated/deleted/started/completed/email_opened */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } export interface ExtendedFieldCreatedEnvelope { entity: ExtendedField; metadata: EventMetadata; } /** * Triggered when an extended field is created. * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Contact Extended Fields * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionId CONTACTS_SCHEMA.VIEW * @webhook * @eventType wix.contacts.v4.extended-field_created */ export declare function onExtendedFieldCreated(handler: (event: ExtendedFieldCreatedEnvelope) => void | Promise): void; export interface ExtendedFieldDeletedEnvelope { metadata: EventMetadata; } /** * Triggered when an extended field is deleted. * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Contact Extended Fields * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionId CONTACTS_SCHEMA.VIEW * @webhook * @eventType wix.contacts.v4.extended-field_deleted */ export declare function onExtendedFieldDeleted(handler: (event: ExtendedFieldDeletedEnvelope) => void | Promise): void; export interface ExtendedFieldUpdatedEnvelope { entity: ExtendedField; metadata: EventMetadata; } /** * Triggered when an extended field is updated. * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Contact Extended Fields * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionId CONTACTS_SCHEMA.VIEW * @webhook * @eventType wix.contacts.v4.extended-field_updated */ export declare function onExtendedFieldUpdated(handler: (event: ExtendedFieldUpdatedEnvelope) => void | Promise): void; /** * Retrieves a custom field with a specified name, or creates one if it doesn't exist. * The number of custom fields is limited to 100. * * Successful calls to this method always return a field, * which can be specified in subsequent calls. * * To find an existing custom field without potentially creating a new one, call Get Extended Field or * Query Extended Fields. * @param displayName - Display name to retrieve or create. * * If an existing custom field is an exact match * for the specified display name, * the existing field is returned. * If not, a new field is created and returned. * @param dataType - Type of data the field holds. * Ignored if an existing field is an exact match * for the specified display name. * @public * @requiredField dataType * @requiredField displayName * @permissionId CONTACTS_SCHEMA.MODIFY * @permissionScope Manage Contact Extended Fields * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @applicableIdentity APP * @returns Extended field that was found or created. * @fqn com.wixpress.contacts.fields.v4.ContactExtendedFieldsServiceV4.FindOrCreateExtendedField */ export declare function findOrCreateExtendedField(displayName: string, dataType: FieldDataType): Promise; /** * Retrieves an extended field by the specified extended field key. * @public * @requiredField key * @param key - null * @permissionId CONTACTS_SCHEMA.VIEW * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Contact Extended Fields * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @applicableIdentity APP * @returns The specified field. * @fqn com.wixpress.contacts.fields.v4.ContactExtendedFieldsServiceV4.GetExtendedField */ export declare function getExtendedField(key: string): Promise; /** * Renames an extended field. * @public * @requiredField field * @requiredField field.displayName * @requiredField key * @param key - null * @param field - null * @permissionId CONTACTS_SCHEMA.MODIFY * @permissionScope Manage Contact Extended Fields * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @applicableIdentity APP * @returns Renamed extended field. * @fqn com.wixpress.contacts.fields.v4.ContactExtendedFieldsServiceV4.UpdateExtendedField */ export declare function renameExtendedField(key: string, field: RenameExtendedField): Promise; export interface RenameExtendedField { /** * Extended field namespace. * * Extended fields created through by calling the Find Or Create Extended Field method * are automatically assigned to the `custom` namespace. * @readonly */ namespace?: string | null; /** Display name shown in the contact list. */ displayName?: string; /** * Type of data the field holds. * @readonly */ dataType?: FieldDataType; /** * Indicates whether the extended field is a system field or custom field. * @readonly */ fieldType?: FieldType; /** * Date and time the field was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the field was last updated. * @readonly */ _updatedDate?: Date | null; /** * Field description, if the field is a system field. * @readonly */ description?: string | null; } /** * Deletes an extended field. * * When an extended field is deleted, * any contact data stored in the field is also permanently deleted. * @param key - Extended field key. * @public * @requiredField key * @permissionId CONTACTS_SCHEMA.MODIFY * @permissionScope Manage Contact Extended Fields * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @applicableIdentity APP * @fqn com.wixpress.contacts.fields.v4.ContactExtendedFieldsServiceV4.DeleteExtendedField */ export declare function deleteExtendedField(key: string): Promise; /** * Creates a query to retrieve a list of extended fields. * * The `queryExtendedFields()` method builds a query to retrieve a list of extended fields and returns an `FieldsQueryBuilder` object. * * The returned object contains the query definition, which is used to run the query using the `find()` method. * * You can refine the query by chaining `FieldsQueryBuilder` methods onto the query. `FieldsQueryBuilder` methods enable you to filter, sort, and control the results that `queryExtendedFields()` returns. * * `queryExtendedFields()` runs with these `FieldsQueryBuilder` defaults, which you can override: * - `skip()` * - `limit(50)` * - `descending('_createdDate')` * * The following `FieldsQueryBuilder` methods are supported for `queryExtendedFields()`. For a full description of the `Extended Field` object, see the object returned for the `items` property in `FieldsQueryResult`. * @public * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Contact Extended Fields * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-EX-FIELDS * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionId CONTACTS_SCHEMA.VIEW * @applicableIdentity APP * @fqn com.wixpress.contacts.fields.v4.ContactExtendedFieldsServiceV4.QueryExtendedFields */ export declare function queryExtendedFields(): FieldsQueryBuilder; interface QueryOffsetResult { currentPage: number | undefined; totalPages: number | undefined; totalCount: number | undefined; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } export interface FieldsQueryResult extends QueryOffsetResult { items: ExtendedField[]; query: FieldsQueryBuilder; next: () => Promise; prev: () => Promise; } export interface FieldsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ eq: (propertyName: 'namespace' | 'key' | 'displayName' | 'dataType' | 'fieldType' | '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ne: (propertyName: 'namespace' | 'key' | 'displayName' | 'dataType' | '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. */ startsWith: (propertyName: 'displayName', value: string) => FieldsQueryBuilder; in: (propertyName: 'key' | 'displayName', value: any) => FieldsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ ascending: (...propertyNames: Array<'displayName' | '_createdDate' | '_updatedDate'>) => FieldsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ descending: (...propertyNames: Array<'displayName' | '_createdDate' | '_updatedDate'>) => FieldsQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */ limit: (limit: number) => FieldsQueryBuilder; /** @param skip - Number of items to skip in the query results before returning the results. */ skip: (skip: number) => FieldsQueryBuilder; find: () => Promise; } export {};