@wix/auto_sdk_loyalty_rewards 1.0.11 → 1.0.12
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.
- package/build/cjs/index.d.ts +2 -2
- package/build/cjs/{loyalty-v1-reward-rewards.universal-BFnbQRqi.d.ts → index.typings.d.ts} +174 -1
- package/build/cjs/index.typings.js +673 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +2 -1
- package/build/es/index.d.mts +2 -2
- package/build/es/{loyalty-v1-reward-rewards.universal-BFnbQRqi.d.mts → index.typings.d.mts} +174 -1
- package/build/es/index.typings.mjs +639 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/meta.d.mts +2 -1
- package/build/internal/cjs/index.d.ts +2 -2
- package/build/internal/cjs/{loyalty-v1-reward-rewards.universal-BFnbQRqi.d.ts → index.typings.d.ts} +174 -1
- package/build/internal/cjs/index.typings.js +673 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +2 -1
- package/build/internal/es/index.d.mts +2 -2
- package/build/internal/es/{loyalty-v1-reward-rewards.universal-BFnbQRqi.d.mts → index.typings.d.mts} +174 -1
- package/build/internal/es/index.typings.mjs +639 -0
- package/build/internal/es/index.typings.mjs.map +1 -0
- package/build/internal/es/meta.d.mts +2 -1
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpClient, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { Reward, BulkCreateRewardsResponse, BulkGetRewardsResponse, CursorQuery, QueryRewardsResponse, UpdateReward, UpdateRewardResponse, ListRewardsOptions, ListRewardsResponse, RewardCreatedEnvelope, RewardDeletedEnvelope, RewardUpdatedEnvelope } from './index.typings.js';
|
|
3
|
+
export { ActionEvent, ApplicationError, BaseEventMetadata, BulkActionMetadata, BulkCreateRewardsRequest, BulkGetRewardsRequest, BulkRewardResult, CouponReward, CouponRewardDiscountTypeOneOf, CouponRewardScopeOrMinSubtotalOneOf, CouponScope, CreateRewardRequest, CreateRewardResponse, CursorPaging, CursorPagingMetadata, CursorQueryPagingMethodOneOf, Cursors, DeleteRewardRequest, DeleteRewardResponse, DiscountAmount, DiscountAmountConfig, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, FixedAmountDiscount, FixedAmountDiscountConfig, FreeShippingDiscount, FreeShippingDiscountConfig, GetRewardRequest, GetRewardResponse, Group, IdentificationData, IdentificationDataIdOneOf, ItemMetadata, ListRewardsInTierRequest, ListRewardsInTierResponse, ListRewardsRequest, MessageEnvelope, PagingMetadataV2, PercentageDiscount, PercentageDiscountConfig, QueryRewardsRequest, RestoreInfo, RewardDisabled, RewardType, RewardTypeDetailsOneOf, RewardsInSite, SortOrder, Sorting, SpiDiscountAmount, UpdateRewardRequest, WebhookIdentityType } from './index.typings.js';
|
|
4
4
|
|
|
5
5
|
declare function createReward$1(httpClient: HttpClient): CreateRewardSignature;
|
|
6
6
|
interface CreateRewardSignature {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NonNullablePaths } from '@wix/sdk-types';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A loyalty reward is an object a customer can redeem with loyalty points.
|
|
3
5
|
* Redeeming a reward then creates a loyalty coupon that the customer can use.
|
|
@@ -678,13 +680,156 @@ interface RewardCreatedEnvelope {
|
|
|
678
680
|
entity: Reward;
|
|
679
681
|
metadata: EventMetadata;
|
|
680
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* Triggered when a reward is created.
|
|
685
|
+
* @permissionScope Read Loyalty
|
|
686
|
+
* @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
|
|
687
|
+
* @permissionScope Manage Loyalty
|
|
688
|
+
* @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
|
|
689
|
+
* @permissionId LOYALTY.READ_REWARDS
|
|
690
|
+
* @webhook
|
|
691
|
+
* @eventType wix.loyalty.v1.reward_created
|
|
692
|
+
* @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards
|
|
693
|
+
* @slug created
|
|
694
|
+
*/
|
|
695
|
+
declare function onRewardCreated(handler: (event: RewardCreatedEnvelope) => void | Promise<void>): void;
|
|
681
696
|
interface RewardDeletedEnvelope {
|
|
682
697
|
metadata: EventMetadata;
|
|
683
698
|
}
|
|
699
|
+
/**
|
|
700
|
+
* Triggered when a reward is deleted.
|
|
701
|
+
* @permissionScope Read Loyalty
|
|
702
|
+
* @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
|
|
703
|
+
* @permissionScope Manage Loyalty
|
|
704
|
+
* @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
|
|
705
|
+
* @permissionId LOYALTY.READ_REWARDS
|
|
706
|
+
* @webhook
|
|
707
|
+
* @eventType wix.loyalty.v1.reward_deleted
|
|
708
|
+
* @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards
|
|
709
|
+
* @slug deleted
|
|
710
|
+
*/
|
|
711
|
+
declare function onRewardDeleted(handler: (event: RewardDeletedEnvelope) => void | Promise<void>): void;
|
|
684
712
|
interface RewardUpdatedEnvelope {
|
|
685
713
|
entity: Reward;
|
|
686
714
|
metadata: EventMetadata;
|
|
687
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* Triggered when a reward is updated.
|
|
718
|
+
* @permissionScope Read Loyalty
|
|
719
|
+
* @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
|
|
720
|
+
* @permissionScope Manage Loyalty
|
|
721
|
+
* @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
|
|
722
|
+
* @permissionId LOYALTY.READ_REWARDS
|
|
723
|
+
* @webhook
|
|
724
|
+
* @eventType wix.loyalty.v1.reward_updated
|
|
725
|
+
* @serviceIdentifier com.wixpress.loyalty.reward.LoyaltyRewards
|
|
726
|
+
* @slug updated
|
|
727
|
+
*/
|
|
728
|
+
declare function onRewardUpdated(handler: (event: RewardUpdatedEnvelope) => void | Promise<void>): void;
|
|
729
|
+
type RewardNonNullablePaths = `discountAmount.configsByTier` | `discountAmount.configsByTier.${number}.amount` | `discountAmount.configsByTier.${number}.costInPoints` | `couponReward.fixedAmount.configsByTier` | `couponReward.fixedAmount.configsByTier.${number}.costInPoints` | `couponReward.fixedAmount.configsByTier.${number}.amount` | `couponReward.percentage.configsByTier` | `couponReward.percentage.configsByTier.${number}.costInPoints` | `couponReward.percentage.configsByTier.${number}.percentage` | `couponReward.freeShipping.configsByTier` | `couponReward.freeShipping.configsByTier.${number}.costInPoints` | `couponReward.minimumSubtotal` | `couponReward.scope.namespace` | `couponReward.scope.group.name` | `name` | `active` | `type`;
|
|
730
|
+
/**
|
|
731
|
+
* Creates a reward that can be redeemed with loyalty points.
|
|
732
|
+
*
|
|
733
|
+
* When a customer redeems a reward, a loyalty coupon is created
|
|
734
|
+
* based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can
|
|
735
|
+
* 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.
|
|
738
|
+
*
|
|
739
|
+
* 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)
|
|
741
|
+
* to change the status.
|
|
742
|
+
*
|
|
743
|
+
* To customize a reward for each loyalty tier, use the `configsByTier` parameter.
|
|
744
|
+
* This allows you to specify the amount of the earned discount, the cost in loyalty points
|
|
745
|
+
* to redeem the reward, and the tier to which this configuration applies. Each tier requires its own
|
|
746
|
+
* `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.
|
|
748
|
+
* @param reward - Reward to create.
|
|
749
|
+
* @public
|
|
750
|
+
* @requiredField reward
|
|
751
|
+
* @requiredField reward.name
|
|
752
|
+
* @permissionId LOYALTY.MANAGE_REWARDS
|
|
753
|
+
* @applicableIdentity APP
|
|
754
|
+
* @returns Created reward.
|
|
755
|
+
* @fqn com.wixpress.loyalty.reward.LoyaltyRewards.CreateReward
|
|
756
|
+
*/
|
|
757
|
+
declare function createReward(reward: NonNullablePaths<Reward, `name`>): Promise<NonNullablePaths<Reward, RewardNonNullablePaths>>;
|
|
758
|
+
/**
|
|
759
|
+
* Creates multiple rewards.
|
|
760
|
+
* @param rewards - Rewards to create.
|
|
761
|
+
* @public
|
|
762
|
+
* @requiredField rewards
|
|
763
|
+
* @requiredField rewards.name
|
|
764
|
+
* @permissionId LOYALTY.MANAGE_REWARDS
|
|
765
|
+
* @applicableIdentity APP
|
|
766
|
+
* @fqn com.wixpress.loyalty.reward.LoyaltyRewards.BulkCreateRewards
|
|
767
|
+
*/
|
|
768
|
+
declare function bulkCreateRewards(rewards: NonNullablePaths<Reward, `name`>[]): Promise<NonNullablePaths<BulkCreateRewardsResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | {
|
|
769
|
+
[P in RewardNonNullablePaths]: `results.${number}.item.${P}`;
|
|
770
|
+
}[RewardNonNullablePaths] | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`>>;
|
|
771
|
+
/**
|
|
772
|
+
* Retrieves a reward.
|
|
773
|
+
* @param _id - ID of the reward to retrieve.
|
|
774
|
+
* @public
|
|
775
|
+
* @requiredField _id
|
|
776
|
+
* @permissionId LOYALTY.READ_REWARDS
|
|
777
|
+
* @applicableIdentity APP
|
|
778
|
+
* @applicableIdentity VISITOR
|
|
779
|
+
* @returns Retrieved reward.
|
|
780
|
+
* @fqn com.wixpress.loyalty.reward.LoyaltyRewards.GetReward
|
|
781
|
+
*/
|
|
782
|
+
declare function getReward(_id: string): Promise<NonNullablePaths<Reward, RewardNonNullablePaths>>;
|
|
783
|
+
/**
|
|
784
|
+
* Retrieves rewards from all metasites that the caller is the member of.
|
|
785
|
+
*
|
|
786
|
+
* Must be called with user identity.
|
|
787
|
+
* @public
|
|
788
|
+
* @documentationMaturity preview
|
|
789
|
+
* @permissionId LOYALTY.REWARD_BULK_READ
|
|
790
|
+
* @fqn com.wixpress.loyalty.reward.LoyaltyRewards.BulkGetRewards
|
|
791
|
+
*/
|
|
792
|
+
declare function bulkGetRewards(): Promise<NonNullablePaths<BulkGetRewardsResponse, `rewardsInSite` | `rewardsInSite.${number}.metaSiteId` | {
|
|
793
|
+
[P in RewardNonNullablePaths]: `rewardsInSite.${number}.rewards.${number}.${P}`;
|
|
794
|
+
}[RewardNonNullablePaths]>>;
|
|
795
|
+
/**
|
|
796
|
+
* Retrieves a list of rewards, given the provided paging, filtering, and sorting.
|
|
797
|
+
*
|
|
798
|
+
* Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.
|
|
799
|
+
*
|
|
800
|
+
* 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).
|
|
801
|
+
* @param query - Query parameters.
|
|
802
|
+
* @public
|
|
803
|
+
* @requiredField query
|
|
804
|
+
* @permissionId LOYALTY.READ_REWARDS
|
|
805
|
+
* @applicableIdentity APP
|
|
806
|
+
* @applicableIdentity VISITOR
|
|
807
|
+
* @fqn com.wixpress.loyalty.reward.LoyaltyRewards.QueryRewards
|
|
808
|
+
*/
|
|
809
|
+
declare function queryRewards(query: CursorQuery): Promise<NonNullablePaths<QueryRewardsResponse, {
|
|
810
|
+
[P in RewardNonNullablePaths]: `rewards.${number}.${P}`;
|
|
811
|
+
}[RewardNonNullablePaths]>>;
|
|
812
|
+
/**
|
|
813
|
+
* Updates a loyalty reward.
|
|
814
|
+
*
|
|
815
|
+
* Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,
|
|
816
|
+
* or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.
|
|
817
|
+
*
|
|
818
|
+
* You may not change the `type` of a reward. That is set upon creation and cannot be updated.
|
|
819
|
+
* @param _id - Reward ID.
|
|
820
|
+
* @public
|
|
821
|
+
* @requiredField _id
|
|
822
|
+
* @requiredField reward
|
|
823
|
+
* @requiredField reward.name
|
|
824
|
+
* @requiredField reward.revision
|
|
825
|
+
* @param reward - Reward info to update.
|
|
826
|
+
* @permissionId LOYALTY.MANAGE_REWARDS
|
|
827
|
+
* @applicableIdentity APP
|
|
828
|
+
* @fqn com.wixpress.loyalty.reward.LoyaltyRewards.UpdateReward
|
|
829
|
+
*/
|
|
830
|
+
declare function updateReward(_id: string, reward: NonNullablePaths<UpdateReward, `name` | `revision`>): Promise<NonNullablePaths<UpdateRewardResponse, {
|
|
831
|
+
[P in RewardNonNullablePaths]: `reward.${P}`;
|
|
832
|
+
}[RewardNonNullablePaths]>>;
|
|
688
833
|
interface UpdateReward {
|
|
689
834
|
/** Discount details. */
|
|
690
835
|
discountAmount?: DiscountAmount;
|
|
@@ -724,9 +869,37 @@ interface UpdateReward {
|
|
|
724
869
|
*/
|
|
725
870
|
_updatedDate?: Date | null;
|
|
726
871
|
}
|
|
872
|
+
/**
|
|
873
|
+
* Deletes a reward.
|
|
874
|
+
* @param _id - ID of the reward to delete.
|
|
875
|
+
* @param revision - Revision number, which increments by 1 each time the reward is updated.
|
|
876
|
+
*
|
|
877
|
+
* To prevent conflicting changes, the current `revision` must be passed when deleting the reward.
|
|
878
|
+
* @public
|
|
879
|
+
* @requiredField _id
|
|
880
|
+
* @requiredField revision
|
|
881
|
+
* @permissionId LOYALTY.MANAGE_REWARDS
|
|
882
|
+
* @applicableIdentity APP
|
|
883
|
+
* @fqn com.wixpress.loyalty.reward.LoyaltyRewards.DeleteReward
|
|
884
|
+
*/
|
|
885
|
+
declare function deleteReward(_id: string, revision: string): Promise<void>;
|
|
886
|
+
/**
|
|
887
|
+
* Retrieves a list of rewards.
|
|
888
|
+
*
|
|
889
|
+
* The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.
|
|
890
|
+
* @public
|
|
891
|
+
* @param options - List options.
|
|
892
|
+
* @permissionId LOYALTY.READ_REWARDS
|
|
893
|
+
* @applicableIdentity APP
|
|
894
|
+
* @applicableIdentity VISITOR
|
|
895
|
+
* @fqn com.wixpress.loyalty.reward.LoyaltyRewards.ListRewards
|
|
896
|
+
*/
|
|
897
|
+
declare function listRewards(options?: ListRewardsOptions): Promise<NonNullablePaths<ListRewardsResponse, {
|
|
898
|
+
[P in RewardNonNullablePaths]: `rewards.${number}.${P}`;
|
|
899
|
+
}[RewardNonNullablePaths]>>;
|
|
727
900
|
interface ListRewardsOptions {
|
|
728
901
|
/** Pagination options. */
|
|
729
902
|
cursorPaging?: CursorPaging;
|
|
730
903
|
}
|
|
731
904
|
|
|
732
|
-
export { type
|
|
905
|
+
export { type ActionEvent, type ApplicationError, type BaseEventMetadata, type BulkActionMetadata, type BulkCreateRewardsRequest, type BulkCreateRewardsResponse, type BulkGetRewardsRequest, type BulkGetRewardsResponse, type BulkRewardResult, type CouponReward, type CouponRewardDiscountTypeOneOf, type CouponRewardScopeOrMinSubtotalOneOf, type CouponScope, type CreateRewardRequest, type CreateRewardResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DeleteRewardRequest, type DeleteRewardResponse, type DiscountAmount, type DiscountAmountConfig, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type FixedAmountDiscount, type FixedAmountDiscountConfig, type FreeShippingDiscount, type FreeShippingDiscountConfig, type GetRewardRequest, type GetRewardResponse, type Group, type IdentificationData, type IdentificationDataIdOneOf, type ItemMetadata, type ListRewardsInTierRequest, type ListRewardsInTierResponse, type ListRewardsOptions, type ListRewardsRequest, type ListRewardsResponse, type MessageEnvelope, type PagingMetadataV2, type PercentageDiscount, type PercentageDiscountConfig, type QueryRewardsRequest, type QueryRewardsResponse, type RestoreInfo, type Reward, type RewardCreatedEnvelope, type RewardDeletedEnvelope, type RewardDisabled, RewardType, type RewardTypeDetailsOneOf, type RewardTypeWithLiterals, type RewardUpdatedEnvelope, type RewardsInSite, SortOrder, type SortOrderWithLiterals, type Sorting, type SpiDiscountAmount, type UpdateReward, type UpdateRewardRequest, type UpdateRewardResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, bulkCreateRewards, bulkGetRewards, createReward, deleteReward, getReward, listRewards, onRewardCreated, onRewardDeleted, onRewardUpdated, queryRewards, updateReward };
|