@wix/auto_sdk_loyalty_rewards 1.0.4 → 1.0.6

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.
Files changed (134) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/loyalty-v1-reward-rewards.context.d.ts +28 -0
  11. package/build/cjs/src/loyalty-v1-reward-rewards.context.js +34 -0
  12. package/build/cjs/src/loyalty-v1-reward-rewards.context.js.map +1 -0
  13. package/build/cjs/src/loyalty-v1-reward-rewards.http.d.ts +56 -0
  14. package/build/cjs/src/loyalty-v1-reward-rewards.http.js +464 -0
  15. package/build/cjs/src/loyalty-v1-reward-rewards.http.js.map +1 -0
  16. package/build/cjs/src/loyalty-v1-reward-rewards.meta.d.ts +26 -0
  17. package/build/cjs/src/loyalty-v1-reward-rewards.meta.js +180 -0
  18. package/build/cjs/src/loyalty-v1-reward-rewards.meta.js.map +1 -0
  19. package/build/cjs/src/loyalty-v1-reward-rewards.public.d.ts +107 -0
  20. package/build/cjs/src/loyalty-v1-reward-rewards.public.js +119 -0
  21. package/build/cjs/src/loyalty-v1-reward-rewards.public.js.map +1 -0
  22. package/build/{internal/loyalty-v1-reward-rewards.universal-DJFLdOGr.d.mts → cjs/src/loyalty-v1-reward-rewards.types.d.ts} +84 -193
  23. package/build/cjs/src/loyalty-v1-reward-rewards.types.js +29 -0
  24. package/build/cjs/src/loyalty-v1-reward-rewards.types.js.map +1 -0
  25. package/build/cjs/src/loyalty-v1-reward-rewards.universal.d.ts +920 -0
  26. package/build/cjs/src/loyalty-v1-reward-rewards.universal.js +373 -0
  27. package/build/cjs/src/loyalty-v1-reward-rewards.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/loyalty-v1-reward-rewards.context.d.ts +28 -0
  39. package/build/es/src/loyalty-v1-reward-rewards.context.js +28 -0
  40. package/build/es/src/loyalty-v1-reward-rewards.context.js.map +1 -0
  41. package/build/es/src/loyalty-v1-reward-rewards.http.d.ts +56 -0
  42. package/build/es/src/loyalty-v1-reward-rewards.http.js +453 -0
  43. package/build/es/src/loyalty-v1-reward-rewards.http.js.map +1 -0
  44. package/build/es/src/loyalty-v1-reward-rewards.meta.d.ts +26 -0
  45. package/build/es/src/loyalty-v1-reward-rewards.meta.js +146 -0
  46. package/build/es/src/loyalty-v1-reward-rewards.meta.js.map +1 -0
  47. package/build/es/src/loyalty-v1-reward-rewards.public.d.ts +107 -0
  48. package/build/es/src/loyalty-v1-reward-rewards.public.js +105 -0
  49. package/build/es/src/loyalty-v1-reward-rewards.public.js.map +1 -0
  50. package/build/{loyalty-v1-reward-rewards.universal-DJFLdOGr.d.mts → es/src/loyalty-v1-reward-rewards.types.d.ts} +84 -193
  51. package/build/es/src/loyalty-v1-reward-rewards.types.js +26 -0
  52. package/build/es/src/loyalty-v1-reward-rewards.types.js.map +1 -0
  53. package/build/es/src/loyalty-v1-reward-rewards.universal.d.ts +920 -0
  54. package/build/es/src/loyalty-v1-reward-rewards.universal.js +339 -0
  55. package/build/es/src/loyalty-v1-reward-rewards.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/loyalty-v1-reward-rewards.context.d.ts +28 -0
  66. package/build/internal/cjs/src/loyalty-v1-reward-rewards.context.js +34 -0
  67. package/build/internal/cjs/src/loyalty-v1-reward-rewards.context.js.map +1 -0
  68. package/build/internal/cjs/src/loyalty-v1-reward-rewards.http.d.ts +56 -0
  69. package/build/internal/cjs/src/loyalty-v1-reward-rewards.http.js +464 -0
  70. package/build/internal/cjs/src/loyalty-v1-reward-rewards.http.js.map +1 -0
  71. package/build/internal/cjs/src/loyalty-v1-reward-rewards.meta.d.ts +26 -0
  72. package/build/internal/cjs/src/loyalty-v1-reward-rewards.meta.js +180 -0
  73. package/build/internal/cjs/src/loyalty-v1-reward-rewards.meta.js.map +1 -0
  74. package/build/internal/cjs/src/loyalty-v1-reward-rewards.public.d.ts +107 -0
  75. package/build/internal/cjs/src/loyalty-v1-reward-rewards.public.js +119 -0
  76. package/build/internal/cjs/src/loyalty-v1-reward-rewards.public.js.map +1 -0
  77. package/build/{loyalty-v1-reward-rewards.universal-DJFLdOGr.d.ts → internal/cjs/src/loyalty-v1-reward-rewards.types.d.ts} +84 -193
  78. package/build/internal/cjs/src/loyalty-v1-reward-rewards.types.js +29 -0
  79. package/build/internal/cjs/src/loyalty-v1-reward-rewards.types.js.map +1 -0
  80. package/build/internal/cjs/src/loyalty-v1-reward-rewards.universal.d.ts +920 -0
  81. package/build/internal/cjs/src/loyalty-v1-reward-rewards.universal.js +373 -0
  82. package/build/internal/cjs/src/loyalty-v1-reward-rewards.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/loyalty-v1-reward-rewards.context.d.ts +28 -0
  93. package/build/internal/es/src/loyalty-v1-reward-rewards.context.js +28 -0
  94. package/build/internal/es/src/loyalty-v1-reward-rewards.context.js.map +1 -0
  95. package/build/internal/es/src/loyalty-v1-reward-rewards.http.d.ts +56 -0
  96. package/build/internal/es/src/loyalty-v1-reward-rewards.http.js +453 -0
  97. package/build/internal/es/src/loyalty-v1-reward-rewards.http.js.map +1 -0
  98. package/build/internal/es/src/loyalty-v1-reward-rewards.meta.d.ts +26 -0
  99. package/build/internal/es/src/loyalty-v1-reward-rewards.meta.js +146 -0
  100. package/build/internal/es/src/loyalty-v1-reward-rewards.meta.js.map +1 -0
  101. package/build/internal/es/src/loyalty-v1-reward-rewards.public.d.ts +107 -0
  102. package/build/internal/es/src/loyalty-v1-reward-rewards.public.js +105 -0
  103. package/build/internal/es/src/loyalty-v1-reward-rewards.public.js.map +1 -0
  104. package/build/internal/{loyalty-v1-reward-rewards.universal-DJFLdOGr.d.ts → es/src/loyalty-v1-reward-rewards.types.d.ts} +84 -193
  105. package/build/internal/es/src/loyalty-v1-reward-rewards.types.js +26 -0
  106. package/build/internal/es/src/loyalty-v1-reward-rewards.types.js.map +1 -0
  107. package/build/internal/es/src/loyalty-v1-reward-rewards.universal.d.ts +920 -0
  108. package/build/internal/es/src/loyalty-v1-reward-rewards.universal.js +339 -0
  109. package/build/internal/es/src/loyalty-v1-reward-rewards.universal.js.map +1 -0
  110. package/package.json +13 -14
  111. package/build/index.d.mts +0 -126
  112. package/build/index.d.ts +0 -126
  113. package/build/index.js +0 -834
  114. package/build/index.js.map +0 -1
  115. package/build/index.mjs +0 -797
  116. package/build/index.mjs.map +0 -1
  117. package/build/internal/index.d.mts +0 -126
  118. package/build/internal/index.d.ts +0 -126
  119. package/build/internal/index.js +0 -834
  120. package/build/internal/index.js.map +0 -1
  121. package/build/internal/index.mjs +0 -797
  122. package/build/internal/index.mjs.map +0 -1
  123. package/build/internal/meta.d.mts +0 -472
  124. package/build/internal/meta.d.ts +0 -472
  125. package/build/internal/meta.js +0 -597
  126. package/build/internal/meta.js.map +0 -1
  127. package/build/internal/meta.mjs +0 -563
  128. package/build/internal/meta.mjs.map +0 -1
  129. package/build/meta.d.mts +0 -472
  130. package/build/meta.d.ts +0 -472
  131. package/build/meta.js +0 -597
  132. package/build/meta.js.map +0 -1
  133. package/build/meta.mjs +0 -563
  134. package/build/meta.mjs.map +0 -1
