import * as _wix_sdk_types from '@wix/sdk-types'; import { QuerySpec, Query, NonNullablePaths } from '@wix/sdk-types'; interface ReferralReward extends ReferralRewardReceiverOneOf, ReferralRewardRewardTypeOptionsOneOf { /** * ID of the referring customer who received the reward. * @format GUID * @readonly */ rewardedReferringCustomerId?: string; /** * ID of the referred friend who received the reward. * @format GUID * @readonly */ rewardedReferredFriendId?: string; /** Details of a coupon reward. Present when `rewardType` is `COUPON`. */ coupon?: V1Coupon; /** Details of a loyalty points reward. Present when `rewardType` is `LOYALTY_POINTS`. */ loyaltyPoints?: V1LoyaltyPoints; /** * Referral reward ID. * @format GUID * @readonly */ _id?: string | null; /** * Revision number, which increments by 1 each time the referral reward is updated. * To prevent conflicting changes, the current revision must be passed when updating the referral reward. * @immutable */ revision?: string | null; /** * Date and time the referral reward was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the referral reward was last updated. * @readonly */ _updatedDate?: Date | null; /** Type of reward given. */ rewardType?: RewardTypeTypeWithLiterals; } /** @oneof */ interface ReferralRewardReceiverOneOf { /** * ID of the referring customer who received the reward. * @format GUID * @readonly */ rewardedReferringCustomerId?: string; /** * ID of the referred friend who received the reward. * @format GUID * @readonly */ rewardedReferredFriendId?: string; } /** @oneof */ interface ReferralRewardRewardTypeOptionsOneOf { /** Details of a coupon reward. Present when `rewardType` is `COUPON`. */ coupon?: V1Coupon; /** Details of a loyalty points reward. Present when `rewardType` is `LOYALTY_POINTS`. */ loyaltyPoints?: V1LoyaltyPoints; } declare enum RewardTypeType { /** Unknown reward type. */ UNKNOWN = "UNKNOWN", /** Loyalty coupon is given. */ COUPON = "COUPON", /** Loyalty points are awarded. */ LOYALTY_POINTS = "LOYALTY_POINTS", /** No reward is given. */ NOTHING = "NOTHING" } /** @enumType */ type RewardTypeTypeWithLiterals = RewardTypeType | 'UNKNOWN' | 'COUPON' | 'LOYALTY_POINTS' | 'NOTHING'; interface V1Coupon { /** * Coupon ID. Example: `8934b045-7052-4a90-be2b-832c70afc9da`. * @format GUID * @readonly */ _id?: string; /** * The code that customers can use to apply the coupon. Example: `6RFD2A3HSPXW`. * @readonly */ code?: string; /** * Current status of the coupon. * @readonly */ status?: StatusWithLiterals; /** * Detailed specifications of the coupon. * @readonly */ couponSpecification?: Coupon; } declare enum Status { /** Coupon status is unknown or not specified. */ UNKNOWN = "UNKNOWN", /** Coupon is active and can be applied to purchases. */ ACTIVE = "ACTIVE", /** Coupon was applied and can't be used again. */ APPLIED = "APPLIED", /** Coupon was deleted and is no longer valid. */ DELETED = "DELETED" } /** @enumType */ type StatusWithLiterals = Status | 'UNKNOWN' | 'ACTIVE' | 'APPLIED' | 'DELETED'; interface Coupon extends CouponDiscountTypeOptionsOneOf, CouponScopeOrMinSubtotalOneOf { /** Options for fixed amount discount. */ fixedAmountOptions?: FixedAmountDiscount; /** Options for percentage discounts. */ percentageOptions?: PercentageDiscount; /** Limit the coupon to carts with a subtotal above this number. */ minimumSubtotal?: number; /** Specifies the type of line items this coupon will apply to. See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). */ scope?: CouponScope; /** * Coupon name. * @minLength 1 * @maxLength 50 */ name?: string; /** Coupon discount type. */ discountType?: DiscountTypeWithLiterals; /** * Whether the coupon is limited to one item. * If `true` and a customer pays for multiple items, the discount applies to only the lowest priced item. * Coupons with a bookings `scope.namespace` are always limited to one item. */ limitedToOneItem?: boolean | null; /** Whether the coupon applies to subscription products. */ appliesToSubscriptions?: boolean | null; /** * Specifies the amount of discounted cycles for a subscription item. * * - Can only be set when `scope.namespace = pricingPlans`. * - If `discountedCycleCount` is empty, the coupon applies to all available cycles. * - `discountedCycleCount` is ignored if `appliesToSubscriptions = true`. * * Max: `999` */ discountedCycleCount?: number | null; } /** @oneof */ interface CouponDiscountTypeOptionsOneOf { /** Options for fixed amount discount. */ fixedAmountOptions?: FixedAmountDiscount; /** Options for percentage discounts. */ percentageOptions?: PercentageDiscount; } /** @oneof */ interface CouponScopeOrMinSubtotalOneOf { /** Limit the coupon to carts with a subtotal above this number. */ minimumSubtotal?: number; /** Specifies the type of line items this coupon will apply to. See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). */ scope?: CouponScope; } declare enum DiscountType { /** Unknown discount type. */ UNKNOWN = "UNKNOWN", /** Discount as a fixed amount. */ FIXED_AMOUNT = "FIXED_AMOUNT", /** Discount as a percentage. */ PERCENTAGE = "PERCENTAGE", /** Free shipping. If `true`, the coupon applies to all items in all `namespaces`. */ FREE_SHIPPING = "FREE_SHIPPING" } /** @enumType */ type DiscountTypeWithLiterals = DiscountType | 'UNKNOWN' | 'FIXED_AMOUNT' | 'PERCENTAGE' | 'FREE_SHIPPING'; interface FixedAmountDiscount { /** * Amount of the discount as a fixed value. * @min 0.01 */ amount?: number; } interface PercentageDiscount { /** * Percentage of discount. * @max 100 */ percentage?: number; } interface CouponScope { /** Scope namespace (Wix Stores, Wix Bookings, Wix Events, Wix Pricing Plans) */ namespace?: string; /** Coupon scope's applied group, for example, Event or ticket in Wix Events. */ group?: Group; } interface Group { /** Name of the group. */ name?: string; /** Entity ID of the group. */ entityId?: string | null; } interface V1LoyaltyPoints { /** * Loyalty transaction ID. * @format GUID * @readonly */ transactionId?: string; /** * The number of loyalty points awarded. * @readonly */ amount?: number; } interface GetReferralRewardRequest { /** * Referral reward ID. * @format GUID */ _id: string; } interface GetReferralRewardResponse { /** Retrieved referral reward. */ referralReward?: ReferralReward; } interface QueryReferralRewardsRequest { /** Query to filter referral rewards. */ query: CursorQuery; /** Contact ID to filter rewards by. Use `"me"` for current identity's rewards. */ contactId?: string | null; } 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 QueryReferralRewardsResponse { /** Retrieved referral rewards. */ referralRewards?: ReferralReward[]; /** Metadata for paging. */ metadata?: 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 ValidateReferralRewardRequest { /** Reward to validate. */ reward?: Reward; } interface Reward extends RewardOptionsOneOf { /** Options for coupon reward type. */ couponOptions?: Coupon; /** Options for the Loyalty points reward type. */ loyaltyPointsOptions?: LoyaltyPoints; /** Type of the reward. */ type?: TypeWithLiterals; } /** @oneof */ interface RewardOptionsOneOf { /** Options for coupon reward type. */ couponOptions?: Coupon; /** Options for the Loyalty points reward type. */ loyaltyPointsOptions?: LoyaltyPoints; } declare enum Type { /** Unknown reward type. */ UNKNOWN = "UNKNOWN", /** Coupon reward type. */ COUPON = "COUPON", /** Loyalty points reward type. */ LOYALTY_POINTS = "LOYALTY_POINTS", /** No reward type. */ NOTHING = "NOTHING" } /** @enumType */ type TypeWithLiterals = Type | 'UNKNOWN' | 'COUPON' | 'LOYALTY_POINTS' | 'NOTHING'; interface LoyaltyPoints { /** * Number of loyalty points to give. * @min 1 * @max 9999999 */ amount?: number; } interface ValidateReferralRewardResponse { } interface BulkGetReferralRewardsRequest { } interface BulkGetReferralRewardsResponse { /** Rewards grouped by site. */ rewardsInSite?: RewardsInSite[]; } interface RewardsInSite { /** * Metasite ID. * @format GUID */ metaSiteId?: string; /** List of rewards for the site. */ rewards?: ReferralReward[]; } 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 SuccessfulReferralEvent { /** Details of the referred friend who completed their referral. */ referredFriendDetails?: ReferredFriendDetails; } interface ReferredFriendDetails { /** * ID of the referred friend. * @format GUID * @readonly */ referredFriendId?: string; /** * Contact ID of the referred friend. * @format GUID * @readonly */ contactId?: string; /** * ID of the customer who referred this friend. * @format GUID * @readonly */ referringCustomerId?: string; } 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 referral reward. * @param _id - Referral reward ID. * @public * @requiredField _id * @permissionId REFERRALS.READ_REWARDS * @applicableIdentity APP * @returns Retrieved referral reward. * @fqn wix.loyalty.referral.reward.v1.ReferralRewards.GetReferralReward */ declare function getReferralReward(_id: string): Promise>; /** * Creates a query to retrieve a list of referral rewards. * * The `queryReferralRewards()` function builds a query to retrieve a list of events and returns a `ReferralRewardsQueryBuilder` object. * * The returned object contains the query definition, which is typically used to run the query using the `find()` function. * * You can refine the query by chaining `ReferralRewardsQueryBuilder` functions onto the query. `ReferralRewardsQueryBuilder` functions enable you to sort, filter, and control the results `queryReferralRewards()` returns. * * `queryReferralRewards()` runs with these `ReferralRewardsQueryBuilder` defaults, which you can override: * * - `limit(50)` * - `descending("_createdDate")` * * The functions that are chained to `queryReferralRewards()` are applied in the order they're called. For example, if you apply ascending('rewardedReferredFriendId') and then descending('rewardType'), the results are sorted first by the referred friend ID, and then, if there are multiple results with the same ID, the items are sorted by reward type. * @public * @permissionId REFERRALS.READ_REWARDS * @applicableIdentity APP * @fqn wix.loyalty.referral.reward.v1.ReferralRewards.QueryReferralRewards */ declare function queryReferralRewards(options?: QueryReferralRewardsOptions): ReferralRewardsQueryBuilder; interface QueryReferralRewardsOptions { /** Contact ID to filter rewards by. Use `"me"` for current identity's rewards. */ contactId?: string | null | undefined; } interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } interface ReferralRewardsQueryResult extends QueryCursorResult { items: ReferralReward[]; query: ReferralRewardsQueryBuilder; next: () => Promise; prev: () => Promise; } interface ReferralRewardsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ eq: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate' | 'rewardType', value: any) => ReferralRewardsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ne: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate' | 'rewardType', value: any) => ReferralRewardsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ge: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate', value: any) => ReferralRewardsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ gt: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate', value: any) => ReferralRewardsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ le: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate', value: any) => ReferralRewardsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ lt: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate', value: any) => ReferralRewardsQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. */ startsWith: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId', value: string) => ReferralRewardsQueryBuilder; /** @param propertyName - Property whose value is compared with `values`. * @param values - List of values to compare against. */ hasSome: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate' | 'rewardType', value: any[]) => ReferralRewardsQueryBuilder; in: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate' | 'rewardType', value: any) => ReferralRewardsQueryBuilder; exists: (propertyName: 'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate' | 'rewardType', value: boolean) => ReferralRewardsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ ascending: (...propertyNames: Array<'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate' | 'rewardType'>) => ReferralRewardsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ descending: (...propertyNames: Array<'rewardedReferringCustomerId' | 'rewardedReferredFriendId' | '_createdDate' | '_updatedDate' | 'rewardType'>) => ReferralRewardsQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */ limit: (limit: number) => ReferralRewardsQueryBuilder; /** @param cursor - A pointer to specific record */ skipTo: (cursor: string) => ReferralRewardsQueryBuilder; find: () => Promise; } /** * @hidden * @fqn wix.loyalty.referral.reward.v1.ReferralRewards.QueryReferralRewards * @requiredField query */ declare function typedQueryReferralRewards(query: ReferralRewardQuery, options?: QueryReferralRewardsOptions): Promise>; interface ReferralRewardQuerySpec extends QuerySpec { paging: 'cursor'; wql: [ { fields: [ '_createdDate', '_updatedDate', 'rewardType', 'rewardedReferredFriendId', 'rewardedReferringCustomerId' ]; operators: '*'; sort: 'BOTH'; } ]; } type CommonQueryWithEntityContext = Query; type ReferralRewardQuery = { /** 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 BulkGetReferralRewardsRequest, type BulkGetReferralRewardsResponse, type CommonQueryWithEntityContext, type Coupon, type CouponDiscountTypeOptionsOneOf, type CouponScope, type CouponScopeOrMinSubtotalOneOf, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, DiscountType, type DiscountTypeWithLiterals, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type FixedAmountDiscount, type GetReferralRewardRequest, type GetReferralRewardResponse, type Group, type IdentificationData, type IdentificationDataIdOneOf, type LoyaltyPoints, type MessageEnvelope, type PercentageDiscount, type QueryReferralRewardsOptions, type QueryReferralRewardsRequest, type QueryReferralRewardsResponse, type ReferralReward, type ReferralRewardQuery, type ReferralRewardQuerySpec, type ReferralRewardReceiverOneOf, type ReferralRewardRewardTypeOptionsOneOf, type ReferralRewardsQueryBuilder, type ReferralRewardsQueryResult, type ReferredFriendDetails, type RestoreInfo, type Reward, type RewardOptionsOneOf, RewardTypeType, type RewardTypeTypeWithLiterals, type RewardsInSite, SortOrder, type SortOrderWithLiterals, type Sorting, Status, type StatusWithLiterals, type SuccessfulReferralEvent, Type, type TypeWithLiterals, type V1Coupon, type V1LoyaltyPoints, type ValidateReferralRewardRequest, type ValidateReferralRewardResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, getReferralReward, queryReferralRewards, typedQueryReferralRewards, utils };