@wix/auto_sdk_loyalty_coupons 1.0.17 → 1.0.18

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.
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  /**
2
4
  * A loyalty coupon is created when a customer redeems their loyalty points for a reward. Creating a loyalty coupon
3
5
  * also creates a corresponding "reference" coupon with the [Coupons API](https://dev.wix.com/api/rest/coupons/about-wix-coupons).
@@ -656,9 +658,60 @@ interface CouponCreatedEnvelope {
656
658
  entity: LoyaltyCoupon;
657
659
  metadata: EventMetadata;
658
660
  }
661
+ /**
662
+ * Triggered when a loyalty coupon is created.
663
+ * @permissionScope Read Loyalty
664
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
665
+ * @permissionScope Manage Loyalty
666
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
667
+ * @permissionScope Manage Restaurants - all permissions
668
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
669
+ * @permissionId LOYALTY.READ_COUPONS
670
+ * @webhook
671
+ * @eventType wix.loyalty.v1.coupon_created
672
+ * @serviceIdentifier com.wixpress.loyalty.coupon.LoyaltyCoupons
673
+ * @slug created
674
+ */
675
+ declare function onCouponCreated(handler: (event: CouponCreatedEnvelope) => void | Promise<void>): void;
659
676
  interface CouponDeletedEnvelope {
660
677
  metadata: EventMetadata;
661
678
  }
679
+ /**
680
+ * Triggered when a loyalty coupon is deleted.
681
+ * @permissionScope Read Loyalty
682
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
683
+ * @permissionScope Manage Loyalty
684
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
685
+ * @permissionScope Manage Restaurants - all permissions
686
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
687
+ * @permissionId LOYALTY.READ_COUPONS
688
+ * @webhook
689
+ * @eventType wix.loyalty.v1.coupon_deleted
690
+ * @serviceIdentifier com.wixpress.loyalty.coupon.LoyaltyCoupons
691
+ * @slug deleted
692
+ */
693
+ declare function onCouponDeleted(handler: (event: CouponDeletedEnvelope) => void | Promise<void>): void;
694
+ type CouponNonNullablePaths = `_id` | `accountId` | `memberIdDeprecated` | `couponReference.couponId` | `couponReference.code` | `couponReference.specification.moneyOffAmount` | `couponReference.specification.percentOffRate` | `couponReference.specification.freeShipping` | `couponReference.specification.fixedPriceAmount` | `couponReference.specification.buyXGetY.x` | `couponReference.specification.buyXGetY.y` | `couponReference.specification.scope.namespace` | `couponReference.specification.type` | `status` | `rewardName`;
695
+ /**
696
+ * Redeems a customer's loyalty points for a loyalty reward and creates a loyalty coupon.
697
+ *
698
+ * Creating a loyalty coupon also creates a corresponding "reference" coupon with the [Coupons API](https://dev.wix.com/api/rest/coupons/about-wix-coupons).
699
+ * The customer receives the reference coupon, which they can apply to their order. The loyalty coupon and its corresponding reference coupon
700
+ * are linked and the loyalty coupon's `status` reflects the current state of the reference coupon.
701
+ *
702
+ * Check which loyalty rewards a site has available with [List Rewards](https://dev.wix.com/docs/rest/crm/loyalty-program/rewards/list-rewards).
703
+ * @param rewardId - ID of the [loyalty reward](https://dev.wix.com/docs/rest/crm/loyalty-program/rewards/reward-object) to redeem.
704
+ * @public
705
+ * @requiredField options
706
+ * @requiredField options.loyaltyAccountId
707
+ * @requiredField rewardId
708
+ * @permissionId LOYALTY.REDEEM_COUPON
709
+ * @applicableIdentity APP
710
+ * @fqn com.wixpress.loyalty.coupon.LoyaltyCoupons.RedeemPointsForCoupon
711
+ */
712
+ declare function redeemPointsForCoupon(rewardId: string, options: NonNullablePaths<RedeemPointsForCouponOptions, `loyaltyAccountId`>): Promise<NonNullablePaths<RedeemPointsForCouponResponse, {
713
+ [P in CouponNonNullablePaths]: `coupon.${P}`;
714
+ }[CouponNonNullablePaths]>>;
662
715
  interface RedeemPointsForCouponOptions {
663
716
  /**
664
717
  * ID of the [loyalty account](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/account-object) of the customer redeeming points.
@@ -666,10 +719,74 @@ interface RedeemPointsForCouponOptions {
666
719
  */
667
720
  loyaltyAccountId: string;
668
721
  }
