import * as _wix_sdk_types from '@wix/sdk-types'; import { QuerySpec, Query, NonNullablePaths } from '@wix/sdk-types'; /** Loyalty transaction. */ interface LoyaltyTransaction extends LoyaltyTransactionTransactionTypeInfoOneOf { /** Information on points earned. */ earnInfo?: EarnInfo; /** Information on points redeemed. */ redeemInfo?: RedeemInfo; /** Information on points adjusted. */ adjustInfo?: AdjustInfo; /** Information on points refunded. */ refundInfo?: RefundInfo; /** Information on points expired. */ expireInfo?: ExpireInfo; /** Information on a limited earn attempt recorded with 0 points. */ earnAttemptInfo?: EarnAttemptInfo; /** * Transaction ID. * @format GUID */ _id?: string | null; /** * Account ID. * @format GUID */ accountId?: string; /** * Date and time the transaction was created. * @readonly */ _createdDate?: Date | null; /** * The number of points earned, adjusted, redeemed, or expired in the transaction. * * + `EARN`: Number of points earned by a customer taking an action. * + `REDEEM`: The number of points redeemed by a customer for a reward. * + `ADJUST`: The number of points adjusted to a customer's balance. * + `REFUND`: The number of points refunded for a previously redeemed reward. * + `EXPIRE`: The number of points that expired due to customer inactivity for a configured period. */ amount?: number; /** Type of transaction. */ transactionType?: TransactionTypeWithLiterals; /** * Transaction description. * @maxLength 100 */ description?: string; /** * Unique identifier, generated by the client. Used to recognize repeated attempts of the same request. Only present when manually adding points with [Earn Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/earn-points). * @maxLength 128 */ idempotencyKey?: string; } /** @oneof */ interface LoyaltyTransactionTransactionTypeInfoOneOf { /** Information on points earned. */ earnInfo?: EarnInfo; /** Information on points redeemed. */ redeemInfo?: RedeemInfo; /** Information on points adjusted. */ adjustInfo?: AdjustInfo; /** Information on points refunded. */ refundInfo?: RefundInfo; /** Information on points expired. */ expireInfo?: ExpireInfo; /** Information on a limited earn attempt recorded with 0 points. */ earnAttemptInfo?: EarnAttemptInfo; } declare enum TransactionType { /** Unknown transaction type. */ UNKNOWN = "UNKNOWN", /** Number of points earned by a customer taking an action. See [Earn Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/earn-points). */ EARN = "EARN", /** Number of points redeemed by a customer for a reward. */ REDEEM = "REDEEM", /** Number of points adjusted to a customer's balance. See [Adjust Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/adjust-points). */ ADJUST = "ADJUST", /** Number of points refunded for a previously redeemed reward. */ REFUND = "REFUND", /** Number of points that expired due to customer inactivity for a configured period. */ EXPIRE = "EXPIRE", /** Record of an earn attempt that was limited to 0 points. */ EARN_ATTEMPT = "EARN_ATTEMPT" } /** @enumType */ type TransactionTypeWithLiterals = TransactionType | 'UNKNOWN' | 'EARN' | 'REDEEM' | 'ADJUST' | 'REFUND' | 'EXPIRE' | 'EARN_ATTEMPT'; interface EarnInfo extends EarnInfoActivityDetailsOneOf { /** Details on following on social media. */ followedSocialMedia?: FollowedSocialMedia; /** * ID of the app that generated the earned points. * @minLength 1 * @readonly */ appId?: string; /** Activity type. */ activityType?: string; /** * Order ID. * @maxLength 512 */ orderId?: string | null; /** * Whether the points amount was adjusted by an earn points limit provider. * @readonly */ limitApplied?: boolean; } /** @oneof */ interface EarnInfoActivityDetailsOneOf { /** Details on following on social media. */ followedSocialMedia?: FollowedSocialMedia; } interface FollowedSocialMedia { /** * Social media channel. * For example, `"FACEBOOK"` or `"INSTAGRAM"`. * @maxLength 32 */ channel?: string; } interface RedeemInfo { /** * ID of the reward that was redeemed. * @format GUID * @readonly */ rewardId?: string; /** * Type of reward that was redeemed. * @readonly */ rewardType?: string | null; /** * ID of the specific item that was redeemed in this transaction. * * Each reward that's redeemed has a unique `referenceEntityId`. * @format GUID * @readonly */ referenceEntityId?: string | null; } interface AdjustInfo { /** * ID of the app that initiated the points adjustment. * @minLength 1 * @readonly */ appId?: string; /** Amount before adjustment. */ amountBefore?: number; /** Amount after adjustment. */ amountAfter?: number; } interface RefundInfo { /** * ID of the app that refunded points. * @minLength 1 * @readonly */ appId?: string; /** * ID of the transaction that was refunded. * @format GUID * @readonly */ refundedTransactionId?: string | null; } interface ExpireInfo { /** Amount before expiration. */ amountBefore?: number; /** Amount after expiration. */ amountAfter?: number; } interface EarnAttemptInfo { /** * ID of the app that generated the earn operation. * @minLength 1 * @readonly */ appId?: string; /** Activity type. */ activityType?: string; /** * Order ID. * @maxLength 512 */ orderId?: string | null; } interface CreateLoyaltyTransactionRequest { /** LoyaltyTransaction to be created. */ loyaltyTransaction?: LoyaltyTransaction; /** If true, deduct points from the account before creating the transaction. */ deductPoints?: boolean; } interface CreateLoyaltyTransactionResponse { /** The created LoyaltyTransaction. */ loyaltyTransaction?: LoyaltyTransaction; } interface BulkCreateLoyaltyTransactionsRequest { /** * Transactions to create. * @minSize 1 * @maxSize 100 */ loyaltyTransactions?: LoyaltyTransaction[]; /** Determines if entities must be returned in response. */ returnEntity?: boolean; } interface BulkCreateLoyaltyTransactionsResponse { /** * Results of bulk creation. * @minSize 1 * @maxSize 100 */ results?: BulkLoyaltyTransactionResult[]; /** Bulk action metadata. */ bulkActionMetadata?: BulkActionMetadata; } 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 BulkLoyaltyTransactionResult { /** Individual loyalty transaction metadata. */ itemMetadata?: ItemMetadata; /** Only exists if `returnEntity` was set to true in the request. */ item?: LoyaltyTransaction; } 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 GetLoyaltyTransactionRequest { /** * ID of the loyalty transaction to retrieve. * @format GUID */ loyaltyTransactionId: string; } interface GetLoyaltyTransactionResponse { /** Retrieved loyalty transaction. */ loyaltyTransaction?: LoyaltyTransaction; } interface QueryLoyaltyTransactionsRequest { /** Query options. */ 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 QueryLoyaltyTransactionsResponse { /** Retrieved loyalty transactions. */ loyaltyTransactions?: LoyaltyTransaction[]; /** 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 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 GetTransactionSumRequest { /** Filter loyalty transactions to sum */ filter?: Record | null; } interface GetTransactionSumResponse { /** * Total amount of all filtered loyalty transactions * @max 9999999 */ totalAmount?: number; } interface RevertTransactionRequest { /** * ID of the EARN transaction to revert. * @format GUID */ transactionId?: string; } interface RevertTransactionResponse { } 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; } /** * Retrieves a transaction. * @param loyaltyTransactionId - ID of the loyalty transaction to retrieve. * @public * @requiredField loyaltyTransactionId * @permissionId LOYALTY.READ_TRANSACTIONS * @applicableIdentity APP * @returns Retrieved loyalty transaction. * @fqn wix.loyalty.transaction.v1.LoyaltyTransactions.GetLoyaltyTransaction */ declare function getLoyaltyTransaction(loyaltyTransactionId: string): Promise>; /** * Retrieves a list of loyalty transactions with the specified paging, filtering, and sorting. * * To learn about working with _Query_ methods, see [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language), * [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging), * and [Field Projection](https://dev.wix.com/docs/rest/articles/get-started/field-projection). * @public * @permissionId LOYALTY.READ_TRANSACTIONS * @applicableIdentity APP * @fqn wix.loyalty.transaction.v1.LoyaltyTransactions.QueryLoyaltyTransactions */ declare function queryLoyaltyTransactions(): LoyaltyTransactionsQueryBuilder; interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } interface LoyaltyTransactionsQueryResult extends QueryCursorResult { items: LoyaltyTransaction[]; query: LoyaltyTransactionsQueryBuilder; next: () => Promise; prev: () => Promise; } interface LoyaltyTransactionsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ eq: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'transactionType' | 'description' | 'idempotencyKey', value: any) => LoyaltyTransactionsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ne: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'transactionType' | 'description' | 'idempotencyKey', value: any) => LoyaltyTransactionsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ge: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'description' | 'idempotencyKey', value: any) => LoyaltyTransactionsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ gt: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'description' | 'idempotencyKey', value: any) => LoyaltyTransactionsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ le: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'description' | 'idempotencyKey', value: any) => LoyaltyTransactionsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ lt: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'description' | 'idempotencyKey', value: any) => LoyaltyTransactionsQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. */ startsWith: (propertyName: '_id' | 'accountId' | 'description' | 'idempotencyKey', value: string) => LoyaltyTransactionsQueryBuilder; /** @param propertyName - Property whose value is compared with `values`. * @param values - List of values to compare against. */ hasSome: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'transactionType' | 'description' | 'idempotencyKey', value: any[]) => LoyaltyTransactionsQueryBuilder; in: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'transactionType' | 'description' | 'idempotencyKey', value: any) => LoyaltyTransactionsQueryBuilder; exists: (propertyName: '_id' | 'accountId' | '_createdDate' | 'amount' | 'transactionType' | 'description' | 'idempotencyKey', value: boolean) => LoyaltyTransactionsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ ascending: (...propertyNames: Array<'_id' | 'accountId' | '_createdDate' | 'amount' | 'transactionType' | 'description' | 'idempotencyKey'>) => LoyaltyTransactionsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ descending: (...propertyNames: Array<'_id' | 'accountId' | '_createdDate' | 'amount' | 'transactionType' | 'description' | 'idempotencyKey'>) => LoyaltyTransactionsQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */ limit: (limit: number) => LoyaltyTransactionsQueryBuilder; /** @param cursor - A pointer to specific record */ skipTo: (cursor: string) => LoyaltyTransactionsQueryBuilder; find: () => Promise; } /** * @hidden * @fqn wix.loyalty.transaction.v1.LoyaltyTransactions.QueryLoyaltyTransactions * @requiredField query */ declare function typedQueryLoyaltyTransactions(query: LoyaltyTransactionQuery): Promise>; interface LoyaltyTransactionQuerySpec extends QuerySpec { paging: 'cursor'; wql: [ { fields: [ '_createdDate', '_id', 'accountId', 'amount', 'description', 'idempotencyKey', 'transactionType' ]; operators: '*'; sort: 'BOTH'; } ]; } type CommonQueryWithEntityContext = Query; type LoyaltyTransactionQuery = { /** 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; }; }; export { type AccountInfo, type ActionEvent, type AdjustInfo, type ApplicationError, type BulkActionMetadata, type BulkCreateLoyaltyTransactionsRequest, type BulkCreateLoyaltyTransactionsResponse, type BulkLoyaltyTransactionResult, type CommonQueryWithEntityContext, type CreateLoyaltyTransactionRequest, type CreateLoyaltyTransactionResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DomainEvent, type DomainEventBodyOneOf, type EarnAttemptInfo, type EarnInfo, type EarnInfoActivityDetailsOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type ExpireInfo, type FollowedSocialMedia, type GetLoyaltyTransactionRequest, type GetLoyaltyTransactionResponse, type GetTransactionSumRequest, type GetTransactionSumResponse, type IdentificationData, type IdentificationDataIdOneOf, type ItemMetadata, type LoyaltyTransaction, type LoyaltyTransactionQuery, type LoyaltyTransactionQuerySpec, type LoyaltyTransactionTransactionTypeInfoOneOf, type LoyaltyTransactionsQueryBuilder, type LoyaltyTransactionsQueryResult, type MessageEnvelope, type QueryLoyaltyTransactionsRequest, type QueryLoyaltyTransactionsResponse, type RedeemInfo, type RefundInfo, type RestoreInfo, type RevertTransactionRequest, type RevertTransactionResponse, SortOrder, type SortOrderWithLiterals, type Sorting, TransactionType, type TransactionTypeWithLiterals, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, getLoyaltyTransaction, queryLoyaltyTransactions, typedQueryLoyaltyTransactions, utils };