@wix/auto_sdk_loyalty_rewards 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,21 +8,22 @@ interface CreateRewardSignature {
8
8
  /**
9
9
  * Creates a reward that can be redeemed with loyalty points.
10
10
  *
11
- * When a customer redeems a reward, a loyalty coupon is created
11
+ * When a customer [redeems a reward](/coupons/redeem-points-for-coupon), a loyalty coupon is created
12
12
  * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can
13
13
  * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,
14
- * no coupon is actually created until a reward is redeemed with points.
15
- * See the Coupons API for more information about coupons.
14
+ * no coupon is actually created until a [reward is redeemed](/coupons/redeem-points-for-coupon) with points.
15
+ * See the [Coupons API](https://dev.wix.com/api/rest/coupons) for more information about coupons. The `type` of reward
16
+ * cannot be updated.
16
17
  *
17
18
  * A reward's `active` status defaults to `false`. To make the reward available to customers,
18
- * either set the `active` field to `true` during creation or call [`updateReward()`](#updatereward)
19
+ * either set the `active` field to `true` during creation or call [Update Reward](/update-reward)
19
20
  * to change the status.
20
21
  *
21
- * To customize a reward for each loyalty tier, use the `configsByTier` parameter.
22
+ * To customize a reward for each [loyalty tier](/tiers), use the `configsByTier` parameter.
22
23
  * This allows you to specify the amount of the earned discount, the cost in loyalty points
23
24
  * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own
24
25
  * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,
25
- * leave the `tierId` field empty. See the Loyalty Tiers API for more information on tiers.
26
+ * leave the `tierId` field empty. See the [Tiers API](/tiers) for more information on tiers.
26
27
  * @param - Reward to create.
27
28
  * @returns Created reward.
28
29
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../src/loyalty-v1-reward-rewards.public.ts","../../src/loyalty-v1-reward-rewards.universal.ts","../../src/loyalty-v1-reward-rewards.http.ts","../../src/loyalty-v1-reward-rewards.context.ts"],"sourcesContent":["export * from './src/loyalty-v1-reward-rewards.context.js';\n","import { renameKeysFromRESTResponseToSDKResponse } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { transformRESTFloatToSDKFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { EventDefinition, HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n BulkCreateRewardsResponse,\n BulkGetRewardsResponse,\n CursorQuery,\n ListRewardsOptions,\n ListRewardsResponse,\n QueryRewardsResponse,\n Reward,\n RewardCreatedEnvelope,\n RewardDeletedEnvelope,\n RewardUpdatedEnvelope,\n UpdateReward,\n UpdateRewardResponse,\n bulkCreateRewards as universalBulkCreateRewards,\n bulkGetRewards as universalBulkGetRewards,\n createReward as universalCreateReward,\n deleteReward as universalDeleteReward,\n getReward as universalGetReward,\n listRewards as universalListRewards,\n queryRewards as universalQueryRewards,\n updateReward as universalUpdateReward,\n} from './loyalty-v1-reward-rewards.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/loyalty' };\n\ntype RewardNonNullablePaths =\n | `discountAmount.configsByTier`\n | `discountAmount.configsByTier.${number}.amount`\n | `discountAmount.configsByTier.${number}.costInPoints`\n | `couponReward.fixedAmount.configsByTier`\n | `couponReward.fixedAmount.configsByTier.${number}.costInPoints`\n | `couponReward.fixedAmount.configsByTier.${number}.amount`\n | `couponReward.percentage.configsByTier`\n | `couponReward.percentage.configsByTier.${number}.costInPoints`\n | `couponReward.percentage.configsByTier.${number}.percentage`\n | `couponReward.freeShipping.configsByTier`\n | `couponReward.freeShipping.configsByTier.${number}.costInPoints`\n | `couponReward.minimumSubtotal`\n | `couponReward.scope.namespace`\n | `couponReward.scope.group.name`\n | `name`\n | `active`\n | `type`;\n\nexport function createReward(httpClient: HttpClient): CreateRewardSignature {\n return (reward: NonNullablePaths<Reward, `name`>) =>\n universalCreateReward(\n reward,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface CreateRewardSignature {\n /**\n * Creates a reward that can be redeemed with loyalty points.\n *\n * When a customer redeems a reward, a loyalty coupon is created\n * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can\n * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,\n * no coupon is actually created until a reward is redeemed with points.\n * See the Coupons API for more information about coupons.\n *\n * A reward's `active` status defaults to `false`. To make the reward available to customers,\n * either set the `active` field to `true` during creation or call [`updateReward()`](#updatereward)\n * to change the status.\n *\n * To customize a reward for each loyalty tier, use the `configsByTier` parameter.\n * This allows you to specify the amount of the earned discount, the cost in loyalty points\n * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own\n * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,\n * leave the `tierId` field empty. See the Loyalty Tiers API for more information on tiers.\n * @param - Reward to create.\n * @returns Created reward.\n */\n (reward: NonNullablePaths<Reward, `name`>): Promise<\n NonNullablePaths<Reward, RewardNonNullablePaths>\n >;\n}\n\nexport function bulkCreateRewards(\n httpClient: HttpClient\n): BulkCreateRewardsSignature {\n return (rewards: NonNullablePaths<Reward, `name`>[]) =>\n universalBulkCreateRewards(\n rewards,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkCreateRewardsSignature {\n /**\n * Creates multiple rewards.\n * @param - Rewards to create.\n */\n (rewards: NonNullablePaths<Reward, `name`>[]): Promise<\n NonNullablePaths<\n BulkCreateRewardsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | {\n [P in RewardNonNullablePaths]: `results.${number}.item.${P}`;\n }[RewardNonNullablePaths]\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n >;\n}\n\nexport function getReward(httpClient: HttpClient): GetRewardSignature {\n return (_id: string) =>\n universalGetReward(\n _id,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetRewardSignature {\n /**\n * Retrieves a reward.\n * @param - ID of the reward to retrieve.\n * @returns Retrieved reward.\n */\n (_id: string): Promise<NonNullablePaths<Reward, RewardNonNullablePaths>>;\n}\n\nexport function bulkGetRewards(\n httpClient: HttpClient\n): BulkGetRewardsSignature {\n return () =>\n universalBulkGetRewards(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGetRewardsSignature {\n /**\n * Retrieves rewards from all metasites that the caller is the member of.\n *\n * Must be called with user identity.\n */\n (): Promise<\n NonNullablePaths<\n BulkGetRewardsResponse,\n | `rewardsInSite`\n | `rewardsInSite.${number}.metaSiteId`\n | {\n [P in RewardNonNullablePaths]: `rewardsInSite.${number}.rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n >;\n}\n\nexport function queryRewards(httpClient: HttpClient): QueryRewardsSignature {\n return (query: CursorQuery) =>\n universalQueryRewards(\n query,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface QueryRewardsSignature {\n /**\n * Retrieves a list of rewards, given the provided paging, filtering, and sorting.\n *\n * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.\n *\n * To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),[Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).\n * @param - Query parameters.\n */\n (query: CursorQuery): Promise<\n NonNullablePaths<\n QueryRewardsResponse,\n {\n [P in RewardNonNullablePaths]: `rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n >;\n}\n\nexport function updateReward(httpClient: HttpClient): UpdateRewardSignature {\n return (\n _id: string,\n reward: NonNullablePaths<UpdateReward, `name` | `revision`>\n ) =>\n universalUpdateReward(\n _id,\n reward,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface UpdateRewardSignature {\n /**\n * Updates a loyalty reward.\n *\n * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,\n * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.\n *\n * You may not change the `type` of a reward. That is set upon creation and cannot be updated.\n * @param - Reward ID.\n * @param - Reward info to update.\n */\n (\n _id: string,\n reward: NonNullablePaths<UpdateReward, `name` | `revision`>\n ): Promise<\n NonNullablePaths<\n UpdateRewardResponse,\n { [P in RewardNonNullablePaths]: `reward.${P}` }[RewardNonNullablePaths]\n >\n >;\n}\n\nexport function deleteReward(httpClient: HttpClient): DeleteRewardSignature {\n return (_id: string, revision: string) =>\n universalDeleteReward(\n _id,\n revision,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface DeleteRewardSignature {\n /**\n * Deletes a reward.\n * @param - ID of the reward to delete.\n * @param - Revision number, which increments by 1 each time the reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.\n */\n (_id: string, revision: string): Promise<void>;\n}\n\nexport function listRewards(httpClient: HttpClient): ListRewardsSignature {\n return (options?: ListRewardsOptions) =>\n universalListRewards(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListRewardsSignature {\n /**\n * Retrieves a list of rewards.\n *\n * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.\n * @param - List options.\n */\n (options?: ListRewardsOptions): Promise<\n NonNullablePaths<\n ListRewardsResponse,\n {\n [P in RewardNonNullablePaths]: `rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n >;\n}\n\nexport const onRewardCreated = EventDefinition(\n 'wix.loyalty.v1.reward_created',\n true,\n (event: RewardCreatedEnvelope) =>\n renameKeysFromRESTResponseToSDKResponse(\n transformPaths(event, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'entity.createdDate' },\n { path: 'entity.updatedDate' },\n { path: 'metadata.eventTime' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'entity.couponReward.minimumSubtotal' },\n { path: 'entity.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'entity.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ])\n )\n)<RewardCreatedEnvelope>();\nexport const onRewardDeleted = EventDefinition(\n 'wix.loyalty.v1.reward_deleted',\n true,\n (event: RewardDeletedEnvelope) =>\n renameKeysFromRESTResponseToSDKResponse(\n transformPaths(event, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'undefined.createdDate' },\n { path: 'undefined.updatedDate' },\n { path: 'metadata.eventTime' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'undefined.couponReward.minimumSubtotal' },\n { path: 'undefined.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'undefined.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ])\n )\n)<RewardDeletedEnvelope>();\nexport const onRewardUpdated = EventDefinition(\n 'wix.loyalty.v1.reward_updated',\n true,\n (event: RewardUpdatedEnvelope) =>\n renameKeysFromRESTResponseToSDKResponse(\n transformPaths(event, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'entity.createdDate' },\n { path: 'entity.updatedDate' },\n { path: 'metadata.eventTime' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'entity.couponReward.minimumSubtotal' },\n { path: 'entity.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'entity.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ])\n )\n)<RewardUpdatedEnvelope>();\n\nexport {\n ActionEvent,\n ApplicationError,\n BaseEventMetadata,\n BulkActionMetadata,\n BulkCreateRewardsRequest,\n BulkCreateRewardsResponse,\n BulkGetRewardsRequest,\n BulkGetRewardsResponse,\n BulkRewardResult,\n CouponReward,\n CouponRewardDiscountTypeOneOf,\n CouponRewardScopeOrMinSubtotalOneOf,\n CouponScope,\n CreateRewardRequest,\n CreateRewardResponse,\n CursorPaging,\n CursorPagingMetadata,\n CursorQuery,\n CursorQueryPagingMethodOneOf,\n Cursors,\n DeleteRewardRequest,\n DeleteRewardResponse,\n DiscountAmount,\n DiscountAmountConfig,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n EventMetadata,\n FixedAmountDiscount,\n FixedAmountDiscountConfig,\n FreeShippingDiscount,\n FreeShippingDiscountConfig,\n GetRewardRequest,\n GetRewardResponse,\n Group,\n IdentificationData,\n IdentificationDataIdOneOf,\n ItemMetadata,\n ListRewardsInTierRequest,\n ListRewardsInTierResponse,\n ListRewardsOptions,\n ListRewardsRequest,\n ListRewardsResponse,\n MessageEnvelope,\n PagingMetadataV2,\n PercentageDiscount,\n PercentageDiscountConfig,\n QueryRewardsRequest,\n QueryRewardsResponse,\n RestoreInfo,\n Reward,\n RewardCreatedEnvelope,\n RewardDeletedEnvelope,\n RewardDisabled,\n RewardType,\n RewardTypeDetailsOneOf,\n RewardUpdatedEnvelope,\n RewardsInSite,\n SortOrder,\n Sorting,\n SpiDiscountAmount,\n UpdateReward,\n UpdateRewardRequest,\n UpdateRewardResponse,\n WebhookIdentityType,\n} from './loyalty-v1-reward-rewards.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixLoyaltyV1Reward from './loyalty-v1-reward-rewards.http.js';\n\n/**\n * A loyalty reward is an object a customer can redeem with loyalty points.\n * Redeeming a reward then creates a loyalty coupon that the customer can use.\n */\nexport interface Reward extends RewardTypeDetailsOneOf {\n /** Discount details. */\n discountAmount?: DiscountAmount;\n /** Coupon details. */\n couponReward?: CouponReward;\n /**\n * Reward ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Reward name.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /** Whether the reward is active. Default: `FALSE` */\n active?: boolean;\n /** Reward type. */\n type?: RewardTypeWithLiterals;\n /**\n * Revision number, which increments by 1 each time the loyalty reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty reward.\n * @readonly\n */\n revision?: string | null;\n /**\n * Date and time the reward was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the reward was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n}\n\n/** @oneof */\nexport interface RewardTypeDetailsOneOf {\n /** Discount details. */\n discountAmount?: DiscountAmount;\n /** Coupon details. */\n couponReward?: CouponReward;\n}\n\n/** Available reward types. */\nexport enum RewardType {\n /** Undefined reward type. */\n UNDEFINED = 'UNDEFINED',\n /** Discount reward. Special flexible reward type used in checkout. */\n DISCOUNT_AMOUNT = 'DISCOUNT_AMOUNT',\n /** Coupon reward. [Learn more about coupons.](https://support.wix.com/en/article/using-coupons-as-loyalty-rewards) */\n COUPON_REWARD = 'COUPON_REWARD',\n /** For internal use. */\n SPI_DISCOUNT_AMOUNT = 'SPI_DISCOUNT_AMOUNT',\n}\n\n/** @enumType */\nexport type RewardTypeWithLiterals =\n | RewardType\n | 'UNDEFINED'\n | 'DISCOUNT_AMOUNT'\n | 'COUPON_REWARD'\n | 'SPI_DISCOUNT_AMOUNT';\n\nexport interface DiscountAmount {\n /**\n * Discount details for each tier.\n * @maxSize 21\n */\n configsByTier?: DiscountAmountConfig[];\n}\n\nexport interface DiscountAmountConfig {\n /**\n * Discount amount. Must be a positive value.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0, maxScale:2 }\n */\n amount?: string;\n /**\n * Tier ID, or empty if config applies to the base tier.\n * @format GUID\n */\n tierId?: string | null;\n /**\n * Amount of points required to redeem the reward.\n * @min 1\n * @max 9999999\n */\n costInPoints?: number;\n}\n\nexport interface CouponReward\n extends CouponRewardDiscountTypeOneOf,\n CouponRewardScopeOrMinSubtotalOneOf {\n /** Discount as a fixed amount. */\n fixedAmount?: FixedAmountDiscount;\n /** Discount as a percentage. */\n percentage?: PercentageDiscount;\n /** Free shipping. */\n freeShipping?: FreeShippingDiscount;\n /** Limit the coupon to carts with a subtotal greater than this number. */\n minimumSubtotal?: number;\n /**\n * Specifies the type of line items this coupon will apply to.\n *\n * For more information, see the Coupons API.\n */\n scope?: CouponScope;\n /** Whether the coupon is limited to one item. */\n limitedToOneItem?: boolean | null;\n /**\n * Whether the coupon applies to subscription products.\n *\n * If set to `true`, the discount will apply to all billing cycles.\n */\n appliesToSubscriptions?: boolean | null;\n /**\n * Reserved for internal use.\n * @min 1\n * @max 999\n */\n discountedCycleCount?: number | null;\n}\n\n/** @oneof */\nexport interface CouponRewardDiscountTypeOneOf {\n /** Discount as a fixed amount. */\n fixedAmount?: FixedAmountDiscount;\n /** Discount as a percentage. */\n percentage?: PercentageDiscount;\n /** Free shipping. */\n freeShipping?: FreeShippingDiscount;\n}\n\n/** @oneof */\nexport interface CouponRewardScopeOrMinSubtotalOneOf {\n /** Limit the coupon to carts with a subtotal greater than this number. */\n minimumSubtotal?: number;\n /**\n * Specifies the type of line items this coupon will apply to.\n *\n * For more information, see the Coupons API.\n */\n scope?: CouponScope;\n}\n\nexport interface FixedAmountDiscount {\n /**\n * Discount details for each tier.\n * @minSize 1\n * @maxSize 21\n */\n configsByTier?: FixedAmountDiscountConfig[];\n}\n\nexport interface FixedAmountDiscountConfig {\n /**\n * Tier ID, or empty if config applies to the base tier.\n * @format GUID\n */\n tierId?: string | null;\n /**\n * Amount of points required to redeem the reward.\n * @min 1\n * @max 9999999\n */\n costInPoints?: number;\n /** Discount amount. */\n amount?: number;\n}\n\nexport interface PercentageDiscount {\n /**\n * Discount details for each tier.\n * @minSize 1\n * @maxSize 21\n */\n configsByTier?: PercentageDiscountConfig[];\n}\n\nexport interface PercentageDiscountConfig {\n /**\n * Tier ID, or empty if config applies to the base tier.\n * @format GUID\n */\n tierId?: string | null;\n /**\n * Amount of points required to redeem the reward.\n * @min 1\n * @max 9999999\n */\n costInPoints?: number;\n /** Percentage discount. */\n percentage?: number;\n}\n\nexport interface FreeShippingDiscount {\n /**\n * Discount details for each tier.\n * @minSize 1\n * @maxSize 21\n */\n configsByTier?: FreeShippingDiscountConfig[];\n}\n\nexport interface FreeShippingDiscountConfig {\n /**\n * Tier ID, or empty if config applies to the base tier.\n * @format GUID\n */\n tierId?: string | null;\n /**\n * Amount of points required to redeem the reward.\n * @min 1\n * @max 9999999\n */\n costInPoints?: number;\n}\n\nexport interface CouponScope {\n /**\n * Scope namespace.\n *\n * See the Coupons API for valid namespaces.\n */\n namespace?: string;\n /**\n * Coupon scope's applied group.\n *\n * See the Coupons API for valid groups.\n */\n group?: Group;\n}\n\nexport interface Group {\n /**\n * Name of coupon scope's group.\n *\n * See the Coupons API for valid groups.\n */\n name?: string;\n /** Entity ID, if the coupon scope is limited to just one item. */\n entityId?: string | null;\n}\n\nexport interface SpiDiscountAmount {\n /**\n * Discount details for each tier.\n * @maxSize 21\n */\n configsByTier?: DiscountAmountConfig[];\n /**\n * Description of the SPI discount amount reward. Taken from user input in the SPI config.\n * @maxLength 200\n */\n description?: string;\n}\n\nexport interface RewardDisabled {}\n\nexport interface CreateRewardRequest {\n /** Reward to create. */\n reward: Reward;\n}\n\nexport interface CreateRewardResponse {\n /** Created reward. */\n reward?: Reward;\n}\n\nexport interface BulkCreateRewardsRequest {\n /**\n * Rewards to create.\n * @minSize 1\n * @maxSize 10\n */\n rewards: Reward[];\n}\n\nexport interface BulkCreateRewardsResponse {\n /** Created rewards. */\n results?: BulkRewardResult[];\n /** Total successes and failures of the bulk create rewards action. */\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkRewardResult {\n /** Item metadata. */\n itemMetadata?: ItemMetadata;\n /** Created reward. */\n item?: Reward;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface GetRewardRequest {\n /**\n * ID of the reward to retrieve.\n * @format GUID\n */\n _id: string;\n}\n\nexport interface GetRewardResponse {\n /** Retrieved reward. */\n reward?: Reward;\n}\n\nexport interface BulkGetRewardsRequest {}\n\nexport interface BulkGetRewardsResponse {\n /** Found rewards per site. */\n rewardsInSite?: RewardsInSite[];\n}\n\nexport interface RewardsInSite {\n /**\n * Metasite id.\n * @format GUID\n */\n metaSiteId?: string;\n /** Rewards. */\n rewards?: Reward[];\n}\n\nexport interface QueryRewardsRequest {\n /** Query parameters. */\n query: CursorQuery;\n}\n\nexport interface CursorQuery extends CursorQueryPagingMethodOneOf {\n /**\n * Cursor paging options.\n *\n * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).\n */\n cursorPaging?: CursorPaging;\n /**\n * Filter object.\n *\n * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).\n */\n filter?: Record<string, any> | null;\n /**\n * Sort object.\n *\n * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).\n * @maxSize 5\n */\n sort?: Sorting[];\n}\n\n/** @oneof */\nexport interface CursorQueryPagingMethodOneOf {\n /**\n * Cursor paging options.\n *\n * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).\n */\n cursorPaging?: CursorPaging;\n}\n\nexport interface Sorting {\n /**\n * Name of the field to sort by.\n * @maxLength 512\n */\n fieldName?: string;\n /** Sort order. */\n order?: SortOrderWithLiterals;\n}\n\nexport enum SortOrder {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\n/** @enumType */\nexport type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';\n\nexport interface CursorPaging {\n /**\n * Maximum number of items to return in the results.\n * @max 100\n */\n limit?: number | null;\n /**\n * Pointer to the next or previous page in the list of results.\n *\n * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.\n * Not relevant for the first request.\n * @maxLength 16000\n */\n cursor?: string | null;\n}\n\nexport interface QueryRewardsResponse {\n /** Retrieved loyalty rewards. */\n rewards?: Reward[];\n /** Details on the paged set of results returned. */\n pagingMetadata?: CursorPagingMetadata;\n}\n\nexport interface CursorPagingMetadata {\n /** Number of items returned in current page. */\n count?: number | null;\n /** Cursor strings that point to the next page, previous page, or both. */\n cursors?: Cursors;\n /**\n * Whether there are more pages to retrieve following the current page.\n *\n * + `true`: Another page of results can be retrieved.\n * + `false`: This is the last page.\n */\n hasNext?: boolean | null;\n}\n\nexport interface Cursors {\n /**\n * Cursor string pointing to the next page in the list of results.\n * @maxLength 16000\n */\n next?: string | null;\n /**\n * Cursor pointing to the previous page in the list of results.\n * @maxLength 16000\n */\n prev?: string | null;\n}\n\nexport interface UpdateRewardRequest {\n /** Reward information to update. */\n reward: Reward;\n}\n\nexport interface UpdateRewardResponse {\n /** Updated reward. */\n reward?: Reward;\n}\n\nexport interface DeleteRewardRequest {\n /**\n * ID of the reward to delete.\n * @format GUID\n */\n _id: string;\n /**\n * Revision number, which increments by 1 each time the reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.\n */\n revision?: string;\n}\n\nexport interface DeleteRewardResponse {}\n\nexport interface ListRewardsRequest {\n /** Pagination options. */\n cursorPaging?: CursorPaging;\n}\n\nexport interface ListRewardsResponse {\n /** Retrieved loyalty rewards. */\n rewards?: Reward[];\n /** Details on the paged set of results returned. */\n pagingMetadata?: PagingMetadataV2;\n}\n\nexport interface PagingMetadataV2 {\n /** Number of items returned in the response. */\n count?: number | null;\n /** Offset that was requested. */\n offset?: number | null;\n /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */\n total?: number | null;\n /** Flag that indicates the server failed to calculate the `total` field. */\n tooManyToCount?: boolean | null;\n /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */\n cursors?: Cursors;\n}\n\nexport interface ListRewardsInTierRequest {\n /**\n * Tier id.\n * @format GUID\n * @readonly\n */\n tierId?: string | null;\n /** Pagination options. */\n cursorPaging?: CursorPaging;\n}\n\nexport interface ListRewardsInTierResponse {\n /** Retrieved loyalty rewards. */\n rewards?: Reward[];\n /** Details on the paged set of results returned. */\n pagingMetadata?: PagingMetadataV2;\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /**\n * Unique event ID.\n * Allows clients to ignore duplicate webhooks.\n */\n _id?: string;\n /**\n * Assumes actions are also always typed to an entity_type\n * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction\n */\n entityFqdn?: string;\n /**\n * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)\n * This is although the created/updated/deleted notion is duplication of the oneof types\n * Example: created/updated/deleted/started/completed/email_opened\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number defining the order of updates to the underlying entity.\n * For example, given that some entity was updated at 16:00 and than again at 16:01,\n * it is guaranteed that the sequence number of the second update is strictly higher than the first.\n * As the consumer, you can use this value to ensure that you handle messages in the correct order.\n * To do so, you will need to persist this number on your end, and compare the sequence number from the\n * message against the one you have stored. Given that the stored number is higher, you should ignore the message.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n}\n\nexport interface EventMetadata extends BaseEventMetadata {\n /**\n * Unique event ID.\n * Allows clients to ignore duplicate webhooks.\n */\n _id?: string;\n /**\n * Assumes actions are also always typed to an entity_type\n * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction\n */\n entityFqdn?: string;\n /**\n * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)\n * This is although the created/updated/deleted notion is duplication of the oneof types\n * Example: created/updated/deleted/started/completed/email_opened\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number defining the order of updates to the underlying entity.\n * For example, given that some entity was updated at 16:00 and than again at 16:01,\n * it is guaranteed that the sequence number of the second update is strictly higher than the first.\n * As the consumer, you can use this value to ensure that you handle messages in the correct order.\n * To do so, you will need to persist this number on your end, and compare the sequence number from the\n * message against the one you have stored. Given that the stored number is higher, you should ignore the message.\n */\n entityEventSequence?: string | null;\n}\n\nexport interface RewardCreatedEnvelope {\n entity: Reward;\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a reward is created.\n * @permissionScope Read Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY\n * @permissionScope Manage Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY\n * @permissionId LOYALTY.READ_REWARDS\n * @webhook\n * @eventType wix.loyalty.v1.reward_created\n * @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards\n * @slug created\n */\nexport declare function onRewardCreated(\n handler: (event: RewardCreatedEnvelope) => void | Promise<void>\n): void;\n\nexport interface RewardDeletedEnvelope {\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a reward is deleted.\n * @permissionScope Read Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY\n * @permissionScope Manage Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY\n * @permissionId LOYALTY.READ_REWARDS\n * @webhook\n * @eventType wix.loyalty.v1.reward_deleted\n * @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards\n * @slug deleted\n */\nexport declare function onRewardDeleted(\n handler: (event: RewardDeletedEnvelope) => void | Promise<void>\n): void;\n\nexport interface RewardUpdatedEnvelope {\n entity: Reward;\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a reward is updated.\n * @permissionScope Read Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY\n * @permissionScope Manage Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY\n * @permissionId LOYALTY.READ_REWARDS\n * @webhook\n * @eventType wix.loyalty.v1.reward_updated\n * @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards\n * @slug updated\n */\nexport declare function onRewardUpdated(\n handler: (event: RewardUpdatedEnvelope) => void | Promise<void>\n): void;\n\ntype RewardNonNullablePaths =\n | `discountAmount.configsByTier`\n | `discountAmount.configsByTier.${number}.amount`\n | `discountAmount.configsByTier.${number}.costInPoints`\n | `couponReward.fixedAmount.configsByTier`\n | `couponReward.fixedAmount.configsByTier.${number}.costInPoints`\n | `couponReward.fixedAmount.configsByTier.${number}.amount`\n | `couponReward.percentage.configsByTier`\n | `couponReward.percentage.configsByTier.${number}.costInPoints`\n | `couponReward.percentage.configsByTier.${number}.percentage`\n | `couponReward.freeShipping.configsByTier`\n | `couponReward.freeShipping.configsByTier.${number}.costInPoints`\n | `couponReward.minimumSubtotal`\n | `couponReward.scope.namespace`\n | `couponReward.scope.group.name`\n | `name`\n | `active`\n | `type`;\n\n/**\n * Creates a reward that can be redeemed with loyalty points.\n *\n * When a customer redeems a reward, a loyalty coupon is created\n * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can\n * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,\n * no coupon is actually created until a reward is redeemed with points.\n * See the Coupons API for more information about coupons.\n *\n * A reward's `active` status defaults to `false`. To make the reward available to customers,\n * either set the `active` field to `true` during creation or call [`updateReward()`](#updatereward)\n * to change the status.\n *\n * To customize a reward for each loyalty tier, use the `configsByTier` parameter.\n * This allows you to specify the amount of the earned discount, the cost in loyalty points\n * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own\n * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,\n * leave the `tierId` field empty. See the Loyalty Tiers API for more information on tiers.\n * @param reward - Reward to create.\n * @public\n * @requiredField reward\n * @requiredField reward.name\n * @permissionId LOYALTY.MANAGE_REWARDS\n * @applicableIdentity APP\n * @returns Created reward.\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.CreateReward\n */\nexport async function createReward(\n reward: NonNullablePaths<Reward, `name`>\n): Promise<NonNullablePaths<Reward, RewardNonNullablePaths>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ reward: reward });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.createReward(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.reward!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { reward: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['reward']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Creates multiple rewards.\n * @param rewards - Rewards to create.\n * @public\n * @requiredField rewards\n * @requiredField rewards.name\n * @permissionId LOYALTY.MANAGE_REWARDS\n * @applicableIdentity APP\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.BulkCreateRewards\n */\nexport async function bulkCreateRewards(\n rewards: NonNullablePaths<Reward, `name`>[]\n): Promise<\n NonNullablePaths<\n BulkCreateRewardsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | {\n [P in RewardNonNullablePaths]: `results.${number}.item.${P}`;\n }[RewardNonNullablePaths]\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ rewards: rewards });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.bulkCreateRewards(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { rewards: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['rewards']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a reward.\n * @param _id - ID of the reward to retrieve.\n * @public\n * @requiredField _id\n * @permissionId LOYALTY.READ_REWARDS\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @returns Retrieved reward.\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.GetReward\n */\nexport async function getReward(\n _id: string\n): Promise<NonNullablePaths<Reward, RewardNonNullablePaths>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.getReward(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.reward!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { id: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['_id']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves rewards from all metasites that the caller is the member of.\n *\n * Must be called with user identity.\n * @public\n * @documentationMaturity preview\n * @permissionId LOYALTY.REWARD_BULK_READ\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.BulkGetRewards\n */\nexport async function bulkGetRewards(): Promise<\n NonNullablePaths<\n BulkGetRewardsResponse,\n | `rewardsInSite`\n | `rewardsInSite.${number}.metaSiteId`\n | {\n [P in RewardNonNullablePaths]: `rewardsInSite.${number}.rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.bulkGetRewards(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a list of rewards, given the provided paging, filtering, and sorting.\n *\n * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.\n *\n * To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),[Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).\n * @param query - Query parameters.\n * @public\n * @requiredField query\n * @permissionId LOYALTY.READ_REWARDS\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.QueryRewards\n */\nexport async function queryRewards(\n query: CursorQuery\n): Promise<\n NonNullablePaths<\n QueryRewardsResponse,\n {\n [P in RewardNonNullablePaths]: `rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ query: query });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.queryRewards(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { query: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['query']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Updates a loyalty reward.\n *\n * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,\n * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.\n *\n * You may not change the `type` of a reward. That is set upon creation and cannot be updated.\n * @param _id - Reward ID.\n * @public\n * @requiredField _id\n * @requiredField reward\n * @requiredField reward.name\n * @requiredField reward.revision\n * @param reward - Reward info to update.\n * @permissionId LOYALTY.MANAGE_REWARDS\n * @applicableIdentity APP\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.UpdateReward\n */\nexport async function updateReward(\n _id: string,\n reward: NonNullablePaths<UpdateReward, `name` | `revision`>\n): Promise<\n NonNullablePaths<\n UpdateRewardResponse,\n { [P in RewardNonNullablePaths]: `reward.${P}` }[RewardNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n reward: { ...reward, id: _id },\n });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.updateReward(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: { reward: '$[1]' },\n explicitPathsToArguments: { 'reward.id': '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['_id', 'reward']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface UpdateReward {\n /** Discount details. */\n discountAmount?: DiscountAmount;\n /** Coupon details. */\n couponReward?: CouponReward;\n /**\n * Reward ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Reward name.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /** Whether the reward is active. Default: `FALSE` */\n active?: boolean;\n /** Reward type. */\n type?: RewardTypeWithLiterals;\n /**\n * Revision number, which increments by 1 each time the loyalty reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty reward.\n * @readonly\n */\n revision?: string | null;\n /**\n * Date and time the reward was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the reward was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n}\n\n/**\n * Deletes a reward.\n * @param _id - ID of the reward to delete.\n * @param revision - Revision number, which increments by 1 each time the reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.\n * @public\n * @requiredField _id\n * @requiredField revision\n * @permissionId LOYALTY.MANAGE_REWARDS\n * @applicableIdentity APP\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.DeleteReward\n */\nexport async function deleteReward(\n _id: string,\n revision: string\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n id: _id,\n revision: revision,\n });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.deleteReward(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { id: '$[0]', revision: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['_id', 'revision']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a list of rewards.\n *\n * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.\n * @public\n * @param options - List options.\n * @permissionId LOYALTY.READ_REWARDS\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.ListRewards\n */\nexport async function listRewards(\n options?: ListRewardsOptions\n): Promise<\n NonNullablePaths<\n ListRewardsResponse,\n {\n [P in RewardNonNullablePaths]: `rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cursorPaging: options?.cursorPaging,\n });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.listRewards(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { cursorPaging: '$[0].cursorPaging' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ListRewardsOptions {\n /** Pagination options. */\n cursorPaging?: CursorPaging;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformRESTFloatToSDKFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'editor.wixapps.net': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n '*.pub.wix-code.com': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'api._api_base_domain_': [\n {\n srcPath: '/loyalty-rewards',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/loyalty-rewards',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_loyalty_rewards';\n\n/**\n * Creates a reward that can be redeemed with loyalty points.\n *\n * When a customer redeems a reward, a loyalty coupon is created\n * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can\n * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,\n * no coupon is actually created until a reward is redeemed with points.\n * See the Coupons API for more information about coupons.\n *\n * A reward's `active` status defaults to `false`. To make the reward available to customers,\n * either set the `active` field to `true` during creation or call [`updateReward()`](#updatereward)\n * to change the status.\n *\n * To customize a reward for each loyalty tier, use the `configsByTier` parameter.\n * This allows you to specify the amount of the earned discount, the cost in loyalty points\n * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own\n * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,\n * leave the `tierId` field empty. See the Loyalty Tiers API for more information on tiers.\n */\nexport function createReward(payload: object): RequestOptionsFactory<any> {\n function __createReward({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'reward.createdDate' }, { path: 'reward.updatedDate' }],\n },\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'reward.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.CreateReward',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'reward.createdDate' },\n { path: 'reward.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'reward.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __createReward;\n}\n\n/** Creates multiple rewards. */\nexport function bulkCreateRewards(payload: object): RequestOptionsFactory<any> {\n function __bulkCreateRewards({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'rewards.createdDate' },\n { path: 'rewards.updatedDate' },\n ],\n },\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [\n { path: 'rewards.couponReward.minimumSubtotal' },\n { path: 'rewards.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'rewards.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.BulkCreateRewards',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/bulk/rewards/create',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'results.item.createdDate' },\n { path: 'results.item.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'results.item.couponReward.minimumSubtotal' },\n {\n path: 'results.item.couponReward.fixedAmount.configsByTier.amount',\n },\n {\n path: 'results.item.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkCreateRewards;\n}\n\n/** Retrieves a reward. */\nexport function getReward(payload: object): RequestOptionsFactory<any> {\n function __getReward({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.GetReward',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards/{id}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'reward.createdDate' },\n { path: 'reward.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'reward.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getReward;\n}\n\n/**\n * Retrieves rewards from all metasites that the caller is the member of.\n *\n * Must be called with user identity.\n */\nexport function bulkGetRewards(payload: object): RequestOptionsFactory<any> {\n function __bulkGetRewards({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.BulkGetRewards',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/bulk/rewards',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'rewardsInSite.rewards.createdDate' },\n { path: 'rewardsInSite.rewards.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'rewardsInSite.rewards.couponReward.minimumSubtotal' },\n {\n path: 'rewardsInSite.rewards.couponReward.fixedAmount.configsByTier.amount',\n },\n {\n path: 'rewardsInSite.rewards.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkGetRewards;\n}\n\n/**\n * Retrieves a list of rewards, given the provided paging, filtering, and sorting.\n *\n * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.\n *\n * To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),[Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).\n */\nexport function queryRewards(payload: object): RequestOptionsFactory<any> {\n function __queryRewards({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.QueryRewards',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards/query',\n data: payload,\n host,\n }),\n data: payload,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'rewards.createdDate' },\n { path: 'rewards.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'rewards.couponReward.minimumSubtotal' },\n { path: 'rewards.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'rewards.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __queryRewards;\n}\n\n/**\n * Updates a loyalty reward.\n *\n * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,\n * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.\n *\n * You may not change the `type` of a reward. That is set upon creation and cannot be updated.\n */\nexport function updateReward(payload: object): RequestOptionsFactory<any> {\n function __updateReward({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'reward.createdDate' }, { path: 'reward.updatedDate' }],\n },\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'reward.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'PUT' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.UpdateReward',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards/{reward.id}',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'reward.createdDate' },\n { path: 'reward.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'reward.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __updateReward;\n}\n\n/** Deletes a reward. */\nexport function deleteReward(payload: object): RequestOptionsFactory<any> {\n function __deleteReward({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'DELETE' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.DeleteReward',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards/{id}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __deleteReward;\n}\n\n/**\n * Retrieves a list of rewards.\n *\n * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.\n */\nexport function listRewards(payload: object): RequestOptionsFactory<any> {\n function __listRewards({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.ListRewards',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'rewards.createdDate' },\n { path: 'rewards.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'rewards.couponReward.minimumSubtotal' },\n { path: 'rewards.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'rewards.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __listRewards;\n}\n","import {\n createReward as publicCreateReward,\n bulkCreateRewards as publicBulkCreateRewards,\n getReward as publicGetReward,\n bulkGetRewards as publicBulkGetRewards,\n queryRewards as publicQueryRewards,\n updateReward as publicUpdateReward,\n deleteReward as publicDeleteReward,\n listRewards as publicListRewards,\n} from './loyalty-v1-reward-rewards.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { createEventModule } from '@wix/sdk-runtime/event-definition-modules';\nimport {\n BuildRESTFunction,\n MaybeContext,\n BuildEventDefinition,\n} from '@wix/sdk-types';\nimport { onRewardCreated as publicOnRewardCreated } from './loyalty-v1-reward-rewards.public.js';\nimport { onRewardDeleted as publicOnRewardDeleted } from './loyalty-v1-reward-rewards.public.js';\nimport { onRewardUpdated as publicOnRewardUpdated } from './loyalty-v1-reward-rewards.public.js';\n\nexport const createReward: MaybeContext<\n BuildRESTFunction<typeof publicCreateReward> & typeof publicCreateReward\n> = /*#__PURE__*/ createRESTModule(publicCreateReward);\nexport const bulkCreateRewards: MaybeContext<\n BuildRESTFunction<typeof publicBulkCreateRewards> &\n typeof publicBulkCreateRewards\n> = /*#__PURE__*/ createRESTModule(publicBulkCreateRewards);\nexport const getReward: MaybeContext<\n BuildRESTFunction<typeof publicGetReward> & typeof publicGetReward\n> = /*#__PURE__*/ createRESTModule(publicGetReward);\nexport const bulkGetRewards: MaybeContext<\n BuildRESTFunction<typeof publicBulkGetRewards> & typeof publicBulkGetRewards\n> = /*#__PURE__*/ createRESTModule(publicBulkGetRewards);\nexport const queryRewards: MaybeContext<\n BuildRESTFunction<typeof publicQueryRewards> & typeof publicQueryRewards\n> = /*#__PURE__*/ createRESTModule(publicQueryRewards);\nexport const updateReward: MaybeContext<\n BuildRESTFunction<typeof publicUpdateReward> & typeof publicUpdateReward\n> = /*#__PURE__*/ createRESTModule(publicUpdateReward);\nexport const deleteReward: MaybeContext<\n BuildRESTFunction<typeof publicDeleteReward> & typeof publicDeleteReward\n> = /*#__PURE__*/ createRESTModule(publicDeleteReward);\nexport const listRewards: MaybeContext<\n BuildRESTFunction<typeof publicListRewards> & typeof publicListRewards\n> = /*#__PURE__*/ createRESTModule(publicListRewards);\n/**\n * Triggered when a reward is created.\n */\nexport const onRewardCreated: BuildEventDefinition<\n typeof publicOnRewardCreated\n> = createEventModule(publicOnRewardCreated);\n/**\n * Triggered when a reward is deleted.\n */\nexport const onRewardDeleted: BuildEventDefinition<\n typeof publicOnRewardDeleted\n> = createEventModule(publicOnRewardDeleted);\n/**\n * Triggered when a reward is updated.\n */\nexport const onRewardUpdated: BuildEventDefinition<\n typeof publicOnRewardUpdated\n> = createEventModule(publicOnRewardUpdated);\n\nexport {\n RewardType,\n SortOrder,\n WebhookIdentityType,\n} from './loyalty-v1-reward-rewards.universal.js';\nexport {\n Reward,\n RewardTypeDetailsOneOf,\n DiscountAmount,\n DiscountAmountConfig,\n CouponReward,\n CouponRewardDiscountTypeOneOf,\n CouponRewardScopeOrMinSubtotalOneOf,\n FixedAmountDiscount,\n FixedAmountDiscountConfig,\n PercentageDiscount,\n PercentageDiscountConfig,\n FreeShippingDiscount,\n FreeShippingDiscountConfig,\n CouponScope,\n Group,\n SpiDiscountAmount,\n RewardDisabled,\n CreateRewardRequest,\n CreateRewardResponse,\n BulkCreateRewardsRequest,\n BulkCreateRewardsResponse,\n BulkRewardResult,\n ItemMetadata,\n ApplicationError,\n BulkActionMetadata,\n GetRewardRequest,\n GetRewardResponse,\n BulkGetRewardsRequest,\n BulkGetRewardsResponse,\n RewardsInSite,\n QueryRewardsRequest,\n CursorQuery,\n CursorQueryPagingMethodOneOf,\n Sorting,\n CursorPaging,\n QueryRewardsResponse,\n CursorPagingMetadata,\n Cursors,\n UpdateRewardRequest,\n UpdateRewardResponse,\n DeleteRewardRequest,\n DeleteRewardResponse,\n ListRewardsRequest,\n ListRewardsResponse,\n PagingMetadataV2,\n ListRewardsInTierRequest,\n ListRewardsInTierResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n BaseEventMetadata,\n EventMetadata,\n RewardCreatedEnvelope,\n RewardDeletedEnvelope,\n RewardUpdatedEnvelope,\n UpdateReward,\n ListRewardsOptions,\n} from './loyalty-v1-reward-rewards.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAAA;AAAA,EAAA,sBAAAC;AAAA,EAAA,oBAAAC;AAAA,EAAA,oBAAAC;AAAA,EAAA,iBAAAC;AAAA,EAAA,mBAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,oBAAAC;AAAA,EAAA,oBAAAC;AAAA;AAAA;;;ACAA,IAAAC,iCAAwD;AACxD,IAAAC,gBAA6C;AAC7C,IAAAC,oBAAqD;AACrD,IAAAC,0BAA+B;AAC/B,uBAA8D;;;ACJ9D,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,mBAA6C;AAC7C,IAAAC,gBAA6C;AAC7C,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,iDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;A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B;AAClB,IAAM,sBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,CAAC,cACC;AAAA,QACE,wCAAe,OAAO;AAAA,MACpB;AAAA,QACE,aAAa;AAAA,QACb,OAAO;AAAA,UACL,EAAE,MAAM,qBAAqB;AAAA,UAC7B,EAAE,MAAM,qBAAqB;AAAA,UAC7B,EAAE,MAAM,qBAAqB;AAAA,QAC/B;AAAA,MACF;AAAA,MACA;AAAA,QACE,aAAa;AAAA,QACb,OAAO;AAAA,UACL,EAAE,MAAM,sCAAsC;AAAA,UAC9C,EAAE,MAAM,uDAAuD;AAAA,UAC/D,EAAE,MAAM,0DAA0D;AAAA,QACpE;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACJ,EAAyB;;;AGrVzB,IAAAC,uBAAiC;AACjC,sCAAkC;AAU3B,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,qBAGK,2DAAiBA,kBAAuB;AACnD,IAAMC,aAEK,2DAAiBA,UAAe;AAC3C,IAAMC,kBAEK,2DAAiBA,eAAoB;AAChD,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,eAEK,2DAAiBA,YAAiB;AAI7C,IAAMC,uBAET,mDAAkB,eAAqB;AAIpC,IAAMC,uBAET,mDAAkB,eAAqB;AAIpC,IAAMC,uBAET,mDAAkB,eAAqB;","names":["bulkCreateRewards","bulkGetRewards","createReward","deleteReward","getReward","listRewards","onRewardCreated","onRewardDeleted","onRewardUpdated","queryRewards","updateReward","import_rename_all_nested_keys","import_float","import_timestamp","import_transform_paths","import_float","import_timestamp","import_rest_modules","payload","RewardType","SortOrder","WebhookIdentityType","createReward","sdkTransformError","bulkCreateRewards","getReward","bulkGetRewards","queryRewards","updateReward","deleteReward","listRewards","createReward","bulkCreateRewards","getReward","bulkGetRewards","queryRewards","updateReward","deleteReward","listRewards","import_rest_modules","createReward","bulkCreateRewards","getReward","bulkGetRewards","queryRewards","updateReward","deleteReward","listRewards","onRewardCreated","onRewardDeleted","onRewardUpdated"]}
1
+ {"version":3,"sources":["../../index.ts","../../src/loyalty-v1-reward-rewards.public.ts","../../src/loyalty-v1-reward-rewards.universal.ts","../../src/loyalty-v1-reward-rewards.http.ts","../../src/loyalty-v1-reward-rewards.context.ts"],"sourcesContent":["export * from './src/loyalty-v1-reward-rewards.context.js';\n","import { renameKeysFromRESTResponseToSDKResponse } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { transformRESTFloatToSDKFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { EventDefinition, HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n BulkCreateRewardsResponse,\n BulkGetRewardsResponse,\n CursorQuery,\n ListRewardsOptions,\n ListRewardsResponse,\n QueryRewardsResponse,\n Reward,\n RewardCreatedEnvelope,\n RewardDeletedEnvelope,\n RewardUpdatedEnvelope,\n UpdateReward,\n UpdateRewardResponse,\n bulkCreateRewards as universalBulkCreateRewards,\n bulkGetRewards as universalBulkGetRewards,\n createReward as universalCreateReward,\n deleteReward as universalDeleteReward,\n getReward as universalGetReward,\n listRewards as universalListRewards,\n queryRewards as universalQueryRewards,\n updateReward as universalUpdateReward,\n} from './loyalty-v1-reward-rewards.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/loyalty' };\n\ntype RewardNonNullablePaths =\n | `discountAmount.configsByTier`\n | `discountAmount.configsByTier.${number}.amount`\n | `discountAmount.configsByTier.${number}.costInPoints`\n | `couponReward.fixedAmount.configsByTier`\n | `couponReward.fixedAmount.configsByTier.${number}.costInPoints`\n | `couponReward.fixedAmount.configsByTier.${number}.amount`\n | `couponReward.percentage.configsByTier`\n | `couponReward.percentage.configsByTier.${number}.costInPoints`\n | `couponReward.percentage.configsByTier.${number}.percentage`\n | `couponReward.freeShipping.configsByTier`\n | `couponReward.freeShipping.configsByTier.${number}.costInPoints`\n | `couponReward.minimumSubtotal`\n | `couponReward.scope.namespace`\n | `couponReward.scope.group.name`\n | `name`\n | `active`\n | `type`;\n\nexport function createReward(httpClient: HttpClient): CreateRewardSignature {\n return (reward: NonNullablePaths<Reward, `name`>) =>\n universalCreateReward(\n reward,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface CreateRewardSignature {\n /**\n * Creates a reward that can be redeemed with loyalty points.\n *\n * When a customer [redeems a reward](/coupons/redeem-points-for-coupon), a loyalty coupon is created\n * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can\n * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,\n * no coupon is actually created until a [reward is redeemed](/coupons/redeem-points-for-coupon) with points.\n * See the [Coupons API](https://dev.wix.com/api/rest/coupons) for more information about coupons. The `type` of reward\n * cannot be updated.\n *\n * A reward's `active` status defaults to `false`. To make the reward available to customers,\n * either set the `active` field to `true` during creation or call [Update Reward](/update-reward)\n * to change the status.\n *\n * To customize a reward for each [loyalty tier](/tiers), use the `configsByTier` parameter.\n * This allows you to specify the amount of the earned discount, the cost in loyalty points\n * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own\n * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,\n * leave the `tierId` field empty. See the [Tiers API](/tiers) for more information on tiers.\n * @param - Reward to create.\n * @returns Created reward.\n */\n (reward: NonNullablePaths<Reward, `name`>): Promise<\n NonNullablePaths<Reward, RewardNonNullablePaths>\n >;\n}\n\nexport function bulkCreateRewards(\n httpClient: HttpClient\n): BulkCreateRewardsSignature {\n return (rewards: NonNullablePaths<Reward, `name`>[]) =>\n universalBulkCreateRewards(\n rewards,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkCreateRewardsSignature {\n /**\n * Creates multiple rewards.\n * @param - Rewards to create.\n */\n (rewards: NonNullablePaths<Reward, `name`>[]): Promise<\n NonNullablePaths<\n BulkCreateRewardsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | {\n [P in RewardNonNullablePaths]: `results.${number}.item.${P}`;\n }[RewardNonNullablePaths]\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n >;\n}\n\nexport function getReward(httpClient: HttpClient): GetRewardSignature {\n return (_id: string) =>\n universalGetReward(\n _id,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetRewardSignature {\n /**\n * Retrieves a reward.\n * @param - ID of the reward to retrieve.\n * @returns Retrieved reward.\n */\n (_id: string): Promise<NonNullablePaths<Reward, RewardNonNullablePaths>>;\n}\n\nexport function bulkGetRewards(\n httpClient: HttpClient\n): BulkGetRewardsSignature {\n return () =>\n universalBulkGetRewards(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGetRewardsSignature {\n /**\n * Retrieves rewards from all metasites that the caller is the member of.\n *\n * Must be called with user identity.\n */\n (): Promise<\n NonNullablePaths<\n BulkGetRewardsResponse,\n | `rewardsInSite`\n | `rewardsInSite.${number}.metaSiteId`\n | {\n [P in RewardNonNullablePaths]: `rewardsInSite.${number}.rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n >;\n}\n\nexport function queryRewards(httpClient: HttpClient): QueryRewardsSignature {\n return (query: CursorQuery) =>\n universalQueryRewards(\n query,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface QueryRewardsSignature {\n /**\n * Retrieves a list of rewards, given the provided paging, filtering, and sorting.\n *\n * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.\n *\n * To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),[Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).\n * @param - Query parameters.\n */\n (query: CursorQuery): Promise<\n NonNullablePaths<\n QueryRewardsResponse,\n {\n [P in RewardNonNullablePaths]: `rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n >;\n}\n\nexport function updateReward(httpClient: HttpClient): UpdateRewardSignature {\n return (\n _id: string,\n reward: NonNullablePaths<UpdateReward, `name` | `revision`>\n ) =>\n universalUpdateReward(\n _id,\n reward,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface UpdateRewardSignature {\n /**\n * Updates a loyalty reward.\n *\n * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,\n * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.\n *\n * You may not change the `type` of a reward. That is set upon creation and cannot be updated.\n * @param - Reward ID.\n * @param - Reward info to update.\n */\n (\n _id: string,\n reward: NonNullablePaths<UpdateReward, `name` | `revision`>\n ): Promise<\n NonNullablePaths<\n UpdateRewardResponse,\n { [P in RewardNonNullablePaths]: `reward.${P}` }[RewardNonNullablePaths]\n >\n >;\n}\n\nexport function deleteReward(httpClient: HttpClient): DeleteRewardSignature {\n return (_id: string, revision: string) =>\n universalDeleteReward(\n _id,\n revision,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface DeleteRewardSignature {\n /**\n * Deletes a reward.\n * @param - ID of the reward to delete.\n * @param - Revision number, which increments by 1 each time the reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.\n */\n (_id: string, revision: string): Promise<void>;\n}\n\nexport function listRewards(httpClient: HttpClient): ListRewardsSignature {\n return (options?: ListRewardsOptions) =>\n universalListRewards(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListRewardsSignature {\n /**\n * Retrieves a list of rewards.\n *\n * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.\n * @param - List options.\n */\n (options?: ListRewardsOptions): Promise<\n NonNullablePaths<\n ListRewardsResponse,\n {\n [P in RewardNonNullablePaths]: `rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n >;\n}\n\nexport const onRewardCreated = EventDefinition(\n 'wix.loyalty.v1.reward_created',\n true,\n (event: RewardCreatedEnvelope) =>\n renameKeysFromRESTResponseToSDKResponse(\n transformPaths(event, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'entity.createdDate' },\n { path: 'entity.updatedDate' },\n { path: 'metadata.eventTime' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'entity.couponReward.minimumSubtotal' },\n { path: 'entity.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'entity.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ])\n )\n)<RewardCreatedEnvelope>();\nexport const onRewardDeleted = EventDefinition(\n 'wix.loyalty.v1.reward_deleted',\n true,\n (event: RewardDeletedEnvelope) =>\n renameKeysFromRESTResponseToSDKResponse(\n transformPaths(event, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'undefined.createdDate' },\n { path: 'undefined.updatedDate' },\n { path: 'metadata.eventTime' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'undefined.couponReward.minimumSubtotal' },\n { path: 'undefined.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'undefined.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ])\n )\n)<RewardDeletedEnvelope>();\nexport const onRewardUpdated = EventDefinition(\n 'wix.loyalty.v1.reward_updated',\n true,\n (event: RewardUpdatedEnvelope) =>\n renameKeysFromRESTResponseToSDKResponse(\n transformPaths(event, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'entity.createdDate' },\n { path: 'entity.updatedDate' },\n { path: 'metadata.eventTime' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'entity.couponReward.minimumSubtotal' },\n { path: 'entity.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'entity.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ])\n )\n)<RewardUpdatedEnvelope>();\n\nexport {\n ActionEvent,\n ApplicationError,\n BaseEventMetadata,\n BulkActionMetadata,\n BulkCreateRewardsRequest,\n BulkCreateRewardsResponse,\n BulkGetRewardsRequest,\n BulkGetRewardsResponse,\n BulkRewardResult,\n CouponReward,\n CouponRewardDiscountTypeOneOf,\n CouponRewardScopeOrMinSubtotalOneOf,\n CouponScope,\n CreateRewardRequest,\n CreateRewardResponse,\n CursorPaging,\n CursorPagingMetadata,\n CursorQuery,\n CursorQueryPagingMethodOneOf,\n Cursors,\n DeleteRewardRequest,\n DeleteRewardResponse,\n DiscountAmount,\n DiscountAmountConfig,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n EventMetadata,\n FixedAmountDiscount,\n FixedAmountDiscountConfig,\n FreeShippingDiscount,\n FreeShippingDiscountConfig,\n GetRewardRequest,\n GetRewardResponse,\n Group,\n IdentificationData,\n IdentificationDataIdOneOf,\n ItemMetadata,\n ListRewardsInTierRequest,\n ListRewardsInTierResponse,\n ListRewardsOptions,\n ListRewardsRequest,\n ListRewardsResponse,\n MessageEnvelope,\n PagingMetadataV2,\n PercentageDiscount,\n PercentageDiscountConfig,\n QueryRewardsRequest,\n QueryRewardsResponse,\n RestoreInfo,\n Reward,\n RewardCreatedEnvelope,\n RewardDeletedEnvelope,\n RewardDisabled,\n RewardType,\n RewardTypeDetailsOneOf,\n RewardUpdatedEnvelope,\n RewardsInSite,\n SortOrder,\n Sorting,\n SpiDiscountAmount,\n UpdateReward,\n UpdateRewardRequest,\n UpdateRewardResponse,\n WebhookIdentityType,\n} from './loyalty-v1-reward-rewards.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixLoyaltyV1Reward from './loyalty-v1-reward-rewards.http.js';\n\n/**\n * A loyalty reward is an object a customer can redeem with loyalty points.\n * Redeeming a reward then creates a loyalty coupon that the customer can use.\n */\nexport interface Reward extends RewardTypeDetailsOneOf {\n /** Discount details. */\n discountAmount?: DiscountAmount;\n /** Coupon details. */\n couponReward?: CouponReward;\n /**\n * Reward ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Reward name.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /** Whether the reward is active. Default: `FALSE` */\n active?: boolean;\n /** Reward type. */\n type?: RewardTypeWithLiterals;\n /**\n * Revision number, which increments by 1 each time the loyalty reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty reward.\n * @readonly\n */\n revision?: string | null;\n /**\n * Date and time the reward was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the reward was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n}\n\n/** @oneof */\nexport interface RewardTypeDetailsOneOf {\n /** Discount details. */\n discountAmount?: DiscountAmount;\n /** Coupon details. */\n couponReward?: CouponReward;\n}\n\n/** Available reward types. */\nexport enum RewardType {\n /** Undefined reward type. */\n UNDEFINED = 'UNDEFINED',\n /** Discount reward. Special flexible reward type used in checkout. */\n DISCOUNT_AMOUNT = 'DISCOUNT_AMOUNT',\n /** Coupon reward. [Learn more about coupons.](https://support.wix.com/en/article/using-coupons-as-loyalty-rewards) */\n COUPON_REWARD = 'COUPON_REWARD',\n /** For internal use. */\n SPI_DISCOUNT_AMOUNT = 'SPI_DISCOUNT_AMOUNT',\n}\n\n/** @enumType */\nexport type RewardTypeWithLiterals =\n | RewardType\n | 'UNDEFINED'\n | 'DISCOUNT_AMOUNT'\n | 'COUPON_REWARD'\n | 'SPI_DISCOUNT_AMOUNT';\n\nexport interface DiscountAmount {\n /**\n * Discount details for each tier.\n * @maxSize 21\n */\n configsByTier?: DiscountAmountConfig[];\n}\n\nexport interface DiscountAmountConfig {\n /**\n * Discount amount. Must be a positive value.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0, maxScale:2 }\n */\n amount?: string;\n /**\n * Tier ID, or empty if config applies to the base tier.\n * @format GUID\n */\n tierId?: string | null;\n /**\n * Amount of points required to redeem the reward.\n * @min 1\n * @max 9999999\n */\n costInPoints?: number;\n}\n\nexport interface CouponReward\n extends CouponRewardDiscountTypeOneOf,\n CouponRewardScopeOrMinSubtotalOneOf {\n /** Discount as a fixed amount. */\n fixedAmount?: FixedAmountDiscount;\n /** Discount as a percentage. */\n percentage?: PercentageDiscount;\n /** Free shipping. */\n freeShipping?: FreeShippingDiscount;\n /** Limit the coupon to carts with a subtotal greater than this number. */\n minimumSubtotal?: number;\n /**\n * Specifies the type of line items this coupon will apply to.\n * For more information, see [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values).\n */\n scope?: CouponScope;\n /** Whether the coupon is limited to one item. */\n limitedToOneItem?: boolean | null;\n /** Whether the coupon also applies to subscriptions. */\n appliesToSubscriptions?: boolean | null;\n /**\n * Specifies the amount of discounted cycles for a subscription item.\n *\n * Can only be set when `appliesToSubscriptions` is `true` and `scope.namespace` is `pricingPlans`.\n * If `discountedCycleCount` is empty, the coupon applies to all available cycles.\n * @min 1\n * @max 999\n */\n discountedCycleCount?: number | null;\n}\n\n/** @oneof */\nexport interface CouponRewardDiscountTypeOneOf {\n /** Discount as a fixed amount. */\n fixedAmount?: FixedAmountDiscount;\n /** Discount as a percentage. */\n percentage?: PercentageDiscount;\n /** Free shipping. */\n freeShipping?: FreeShippingDiscount;\n}\n\n/** @oneof */\nexport interface CouponRewardScopeOrMinSubtotalOneOf {\n /** Limit the coupon to carts with a subtotal greater than this number. */\n minimumSubtotal?: number;\n /**\n * Specifies the type of line items this coupon will apply to.\n * For more information, see [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values).\n */\n scope?: CouponScope;\n}\n\nexport interface FixedAmountDiscount {\n /**\n * Discount details for each tier.\n * @minSize 1\n * @maxSize 21\n */\n configsByTier?: FixedAmountDiscountConfig[];\n}\n\nexport interface FixedAmountDiscountConfig {\n /**\n * Tier ID, or empty if config applies to the base tier.\n * @format GUID\n */\n tierId?: string | null;\n /**\n * Amount of points required to redeem the reward.\n * @min 1\n * @max 9999999\n */\n costInPoints?: number;\n /** Discount amount. */\n amount?: number;\n}\n\nexport interface PercentageDiscount {\n /**\n * Discount details for each tier.\n * @minSize 1\n * @maxSize 21\n */\n configsByTier?: PercentageDiscountConfig[];\n}\n\nexport interface PercentageDiscountConfig {\n /**\n * Tier ID, or empty if config applies to the base tier.\n * @format GUID\n */\n tierId?: string | null;\n /**\n * Amount of points required to redeem the reward.\n * @min 1\n * @max 9999999\n */\n costInPoints?: number;\n /** Percentage discount. */\n percentage?: number;\n}\n\nexport interface FreeShippingDiscount {\n /**\n * Discount details for each tier.\n * @minSize 1\n * @maxSize 21\n */\n configsByTier?: FreeShippingDiscountConfig[];\n}\n\nexport interface FreeShippingDiscountConfig {\n /**\n * Tier ID, or empty if config applies to the base tier.\n * @format GUID\n */\n tierId?: string | null;\n /**\n * Amount of points required to redeem the reward.\n * @min 1\n * @max 9999999\n */\n costInPoints?: number;\n}\n\nexport interface CouponScope {\n /**\n * Scope namespace.\n *\n * See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values) for valid namespaces.\n */\n namespace?: string;\n /**\n * Coupon scope's applied group.\n *\n * See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values) for valid groups.\n */\n group?: Group;\n}\n\nexport interface Group {\n /**\n * Name of coupon scope's group.\n *\n * See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values) for valid groups.\n */\n name?: string;\n /** Entity ID, if the coupon scope is limited to just one item. */\n entityId?: string | null;\n}\n\nexport interface SpiDiscountAmount {\n /**\n * Discount details for each tier.\n * @maxSize 21\n */\n configsByTier?: DiscountAmountConfig[];\n /**\n * Description of the SPI discount amount reward. Taken from user input in the SPI config.\n * @maxLength 200\n */\n description?: string;\n}\n\nexport interface RewardDisabled {}\n\nexport interface CreateRewardRequest {\n /** Reward to create. */\n reward: Reward;\n}\n\nexport interface CreateRewardResponse {\n /** Created reward. */\n reward?: Reward;\n}\n\nexport interface BulkCreateRewardsRequest {\n /**\n * Rewards to create.\n * @minSize 1\n * @maxSize 10\n */\n rewards: Reward[];\n}\n\nexport interface BulkCreateRewardsResponse {\n /** Created rewards. */\n results?: BulkRewardResult[];\n /** Total successes and failures of the bulk create rewards action. */\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkRewardResult {\n /** Item metadata. */\n itemMetadata?: ItemMetadata;\n /** Created reward. */\n item?: Reward;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface GetRewardRequest {\n /**\n * ID of the reward to retrieve.\n * @format GUID\n */\n _id: string;\n}\n\nexport interface GetRewardResponse {\n /** Retrieved reward. */\n reward?: Reward;\n}\n\nexport interface BulkGetRewardsRequest {}\n\nexport interface BulkGetRewardsResponse {\n /** Found rewards per site. */\n rewardsInSite?: RewardsInSite[];\n}\n\nexport interface RewardsInSite {\n /**\n * Metasite id.\n * @format GUID\n */\n metaSiteId?: string;\n /** Rewards. */\n rewards?: Reward[];\n}\n\nexport interface QueryRewardsRequest {\n /** Query parameters. */\n query: CursorQuery;\n}\n\nexport interface CursorQuery extends CursorQueryPagingMethodOneOf {\n /**\n * Cursor paging options.\n *\n * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).\n */\n cursorPaging?: CursorPaging;\n /**\n * Filter object.\n *\n * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).\n */\n filter?: Record<string, any> | null;\n /**\n * Sort object.\n *\n * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).\n * @maxSize 5\n */\n sort?: Sorting[];\n}\n\n/** @oneof */\nexport interface CursorQueryPagingMethodOneOf {\n /**\n * Cursor paging options.\n *\n * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).\n */\n cursorPaging?: CursorPaging;\n}\n\nexport interface Sorting {\n /**\n * Name of the field to sort by.\n * @maxLength 512\n */\n fieldName?: string;\n /** Sort order. */\n order?: SortOrderWithLiterals;\n}\n\nexport enum SortOrder {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\n/** @enumType */\nexport type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';\n\nexport interface CursorPaging {\n /**\n * Maximum number of items to return in the results.\n * @max 100\n */\n limit?: number | null;\n /**\n * Pointer to the next or previous page in the list of results.\n *\n * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.\n * Not relevant for the first request.\n * @maxLength 16000\n */\n cursor?: string | null;\n}\n\nexport interface QueryRewardsResponse {\n /** Retrieved loyalty rewards. */\n rewards?: Reward[];\n /** Details on the paged set of results returned. */\n pagingMetadata?: CursorPagingMetadata;\n}\n\nexport interface CursorPagingMetadata {\n /** Number of items returned in current page. */\n count?: number | null;\n /** Cursor strings that point to the next page, previous page, or both. */\n cursors?: Cursors;\n /**\n * Whether there are more pages to retrieve following the current page.\n *\n * + `true`: Another page of results can be retrieved.\n * + `false`: This is the last page.\n */\n hasNext?: boolean | null;\n}\n\nexport interface Cursors {\n /**\n * Cursor string pointing to the next page in the list of results.\n * @maxLength 16000\n */\n next?: string | null;\n /**\n * Cursor pointing to the previous page in the list of results.\n * @maxLength 16000\n */\n prev?: string | null;\n}\n\nexport interface UpdateRewardRequest {\n /** Reward information to update. */\n reward: Reward;\n}\n\nexport interface UpdateRewardResponse {\n /** Updated reward. */\n reward?: Reward;\n}\n\nexport interface DeleteRewardRequest {\n /**\n * ID of the reward to delete.\n * @format GUID\n */\n _id: string;\n /**\n * Revision number, which increments by 1 each time the reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.\n */\n revision?: string;\n}\n\nexport interface DeleteRewardResponse {}\n\nexport interface ListRewardsRequest {\n /** Pagination options. */\n cursorPaging?: CursorPaging;\n}\n\nexport interface ListRewardsResponse {\n /** Retrieved loyalty rewards. */\n rewards?: Reward[];\n /** Details on the paged set of results returned. */\n pagingMetadata?: PagingMetadataV2;\n}\n\nexport interface PagingMetadataV2 {\n /** Number of items returned in the response. */\n count?: number | null;\n /** Offset that was requested. */\n offset?: number | null;\n /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */\n total?: number | null;\n /** Flag that indicates the server failed to calculate the `total` field. */\n tooManyToCount?: boolean | null;\n /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */\n cursors?: Cursors;\n}\n\nexport interface ListRewardsInTierRequest {\n /**\n * Tier id.\n * @format GUID\n * @readonly\n */\n tierId?: string | null;\n /** Pagination options. */\n cursorPaging?: CursorPaging;\n}\n\nexport interface ListRewardsInTierResponse {\n /** Retrieved loyalty rewards. */\n rewards?: Reward[];\n /** Details on the paged set of results returned. */\n pagingMetadata?: PagingMetadataV2;\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /**\n * Unique event ID.\n * Allows clients to ignore duplicate webhooks.\n */\n _id?: string;\n /**\n * Assumes actions are also always typed to an entity_type\n * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction\n */\n entityFqdn?: string;\n /**\n * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)\n * This is although the created/updated/deleted notion is duplication of the oneof types\n * Example: created/updated/deleted/started/completed/email_opened\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number defining the order of updates to the underlying entity.\n * For example, given that some entity was updated at 16:00 and than again at 16:01,\n * it is guaranteed that the sequence number of the second update is strictly higher than the first.\n * As the consumer, you can use this value to ensure that you handle messages in the correct order.\n * To do so, you will need to persist this number on your end, and compare the sequence number from the\n * message against the one you have stored. Given that the stored number is higher, you should ignore the message.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n}\n\nexport interface EventMetadata extends BaseEventMetadata {\n /**\n * Unique event ID.\n * Allows clients to ignore duplicate webhooks.\n */\n _id?: string;\n /**\n * Assumes actions are also always typed to an entity_type\n * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction\n */\n entityFqdn?: string;\n /**\n * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)\n * This is although the created/updated/deleted notion is duplication of the oneof types\n * Example: created/updated/deleted/started/completed/email_opened\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number defining the order of updates to the underlying entity.\n * For example, given that some entity was updated at 16:00 and than again at 16:01,\n * it is guaranteed that the sequence number of the second update is strictly higher than the first.\n * As the consumer, you can use this value to ensure that you handle messages in the correct order.\n * To do so, you will need to persist this number on your end, and compare the sequence number from the\n * message against the one you have stored. Given that the stored number is higher, you should ignore the message.\n */\n entityEventSequence?: string | null;\n}\n\nexport interface RewardCreatedEnvelope {\n entity: Reward;\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a reward is created.\n * @permissionScope Read Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY\n * @permissionScope Manage Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY\n * @permissionId LOYALTY.READ_REWARDS\n * @webhook\n * @eventType wix.loyalty.v1.reward_created\n * @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards\n * @slug created\n */\nexport declare function onRewardCreated(\n handler: (event: RewardCreatedEnvelope) => void | Promise<void>\n): void;\n\nexport interface RewardDeletedEnvelope {\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a reward is deleted.\n * @permissionScope Read Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY\n * @permissionScope Manage Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY\n * @permissionId LOYALTY.READ_REWARDS\n * @webhook\n * @eventType wix.loyalty.v1.reward_deleted\n * @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards\n * @slug deleted\n */\nexport declare function onRewardDeleted(\n handler: (event: RewardDeletedEnvelope) => void | Promise<void>\n): void;\n\nexport interface RewardUpdatedEnvelope {\n entity: Reward;\n metadata: EventMetadata;\n}\n\n/**\n * Triggered when a reward is updated.\n * @permissionScope Read Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY\n * @permissionScope Manage Loyalty\n * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY\n * @permissionId LOYALTY.READ_REWARDS\n * @webhook\n * @eventType wix.loyalty.v1.reward_updated\n * @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards\n * @slug updated\n */\nexport declare function onRewardUpdated(\n handler: (event: RewardUpdatedEnvelope) => void | Promise<void>\n): void;\n\ntype RewardNonNullablePaths =\n | `discountAmount.configsByTier`\n | `discountAmount.configsByTier.${number}.amount`\n | `discountAmount.configsByTier.${number}.costInPoints`\n | `couponReward.fixedAmount.configsByTier`\n | `couponReward.fixedAmount.configsByTier.${number}.costInPoints`\n | `couponReward.fixedAmount.configsByTier.${number}.amount`\n | `couponReward.percentage.configsByTier`\n | `couponReward.percentage.configsByTier.${number}.costInPoints`\n | `couponReward.percentage.configsByTier.${number}.percentage`\n | `couponReward.freeShipping.configsByTier`\n | `couponReward.freeShipping.configsByTier.${number}.costInPoints`\n | `couponReward.minimumSubtotal`\n | `couponReward.scope.namespace`\n | `couponReward.scope.group.name`\n | `name`\n | `active`\n | `type`;\n\n/**\n * Creates a reward that can be redeemed with loyalty points.\n *\n * When a customer [redeems a reward](/coupons/redeem-points-for-coupon), a loyalty coupon is created\n * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can\n * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,\n * no coupon is actually created until a [reward is redeemed](/coupons/redeem-points-for-coupon) with points.\n * See the [Coupons API](https://dev.wix.com/api/rest/coupons) for more information about coupons. The `type` of reward\n * cannot be updated.\n *\n * A reward's `active` status defaults to `false`. To make the reward available to customers,\n * either set the `active` field to `true` during creation or call [Update Reward](/update-reward)\n * to change the status.\n *\n * To customize a reward for each [loyalty tier](/tiers), use the `configsByTier` parameter.\n * This allows you to specify the amount of the earned discount, the cost in loyalty points\n * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own\n * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,\n * leave the `tierId` field empty. See the [Tiers API](/tiers) for more information on tiers.\n * @param reward - Reward to create.\n * @public\n * @requiredField reward\n * @requiredField reward.name\n * @permissionId LOYALTY.MANAGE_REWARDS\n * @applicableIdentity APP\n * @returns Created reward.\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.CreateReward\n */\nexport async function createReward(\n reward: NonNullablePaths<Reward, `name`>\n): Promise<NonNullablePaths<Reward, RewardNonNullablePaths>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ reward: reward });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.createReward(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.reward!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { reward: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['reward']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Creates multiple rewards.\n * @param rewards - Rewards to create.\n * @public\n * @requiredField rewards\n * @requiredField rewards.name\n * @permissionId LOYALTY.MANAGE_REWARDS\n * @applicableIdentity APP\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.BulkCreateRewards\n */\nexport async function bulkCreateRewards(\n rewards: NonNullablePaths<Reward, `name`>[]\n): Promise<\n NonNullablePaths<\n BulkCreateRewardsResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | {\n [P in RewardNonNullablePaths]: `results.${number}.item.${P}`;\n }[RewardNonNullablePaths]\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ rewards: rewards });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.bulkCreateRewards(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { rewards: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['rewards']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a reward.\n * @param _id - ID of the reward to retrieve.\n * @public\n * @requiredField _id\n * @permissionId LOYALTY.READ_REWARDS\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @returns Retrieved reward.\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.GetReward\n */\nexport async function getReward(\n _id: string\n): Promise<NonNullablePaths<Reward, RewardNonNullablePaths>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.getReward(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)?.reward!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { id: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['_id']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves rewards from all metasites that the caller is the member of.\n *\n * Must be called with user identity.\n * @public\n * @documentationMaturity preview\n * @permissionId LOYALTY.REWARD_BULK_READ\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.BulkGetRewards\n */\nexport async function bulkGetRewards(): Promise<\n NonNullablePaths<\n BulkGetRewardsResponse,\n | `rewardsInSite`\n | `rewardsInSite.${number}.metaSiteId`\n | {\n [P in RewardNonNullablePaths]: `rewardsInSite.${number}.rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.bulkGetRewards(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a list of rewards, given the provided paging, filtering, and sorting.\n *\n * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.\n *\n * To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),[Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).\n * @param query - Query parameters.\n * @public\n * @requiredField query\n * @permissionId LOYALTY.READ_REWARDS\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.QueryRewards\n */\nexport async function queryRewards(\n query: CursorQuery\n): Promise<\n NonNullablePaths<\n QueryRewardsResponse,\n {\n [P in RewardNonNullablePaths]: `rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ query: query });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.queryRewards(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { query: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['query']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Updates a loyalty reward.\n *\n * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,\n * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.\n *\n * You may not change the `type` of a reward. That is set upon creation and cannot be updated.\n * @param _id - Reward ID.\n * @public\n * @requiredField _id\n * @requiredField reward\n * @requiredField reward.name\n * @requiredField reward.revision\n * @param reward - Reward info to update.\n * @permissionId LOYALTY.MANAGE_REWARDS\n * @applicableIdentity APP\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.UpdateReward\n */\nexport async function updateReward(\n _id: string,\n reward: NonNullablePaths<UpdateReward, `name` | `revision`>\n): Promise<\n NonNullablePaths<\n UpdateRewardResponse,\n { [P in RewardNonNullablePaths]: `reward.${P}` }[RewardNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n reward: { ...reward, id: _id },\n });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.updateReward(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: { reward: '$[1]' },\n explicitPathsToArguments: { 'reward.id': '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['_id', 'reward']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface UpdateReward {\n /** Discount details. */\n discountAmount?: DiscountAmount;\n /** Coupon details. */\n couponReward?: CouponReward;\n /**\n * Reward ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Reward name.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /** Whether the reward is active. Default: `FALSE` */\n active?: boolean;\n /** Reward type. */\n type?: RewardTypeWithLiterals;\n /**\n * Revision number, which increments by 1 each time the loyalty reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty reward.\n * @readonly\n */\n revision?: string | null;\n /**\n * Date and time the reward was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the reward was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n}\n\n/**\n * Deletes a reward.\n * @param _id - ID of the reward to delete.\n * @param revision - Revision number, which increments by 1 each time the reward is updated.\n *\n * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.\n * @public\n * @requiredField _id\n * @requiredField revision\n * @permissionId LOYALTY.MANAGE_REWARDS\n * @applicableIdentity APP\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.DeleteReward\n */\nexport async function deleteReward(\n _id: string,\n revision: string\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n id: _id,\n revision: revision,\n });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.deleteReward(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { id: '$[0]', revision: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['_id', 'revision']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a list of rewards.\n *\n * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.\n * @public\n * @param options - List options.\n * @permissionId LOYALTY.READ_REWARDS\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.ListRewards\n */\nexport async function listRewards(\n options?: ListRewardsOptions\n): Promise<\n NonNullablePaths<\n ListRewardsResponse,\n {\n [P in RewardNonNullablePaths]: `rewards.${number}.${P}`;\n }[RewardNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cursorPaging: options?.cursorPaging,\n });\n\n const reqOpts = ambassadorWixLoyaltyV1Reward.listRewards(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { cursorPaging: '$[0].cursorPaging' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ListRewardsOptions {\n /** Pagination options. */\n cursorPaging?: CursorPaging;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformRESTFloatToSDKFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'editor.wixapps.net': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n '*.pub.wix-code.com': [\n {\n srcPath: '/_api/loyalty-rewards',\n destPath: '',\n },\n ],\n 'api._api_base_domain_': [\n {\n srcPath: '/loyalty-rewards',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/loyalty-rewards',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_loyalty_rewards';\n\n/**\n * Creates a reward that can be redeemed with loyalty points.\n *\n * When a customer [redeems a reward](/coupons/redeem-points-for-coupon), a loyalty coupon is created\n * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can\n * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,\n * no coupon is actually created until a [reward is redeemed](/coupons/redeem-points-for-coupon) with points.\n * See the [Coupons API](https://dev.wix.com/api/rest/coupons) for more information about coupons. The `type` of reward\n * cannot be updated.\n *\n * A reward's `active` status defaults to `false`. To make the reward available to customers,\n * either set the `active` field to `true` during creation or call [Update Reward](/update-reward)\n * to change the status.\n *\n * To customize a reward for each [loyalty tier](/tiers), use the `configsByTier` parameter.\n * This allows you to specify the amount of the earned discount, the cost in loyalty points\n * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own\n * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,\n * leave the `tierId` field empty. See the [Tiers API](/tiers) for more information on tiers.\n */\nexport function createReward(payload: object): RequestOptionsFactory<any> {\n function __createReward({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'reward.createdDate' }, { path: 'reward.updatedDate' }],\n },\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'reward.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.CreateReward',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'reward.createdDate' },\n { path: 'reward.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'reward.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __createReward;\n}\n\n/** Creates multiple rewards. */\nexport function bulkCreateRewards(payload: object): RequestOptionsFactory<any> {\n function __bulkCreateRewards({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'rewards.createdDate' },\n { path: 'rewards.updatedDate' },\n ],\n },\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [\n { path: 'rewards.couponReward.minimumSubtotal' },\n { path: 'rewards.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'rewards.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.BulkCreateRewards',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/bulk/rewards/create',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'results.item.createdDate' },\n { path: 'results.item.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'results.item.couponReward.minimumSubtotal' },\n {\n path: 'results.item.couponReward.fixedAmount.configsByTier.amount',\n },\n {\n path: 'results.item.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkCreateRewards;\n}\n\n/** Retrieves a reward. */\nexport function getReward(payload: object): RequestOptionsFactory<any> {\n function __getReward({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.GetReward',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards/{id}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'reward.createdDate' },\n { path: 'reward.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'reward.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getReward;\n}\n\n/**\n * Retrieves rewards from all metasites that the caller is the member of.\n *\n * Must be called with user identity.\n */\nexport function bulkGetRewards(payload: object): RequestOptionsFactory<any> {\n function __bulkGetRewards({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.BulkGetRewards',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/bulk/rewards',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'rewardsInSite.rewards.createdDate' },\n { path: 'rewardsInSite.rewards.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'rewardsInSite.rewards.couponReward.minimumSubtotal' },\n {\n path: 'rewardsInSite.rewards.couponReward.fixedAmount.configsByTier.amount',\n },\n {\n path: 'rewardsInSite.rewards.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkGetRewards;\n}\n\n/**\n * Retrieves a list of rewards, given the provided paging, filtering, and sorting.\n *\n * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.\n *\n * To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),[Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).\n */\nexport function queryRewards(payload: object): RequestOptionsFactory<any> {\n function __queryRewards({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.QueryRewards',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards/query',\n data: payload,\n host,\n }),\n data: payload,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'rewards.createdDate' },\n { path: 'rewards.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'rewards.couponReward.minimumSubtotal' },\n { path: 'rewards.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'rewards.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __queryRewards;\n}\n\n/**\n * Updates a loyalty reward.\n *\n * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,\n * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.\n *\n * You may not change the `type` of a reward. That is set upon creation and cannot be updated.\n */\nexport function updateReward(payload: object): RequestOptionsFactory<any> {\n function __updateReward({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'reward.createdDate' }, { path: 'reward.updatedDate' }],\n },\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n { path: 'reward.couponReward.percentage.configsByTier.percentage' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'PUT' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.UpdateReward',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards/{reward.id}',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'reward.createdDate' },\n { path: 'reward.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'reward.couponReward.minimumSubtotal' },\n { path: 'reward.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'reward.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __updateReward;\n}\n\n/** Deletes a reward. */\nexport function deleteReward(payload: object): RequestOptionsFactory<any> {\n function __deleteReward({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'DELETE' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.DeleteReward',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards/{id}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __deleteReward;\n}\n\n/**\n * Retrieves a list of rewards.\n *\n * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.\n */\nexport function listRewards(payload: object): RequestOptionsFactory<any> {\n function __listRewards({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.loyalty.v1.reward',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.loyalty.reward.LoyaltyRewards.ListRewards',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressLoyaltyRewardLoyaltyRewardsUrl({\n protoPath: '/v1/rewards',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'rewards.createdDate' },\n { path: 'rewards.updatedDate' },\n ],\n },\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'rewards.couponReward.minimumSubtotal' },\n { path: 'rewards.couponReward.fixedAmount.configsByTier.amount' },\n {\n path: 'rewards.couponReward.percentage.configsByTier.percentage',\n },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __listRewards;\n}\n","import {\n createReward as publicCreateReward,\n bulkCreateRewards as publicBulkCreateRewards,\n getReward as publicGetReward,\n bulkGetRewards as publicBulkGetRewards,\n queryRewards as publicQueryRewards,\n updateReward as publicUpdateReward,\n deleteReward as publicDeleteReward,\n listRewards as publicListRewards,\n} from './loyalty-v1-reward-rewards.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { createEventModule } from '@wix/sdk-runtime/event-definition-modules';\nimport {\n BuildRESTFunction,\n MaybeContext,\n BuildEventDefinition,\n} from '@wix/sdk-types';\nimport { onRewardCreated as publicOnRewardCreated } from './loyalty-v1-reward-rewards.public.js';\nimport { onRewardDeleted as publicOnRewardDeleted } from './loyalty-v1-reward-rewards.public.js';\nimport { onRewardUpdated as publicOnRewardUpdated } from './loyalty-v1-reward-rewards.public.js';\n\nexport const createReward: MaybeContext<\n BuildRESTFunction<typeof publicCreateReward> & typeof publicCreateReward\n> = /*#__PURE__*/ createRESTModule(publicCreateReward);\nexport const bulkCreateRewards: MaybeContext<\n BuildRESTFunction<typeof publicBulkCreateRewards> &\n typeof publicBulkCreateRewards\n> = /*#__PURE__*/ createRESTModule(publicBulkCreateRewards);\nexport const getReward: MaybeContext<\n BuildRESTFunction<typeof publicGetReward> & typeof publicGetReward\n> = /*#__PURE__*/ createRESTModule(publicGetReward);\nexport const bulkGetRewards: MaybeContext<\n BuildRESTFunction<typeof publicBulkGetRewards> & typeof publicBulkGetRewards\n> = /*#__PURE__*/ createRESTModule(publicBulkGetRewards);\nexport const queryRewards: MaybeContext<\n BuildRESTFunction<typeof publicQueryRewards> & typeof publicQueryRewards\n> = /*#__PURE__*/ createRESTModule(publicQueryRewards);\nexport const updateReward: MaybeContext<\n BuildRESTFunction<typeof publicUpdateReward> & typeof publicUpdateReward\n> = /*#__PURE__*/ createRESTModule(publicUpdateReward);\nexport const deleteReward: MaybeContext<\n BuildRESTFunction<typeof publicDeleteReward> & typeof publicDeleteReward\n> = /*#__PURE__*/ createRESTModule(publicDeleteReward);\nexport const listRewards: MaybeContext<\n BuildRESTFunction<typeof publicListRewards> & typeof publicListRewards\n> = /*#__PURE__*/ createRESTModule(publicListRewards);\n/**\n * Triggered when a reward is created.\n */\nexport const onRewardCreated: BuildEventDefinition<\n typeof publicOnRewardCreated\n> = createEventModule(publicOnRewardCreated);\n/**\n * Triggered when a reward is deleted.\n */\nexport const onRewardDeleted: BuildEventDefinition<\n typeof publicOnRewardDeleted\n> = createEventModule(publicOnRewardDeleted);\n/**\n * Triggered when a reward is updated.\n */\nexport const onRewardUpdated: BuildEventDefinition<\n typeof publicOnRewardUpdated\n> = createEventModule(publicOnRewardUpdated);\n\nexport {\n RewardType,\n SortOrder,\n WebhookIdentityType,\n} from './loyalty-v1-reward-rewards.universal.js';\nexport {\n Reward,\n RewardTypeDetailsOneOf,\n DiscountAmount,\n DiscountAmountConfig,\n CouponReward,\n CouponRewardDiscountTypeOneOf,\n CouponRewardScopeOrMinSubtotalOneOf,\n FixedAmountDiscount,\n FixedAmountDiscountConfig,\n PercentageDiscount,\n PercentageDiscountConfig,\n FreeShippingDiscount,\n FreeShippingDiscountConfig,\n CouponScope,\n Group,\n SpiDiscountAmount,\n RewardDisabled,\n CreateRewardRequest,\n CreateRewardResponse,\n BulkCreateRewardsRequest,\n BulkCreateRewardsResponse,\n BulkRewardResult,\n ItemMetadata,\n ApplicationError,\n BulkActionMetadata,\n GetRewardRequest,\n GetRewardResponse,\n BulkGetRewardsRequest,\n BulkGetRewardsResponse,\n RewardsInSite,\n QueryRewardsRequest,\n CursorQuery,\n CursorQueryPagingMethodOneOf,\n Sorting,\n CursorPaging,\n QueryRewardsResponse,\n CursorPagingMetadata,\n Cursors,\n UpdateRewardRequest,\n UpdateRewardResponse,\n DeleteRewardRequest,\n DeleteRewardResponse,\n ListRewardsRequest,\n ListRewardsResponse,\n PagingMetadataV2,\n ListRewardsInTierRequest,\n ListRewardsInTierResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n BaseEventMetadata,\n EventMetadata,\n RewardCreatedEnvelope,\n RewardDeletedEnvelope,\n RewardUpdatedEnvelope,\n UpdateReward,\n ListRewardsOptions,\n} from './loyalty-v1-reward-rewards.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAAA;AAAA,EAAA,sBAAAC;AAAA,EAAA,oBAAAC;AAAA,EAAA,oBAAAC;AAAA,EAAA,iBAAAC;AAAA,EAAA,mBAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,oBAAAC;AAAA,EAAA,oBAAAC;AA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AACJ,EAAyB;;;AGtVzB,IAAAC,uBAAiC;AACjC,sCAAkC;AAU3B,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,qBAGK,2DAAiBA,kBAAuB;AACnD,IAAMC,aAEK,2DAAiBA,UAAe;AAC3C,IAAMC,kBAEK,2DAAiBA,eAAoB;AAChD,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,eAEK,2DAAiBA,YAAiB;AAI7C,IAAMC,uBAET,mDAAkB,eAAqB;AAIpC,IAAMC,uBAET,mDAAkB,eAAqB;AAIpC,IAAMC,uBAET,mDAAkB,eAAqB;","names":["bulkCreateRewards","bulkGetRewards","createReward","deleteReward","getReward","listRewards","onRewardCreated","onRewardDeleted","onRewardUpdated","queryRewards","updateReward","import_rename_all_nested_keys","import_float","import_timestamp","import_transform_paths","import_float","import_timestamp","import_rest_modules","payload","RewardType","SortOrder","WebhookIdentityType","createReward","sdkTransformError","bulkCreateRewards","getReward","bulkGetRewards","queryRewards","updateReward","deleteReward","listRewards","createReward","bulkCreateRewards","getReward","bulkGetRewards","queryRewards","updateReward","deleteReward","listRewards","import_rest_modules","createReward","bulkCreateRewards","getReward","bulkGetRewards","queryRewards","updateReward","deleteReward","listRewards","onRewardCreated","onRewardDeleted","onRewardUpdated"]}
@@ -100,20 +100,18 @@ interface CouponReward extends CouponRewardDiscountTypeOneOf, CouponRewardScopeO
100
100
  minimumSubtotal?: number;
101
101
  /**
102
102
  * Specifies the type of line items this coupon will apply to.
103
- *
104
- * For more information, see the Coupons API.
103
+ * For more information, see [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values).
105
104
  */
106
105
  scope?: CouponScope;
107
106
  /** Whether the coupon is limited to one item. */
108
107
  limitedToOneItem?: boolean | null;
109
- /**
110
- * Whether the coupon applies to subscription products.
111
- *
112
- * If set to `true`, the discount will apply to all billing cycles.
113
- */
108
+ /** Whether the coupon also applies to subscriptions. */
114
109
  appliesToSubscriptions?: boolean | null;
115
110
  /**
116
- * Reserved for internal use.
111
+ * Specifies the amount of discounted cycles for a subscription item.
112
+ *
113
+ * Can only be set when `appliesToSubscriptions` is `true` and `scope.namespace` is `pricingPlans`.
114
+ * If `discountedCycleCount` is empty, the coupon applies to all available cycles.
117
115
  * @min 1
118
116
  * @max 999
119
117
  */
@@ -134,8 +132,7 @@ interface CouponRewardScopeOrMinSubtotalOneOf {
134
132
  minimumSubtotal?: number;
135
133
  /**
136
134
  * Specifies the type of line items this coupon will apply to.
137
- *
138
- * For more information, see the Coupons API.
135
+ * For more information, see [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values).
139
136
  */
140
137
  scope?: CouponScope;
141
138
  }
@@ -210,13 +207,13 @@ interface CouponScope {
210
207
  /**
211
208
  * Scope namespace.
212
209
  *
213
- * See the Coupons API for valid namespaces.
210
+ * See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values) for valid namespaces.
214
211
  */
215
212
  namespace?: string;
216
213
  /**
217
214
  * Coupon scope's applied group.
218
215
  *
219
- * See the Coupons API for valid groups.
216
+ * See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values) for valid groups.
220
217
  */
221
218
  group?: Group;
222
219
  }
@@ -224,7 +221,7 @@ interface Group {
224
221
  /**
225
222
  * Name of coupon scope's group.
226
223
  *
227
- * See the Coupons API for valid groups.
224
+ * See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values) for valid groups.
228
225
  */
229
226
  name?: string;
230
227
  /** Entity ID, if the coupon scope is limited to just one item. */
@@ -730,21 +727,22 @@ type RewardNonNullablePaths = `discountAmount.configsByTier` | `discountAmount.c
730
727
  /**
731
728
  * Creates a reward that can be redeemed with loyalty points.
732
729
  *
733
- * When a customer redeems a reward, a loyalty coupon is created
730
+ * When a customer [redeems a reward](/coupons/redeem-points-for-coupon), a loyalty coupon is created
734
731
  * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can
735
732
  * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,
736
- * no coupon is actually created until a reward is redeemed with points.
737
- * See the Coupons API for more information about coupons.
733
+ * no coupon is actually created until a [reward is redeemed](/coupons/redeem-points-for-coupon) with points.
734
+ * See the [Coupons API](https://dev.wix.com/api/rest/coupons) for more information about coupons. The `type` of reward
735
+ * cannot be updated.
738
736
  *
739
737
  * A reward's `active` status defaults to `false`. To make the reward available to customers,
740
- * either set the `active` field to `true` during creation or call [`updateReward()`](#updatereward)
738
+ * either set the `active` field to `true` during creation or call [Update Reward](/update-reward)
741
739
  * to change the status.
742
740
  *
743
- * To customize a reward for each loyalty tier, use the `configsByTier` parameter.
741
+ * To customize a reward for each [loyalty tier](/tiers), use the `configsByTier` parameter.
744
742
  * This allows you to specify the amount of the earned discount, the cost in loyalty points
745
743
  * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own
746
744
  * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,
747
- * leave the `tierId` field empty. See the Loyalty Tiers API for more information on tiers.
745
+ * leave the `tierId` field empty. See the [Tiers API](/tiers) for more information on tiers.
748
746
  * @param reward - Reward to create.
749
747
  * @public
750
748
  * @requiredField reward