import * as _wix_sdk_types from '@wix/sdk-types'; import { QuerySpec, Query, NonNullablePaths } from '@wix/sdk-types'; /** A loyalty checkout discount represents a discount applied to a checkout using loyalty rewards, coupons, or referral rewards. */ interface LoyaltyCheckoutDiscount extends LoyaltyCheckoutDiscountDiscountOneOf { /** * ID of the loyalty reward used for this discount. * @format GUID */ rewardId?: string; /** * ID of the loyalty coupon used for this discount. * @format GUID */ loyaltyCouponId?: string; /** * ID of the referral reward used for this discount. * @format GUID */ referralRewardId?: string; /** * Loyalty checkout discount ID. * @format GUID * @readonly */ _id?: string; /** * ID of the checkout this discount is applied to. * @format GUID */ checkoutId?: string; /** * Current status of the discount. * @readonly */ status?: DiscountStatusWithLiterals; /** * The type of discount applied. * @readonly */ discountType?: DiscountTypeWithLiterals; } /** @oneof */ interface LoyaltyCheckoutDiscountDiscountOneOf { /** * ID of the loyalty reward used for this discount. * @format GUID */ rewardId?: string; /** * ID of the loyalty coupon used for this discount. * @format GUID */ loyaltyCouponId?: string; /** * ID of the referral reward used for this discount. * @format GUID */ referralRewardId?: string; } declare enum DiscountStatus { /** Status is unknown or not specified. */ UNKNOWN = "UNKNOWN", /** Discount has been applied to the checkout. */ APPLIED = "APPLIED", /** Discount application is in progress. */ IN_PROGRESS = "IN_PROGRESS", /** Discount has been successfully completed. */ COMPLETED = "COMPLETED", /** Discount has been refunded. */ REFUNDED = "REFUNDED", /** Attempt to refund the discount failed. */ FAILED_TO_REFUND = "FAILED_TO_REFUND", /** Discount was refunded due to a timeout. */ REFUNDED_DUE_TO_TIMEOUT = "REFUNDED_DUE_TO_TIMEOUT", /** Discount was refunded due to manual removal. */ REFUNDED_DUE_TO_MANUAL_DISCOUNT_REMOVAL = "REFUNDED_DUE_TO_MANUAL_DISCOUNT_REMOVAL", /** Discount is scheduled for refund. */ SCHEDULED_FOR_REFUND = "SCHEDULED_FOR_REFUND", /** Discount wasn't used. */ UNUSED = "UNUSED" } /** @enumType */ type DiscountStatusWithLiterals = DiscountStatus | 'UNKNOWN' | 'APPLIED' | 'IN_PROGRESS' | 'COMPLETED' | 'REFUNDED' | 'FAILED_TO_REFUND' | 'REFUNDED_DUE_TO_TIMEOUT' | 'REFUNDED_DUE_TO_MANUAL_DISCOUNT_REMOVAL' | 'SCHEDULED_FOR_REFUND' | 'UNUSED'; declare enum DiscountType { /** Discount type is unknown or not specified. */ UNKNOWN = "UNKNOWN", /** A discount from a flexible reward. */ DISCOUNT_AMOUNT = "DISCOUNT_AMOUNT", /** A discount from a redeemed loyalty program coupon. */ LOYALTY_COUPON = "LOYALTY_COUPON", /** A discount from a coupon reward that hasn't yet been redeemed. */ COUPON_REWARD = "COUPON_REWARD", /** A discount from a referral reward. */ REFERRAL_REWARD = "REFERRAL_REWARD" } /** @enumType */ type DiscountTypeWithLiterals = DiscountType | 'UNKNOWN' | 'DISCOUNT_AMOUNT' | 'LOYALTY_COUPON' | 'COUPON_REWARD' | 'REFERRAL_REWARD'; interface DiscountRefundedDueToManualDiscountRemoval { /** Loyalty checkout discount refunded due to manual removal. */ discount?: LoyaltyCheckoutDiscount; } interface DiscountRefundedDueToTimeout { /** Loyalty checkout discount refunded due to timeout. */ discount?: LoyaltyCheckoutDiscount; } interface DiscountScheduledForRefund { /** Loyalty checkout discount scheduled for refund. */ discount?: LoyaltyCheckoutDiscount; } /** Request to apply a discount to a checkout. */ interface ApplyDiscountToCheckoutRequest extends ApplyDiscountToCheckoutRequestDiscountOneOf { /** Unredeemed loyalty reward discount. */ reward?: Reward; /** Loyalty coupon discount. */ loyaltyCoupon?: LoyaltyCoupon; /** Referral reward discount. */ referralReward?: ReferralReward; /** * ID of the checkout to apply the discount to. * @format GUID */ checkoutId: string; } /** @oneof */ interface ApplyDiscountToCheckoutRequestDiscountOneOf { /** Unredeemed loyalty reward discount. */ reward?: Reward; /** Loyalty coupon discount. */ loyaltyCoupon?: LoyaltyCoupon; /** Referral reward discount. */ referralReward?: ReferralReward; } interface Reward { /** * ID of the loyalty reward to be used for this discount. * @format GUID */ _id?: string; /** * Number of points to spend for this reward. * For example, if the reward is 10 points = $1, then 35 points would give a $3.50 discount. * * >**Note:** Only relevant when using a flexible type reward. Depending on how your loyalty program is set up, there may be a minimum number of points you must spend. * @min 1 * @max 9999999 */ pointsToSpend?: number | null; /** * Revision number, which increments by 1 each time a reward is updated. * To prevent conflicting changes, the current `revision` must be passed when updating a reward. */ revision?: string; } interface LoyaltyCoupon { /** * ID of the loyalty coupon to be used for this discount. * @format GUID */ _id?: string; /** * Revision of the coupon object. Incremented by 1 each time the coupon object is updated. * Pass the latest `revision` when updating to prevent conflicting changes. */ revision?: string; } interface ReferralReward { /** * Referral reward discount ID. * @format GUID */ _id?: string; /** * Revision of the referral object. Incremented by 1 each time the referral object is updated. * Pass the latest `revision` when updating to prevent conflicting changes. */ revision?: string; } /** Response after applying a discount to a checkout. */ interface ApplyDiscountToCheckoutResponse { /** The applied loyalty checkout discount. */ discount?: LoyaltyCheckoutDiscount; } interface QueryLoyaltyCheckoutDiscountsRequest { /** * 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; /** * Origin point for geo-distance sorting on a GEO field * results are ordered by distance from this point (ASC = nearest first, DESC = farthest first). */ origin?: AddressLocation; } declare enum SortOrder { ASC = "ASC", DESC = "DESC" } /** @enumType */ type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC'; interface AddressLocation { /** Address latitude. */ latitude?: number | null; /** Address longitude. */ longitude?: number | null; } 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; } /** Response from querying loyalty checkout discounts. */ interface QueryLoyaltyCheckoutDiscountsResponse { /** List of loyalty checkout discounts matching the query. */ loyaltyCheckoutDiscounts?: LoyaltyCheckoutDiscount[]; /** Paging metadata for the response. */ 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 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; } /** * Applies a discount to a checkout. * * You can apply one of the following discounts, which are exchanged for loyalty points: `reward`, `loyaltyCoupon`, or `referralReward`. * @param checkoutId - ID of the checkout to apply the discount to. * @public * @requiredField checkoutId * @permissionId LOYALTY.REDEEM_OWN_COUPON * @applicableIdentity APP * @applicableIdentity MEMBER * @returns Response after applying a discount to a checkout. * @fqn wix.loyalty.checkoutexchange.v1.LoyaltyCheckoutExchange.ApplyDiscountToCheckout */ declare function applyDiscountToCheckout(checkoutId: string, options?: ApplyDiscountToCheckoutOptions): Promise>; interface ApplyDiscountToCheckoutOptions extends ApplyDiscountToCheckoutOptionsDiscountOneOf { /** Unredeemed loyalty reward discount. */ reward?: Reward; /** Loyalty coupon discount. */ loyaltyCoupon?: LoyaltyCoupon; /** Referral reward discount. */ referralReward?: ReferralReward; } /** @oneof */ interface ApplyDiscountToCheckoutOptionsDiscountOneOf { /** Unredeemed loyalty reward discount. */ reward?: Reward; /** Loyalty coupon discount. */ loyaltyCoupon?: LoyaltyCoupon; /** Referral reward discount. */ referralReward?: ReferralReward; } /** * Creates a query to retrieve a list of checkout discounts. * * The `queryLoyaltyCheckoutDiscount()` method builds a query to retrieve a list of checkout discounts and returns a `LoyaltyCheckoutDiscountQueryBuilder` 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 `LoyaltyCheckoutDiscountQueryBuilder` methods onto the query. `LoyaltyCheckoutDiscountQueryBuilder` methods enable you to sort, filter, and control the results `queryLoyaltyCheckoutDiscount()` returns. * * `queryLoyaltyCheckoutDiscount()` runs with these `LoyaltyCheckoutDiscountQueryBuilder` defaults, which you can override: * * - `limit(50)` * - `descending("_createdDate")` * * The methods that are chained to `queryLoyaltyCheckoutDiscount()` are applied in the order they're called. For example, if you apply ascending('status') and then descending('checkoutId'), the results are sorted first by the status, and then, if there are multiple results with the same status, the items are sorted by checkout ID. * @public * @permissionId LOYALTY.QUERY_CHECKOUT_DISCOUNTS * @applicableIdentity APP * @applicableIdentity MEMBER * @fqn wix.loyalty.checkoutexchange.v1.LoyaltyCheckoutExchange.QueryLoyaltyCheckoutDiscounts */ declare function queryLoyaltyCheckoutDiscounts(): LoyaltyCheckoutDiscountsQueryBuilder; interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } interface LoyaltyCheckoutDiscountsQueryResult extends QueryCursorResult { items: LoyaltyCheckoutDiscount[]; query: LoyaltyCheckoutDiscountsQueryBuilder; next: () => Promise; prev: () => Promise; } interface LoyaltyCheckoutDiscountsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ eq: (propertyName: 'checkoutId' | 'status', value: any) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ne: (propertyName: 'checkoutId' | 'status', value: any) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ge: (propertyName: 'checkoutId', value: any) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ gt: (propertyName: 'checkoutId', value: any) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ le: (propertyName: 'checkoutId', value: any) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ lt: (propertyName: 'checkoutId', value: any) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. */ startsWith: (propertyName: 'checkoutId', value: string) => LoyaltyCheckoutDiscountsQueryBuilder; in: (propertyName: 'checkoutId' | 'status', value: any) => LoyaltyCheckoutDiscountsQueryBuilder; exists: (propertyName: 'checkoutId' | 'status', value: boolean) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ ascending: (...propertyNames: Array<'checkoutId' | 'status'>) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ descending: (...propertyNames: Array<'checkoutId' | 'status'>) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */ limit: (limit: number) => LoyaltyCheckoutDiscountsQueryBuilder; /** @param cursor - A pointer to specific record */ skipTo: (cursor: string) => LoyaltyCheckoutDiscountsQueryBuilder; find: () => Promise; } /** * @hidden * @fqn wix.loyalty.checkoutexchange.v1.LoyaltyCheckoutExchange.QueryLoyaltyCheckoutDiscounts * @requiredField query * @returns Response from querying loyalty checkout discounts. */ declare function typedQueryLoyaltyCheckoutDiscounts(query: LoyaltyCheckoutDiscountQuery): Promise>; interface LoyaltyCheckoutDiscountQuerySpec extends QuerySpec { paging: 'cursor'; wql: [ { fields: ['checkoutId', 'status']; operators: '*'; sort: 'BOTH'; } ]; } type CommonQueryWithEntityContext = Query; type LoyaltyCheckoutDiscountQuery = { /** 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']; /** Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first). */ origin?: NonNullable[number]['origin']; }[]; }; declare const utils: { query: _wix_sdk_types.QueryHelpers; }; export { type AccountInfo, type ActionEvent, type AddressLocation, type ApplyDiscountToCheckoutOptions, type ApplyDiscountToCheckoutOptionsDiscountOneOf, type ApplyDiscountToCheckoutRequest, type ApplyDiscountToCheckoutRequestDiscountOneOf, type ApplyDiscountToCheckoutResponse, type CommonQueryWithEntityContext, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DiscountRefundedDueToManualDiscountRemoval, type DiscountRefundedDueToTimeout, type DiscountScheduledForRefund, DiscountStatus, type DiscountStatusWithLiterals, DiscountType, type DiscountTypeWithLiterals, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type IdentificationData, type IdentificationDataIdOneOf, type LoyaltyCheckoutDiscount, type LoyaltyCheckoutDiscountDiscountOneOf, type LoyaltyCheckoutDiscountQuery, type LoyaltyCheckoutDiscountQuerySpec, type LoyaltyCheckoutDiscountsQueryBuilder, type LoyaltyCheckoutDiscountsQueryResult, type LoyaltyCoupon, type MessageEnvelope, type QueryLoyaltyCheckoutDiscountsRequest, type QueryLoyaltyCheckoutDiscountsResponse, type ReferralReward, type RestoreInfo, type Reward, SortOrder, type SortOrderWithLiterals, type Sorting, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, applyDiscountToCheckout, queryLoyaltyCheckoutDiscounts, typedQueryLoyaltyCheckoutDiscounts, utils };