import * as _wix_sdk_types from '@wix/sdk-types'; import { QuerySpec, SearchSpec, Query, Search, NonNullablePaths } from '@wix/sdk-types'; /** * 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. */ interface LoyaltyAccount { /** * Account ID. * @format GUID * @readonly */ _id?: string; /** * Account owner's contact ID. See the Contacts API to learn more about a site's contacts. * @format GUID * @readonly */ contactId?: string; /** * Member ID of the account owner. See the Members API to learn more about a site's members. * @format GUID * @readonly */ memberId?: string | null; /** * Details of the account's point totals. * @readonly */ points?: Points; /** * Whether the account has enough points in `points.balance` 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; /** * Date and time of the account's last activity. * @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. * * See the Tiers API for more information. * @readonly */ tier?: Tier; /** * Contact information. * @readonly */ contact?: Contact; /** * Points expiration information. * @readonly */ pointsExpiration?: PointsExpiration; } /** Loyalty points information. */ interface Points { /** * Current points 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. * * See the Tiers API for more information. */ interface Tier { /** * Tier ID. * * This field will not be returned if the account belongs to the base tier. * @format GUID * @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. */ interface Contact { /** * Contact ID. * @format GUID * @readonly */ _id?: string | null; /** * Contact's first and last name. * @readonly */ name?: string | null; /** * Contact's profile picture. * @readonly */ picture?: Image; /** * Contact's email address. * @readonly * @format EMAIL */ email?: string | null; /** * Contact's first and last name. If no name is provided, uses contact's email. * @readonly */ displayName?: string | null; } interface Image { /** WixMedia image ID. */ _id?: string; /** Image URL. */ url?: string; /** * Original image height. * @readonly */ height?: number; /** * Original image width. * @readonly */ width?: number; } interface PointsExpiration { /** * Date and time at which points are expiring. * @readonly */ expirationDate?: Date | null; /** * Amount of points that are going to expire at that date. * @readonly */ expiringPointsAmount?: number; } interface RewardAvailabilityUpdated { /** True if rewards is available. */ rewardAvailable?: boolean; /** Source of this change. */ updateTrigger?: UpdateTriggerWithLiterals; } 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" } /** @enumType */ type UpdateTriggerWithLiterals = UpdateTrigger | 'UNDEFINED' | 'REWARD_UPDATED' | 'BALANCE_UPDATED' | 'TIERS_RECALCULATED'; interface CreateAccountRequest { /** * Contact ID for a site's contact. See the Contacts API for more information. * @format GUID */ contactId: string; } interface CreateAccountResponse { /** Created loyalty account. */ account?: LoyaltyAccount; } interface EarnPointsRequest extends EarnPointsRequestActivityDetailsOneOf { /** Followed social media details. */ followedSocialMedia?: FollowedSocialMedia; /** * Loyalty account ID. * @format GUID */ accountId: string; /** * Amount of points to earn. Must be a positive, whole number. * * Min: `1` * * Max: `9999999` * @min 1 * @max 9999999 */ amount?: number; /** * Description of how the points were earned. * * Max: 100 characters * @minLength 1 * @maxLength 100 */ 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`. * @minLength 1 * @maxLength 100 */ 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. * @minLength 1 * @maxLength 256 */ idempotencyKey: string; /** * Activity type. * * If points were earned through automation it should be set to the trigger key. * @maxLength 100 */ activityType?: string | null; /** * Order ID which was source of this transaction. * @maxLength 512 */ orderId?: string | null; /** * Whether the points amount was adjusted by an earn points limit provider. * @readonly */ limitApplied?: boolean; } /** @oneof */ interface EarnPointsRequestActivityDetailsOneOf { /** Followed social media details. */ followedSocialMedia?: FollowedSocialMedia; } interface FollowedSocialMedia { /** * Social media channel. * Example: `FACEBOOK`, `INSTAGRAM`. * @maxLength 32 */ channel?: string; } interface EarnPointsResponse { /** Updated loyalty account. */ account?: LoyaltyAccount; /** * Transaction ID associated with the points earned. * @format GUID * @readonly */ transactionId?: string; } interface PointsUpdated { /** Updated account. */ account?: LoyaltyAccount; } interface FirstTransaction { /** Updated account. */ account?: LoyaltyAccount; } 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` * @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` * @min -9999999 * @max 9999999 */ amount?: number; /** * Loyalty account ID. * @format GUID */ accountId: string; /** * Description to explain the reason for the points adjustment. * @minLength 1 * @maxLength 100 */ 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. * @min 1 */ revision?: string; } /** @oneof */ 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` * @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` * @min -9999999 * @max 9999999 */ amount?: number; } interface AdjustPointsResponse { /** Loyalty account. */ account?: LoyaltyAccount; /** * Transaction ID associated with the points adjustment. * @format GUID * @readonly */ transactionId?: string; } interface DeductPointsRequest { /** * Loyalty account ID. * @format GUID */ accountId?: string; /** * Amount of points to deduct. Must be a positive, whole number. * * Min: `1` * * Max: `9999999` * @min 1 * @max 9999999 */ amount?: number; /** * If true, the deduction will be reverted in case of failure in subsequent operations. * Points equal to the "amount" value will be given to the account instead of being taken away. */ revertDeduction?: boolean; } interface DeductPointsResponse { /** Updated loyalty account. */ account?: LoyaltyAccount; } interface RedeemPointsRequest { /** * Loyalty account ID. * @format GUID */ accountId?: string; /** * Reward ID. See the Rewards API for more details. * @format GUID */ rewardId?: string; /** * Number of times the given reward will be redeemed. Must be a positive whole number. * @min 1 */ 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. * @min 1 */ revision?: string; /** * ID of the entity that is being redeemed. * For example, the `orderId` for an order discount or the `couponId` for a coupon reward. * @format GUID */ referenceEntityId?: string | null; } interface RedeemPointsResponse { /** Loyalty account. */ account?: LoyaltyAccount; /** * Transaction ID associated with the redemption. * @format GUID * @readonly */ transactionId?: string; } interface RedeemDeterminedAmountOfPointsRequest { /** * Loyalty account ID. * @format GUID */ accountId?: string; /** * Reward ID. See the Rewards API for more details. * @format GUID */ rewardId?: string; /** * Number of points to be redeemed off the account. * @min 1 */ 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. * @min 1 */ revision?: string; /** * ID of the entity that is being redeemed. * For example, the `orderId` for an order discount or the `couponId` for a coupon reward. * @format GUID */ referenceEntityId?: string | null; } interface RedeemDeterminedAmountOfPointsResponse { /** Loyalty account. */ account?: LoyaltyAccount; /** * Transaction ID associated with the redemption. * @format GUID * @readonly */ transactionId?: string; } interface RefundTransactionRequest { /** * Transaction ID associated with the refund. * @format GUID * @readonly */ transactionId?: string; } interface RefundTransactionResponse { } interface GetAccountRequest { /** * ID of the account to retrieve. * @format GUID */ _id: string; } interface GetAccountResponse { /** Retrieved loyalty account. */ account?: LoyaltyAccount; } interface QueryLoyaltyAccountsRequest { /** * Filter object. * See [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language) for more information. */ query: CursorQuery; } 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 [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters). */ filter?: Record | null; /** * Sort object. * * Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting). * @maxSize 5 */ sort?: Sorting[]; } /** @oneof */ 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; } interface Sorting { /** * Name of the field to sort by. * @maxLength 512 */ fieldName?: string; /** Sort order. */ order?: SortOrderWithLiterals; } declare enum SortOrder { ASC = "ASC", DESC = "DESC" } /** @enumType */ type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC'; interface CursorPaging { /** * Maximum number of items to return in the results. * @max 100 */ 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. * @maxLength 16000 */ cursor?: string | null; } interface QueryLoyaltyAccountsResponse { /** Retrieved loyalty accounts. */ loyaltyAccounts?: LoyaltyAccount[]; /** Paging metadata */ pagingMetadata?: CursorPagingMetadata; } 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; } interface Cursors { /** * Cursor string pointing to the next page in the list of results. * @maxLength 16000 */ next?: string | null; /** * Cursor pointing to the previous page in the list of results. * @maxLength 16000 */ prev?: string | null; } interface ListUserAccountsRequest { /** * Number of items to load. Minimum `1`, maximum `50`. * @min 1 * @max 50 */ limit?: number | null; } interface ListUserAccountsResponse { /** Loyalty accounts. */ accounts?: LoyaltyAccountForMetaSite[]; } interface LoyaltyAccountForMetaSite { /** Loyalty account. */ account?: LoyaltyAccount; /** * Metasite ID. * @format GUID */ metaSiteId?: string; } interface GetProgramTotalsRequest { } interface GetProgramTotalsResponse { /** Point totals for the entire program. */ points?: Points; /** Tier total for the entire program. */ tierTotals?: TierTotal[]; } interface TierTotal { /** * Tier ID. If no Tier ID is provided, the ID is `null`. * See the base tier in the Tiers API for more information. * @format GUID * @readonly */ _id?: string | null; /** Total number of loyalty account that belong to a particular tier. */ numberOfAccounts?: number; } interface GetCurrentMemberAccountRequest { } interface GetCurrentMemberAccountResponse { /** Loyalty account. */ account?: LoyaltyAccount; } interface GetAccountBySecondaryIdRequest extends GetAccountBySecondaryIdRequestIdOneOf { /** * Account owner's contact ID. See the Contacts API for more information. * @maxLength 50 */ contactId?: string; /** * Account owner's member ID. See the Members API for more information. * @maxLength 50 */ memberId?: string; } /** @oneof */ interface GetAccountBySecondaryIdRequestIdOneOf { /** * Account owner's contact ID. See the Contacts API for more information. * @maxLength 50 */ contactId?: string; /** * Account owner's member ID. See the Members API for more information. * @maxLength 50 */ memberId?: string; } interface GetAccountBySecondaryIdResponse { /** Loyalty account. */ account?: LoyaltyAccount; } /** Options to use when retrieving a list of loyalty accounts. */ interface ListAccountsRequest { /** * List of contact IDs. * @format GUID * @maxSize 50 */ contactIds?: string[]; /** Pagination options. */ cursorPaging?: CursorPaging; } interface ListAccountsResponse { /** Retrieved loyalty accounts. */ accounts?: LoyaltyAccount[]; /** Details on the paged set of results returned. */ pagingMetadata?: PagingMetadataV2; } 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. */ interface SearchAccountsRequest { /** Search options. */ search?: CursorSearch; } 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 [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters). */ filter?: Record | null; /** * List of sort objects. * * Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting). * @maxSize 10 */ sort?: Sorting[]; /** * Logical groupings of data into facets, with summaries for each facet. For example, use aggregations to allow site visitors to narrow down their search results by selecting specific categories. * @maxSize 10 */ aggregations?: Aggregation[]; /** Free text to match in searchable fields. */ search?: SearchDetails; /** * Time zone to adjust date-time-based filters and aggregations, in ISO 8601 (including offsets) or IANA time zone database (including time zone IDs) format. * Applies to all relevant filters and aggregations, unless overridden by providing timestamps including time zone. For example, "2023-12-20T10:52:34.795Z". * @maxLength 50 */ timeZone?: string | null; } /** @oneof */ 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; } interface Aggregation extends AggregationKindOneOf { /** A value aggregation calculates metrics such as count for specific fields within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number (count) of products for each price listed in the store. */ value?: ValueAggregation; /** A range aggregation calculates the count of the values from the specified field in the dataset that fall within the range of each bucket you define. For example, use a range aggregation to compare the number of reservations made for parties of 4 or less to the number of reservations made for parties with 5 or more. */ range?: RangeAggregation; /** A scalar aggregation calculates a single numerical value from a dataset, summarizing the dataset into one key metric: `COUNT_DISTINCT`, `SUM`, `AVG`, `MIN`, or `MAX`. */ scalar?: ScalarAggregation; /** A date histogram calculates the count of time values from the specified field in the dataset that fall within each time interval you define (hour, day, week, etc.) For example, use a date histogram to find how many reservations have been made at a restaurant each week. */ dateHistogram?: DateHistogramAggregation; /** A nested aggregation is applied within the results of another aggregation. Rather than aggregating directly on the primary dataset, first group data using one aggregation and then apply another aggregation within each group. It allows for more complex analyses where you can summarize data at different levels of detail or hierarchy. For example, to get the number of products that are in stock and out of stock for each price listed, first perform a value aggregation on `discountedPriceNumeric`, and a second value aggregation on `inStock`. */ nested?: NestedAggregation; /** * Aggregation name, returned in `aggregations.results.name`. * @maxLength 100 */ name?: string | null; /** Type of aggregation to perform. Must align with the corresponding aggregation field. */ type?: AggregationTypeWithLiterals; /** * Field to aggregate by. Use dot notation to specify a JSON path. For example, `order.address.streetName`. * @maxLength 200 */ fieldPath?: string; /** * Deprecated. Use `nested` instead. * @deprecated Deprecated. Use `nested` instead. * @replacedBy kind.nested * @targetRemovalDate 2024-03-30 */ groupBy?: GroupByAggregation; } /** @oneof */ interface AggregationKindOneOf { /** A value aggregation calculates metrics such as count for specific fields within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number (count) of products for each price listed in the store. */ value?: ValueAggregation; /** A range aggregation calculates the count of the values from the specified field in the dataset that fall within the range of each bucket you define. For example, use a range aggregation to compare the number of reservations made for parties of 4 or less to the number of reservations made for parties with 5 or more. */ range?: RangeAggregation; /** A scalar aggregation calculates a single numerical value from a dataset, summarizing the dataset into one key metric: `COUNT_DISTINCT`, `SUM`, `AVG`, `MIN`, or `MAX`. */ scalar?: ScalarAggregation; /** A date histogram calculates the count of time values from the specified field in the dataset that fall within each time interval you define (hour, day, week, etc.) For example, use a date histogram to find how many reservations have been made at a restaurant each week. */ dateHistogram?: DateHistogramAggregation; /** A nested aggregation is applied within the results of another aggregation. Rather than aggregating directly on the primary dataset, first group data using one aggregation and then apply another aggregation within each group. It allows for more complex analyses where you can summarize data at different levels of detail or hierarchy. For example, to get the number of products that are in stock and out of stock for each price listed, first perform a value aggregation on `discountedPriceNumeric`, and a second value aggregation on `inStock`. */ nested?: NestedAggregation; } 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; } declare enum SortType { /** Number of matches in the results. */ COUNT = "COUNT", /** Alphabetically by the field value. */ VALUE = "VALUE" } /** @enumType */ type SortTypeWithLiterals = SortType | 'COUNT' | 'VALUE'; declare enum SortDirection { /** Descending order. */ DESC = "DESC", /** Ascending order. */ ASC = "ASC" } /** @enumType */ type SortDirectionWithLiterals = SortDirection | 'DESC' | 'ASC'; declare enum MissingValues { /** Exclude missing values from the aggregation results. */ EXCLUDE = "EXCLUDE", /** Include missing values in the aggregation results. */ INCLUDE = "INCLUDE" } /** @enumType */ type MissingValuesWithLiterals = MissingValues | 'EXCLUDE' | 'INCLUDE'; interface IncludeMissingValuesOptions { /** * Specify a custom name for the bucket containing the missing values. Defaults are `"N/A"` for strings, `0` for integers, and `false` for booleans. * @maxLength 20 */ addToBucket?: string; } declare enum ScalarType { /** Total number of distinct values. */ COUNT_DISTINCT = "COUNT_DISTINCT", /** Minimum value. */ MIN = "MIN", /** Maximum value. */ MAX = "MAX" } /** @enumType */ type ScalarTypeWithLiterals = ScalarType | 'COUNT_DISTINCT' | 'MIN' | 'MAX'; interface ValueAggregation extends ValueAggregationOptionsOneOf { /** Options for including missing values in results. */ includeOptions?: IncludeMissingValuesOptions; /** Sort type. */ sortType?: SortTypeWithLiterals; /** Sort direction. */ sortDirection?: SortDirectionWithLiterals; /** * Number of aggregation results to return. * Min: `1` * Max: `250` * Default: `10` */ limit?: number | null; /** * Whether to include or exclude missing values in the aggregation results. * Default: `EXCLUDE`. */ missingValues?: MissingValuesWithLiterals; } /** @oneof */ interface ValueAggregationOptionsOneOf { /** Options for including missing values in results. */ includeOptions?: IncludeMissingValuesOptions; } declare enum NestedAggregationType { /** Calculates the distribution of a specific field's values within a dataset, providing insights into the overall distribution and key statistics of those values. */ VALUE = "VALUE", /** Calculates the count of the values from the specified field in the dataset that fall within the range of each bucket you define. */ RANGE = "RANGE", /** Calculates a single numerical value from a dataset, summarizing the dataset into one key metric: `COUNT_DISTINCT`, `SUM`, `AVG`, `MIN`, or `MAX`. */ SCALAR = "SCALAR", /** Calculates the count of time values from the specified field in the dataset that fall within each time interval you define (hour, day, week, etc.). */ DATE_HISTOGRAM = "DATE_HISTOGRAM" } /** @enumType */ type NestedAggregationTypeWithLiterals = NestedAggregationType | 'VALUE' | 'RANGE' | 'SCALAR' | 'DATE_HISTOGRAM'; interface RangeAggregation { /** * List of range buckets. During aggregation each entity is placed in the first bucket its value falls into, based on the provided range bounds. * @maxSize 50 */ buckets?: RangeBucket[]; } interface ScalarAggregation { /** Operator type for the scalar aggregation. */ type?: ScalarTypeWithLiterals; } interface DateHistogramAggregation { /** Interval for date histogram aggregation. */ interval?: DateHistogramAggregationIntervalWithLiterals; } declare enum DateHistogramAggregationInterval { YEAR = "YEAR", MONTH = "MONTH", WEEK = "WEEK", DAY = "DAY", HOUR = "HOUR", MINUTE = "MINUTE", SECOND = "SECOND" } /** @enumType */ type DateHistogramAggregationIntervalWithLiterals = DateHistogramAggregationInterval | 'YEAR' | 'MONTH' | 'WEEK' | 'DAY' | 'HOUR' | 'MINUTE' | 'SECOND'; interface NestedAggregationItem extends NestedAggregationItemKindOneOf { /** A value aggregation calculates the distribution of a specific field's values within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number (count) of orders for each order status. */ value?: ValueAggregation; /** A range aggregation calculates the count of the values from the specified field in the dataset that fall within the range of each bucket you define. For example, use a range aggregation to compare the number of reservations made for parties of 4 or less to the number of reservations made for parties with 5 or more. If ranges overlap, a record that fits more than one range will only be counted in the first range that matches the criteria. */ range?: RangeAggregation; /** A scalar aggregation calculates a single numerical value from a dataset, summarizing the dataset into one key metric: `COUNT_DISTINCT`, `SUM`, `AVG`, `MIN`, or `MAX`. */ scalar?: ScalarAggregation; /** A date histogram calculates the count of time values from the specified field in the dataset that fall within each time interval you define (hour, day, week, etc.). For example, use a date histogram to determine how many reservations have been made at a restaurant each week. If ranges overlap, a record that fits more than one range will only be counted in the first range that matches the criteria. */ dateHistogram?: DateHistogramAggregation; /** * Unique, caller-defined aggregation name, returned in `aggregations.results`. * @maxLength 100 */ name?: string | null; /** Type of aggregation to perform. The matching aggregation field must be passed. */ type?: NestedAggregationTypeWithLiterals; /** * Field to aggregate by. Use dot notation to specify a JSON path. For example, `order.address.streetName`. * @maxLength 200 */ fieldPath?: string; } /** @oneof */ interface NestedAggregationItemKindOneOf { /** A value aggregation calculates the distribution of a specific field's values within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number (count) of orders for each order status. */ value?: ValueAggregation; /** A range aggregation calculates the count of the values from the specified field in the dataset that fall within the range of each bucket you define. For example, use a range aggregation to compare the number of reservations made for parties of 4 or less to the number of reservations made for parties with 5 or more. If ranges overlap, a record that fits more than one range will only be counted in the first range that matches the criteria. */ range?: RangeAggregation; /** A scalar aggregation calculates a single numerical value from a dataset, summarizing the dataset into one key metric: `COUNT_DISTINCT`, `SUM`, `AVG`, `MIN`, or `MAX`. */ scalar?: ScalarAggregation; /** A date histogram calculates the count of time values from the specified field in the dataset that fall within each time interval you define (hour, day, week, etc.). For example, use a date histogram to determine how many reservations have been made at a restaurant each week. If ranges overlap, a record that fits more than one range will only be counted in the first range that matches the criteria. */ dateHistogram?: DateHistogramAggregation; } declare enum AggregationType { /** Calculates the distribution of a specific field's values within a dataset, providing insights into the overall distribution and key statistics of those values. */ VALUE = "VALUE", /** Calculates the count of the values from the specified field in the dataset that fall within the range of each bucket you define. */ RANGE = "RANGE", /** Calculates a single numerical value from a dataset, summarizing the dataset into one key metric: `COUNT_DISTINCT`, `SUM`, `AVG`, `MIN`, or `MAX`. */ SCALAR = "SCALAR", /** Calculates the count of time values from the specified field in the dataset that fall within each time interval you define (hour, day, week, etc.). */ DATE_HISTOGRAM = "DATE_HISTOGRAM", /** Flattened list of aggregations, where each aggregation is nested within previous one. */ NESTED = "NESTED" } /** @enumType */ type AggregationTypeWithLiterals = AggregationType | 'VALUE' | 'RANGE' | 'SCALAR' | 'DATE_HISTOGRAM' | 'NESTED'; /** Nested aggregation expressed through a list of aggregation where each next aggregation is nested within previous one. */ interface NestedAggregation { /** * Flattened list of aggregations, where each aggregation is nested within previous one. * @minSize 2 * @maxSize 3 */ nestedAggregations?: NestedAggregationItem[]; } interface GroupByAggregation extends GroupByAggregationKindOneOf { /** Value aggregation configuration. */ value?: ValueAggregation; /** * Unique, caller-defined aggregation name, returned in `aggregations.results`. * @maxLength 100 */ name?: string | null; /** * Field to aggregate by. * @maxLength 200 */ fieldPath?: string; } /** @oneof */ interface GroupByAggregationKindOneOf { /** Value aggregation configuration. */ value?: ValueAggregation; } interface SearchDetails { /** Search mode. Defines the search logic for combining multiple terms in the `expression`. */ mode?: ModeWithLiterals; /** * Search term or expression. * @maxLength 100 */ expression?: string | null; /** * Fields to search in. If the array is empty, all searchable fields are searched. Use dot notation to specify a JSON path. For example, `order.address.streetName`. * @maxLength 200 * @maxSize 20 */ fields?: string[]; /** Whether to enable the search function to use an algorithm to automatically find results that are close to the search expression, such as typos and declensions. */ fuzzy?: boolean; } declare enum Mode { /** At least one of the search terms must be present. */ OR = "OR", /** All search terms must be present. */ AND = "AND" } /** @enumType */ type ModeWithLiterals = Mode | 'OR' | 'AND'; /** Accounts found through provided search capabilities, along with paging and aggregation data of the results. */ interface SearchAccountsResponse { /** Found accounts. */ accounts?: LoyaltyAccount[]; /** Paging metadata. */ pagingMetadata?: CursorPagingMetadata; /** Aggregation data */ aggregationData?: AggregationData; } interface AggregationData { /** * List of the aggregated data results. * @maxSize 10000 */ results?: AggregationResults[]; } interface ValueAggregationResult { /** * Value of the field. * @maxLength 100 */ value?: string; /** Number of entities with this value. */ count?: number; } interface RangeAggregationResult { /** Inclusive lower bound of the range. */ from?: number | null; /** Exclusive upper bound of the range. */ to?: number | null; /** Total number of entities in this range. */ count?: number; } interface NestedAggregationResults extends NestedAggregationResultsResultOneOf { /** Value aggregation results. */ values?: ValueResults; /** Range aggregation results. */ ranges?: RangeResults; /** Scalar aggregation results. */ scalar?: AggregationResultsScalarResult; /** * Unique, caller-defined aggregation name, identifiable by the requested aggregation `name`. * @maxLength 100 */ name?: string; /** Aggregation type. */ type?: AggregationTypeWithLiterals; /** * Field which the data was aggregated by. * @maxLength 200 */ fieldPath?: string; } /** @oneof */ interface NestedAggregationResultsResultOneOf { /** Value aggregation results. */ values?: ValueResults; /** Range aggregation results. */ ranges?: RangeResults; /** Scalar aggregation results. */ scalar?: AggregationResultsScalarResult; } interface ValueResults { /** * List of value aggregations. * @maxSize 250 */ results?: ValueAggregationResult[]; } interface RangeResults { /** * List of ranges returned in the same order as requested. * @maxSize 50 */ results?: RangeAggregationResult[]; } interface AggregationResultsScalarResult { /** Type of scalar aggregation. */ type?: ScalarTypeWithLiterals; /** Value of the scalar aggregation. */ value?: number; } interface NestedValueAggregationResult { /** * Value of the field. * @maxLength 1000 */ value?: string; /** Nested aggregations. */ nestedResults?: NestedAggregationResults; } interface ValueResult { /** * Value of the field. * @maxLength 1000 */ value?: string; /** Number of entities with this value. */ count?: number | null; } interface RangeResult { /** Inclusive lower bound of the range. */ from?: number | null; /** Exclusive upper bound of the range. */ to?: number | null; /** Number of entities in this range. */ count?: number | null; } interface ScalarResult { /** Value of the scalar aggregation. */ value?: number; } interface ScalarDateResult { /** * Date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * @maxLength 100 */ value?: string; } 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; /** Scalar date aggregation result. */ scalarDate?: ScalarDateResult; } /** @oneof */ interface NestedResultValueResultOneOf { /** Value aggregation result. */ value?: ValueResult; /** Range aggregation result. */ range?: RangeResult; /** Scalar aggregation result. */ scalar?: ScalarResult; /** Date histogram aggregation result. */ dateHistogram?: ValueResult; /** Scalar date aggregation result. */ scalarDate?: ScalarDateResult; } interface Results { /** List of nested aggregations. */ results?: Record; } interface DateHistogramResult { /** * Date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * @maxLength 100 */ value?: string; /** Number of entities in the bucket. */ count?: number; } interface GroupByValueResults { /** * List of value aggregations. * @maxSize 1000 */ results?: NestedValueAggregationResult[]; } interface DateHistogramResults { /** * List of date histogram aggregations. * @maxSize 200 */ results?: DateHistogramResult[]; } /** Results of `NESTED` aggregation type in a flattened array, identifiable by the requested aggregation `name`. */ interface NestedResults { /** * List of nested aggregations. * @maxSize 1000 */ results?: Results[]; } interface AggregationResultsScalarDateResult { /** Type of scalar date aggregation. Possible values: `MIN`, `MAX`. */ type?: ScalarTypeWithLiterals; /** * Date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * @maxLength 100 */ value?: string; } 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; /** Date aggregation results. */ scalarDate?: AggregationResultsScalarDateResult; /** * Aggregation name, returned in `aggregations.results.name`. * @maxLength 100 */ name?: string; /** Aggregation type. Must align with the corresponding aggregation field. */ type?: AggregationTypeWithLiterals; /** * Field to aggregate by. Use dot notation to specify a JSON path. For example, `order.address.streetName`. * @maxLength 200 */ fieldPath?: string; } /** @oneof */ 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; /** Date aggregation results. */ scalarDate?: AggregationResultsScalarDateResult; } interface ExportAccountsRequest { query?: QueryV2; } interface QueryV2 extends QueryV2PagingMethodOneOf { /** Paging options to limit and offset 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 [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters). */ filter?: Record | null; /** * Sort object. * * Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting). */ 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 */ interface QueryV2PagingMethodOneOf { /** Paging options to limit and offset 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; } interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } interface ExportAccountsResponse { accounts?: LoyaltyAccount[]; pagingMetadata?: CursorPagingMetadata; } /** Options to use when retrieving amount of loyalty accounts. */ interface CountAccountsRequest { /** Filter object. */ filter?: Record | null; /** Free text to match in searchable fields. */ search?: SearchDetails; } /** Amount of accounts found for the given search query */ interface CountAccountsResponse { count?: number; } interface BulkAdjustPointsRequest extends BulkAdjustPointsRequestTypeOneOf { /** @max 999999999 */ balance?: number; /** * @min -9999999 * @max 9999999 */ amount?: number; search?: CursorSearch; } /** @oneof */ interface BulkAdjustPointsRequestTypeOneOf { /** @max 999999999 */ balance?: number; /** * @min -9999999 * @max 9999999 */ amount?: number; } interface BulkAdjustPointsResponse { /** * ID of the job. * * Use this ID to call [Get Async Job](https://dev.wix.com/docs/api-reference/business-management/async-job/get-async-job) * to retrieve the job details and metadata. * @format GUID * @readonly */ asyncJobId?: string | null; } interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** Event ID. With this ID you can easily spot duplicated events and ignore them. */ _id?: string; /** * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`. */ entityFqdn?: string; /** * Event action name, placed at the top level to make it easier for users to dispatch messages. * For 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 that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number. * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it. */ entityEventSequence?: string | null; } /** @oneof */ interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } interface EntityCreatedEvent { entity?: string; } interface RestoreInfo { deletedDate?: Date | null; } 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; } interface EntityDeletedEvent { /** Entity that was deleted. */ deletedEntity?: string | null; } interface ActionEvent { body?: string; } interface Empty { } interface TiersRollingUpdate { } interface TiersProgramSettingsChanged { /** Settings for the tiers program. */ programSettings?: TiersProgramSettings; } /** Tiers program settings apply globally to all tiers in the program. A site can only have 1 set of program settings. */ 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?: StatusWithLiterals; /** * 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. * @immutable */ 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's unassigned for not meeting * the required points threshold of any other tier. */ baseTierDefinition?: TierDefinition; } /** @oneof */ 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; } 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" } /** @enumType */ type StatusWithLiterals = Status | 'UNKNOWN' | 'DISABLED' | 'DRAFT' | 'ACTIVE' | 'PAUSED'; /** Information about the tier. */ interface TierDefinition { /** Details about the tier icon. */ icon?: string; /** * Tier name. * @minLength 1 * @maxLength 50 */ name?: string | null; /** * Tier description. * @maxLength 70 */ description?: string | null; } 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. */ interface RollingWindow { /** * Number of months to use for the rolling window period. * * Min: `12` * * Max: `36` * @min 1 * @max 36 */ durationInMonths?: number; } 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. * @format GUID */ 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 */ 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. */ 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. */ interface Subscription { /** * ID of the subscription. * @format GUID */ _id?: string; /** * ID of the Wix account that purchased the subscription. * @format GUID */ 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. * @format GUID */ 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. * @format GUID */ 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?: SubscriptionStatusWithLiterals; /** * 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. * @format GUID */ 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; /** * Seats of the product that the subscription was purchased for. * Will be Null for products that don't support seats. * @min 1 * @max 500 */ seats?: number | null; } 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?: ProviderNameWithLiterals; /** Current provider reference ID. */ providerReferenceId?: string | null; /** Previous provider reference IDs. Used for when a subscription is extended, specifically for domains. */ previousProviderReferenceIds?: string[]; } declare enum ProviderName { UNKNOWN = "UNKNOWN", SBS = "SBS", LICENSER = "LICENSER", BASS = "BASS", RESELLER = "RESELLER", RECURRING_INVOICES = "RECURRING_INVOICES" } /** @enumType */ type ProviderNameWithLiterals = ProviderName | 'UNKNOWN' | 'SBS' | 'LICENSER' | 'BASS' | 'RESELLER' | 'RECURRING_INVOICES'; interface Cycle extends CycleCycleSelectorOneOf { /** repetitive interval */ interval?: Interval; /** one time */ oneTime?: OneTime; } /** @oneof */ interface CycleCycleSelectorOneOf { /** repetitive interval */ interval?: Interval; /** one time */ oneTime?: OneTime; } interface Interval { /** interval unit of measure */ unit?: IntervalUnitWithLiterals; /** number of interval */ count?: number; } declare enum IntervalUnit { /** unknown interval unit */ UNKNOWN = "UNKNOWN", /** day */ DAY = "DAY", /** week */ WEEK = "WEEK", /** month */ MONTH = "MONTH", /** year */ YEAR = "YEAR" } /** @enumType */ type IntervalUnitWithLiterals = IntervalUnit | 'UNKNOWN' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR'; interface OneTime { } 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" } /** @enumType */ type SubscriptionStatusWithLiterals = SubscriptionStatus | 'UNKNOWN' | 'AUTO_RENEW_ON' | 'AUTO_RENEW_OFF' | 'MANUAL_RECURRING' | 'CANCELLED' | 'TRANSFERRED'; /** Triggered when a subscription is reactivated. */ interface ReactivationData { reactivationReason?: ReactivationReasonEnumWithLiterals; /** * 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 */ 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" } /** @enumType */ type ReactivationReasonEnumWithLiterals = ReactivationReasonEnum | 'UNKNOWN' | 'BILLING_STATUS_CHANGE' | '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. */ interface SubscriptionAssigned { /** Assigned subscription. */ subscription?: Subscription; /** * ID of the metasite that the subscription has been assigned to before the update. * @format GUID */ previousMetaSiteId?: string | null; } /** Triggered when a subscription is canceled. */ 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; /** The type of refund applied to the cancellation. */ refundType?: RefundTypeWithLiterals; } /** Information about the cancellation flow including who canceled the subscription and why it was canceled. */ 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://dev.wix.com/docs/rest/account-level/premium/premium-subscriptions-manager/subscription-v1/cancel-immediately) * or [Cancel Immediately Offline](https://dev.wix.com/docs/rest/account-level/premium/premium-subscriptions-manager/subscription-v1/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?: InitiatorWithLiterals; } declare enum Initiator { UNKNOWN = "UNKNOWN", USER_REQUESTED = "USER_REQUESTED", APP_MANAGED = "APP_MANAGED", PASSIVE = "PASSIVE" } /** @enumType */ type InitiatorWithLiterals = Initiator | 'UNKNOWN' | 'USER_REQUESTED' | 'APP_MANAGED' | 'PASSIVE'; declare enum RefundType { UNKNOWN = "UNKNOWN", NO_REFUND = "NO_REFUND", FULL_REFUND = "FULL_REFUND", PRORATED_REFUND = "PRORATED_REFUND" } /** @enumType */ type RefundTypeWithLiterals = RefundType | 'UNKNOWN' | 'NO_REFUND' | 'FULL_REFUND' | 'PRORATED_REFUND'; /** Triggered when the subscription's auto renew is turned on. */ 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. */ 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. */ interface SubscriptionUnassigned { /** Unassigned subscription. */ subscription?: Subscription; /** * ID of the metasite that the subscription has been assigned to before the event. * @format GUID */ 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?: UnassignReasonWithLiterals; } declare enum UnassignReason { UNKNOWN = "UNKNOWN", USER_REQUESTED = "USER_REQUESTED", REPLACED_BY_ANOTHER_SUBSCRIPTION = "REPLACED_BY_ANOTHER_SUBSCRIPTION" } /** @enumType */ type UnassignReasonWithLiterals = UnassignReason | 'UNKNOWN' | 'USER_REQUESTED' | '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. */ 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. */ 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. */ interface ContractSwitched { /** Updated subscription. */ subscription?: Subscription; /** Billing cycle before the update. */ previousCycle?: Cycle; /** * ID of the product belonging to the subscription before the update. * @format GUID */ previousProductId?: string; /** * ID of the product type that the subscription's original product belonged to before the update. * @format GUID */ 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?: ContractSwitchTypeWithLiterals; /** * ID of the metasite the subscription has been assigned to previously. * Available only in case the subscription is assigned to a different site. * @format GUID */ 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?: ContractSwitchReasonWithLiterals; /** 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?: ProductAdjustmentWithLiterals; /** * Number of seats before the contract switch. * @min 1 * @max 500 */ previousSeats?: number | null; } /** Copied from SBS */ 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", FIXED_BILLING_DATE_PRORATION = "FIXED_BILLING_DATE_PRORATION", IMMEDIATE_SWITCH = "IMMEDIATE_SWITCH" } /** @enumType */ type ContractSwitchTypeWithLiterals = ContractSwitchType | 'NOT_APPLICABLE' | 'ADDITIONAL_QUANTITY' | 'CREDIT_UNUSED_PERIOD' | 'REFUND_PRICE_DIFF' | 'ADJUST_PERIOD_END' | 'DOWNGRADE_GRACE_PERIOD' | 'FULL_AMOUNT_PERIOD' | 'END_OF_PERIOD' | 'PENDING_CHANGES' | 'DOWNGRADE_RENEWAL' | 'FIXED_BILLING_DATE_PRORATION' | 'IMMEDIATE_SWITCH'; declare enum ContractSwitchReason { EXTERNAL_PROVIDER_TRIGGER = "EXTERNAL_PROVIDER_TRIGGER", PRICE_INCREASE = "PRICE_INCREASE" } /** @enumType */ type ContractSwitchReasonWithLiterals = ContractSwitchReason | 'EXTERNAL_PROVIDER_TRIGGER' | 'PRICE_INCREASE'; /** Triggered when a subscription's price is increased. */ interface ProductPriceIncreaseData { /** * Price of the subscription before the update. * @format DECIMAL_VALUE */ 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?: PriceIncreaseTriggerWithLiterals; } /** Reason for Price Increase Trigger */ declare enum PriceIncreaseTrigger { NEAR_RENEWAL = "NEAR_RENEWAL", RECURRING_SUCCESS = "RECURRING_SUCCESS", MANUAL = "MANUAL" } /** @enumType */ type PriceIncreaseTriggerWithLiterals = PriceIncreaseTrigger | 'NEAR_RENEWAL' | 'RECURRING_SUCCESS' | 'MANUAL'; /** Triggered when a subscription's product is adusted. */ 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" } /** @enumType */ type ProductAdjustmentWithLiterals = ProductAdjustment | 'NOT_APPLICABLE' | '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. */ 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. */ interface SubscriptionPendingChange { /** Subscription for which a pending update is triggered. */ subscription?: Subscription; } /** Triggered when a recurring charge attempt failed for a subscription. */ interface RecurringChargeAttemptFailed { /** Subscription for which the recurring charge attempt has failed. */ subscription?: Subscription; } interface ContactSyncRequest { /** @format GUID */ contactIds?: string[]; /** @format GUID */ contactId?: string | null; } interface BulkUpsertAccountsRequest { /** * List of contactIds + points to either insert as new loyalty accounts, or update if contacts already exist as loyalty accounts * @minSize 1 * @maxSize 100 */ 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; } interface AccountToUpsert { /** @format GUID */ contactId?: string; /** @max 9999999 */ pointsBalance?: number; } interface BulkUpsertAccountsResponse { /** Loyalty accounts that were created or updated */ result?: BulkAccountResult[]; /** Numbers of successes and failures */ metadata?: BulkActionMetadata; } interface BulkAccountResult { /** The created/updated account is returned if specified so in request message. */ account?: LoyaltyAccount; /** LoyaltyAccount metadata. */ metadata?: ItemMetadata; } 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; } interface ApplicationError { /** Error code. */ code?: string; /** Description of the error. */ description?: string; /** Data related to the error. */ data?: Record | null; } 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; } interface MessageEnvelope { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; /** Details related to the account */ accountInfo?: AccountInfo; } interface IdentificationData extends IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; /** @readonly */ identityType?: WebhookIdentityTypeWithLiterals; } /** @oneof */ interface IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; } declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } /** @enumType */ type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP'; interface AccountInfo { /** * ID of the Wix account associated with the event. * @format GUID */ accountId?: string | null; /** * ID of the parent Wix account. Only included when accountId belongs to a child account. * @format GUID */ parentAccountId?: string | null; /** * ID of the Wix site associated with the event. Only included when the event is tied to a specific site. * @format GUID */ siteId?: string | null; } interface BaseEventMetadata { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Details related to the account */ accountInfo?: AccountInfo; } interface EventMetadata extends BaseEventMetadata { /** Event ID. With this ID you can easily spot duplicated events and ignore them. */ _id?: string; /** * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`. */ entityFqdn?: string; /** * Event action name, placed at the top level to make it easier for users to dispatch messages. * For 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 that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number. * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it. */ entityEventSequence?: string | null; accountInfo?: AccountInfoMetadata; } interface AccountInfoMetadata { /** ID of the Wix account associated with the event */ accountId: string; /** ID of the Wix site associated with the event. Only included when the event is tied to a specific site. */ siteId?: string; /** ID of the parent Wix account. Only included when 'accountId' belongs to a child account. */ parentAccountId?: string; } 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 * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionId LOYALTY.READ_ACCOUNTS * @webhook * @eventType wix.loyalty.v1.account_created * @serviceIdentifier com.wixpress.loyalty.account.LoyaltyAccounts * @slug created */ declare function onAccountCreated(handler: (event: AccountCreatedEnvelope) => void | Promise): void; 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 * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionId LOYALTY.READ_ACCOUNTS * @webhook * @eventType wix.loyalty.v1.account_points_updated * @serviceIdentifier com.wixpress.loyalty.account.LoyaltyAccounts * @slug points_updated */ declare function onAccountPointsUpdated(handler: (event: AccountPointsUpdatedEnvelope) => void | Promise): void; interface AccountRewardAvailabilityUpdatedEnvelope { data: RewardAvailabilityUpdated; metadata: EventMetadata; } /** * Triggered when `rewardAvailable` updates on a loyalty account. * @permissionScope Read Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY * @permissionScope Manage Loyalty * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionId LOYALTY.READ_ACCOUNTS * @webhook * @eventType wix.loyalty.v1.account_reward_availability_updated * @serviceIdentifier com.wixpress.loyalty.account.LoyaltyAccounts * @slug reward_availability_updated */ declare function onAccountRewardAvailabilityUpdated(handler: (event: AccountRewardAvailabilityUpdatedEnvelope) => void | Promise): void; 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 * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionId LOYALTY.READ_ACCOUNTS * @webhook * @eventType wix.loyalty.v1.account_updated * @serviceIdentifier com.wixpress.loyalty.account.LoyaltyAccounts * @slug updated */ declare function onAccountUpdated(handler: (event: AccountUpdatedEnvelope) => void | Promise): void; /** * Creates a loyalty account for a site contact. * * To create a new loyalty account, a customer must first be a site contact with a contact ID, see the Contacts API. * The site must also have an [active loyalty program](https://dev.wix.com/docs/rest/crm/loyalty-program/program/activate-loyalty-program) * before loyalty accounts can be created. * @param contactId - Contact ID for a site's contact. See the Contacts API for more information. * @public * @requiredField contactId * @permissionId LOYALTY.MANAGE_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.CreateAccount */ declare function createAccount(contactId: string): Promise>; /** * Adds points to a loyalty account. * * Only a positive amount can be added using this method. To adjust an account's balance * for a negative amount, use Adjust Points. * * This method allows customers to manually earn points to their loyalty accounts. To use this method 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, then, * the `appId` automatically sets to the source app that generates the points. In both cases, the transaction `type` is `"EARN"`. * @param accountId - Loyalty account ID. * @public * @requiredField accountId * @requiredField options.appId * @requiredField options.idempotencyKey * @param options - Earn points info. * @permissionId LOYALTY.MANAGE_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.EarnPoints */ declare function earnPoints(accountId: string, options?: NonNullablePaths): Promise>; interface EarnPointsOptions extends EarnPointsOptionsActivityDetailsOneOf { /** * Amount of points to earn. Must be a positive, whole number. * * Min: `1` * * Max: `9999999` * @min 1 * @max 9999999 */ amount?: number; /** * Description of how the points were earned. * * Max: 100 characters * @minLength 1 * @maxLength 100 */ 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`. * @minLength 1 * @maxLength 100 */ 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. * @minLength 1 * @maxLength 256 */ idempotencyKey: string; /** * Activity type. * * If points were earned through automation it should be set to the trigger key. * @maxLength 100 */ activityType?: string | null; /** * Order ID which was source of this transaction. * @maxLength 512 */ orderId?: string | null; /** * Whether the points amount was adjusted by an earn points limit provider. * @readonly */ limitApplied?: boolean; /** Followed social media details. */ followedSocialMedia?: FollowedSocialMedia; } /** @oneof */ interface EarnPointsOptionsActivityDetailsOneOf { /** Followed social media details. */ followedSocialMedia?: FollowedSocialMedia; } /** * Adjusts the point balance of a loyalty account. * * You can adjust the balance in two ways: * - `balance` allows you to set the total points balance to this new amount. The transaction `type` will return as `"ADJUST"`. * - `amount` allows you to adjust 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 result in a negative balance. If you pass an integer in both the `balance` and the `amount` parameters then the `balance` adjustment takes effect and the * `amount` adjustment is ignored. * @param accountId - Loyalty account ID. * @public * @requiredField accountId * @param options - Options to use when adjusting points. * @permissionId LOYALTY.MANAGE_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.AdjustPoints */ declare function adjustPoints(accountId: string, options?: AdjustPointsOptions): Promise>; interface AdjustPointsOptions extends AdjustPointsOptionsTypeOneOf { /** * Description to explain the reason for the points adjustment. * @minLength 1 * @maxLength 100 */ 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` * @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` * @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. * @min 1 */ revision?: string; } /** @oneof */ interface AdjustPointsOptionsTypeOneOf { /** * 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` * @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` * @min -9999999 * @max 9999999 */ amount?: number; } /** * Retrieves a loyalty account by ID. * * You can also retrieve an account using a secondary ID, such as a contact ID or a member ID by calling * Get Account by Secondary ID. * @param _id - ID of the account to retrieve. * @public * @requiredField _id * @permissionId LOYALTY.READ_ACCOUNTS * @applicableIdentity APP * @returns Retrieved loyalty account. * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.GetAccount */ declare function getAccount(_id: string): Promise>; /** * Creates a query to retrieve a list of accounts. * * The `queryLoyaltyAccounts()` method 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()` method. * * You can refine the query by chaining `LoyaltyAccountsQueryBuilder` methods onto the query. `LoyaltyAccountsQueryBuilder` methods 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 methods 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 * @permissionId LOYALTY.READ_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.QueryLoyaltyAccounts */ declare function queryLoyaltyAccounts(): LoyaltyAccountsQueryBuilder; interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } interface LoyaltyAccountsQueryResult extends QueryCursorResult { items: LoyaltyAccount[]; query: LoyaltyAccountsQueryBuilder; next: () => Promise; prev: () => Promise; } interface LoyaltyAccountsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ 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. */ 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. */ ge: (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. */ gt: (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. */ le: (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. */ lt: (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 `string`. * @param string - String to compare against. Case-insensitive. */ 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. */ 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; 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; 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. */ 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. */ 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. */ limit: (limit: number) => LoyaltyAccountsQueryBuilder; /** @param cursor - A pointer to specific record */ skipTo: (cursor: string) => LoyaltyAccountsQueryBuilder; find: () => Promise; } /** * @hidden * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.QueryLoyaltyAccounts * @requiredField query */ declare function typedQueryLoyaltyAccounts(query: LoyaltyAccountQuery): Promise>; interface LoyaltyAccountQuerySpec extends QuerySpec { paging: 'cursor'; wql: [ { fields: [ '_createdDate', '_id', 'contactId', 'lastActivityDate', 'memberId', 'points.adjusted', 'points.balance', 'points.earned', 'points.expired', 'points.redeemed', 'pointsExpiration.expirationDate', 'pointsExpiration.expiringPointsAmount', 'tier._id' ]; operators: '*'; sort: 'BOTH'; } ]; } type CommonQueryWithEntityContext = Query; type LoyaltyAccountQuery = { /** Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging). */ cursorPaging?: { /** Maximum number of items to return in the results. @max: 100 */ limit?: NonNullable['limit'] | 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. @maxLength: 16000 */ cursor?: NonNullable['cursor'] | null; }; /** Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters). */ filter?: CommonQueryWithEntityContext['filter'] | null; /** Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting). @maxSize: 5 */ sort?: { /** Name of the field to sort by. @maxLength: 512 */ fieldName?: NonNullable[number]['fieldName']; /** Sort order. */ order?: NonNullable[number]['order']; }[]; }; declare const utils: { query: { QueryBuilder: () => _wix_sdk_types.QueryBuilder; Filter: _wix_sdk_types.FilterFactory; Sort: _wix_sdk_types.SortFactory; }; search: { SearchBuilder: () => _wix_sdk_types.SearchBuilder; Filter: _wix_sdk_types.FilterFactory; Sort: _wix_sdk_types.SortFactory; SearchParams: _wix_sdk_types.SearchParamsFactory; Aggregation: _wix_sdk_types.AggregationFactory; }; }; /** * Retrieves the total amount of points earned, redeemed, and adjusted for the entire loyalty 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. * @public * @permissionId LOYALTY.READ_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.GetProgramTotals */ declare function getProgramTotals(): Promise>; /** * Retrieves the current member's loyalty account. * @public * @permissionId LOYALTY.READ_OWN_ACCOUNT * @applicableIdentity APP * @applicableIdentity MEMBER * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.GetCurrentMemberAccount */ declare function getCurrentMemberAccount(): Promise>; /** * Retrieves the account belonging to the specified contact or member. * * This method retrieves loyalty accounts using either a customer's contact ID or member ID. You can also retrieve an account * using the loyalty account ID with Get Account. * @public * @requiredField options * @requiredField options._id * @param options - ID of the customer to retrieve loyalty account for. * @permissionId LOYALTY.READ_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.GetAccountBySecondaryId */ declare function getAccountBySecondaryId(options: GetAccountBySecondaryIdOptions): Promise>; interface GetAccountBySecondaryIdOptions extends GetAccountBySecondaryIdOptionsIdOneOf { /** * Account owner's contact ID. See the Contacts API for more information. * @maxLength 50 */ contactId?: string; /** * Account owner's member ID. See the Members API for more information. * @maxLength 50 */ memberId?: string; } /** @oneof */ interface GetAccountBySecondaryIdOptionsIdOneOf { /** * Account owner's contact ID. See the Contacts API for more information. * @maxLength 50 */ contactId?: string; /** * Account owner's member ID. See the Members API for more information. * @maxLength 50 */ memberId?: string; } /** * Retrieves a list of accounts, given the provided filters. * * 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. * * Deprecated method, please use Query Loyalty Accounts or Search Accounts instead. * @public * @param options - Options to use when retrieving a list of loyalty accounts. * @permissionId LOYALTY.READ_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.ListAccounts * @deprecated * @replacedBy com.wixpress.loyalty.account.LoyaltyAccounts.QueryLoyaltyAccounts * @targetRemovalDate 2025-06-30 */ declare function listAccounts(options?: ListAccountsOptions): Promise>; interface ListAccountsOptions { /** * List of contact IDs. * @format GUID * @maxSize 50 */ contactIds?: string[]; /** Pagination options. */ cursorPaging?: CursorPaging; } interface LoyaltyAccountSearchSpec extends SearchSpec { searchable: ['contact.email', 'contact.name']; aggregatable: [ '_updatedDate', 'contact._id', 'lastActivityDate', 'points.balance', 'points.redeemed', 'pointsExpiration.expirationDate' ]; paging: 'cursor'; wql: [ { operators: '*'; fields: [ '_updatedDate', 'contact._id', 'contact.displayName', 'contact.email', 'contact.name', 'lastActivityDate', 'points.balance', 'points.redeemed', 'pointsExpiration.expirationDate' ]; sort: 'BOTH'; } ]; } type CommonSearchWithEntityContext = Search; type LoyaltyAccountSearch = { /** Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging). */ cursorPaging?: { /** Maximum number of items to return in the results. @max: 100 */ limit?: NonNullable['limit'] | 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. @maxLength: 16000 */ cursor?: NonNullable['cursor'] | null; }; /** Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters). */ filter?: CommonSearchWithEntityContext['filter'] | null; /** List of sort objects. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting). @maxSize: 10 */ sort?: { /** Name of the field to sort by. @maxLength: 512 */ fieldName?: NonNullable[number]['fieldName']; /** Sort order. */ order?: NonNullable[number]['order']; }[]; /** Logical groupings of data into facets, with summaries for each facet. For example, use aggregations to allow site visitors to narrow down their search results by selecting specific categories. @maxSize: 10 */ aggregations?: { /** A value aggregation calculates metrics such as count for specific fields within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number (count) of products for each price listed in the store. */ value?: NonNullable[number]['value']; /** A range aggregation calculates the count of the values from the specified field in the dataset that fall within the range of each bucket you define. For example, use a range aggregation to compare the number of reservations made for parties of 4 or less to the number of reservations made for parties with 5 or more. */ range?: NonNullable[number]['range']; /** A scalar aggregation calculates a single numerical value from a dataset, summarizing the dataset into one key metric: `COUNT_DISTINCT`, `SUM`, `AVG`, `MIN`, or `MAX`. */ scalar?: NonNullable[number]['scalar']; /** A date histogram calculates the count of time values from the specified field in the dataset that fall within each time interval you define (hour, day, week, etc.) For example, use a date histogram to find how many reservations have been made at a restaurant each week. */ dateHistogram?: NonNullable[number]['dateHistogram']; /** A nested aggregation is applied within the results of another aggregation. Rather than aggregating directly on the primary dataset, first group data using one aggregation and then apply another aggregation within each group. It allows for more complex analyses where you can summarize data at different levels of detail or hierarchy. For example, to get the number of products that are in stock and out of stock for each price listed, first perform a value aggregation on `discountedPriceNumeric`, and a second value aggregation on `inStock`. */ nested?: NonNullable[number]['nested']; /** Aggregation name, returned in `aggregations.results.name`. @maxLength: 100 */ name?: NonNullable[number]['name'] | null; /** Type of aggregation to perform. Must align with the corresponding aggregation field. */ type?: NonNullable[number]['type']; /** Field to aggregate by. Use dot notation to specify a JSON path. For example, `order.address.streetName`. @maxLength: 200 */ fieldPath?: NonNullable[number]['fieldPath']; /** Deprecated. Use `nested` instead. @deprecated: Deprecated. Use `nested` instead., @replacedBy: kind.nested, @targetRemovalDate: 2024-03-30 */ groupBy?: NonNullable[number]['groupBy']; }[]; /** Free text to match in searchable fields. */ search?: { /** Search mode. Defines the search logic for combining multiple terms in the `expression`. */ mode?: NonNullable['mode']; /** Search term or expression. @maxLength: 100 */ expression?: NonNullable['expression'] | null; /** Fields to search in. If the array is empty, all searchable fields are searched. Use dot notation to specify a JSON path. For example, `order.address.streetName`. @maxLength: 200, @maxSize: 20 */ fields?: NonNullable['fields']; /** Whether to enable the search function to use an algorithm to automatically find results that are close to the search expression, such as typos and declensions. */ fuzzy?: NonNullable['fuzzy']; }; /** Time zone to adjust date-time-based filters and aggregations, in ISO 8601 (including offsets) or IANA time zone database (including time zone IDs) format. Applies to all relevant filters and aggregations, unless overridden by providing timestamps including time zone. For example, "2023-12-20T10:52:34.795Z". @maxLength: 50 */ timeZone?: CommonSearchWithEntityContext['timeZone'] | null; }; /** * Retrieves the count of found accounts, given the provided filters and search capabilities. * * Use with Search Accounts to retrieve the total amount of loyalty accounts on a site. * @public * @permissionId LOYALTY.READ_ACCOUNTS * @applicableIdentity APP * @returns Amount of accounts found for the given search query * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.CountAccounts */ declare function countAccounts(options?: CountAccountsOptions): Promise>; interface CountAccountsOptions { /** Filter object. */ filter?: Record | null; /** Free text to match in searchable fields. */ search?: SearchDetails; } /** * Updates the points balance of multiple accounts. * * You can adjust the balance in two ways: * - `balance` allows you to set the total points balance to this new amount. The transaction `type` will return as `"ADJUST"`. * - `amount` allows you to adjust 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"`. * * You can use the job ID from the response to call [Get Async Job](https://dev.wix.com/docs/api-reference/business-management/async-job/get-async-job) * to retrieve the job details and metadata. * @public * @permissionId LOYALTY.MANAGE_ACCOUNTS * @applicableIdentity APP * @fqn com.wixpress.loyalty.account.LoyaltyAccounts.BulkAdjustPoints */ declare function bulkAdjustPoints(options?: BulkAdjustPointsOptions): Promise; interface BulkAdjustPointsOptions extends BulkAdjustPointsOptionsTypeOneOf { search?: CursorSearch; /** @max 999999999 */ balance?: number; /** * @min -9999999 * @max 9999999 */ amount?: number; } /** @oneof */ interface BulkAdjustPointsOptionsTypeOneOf { /** @max 999999999 */ balance?: number; /** * @min -9999999 * @max 9999999 */ amount?: number; } export { type RewardAvailabilityUpdated as $, type AdjustPointsOptions as A, type BulkAdjustPointsOptions as B, type CreateAccountResponse as C, DateHistogramAggregationInterval as D, type EarnPointsOptions as E, Initiator as F, type GetProgramTotalsResponse as G, RefundType as H, IntervalUnit as I, UnassignReason as J, ContractSwitchType as K, type LoyaltyAccount as L, MissingValues as M, NestedAggregationType as N, ContractSwitchReason as O, ProviderName as P, PriceIncreaseTrigger as Q, ReactivationReasonEnum as R, type SearchAccountsResponse as S, ProductAdjustment as T, UpdateTrigger as U, type Points as V, WebhookIdentityType as W, type Tier as X, type Contact as Y, type Image as Z, type PointsExpiration as _, type EarnPointsResponse as a, type ValueResult as a$, type CreateAccountRequest as a0, type EarnPointsRequest as a1, type EarnPointsRequestActivityDetailsOneOf as a2, type FollowedSocialMedia as a3, type PointsUpdated as a4, type FirstTransaction as a5, type AdjustPointsRequest as a6, type AdjustPointsRequestTypeOneOf as a7, type DeductPointsRequest as a8, type DeductPointsResponse as a9, type SearchAccountsRequest as aA, type CursorSearch as aB, type CursorSearchPagingMethodOneOf as aC, type Aggregation as aD, type AggregationKindOneOf as aE, type RangeBucket as aF, type IncludeMissingValuesOptions as aG, type ValueAggregation as aH, type ValueAggregationOptionsOneOf as aI, type RangeAggregation as aJ, type ScalarAggregation as aK, type DateHistogramAggregation as aL, type NestedAggregationItem as aM, type NestedAggregationItemKindOneOf as aN, type NestedAggregation as aO, type GroupByAggregation as aP, type GroupByAggregationKindOneOf as aQ, type SearchDetails as aR, type AggregationData as aS, type ValueAggregationResult as aT, type RangeAggregationResult as aU, type NestedAggregationResults as aV, type NestedAggregationResultsResultOneOf as aW, type ValueResults as aX, type RangeResults as aY, type AggregationResultsScalarResult as aZ, type NestedValueAggregationResult as a_, type RedeemPointsRequest as aa, type RedeemPointsResponse as ab, type RedeemDeterminedAmountOfPointsRequest as ac, type RedeemDeterminedAmountOfPointsResponse as ad, type RefundTransactionRequest as ae, type RefundTransactionResponse as af, type GetAccountRequest as ag, type GetAccountResponse as ah, type QueryLoyaltyAccountsRequest as ai, type CursorQuery as aj, type CursorQueryPagingMethodOneOf as ak, type Sorting as al, type CursorPaging as am, type QueryLoyaltyAccountsResponse as an, type CursorPagingMetadata as ao, type Cursors as ap, type ListUserAccountsRequest as aq, type ListUserAccountsResponse as ar, type LoyaltyAccountForMetaSite as as, type GetProgramTotalsRequest as at, type TierTotal as au, type GetCurrentMemberAccountRequest as av, type GetAccountBySecondaryIdRequest as aw, type GetAccountBySecondaryIdRequestIdOneOf as ax, type ListAccountsRequest as ay, type PagingMetadataV2 as az, type AdjustPointsResponse as b, type BulkAccountResult as b$, type RangeResult as b0, type ScalarResult as b1, type ScalarDateResult as b2, type NestedResultValue as b3, type NestedResultValueResultOneOf as b4, type Results as b5, type DateHistogramResult as b6, type GroupByValueResults as b7, type DateHistogramResults as b8, type NestedResults as b9, type SubscriptionEvent as bA, type SubscriptionEventEventOneOf as bB, type SubscriptionCreated as bC, type Subscription as bD, type BillingReference as bE, type Cycle as bF, type CycleCycleSelectorOneOf as bG, type Interval as bH, type OneTime as bI, type ReactivationData as bJ, type SubscriptionAssigned as bK, type SubscriptionCancelled as bL, type CancellationDetails as bM, type SubscriptionAutoRenewTurnedOn as bN, type SubscriptionAutoRenewTurnedOff as bO, type SubscriptionUnassigned as bP, type SubscriptionTransferred as bQ, type RecurringChargeSucceeded as bR, type ContractSwitched as bS, type ProductPriceIncreaseData as bT, type SubscriptionNearEndOfPeriod as bU, type SubscriptionPendingChange as bV, type RecurringChargeAttemptFailed as bW, type ContactSyncRequest as bX, type BulkUpsertAccountsRequest as bY, type AccountToUpsert as bZ, type BulkUpsertAccountsResponse as b_, type AggregationResultsScalarDateResult as ba, type AggregationResults as bb, type AggregationResultsResultOneOf as bc, type ExportAccountsRequest as bd, type QueryV2 as be, type QueryV2PagingMethodOneOf as bf, type Paging as bg, type ExportAccountsResponse as bh, type CountAccountsRequest as bi, type BulkAdjustPointsRequest as bj, type BulkAdjustPointsRequestTypeOneOf as bk, type DomainEvent as bl, type DomainEventBodyOneOf as bm, type EntityCreatedEvent as bn, type RestoreInfo as bo, type EntityUpdatedEvent as bp, type EntityDeletedEvent as bq, type ActionEvent as br, type Empty as bs, type TiersRollingUpdate as bt, type TiersProgramSettingsChanged as bu, type TiersProgramSettings as bv, type TiersProgramSettingsPeriodOneOf as bw, type TierDefinition as bx, type FocalPoint as by, type RollingWindow as bz, type GetCurrentMemberAccountResponse as c, type ItemMetadata as c0, type ApplicationError as c1, type BulkActionMetadata as c2, type MessageEnvelope as c3, type IdentificationData as c4, type IdentificationDataIdOneOf as c5, type AccountInfo as c6, type BaseEventMetadata as c7, type EventMetadata as c8, type AccountInfoMetadata as c9, type ContractSwitchTypeWithLiterals as cA, type ContractSwitchReasonWithLiterals as cB, type PriceIncreaseTriggerWithLiterals as cC, type ProductAdjustmentWithLiterals as cD, type WebhookIdentityTypeWithLiterals as cE, type CommonQueryWithEntityContext as cF, type CommonSearchWithEntityContext as cG, onAccountCreated as cH, onAccountPointsUpdated as cI, onAccountRewardAvailabilityUpdated as cJ, onAccountUpdated as cK, createAccount as cL, earnPoints as cM, adjustPoints as cN, getAccount as cO, queryLoyaltyAccounts as cP, getProgramTotals as cQ, getCurrentMemberAccount as cR, getAccountBySecondaryId as cS, listAccounts as cT, countAccounts as cU, bulkAdjustPoints as cV, type EarnPointsOptionsActivityDetailsOneOf as ca, type AdjustPointsOptionsTypeOneOf as cb, type LoyaltyAccountsQueryResult as cc, type LoyaltyAccountQuerySpec as cd, type GetAccountBySecondaryIdOptionsIdOneOf as ce, type LoyaltyAccountSearchSpec as cf, type BulkAdjustPointsOptionsTypeOneOf as cg, utils as ch, type UpdateTriggerWithLiterals as ci, type SortOrderWithLiterals as cj, type SortTypeWithLiterals as ck, type SortDirectionWithLiterals as cl, type MissingValuesWithLiterals as cm, type ScalarTypeWithLiterals as cn, type NestedAggregationTypeWithLiterals as co, type DateHistogramAggregationIntervalWithLiterals as cp, type AggregationTypeWithLiterals as cq, type ModeWithLiterals as cr, type StatusWithLiterals as cs, type ProviderNameWithLiterals as ct, type IntervalUnitWithLiterals as cu, type SubscriptionStatusWithLiterals as cv, type ReactivationReasonEnumWithLiterals as cw, type InitiatorWithLiterals as cx, type RefundTypeWithLiterals as cy, type UnassignReasonWithLiterals as cz, type GetAccountBySecondaryIdOptions as d, type GetAccountBySecondaryIdResponse as e, type ListAccountsOptions as f, type ListAccountsResponse as g, type LoyaltyAccountSearch as h, type CountAccountsOptions as i, type CountAccountsResponse as j, type BulkAdjustPointsResponse as k, type AccountCreatedEnvelope as l, type AccountPointsUpdatedEnvelope as m, type AccountRewardAvailabilityUpdatedEnvelope as n, type AccountUpdatedEnvelope as o, type LoyaltyAccountsQueryBuilder as p, type LoyaltyAccountQuery as q, SortOrder as r, SortType as s, typedQueryLoyaltyAccounts as t, SortDirection as u, ScalarType as v, AggregationType as w, Mode as x, Status as y, SubscriptionStatus as z };