export interface ReferredFriend { /** * ID of the referred friend. * @readonly */ _id?: string; /** * Contact ID of the referred friend. * @readonly */ contactId?: string; /** * ID of the customer who referred this friend. * @readonly */ referringCustomerId?: string; /** Status of the referred friend. */ status?: Status; /** * Revision number, which increments by 1 each time the referred friend is updated. * To prevent conflicting changes, the current revision must be passed when updating the referred friend. * @readonly */ revision?: string | null; /** * Date and time the referred friend was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the referred friend was last updated. * @readonly */ _updatedDate?: Date | null; } export declare enum Status { /** Unknown status. */ UNKNOWN = "UNKNOWN", /** Initial status when the referred friend joins the site as a member. */ SIGN_UP_COMPLETED = "SIGN_UP_COMPLETED", /** Status after the referred friend completes a specific action, such as making a purchase. */ ACTIONS_COMPLETED = "ACTIONS_COMPLETED" } export interface CreateReferredFriendRequest { /** Referral code for the referred friend. */ referralCode?: string | null; } export interface CreateReferredFriendResponse { /** Created referred friend. */ referredFriend?: ReferredFriend; } export interface GetReferredFriendRequest { /** ID of the referred friend to retrieve. */ referredFriendId: string; } export interface GetReferredFriendResponse { /** Retrieved referred friend. */ referredFriend?: ReferredFriend; } export interface GetReferredFriendByContactIdRequest { /** Contact ID or "me" to get the current identity's contact. */ contactId: string; } export interface GetReferredFriendByContactIdResponse { /** Retrieved referred friend. */ referredFriend?: ReferredFriend; } export interface UpdateReferredFriendRequest { /** Referred friend to be updated. May be partial. */ referredFriend: ReferredFriend; } export interface UpdateReferredFriendResponse { /** Updated referred friend. */ referredFriend?: ReferredFriend; } export interface DeleteReferredFriendRequest { /** ID of the referred friend to delete. */ referredFriendId: string; /** * Revision number, which increments by 1 each time the referred friend is updated. * To prevent conflicting changes, the current revision must be passed when deleting the referred friend. */ revision?: string; } export interface DeleteReferredFriendResponse { } export interface QueryReferredFriendRequest { /** Query options. */ query: CursorQuery; } export interface CursorQuery extends CursorQueryPagingMethodOneOf { /** * Cursor paging options. * * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging). */ cursorPaging?: CursorPaging; /** * Filter object. * * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section). */ filter?: Record | null; /** * Sort object. * * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section). */ sort?: Sorting[]; } /** @oneof */ export interface CursorQueryPagingMethodOneOf { /** * Cursor paging options. * * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging). */ cursorPaging?: CursorPaging; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrder; } export declare enum SortOrder { ASC = "ASC", DESC = "DESC" } export interface CursorPaging { /** Maximum number of items to return in the results. */ limit?: number | null; /** * Pointer to the next or previous page in the list of results. * * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. * Not relevant for the first request. */ cursor?: string | null; } export interface QueryReferredFriendResponse { /** Retrieved referred friends. */ referredFriends?: ReferredFriend[]; /** Cursor paging metadata. */ metadata?: CursorPagingMetadata; } export interface CursorPagingMetadata { /** Number of items returned in current page. */ count?: number | null; /** Cursor strings that point to the next page, previous page, or both. */ cursors?: Cursors; /** * Whether there are more pages to retrieve following the current page. * * + `true`: Another page of results can be retrieved. * + `false`: This is the last page. */ hasNext?: boolean | null; } export interface Cursors { /** Cursor string pointing to the next page in the list of results. */ next?: string | null; /** Cursor pointing to the previous page in the list of results. */ prev?: string | null; } 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 Empty { } export interface SuccessfulReferralEvent { /** Details of the referred friend who completed their referral. */ referredFriendDetails?: ReferredFriendDetails; } export interface ReferredFriendDetails { /** * ID of the referred friend. * @readonly */ referredFriendId?: string; /** * Contact ID of the referred friend. * @readonly */ contactId?: string; /** * ID of the customer who referred this friend. * @readonly */ referringCustomerId?: 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 ReferredFriendNonNullableFields { _id: string; contactId: string; referringCustomerId: string; status: Status; } export interface CreateReferredFriendResponseNonNullableFields { referredFriend?: ReferredFriendNonNullableFields; } export interface GetReferredFriendResponseNonNullableFields { referredFriend?: ReferredFriendNonNullableFields; } export interface GetReferredFriendByContactIdResponseNonNullableFields { referredFriend?: ReferredFriendNonNullableFields; } export interface UpdateReferredFriendResponseNonNullableFields { referredFriend?: ReferredFriendNonNullableFields; } export interface QueryReferredFriendResponseNonNullableFields { referredFriends: ReferredFriendNonNullableFields[]; } 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 ReferredFriendCreatedEnvelope { entity: ReferredFriend; metadata: EventMetadata; } /** * Triggered when a referred friend is created. * @permissionId REFERRALS.READ_REFERRED_FRIENDS * @webhook * @eventType wix.loyalty.referral.v1.referred_friend_created */ export declare function onReferredFriendCreated(handler: (event: ReferredFriendCreatedEnvelope) => void | Promise): void; export interface ReferredFriendDeletedEnvelope { metadata: EventMetadata; } /** * Triggered when a referred friend is deleted. * @permissionId REFERRALS.MANAGE_REFERRED_FRIENDS * @webhook * @eventType wix.loyalty.referral.v1.referred_friend_deleted */ export declare function onReferredFriendDeleted(handler: (event: ReferredFriendDeletedEnvelope) => void | Promise): void; export interface ReferredFriendUpdatedEnvelope { entity: ReferredFriend; metadata: EventMetadata; } /** * Triggered when a referred friend is updated. * @permissionId REFERRALS.MANAGE_REFERRED_FRIENDS * @webhook * @eventType wix.loyalty.referral.v1.referred_friend_updated */ export declare function onReferredFriendUpdated(handler: (event: ReferredFriendUpdatedEnvelope) => void | Promise): void; /** * Creates a new referred friend or returns an existing entity if it already exists. * * This method must be called with a [member identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities#site-members). * * A referral code must be provided either in the request or via scope. * * The member must be eligible to become a referred friend. * @public * @permissionId REFERRALS.CREATE_OWN_REFERRED_FRIEND * @applicableIdentity MEMBER * @fqn wix.loyalty.referral.friend.v1.ReferredFriends.CreateReferredFriend */ export declare function createReferredFriend(options?: CreateReferredFriendOptions): Promise; export interface CreateReferredFriendOptions { /** Referral code for the referred friend. */ referralCode?: string | null; } /** * Retrieves a referred friend by ID. * @param referredFriendId - ID of the referred friend to retrieve. * @public * @requiredField referredFriendId * @permissionId REFERRALS.READ_REFERRED_FRIENDS * @returns Retrieved referred friend. * @fqn wix.loyalty.referral.friend.v1.ReferredFriends.GetReferredFriend */ export declare function getReferredFriend(referredFriendId: string): Promise; /** * Retrieves a referred friend by contact ID. * * You can use `me` instead of a specific contact ID to get the referred friend for the current identity's contact. * @param contactId - Contact ID or "me" to get the current identity's contact. * @public * @requiredField contactId * @permissionId REFERRALS.READ_REFERRED_FRIENDS * @fqn wix.loyalty.referral.friend.v1.ReferredFriends.GetReferredFriendByContactId */ export declare function getReferredFriendByContactId(contactId: string): Promise; /** * Updates a referred friend. Supports partial updates. * * You must pass the latest `revision` for a successful update. * @param _id - ID of the referred friend. * @public * @requiredField _id * @requiredField referredFriend * @requiredField referredFriend.contactId * @requiredField referredFriend.referringCustomerId * @requiredField referredFriend.revision * @permissionId REFERRALS.MANAGE_REFERRED_FRIENDS * @returns Updated referred friend. * @fqn wix.loyalty.referral.friend.v1.ReferredFriends.UpdateReferredFriend */ export declare function updateReferredFriend(_id: string, referredFriend: UpdateReferredFriend): Promise; export interface UpdateReferredFriend { /** * ID of the referred friend. * @readonly */ _id?: string; /** * Contact ID of the referred friend. * @readonly */ contactId?: string; /** * ID of the customer who referred this friend. * @readonly */ referringCustomerId?: string; /** Status of the referred friend. */ status?: Status; /** * Revision number, which increments by 1 each time the referred friend is updated. * To prevent conflicting changes, the current revision must be passed when updating the referred friend. * @readonly */ revision?: string | null; /** * Date and time the referred friend was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the referred friend was last updated. * @readonly */ _updatedDate?: Date | null; } /** * Deletes a referred friend. * @param referredFriendId - ID of the referred friend to delete. * @public * @requiredField referredFriendId * @permissionId REFERRALS.MANAGE_REFERRED_FRIENDS * @fqn wix.loyalty.referral.friend.v1.ReferredFriends.DeleteReferredFriend */ export declare function deleteReferredFriend(referredFriendId: string, options?: DeleteReferredFriendOptions): Promise; export interface DeleteReferredFriendOptions { /** * Revision number, which increments by 1 each time the referred friend is updated. * To prevent conflicting changes, the current revision must be passed when deleting the referred friend. */ revision?: string; } /** * Creates a query to retrieve a list of referred friends. * * The `queryReferredFriend()` function builds a query to retrieve a list of events and returns a `ReferredFriendsQueryBuilder` object. * * The returned object contains the query definition, which is typically used to run the query using the `find()` function. * * You can refine the query by chaining `ReferredFriendsQueryBuilder` functions onto the query. `ReferredFriendsQueryBuilder` functions enable you to sort, filter, and control the results `queryReferredFriend()` returns. * * `queryReferredFriend()` runs with these `ReferredFriendQueryBuilder` defaults, which you can override: * * - `limit(50)` * - `descending("_createdDate")` * * The functions that are chained to `queryReferredFriend()` are applied in the order they're called. For example, if you apply ascending('status') and then descending('referringCustomerId'), the results are sorted first by the status, and then, if there are multiple results with the same status, the items are sorted by referring customer ID. * @public * @permissionId REFERRALS.READ_REFERRED_FRIENDS * @fqn wix.loyalty.referral.friend.v1.ReferredFriends.QueryReferredFriend */ export declare function queryReferredFriend(): ReferredFriendsQueryBuilder; interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } export interface ReferredFriendsQueryResult extends QueryCursorResult { items: ReferredFriend[]; query: ReferredFriendsQueryBuilder; next: () => Promise; prev: () => Promise; } export interface ReferredFriendsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ eq: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ne: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. */ startsWith: (propertyName: 'referringCustomerId', value: string) => ReferredFriendsQueryBuilder; /** @param propertyName - Property whose value is compared with `values`. * @param values - List of values to compare against. */ hasSome: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any[]) => ReferredFriendsQueryBuilder; in: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder; exists: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: boolean) => ReferredFriendsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ ascending: (...propertyNames: Array<'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate'>) => ReferredFriendsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ descending: (...propertyNames: Array<'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate'>) => ReferredFriendsQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */ limit: (limit: number) => ReferredFriendsQueryBuilder; /** @param cursor - A pointer to specific record */ skipTo: (cursor: string) => ReferredFriendsQueryBuilder; find: () => Promise; } export {};