722
+ /**
723
+ * Redeems a current customer's loyalty points for a loyalty reward and creates a loyalty coupon.
724
+ *
725
+ * Creating a loyalty coupon also creates a corresponding "reference" coupon with the [Coupons API](https://dev.wix.com/api/rest/coupons/about-wix-coupons).
726
+ * The customer receives the reference coupon, which they can apply to their order. The loyalty coupon and its corresponding reference coupon
727
+ * are linked and the loyalty coupon's `status` reflects the current state of the reference coupon.
728
+ *
729
+ * Check which loyalty rewards a site has available with [List Rewards](https://dev.wix.com/docs/rest/crm/loyalty-program/rewards/list-rewards).
730
+ *
731
+ * >**Note:**
732
+ * >This endpoint requires [visitor or member authentication](https://dev.wix.com/docs/rest/articles/getting-started/access-types-and-permissions).
733
+ * @param rewardId - ID of the [loyalty reward](https://dev.wix.com/docs/rest/crm/loyalty-program/rewards/reward-object) to redeem.
734
+ * @public
735
+ * @requiredField rewardId
736
+ * @permissionId LOYALTY.REDEEM_OWN_COUPON
737
+ * @applicableIdentity APP
738
+ * @applicableIdentity MEMBER
739
+ * @fqn com.wixpress.loyalty.coupon.LoyaltyCoupons.RedeemCurrentMemberPointsForCoupon
740
+ */
741
+ declare function redeemCurrentMemberPointsForCoupon(rewardId: string): Promise<NonNullablePaths<RedeemCurrentMemberPointsForCouponResponse, {
742
+ [P in CouponNonNullablePaths]: `coupon.${P}`;
743
+ }[CouponNonNullablePaths]>>;
744
+ /**
745
+ * Retrieves a loyalty coupon.
746
+ * @param loyaltyCouponId - ID of the loyalty coupon to retrieve.
747
+ * @public
748
+ * @requiredField loyaltyCouponId
749
+ * @permissionId LOYALTY.READ_COUPONS
750
+ * @applicableIdentity APP
751
+ * @returns Retrieved loyalty coupon.
752
+ * @fqn com.wixpress.loyalty.coupon.LoyaltyCoupons.GetLoyaltyCoupon
753
+ */
754
+ declare function getLoyaltyCoupon(loyaltyCouponId: string): Promise<NonNullablePaths<LoyaltyCoupon, CouponNonNullablePaths>>;
755
+ /**
756
+ * Retrieves a sequence of loyalty coupons
757
+ * @public
758
+ * @permissionId LOYALTY.REWARD_BULK_READ
759
+ * @fqn com.wixpress.loyalty.coupon.LoyaltyCoupons.BulkGetLoyaltyCoupon
760
+ */
761
+ declare function bulkGetLoyaltyCoupon(options?: BulkGetLoyaltyCouponOptions): Promise<NonNullablePaths<BulkGetLoyaltyCouponResponse, `couponsInSite` | `couponsInSite.${number}.metaSiteId` | {
762
+ [P in CouponNonNullablePaths]: `couponsInSite.${number}.loyaltyCoupons.${number}.${P}`;
763
+ }[CouponNonNullablePaths]>>;
669
764
  interface BulkGetLoyaltyCouponOptions {
670
765
  /** Query to filter loyalty coupons. */
671
766
  query?: CursorQuery;
672
767
  }