@@ -0,0 +1,339 @@
1
+ import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
+ import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
3
+ import * as ambassadorWixLoyaltyV1Reward from './loyalty-v1-reward-rewards.http.js';
4
+ /** Available reward types. */
5
+ export var RewardType;
6
+ (function (RewardType) {
7
+ /** Undefined reward type. */
8
+ RewardType["UNDEFINED"] = "UNDEFINED";
9
+ /** Discount reward. Special flexible reward type used in checkout. */
10
+ RewardType["DISCOUNT_AMOUNT"] = "DISCOUNT_AMOUNT";
11
+ /** Coupon reward. [Learn more about coupons.](https://support.wix.com/en/article/using-coupons-as-loyalty-rewards) */
12
+ RewardType["COUPON_REWARD"] = "COUPON_REWARD";
13
+ /** For internal use. */
14
+ RewardType["SPI_DISCOUNT_AMOUNT"] = "SPI_DISCOUNT_AMOUNT";
15
+ })(RewardType || (RewardType = {}));
16
+ export var SortOrder;
17
+ (function (SortOrder) {
18
+ SortOrder["ASC"] = "ASC";
19
+ SortOrder["DESC"] = "DESC";
20
+ })(SortOrder || (SortOrder = {}));
21
+ export var WebhookIdentityType;
22
+ (function (WebhookIdentityType) {
23
+ WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
24
+ WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
25
+ WebhookIdentityType["MEMBER"] = "MEMBER";
26
+ WebhookIdentityType["WIX_USER"] = "WIX_USER";
27
+ WebhookIdentityType["APP"] = "APP";
28
+ })(WebhookIdentityType || (WebhookIdentityType = {}));
29
+ /**
30
+ * Creates a reward that can be redeemed with loyalty points.
31
+ *
32
+ * When a customer redeems a reward, a loyalty coupon is created
33
+ * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can
34
+ * then be used by the customer to receive the discount. Note that while the Rewards API uses coupon scopes and specifications,
35
+ * no coupon is actually created until a reward is redeemed with points.
36
+ * See the Coupons API for more information about coupons.
37
+ *
38
+ * A reward's `active` status defaults to `false`. To make the reward available to customers,
39
+ * either set the `active` field to `true` during creation or call [`updateReward()`](#updatereward)
40
+ * to change the status.
41
+ *
42
+ * To customize a reward for each loyalty tier, use the `configsByTier` parameter.
43
+ * This allows you to specify the amount of the earned discount, the cost in loyalty points
44
+ * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own
45
+ * `configsByTier` configuration. To create a reward that is available to loyalty accounts in the base tier,
46
+ * leave the `tierId` field empty. See the Loyalty Tiers API for more information on tiers.
47
+ * @param reward - Reward to create.
48
+ * @public
49
+ * @requiredField reward
50
+ * @requiredField reward.name
51
+ * @requiredField reward.typeDetails
52
+ * @permissionId LOYALTY.MANAGE_REWARDS
53
+ * @permissionScope Manage Loyalty
54
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
55
+ * @applicableIdentity APP
56
+ * @returns Created reward.
57
+ * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.CreateReward
58
+ */
59
+ export async function createReward(reward) {
60
+ // @ts-ignore
61
+ const { httpClient, sideEffects } = arguments[1];
62
+ const payload = renameKeysFromSDKRequestToRESTRequest({ reward: reward });
63
+ const reqOpts = ambassadorWixLoyaltyV1Reward.createReward(payload);
64
+ sideEffects?.onSiteCall?.();
65
+ try {
66
+ const result = await httpClient.request(reqOpts);
67
+ sideEffects?.onSuccess?.(result);
68
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.reward;
69
+ }
70
+ catch (err) {
71
+ const transformedError = sdkTransformError(err, {
72
+ spreadPathsToArguments: {},
73
+ explicitPathsToArguments: { reward: '$[0]' },
74
+ singleArgumentUnchanged: false,
75
+ }, ['reward']);
76
+ sideEffects?.onError?.(err);
77
+ throw transformedError;
78
+ }
79
+ }
80
+ /**
81
+ * Creates multiple rewards.
82
+ * @param rewards - Rewards to create.
83
+ * @public
84
+ * @requiredField rewards
85
+ * @requiredField rewards.name
86
+ * @requiredField rewards.typeDetails
87
+ * @permissionId LOYALTY.MANAGE_REWARDS
88
+ * @permissionScope Manage Loyalty
89
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
90
+ * @applicableIdentity APP
91
+ * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.BulkCreateRewards
92
+ */
93
+ export async function bulkCreateRewards(rewards) {
94
+ // @ts-ignore
95
+ const { httpClient, sideEffects } = arguments[1];
96
+ const payload = renameKeysFromSDKRequestToRESTRequest({ rewards: rewards });
97
+ const reqOpts = ambassadorWixLoyaltyV1Reward.bulkCreateRewards(payload);
98
+ sideEffects?.onSiteCall?.();
99
+ try {
100
+ const result = await httpClient.request(reqOpts);
101
+ sideEffects?.onSuccess?.(result);
102
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
103
+ }
104
+ catch (err) {
105
+ const transformedError = sdkTransformError(err, {
106
+ spreadPathsToArguments: {},
107
+ explicitPathsToArguments: { rewards: '$[0]' },
108
+ singleArgumentUnchanged: false,
109
+ }, ['rewards']);
110
+ sideEffects?.onError?.(err);
111
+ throw transformedError;
112
+ }
113
+ }
114
+ /**
115
+ * Retrieves a reward.
116
+ * @param _id - ID of the reward to retrieve.
117
+ * @public
118
+ * @requiredField _id
119
+ * @permissionId LOYALTY.READ_REWARDS
120
+ * @permissionScope Read Loyalty
121
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
122
+ * @permissionScope Manage Loyalty
123
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
124
+ * @applicableIdentity APP
125
+ * @applicableIdentity VISITOR
126
+ * @returns Retrieved reward.
127
+ * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.GetReward
128
+ */
129
+ export async function getReward(_id) {
130
+ // @ts-ignore
131
+ const { httpClient, sideEffects } = arguments[1];
132
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
133
+ const reqOpts = ambassadorWixLoyaltyV1Reward.getReward(payload);
134
+ sideEffects?.onSiteCall?.();
135
+ try {
136
+ const result = await httpClient.request(reqOpts);
137
+ sideEffects?.onSuccess?.(result);
138
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.reward;
139
+ }
140
+ catch (err) {
141
+ const transformedError = sdkTransformError(err, {
142
+ spreadPathsToArguments: {},
143
+ explicitPathsToArguments: { id: '$[0]' },
144
+ singleArgumentUnchanged: false,
145
+ }, ['_id']);
146
+ sideEffects?.onError?.(err);
147
+ throw transformedError;
148
+ }
149
+ }
150
+ /**
151
+ * Retrieves rewards from all metasites that the caller is the member of.
152
+ *
153
+ * Must be called with user identity.
154
+ * @public
155
+ * @documentationMaturity preview
156
+ * @permissionId LOYALTY.REWARD_BULK_READ
157
+ * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.BulkGetRewards
158
+ */
159
+ export async function bulkGetRewards() {
160
+ // @ts-ignore
161
+ const { httpClient, sideEffects } = arguments[0];
162
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
163
+ const reqOpts = ambassadorWixLoyaltyV1Reward.bulkGetRewards(payload);
164
+ sideEffects?.onSiteCall?.();
165
+ try {
166
+ const result = await httpClient.request(reqOpts);
167
+ sideEffects?.onSuccess?.(result);
168
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
169
+ }
170
+ catch (err) {
171
+ const transformedError = sdkTransformError(err, {
172
+ spreadPathsToArguments: {},
173
+ explicitPathsToArguments: {},
174
+ singleArgumentUnchanged: false,
175
+ }, []);
176
+ sideEffects?.onError?.(err);
177
+ throw transformedError;
178
+ }
179
+ }
180
+ /**
181
+ * Retrieves a list of rewards, given the provided paging, filtering, and sorting.
182
+ *
183
+ * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.
184
+ *
185
+ * 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).
186
+ * @param query - Query parameters.
187
+ * @public
188
+ * @requiredField query
189
+ * @permissionId LOYALTY.READ_REWARDS
190
+ * @permissionScope Read Loyalty
191
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
192
+ * @permissionScope Manage Loyalty
193
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
194
+ * @applicableIdentity APP
195
+ * @applicableIdentity VISITOR
196
+ * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.QueryRewards
197
+ */
198
+ export async function queryRewards(query) {
199
+ // @ts-ignore
200
+ const { httpClient, sideEffects } = arguments[1];
201
+ const payload = renameKeysFromSDKRequestToRESTRequest({ query: query });
202
+ const reqOpts = ambassadorWixLoyaltyV1Reward.queryRewards(payload);
203
+ sideEffects?.onSiteCall?.();
204
+ try {
205
+ const result = await httpClient.request(reqOpts);
206
+ sideEffects?.onSuccess?.(result);
207
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
208
+ }
209
+ catch (err) {
210
+ const transformedError = sdkTransformError(err, {
211
+ spreadPathsToArguments: {},
212
+ explicitPathsToArguments: { query: '$[0]' },
213
+ singleArgumentUnchanged: false,
214
+ }, ['query']);
215
+ sideEffects?.onError?.(err);
216
+ throw transformedError;
217
+ }
218
+ }
219
+ /**
220
+ * Updates a loyalty reward.
221
+ *
222
+ * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,
223
+ * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.
224
+ *
225
+ * You may not change the `type` of a reward. That is set upon creation and cannot be updated.
226
+ * @param _id - Reward ID.
227
+ * @public
228
+ * @requiredField _id
229
+ * @requiredField reward
230
+ * @requiredField reward.name
231
+ * @requiredField reward.revision
232
+ * @requiredField reward.typeDetails
233
+ * @param reward - Reward info to update.
234
+ * @permissionId LOYALTY.MANAGE_REWARDS
235
+ * @permissionScope Manage Loyalty
236
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
237
+ * @applicableIdentity APP
238
+ * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.UpdateReward
239
+ */
240
+ export async function updateReward(_id, reward) {
241
+ // @ts-ignore
242
+ const { httpClient, sideEffects } = arguments[2];
243
+ const payload = renameKeysFromSDKRequestToRESTRequest({
244
+ reward: { ...reward, id: _id },
245
+ });
246
+ const reqOpts = ambassadorWixLoyaltyV1Reward.updateReward(payload);
247
+ sideEffects?.onSiteCall?.();
248
+ try {
249
+ const result = await httpClient.request(reqOpts);
250
+ sideEffects?.onSuccess?.(result);
251
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
252
+ }
253
+ catch (err) {
254
+ const transformedError = sdkTransformError(err, {
255
+ spreadPathsToArguments: { reward: '$[1]' },
256
+ explicitPathsToArguments: { 'reward.id': '$[0]' },
257
+ singleArgumentUnchanged: false,
258
+ }, ['_id', 'reward']);
259
+ sideEffects?.onError?.(err);
260
+ throw transformedError;
261
+ }
262
+ }
263
+ /**
264
+ * Deletes a reward.
265
+ * @param _id - ID of the reward to delete.
266
+ * @param revision - Revision number, which increments by 1 each time the reward is updated.
267
+ *
268
+ * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.
269
+ * @public
270
+ * @requiredField _id
271
+ * @requiredField revision
272
+ * @permissionId LOYALTY.MANAGE_REWARDS
273
+ * @permissionScope Manage Loyalty
274
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
275
+ * @applicableIdentity APP
276
+ * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.DeleteReward
277
+ */
278
+ export async function deleteReward(_id, revision) {
279
+ // @ts-ignore
280
+ const { httpClient, sideEffects } = arguments[2];
281
+ const payload = renameKeysFromSDKRequestToRESTRequest({
282
+ id: _id,
283
+ revision: revision,
284
+ });
285
+ const reqOpts = ambassadorWixLoyaltyV1Reward.deleteReward(payload);
286
+ sideEffects?.onSiteCall?.();
287
+ try {
288
+ const result = await httpClient.request(reqOpts);
289
+ sideEffects?.onSuccess?.(result);
290
+ }
291
+ catch (err) {
292
+ const transformedError = sdkTransformError(err, {
293
+ spreadPathsToArguments: {},
294
+ explicitPathsToArguments: { id: '$[0]', revision: '$[1]' },
295
+ singleArgumentUnchanged: false,
296
+ }, ['_id', 'revision']);
297
+ sideEffects?.onError?.(err);
298
+ throw transformedError;
299
+ }
300
+ }
301
+ /**
302
+ * Retrieves a list of rewards.
303
+ *
304
+ * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.
305
+ * @public
306
+ * @param options - List options.
307
+ * @permissionId LOYALTY.READ_REWARDS
308
+ * @permissionScope Read Loyalty
309
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
310
+ * @permissionScope Manage Loyalty
311
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
312
+ * @applicableIdentity APP
313
+ * @applicableIdentity VISITOR
314
+ * @fqn com.wixpress.loyalty.reward.LoyaltyRewards.ListRewards
315
+ */
316
+ export async function listRewards(options) {
317
+ // @ts-ignore
318
+ const { httpClient, sideEffects } = arguments[1];
319
+ const payload = renameKeysFromSDKRequestToRESTRequest({
320
+ cursorPaging: options?.cursorPaging,
321
+ });
322
+ const reqOpts = ambassadorWixLoyaltyV1Reward.listRewards(payload);
323
+ sideEffects?.onSiteCall?.();
324
+ try {
325
+ const result = await httpClient.request(reqOpts);
326
+ sideEffects?.onSuccess?.(result);
327
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
328
+ }
329
+ catch (err) {
330
+ const transformedError = sdkTransformError(err, {
331
+ spreadPathsToArguments: {},
332
+ explicitPathsToArguments: { cursorPaging: '$[0].cursorPaging' },
333
+ singleArgumentUnchanged: false,
334
+ }, ['options']);
335
+ sideEffects?.onError?.(err);
336
+ throw transformedError;
337
+ }
338
+ }
339
+ //# sourceMappingURL=loyalty-v1-reward-rewards.universal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loyalty-v1-reward-rewards.universal.js","sourceRoot":"","sources":["../../../../src/loyalty-v1-reward-rewards.universal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EACL,qCAAqC,EACrC,uCAAuC,GACxC,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,4BAA4B,MAAM,qCAAqC,CAAC;AAsDpF,8BAA8B;AAC9B,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACpB,6BAA6B;IAC7B,qCAAuB,CAAA;IACvB,sEAAsE;IACtE,iDAAmC,CAAA;IACnC,sHAAsH;IACtH,6CAA+B,CAAA;IAC/B,wBAAwB;IACxB,yDAA2C,CAAA;AAC7C,CAAC,EATW,UAAU,KAAV,UAAU,QASrB;AAkVD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AA0QD,MAAM,CAAN,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,8DAAuC,CAAA;IACvC,wCAAiB,CAAA;IACjB,4CAAqB,CAAA;IACrB,kCAAW,CAAA;AACb,CAAC,EANW,mBAAmB,KAAnB,mBAAmB,QAM9B;AAyID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,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+ "version": "1.0.6",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
7
7
  },
