export interface ActivityCounter { /** Member ID. */ memberId?: string; /** * App ID. * When developing websites, if you set activity counter data using elevation, the action is assigned to the generic Wix code backend app: `151e476a-715e-ec33-db9a-a7ff4d51f70a`. */ appId?: string; /** Counters for this member. */ counters?: Counter[]; /** * Revision number, which increments by 1 each time the counter is updated. To prevent conflicting changes, the existing revision must be used when updating a counter. * @readonly */ revision?: string | null; } export interface Counter { /** Counter key, unique within the given app. */ key?: string; /** Whether this counter data is available to all. If `false`, the counter is only available to the data owner and counter owner. */ public?: boolean; /** Activity count. */ count?: number; } export interface SetActivityCountersRequest { /** Member ID whose counter will be set. */ memberId: string; /** Counter data for this site member. */ counter: Counter; } export interface SetActivityCountersResponse { /** Updated activity counter. */ activityCounter?: ActivityCounter; } export interface IncrementActivityCountersRequest { /** Member ID whose counter will be incremented. */ memberId: string; /** Counter data for this site member. */ counter: Counter; } export interface IncrementActivityCountersResponse { /** Incremented activity counter. */ activityCounter?: ActivityCounter; } export interface GetActivityCountersRequest { /** Member ID whose counters will be returned. */ memberId: string; } export interface GetActivityCountersResponse { /** Activity counters. */ activityCounters?: ActivityCounter[]; } export interface QueryActivityCountersRequest { /** Query options. */ query?: Query; } export interface Query { /** Filter object. */ filter?: any; /** Paging options. */ paging?: Paging; } export interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } export interface QueryActivityCountersResponse { /** Retrieved activity counters. */ activityCounters?: ActivityCounter[]; /** Paging metadata. */ metadata?: PagingMetadata; } export interface PagingMetadata { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ offset?: number | null; /** Total number of items that match the query. */ total?: number | null; /** Flag that indicates the server failed to calculate the `total` field. */ tooManyToCount?: boolean | 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 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" } interface CounterNonNullableFields { key: string; public: boolean; count: number; } interface ActivityCounterNonNullableFields { memberId: string; appId: string; counters: CounterNonNullableFields[]; } export interface SetActivityCountersResponseNonNullableFields { activityCounter?: ActivityCounterNonNullableFields; } export interface IncrementActivityCountersResponseNonNullableFields { activityCounter?: ActivityCounterNonNullableFields; } export interface GetActivityCountersResponseNonNullableFields { activityCounters: ActivityCounterNonNullableFields[]; } export interface QueryActivityCountersResponseNonNullableFields { activityCounters: ActivityCounterNonNullableFields[]; } 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 ActivityCounterUpdatedEnvelope { entity: ActivityCounter; metadata: EventMetadata; } /** * Triggered when a member's activity counter is updated. * @permissionScope Manage Activity Counters * @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-ACTIVITY-COUNTERS * @permissionScope Read Activity Counters * @permissionScopeId SCOPE.DC-MEMBERS.READ-ACTIVITY-COUNTERS * @permissionId MEMBERS.ACTIVITY_COUNTERS_READ * @webhook * @eventType wix.members.v1.activity_counter_updated */ export declare function onActivityCounterUpdated(handler: (event: ActivityCounterUpdatedEnvelope) => void | Promise): void; /** * Sets activity counters for a requested site member. * * If the counter does not already exist, it will be created. * * Counters are identified with a custom key, which must be unique. * * > **Note**: Make sure to pass a `memberId` and not a `contactId` to identify the member. Any relationship between a member's `memberId` and `contactId` is coincidental. * @param memberId - Member ID whose counter will be set. * @param counter - Counter data for this site member. * @public * @requiredField counter * @requiredField memberId * @permissionId MEMBERS.ACTIVITY_COUNTERS_WRITE * @permissionScope Manage Activity Counters * @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-ACTIVITY-COUNTERS * @applicableIdentity APP * @fqn com.wixpress.members.activitycounters.ActivityCounters.SetActivityCounters */ export declare function setActivityCounters(memberId: string, counter: Counter): Promise; /** * Increments a specific activity counters for a specified site member. * * If the counter does not already exist, it will be created. * * Counters are identified with a custom key, which must be unique. * * > **Note**: Make sure to pass a `memberId` and not a `contactId` to identify the member. Any relationship between a member's `memberId` and `contactId` is coincidental. * @param memberId - Member ID whose counter will be incremented. * @param counter - Counter data for this site member. * @public * @requiredField counter * @requiredField memberId * @permissionId MEMBERS.ACTIVITY_COUNTERS_WRITE * @permissionScope Manage Activity Counters * @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-ACTIVITY-COUNTERS * @applicableIdentity APP * @fqn com.wixpress.members.activitycounters.ActivityCounters.IncrementActivityCounters */ export declare function incrementActivityCounters(memberId: string, counter: Counter): Promise; /** * Retrieves activity counters for the specified site member, including all public counters and any private counters owned by the authenticated caller. * * > **Note**: Make sure to pass a `memberId` and not a `contactId` to identify the member. Any relationship between a member's `memberId` and `contactId` is coincidental. * @param memberId - Member ID whose counters will be returned. * @public * @requiredField memberId * @permissionId MEMBERS.ACTIVITY_COUNTERS_READ * @permissionScope Manage Activity Counters * @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-ACTIVITY-COUNTERS * @permissionScope Read Activity Counters * @permissionScopeId SCOPE.DC-MEMBERS.READ-ACTIVITY-COUNTERS * @applicableIdentity APP * @applicableIdentity VISITOR * @fqn com.wixpress.members.activitycounters.ActivityCounters.GetActivityCounters */ export declare function getActivityCounters(memberId: string): Promise; /** * Returns up to 100 public activity counters for the provided filter and paging. * * Only counters that are marked as public are returned. * * Supported fields for filtering: * - `memberId` * * Supported operations: * * Comparison: * - $eq * - $ne * - $in * * Logical: * - $and * - $not * - $or * @public * @param options - Information about the activity counters to retrieve. * @permissionScope Manage Activity Counters * @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-ACTIVITY-COUNTERS * @permissionScope Read Activity Counters * @permissionScopeId SCOPE.DC-MEMBERS.READ-ACTIVITY-COUNTERS * @permissionId MEMBERS.ACTIVITY_COUNTERS_READ * @applicableIdentity APP * @applicableIdentity VISITOR * @fqn com.wixpress.members.activitycounters.ActivityCounters.QueryActivityCounters */ export declare function queryActivityCounters(): ActivityCountersQueryBuilder; interface QueryOffsetResult { currentPage: number | undefined; totalPages: number | undefined; totalCount: number | undefined; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } export interface ActivityCountersQueryResult extends QueryOffsetResult { items: ActivityCounter[]; query: ActivityCountersQueryBuilder; next: () => Promise; prev: () => Promise; } export interface ActivityCountersQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ eq: (propertyName: 'memberId', value: any) => ActivityCountersQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ne: (propertyName: 'memberId', value: any) => ActivityCountersQueryBuilder; in: (propertyName: 'memberId', value: any) => ActivityCountersQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */ limit: (limit: number) => ActivityCountersQueryBuilder; /** @param skip - Number of items to skip in the query results before returning the results. */ skip: (skip: number) => ActivityCountersQueryBuilder; find: () => Promise; } export {};