/** * A loyalty account stores a customer's loyalty points balance. A site's customers can earn points to their account * and redeem those points for rewards. */ export interface LoyaltyAccount { /** * Account ID. * @readonly */ _id?: string; /** * Account owner's contact ID. See the [Contacts API](wix-crm-backend/contacts) to learn more. * @readonly */ contactId?: string; /** * Account owner's member ID. See the [Members API](wix-members-backend/introduction) to learn more. * @readonly */ memberId?: string | null; /** * Information about the account totals. * @readonly */ points?: Points; /** * Whether the account has a reward available. `true` if the amount of points in `points.balance` are enough to redeem for a reward. * @readonly */ rewardAvailable?: boolean; /** * Date and time the account was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the account was last updated. * @readonly */ _updatedDate?: Date | null; /** * Account's last activity date and time. * @readonly */ lastActivityDate?: Date | null; /** * Revision number, which increments by 1 each time the loyalty account is updated. * * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty account. * * Ignored when creating an account. */ revision?: string; /** * Tier information. * @readonly */ tier?: Tier; /** * Contact information. * @readonly */ contact?: Contact; /** * Points expiration information * @readonly */ pointsExpiration?: PointsExpiration; } export interface Points { /** * Current point balance. * * Equal to the sum of `earned` and `adjusted` points, minus `redeemed` points. * @readonly */ balance?: number; /** * Total earned points. * @readonly */ earned?: number; /** * Total adjusted points. * @readonly */ adjusted?: number; /** * Total redeemed points. * @readonly */ redeemed?: number; /** * Total expired points. * @readonly */ expired?: number; } /** * Tier information. * * The Tiers API is currently unavailable, but the program may be activated and managed from a site's * [loyalty dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Floyalty-accounts/wizard/). */ export interface Tier { /** * Tier ID. * * This field will not be returned if the account belongs to the base tier. * @readonly */ _id?: string | null; /** * Date and time the tier information was last recalculated. * @readonly */ _updatedDate?: Date | null; /** * Points earned and adjusted over the tier's current rolling window. * @readonly */ points?: number; } /** Loyalty account's contact information */ export interface Contact { /** * Contact ID. * @readonly */ _id?: string | null; /** * Contact's first and last name. * @readonly */ name?: string | null; /** * Contact's profile picture. * @readonly */ picture?: Image; /** * Contact's email addresses. * @readonly */ email?: string | null; /** * Contact's first and last name. If no name is provided, uses contact's email. * @readonly */ displayName?: string | null; } export interface Image { /** WixMedia image ID. */ _id?: string; /** Image URL. */ url?: string; /** * Original image height. * @readonly */ height?: number; /** * Original image width. * @readonly */ width?: number; } export interface PointsExpiration { /** * Date at which points are expiring. * @readonly */ expirationDate?: Date | null; /** * Amount of points that are going to expire at that date. * @readonly */ expiringPointsAmount?: number; } export interface RewardAvailabilityUpdated { /** True if rewards is available. */ rewardAvailable?: boolean; /** Source of this change. */ updateTrigger?: UpdateTrigger; } export declare enum UpdateTrigger { /** Undefined trigger. */ UNDEFINED = "UNDEFINED", /** Reward was updated. */ REWARD_UPDATED = "REWARD_UPDATED", /** Balance was updated. */ BALANCE_UPDATED = "BALANCE_UPDATED", /** Tiers were recalculated. */ TIERS_RECALCULATED = "TIERS_RECALCULATED" } export interface CreateAccountRequest { /** * Contact ID for a Wix site contact. See the [Contacts API](wix-crm-backend/contacts) to learn more. * */ contactId: string; } export interface CreateAccountResponse { /** Created loyalty account. */ account?: LoyaltyAccount; } export interface EarnPointsRequest extends EarnPointsRequestActivityDetailsOneOf { /** Followed social media details. */ followedSocialMedia?: FollowedSocialMedia; /** Loyalty account ID. */ accountId: string; /** * Amount of points to earn. Must be a positive, whole number. * * Min: `1` * * Max: `9999999` */ amount?: number; /** * Description of how the points were earned. * * Max: 100 characters */ description?: string; /** * ID of the app that initiated the transaction. * * If points were earned manually, then the `appId` is the Loyalty app's * `wixAppId` of `553c79f3-5625-4f38-b14b-ef7c0d1e87df`. If points were earned in an automatic event, * then the `appId` is from that automation's `sourceAppId`. */ appId: string; /** * Unique string identifier generated by the app. Wix uses this identifier to recognize subsequent retries of the same request. * * Please use `GUID` format. */ idempotencyKey: string; /** * Activity type. * * If points were earned through automation it should be set to trigger key. */ activityType?: string | null; /** Order id which was source of this transaction. */ orderId?: string | null; } /** @oneof */ export interface EarnPointsRequestActivityDetailsOneOf { /** Followed social media details. */ followedSocialMedia?: FollowedSocialMedia; } export interface FollowedSocialMedia { /** * Social media channel. * Example: `FACEBOOK`, `INSTAGRAM`. */ channel?: string; } export interface EarnPointsResponse { /** Updated loyalty account. */ account?: LoyaltyAccount; /** * Transaction ID associated with the points earned. * @readonly */ transactionId?: string; } export interface PointsUpdated { /** Updated account. */ account?: LoyaltyAccount; } export interface FirstTransaction { /** Updated account. */ account?: LoyaltyAccount; } export interface AdjustPointsRequest extends AdjustPointsRequestTypeOneOf { /** * Sets the account's point balance to this amount. Must be a positive, whole number or zero. * * The net difference between this new balance and the previous balance will be reflected in the `adjusted` field of the customer's account. * * Min: `0` * * Max: `999999999` */ balance?: number; /** * Adjusts the account's point balance by this amount. Must be a whole number with a maximum of 7 digits. * The amount can be negative, but cannot be `0`. * * Min: `-9999999` * * Max: `9999999` */ amount?: number; /** Loyalty account ID. */ accountId: string; /** Description to explain the reason for the points adjustment. */ description?: string | null; /** * Each time the loyalty account is updated, `revision` increments by 1. * * The current `revision` must be passed when adjusting points in the loyalty account. This * ensures you're working with the latest version of the loyalty account and prevents unintended overwrites. */ revision?: string; } /** @oneof */ export interface AdjustPointsRequestTypeOneOf { /** * Sets the account's point balance to this amount. Must be a positive, whole number or zero. * * The net difference between this new balance and the previous balance will be reflected in the `adjusted` field of the customer's account. * * Min: `0` * * Max: `999999999` */ balance?: number; /** * Adjusts the account's point balance by this amount. Must be a whole number with a maximum of 7 digits. * The amount can be negative, but cannot be `0`. * * Min: `-9999999` * * Max: `9999999` */ amount?: number; } export interface AdjustPointsResponse { /** Adjusted loyalty account. */ account?: LoyaltyAccount; /** * Transaction ID associated with the points adjustment. * @readonly */ transactionId?: string; } export interface RedeemPointsRequest { /** Loyalty account ID. */ accountId?: string; /** Reward ID. See [Rewards API](https://dev.wix.com/api/rest/loyalty/rewards/rewards-object) for more details. */ rewardId?: string; /** Number of times the given reward will be redeemed. Must be a positive whole number. */ count?: number; /** * Revision number, which increments by 1 each time points are redeemed. * To prevent conflicting changes, the existing `revision` must be used when redeeming points. */ revision?: string; /** Id of the entity that is being redeemed (e.g. orderId for order discount, couponId for coupon reward). */ referenceEntityId?: string | null; } export interface RedeemPointsResponse { /** Loyalty account. */ account?: LoyaltyAccount; /** * Transaction ID associated with the redemption. * @readonly */ transactionId?: string; } export interface RedeemDeterminedAmountOfPointsRequest { /** Loyalty account ID. */ accountId?: string; /** Reward ID. See [Rewards API](https://dev.wix.com/api/rest/loyalty/rewards/rewards-object) for more details. */ rewardId?: string; /** Number of points to be redeemed off the account. */ points?: number; /** * Revision number, which increments by 1 each time points are redeemed. * To prevent conflicting changes, the existing `revision` must be used when redeeming points. */ revision?: string; /** Id of the entity that is being redeemed (e.g. orderId for order discount, couponId for coupon reward). */ referenceEntityId?: string | null; } export interface RedeemDeterminedAmountOfPointsResponse { /** Loyalty account. */ account?: LoyaltyAccount; /** * Transaction ID associated with the redemption. * @readonly */ transactionId?: string; } export interface RefundTransactionRequest { /** * Transaction ID associated with the refund. * @readonly */ transactionId?: string; } export interface RefundTransactionResponse { } export interface GetAccountRequest { /** ID of the account to retrieve. */ _id: string; } export interface GetAccountResponse { /** Retrieved loyalty account. */ account?: LoyaltyAccount; } export interface QueryLoyaltyAccountsRequest { /** * Filter object. * See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) for more information. */ 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 QueryLoyaltyAccountsResponse { /** Loyalty accounts. */ loyaltyAccounts?: LoyaltyAccount[]; /** Paging metadata */ pagingMetadata?: 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 ListUserAccountsRequest { /** Number of items to load. Minimum `1`, maximum `50`. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } export interface ListUserAccountsResponse { /** Loyalty accounts. */ accounts?: LoyaltyAccountForMetaSite[]; } export interface LoyaltyAccountForMetaSite { /** Loyalty account. */ account?: LoyaltyAccount; /** Metasite ID. */ metaSiteId?: string; } export interface GetProgramTotalsRequest { } export interface GetProgramTotalsResponse { /** Point totals for the entire program. */ points?: Points; /** Tier total for the entire program. */ tierTotals?: TierTotal[]; } export interface TierTotal { /** * Tier ID. If no Tier ID provided, the ID is null. See [Base tier](https://dev.wix.com/docs/rest/crm/loyalty-program/tiers/introduction)for more information. * @readonly */ _id?: string | null; /** Total number of loyalty account that belong to a particular Tier. */ numberOfAccounts?: number; } export interface GetCurrentMemberAccountRequest { } export interface GetCurrentMemberAccountResponse { /** Loyalty account. */ account?: LoyaltyAccount; } export interface GetAccountBySecondaryIdRequest extends GetAccountBySecondaryIdRequestIdOneOf { /** Account owner's contact ID. See the [Contacts API](wix-crm-backend/contacts) to learn more. */ contactId?: string; /** Account owner's member ID. See the [Members API](wix-members-backend/introduction) to learn more. */ memberId?: string; } /** @oneof */ export interface GetAccountBySecondaryIdRequestIdOneOf { /** Account owner's contact ID. See the [Contacts API](wix-crm-backend/contacts) to learn more. */ contactId?: string; /** Account owner's member ID/ See the [Members API](wix-members-backend/introduction) to learn more. */ memberId?: string; } export interface GetAccountBySecondaryIdResponse { /** Retrieved loyalty account. */ account?: LoyaltyAccount; } /** Options to use when retrieving a list of loyalty accounts. */ export interface ListAccountsRequest { /** List of contact IDs. See the [Contacts API](wix-crm-backend/contacts) to learn more. */ contactIds?: string[]; /** Pagination options. */ cursorPaging?: CursorPaging; } export interface ListAccountsResponse { /** Retrieved loyalty accounts. */ accounts?: LoyaltyAccount[]; /** Details on the paged set of results returned. */ pagingMetadata?: PagingMetadataV2; } export interface PagingMetadataV2 { /** 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. Returned if offset paging is used and the `tooManyToCount` flag is not set. */ total?: number | null; /** Flag that indicates the server failed to calculate the `total` field. */ tooManyToCount?: boolean | null; /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */ cursors?: Cursors; } /** Options to use when search for loyalty accounts. */ export interface SearchAccountsRequest { /** Search options. */ search?: CursorSearch; } export interface CursorSearch extends CursorSearchPagingMethodOneOf { /** * 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; /** * List of sort objects. * * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section). */ sort?: Sorting[]; /** Aggregations are a way to explore large amounts of data by displaying summaries about various partitions of the data and later allowing to narrow the navigation to a specific partition. */ aggregations?: Aggregation[]; /** Free text to match in searchable fields. */ search?: SearchDetails; /** * UTC offset or IANA time zone. Valid values are * ISO 8601 UTC offsets, such as +02:00 or -06:00, * and IANA time zone IDs, such as Europe/Rome. * * Affects all filters and aggregations returned values. * You may override this behavior in a specific filter by providing * timestamps including time zone. For example, `"2023-12-20T10:52:34.795Z"`. */ timeZone?: string | null; } /** @oneof */ export interface CursorSearchPagingMethodOneOf { /** * 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 Aggregation extends AggregationKindOneOf { /** Value aggregation. */ value?: ValueAggregation; /** Range aggregation. */ range?: RangeAggregation; /** Scalar aggregation. */ scalar?: ScalarAggregation; /** Date histogram aggregation. */ dateHistogram?: DateHistogramAggregation; /** Nested aggregation. */ nested?: NestedAggregation; /** User-defined name of aggregation, should be unique, will appear in aggregation results. */ name?: string | null; /** Type of aggregation, client must provide matching aggregation field below. */ type?: AggregationType; /** Field to aggregate by, use dot notation to specify json path. */ fieldPath?: string; /** * Deprecated. Use `nested` instead. * @deprecated Deprecated. Use `nested` instead. * @replacedBy kind.nested * @targetRemovalDate 2024-03-30 */ groupBy?: GroupByAggregation; } /** @oneof */ export interface AggregationKindOneOf { /** Value aggregation. */ value?: ValueAggregation; /** Range aggregation. */ range?: RangeAggregation; /** Scalar aggregation. */ scalar?: ScalarAggregation; /** Date histogram aggregation. */ dateHistogram?: DateHistogramAggregation; /** Nested aggregation. */ nested?: NestedAggregation; } export interface RangeBucket { /** Inclusive lower bound of the range. Required if `to` is not provided. */ from?: number | null; /** Exclusive upper bound of the range. Required if `from` is not provided. */ to?: number | null; } export declare enum SortType { /** Sort by number of matches. */ COUNT = "COUNT", /** Sort by value of the field alphabetically. */ VALUE = "VALUE" } export declare enum SortDirection { /** Sort in descending order. */ DESC = "DESC", /** Sort in ascending order. */ ASC = "ASC" } export declare enum MissingValues { /** Exclude missing values from the aggregation results. */ EXCLUDE = "EXCLUDE", /** Include missing values in the aggregation results. */ INCLUDE = "INCLUDE" } export interface IncludeMissingValuesOptions { /** Specify custom bucket name. Defaults are [string -> "N/A"], [int -> "0"], [bool -> "false"] ... */ addToBucket?: string; } export declare enum ScalarType { UNKNOWN_SCALAR_TYPE = "UNKNOWN_SCALAR_TYPE", /** Count of distinct values. */ COUNT_DISTINCT = "COUNT_DISTINCT", /** Minimum value. */ MIN = "MIN", /** Maximum value. */ MAX = "MAX" } export interface ValueAggregation extends ValueAggregationOptionsOneOf { /** Options for including missing values. */ includeOptions?: IncludeMissingValuesOptions; /** Whether to sort by number of matches or value of the field. */ sortType?: SortType; /** Whether to sort in ascending or descending order. */ sortDirection?: SortDirection; /** How many aggregations to return. Can be between 1 and 250. 10 is the default. */ limit?: number | null; /** Whether to include or exclude missing values from the aggregation results. Default: `EXCLUDE`. */ missingValues?: MissingValues; } /** @oneof */ export interface ValueAggregationOptionsOneOf { /** Options for including missing values. */ includeOptions?: IncludeMissingValuesOptions; } export declare enum NestedAggregationType { UNKNOWN_AGGREGATION_TYPE = "UNKNOWN_AGGREGATION_TYPE", /** An aggregation where result buckets are dynamically built - one per unique value. */ VALUE = "VALUE", /** An aggregation, where user can define set of ranges - each representing a bucket. */ RANGE = "RANGE", /** A single-value metric aggregation. For example, min, max, sum, avg. */ SCALAR = "SCALAR", /** An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.). */ DATE_HISTOGRAM = "DATE_HISTOGRAM" } export interface RangeAggregation { /** List of range buckets, where during aggregation each entity will be placed in the first bucket its value falls into, based on the provided range bounds. */ buckets?: RangeBucket[]; } export interface ScalarAggregation { /** Define the operator for the scalar aggregation. */ type?: ScalarType; } export interface DateHistogramAggregation { /** Interval for date histogram aggregation. */ interval?: DateHistogramAggregationInterval; } export declare enum DateHistogramAggregationInterval { UNKNOWN_INTERVAL = "UNKNOWN_INTERVAL", /** Yearly interval */ YEAR = "YEAR", /** Monthly interval */ MONTH = "MONTH", /** Weekly interval */ WEEK = "WEEK", /** Daily interval */ DAY = "DAY", /** Hourly interval */ HOUR = "HOUR", /** Minute interval */ MINUTE = "MINUTE", /** Second interval */ SECOND = "SECOND" } export interface NestedAggregationItem extends NestedAggregationItemKindOneOf { /** Value aggregation. */ value?: ValueAggregation; /** Range aggregation. */ range?: RangeAggregation; /** Scalar aggregation. */ scalar?: ScalarAggregation; /** Date histogram aggregation. */ dateHistogram?: DateHistogramAggregation; /** User-defined name of aggregation, should be unique, will appear in aggregation results. */ name?: string | null; /** Type of aggregation, client must provide matching aggregation field below. */ type?: NestedAggregationType; /** Field to aggregate by, use dot notation to specify json path. */ fieldPath?: string; } /** @oneof */ export interface NestedAggregationItemKindOneOf { /** Value aggregation. */ value?: ValueAggregation; /** Range aggregation. */ range?: RangeAggregation; /** Scalar aggregation. */ scalar?: ScalarAggregation; /** Date histogram aggregation. */ dateHistogram?: DateHistogramAggregation; } export declare enum AggregationType { UNKNOWN_AGGREGATION_TYPE = "UNKNOWN_AGGREGATION_TYPE", /** An aggregation where result buckets are dynamically built - one per unique value. */ VALUE = "VALUE", /** An aggregation, where user can define set of ranges - each representing a bucket. */ RANGE = "RANGE", /** A single-value metric aggregation. For example, min, max, sum, avg. */ SCALAR = "SCALAR", /** An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.) */ DATE_HISTOGRAM = "DATE_HISTOGRAM", /** Multi-level aggregation, where each next aggregation is nested within previous one. */ NESTED = "NESTED" } /** Nested aggregation expressed through a list of aggregation where each next aggregation is nested within previous one. */ export interface NestedAggregation { /** Flattened list of aggregations, where each next aggregation is nested within previous one. */ nestedAggregations?: NestedAggregationItem[]; } export interface GroupByAggregation extends GroupByAggregationKindOneOf { /** Value aggregation configuration. */ value?: ValueAggregation; /** User-defined name of aggregation, should be unique, will appear in aggregation results. */ name?: string | null; /** Field to aggregate by. */ fieldPath?: string; } /** @oneof */ export interface GroupByAggregationKindOneOf { /** Value aggregation configuration. */ value?: ValueAggregation; } export interface SearchDetails { /** Defines how separate search terms in `expression` are combined. */ mode?: Mode; /** Search term or expression. */ expression?: string | null; /** Fields to search in. If empty - will search in all searchable fields. Use dot notation to specify json path. */ fields?: string[]; /** Whether to use auto fuzzy search (allowing typos by a managed proximity algorithm). */ fuzzy?: boolean; } export declare enum Mode { /** Any of the search terms must be present. */ OR = "OR", /** All search terms must be present. */ AND = "AND" } /** Accounts found through provided search capabilities, along with paging and aggregation data of the results. */ export interface SearchAccountsResponse { /** Found accounts. */ accounts?: LoyaltyAccount[]; /** Paging metadata. */ pagingMetadata?: CursorPagingMetadata; /** Aggregation data */ aggregationData?: AggregationData; } export interface AggregationData { /** key = aggregation name (as derived from search request). */ results?: AggregationResults[]; } export interface ValueAggregationResult { /** Value of the field. */ value?: string; /** Count of entities with this value. */ count?: number; } export interface RangeAggregationResult { /** Inclusive lower bound of the range. */ from?: number | null; /** Exclusive upper bound of the range. */ to?: number | null; /** Count of entities in this range. */ count?: number; } export interface NestedAggregationResults extends NestedAggregationResultsResultOneOf { /** Value aggregation results. */ values?: ValueResults; /** Range aggregation results. */ ranges?: RangeResults; /** Scalar aggregation results. */ scalar?: AggregationResultsScalarResult; /** User-defined name of aggregation, matches the one provided in request. */ name?: string; /** Type of aggregation that matches result. */ type?: AggregationType; /** Field to aggregate by, matches the one provided in request. */ fieldPath?: string; } /** @oneof */ export interface NestedAggregationResultsResultOneOf { /** Value aggregation results. */ values?: ValueResults; /** Range aggregation results. */ ranges?: RangeResults; /** Scalar aggregation results. */ scalar?: AggregationResultsScalarResult; } export interface ValueResults { /** List of value aggregations. */ results?: ValueAggregationResult[]; } export interface RangeResults { /** List of ranges returned in same order as requested. */ results?: RangeAggregationResult[]; } export interface AggregationResultsScalarResult { /** Type of scalar aggregation. */ type?: ScalarType; /** Value of the scalar aggregation. */ value?: number; } export interface NestedValueAggregationResult { /** Value of the field. */ value?: string; /** Nested aggregations. */ nestedResults?: NestedAggregationResults; } export interface ValueResult { /** Value of the field. */ value?: string; /** Count of entities with this value. */ count?: number | null; } export interface RangeResult { /** Inclusive lower bound of the range. */ from?: number | null; /** Exclusive upper bound of the range. */ to?: number | null; /** Count of entities in this range. */ count?: number | null; } export interface ScalarResult { /** Value of the scalar aggregation. */ value?: number; } export interface NestedResultValue extends NestedResultValueResultOneOf { /** Value aggregation result. */ value?: ValueResult; /** Range aggregation result. */ range?: RangeResult; /** Scalar aggregation result. */ scalar?: ScalarResult; /** Date histogram aggregation result. */ dateHistogram?: ValueResult; } /** @oneof */ export interface NestedResultValueResultOneOf { /** Value aggregation result. */ value?: ValueResult; /** Range aggregation result. */ range?: RangeResult; /** Scalar aggregation result. */ scalar?: ScalarResult; /** Date histogram aggregation result. */ dateHistogram?: ValueResult; } export interface Results { /** List of nested aggregations. */ results?: Record; } export interface DateHistogramResult { /** Date in ISO 8601 format. */ value?: string; /** Count of documents in the bucket. */ count?: number; } export interface GroupByValueResults { /** List of value aggregations. */ results?: NestedValueAggregationResult[]; } export interface DateHistogramResults { /** List of date histogram aggregations. */ results?: DateHistogramResult[]; } /** * Results of `NESTED` aggregation type in a flattened form. * Aggregations in resulting array are keyed by requested aggregation `name`. */ export interface NestedResults { /** List of nested aggregations. */ results?: Results[]; } export interface AggregationResults extends AggregationResultsResultOneOf { /** Value aggregation results. */ values?: ValueResults; /** Range aggregation results. */ ranges?: RangeResults; /** Scalar aggregation results. */ scalar?: AggregationResultsScalarResult; /** Group by value aggregation results. */ groupedByValue?: GroupByValueResults; /** Date histogram aggregation results. */ dateHistogram?: DateHistogramResults; /** Nested aggregation results. */ nested?: NestedResults; /** User-defined name of aggregation as derived from search request. */ name?: string; /** Type of aggregation that must match provided kind as derived from search request. */ type?: AggregationType; /** Field to aggregate by as derived from search request. */ fieldPath?: string; } /** @oneof */ export interface AggregationResultsResultOneOf { /** Value aggregation results. */ values?: ValueResults; /** Range aggregation results. */ ranges?: RangeResults; /** Scalar aggregation results. */ scalar?: AggregationResultsScalarResult; /** Group by value aggregation results. */ groupedByValue?: GroupByValueResults; /** Date histogram aggregation results. */ dateHistogram?: DateHistogramResults; /** Nested aggregation results. */ nested?: NestedResults; } export interface ExportAccountsRequest { query?: QueryV2; } export interface QueryV2 extends QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ 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[]; /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */ fields?: string[]; /** Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned. */ fieldsets?: string[]; } /** @oneof */ export interface QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; } 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 ExportAccountsResponse { accounts?: LoyaltyAccount[]; pagingMetadata?: CursorPagingMetadata; } /** Options to use when looking up count of loyalty accounts. */ export interface CountAccountsRequest { /** Filter object. */ filter?: Record | null; /** Free text to match in searchable fields. */ search?: SearchDetails; } /** Count of accounts found for given search query */ export interface CountAccountsResponse { count?: number; } export interface BulkAdjustPointsRequest extends BulkAdjustPointsRequestTypeOneOf { balance?: number; amount?: number; search?: CursorSearch; } /** @oneof */ export interface BulkAdjustPointsRequestTypeOneOf { balance?: number; amount?: number; } export interface BulkAdjustPointsResponse { /** @readonly */ asyncJobId?: 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 TiersRollingUpdate { } export interface TiersProgramSettingsChanged { /** Settings for the tiers program. */ programSettings?: TiersProgramSettings; } /** There can be single TiersSettings per site and it's global (i.e. applies to all program's tiers) */ export interface TiersProgramSettings extends TiersProgramSettingsPeriodOneOf { /** * *Required.** * Period of time used to calculate loyalty points for tier assignment. * * The loyalty points accumulated during this period determine if the account meets a tier's required point threshold. */ rollingWindow?: RollingWindow; /** Tiers program status. */ status?: Status; /** * Revision number, which increments by 1 each time the loyalty tiers settings are updated. * * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tiers settings. */ revision?: string | null; /** * Date and time the loyalty tiers program was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the loyalty tiers program was last updated. * @readonly */ _updatedDate?: Date | null; /** * Information about the base loyalty tier. * * The base tier is the default tier for any account that is unassigned for not meeting * the required points threshold of any other tier. */ baseTierDefinition?: TierDefinition; } /** @oneof */ export interface TiersProgramSettingsPeriodOneOf { /** * *Required.** * Period of time used to calculate loyalty points for tier assignment. * * The loyalty points accumulated during this period determine if the account meets a tier's required point threshold. */ rollingWindow?: RollingWindow; } export declare enum Status { /** Unknown status. */ UNKNOWN = "UNKNOWN", /** Tiers are disabled. */ DISABLED = "DISABLED", /** Tiers are enabled but not yet active. */ DRAFT = "DRAFT", /** Tiers are active. */ ACTIVE = "ACTIVE", /** Tiers are paused. */ PAUSED = "PAUSED" } /** Information about the tier. */ export interface TierDefinition { /** Details about the tier icon. */ icon?: string; /** Tier name. */ name?: string | null; /** Tier description. */ description?: string | null; } export interface FocalPoint { /** X-coordinate of the focal point. */ x?: number; /** Y-coordinate of the focal point. */ y?: number; /** crop by height */ height?: number | null; /** crop by width */ width?: number | null; } /** * *Required.** Period of time used to calculate loyalty points for tier assignment. * * The loyalty points accumulated during this period determine if the account meets a tier's required point threshold. */ export interface RollingWindow { /** * Number of months to use for the rolling window period. * * Min: `12` * * Max: `36` */ durationInMonths?: number; } export interface SubscriptionEvent extends SubscriptionEventEventOneOf { /** Triggered when a subscription is created. */ created?: SubscriptionCreated; /** * Triggered when a subscription is assigned to a Wix site, including the initial * assignment of a floating subscription or a re-assignement from a different site. */ assigned?: SubscriptionAssigned; /** Triggered when a subscription is canceled. */ cancelled?: SubscriptionCancelled; /** Triggered when the subscription's auto renew is turned on. */ autoRenewTurnedOn?: SubscriptionAutoRenewTurnedOn; /** Triggered when the subscription's auto renew is turned off. */ autoRenewTurnedOff?: SubscriptionAutoRenewTurnedOff; /** * Triggered when a subscription is unassigned from a Wix site and becomes * floating. */ unassigned?: SubscriptionUnassigned; /** * Triggered when a subscription is transferred from one Wix account to another. * A transfer includes cancelling the original subscription and creating a new * subscription for the target account. The event returns both the original * and the new subscription. */ transferred?: SubscriptionTransferred; /** Triggered when a recurring charge succeeds for a subscription. */ recurringChargeSucceeded?: RecurringChargeSucceeded; /** * Triggered when a subscription was updated including when its product has been * up- or downgraded or the billing cycle is changed. */ contractSwitched?: ContractSwitched; /** * Triggered when a subscription gets close to the end of its billing cycle. * The exact number of days is defined in the billing system. */ nearEndOfPeriod?: SubscriptionNearEndOfPeriod; /** * Triggered when a subscription is updated and the change doesn't happen * immediately but at the end of the current billing cycle. */ pendingChange?: SubscriptionPendingChange; /** Triggered when a recurring charge attempt fails for a subscription. */ recurringChargeAttemptFailed?: RecurringChargeAttemptFailed; /** ID of the subscription's event. */ eventId?: string | null; /** * Date and time of the event in * [UTC datetime](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) * `YYYY-MM-DDThh:mm:ss.sssZ` format. */ eventDate?: Date | null; } /** @oneof */ export interface SubscriptionEventEventOneOf { /** Triggered when a subscription is created. */ created?: SubscriptionCreated; /** * Triggered when a subscription is assigned to a Wix site, including the initial * assignment of a floating subscription or a re-assignement from a different site. */ assigned?: SubscriptionAssigned; /** Triggered when a subscription is canceled. */ cancelled?: SubscriptionCancelled; /** Triggered when the subscription's auto renew is turned on. */ autoRenewTurnedOn?: SubscriptionAutoRenewTurnedOn; /** Triggered when the subscription's auto renew is turned off. */ autoRenewTurnedOff?: SubscriptionAutoRenewTurnedOff; /** * Triggered when a subscription is unassigned from a Wix site and becomes * floating. */ unassigned?: SubscriptionUnassigned; /** * Triggered when a subscription is transferred from one Wix account to another. * A transfer includes cancelling the original subscription and creating a new * subscription for the target account. The event returns both the original * and the new subscription. */ transferred?: SubscriptionTransferred; /** Triggered when a recurring charge succeeds for a subscription. */ recurringChargeSucceeded?: RecurringChargeSucceeded; /** * Triggered when a subscription was updated including when its product has been * up- or downgraded or the billing cycle is changed. */ contractSwitched?: ContractSwitched; /** * Triggered when a subscription gets close to the end of its billing cycle. * The exact number of days is defined in the billing system. */ nearEndOfPeriod?: SubscriptionNearEndOfPeriod; /** * Triggered when a subscription is updated and the change doesn't happen * immediately but at the end of the current billing cycle. */ pendingChange?: SubscriptionPendingChange; /** Triggered when a recurring charge attempt fails for a subscription. */ recurringChargeAttemptFailed?: RecurringChargeAttemptFailed; } /** Triggered when a subscription is created. */ export interface SubscriptionCreated { /** Created subscription. */ subscription?: Subscription; /** Metadata for the `created` event. */ metadata?: Record; /** * Subscription reactivation data. * A subscription can be reactivated for example if it was incorrectly canceled because of fraud and then reactivated * by the billing system */ reactivationData?: ReactivationData; } /** * A subscription holds information about a Premium product that a Wix account * owner has purchased including details about the billing. */ export interface Subscription { /** ID of the subscription. */ _id?: string; /** ID of the Wix account that purchased the subscription. */ userId?: string; /** * ID of the [product](https://bo.wix.com/wix-docs/rest/premium/premium-product-catalog-v2/products/product-object) * for which the subscription was purchased. */ productId?: string; /** * Date and time the subscription was created in * [UTC datetime](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) * `YYYY-MM-DDThh:mm:ss.sssZ` format. */ createdAt?: Date | null; /** * Date and time the subscription was last updated in * [UTC datetime](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) * `YYYY-MM-DDThh:mm:ss.sssZ` format. */ updatedAt?: Date | null; /** * ID of the metasite that the subscription is assigned to. * Available only when the subscription is assigned to a Wix site. * Subscriptions for account level products can't be assigned to a Wix site. */ metaSiteId?: string | null; /** Information about the system that manages the subscription's billing. */ billingReference?: BillingReference; /** Information about the billing cycle of the subscription. */ cycle?: Cycle; /** * Subscription status. * * + `UNKNOWN`: Default status. * + `AUTO_RENEW_ON`: Subscription is active and automatically renews at the end of the current billing cycle. * + `AUTO_RENEW_OFF`: Subscription is active but expires at the end of the current billing cycle. * + `MANUAL_RECURRING`: Subscription is active and renews at the end of the current billing cycle, in case the customer takes an action related to the payment. * + `CANCELLED`: Subscription isn't active because it has been canceled. * + `TRANSFERRED`: Subscription isn't active because it has been transferred to a different account. A different active subscription was created for the target account. */ status?: SubscriptionStatus; /** * Date and time the subscription was last transferred from one Wix account to * another in * [UTC datetime](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) * `YYYY-MM-DDThh:mm:ss.sssZ` format. */ transferredAt?: Date | null; /** * ID of the [product type](https://bo.wix.com/wix-docs/rest/premium/premium-product-catalog-v2/product-types/product-type-object) * that the product, for which the subscription was purchased, belongs to. */ productTypeId?: string; /** Version number, which increments by 1 each time the subscription is updated. */ version?: number; /** * Whether the subscription is active. Includes the statuses * `"AUTO_RENEW_ON"`, `"AUTO_RENEW_OFF"`, and `"MANUAL_RECURRING"`. */ active?: boolean; /** * Date and time the subscription was originally created in * [UTC datetime](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) * `YYYY-MM-DDThh:mm:ss.sssZ` format. * Differs from `createdAt` in case the subscription was originally created for a different Wix account and has been transferred. */ originalCreationDate?: Date | null; /** Custom metadata about the subscription. */ metadata?: Record; /** * 2-letter country code in * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * format. */ countryCode?: string | null; } export interface BillingReference { /** * Name of the billing system that manages the subscription. * * + `"UNKNOWN"`: Default value. * + `"SBS"`: [Wix Billing](https://github.com/wix-p/premium-billing/tree/master/sbs). * + `"LICENSER"`: * + `"BASS"`: [Billing and Subscriptions System](https://dev.wix.com/docs/rest/internal-only/premium/subscriptions-by-billing-by-wix/introduction). * + `"RESELLER"`: [External Reseller](https://dev.wix.com/api/rest/account-level-apis/resellers/introduction). */ providerName?: ProviderName; /** Current provider reference ID. */ providerReferenceId?: string | null; /** Previous provider reference IDs. Used for when a subscription is extended, specifically for domains. */ previousProviderReferenceIds?: string[]; } export declare enum ProviderName { UNKNOWN = "UNKNOWN", SBS = "SBS", LICENSER = "LICENSER", BASS = "BASS", RESELLER = "RESELLER", RECURRING_INVOICES = "RECURRING_INVOICES" } export interface Cycle extends CycleCycleSelectorOneOf { /** repetitive interval */ interval?: Interval; /** one time */ oneTime?: OneTime; } /** @oneof */ export interface CycleCycleSelectorOneOf { /** repetitive interval */ interval?: Interval; /** one time */ oneTime?: OneTime; } export interface Interval { /** interval unit of measure */ unit?: IntervalUnit; /** number of interval */ count?: number; } export declare enum IntervalUnit { /** unknown interval unit */ UNKNOWN = "UNKNOWN", /** day */ DAY = "DAY", /** week */ WEEK = "WEEK", /** month */ MONTH = "MONTH", /** year */ YEAR = "YEAR" } export interface OneTime { } export declare enum SubscriptionStatus { UNKNOWN = "UNKNOWN", AUTO_RENEW_ON = "AUTO_RENEW_ON", AUTO_RENEW_OFF = "AUTO_RENEW_OFF", MANUAL_RECURRING = "MANUAL_RECURRING", CANCELLED = "CANCELLED", TRANSFERRED = "TRANSFERRED" } /** Triggered when a subscription is reactivated. */ export interface ReactivationData { reactivationReason?: ReactivationReasonEnum; /** * In the event of reactivation after chargeback dispute, the subscription may be extended according to the * number of days it was inactive during the time of resolving the dispute */ newEndOfPeriod?: Date | null; /** The original end date, before the inactive period. */ oldEndOfPeriod?: Date | null; /** The difference in days between the new new_end_of_period and old_end_of_period */ differenceInDays?: number | null; } /** Reason for subscription reactivation */ export declare enum ReactivationReasonEnum { UNKNOWN = "UNKNOWN", /** * Subscription was reactivated due to billing status change from CANCELED to ACTIVE, for example if it was incorrectly * canceled because of suspicion of fraud */ BILLING_STATUS_CHANGE = "BILLING_STATUS_CHANGE", /** Subscription was reactivated after a chargeback dispute */ REACTIVATED_AFTER_CHARGEBACK = "REACTIVATED_AFTER_CHARGEBACK" } /** * Triggered when a subscription is assigned to a Wix site, including the initial * assignment of a floating subscription or a re-assignement from a different site. */ export interface SubscriptionAssigned { /** Assigned subscription. */ subscription?: Subscription; /** ID of the metasite that the subscription has been assigned to before the update. */ previousMetaSiteId?: string | null; } /** Triggered when a subscription is canceled. */ export interface SubscriptionCancelled { /** Canceled subscription. */ subscription?: Subscription; /** Details about the cancellation including who canceled the subscription and why. */ cancellationDetails?: CancellationDetails; /** * Whether the subscription is canceled immediately or expires at the end of the current billing cycle. * * Default: `false` */ immediateCancel?: boolean; /** Whether the subscription was canceled during the free trial period. */ canceledInFreeTrial?: boolean; } /** Information about the cancellation flow including who canceled the subscription and why it was canceled. */ export interface CancellationDetails { /** * Cancellation code. * * Values supported for cancellations on behalf of the billing system: `-1`, `-2`, `-3`, `-4`, `-5`, `-6`, `-7`, `-8`. * For cancellations on behalf of the site owner or the service provider `cancellationCode` * is taken from the request of * [Cancel Immediately Offline](https://bo.wix.com/wix-docs/rest/premium/premium-subscriptions-manager/cancel-immediately-offline). * * + `-1`: The subscription has been cancelled by the billing system but none of the listed cancellation reasons applies. * + `-2`: There were payment problems. * + `-3`: There was a chargeback. * + `-4`: Customer support has canceled the subscription and issued a refund. * + `-5`: The site owner has changed their existing subscription. * + `-6`: The subscription has been transferred to a different Wix account. * + `-7`: The subscription has been canceled because the site owner hasn't manually authenticated the recurring payment during the subscription's grace period. For example, site owners must manually confirm recurring payments within 40 days when paying with boleto. * + `-8`: The Wix account that the subscription belonged to has been deleted. */ cancellationCode?: number | null; /** * Cancellation reason. For cancellations on behalf of the site owner or the service provider `cancellationReason` * is taken from the request of * [Cancel Immediately Offline](https://bo.wix.com/wix-docs/rest/premium/premium-subscriptions-manager/cancel-immediately-offline). * For cancellations on behalf of the billing system `cancellationReason` is `null` or an empty string. */ cancellationReason?: string | null; /** * Initiator of the cancellation. For `"USER_REQUESTED"` and `"APP_MANAGED"`, * `cancellationCode` and `cancellationReason` are taken from the request of * [Cancel Immediately](https://bo.wix.com/wix-docs/rest/premium/premium-subscriptions-manager/cancel-immediately) * or [Cancel Immediately Offline](https://bo.wix.com/wix-docs/rest/premium/premium-subscriptions-manager/cancel-immediately-offline). * For `"PASSIVE"`, cancellations `cancellationCode` is automatically calculated and `cancellationReason` * is `null` or an empty string. * * + `"UNKNOWN`: Default value. * + `"USER_REQUESTED"`: The Wix account owner has canceled the subscription. * + `"APP_MANAGED"`: The service provider has canceled the subscription. * + `"PASSIVE"`: The billing system has canceled the subscription. For example, in case of payment failure or fraud. */ initiator?: Initiator; } export declare enum Initiator { UNKNOWN = "UNKNOWN", USER_REQUESTED = "USER_REQUESTED", APP_MANAGED = "APP_MANAGED", PASSIVE = "PASSIVE" } /** Triggered when the subscription's auto renew is turned on. */ export interface SubscriptionAutoRenewTurnedOn { /** Subscription for which auto renew is turned on. */ subscription?: Subscription; /** * Supported values: `USER`, `APP`. * * Information about who turned auto renew on. * + `"USER"`: The site owner who purchased the subscription has turned auto renew on. * + `"APP"`: The service provider has turned auto renew on. */ initiator?: string | null; } /** Triggered when the subscription's auto renew is turned off. */ export interface SubscriptionAutoRenewTurnedOff { /** Subscription for which auto renew is turned off. */ subscription?: Subscription; /** Details about the cancellation including who canceled the subscription and why. */ cancellationDetails?: CancellationDetails; /** * Whether the subscription is immediately canceled or expires at the end of the current billing cycle. * * Default: `false` */ immediateCancel?: boolean; } /** * Triggered when a subscription is unassigned from a Wix site and becomes * floating. */ export interface SubscriptionUnassigned { /** Unassigned subscription. */ subscription?: Subscription; /** ID of the metasite that the subscription has been assigned to before the event. */ previousMetaSiteId?: string; /** * Reason why the subscription is unassigned. * * + `"UNKNOWN"`: Default value. * + `"USER_REQUESTED"`: The Wix account owner has unassigned the subscription. * + `"REPLACED_BY_ANOTHER_SUBSCRIPTION"`: A different subscription that replaces this subscription is assigned to the site. */ unassignReason?: UnassignReason; } export declare enum UnassignReason { UNKNOWN = "UNKNOWN", USER_REQUESTED = "USER_REQUESTED", REPLACED_BY_ANOTHER_SUBSCRIPTION = "REPLACED_BY_ANOTHER_SUBSCRIPTION" } /** * Triggered when a subscription is transferred from one Wix account to another. * A transfer includes cancelling the original subscription and creating a new * subscription for the target account. The event returns both the original * and the new subscription. */ export interface SubscriptionTransferred { /** Original subscription that was canceled for the transfer. */ originSubscription?: Subscription; /** Newly created subscription for the target account. */ targetSubscription?: Subscription; } /** Triggered when a recurring charge succeeds for a subscription. */ export interface RecurringChargeSucceeded { /** Subscription for which the recurring charge has succeeded. */ subscription?: Subscription; /** Indication that there was a successful charge at the end of the free trial period */ freeTrialPeriodEnd?: boolean; } /** * Triggered when a subscription was updated including when its product has been * up- or downgraded or the billing cycle is changed. */ export interface ContractSwitched { /** Updated subscription. */ subscription?: Subscription; /** Billing cycle before the update. */ previousCycle?: Cycle; /** ID of the product belonging to the subscription before the update. */ previousProductId?: string; /** ID of the product type that the subscription's original product belonged to before the update. */ previousProductTypeId?: string; /** * Update type. __Note__: Doesn't include information about a product adjustment. * For that purpose, see `productAdjustment`. * * + `"NOT_APPLICABLE"`: Default value. * + `"ADDITIONAL_QUANTITY"`: An increased usage quota is added to the subscription. For example, a second mailbox is added to a subscription that previously included a single mailbox. * + `"CREDIT_UNUSED_PERIOD"`: The subscription is upgraded and the new price is less than the regular price. The new price applies to every billing cycle, not just the first cycle. * + `"REFUND_PRICE_DIFF"`: Not implemented. * + `"ADJUST_PERIOD_END"`: Not implemented. * + `"DOWNGRADE_GRACE_PERIOD"`: For downgrades during the grace period. In this situation, the site owner hasn’t paid yet and must immediately pay for the downgraded subscription. * + `"FULL_AMOUNT_PERIOD"`: For upgrades in which the site owner retains unused benefits. For example, site owners upgrading a Facebook Ads subscription retain their unused FB Ads credit. The unused credit is added to the new credit. * + `"END_OF_PERIOD"`: The subscription's billing current cycle is extended because of a downgrade. * + `"PENDING_CHANGES"`: The subscription's billing is updated, but the change doesn't apply immediately. Instead, the update becomes effective at the end of current billing cycle. * + `"DOWNGRADE_RENEWAL"`: The subscription is downgraded because of a declined payment. This prevents subscriptions from churning. */ contractSwitchType?: ContractSwitchType; /** * ID of the metasite the subscription has been assigned to previously. * Available only in case the subscription is assigned to a different site. */ previousMetaSiteId?: string | null; /** * Update reason. * * + `"PRICE_INCREASE"`: The subscription's price has been increased. * + `"EXTERNAL_PROVIDER_TRIGGER"`: Any reason other than a price increase. */ contractSwitchReason?: ContractSwitchReason; /** Information about the price update. Available only for updates with a price increase. */ productPriceIncreaseData?: ProductPriceIncreaseData; /** * Information about a product adjustment. For example, a downgrade. * __Note__: This isn't the same as `contractSwitchType`. * * + `NOT_APPLICABLE`: There is no information about whether the product has been up- or downgraded. * + `DOWNGRADE`: The product has been downgraded. */ productAdjustment?: ProductAdjustment; } /** Copied from SBS */ export declare enum ContractSwitchType { NOT_APPLICABLE = "NOT_APPLICABLE", ADDITIONAL_QUANTITY = "ADDITIONAL_QUANTITY", CREDIT_UNUSED_PERIOD = "CREDIT_UNUSED_PERIOD", REFUND_PRICE_DIFF = "REFUND_PRICE_DIFF", ADJUST_PERIOD_END = "ADJUST_PERIOD_END", DOWNGRADE_GRACE_PERIOD = "DOWNGRADE_GRACE_PERIOD", FULL_AMOUNT_PERIOD = "FULL_AMOUNT_PERIOD", END_OF_PERIOD = "END_OF_PERIOD", PENDING_CHANGES = "PENDING_CHANGES", DOWNGRADE_RENEWAL = "DOWNGRADE_RENEWAL" } export declare enum ContractSwitchReason { EXTERNAL_PROVIDER_TRIGGER = "EXTERNAL_PROVIDER_TRIGGER", PRICE_INCREASE = "PRICE_INCREASE" } /** Triggered when a subscription's price is increased. */ export interface ProductPriceIncreaseData { /** Price of the subscription before the update. */ previousPrice?: string | null; /** A value that is used in order to select the correct email template to send the user regarding the price increase. */ emailTemplateSelector?: string | null; /** Used to differentiate between migration segments. Does not have to be unique per segment. */ segmentName?: string | null; /** Used to determine how the price increase was triggered. */ priceIncreaseTrigger?: PriceIncreaseTrigger; } /** Reason for Price Increase Trigger */ export declare enum PriceIncreaseTrigger { NEAR_RENEWAL = "NEAR_RENEWAL", RECURRING_SUCCESS = "RECURRING_SUCCESS", MANUAL = "MANUAL" } /** Triggered when a subscription's product is adusted. */ export declare enum ProductAdjustment { /** flag to show that the ContractSwitchedEvent is not applicable / needed */ NOT_APPLICABLE = "NOT_APPLICABLE", /** flag to show that the ContractSwitchedEvent is a Downgrade */ DOWNGRADE = "DOWNGRADE" } /** * Triggered when a subscription gets close to the end of its billing cycle. * The exact number of days is defined in the billing system. */ export interface SubscriptionNearEndOfPeriod { /** Subscription that got close to the end of its billing cycle. */ subscription?: Subscription; /** Whether the subscription is within the free trial period. */ inFreeTrial?: boolean; } /** * Triggered when a subscription is updated and the change doesn't happen * immediately but at the end of the current billing cycle. */ export interface SubscriptionPendingChange { /** Subscription for which a pending update is triggered. */ subscription?: Subscription; } /** Triggered when a recurring charge attempt failed for a subscription. */ export interface RecurringChargeAttemptFailed { /** Subscription for which the recurring charge attempt has failed. */ subscription?: Subscription; } export interface ContactSyncRequest { contactIds?: string[]; contactId?: string | null; } export interface BulkUpsertAccountsRequest { /** List of contactIds + points to either insert as new loyalty accounts, or update if contacts already exist as loyalty accounts */ accounts?: AccountToUpsert[]; /** * If true, the upserted accounts are returned in response * @deprecated If true, the upserted accounts are returned in response * @targetRemovalDate 2024-02-01 */ returnAccounts?: boolean; /** Description of the action */ description?: string | null; } export interface AccountToUpsert { contactId?: string; pointsBalance?: number; } export interface BulkUpsertAccountsResponse { /** Loyalty accounts that were created or updated */ result?: BulkAccountResult[]; /** Numbers of successes and failures */ metadata?: BulkActionMetadata; } export interface BulkAccountResult { /** The created/updated account is returned if specified so in request message. */ account?: LoyaltyAccount; /** LoyaltyAccount metadata. */ metadata?: ItemMetadata; } export interface ItemMetadata { /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */ _id?: string | null; /** Index of the item within the request array. Allows for correlation between request and response items. */ originalIndex?: number; /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */ success?: boolean; /** Details about the error in case of failure. */ error?: ApplicationError; } export interface ApplicationError { /** Error code. */ code?: string; /** Description of the error. */ description?: string; /** Data related to the error. */ data?: Record | null; } export interface BulkActionMetadata { /** Number of items that were successfully processed. */ totalSuccesses?: number; /** Number of items that couldn't be processed. */ totalFailures?: number; /** Number of failures without details because detailed failure threshold was exceeded. */ undetailedFailures?: number; } export interface SetMissingMemberIdRequest { /** ID of the account to retrieve. */ accountId?: string; } export interface SetMissingMemberIdResponse { /** Loyalty account. */ account?: LoyaltyAccount; } 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 PointsNonNullableFields { balance: number; earned: number; adjusted: number; redeemed: number; expired: number; } interface TierNonNullableFields { points: number; } interface ImageNonNullableFields { _id: string; url: string; height: number; width: number; } interface ContactNonNullableFields { picture?: ImageNonNullableFields; } interface PointsExpirationNonNullableFields { expiringPointsAmount: number; } export interface LoyaltyAccountNonNullableFields { _id: string; contactId: string; points?: PointsNonNullableFields; rewardAvailable: boolean; revision: string; tier?: TierNonNullableFields; contact?: ContactNonNullableFields; pointsExpiration?: PointsExpirationNonNullableFields; } export interface CreateAccountResponseNonNullableFields { account?: LoyaltyAccountNonNullableFields; } export interface EarnPointsResponseNonNullableFields { account?: LoyaltyAccountNonNullableFields; transactionId: string; } export interface AdjustPointsResponseNonNullableFields { account?: LoyaltyAccountNonNullableFields; transactionId: string; } export interface GetAccountResponseNonNullableFields { account?: LoyaltyAccountNonNullableFields; } export interface QueryLoyaltyAccountsResponseNonNullableFields { loyaltyAccounts: LoyaltyAccountNonNullableFields[]; } interface TierTotalNonNullableFields { numberOfAccounts: number; } export interface GetProgramTotalsResponseNonNullableFields { points?: PointsNonNullableFields; tierTotals: TierTotalNonNullableFields[]; } export interface GetCurrentMemberAccountResponseNonNullableFields { account?: LoyaltyAccountNonNullableFields; } export interface GetAccountBySecondaryIdResponseNonNullableFields { account?: LoyaltyAccountNonNullableFields; } export interface ListAccountsResponseNonNullableFields { accounts: LoyaltyAccountNonNullableFields[]; } interface ValueAggregationResultNonNullableFields { value: string; count: number; } interface ValueResultsNonNullableFields { results: ValueAggregationResultNonNullableFields[]; } interface RangeAggregationResultNonNullableFields { count: number; } interface RangeResultsNonNullableFields { results: RangeAggregationResultNonNullableFields[]; } interface AggregationResultsScalarResultNonNullableFields { type: ScalarType; value: number; } interface NestedAggregationResultsNonNullableFields { values?: ValueResultsNonNullableFields; ranges?: RangeResultsNonNullableFields; scalar?: AggregationResultsScalarResultNonNullableFields; name: string; type: AggregationType; fieldPath: string; } interface NestedValueAggregationResultNonNullableFields { value: string; nestedResults?: NestedAggregationResultsNonNullableFields; } interface GroupByValueResultsNonNullableFields { results: NestedValueAggregationResultNonNullableFields[]; } interface DateHistogramResultNonNullableFields { value: string; count: number; } interface DateHistogramResultsNonNullableFields { results: DateHistogramResultNonNullableFields[]; } interface AggregationResultsNonNullableFields { values?: ValueResultsNonNullableFields; ranges?: RangeResultsNonNullableFields; scalar?: AggregationResultsScalarResultNonNullableFields; groupedByValue?: GroupByValueResultsNonNullableFields; dateHistogram?: DateHistogramResultsNonNullableFields; name: string; type: AggregationType; fieldPath: string; } interface AggregationDataNonNullableFields { results: AggregationResultsNonNullableFields[]; } export interface SearchAccountsResponseNonNullableFields { accounts: LoyaltyAccountNonNullableFields[]; aggregationData?: AggregationDataNonNullableFields; } export interface CountAccountsResponseNonNullableFields { count: number; } 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 AccountCreatedEnvelope { entity: LoyaltyAccount; metadata: EventMetadata; } /** * Triggered when a loyalty account is created. * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @permissionId LOYALTY.READ_ACCOUNTS * @webhook * @eventType wix.loyalty.v1.account_created */ export declare function onAccountCreated(handler: (event: AccountCreatedEnvelope) => void | Promise): void; export interface AccountPointsUpdatedEnvelope { data: PointsUpdated; metadata: EventMetadata; } /** * Triggered when the points of a loyalty account are adjusted, earned, or redeemed. * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @permissionId LOYALTY.READ_ACCOUNTS * @webhook * @eventType wix.loyalty.v1.account_points_updated */ export declare function onAccountPointsUpdated(handler: (event: AccountPointsUpdatedEnvelope) => void | Promise): void; export interface AccountRewardAvailabilityUpdatedEnvelope { data: RewardAvailabilityUpdated; metadata: EventMetadata; } /** * Triggered when rewardAvailable field is changed on Account. * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @permissionId LOYALTY.READ_ACCOUNTS * @webhook * @eventType wix.loyalty.v1.account_reward_availability_updated */ export declare function onAccountRewardAvailabilityUpdated(handler: (event: AccountRewardAvailabilityUpdatedEnvelope) => void | Promise): void; export interface AccountUpdatedEnvelope { entity: LoyaltyAccount; metadata: EventMetadata; } /** * Triggered when a loyalty account is updated, including when points are adjusted, earned, or redeemed. * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @permissionId LOYALTY.READ_ACCOUNTS * @webhook * @eventType wix.loyalty.v1.account_updated */ export declare function onAccountUpdated(handler: (event: AccountUpdatedEnvelope) => void | Promise): void; /** * Creates a loyalty account for one of a site's contacts. * * The `createAccount()` function returns a Promise that resolves to the new loyalty account when it is created. * * To create a new loyalty account, the customer must first be a site contact with a contact ID. The site must also have an active loyalty program before loyalty accounts can be created. * * >**Note:** Only visitors with **Manage Loyalty** [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can create a loyalty account. * @public * @requiredField contactId * @param contactId - Contact ID for a Wix site contact. See the [Contacts API](wix-crm-backend/contacts) to learn more. * @permissionId LOYALTY.MANAGE_ACCOUNTS * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.CreateAccount */ export declare function createAccount(contactId: string): Promise; /** * Adds points to a loyalty account. * * The `earnPoints()` function returns a Promise that resolves to the updated loyalty account. * * Only a positive amount can be added using the `earnPoints()` function, to manually adjust an account's balance for a negative amount, use [`adjustPoints()`](wix-loyalty-v2/accounts/adjustpoints). * * The `earnPoints()` function allows customers to manually earn points to their loyalty accounts. To use this function you must include an `appId` and an `idempotencyKey`. Any string can be set as the `appId` or `idempotencyKey`. In contrast to when an account earns points through an action taken on your site, the `appId` automatically sets to the source app that generates the points. The transaction `type` is `"EARN"` for points earned this way. * * >**Note:** Only visitors with **Manage Loyalty** [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can earn loyalty points. * @param accountId - Loyalty account ID. * @public * @requiredField accountId * @requiredField options.appId * @requiredField options.idempotencyKey * @param options - Earn points info. * @permissionId LOYALTY.MANAGE_ACCOUNTS * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.EarnPoints */ export declare function earnPoints(accountId: string, options?: EarnPointsOptions): Promise; export interface EarnPointsOptions extends EarnPointsRequestActivityDetailsOneOf { /** * Amount of points to earn. Must be a positive, whole number. * * Min: `1` * * Max: `9999999` */ amount?: number; /** * Description of how the points were earned. * * Max: 100 characters */ description?: string; /** * ID of the app that initiated the transaction. * * If points were earned manually, then the `appId` is the Loyalty app's * `wixAppId` of `553c79f3-5625-4f38-b14b-ef7c0d1e87df`. If points were earned in an automatic event, * then the `appId` is from that automation's `sourceAppId`. */ appId: string; /** * Unique string identifier generated by the app. Wix uses this identifier to recognize subsequent retries of the same request. * * Please use `GUID` format. */ idempotencyKey: string; /** * Activity type. * * If points were earned through automation it should be set to trigger key. */ activityType?: string | null; /** Order id which was source of this transaction. */ orderId?: string | null; /** Followed social media details. */ followedSocialMedia?: FollowedSocialMedia; } /** * Adjusts the point balance of a loyalty account. * * The `adjustPoints()` function returns a Promise that resolves to the updated loyalty account. * * To adjust the points balance of an account you must include an `accountId`, a `revision` number, and the adjustment to make. You can also leave a description to explain the reason for the points adjustment. * * There are two ways to adjust the points of a loyalty account: * - `balance` allows you to set the total points balance to this new amount. The transaction `type` will return as `"ADJUST"`. * - `amount` allows you to alter the points balance by this amount. This amount can be a positive number to increase the points balance or a negative number to decrease the balance. The transaction type will return as `"GIVE"`. * * An account may not be adjusted to a negative balance. If you pass values in both the `balance` and the `amount` parameters then the `balance` adjustment takes effect and the `amount` adjustment is ignored. * * >**Note:** Only visitors with **Manage Loyalty** [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can manually adjust points in a loyalty account. * @param accountId - Loyalty account ID. * @public * @requiredField accountId * @param options - Options to use when adjusting points. * @permissionId LOYALTY.MANAGE_ACCOUNTS * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.AdjustPoints */ export declare function adjustPoints(accountId: string, options?: AdjustPointsOptions): Promise; export interface AdjustPointsOptions extends AdjustPointsRequestTypeOneOf { /** Description to explain the reason for the points adjustment. */ description?: string | null; /** * Sets the account's point balance to this amount. Must be a positive, whole number or zero. * * The net difference between this new balance and the previous balance will be reflected in the `adjusted` field of the customer's account. * * Min: `0` * * Max: `999999999` */ balance?: number; /** * Adjusts the account's point balance by this amount. Must be a whole number with a maximum of 7 digits. * The amount can be negative, but cannot be `0`. * * Min: `-9999999` * * Max: `9999999` */ amount?: number; /** * Each time the loyalty account is updated, `revision` increments by 1. * * The current `revision` must be passed when adjusting points in the loyalty account. This * ensures you're working with the latest version of the loyalty account and prevents unintended overwrites. */ revision?: string; } /** * Retrieves an account using the loyalty account ID. * * The `getAccount()` function returns a Promise that resolves to the specified loyalty account when it is retrieved. * * You can also get an account using a secondary ID, such as a contact ID or a member ID with the [`getAccountBySecondaryId()`](wix-loyalty-v2/accounts/getaccountbysecondaryid) function. * * >**Note:** Only visitors with **Manage Loyalty** [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can retrieve a loyalty account. * @param _id - ID of the account to retrieve. * @public * @requiredField _id * @permissionId LOYALTY.READ_ACCOUNTS * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @returns Retrieved loyalty account. * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.GetAccount */ export declare function getAccount(_id: string): Promise; /** * Creates a query to retrieve a list of accounts. * * The `queryLoyaltyAccounts()` function builds a query to retrieve a list of events and returns a `LoyaltyAccountsQueryBuilder` 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 `LoyaltyAccountsQueryBuilder` functions onto the query. `LoyaltyAccountsQueryBuilder` functions enable you to sort, filter, and control the results `queryLoyaltyAccounts()` returns. * * `queryLoyaltyAccounts()` runs with these `LoyaltyAccountsQueryBuilder` defaults, which you can override: * * - skip(0) * - limit(50) * - descending("_createdDate") * * The functions that are chained to `queryLoyaltyAccounts()` are applied in the order they're called. For example, if you apply ascending('points.balance') and then descending('points.earned'), the results are sorted first by the balance, and then, if there are multiple results with the same balance, the items are sorted by earned points. * @public * @documentationMaturity preview * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @permissionId LOYALTY.READ_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.QueryLoyaltyAccounts */ export declare function queryLoyaltyAccounts(): LoyaltyAccountsQueryBuilder; interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } export interface LoyaltyAccountsQueryResult extends QueryCursorResult { items: LoyaltyAccount[]; query: LoyaltyAccountsQueryBuilder; next: () => Promise; prev: () => Promise; } export interface LoyaltyAccountsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ eq: (propertyName: '_id' | 'contactId' | 'memberId' | 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'tier.id' | 'contact.id' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: any) => LoyaltyAccountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ ne: (propertyName: '_id' | 'contactId' | 'memberId' | 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'tier.id' | 'contact.id' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: any) => LoyaltyAccountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ ge: (propertyName: 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: any) => LoyaltyAccountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ gt: (propertyName: 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: any) => LoyaltyAccountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ le: (propertyName: 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: any) => LoyaltyAccountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ lt: (propertyName: 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: any) => LoyaltyAccountsQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. * @documentationMaturity preview */ startsWith: (propertyName: '_id' | 'contactId' | 'memberId' | 'tier.id' | 'contact.id', value: string) => LoyaltyAccountsQueryBuilder; /** @param propertyName - Property whose value is compared with `values`. * @param values - List of values to compare against. * @documentationMaturity preview */ hasSome: (propertyName: '_id' | 'contactId' | 'memberId' | 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'tier.id' | 'contact.id' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: any[]) => LoyaltyAccountsQueryBuilder; /** @documentationMaturity preview */ in: (propertyName: '_id' | 'contactId' | 'memberId' | 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'tier.id' | 'contact.id' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: any) => LoyaltyAccountsQueryBuilder; /** @documentationMaturity preview */ exists: (propertyName: '_id' | 'contactId' | 'memberId' | 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'tier.id' | 'contact.id' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount', value: boolean) => LoyaltyAccountsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. * @documentationMaturity preview */ ascending: (...propertyNames: Array<'_id' | 'contactId' | 'memberId' | 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'tier.id' | 'contact.id' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount'>) => LoyaltyAccountsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. * @documentationMaturity preview */ descending: (...propertyNames: Array<'_id' | 'contactId' | 'memberId' | 'points.balance' | 'points.earned' | 'points.adjusted' | 'points.redeemed' | 'points.expired' | '_createdDate' | 'lastActivityDate' | 'tier.id' | 'contact.id' | 'pointsExpiration.expirationDate' | 'pointsExpiration.expiringPointsAmount'>) => LoyaltyAccountsQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. * @documentationMaturity preview */ limit: (limit: number) => LoyaltyAccountsQueryBuilder; /** @param cursor - A pointer to specific record * @documentationMaturity preview */ skipTo: (cursor: string) => LoyaltyAccountsQueryBuilder; /** @documentationMaturity preview */ find: () => Promise; } /** * Retrieves the total amount of points earned, redeemed, and adjusted for the entire loyalty program. * * The `getProgramTotals()` function returns a Promise that resolves to the combined total points for all loyalty accounts in the program. * * The `balance` is the current total of points outstanding, while the `earned`, `adjusted`, and `redeemed` amounts are the all-time accumulated amounts. The totals include the amounts for all loyalty accounts. * * >**Note:** Only visitors with **Manage Loyalty** [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can retrieve the loyalty program totals. * @public * @permissionId LOYALTY.READ_ACCOUNTS * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.GetProgramTotals */ export declare function getProgramTotals(): Promise; /** * Retrieves the currently logged-in member's account. * @public * @permissionId LOYALTY.READ_OWN_ACCOUNT * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @applicableIdentity MEMBER * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.GetCurrentMemberAccount */ export declare function getCurrentMemberAccount(): Promise; /** * Retrieves the loyalty account of the specified site contact or member. * * The `getAccountBySecondaryId()` function returns a Promise that resolves to the specified loyalty account when it is retrieved. * * This function gets a loyalty account using either a customer's contact ID or member ID. You can also get an account using the loyalty account ID with the [`getAccount()`](wix-loyalty-v2/accounts/getaccount) function. * * >**Note:** Only visitors with **Manage Loyalty** [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can retrieve a loyalty account. * @public * @param options - ID of the customer to retrieve loyalty account for. * @permissionId LOYALTY.READ_ACCOUNTS * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.GetAccountBySecondaryId */ export declare function getAccountBySecondaryId(options?: GetAccountBySecondaryIdOptions): Promise; export interface GetAccountBySecondaryIdOptions extends GetAccountBySecondaryIdRequestIdOneOf { /** Account owner's contact ID. See the [Contacts API](wix-crm-backend/contacts) to learn more. */ contactId?: string; /** Account owner's member ID. See the [Members API](wix-members-backend/introduction) to learn more. */ memberId?: string; } /** * > **Deprecation Notice** * > * > **This method has been replaced with [Query Loyalty Accounts](https://dev.wix.com/docs/sdk/backend-modules/loyalty/accounts/query-loyalty-accounts) and will be removed on June 30, 2025. If your app uses this method, we recommend updating your code as soon as possible.** * * Retrieves a list of loyalty accounts, given the provided filters. * * The `listAccounts()` function returns a Promise that resolves to a list of loyalty accounts. * * You can retrieve selected loyalty accounts with an array of `contactIds` or retrieve a list of all of a site's loyalty accounts * with an empty request parameter. Use the `cursorPaging` parameters to limit how many items load at a time. * * >**Note:** Only visitors with **Manage Loyalty** [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can retrieve loyalty accounts. * @public * @param options - Options to use when retrieving a list of loyalty accounts. * @permissionId LOYALTY.READ_ACCOUNTS * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.ListAccounts * @deprecated * @replacedBy QueryLoyaltyAccounts * @targetRemovalDate 2025-06-01 */ export declare function listAccounts(options?: ListAccountsOptions): Promise; export interface ListAccountsOptions { /** List of contact IDs. See the [Contacts API](wix-crm-backend/contacts) to learn more. */ contactIds?: string[]; /** Pagination options. */ cursorPaging?: CursorPaging; } /** * Retrieves a list of accounts, given the provided filters and search capabilities. * Search is executed on the account's name and email values. * @public * @permissionId LOYALTY.READ_ACCOUNTS * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @returns Accounts found through provided search capabilities, along with paging and aggregation data of the results. * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.SearchAccounts */ export declare function searchAccounts(options?: SearchAccountsOptions): Promise; export interface SearchAccountsOptions { /** Search options. */ search?: CursorSearch; } /** * Retrieves the count of found accounts, given the provided filters and search capabilities. * * This endpoint can help find the total count of accounts when used alongside [Search Accounts](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/search-accounts). * @public * @permissionId LOYALTY.READ_ACCOUNTS * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @returns Count of accounts found for given search query * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.CountAccounts */ export declare function countAccounts(options?: CountAccountsOptions): Promise; export interface CountAccountsOptions { /** Filter object. */ filter?: Record | null; /** Free text to match in searchable fields. */ search?: SearchDetails; } /** * Updates points balance of multiple accounts. * Depending on the BulkAdjustPointsRequest.type: * amount - provided amount of points is appended to the accounts balance * balance - accounts balance is set to the provided amount * * Returns id of the asyncInfra job that takes care of the points adjustment. * @public * @permissionId LOYALTY.MANAGE_ACCOUNTS * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.BulkAdjustPoints */ export declare function bulkAdjustPoints(options?: BulkAdjustPointsOptions): Promise; export interface BulkAdjustPointsOptions extends BulkAdjustPointsRequestTypeOneOf { search?: CursorSearch; balance?: number; amount?: number; } export {};