8
8
  "keywords": [],
9
9
  "sideEffects": false,
10
- "main": "/build/index.js",
11
- "types": "./build/index.d.mts",
10
+ "main": "./build/cjs/index.js",
11
+ "types": "./build/es/index.d.ts",
12
12
  "exports": {
13
13
  ".": {
14
- "import": "./build/index.mjs",
15
- "require": "./build/index.js",
16
- "types": "./build/index.d.mts"
14
+ "import": "./build/es/index.js",
15
+ "require": "./build/cjs/index.js",
16
+ "types": "./build/es/index.d.ts"
17
17
  },
18
18
  "./package.json": "./package.json",
19
19
  "./meta": {
20
- "import": "./build/meta.mjs",
21
- "require": "./build/meta.js",
22
- "types": "./build/meta.d.mts"
20
+ "import": "./build/es/meta.js",
21
+ "require": "./build/cjs/meta.js",
22
+ "types": "./build/es/meta.d.ts"
23
23
  }
24
24
  },
25
25
  "files": [
@@ -28,15 +28,14 @@
28
28
  "service-plugins"
29
29
  ],
30
30
  "dependencies": {
31
- "@wix/sdk-runtime": "^0.3.42",
32
- "@wix/sdk-types": "^1.13.16"
31
+ "@wix/sdk-runtime": "^0.3.49",
32
+ "@wix/sdk-types": "^1.13.23"
33
33
  },