768
+ /**
769
+ * Retrieves the loyalty coupons for the currently logged-in member.
770
+ *
771
+ * >**Note:**
772
+ * >This endpoint requires [visitor or member authentication](https://dev.wix.com/docs/rest/articles/getting-started/access-types-and-permissions).
773
+ * @public
774
+ * @permissionId LOYALTY.READ_OWN_COUPONS
775
+ * @applicableIdentity APP
776
+ * @applicableIdentity MEMBER
777
+ * @fqn com.wixpress.loyalty.coupon.LoyaltyCoupons.GetCurrentMemberCoupons
778
+ */
779
+ declare function getCurrentMemberCoupons(): Promise<NonNullablePaths<GetCurrentMemberCouponsResponse, {
780
+ [P in CouponNonNullablePaths]: `loyaltyCoupons.${number}.${P}`;
781
+ }[CouponNonNullablePaths]>>;
782
+ /**
783
+ * Retrieves a list of loyalty coupons, given the provided paging, filtering, and sorting.
784
+ * @public
785
+ * @permissionId LOYALTY.READ_COUPONS
786
+ * @applicableIdentity APP
787
+ * @fqn com.wixpress.loyalty.coupon.LoyaltyCoupons.QueryLoyaltyCoupon
788
+ */
789
+ declare function queryLoyaltyCoupons(): LoyaltyCouponsQueryBuilder;
673
790
  interface QueryCursorResult {
674
791
  cursors: Cursors;
675
792
  hasNext: () => boolean;
@@ -728,5 +845,21 @@ interface LoyaltyCouponsQueryBuilder {
728
845
  skipTo: (cursor: string) => LoyaltyCouponsQueryBuilder;
729
846
  find: () => Promise<LoyaltyCouponsQueryResult>;
730
847
  }
848
+ /**
849
+ * Deletes a loyalty coupon.
850
+ *
851
+ * The deletion of a loyalty coupon does not impact the functionality of the corresponding coupon itself.
852
+ * @param _id - ID of the loyalty coupon to delete.
853
+ * @param revision - Revision number, which increments by 1 each time the loyalty coupon is updated.
854
+ *
855
+ * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty coupon.
856
+ * @public
857
+ * @requiredField _id
858
+ * @requiredField revision
859
+ * @permissionId LOYALTY.MANAGE_COUPONS
860
+ * @applicableIdentity APP
861
+ * @fqn com.wixpress.loyalty.coupon.LoyaltyCoupons.DeleteLoyaltyCoupon
862
+ */
863
+ declare function deleteLoyaltyCoupon(_id: string, revision: string): Promise<void>;
731
864
 
732
- export { type BaseEventMetadata as $, type QueryV2PagingMethodOneOf as A, type BulkGetLoyaltyCouponOptions as B, type CouponCreatedEnvelope as C, type QueryLoyaltyCouponResponse as D, type PagingMetadataV2 as E, type Cursors as F, type GetCurrentMemberCouponsResponse as G, type DeleteLoyaltyCouponRequest as H, type DeleteLoyaltyCouponResponse as I, type DomainEvent as J, type DomainEventBodyOneOf as K, type LoyaltyCoupon as L, type EntityCreatedEvent as M, type RestoreInfo as N, type EntityUpdatedEvent as O, type Paging as P, type QueryLoyaltyCouponRequest as Q, type RedeemPointsForCouponOptions as R, Status as S, Type as T, type EntityDeletedEvent as U, type ActionEvent as V, WebhookIdentityType as W, type Empty as X, type MessageEnvelope as Y, type IdentificationData as Z, type IdentificationDataIdOneOf as _, type RedeemPointsForCouponResponse as a, type EventMetadata as a0, type LoyaltyCouponsQueryResult as a1, type RedeemCurrentMemberPointsForCouponResponse as b, type BulkGetLoyaltyCouponResponse as c, type LoyaltyCouponsQueryBuilder as d, type CouponDeletedEnvelope as e, SortOrder as f, type CouponReference as g, type Specification as h, type SpecificationTypeDetailsOneOf as i, type SpecificationScopeOrMinSubtotalOneOf as j, type BuyXGetY as k, type Scope as l, type RedeemPointsForCouponRequest as m, type RedeemCurrentMemberPointsForCouponRequest as n, type RedeemMemberPointsForDiscountAmountCouponRequest as o, type RedeemMemberPointsForDiscountAmountCouponResponse as p, type GetLoyaltyCouponRequest as q, type GetLoyaltyCouponResponse as r, type BulkGetLoyaltyCouponRequest as s, type CursorQuery as t, type CursorQueryPagingMethodOneOf as u, type Sorting as v, type CursorPaging as w, type CouponsInSite as x, type GetCurrentMemberCouponsRequest as y, type QueryV2 as z };
865
+ export { type ActionEvent, type BaseEventMetadata, type BulkGetLoyaltyCouponOptions, type BulkGetLoyaltyCouponRequest, type BulkGetLoyaltyCouponResponse, type BuyXGetY, type CouponCreatedEnvelope, type CouponDeletedEnvelope, type CouponReference, type CouponsInSite, type CursorPaging, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DeleteLoyaltyCouponRequest, type DeleteLoyaltyCouponResponse, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type GetCurrentMemberCouponsRequest, type GetCurrentMemberCouponsResponse, type GetLoyaltyCouponRequest, type GetLoyaltyCouponResponse, type IdentificationData, type IdentificationDataIdOneOf, type LoyaltyCoupon, type LoyaltyCouponsQueryBuilder, type LoyaltyCouponsQueryResult, type MessageEnvelope, type Paging, type PagingMetadataV2, type QueryLoyaltyCouponRequest, type QueryLoyaltyCouponResponse, type QueryV2, type QueryV2PagingMethodOneOf, type RedeemCurrentMemberPointsForCouponRequest, type RedeemCurrentMemberPointsForCouponResponse, type RedeemMemberPointsForDiscountAmountCouponRequest, type RedeemMemberPointsForDiscountAmountCouponResponse, type RedeemPointsForCouponOptions, type RedeemPointsForCouponRequest, type RedeemPointsForCouponResponse, type RestoreInfo, type Scope, SortOrder, type SortOrderWithLiterals, type Sorting, type Specification, type SpecificationScopeOrMinSubtotalOneOf, type SpecificationTypeDetailsOneOf, Status, type StatusWithLiterals, Type, type TypeWithLiterals, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, bulkGetLoyaltyCoupon, deleteLoyaltyCoupon, getCurrentMemberCoupons, getLoyaltyCoupon, onCouponCreated, onCouponDeleted, queryLoyaltyCoupons, redeemCurrentMemberPointsForCoupon, redeemPointsForCoupon };