@wix/auto_sdk_loyalty_coupons 1.0.26 → 1.0.28

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,13 +1,13 @@
1
1
  import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
2
- import { RedeemPointsForCouponOptions, RedeemPointsForCouponResponse, RedeemCurrentMemberPointsForCouponResponse, LoyaltyCoupon, BulkGetLoyaltyCouponOptions, BulkGetLoyaltyCouponResponse, GetCurrentMemberCouponsResponse, LoyaltyCouponsQueryBuilder, CouponCreatedEnvelope, CouponDeletedEnvelope } from './index.typings.js';
3
- export { ActionEvent, BaseEventMetadata, BulkGetLoyaltyCouponRequest, BuyXGetY, CouponReference, CouponsInSite, CursorPaging, CursorQuery, CursorQueryPagingMethodOneOf, Cursors, DeleteLoyaltyCouponRequest, DeleteLoyaltyCouponResponse, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, GetCurrentMemberCouponsRequest, GetLoyaltyCouponRequest, GetLoyaltyCouponResponse, IdentificationData, IdentificationDataIdOneOf, LoyaltyCouponsQueryResult, MessageEnvelope, Paging, PagingMetadataV2, QueryLoyaltyCouponRequest, QueryLoyaltyCouponResponse, QueryV2, QueryV2PagingMethodOneOf, RedeemCurrentMemberPointsForCouponRequest, RedeemMemberPointsForDiscountAmountCouponRequest, RedeemMemberPointsForDiscountAmountCouponResponse, RedeemPointsForCouponRequest, RestoreInfo, Scope, SortOrder, SortOrderWithLiterals, Sorting, Specification, SpecificationScopeOrMinSubtotalOneOf, SpecificationTypeDetailsOneOf, Status, StatusWithLiterals, Type, TypeWithLiterals, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.js';
2
+ import { RedeemPointsForCouponOptions, RedeemPointsForCouponResponse, RedeemCurrentMemberPointsForCouponResponse, LoyaltyCoupon, BulkGetLoyaltyCouponOptions, BulkGetLoyaltyCouponResponse, GetCurrentMemberCouponsResponse, CouponCreatedEnvelope, CouponDeletedEnvelope, LoyaltyCouponsQueryBuilder, QueryV2, typedQueryLoyaltyCoupons } from './index.typings.js';
3
+ export { ActionEvent, BaseEventMetadata, BulkGetLoyaltyCouponRequest, BuyXGetY, CouponReference, CouponsInSite, CursorPaging, CursorQuery, CursorQueryPagingMethodOneOf, Cursors, DeleteLoyaltyCouponRequest, DeleteLoyaltyCouponResponse, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, GetCurrentMemberCouponsRequest, GetLoyaltyCouponRequest, GetLoyaltyCouponResponse, IdentificationData, IdentificationDataIdOneOf, LoyaltyCouponsQueryResult, MessageEnvelope, Paging, PagingMetadataV2, QueryLoyaltyCouponRequest, QueryLoyaltyCouponResponse, QueryV2PagingMethodOneOf, RedeemCurrentMemberPointsForCouponRequest, RedeemMemberPointsForDiscountAmountCouponRequest, RedeemMemberPointsForDiscountAmountCouponResponse, RedeemPointsForCouponRequest, RestoreInfo, Scope, SortOrder, SortOrderWithLiterals, Sorting, Specification, SpecificationScopeOrMinSubtotalOneOf, SpecificationTypeDetailsOneOf, Status, StatusWithLiterals, Type, TypeWithLiterals, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.js';
4
4
 
5
5
  declare function redeemPointsForCoupon$1(httpClient: HttpClient): RedeemPointsForCouponSignature;
6
6
  interface RedeemPointsForCouponSignature {
7
7
  /**
8
8
  * Redeems a customer's loyalty points for a loyalty reward and creates a loyalty coupon.
9
9
  *
10
- * Creating a loyalty coupon also creates a corresponding "reference" coupon with the Coupons API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/marketing/coupons/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/marketing/coupons/coupons/coupon-object)).
10
+ * Creating a loyalty coupon also creates a corresponding "reference" coupon with the [Coupons API](https://dev.wix.com/docs/rest/business-management/marketing/coupons/coupons/coupon-object).
11
11
  * The customer receives the reference coupon, which they can apply to their order. The loyalty coupon and its corresponding reference coupon
12
12
  * are linked and the loyalty coupon's `status` reflects the current state of the reference coupon.
13
13
  *
@@ -21,7 +21,7 @@ interface RedeemCurrentMemberPointsForCouponSignature {
21
21
  /**
22
22
  * Redeems a current customer's loyalty points for a loyalty reward and creates a loyalty coupon.
23
23
  *
24
- * Creating a loyalty coupon also creates a corresponding "reference" coupon with the Coupons API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/marketing/coupons/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/marketing/coupons/coupons/coupon-object)).
24
+ * Creating a loyalty coupon also creates a corresponding "reference" coupon with the [Coupons API](https://dev.wix.com/docs/rest/business-management/marketing/coupons/coupons/coupon-object).
25
25
  * The customer receives the reference coupon, which they can apply to their order. The loyalty coupon and its corresponding reference coupon
26
26
  * are linked and the loyalty coupon's `status` reflects the current state of the reference coupon.
27
27
  *
@@ -59,13 +59,6 @@ interface GetCurrentMemberCouponsSignature {
59
59
  */
60
60
  (): Promise<NonNullablePaths<GetCurrentMemberCouponsResponse, `loyaltyCoupons` | `loyaltyCoupons.${number}._id` | `loyaltyCoupons.${number}.accountId` | `loyaltyCoupons.${number}.memberIdDeprecated` | `loyaltyCoupons.${number}.couponReference.couponId` | `loyaltyCoupons.${number}.couponReference.code` | `loyaltyCoupons.${number}.couponReference.specification.moneyOffAmount` | `loyaltyCoupons.${number}.couponReference.specification.percentOffRate` | `loyaltyCoupons.${number}.couponReference.specification.freeShipping` | `loyaltyCoupons.${number}.couponReference.specification.fixedPriceAmount` | `loyaltyCoupons.${number}.couponReference.specification.type` | `loyaltyCoupons.${number}.status` | `loyaltyCoupons.${number}.rewardName`, 6>>;
61
61
  }
62
- declare function queryLoyaltyCoupons$1(httpClient: HttpClient): QueryLoyaltyCouponsSignature;
63
- interface QueryLoyaltyCouponsSignature {
64
- /**
65
- * Retrieves a list of loyalty coupons, with the specified paging, filtering, and sorting.
66
- */
67
- (): LoyaltyCouponsQueryBuilder;
68
- }
69
62
  declare function deleteLoyaltyCoupon$1(httpClient: HttpClient): DeleteLoyaltyCouponSignature;
70
63
  interface DeleteLoyaltyCouponSignature {
71
64
  /**
@@ -82,13 +75,17 @@ interface DeleteLoyaltyCouponSignature {
82
75
  declare const onCouponCreated$1: EventDefinition<CouponCreatedEnvelope, "wix.loyalty.v1.coupon_created">;
83
76
  declare const onCouponDeleted$1: EventDefinition<CouponDeletedEnvelope, "wix.loyalty.v1.coupon_deleted">;
84
77
 
78
+ declare function customQueryLoyaltyCoupons(httpClient: HttpClient): {
79
+ (): LoyaltyCouponsQueryBuilder;
80
+ (query: QueryV2): ReturnType<typeof typedQueryLoyaltyCoupons>;
81
+ };
85
82
  declare const redeemPointsForCoupon: MaybeContext<BuildRESTFunction<typeof redeemPointsForCoupon$1> & typeof redeemPointsForCoupon$1>;
86
83
  declare const redeemCurrentMemberPointsForCoupon: MaybeContext<BuildRESTFunction<typeof redeemCurrentMemberPointsForCoupon$1> & typeof redeemCurrentMemberPointsForCoupon$1>;
87
84
  declare const getLoyaltyCoupon: MaybeContext<BuildRESTFunction<typeof getLoyaltyCoupon$1> & typeof getLoyaltyCoupon$1>;
88
85
  declare const bulkGetLoyaltyCoupon: MaybeContext<BuildRESTFunction<typeof bulkGetLoyaltyCoupon$1> & typeof bulkGetLoyaltyCoupon$1>;
89
86
  declare const getCurrentMemberCoupons: MaybeContext<BuildRESTFunction<typeof getCurrentMemberCoupons$1> & typeof getCurrentMemberCoupons$1>;
90
- declare const queryLoyaltyCoupons: MaybeContext<BuildRESTFunction<typeof queryLoyaltyCoupons$1> & typeof queryLoyaltyCoupons$1>;
91
87
  declare const deleteLoyaltyCoupon: MaybeContext<BuildRESTFunction<typeof deleteLoyaltyCoupon$1> & typeof deleteLoyaltyCoupon$1>;
88
+ declare const queryLoyaltyCoupons: MaybeContext<BuildRESTFunction<typeof customQueryLoyaltyCoupons> & typeof customQueryLoyaltyCoupons>;
92
89
  /**
93
90
  * Triggered when a loyalty coupon is created.
94
91
  */
@@ -98,4 +95,4 @@ declare const onCouponCreated: BuildEventDefinition<typeof onCouponCreated$1> &
98
95
  */
99
96
  declare const onCouponDeleted: BuildEventDefinition<typeof onCouponDeleted$1> & typeof onCouponDeleted$1;
100
97
 
101
- export { BulkGetLoyaltyCouponOptions, BulkGetLoyaltyCouponResponse, CouponCreatedEnvelope, CouponDeletedEnvelope, GetCurrentMemberCouponsResponse, LoyaltyCoupon, LoyaltyCouponsQueryBuilder, RedeemCurrentMemberPointsForCouponResponse, RedeemPointsForCouponOptions, RedeemPointsForCouponResponse, bulkGetLoyaltyCoupon, deleteLoyaltyCoupon, getCurrentMemberCoupons, getLoyaltyCoupon, onCouponCreated, onCouponDeleted, queryLoyaltyCoupons, redeemCurrentMemberPointsForCoupon, redeemPointsForCoupon };
98
+ export { BulkGetLoyaltyCouponOptions, BulkGetLoyaltyCouponResponse, CouponCreatedEnvelope, CouponDeletedEnvelope, GetCurrentMemberCouponsResponse, LoyaltyCoupon, LoyaltyCouponsQueryBuilder, QueryV2, RedeemCurrentMemberPointsForCouponResponse, RedeemPointsForCouponOptions, RedeemPointsForCouponResponse, bulkGetLoyaltyCoupon, deleteLoyaltyCoupon, getCurrentMemberCoupons, getLoyaltyCoupon, onCouponCreated, onCouponDeleted, queryLoyaltyCoupons, redeemCurrentMemberPointsForCoupon, redeemPointsForCoupon };
@@ -617,6 +617,29 @@ function queryLoyaltyCoupons() {
617
617
  transformationPaths: {}
618
618
  });
619
619
  }
620
+ async function typedQueryLoyaltyCoupons(query) {
621
+ const { httpClient, sideEffects } = arguments[1];
622
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ query });
623
+ const reqOpts = queryLoyaltyCoupon(payload);
624
+ sideEffects?.onSiteCall?.();
625
+ try {
626
+ const result = await httpClient.request(reqOpts);
627
+ sideEffects?.onSuccess?.(result);
628
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
629
+ } catch (err) {
630
+ const transformedError = (0, import_transform_error.transformError)(
631
+ err,
632
+ {
633
+ spreadPathsToArguments: {},
634
+ explicitPathsToArguments: { query: "$[0]" },
635
+ singleArgumentUnchanged: false
636
+ },
637
+ ["query"]
638
+ );
639
+ sideEffects?.onError?.(err);
640
+ throw transformedError;
641
+ }
642
+ }
620
643
  async function deleteLoyaltyCoupon2(_id, revision) {
621
644
  const { httpClient, sideEffects } = arguments[2];
622
645
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
@@ -685,6 +708,13 @@ function queryLoyaltyCoupons2(httpClient) {
685
708
  { httpClient }
686
709
  );
687
710
  }