34
34
  "devDependencies": {
35
- "tsup": "^8.4.0",
36
35
  "typescript": "^5.3.2"
37
36
  },
38
37
  "scripts": {
39
- "build": "tsup",
38
+ "build": "tsc -b tsconfig.json tsconfig.esm.json tsconfig.internal.json tsconfig.internal.esm.json",
40
39
  "test": ":"
41
40
  },
42
41
  "wix": {
@@ -49,5 +48,5 @@
49
48
  "fqdn": "wix.loyalty.v1.reward"
50
49
  }
51
50
  },
52
- "falconPackageHash": "70ef8f1a960e03c5dbd149b70d65fbc48a8feebb6c781a7721a43266"
51
+ "falconPackageHash": "fe7195a51cf479ea3ae29e92997dce2a52658d86456fe69dd64eaa17"
53
52
  }
package/build/index.d.mts DELETED
@@ -1,126 +0,0 @@
1
- import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
- import { R as Reward, B as BulkCreateRewardsResponse, a as BulkGetRewardsResponse, C as CursorQuery, Q as QueryRewardsResponse, U as UpdateReward, b as UpdateRewardResponse, L as ListRewardsOptions, c as ListRewardsResponse } from './loyalty-v1-reward-rewards.universal-DJFLdOGr.mjs';
3
- export { a4 as ActionEvent, A as ApplicationError, a9 as BaseEventMetadata, u as BulkActionMetadata, s as BulkCreateRewardsRequest, x as BulkGetRewardsRequest, t as BulkRewardResult, g as CouponReward, h as CouponRewardDiscountTypeOneOf, i as CouponRewardScopeOrMinSubtotalOneOf, n as CouponScope, q as CreateRewardRequest, r as CreateRewardResponse, J as CursorPaging, K as CursorPagingMetadata, E as CursorQueryPagingMethodOneOf, M as Cursors, O as DeleteRewardRequest, T as DeleteRewardResponse, D as DiscountAmount, f as DiscountAmountConfig, _ as DomainEvent, $ as DomainEventBodyOneOf, a5 as Empty, a0 as EntityCreatedEvent, a3 as EntityDeletedEvent, a2 as EntityUpdatedEvent, aa as EventMetadata, F as FixedAmountDiscount, j as FixedAmountDiscountConfig, l as FreeShippingDiscount, m as FreeShippingDiscountConfig, v as GetRewardRequest, w as GetRewardResponse, G as Group, a7 as IdentificationData, a8 as IdentificationDataIdOneOf, I as ItemMetadata, Y as ListRewardsInTierRequest, Z as ListRewardsInTierResponse, V as ListRewardsRequest, a6 as MessageEnvelope, X as PagingMetadataV2, P as PercentageDiscount, k as PercentageDiscountConfig, z as QueryRewardsRequest, a1 as RestoreInfo, ab as RewardCreatedEnvelope, ac as RewardDeletedEnvelope, p as RewardDisabled, d as RewardType, e as RewardTypeDetailsOneOf, ad as RewardUpdatedEnvelope, y as RewardsInSite, S as SortOrder, H as Sorting, o as SpiDiscountAmount, N as UpdateRewardRequest, W as WebhookIdentityType } from './loyalty-v1-reward-rewards.universal-DJFLdOGr.mjs';
4
- import { createEventModule } from '@wix/sdk-runtime/event-definition-modules';
5
-
6
- declare function createReward$1(httpClient: HttpClient): CreateRewardSignature;
7
- interface CreateRewardSignature {
8
- /**
9
- * Creates a reward that can be redeemed with loyalty points.
10
- *
11
- * When a customer redeems a reward, a loyalty coupon is created
12
- * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can
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.
16
- *
17
- * 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
- * to change the status.
20
- *
21
- * To customize a reward for each loyalty tier, use the `configsByTier` parameter.
22
- * This allows you to specify the amount of the earned discount, the cost in loyalty points
23
- * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own
24
- * `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
- * @param - Reward to create.
27
- * @returns Created reward.
28
- */
29
- (reward: Reward): Promise<Reward>;
30
- }
31
- declare function bulkCreateRewards$1(httpClient: HttpClient): BulkCreateRewardsSignature;
32
- interface BulkCreateRewardsSignature {
33
- /**
34
- * Creates multiple rewards.
35
- * @param - Rewards to create.
36
- */
37
- (rewards: Reward[]): Promise<BulkCreateRewardsResponse>;
38
- }
39
- declare function getReward$1(httpClient: HttpClient): GetRewardSignature;
40
- interface GetRewardSignature {
41
- /**
42
- * Retrieves a reward.
43
- * @param - ID of the reward to retrieve.
44
- * @returns Retrieved reward.
45
- */
46
- (_id: string): Promise<Reward>;
47
- }
48
- declare function bulkGetRewards$1(httpClient: HttpClient): BulkGetRewardsSignature;
49
- interface BulkGetRewardsSignature {
50
- /**
51
- * Retrieves rewards from all metasites that the caller is the member of.
52
- *
53
- * Must be called with user identity.
54
- */
55
- (): Promise<BulkGetRewardsResponse>;
56
- }
57
- declare function queryRewards$1(httpClient: HttpClient): QueryRewardsSignature;
58
- interface QueryRewardsSignature {
59
- /**
60
- * Retrieves a list of rewards, given the provided paging, filtering, and sorting.
61
- *
62
- * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.
63
- *
64
- * 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).
65
- * @param - Query parameters.
66
- */
67
- (query: CursorQuery): Promise<QueryRewardsResponse>;
68
- }
69
- declare function updateReward$1(httpClient: HttpClient): UpdateRewardSignature;
70
- interface UpdateRewardSignature {
71
- /**
72
- * Updates a loyalty reward.
73
- *
74
- * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,
75
- * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.
76
- *
77
- * You may not change the `type` of a reward. That is set upon creation and cannot be updated.
78
- * @param - Reward ID.
79
- * @param - Reward info to update.
80
- */
81
- (_id: string, reward: UpdateReward): Promise<UpdateRewardResponse>;
82
- }
83
- declare function deleteReward$1(httpClient: HttpClient): DeleteRewardSignature;
84
- interface DeleteRewardSignature {
85
- /**
86
- * Deletes a reward.
87
- * @param - ID of the reward to delete.
88
- * @param - Revision number, which increments by 1 each time the reward is updated.
89
- *
90
- * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.
91
- */
92
- (_id: string, revision: string): Promise<void>;
93
- }
94
- declare function listRewards$1(httpClient: HttpClient): ListRewardsSignature;
95
- interface ListRewardsSignature {
96
- /**
97
- * Retrieves a list of rewards.
98
- *
99
- * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.
100
- * @param - List options.
101
- */
102
- (options?: ListRewardsOptions | undefined): Promise<ListRewardsResponse>;
103
- }
104
-
105
- declare const createReward: MaybeContext<BuildRESTFunction<typeof createReward$1> & typeof createReward$1>;
106
- declare const bulkCreateRewards: MaybeContext<BuildRESTFunction<typeof bulkCreateRewards$1> & typeof bulkCreateRewards$1>;
107
- declare const getReward: MaybeContext<BuildRESTFunction<typeof getReward$1> & typeof getReward$1>;
108
- declare const bulkGetRewards: MaybeContext<BuildRESTFunction<typeof bulkGetRewards$1> & typeof bulkGetRewards$1>;
109
- declare const queryRewards: MaybeContext<BuildRESTFunction<typeof queryRewards$1> & typeof queryRewards$1>;
110
- declare const updateReward: MaybeContext<BuildRESTFunction<typeof updateReward$1> & typeof updateReward$1>;
111
- declare const deleteReward: MaybeContext<BuildRESTFunction<typeof deleteReward$1> & typeof deleteReward$1>;
112
- declare const listRewards: MaybeContext<BuildRESTFunction<typeof listRewards$1> & typeof listRewards$1>;
113
- /**
114
- * Triggered when a reward is created.
115
- */
116
- declare const onRewardCreated: ReturnType<typeof createEventModule<typeof publicOnRewardCreated>>;
117
- /**
118
- * Triggered when a reward is deleted.
119
- */
120
- declare const onRewardDeleted: ReturnType<typeof createEventModule<typeof publicOnRewardDeleted>>;
121
- /**
122
- * Triggered when a reward is updated.
123
- */
124
- declare const onRewardUpdated: ReturnType<typeof createEventModule<typeof publicOnRewardUpdated>>;
125
-
126
- export { BulkCreateRewardsResponse, BulkGetRewardsResponse, CursorQuery, ListRewardsOptions, ListRewardsResponse, QueryRewardsResponse, Reward, UpdateReward, UpdateRewardResponse, bulkCreateRewards, bulkGetRewards, createReward, deleteReward, getReward, listRewards, onRewardCreated, onRewardDeleted, onRewardUpdated, queryRewards, updateReward };
package/build/index.d.ts DELETED
@@ -1,126 +0,0 @@
1
- import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
- import { R as Reward, B as BulkCreateRewardsResponse, a as BulkGetRewardsResponse, C as CursorQuery, Q as QueryRewardsResponse, U as UpdateReward, b as UpdateRewardResponse, L as ListRewardsOptions, c as ListRewardsResponse } from './loyalty-v1-reward-rewards.universal-DJFLdOGr.js';
3
- export { a4 as ActionEvent, A as ApplicationError, a9 as BaseEventMetadata, u as BulkActionMetadata, s as BulkCreateRewardsRequest, x as BulkGetRewardsRequest, t as BulkRewardResult, g as CouponReward, h as CouponRewardDiscountTypeOneOf, i as CouponRewardScopeOrMinSubtotalOneOf, n as CouponScope, q as CreateRewardRequest, r as CreateRewardResponse, J as CursorPaging, K as CursorPagingMetadata, E as CursorQueryPagingMethodOneOf, M as Cursors, O as DeleteRewardRequest, T as DeleteRewardResponse, D as DiscountAmount, f as DiscountAmountConfig, _ as DomainEvent, $ as DomainEventBodyOneOf, a5 as Empty, a0 as EntityCreatedEvent, a3 as EntityDeletedEvent, a2 as EntityUpdatedEvent, aa as EventMetadata, F as FixedAmountDiscount, j as FixedAmountDiscountConfig, l as FreeShippingDiscount, m as FreeShippingDiscountConfig, v as GetRewardRequest, w as GetRewardResponse, G as Group, a7 as IdentificationData, a8 as IdentificationDataIdOneOf, I as ItemMetadata, Y as ListRewardsInTierRequest, Z as ListRewardsInTierResponse, V as ListRewardsRequest, a6 as MessageEnvelope, X as PagingMetadataV2, P as PercentageDiscount, k as PercentageDiscountConfig, z as QueryRewardsRequest, a1 as RestoreInfo, ab as RewardCreatedEnvelope, ac as RewardDeletedEnvelope, p as RewardDisabled, d as RewardType, e as RewardTypeDetailsOneOf, ad as RewardUpdatedEnvelope, y as RewardsInSite, S as SortOrder, H as Sorting, o as SpiDiscountAmount, N as UpdateRewardRequest, W as WebhookIdentityType } from './loyalty-v1-reward-rewards.universal-DJFLdOGr.js';
4
- import { createEventModule } from '@wix/sdk-runtime/event-definition-modules';
5
-
6
- declare function createReward$1(httpClient: HttpClient): CreateRewardSignature;
7
- interface CreateRewardSignature {
8
- /**
9
- * Creates a reward that can be redeemed with loyalty points.
10
- *
11
- * When a customer redeems a reward, a loyalty coupon is created
12
- * based on the specifications detailed in either the `discountAmount` or `couponReward` fields. This coupon can
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.
16
- *
17
- * 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
- * to change the status.
20
- *
21
- * To customize a reward for each loyalty tier, use the `configsByTier` parameter.
22
- * This allows you to specify the amount of the earned discount, the cost in loyalty points
23
- * to redeem the reward, and the tier to which this configuration applies. Each tier requires its own
24
- * `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
- * @param - Reward to create.
27
- * @returns Created reward.
28
- */
29
- (reward: Reward): Promise<Reward>;
30
- }
31
- declare function bulkCreateRewards$1(httpClient: HttpClient): BulkCreateRewardsSignature;
32
- interface BulkCreateRewardsSignature {
33
- /**
34
- * Creates multiple rewards.
35
- * @param - Rewards to create.
36
- */
37
- (rewards: Reward[]): Promise<BulkCreateRewardsResponse>;
38
- }
39
- declare function getReward$1(httpClient: HttpClient): GetRewardSignature;
40
- interface GetRewardSignature {
41
- /**
42
- * Retrieves a reward.
43
- * @param - ID of the reward to retrieve.
44
- * @returns Retrieved reward.
45
- */
46
- (_id: string): Promise<Reward>;
47
- }
48
- declare function bulkGetRewards$1(httpClient: HttpClient): BulkGetRewardsSignature;
49
- interface BulkGetRewardsSignature {
50
- /**
51
- * Retrieves rewards from all metasites that the caller is the member of.
52
- *
53
- * Must be called with user identity.
54
- */
55
- (): Promise<BulkGetRewardsResponse>;
56
- }
57
- declare function queryRewards$1(httpClient: HttpClient): QueryRewardsSignature;
58
- interface QueryRewardsSignature {
59
- /**
60
- * Retrieves a list of rewards, given the provided paging, filtering, and sorting.
61
- *
62
- * Query Rewards runs with these defaults, which you can override: `cursorPaging.limit` is `50`.
63
- *
64
- * 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).
65
- * @param - Query parameters.
66
- */
67
- (query: CursorQuery): Promise<QueryRewardsResponse>;
68
- }
69
- declare function updateReward$1(httpClient: HttpClient): UpdateRewardSignature;
70
- interface UpdateRewardSignature {
71
- /**
72
- * Updates a loyalty reward.
73
- *
74
- * Use this endpoint to update details of a reward, such as the name, whether or not a reward is active,
75
- * or the amount of points it costs to redeem. Also use this endpoint to add new tiers that are eligible to redeem a reward.
76
- *
77
- * You may not change the `type` of a reward. That is set upon creation and cannot be updated.
78
- * @param - Reward ID.
79
- * @param - Reward info to update.
80
- */
81
- (_id: string, reward: UpdateReward): Promise<UpdateRewardResponse>;
82
- }
83
- declare function deleteReward$1(httpClient: HttpClient): DeleteRewardSignature;
84
- interface DeleteRewardSignature {
85
- /**
86
- * Deletes a reward.
87
- * @param - ID of the reward to delete.
88
- * @param - Revision number, which increments by 1 each time the reward is updated.
89
- *
90
- * To prevent conflicting changes, the current `revision` must be passed when deleting the reward.
91
- */
92
- (_id: string, revision: string): Promise<void>;
93
- }
94
- declare function listRewards$1(httpClient: HttpClient): ListRewardsSignature;
95
- interface ListRewardsSignature {
96
- /**
97
- * Retrieves a list of rewards.
98
- *
99
- * The list includes rewards that are currently nonredeemable due to insufficient points held by any customers.
100
- * @param - List options.
101
- */
102
- (options?: ListRewardsOptions | undefined): Promise<ListRewardsResponse>;
103
- }
104
-
105
- declare const createReward: MaybeContext<BuildRESTFunction<typeof createReward$1> & typeof createReward$1>;
106
- declare const bulkCreateRewards: MaybeContext<BuildRESTFunction<typeof bulkCreateRewards$1> & typeof bulkCreateRewards$1>;
107
- declare const getReward: MaybeContext<BuildRESTFunction<typeof getReward$1> & typeof getReward$1>;
108
- declare const bulkGetRewards: MaybeContext<BuildRESTFunction<typeof bulkGetRewards$1> & typeof bulkGetRewards$1>;
109
- declare const queryRewards: MaybeContext<BuildRESTFunction<typeof queryRewards$1> & typeof queryRewards$1>;
110
- declare const updateReward: MaybeContext<BuildRESTFunction<typeof updateReward$1> & typeof updateReward$1>;
111
- declare const deleteReward: MaybeContext<BuildRESTFunction<typeof deleteReward$1> & typeof deleteReward$1>;
112
- declare const listRewards: MaybeContext<BuildRESTFunction<typeof listRewards$1> & typeof listRewards$1>;
113
- /**
114
- * Triggered when a reward is created.
115
- */
116
- declare const onRewardCreated: ReturnType<typeof createEventModule<typeof publicOnRewardCreated>>;
117
- /**
118
- * Triggered when a reward is deleted.
119
- */
120
- declare const onRewardDeleted: ReturnType<typeof createEventModule<typeof publicOnRewardDeleted>>;
121
- /**
122
- * Triggered when a reward is updated.
123
- */
124
- declare const onRewardUpdated: ReturnType<typeof createEventModule<typeof publicOnRewardUpdated>>;
125
-
126
- export { BulkCreateRewardsResponse, BulkGetRewardsResponse, CursorQuery, ListRewardsOptions, ListRewardsResponse, QueryRewardsResponse, Reward, UpdateReward, UpdateRewardResponse, bulkCreateRewards, bulkGetRewards, createReward, deleteReward, getReward, listRewards, onRewardCreated, onRewardDeleted, onRewardUpdated, queryRewards, updateReward };