711
+ function typedQueryLoyaltyCoupons2(httpClient) {
712
+ return (query) => typedQueryLoyaltyCoupons(
713
+ query,
714
+ // @ts-ignore
715
+ { httpClient }
716
+ );
717
+ }
688
718
  function deleteLoyaltyCoupon3(httpClient) {
689
719
  return (_id, revision) => deleteLoyaltyCoupon2(
690
720
  _id,
@@ -749,13 +779,25 @@ var onCouponDeleted = (0, import_sdk_types.EventDefinition)(
749
779
  // src/loyalty-v1-coupon-coupons.context.ts
750
780
  var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
751
781
  var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
782
+ var import_query_method_router = require("@wix/sdk-runtime/query-method-router");
783
+ function customQueryLoyaltyCoupons(httpClient) {
784
+ const router = (0, import_query_method_router.createQueryOverloadRouter)({
785
+ builderQueryFunction: () => queryLoyaltyCoupons2(httpClient)(),
786
+ typedQueryFunction: (query) => typedQueryLoyaltyCoupons2(httpClient)(query),
787
+ hasOptionsParameter: false
788
+ });
789
+ function overloadedQuery(query) {
790
+ return router(...arguments);
791
+ }
792
+ return overloadedQuery;
793
+ }
752
794
  var redeemPointsForCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(redeemPointsForCoupon3);
753
795
  var redeemCurrentMemberPointsForCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(redeemCurrentMemberPointsForCoupon3);
754
796
  var getLoyaltyCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getLoyaltyCoupon3);
755
797
  var bulkGetLoyaltyCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkGetLoyaltyCoupon3);
756
798
  var getCurrentMemberCoupons4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getCurrentMemberCoupons3);
757
- var queryLoyaltyCoupons3 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryLoyaltyCoupons2);
758
799
  var deleteLoyaltyCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(deleteLoyaltyCoupon3);
800
+ var queryLoyaltyCoupons3 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(customQueryLoyaltyCoupons);
759
801
  var onCouponCreated2 = (0, import_event_definition_modules.createEventModule)(onCouponCreated);
760
802
  var onCouponDeleted2 = (0, import_event_definition_modules.createEventModule)(onCouponDeleted);
761
803
  // Annotate the CommonJS export names for ESM import in node: