@wix/referral 1.0.3 → 1.0.5

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,88 +1,322 @@
1
- /** ReferralProgram is the main entity of ReferralPrograms that can be used to manage the program. */
2
- interface ReferralProgram {
3
- /** Referral program name. */
4
- name?: string | null;
1
+ /** ReferralEvent. */
2
+ interface ReferralEvent extends ReferralEventEventTypeOneOf {
3
+ /** ReferredFriendSignupEvent is an event that is triggered when a referred friend signs up. */
4
+ referredFriendSignupEvent?: ReferredFriendSignupEvent;
5
+ /** SuccessfulReferralEvent is an event that is triggered when a referral is successful. */
6
+ successfulReferralEvent?: V1SuccessfulReferralEvent;
7
+ /** ActionEvent is an event that is triggered when an action is performed. */
8
+ actionEvent?: V1ActionEvent;
9
+ /** RewardEvent is an event that is triggered when a reward is given. */
10
+ rewardEvent?: RewardEvent;
5
11
  /**
6
- * Referral program status.
12
+ * ReferralEvent ID.
7
13
  * @readonly
8
14
  */
9
- status?: ProgramStatus;
15
+ _id?: string | null;
10
16
  /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision. */
11
17
  revision?: string | null;
12
18
  /**
13
- * Program's creation date and time.
19
+ * Represents the time this ReferralEvent was created.
14
20
  * @readonly
15
21
  */
16
22
  _createdDate?: Date;
17
23
  /**
18
- * Program's last update date and time
24
+ * Represents the time this ReferralEvent was last updated.
19
25
  * @readonly
20
26
  */
21
27
  _updatedDate?: Date;
22
- /** Referred friend reward configuration. */
23
- referredFriendReward?: Reward$1;
24
- /** Referring customer reward configuration. */
25
- referringCustomerReward?: Reward$1;
26
- /** List of actions that complete referral. */
27
- successfulReferralActions?: Action[];
28
- /**
29
- * Set to true if user has required plan to activate program.
30
- * @readonly
31
- * @deprecated Set to true if user has required plan to activate program.
32
- * @replacedBy GetReferralProgramPremiumFeatures
33
- * @removalDate 2024-09-01
34
- */
35
- isPremium?: boolean;
36
- /** Emails configuration. */
37
- emails?: Emails;
38
28
  }
39
- declare enum ProgramStatus {
40
- /** unknown status. */
41
- UNKNOWN = "UNKNOWN",
42
- /** initial program status (program was created but was not enabled yet). */
43
- DRAFT = "DRAFT",
44
- /** program is active. */
45
- ACTIVE = "ACTIVE",
46
- /** program was manually disabled by the user (this action can be reverted, meaning user can set it to be active again). */
47
- PAUSED = "PAUSED"
29
+ /** @oneof */
30
+ interface ReferralEventEventTypeOneOf {
31
+ /** ReferredFriendSignupEvent is an event that is triggered when a referred friend signs up. */
32
+ referredFriendSignupEvent?: ReferredFriendSignupEvent;
33
+ /** SuccessfulReferralEvent is an event that is triggered when a referral is successful. */
34
+ successfulReferralEvent?: V1SuccessfulReferralEvent;
35
+ /** ActionEvent is an event that is triggered when an action is performed. */
36
+ actionEvent?: V1ActionEvent;
37
+ /** RewardEvent is an event that is triggered when a reward is given. */
38
+ rewardEvent?: RewardEvent;
39
+ }
40
+ interface ReferredFriendSignupEvent {
41
+ /** The referred friend ID. */
42
+ referredFriendId?: string;
43
+ }
44
+ interface V1SuccessfulReferralEvent {
45
+ /** The referred friend ID. */
46
+ referredFriendId?: string;
47
+ /** The referring customer ID. */
48
+ referringCustomerId?: string;
49
+ }
50
+ interface V1ActionEvent {
51
+ /** The referred friend ID. */
52
+ referredFriendId?: string;
53
+ /** The referring customer ID. */
54
+ referringCustomerId?: string;
55
+ /** The trigger of the action. */
56
+ trigger?: V1Trigger;
57
+ /** Amount. */
58
+ amount?: string | null;
59
+ /** Currency. */
60
+ currency?: string | null;
61
+ /** Order ID. */
62
+ orderId?: string | null;
63
+ }
64
+ interface V1Trigger {
65
+ /** The app id of the app that triggered the event. */
66
+ appId?: string;
67
+ /** The activity type that triggered the event. */
68
+ activityType?: string;
48
69
  }
49
- interface Reward$1 extends RewardOptionsOneOf {
50
- /** Options for coupon reward type. */
51
- couponOptions?: Coupon$1;
52
- /** Options for Loyalty points reward type. */
53
- loyaltyPointsOptions?: LoyaltyPoints$1;
54
- /** Type of the reward. */
55
- type?: Type;
70
+ interface RewardEvent extends RewardEventReceiverOneOf {
71
+ /**
72
+ * The referring customer ID.
73
+ * @readonly
74
+ */
75
+ rewardedReferringCustomerId?: string;
76
+ /**
77
+ * The referred friend ID.
78
+ * @readonly
79
+ */
80
+ rewardedReferredFriendId?: string;
81
+ /** The referral reward ID. */
82
+ referralRewardId?: string;
83
+ /** The reward type. */
84
+ rewardType?: Reward;
56
85
  }
57
86
  /** @oneof */
58
- interface RewardOptionsOneOf {
59
- /** Options for coupon reward type. */
60
- couponOptions?: Coupon$1;
61
- /** Options for Loyalty points reward type. */
62
- loyaltyPointsOptions?: LoyaltyPoints$1;
87
+ interface RewardEventReceiverOneOf {
88
+ /**
89
+ * The referring customer ID.
90
+ * @readonly
91
+ */
92
+ rewardedReferringCustomerId?: string;
93
+ /**
94
+ * The referred friend ID.
95
+ * @readonly
96
+ */
97
+ rewardedReferredFriendId?: string;
63
98
  }
64
- declare enum Type {
99
+ declare enum Reward {
65
100
  /** Unknown reward type. */
66
101
  UNKNOWN = "UNKNOWN",
67
- /** Coupon reward type. */
102
+ /** Reward is a coupon. */
68
103
  COUPON = "COUPON",
69
- /** Loyalty points reward type. */
104
+ /** Reward is loyalty points. */
70
105
  LOYALTY_POINTS = "LOYALTY_POINTS",
71
- /** No reward type. */
106
+ /** No reward. */
72
107
  NOTHING = "NOTHING"
73
108
  }
109
+ interface CursorQuery$1 extends CursorQueryPagingMethodOneOf$1 {
110
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
111
+ cursorPaging?: CursorPaging$1;
112
+ /**
113
+ * Filter object in the following format:
114
+ * `"filter" : {
115
+ * "fieldName1": "value1",
116
+ * "fieldName2":{"$operator":"value2"}
117
+ * }`
118
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
119
+ */
120
+ filter?: Record<string, any> | null;
121
+ /**
122
+ * Sort object in the following format:
123
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
124
+ */
125
+ sort?: Sorting$1[];
126
+ }
127
+ /** @oneof */
128
+ interface CursorQueryPagingMethodOneOf$1 {
129
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
130
+ cursorPaging?: CursorPaging$1;
131
+ }
132
+ interface Sorting$1 {
133
+ /** Name of the field to sort by. */
134
+ fieldName?: string;
135
+ /** Sort order. */
136
+ order?: SortOrder$1;
137
+ }
138
+ declare enum SortOrder$1 {
139
+ ASC = "ASC",
140
+ DESC = "DESC"
141
+ }
142
+ interface CursorPaging$1 {
143
+ /** Maximum number of items to return in the results. */
144
+ limit?: number | null;
145
+ /**
146
+ * Pointer to the next or previous page in the list of results.
147
+ *
148
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
149
+ * Not relevant for the first request.
150
+ */
151
+ cursor?: string | null;
152
+ }
153
+ interface CursorPagingMetadata$1 {
154
+ /** Number of items returned in the response. */
155
+ count?: number | null;
156
+ /** Cursor strings that point to the next page, previous page, or both. */
157
+ cursors?: Cursors$3;
158
+ /**
159
+ * Whether there are more pages to retrieve following the current page.
160
+ *
161
+ * + `true`: Another page of results can be retrieved.
162
+ * + `false`: This is the last page.
163
+ */
164
+ hasNext?: boolean | null;
165
+ }
166
+ interface Cursors$3 {
167
+ /** Cursor string pointing to the next page in the list of results. */
168
+ next?: string | null;
169
+ /** Cursor pointing to the previous page in the list of results. */
170
+ prev?: string | null;
171
+ }
172
+ interface GetReferralStatisticsResponse {
173
+ /** Total sign ups completed by referred friends */
174
+ totalSignUpsCompleted?: number;
175
+ /** Total actions completed by referred friends */
176
+ totalActionsCompleted?: number;
177
+ /** Total amount of purchases made by referred friends */
178
+ totalAmountGenerated?: string;
179
+ }
180
+ interface QueryReferringCustomerTotalsResponse {
181
+ /** List of ReferringCustomerTotals that match the query. */
182
+ referringCustomerTotals?: ReferringCustomerTotal[];
183
+ /** Paging metadata. */
184
+ metadata?: CursorPagingMetadata$1;
185
+ }
186
+ interface ReferringCustomerTotal {
187
+ /**
188
+ * Referring customer id.
189
+ * @readonly
190
+ */
191
+ referringCustomerId?: string;
192
+ /**
193
+ * Contact id.
194
+ * @readonly
195
+ */
196
+ contactId?: string;
197
+ /**
198
+ * Last successful referral date.
199
+ * @readonly
200
+ */
201
+ lastSuccessfulReferral?: Date;
202
+ /**
203
+ * Total successful referrals made by this customer.
204
+ * @readonly
205
+ */
206
+ totalSuccessfulReferrals?: number;
207
+ /**
208
+ * Total amount generated by friends referred by this customer.
209
+ * @readonly
210
+ */
211
+ totalAmountGenerated?: string;
212
+ /**
213
+ * Last friend action date.
214
+ * @readonly
215
+ */
216
+ lastFriendAction?: Date;
217
+ /**
218
+ * Total friends that have actions done.
219
+ * @readonly
220
+ */
221
+ totalFriendsWithActions?: number;
222
+ }
223
+ interface QueryReferredFriendActionsResponse {
224
+ /** List of ReferredFriendActions that match the query. */
225
+ referredFriendActions?: ReferredFriendAction[];
226
+ /** Paging metadata. */
227
+ metadata?: CursorPagingMetadata$1;
228
+ }
229
+ interface ReferredFriendAction extends ReferredFriendActionRewardTypeOptionsOneOf {
230
+ /** Coupon reward type options. */
231
+ coupon?: V1Coupon$1;
232
+ /** Loyalty points reward type options. */
233
+ loyaltyPoints?: LoyaltyPoints;
234
+ /**
235
+ * Referred friend id.
236
+ * @readonly
237
+ */
238
+ referredFriendId?: string;
239
+ /**
240
+ * Contact id.
241
+ * @readonly
242
+ */
243
+ contactId?: string;
244
+ /**
245
+ * First action trigger.
246
+ * @readonly
247
+ */
248
+ trigger?: V1Trigger;
249
+ /**
250
+ * First action date.
251
+ * @readonly
252
+ */
253
+ actionDate?: Date;
254
+ /** Issued reward type. */
255
+ rewardType?: Reward;
256
+ /** Total number of actions. */
257
+ totalActions?: number;
258
+ /**
259
+ * Total amount spent by this referred friend.
260
+ * @readonly
261
+ */
262
+ totalAmountSpent?: string;
263
+ /**
264
+ * friend signup date.
265
+ * @readonly
266
+ */
267
+ signupDate?: Date;
268
+ }
269
+ /** @oneof */
270
+ interface ReferredFriendActionRewardTypeOptionsOneOf {
271
+ /** Coupon reward type options. */
272
+ coupon?: V1Coupon$1;
273
+ /** Loyalty points reward type options. */
274
+ loyaltyPoints?: LoyaltyPoints;
275
+ }
276
+ interface V1Coupon$1 {
277
+ /**
278
+ * Coupon ID.
279
+ * @readonly
280
+ */
281
+ _id?: string;
282
+ /**
283
+ * Coupon code.
284
+ * @readonly
285
+ */
286
+ code?: string;
287
+ /**
288
+ * Coupon status.
289
+ * @readonly
290
+ */
291
+ status?: Status$2;
292
+ /**
293
+ * Coupon specification.
294
+ * @readonly
295
+ */
296
+ couponSpecification?: Coupon$1;
297
+ }
298
+ declare enum Status$2 {
299
+ /** Unknown coupon status. */
300
+ UNKNOWN = "UNKNOWN",
301
+ /** Coupon is active and can be applied. */
302
+ ACTIVE = "ACTIVE",
303
+ /** Coupon was already applied and can not be used anymore. */
304
+ APPLIED = "APPLIED",
305
+ /** Coupon was deleted. */
306
+ DELETED = "DELETED"
307
+ }
74
308
  interface Coupon$1 extends CouponDiscountTypeOptionsOneOf$1, CouponScopeOrMinSubtotalOneOf$1 {
75
- /** Options for fixed amount discount type. */
309
+ /** Options for fixed amount discount type */
76
310
  fixedAmountOptions?: FixedAmountDiscount$1;
77
- /** Options for percentage discount type. */
311
+ /** Options for percentage discount type */
78
312
  percentageOptions?: PercentageDiscount$1;
79
313
  /** Limit the coupon to carts with a subtotal above this number. */
80
314
  minimumSubtotal?: number;
81
315
  /** Specifies the type of line items this coupon will apply to. */
82
316
  scope?: CouponScope$1;
83
- /** Coupon name. */
317
+ /** Coupon name */
84
318
  name?: string;
85
- /** Coupon discount type. */
319
+ /** Coupon discount type */
86
320
  discountType?: DiscountType$1;
87
321
  /** Limit the coupon to only apply to one item in cart. */
88
322
  limitedToOneItem?: boolean | null;
@@ -93,9 +327,9 @@ interface Coupon$1 extends CouponDiscountTypeOptionsOneOf$1, CouponScopeOrMinSub
93
327
  }
94
328
  /** @oneof */
95
329
  interface CouponDiscountTypeOptionsOneOf$1 {
96
- /** Options for fixed amount discount type. */
330
+ /** Options for fixed amount discount type */
97
331
  fixedAmountOptions?: FixedAmountDiscount$1;
98
- /** Options for percentage discount type. */
332
+ /** Options for percentage discount type */
99
333
  percentageOptions?: PercentageDiscount$1;
100
334
  }
101
335
  /** @oneof */
@@ -106,121 +340,42 @@ interface CouponScopeOrMinSubtotalOneOf$1 {
106
340
  scope?: CouponScope$1;
107
341
  }
108
342
  declare enum DiscountType$1 {
109
- /** Unknown discount type. */
110
343
  UNKNOWN = "UNKNOWN",
111
- /** Discount as a fixed amount. */
344
+ /** Discount as a fixed amount */
112
345
  FIXED_AMOUNT = "FIXED_AMOUNT",
113
- /** Discount as a percentage. */
346
+ /** Discount as a percentage */
114
347
  PERCENTAGE = "PERCENTAGE",
115
- /** Free shipping. */
348
+ /** Free shipping */
116
349
  FREE_SHIPPING = "FREE_SHIPPING"
117
350
  }
118
351
  interface FixedAmountDiscount$1 {
119
- /** Fixed amount to discount. */
352
+ /** Fixed amount to discount */
120
353
  amount?: number;
121
354
  }
122
355
  interface PercentageDiscount$1 {
123
- /** Percentage to discount. */
124
356
  percentage?: number;
125
357
  }
126
358
  interface CouponScope$1 {
127
- /** Namespace of the coupon scope. */
128
359
  namespace?: string;
129
- /** Group of the coupon scope. */
130
360
  group?: Group$1;
131
361
  }
132
362
  interface Group$1 {
133
- /** Name of the group. */
134
363
  name?: string;
135
- /** Entity ID of the group. */
136
364
  entityId?: string | null;
137
365
  }
138
- interface LoyaltyPoints$1 {
139
- /** Amount of points to give. */
140
- amount?: number;
141
- }
142
- declare enum Action {
143
- /** Unknown action. */
144
- UNKNOWN = "UNKNOWN",
145
- /** Store order placed. */
146
- STORE_ORDER_PLACED = "STORE_ORDER_PLACED",
147
- /** Pricing plan ordered. */
148
- PLAN_ORDERED = "PLAN_ORDERED",
149
- /** Wix events ticket ordered. */
150
- TICKET_ORDERED = "TICKET_ORDERED",
151
- /** Bookings session booked. */
152
- SESSION_BOOKED = "SESSION_BOOKED",
153
- /** Restaurant order placed. */
154
- RESTAURANT_ORDER_PLACED = "RESTAURANT_ORDER_PLACED"
155
- }
156
- interface Emails {
157
- /** Encourage customers to refer their friends email. Select for which apps to enable. */
158
- encourageToReferFriends?: App[];
159
- /** Notify customers about their referral reward email. Set true to enable email. */
160
- notifyCustomersAboutReward?: boolean;
161
- }
162
- declare enum App {
163
- /** Unknown app. */
164
- UNKNOWN = "UNKNOWN",
165
- /** Wix stores. */
166
- STORES = "STORES",
167
- /** Wix pricing plans. */
168
- PRICING_PLANS = "PRICING_PLANS",
169
- /** Wix events. */
170
- EVENTS = "EVENTS",
171
- /** Wix bookings. */
172
- BOOKINGS = "BOOKINGS",
173
- /** Wix restaurants. */
174
- RESTAURANTS = "RESTAURANTS"
175
- }
176
- interface GetReferralProgramResponse {
177
- /** The retrieved ReferralProgram. */
178
- referralProgram?: ReferralProgram;
179
- }
180
- interface Cursors$3 {
181
- /** Cursor string pointing to the next page in the list of results. */
182
- next?: string | null;
183
- /** Cursor pointing to the previous page in the list of results. */
184
- prev?: string | null;
185
- }
186
- interface UpdateReferralProgramResponse {
187
- /** The updated ReferralProgram. */
188
- referralProgram?: ReferralProgram;
189
- }
190
- interface ActivateReferralProgramResponse {
191
- /** The activated ReferralProgram. */
192
- referralProgram?: ReferralProgram;
193
- }
194
- interface PauseReferralProgramResponse {
195
- /** The paused ReferralProgram. */
196
- referralProgram?: ReferralProgram;
197
- }
198
- interface GetAISocialMediaPostsSuggestionsResponse {
199
- /** The generated suggestions. */
200
- suggestions?: AISocialMediaPostSuggestion[];
201
- /** The refer friends page URL. */
202
- referFriendsPageUrl?: string | null;
203
- }
204
- interface AISocialMediaPostSuggestion {
205
- /** The suggested post content. */
206
- postContent?: string;
207
- /** The suggested hashtags. */
208
- hashtags?: string[];
209
- }
210
- interface GenerateAISocialMediaPostsSuggestionsResponse {
211
- /** The generated suggestions. */
212
- suggestions?: AISocialMediaPostSuggestion[];
213
- /** The refer friends page URL. */
214
- referFriendsPageUrl?: string | null;
215
- }
216
- interface GetReferralProgramPremiumFeaturesResponse {
366
+ interface LoyaltyPoints {
217
367
  /**
218
- * Set to true if user has referral program feature.
368
+ * Loyalty transaction ID.
219
369
  * @readonly
220
370
  */
221
- referralProgram?: boolean;
371
+ transactionId?: string;
372
+ /**
373
+ * Loyalty points amount given.
374
+ * @readonly
375
+ */
376
+ amount?: number;
222
377
  }
223
- interface IdentificationData$3 extends IdentificationDataIdOneOf$3 {
378
+ interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
224
379
  /** ID of a site visitor that has not logged in to the site. */
225
380
  anonymousVisitorId?: string;
226
381
  /** ID of a site visitor that has logged in to the site. */
@@ -230,10 +385,10 @@ interface IdentificationData$3 extends IdentificationDataIdOneOf$3 {
230
385
  /** ID of an app. */
231
386
  appId?: string;
232
387
  /** @readonly */
233
- identityType?: WebhookIdentityType$3;
388
+ identityType?: WebhookIdentityType$2;
234
389
  }
235
390
  /** @oneof */
236
- interface IdentificationDataIdOneOf$3 {
391
+ interface IdentificationDataIdOneOf$2 {
237
392
  /** ID of a site visitor that has not logged in to the site. */
238
393
  anonymousVisitorId?: string;
239
394
  /** ID of a site visitor that has logged in to the site. */
@@ -243,189 +398,34 @@ interface IdentificationDataIdOneOf$3 {
243
398
  /** ID of an app. */
244
399
  appId?: string;
245
400
  }
246
- declare enum WebhookIdentityType$3 {
401
+ declare enum WebhookIdentityType$2 {
247
402
  UNKNOWN = "UNKNOWN",
248
403
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
249
404
  MEMBER = "MEMBER",
250
405
  WIX_USER = "WIX_USER",
251
406
  APP = "APP"
252
407
  }
253
- interface GetReferralProgramResponseNonNullableFields {
254
- referralProgram?: {
255
- status: ProgramStatus;
256
- referredFriendReward?: {
257
- couponOptions?: {
258
- fixedAmountOptions?: {
259
- amount: number;
260
- };
261
- percentageOptions?: {
262
- percentage: number;
263
- };
264
- minimumSubtotal: number;
265
- scope?: {
266
- namespace: string;
267
- group?: {
268
- name: string;
269
- };
270
- };
271
- name: string;
272
- discountType: DiscountType$1;
273
- };
274
- loyaltyPointsOptions?: {
275
- amount: number;
276
- };
277
- type: Type;
278
- };
279
- referringCustomerReward?: {
280
- couponOptions?: {
281
- fixedAmountOptions?: {
282
- amount: number;
283
- };
284
- percentageOptions?: {
285
- percentage: number;
286
- };
287
- minimumSubtotal: number;
288
- scope?: {
289
- namespace: string;
290
- group?: {
291
- name: string;
292
- };
293
- };
294
- name: string;
295
- discountType: DiscountType$1;
296
- };
297
- loyaltyPointsOptions?: {
298
- amount: number;
299
- };
300
- type: Type;
301
- };
302
- successfulReferralActions: Action[];
303
- isPremium: boolean;
304
- emails?: {
305
- encourageToReferFriends: App[];
306
- notifyCustomersAboutReward: boolean;
307
- };
308
- };
309
- }
310
- interface UpdateReferralProgramResponseNonNullableFields {
311
- referralProgram?: {
312
- status: ProgramStatus;
313
- referredFriendReward?: {
314
- couponOptions?: {
315
- fixedAmountOptions?: {
316
- amount: number;
317
- };
318
- percentageOptions?: {
319
- percentage: number;
320
- };
321
- minimumSubtotal: number;
322
- scope?: {
323
- namespace: string;
324
- group?: {
325
- name: string;
326
- };
327
- };
328
- name: string;
329
- discountType: DiscountType$1;
330
- };
331
- loyaltyPointsOptions?: {
332
- amount: number;
333
- };
334
- type: Type;
335
- };
336
- referringCustomerReward?: {
337
- couponOptions?: {
338
- fixedAmountOptions?: {
339
- amount: number;
340
- };
341
- percentageOptions?: {
342
- percentage: number;
343
- };
344
- minimumSubtotal: number;
345
- scope?: {
346
- namespace: string;
347
- group?: {
348
- name: string;
349
- };
350
- };
351
- name: string;
352
- discountType: DiscountType$1;
353
- };
354
- loyaltyPointsOptions?: {
355
- amount: number;
356
- };
357
- type: Type;
358
- };
359
- successfulReferralActions: Action[];
360
- isPremium: boolean;
361
- emails?: {
362
- encourageToReferFriends: App[];
363
- notifyCustomersAboutReward: boolean;
364
- };
365
- };
408
+ interface GetReferralStatisticsResponseNonNullableFields {
409
+ totalSignUpsCompleted: number;
410
+ totalActionsCompleted: number;
411
+ totalAmountGenerated: string;
366
412
  }
367
- interface ActivateReferralProgramResponseNonNullableFields {
368
- referralProgram?: {
369
- status: ProgramStatus;
370
- referredFriendReward?: {
371
- couponOptions?: {
372
- fixedAmountOptions?: {
373
- amount: number;
374
- };
375
- percentageOptions?: {
376
- percentage: number;
377
- };
378
- minimumSubtotal: number;
379
- scope?: {
380
- namespace: string;
381
- group?: {
382
- name: string;
383
- };
384
- };
385
- name: string;
386
- discountType: DiscountType$1;
387
- };
388
- loyaltyPointsOptions?: {
389
- amount: number;
390
- };
391
- type: Type;
392
- };
393
- referringCustomerReward?: {
394
- couponOptions?: {
395
- fixedAmountOptions?: {
396
- amount: number;
397
- };
398
- percentageOptions?: {
399
- percentage: number;
400
- };
401
- minimumSubtotal: number;
402
- scope?: {
403
- namespace: string;
404
- group?: {
405
- name: string;
406
- };
407
- };
408
- name: string;
409
- discountType: DiscountType$1;
410
- };
411
- loyaltyPointsOptions?: {
412
- amount: number;
413
- };
414
- type: Type;
415
- };
416
- successfulReferralActions: Action[];
417
- isPremium: boolean;
418
- emails?: {
419
- encourageToReferFriends: App[];
420
- notifyCustomersAboutReward: boolean;
421
- };
422
- };
413
+ interface QueryReferringCustomerTotalsResponseNonNullableFields {
414
+ referringCustomerTotals: {
415
+ referringCustomerId: string;
416
+ contactId: string;
417
+ totalSuccessfulReferrals: number;
418
+ totalAmountGenerated: string;
419
+ totalFriendsWithActions: number;
420
+ }[];
423
421
  }
424
- interface PauseReferralProgramResponseNonNullableFields {
425
- referralProgram?: {
426
- status: ProgramStatus;
427
- referredFriendReward?: {
428
- couponOptions?: {
422
+ interface QueryReferredFriendActionsResponseNonNullableFields {
423
+ referredFriendActions: {
424
+ coupon?: {
425
+ _id: string;
426
+ code: string;
427
+ status: Status$2;
428
+ couponSpecification?: {
429
429
  fixedAmountOptions?: {
430
430
  amount: number;
431
431
  };
@@ -442,66 +442,31 @@ interface PauseReferralProgramResponseNonNullableFields {
442
442
  name: string;
443
443
  discountType: DiscountType$1;
444
444
  };
445
- loyaltyPointsOptions?: {
446
- amount: number;
447
- };
448
- type: Type;
449
445
  };
450
- referringCustomerReward?: {
451
- couponOptions?: {
452
- fixedAmountOptions?: {
453
- amount: number;
454
- };
455
- percentageOptions?: {
456
- percentage: number;
457
- };
458
- minimumSubtotal: number;
459
- scope?: {
460
- namespace: string;
461
- group?: {
462
- name: string;
463
- };
464
- };
465
- name: string;
466
- discountType: DiscountType$1;
467
- };
468
- loyaltyPointsOptions?: {
469
- amount: number;
470
- };
471
- type: Type;
446
+ loyaltyPoints?: {
447
+ transactionId: string;
448
+ amount: number;
472
449
  };
473
- successfulReferralActions: Action[];
474
- isPremium: boolean;
475
- emails?: {
476
- encourageToReferFriends: App[];
477
- notifyCustomersAboutReward: boolean;
450
+ referredFriendId: string;
451
+ contactId: string;
452
+ trigger?: {
453
+ appId: string;
454
+ activityType: string;
478
455
  };
479
- };
480
- }
481
- interface GetAISocialMediaPostsSuggestionsResponseNonNullableFields {
482
- suggestions: {
483
- postContent: string;
484
- hashtags: string[];
485
- }[];
486
- }
487
- interface GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields {
488
- suggestions: {
489
- postContent: string;
490
- hashtags: string[];
456
+ rewardType: Reward;
457
+ totalActions: number;
458
+ totalAmountSpent: string;
491
459
  }[];
492
460
  }
493
- interface GetReferralProgramPremiumFeaturesResponseNonNullableFields {
494
- referralProgram: boolean;
495
- }
496
- interface BaseEventMetadata$3 {
461
+ interface BaseEventMetadata$2 {
497
462
  /** App instance ID. */
498
463
  instanceId?: string | null;
499
464
  /** Event type. */
500
465
  eventType?: string;
501
466
  /** The identification type and identity data. */
502
- identity?: IdentificationData$3;
467
+ identity?: IdentificationData$2;
503
468
  }
504
- interface EventMetadata$3 extends BaseEventMetadata$3 {
469
+ interface EventMetadata$2 extends BaseEventMetadata$2 {
505
470
  /**
506
471
  * Unique event ID.
507
472
  * Allows clients to ignore duplicate webhooks.
@@ -539,394 +504,249 @@ interface EventMetadata$3 extends BaseEventMetadata$3 {
539
504
  */
540
505
  entityEventSequence?: string | null;
541
506
  }
542
- interface ProgramUpdatedEnvelope {
543
- entity: ReferralProgram;
544
- metadata: EventMetadata$3;
507
+ interface ReferralEventCreatedEnvelope {
508
+ entity: ReferralEvent;
509
+ metadata: EventMetadata$2;
545
510
  }
546
- interface QueryCursorResult$3 {
511
+ interface QueryCursorResult$2 {
547
512
  cursors: Cursors$3;
548
513
  hasNext: () => boolean;
549
514
  hasPrev: () => boolean;
550
515
  length: number;
551
516
  pageSize: number;
552
517
  }
553
- interface ReferralProgramsQueryResult extends QueryCursorResult$3 {
554
- items: ReferralProgram[];
555
- query: ReferralProgramsQueryBuilder;
556
- next: () => Promise<ReferralProgramsQueryResult>;
557
- prev: () => Promise<ReferralProgramsQueryResult>;
518
+ interface ReferralEventsQueryResult extends QueryCursorResult$2 {
519
+ items: ReferralEvent[];
520
+ query: ReferralEventsQueryBuilder;
521
+ next: () => Promise<ReferralEventsQueryResult>;
522
+ prev: () => Promise<ReferralEventsQueryResult>;
558
523
  }
559
- interface ReferralProgramsQueryBuilder {
560
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
524
+ interface ReferralEventsQueryBuilder {
525
+ /** @param propertyName - Property whose value is compared with `value`.
526
+ * @param value - Value to compare against.
561
527
  * @documentationMaturity preview
562
528
  */
563
- limit: (limit: number) => ReferralProgramsQueryBuilder;
564
- /** @param cursor - A pointer to specific record
529
+ eq: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
530
+ /** @param propertyName - Property whose value is compared with `value`.
531
+ * @param value - Value to compare against.
565
532
  * @documentationMaturity preview
566
533
  */
567
- skipTo: (cursor: string) => ReferralProgramsQueryBuilder;
568
- /** @documentationMaturity preview */
569
- find: () => Promise<ReferralProgramsQueryResult>;
570
- }
571
- interface GetAiSocialMediaPostsSuggestionsOptions {
572
- /** The topic to generate suggestions for. */
573
- topic?: string;
574
- }
575
- interface GenerateAiSocialMediaPostsSuggestionsOptions {
576
- /** The topic to generate suggestions for. */
577
- topic?: string;
578
- }
579
-
580
- type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
581
- interface HttpClient$3 {
582
- request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
583
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
584
- }
585
- type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
586
- type HttpResponse$3<T = any> = {
587
- data: T;
588
- status: number;
589
- statusText: string;
590
- headers: any;
591
- request?: any;
592
- };
593
- type RequestOptions$3<_TResponse = any, Data = any> = {
594
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
595
- url: string;
596
- data?: Data;
597
- params?: URLSearchParams;
598
- } & APIMetadata$3;
599
- type APIMetadata$3 = {
600
- methodFqn?: string;
601
- entityFqdn?: string;
602
- packageName?: string;
603
- };
604
- type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
605
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
606
- __type: 'event-definition';
607
- type: Type;
608
- isDomainEvent?: boolean;
609
- transformations?: (envelope: unknown) => Payload;
610
- __payload: Payload;
611
- };
612
- declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
613
- type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
614
- type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
615
-
616
- declare global {
617
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
618
- interface SymbolConstructor {
619
- readonly observable: symbol;
620
- }
621
- }
622
-
623
- declare function getReferralProgram$1(httpClient: HttpClient$3): () => Promise<GetReferralProgramResponse & GetReferralProgramResponseNonNullableFields>;
624
- declare function queryReferralPrograms$1(httpClient: HttpClient$3): () => ReferralProgramsQueryBuilder;
625
- declare function updateReferralProgram$1(httpClient: HttpClient$3): (referralProgram: ReferralProgram) => Promise<UpdateReferralProgramResponse & UpdateReferralProgramResponseNonNullableFields>;
626
- declare function activateReferralProgram$1(httpClient: HttpClient$3): () => Promise<ActivateReferralProgramResponse & ActivateReferralProgramResponseNonNullableFields>;
627
- declare function pauseReferralProgram$1(httpClient: HttpClient$3): () => Promise<PauseReferralProgramResponse & PauseReferralProgramResponseNonNullableFields>;
628
- declare function getAiSocialMediaPostsSuggestions$1(httpClient: HttpClient$3): (options?: GetAiSocialMediaPostsSuggestionsOptions) => Promise<GetAISocialMediaPostsSuggestionsResponse & GetAISocialMediaPostsSuggestionsResponseNonNullableFields>;
629
- declare function generateAiSocialMediaPostsSuggestions$1(httpClient: HttpClient$3): (options?: GenerateAiSocialMediaPostsSuggestionsOptions) => Promise<GenerateAISocialMediaPostsSuggestionsResponse & GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields>;
630
- declare function getReferralProgramPremiumFeatures$1(httpClient: HttpClient$3): () => Promise<GetReferralProgramPremiumFeaturesResponse & GetReferralProgramPremiumFeaturesResponseNonNullableFields>;
631
- declare const onProgramUpdated$1: EventDefinition$3<ProgramUpdatedEnvelope, "wix.loyalty.referral.v1.program_updated">;
632
-
633
- declare const getReferralProgram: BuildRESTFunction$3<typeof getReferralProgram$1>;
634
- declare const queryReferralPrograms: BuildRESTFunction$3<typeof queryReferralPrograms$1>;
635
- declare const updateReferralProgram: BuildRESTFunction$3<typeof updateReferralProgram$1>;
636
- declare const activateReferralProgram: BuildRESTFunction$3<typeof activateReferralProgram$1>;
637
- declare const pauseReferralProgram: BuildRESTFunction$3<typeof pauseReferralProgram$1>;
638
- declare const getAiSocialMediaPostsSuggestions: BuildRESTFunction$3<typeof getAiSocialMediaPostsSuggestions$1>;
639
- declare const generateAiSocialMediaPostsSuggestions: BuildRESTFunction$3<typeof generateAiSocialMediaPostsSuggestions$1>;
640
- declare const getReferralProgramPremiumFeatures: BuildRESTFunction$3<typeof getReferralProgramPremiumFeatures$1>;
641
- declare const onProgramUpdated: BuildEventDefinition$3<typeof onProgramUpdated$1>;
642
-
643
- declare const context$3_activateReferralProgram: typeof activateReferralProgram;
644
- declare const context$3_generateAiSocialMediaPostsSuggestions: typeof generateAiSocialMediaPostsSuggestions;
645
- declare const context$3_getAiSocialMediaPostsSuggestions: typeof getAiSocialMediaPostsSuggestions;
646
- declare const context$3_getReferralProgram: typeof getReferralProgram;
647
- declare const context$3_getReferralProgramPremiumFeatures: typeof getReferralProgramPremiumFeatures;
648
- declare const context$3_onProgramUpdated: typeof onProgramUpdated;
649
- declare const context$3_pauseReferralProgram: typeof pauseReferralProgram;
650
- declare const context$3_queryReferralPrograms: typeof queryReferralPrograms;
651
- declare const context$3_updateReferralProgram: typeof updateReferralProgram;
652
- declare namespace context$3 {
653
- export { context$3_activateReferralProgram as activateReferralProgram, context$3_generateAiSocialMediaPostsSuggestions as generateAiSocialMediaPostsSuggestions, context$3_getAiSocialMediaPostsSuggestions as getAiSocialMediaPostsSuggestions, context$3_getReferralProgram as getReferralProgram, context$3_getReferralProgramPremiumFeatures as getReferralProgramPremiumFeatures, context$3_onProgramUpdated as onProgramUpdated, context$3_pauseReferralProgram as pauseReferralProgram, context$3_queryReferralPrograms as queryReferralPrograms, context$3_updateReferralProgram as updateReferralProgram };
654
- }
655
-
656
- /** ReferralEvent. */
657
- interface ReferralEvent extends ReferralEventEventTypeOneOf {
658
- /** ReferredFriendSignupEvent is an event that is triggered when a referred friend signs up. */
659
- referredFriendSignupEvent?: ReferredFriendSignupEvent;
660
- /** SuccessfulReferralEvent is an event that is triggered when a referral is successful. */
661
- successfulReferralEvent?: V1SuccessfulReferralEvent;
662
- /** ActionEvent is an event that is triggered when an action is performed. */
663
- actionEvent?: V1ActionEvent;
664
- /** RewardEvent is an event that is triggered when a reward is given. */
665
- rewardEvent?: RewardEvent;
666
- /**
667
- * ReferralEvent ID.
668
- * @readonly
534
+ ne: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
535
+ /** @param propertyName - Property whose value is compared with `value`.
536
+ * @param value - Value to compare against.
537
+ * @documentationMaturity preview
669
538
  */
670
- _id?: string | null;
671
- /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision. */
672
- revision?: string | null;
673
- /**
674
- * Represents the time this ReferralEvent was created.
675
- * @readonly
539
+ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
540
+ /** @param propertyName - Property whose value is compared with `value`.
541
+ * @param value - Value to compare against.
542
+ * @documentationMaturity preview
676
543
  */
677
- _createdDate?: Date;
678
- /**
679
- * Represents the time this ReferralEvent was last updated.
680
- * @readonly
544
+ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
545
+ /** @param propertyName - Property whose value is compared with `value`.
546
+ * @param value - Value to compare against.
547
+ * @documentationMaturity preview
681
548
  */
682
- _updatedDate?: Date;
683
- }
684
- /** @oneof */
685
- interface ReferralEventEventTypeOneOf {
686
- /** ReferredFriendSignupEvent is an event that is triggered when a referred friend signs up. */
687
- referredFriendSignupEvent?: ReferredFriendSignupEvent;
688
- /** SuccessfulReferralEvent is an event that is triggered when a referral is successful. */
689
- successfulReferralEvent?: V1SuccessfulReferralEvent;
690
- /** ActionEvent is an event that is triggered when an action is performed. */
691
- actionEvent?: V1ActionEvent;
692
- /** RewardEvent is an event that is triggered when a reward is given. */
693
- rewardEvent?: RewardEvent;
694
- }
695
- interface ReferredFriendSignupEvent {
696
- /** The referred friend ID. */
697
- referredFriendId?: string;
698
- }
699
- interface V1SuccessfulReferralEvent {
700
- /** The referred friend ID. */
701
- referredFriendId?: string;
702
- /** The referring customer ID. */
703
- referringCustomerId?: string;
704
- }
705
- interface V1ActionEvent {
706
- /** The referred friend ID. */
707
- referredFriendId?: string;
708
- /** The referring customer ID. */
709
- referringCustomerId?: string;
710
- /** The trigger of the action. */
711
- trigger?: V1Trigger;
712
- /** Amount. */
713
- amount?: string | null;
714
- /** Currency. */
715
- currency?: string | null;
716
- /** Order ID. */
717
- orderId?: string | null;
718
- }
719
- interface V1Trigger {
720
- /** The app id of the app that triggered the event. */
721
- appId?: string;
722
- /** The activity type that triggered the event. */
723
- activityType?: string;
724
- }
725
- interface RewardEvent extends RewardEventReceiverOneOf {
726
- /**
727
- * The referring customer ID.
728
- * @readonly
549
+ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
550
+ /** @param propertyName - Property whose value is compared with `value`.
551
+ * @param value - Value to compare against.
552
+ * @documentationMaturity preview
729
553
  */
730
- rewardedReferringCustomerId?: string;
731
- /**
732
- * The referred friend ID.
733
- * @readonly
554
+ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
555
+ /** @param propertyName - Property whose value is compared with `values`.
556
+ * @param values - List of values to compare against.
557
+ * @documentationMaturity preview
734
558
  */
735
- rewardedReferredFriendId?: string;
736
- /** The referral reward ID. */
737
- referralRewardId?: string;
738
- /** The reward type. */
739
- rewardType?: Reward;
740
- }
741
- /** @oneof */
742
- interface RewardEventReceiverOneOf {
743
- /**
744
- * The referring customer ID.
745
- * @readonly
559
+ hasSome: (propertyName: '_createdDate' | '_updatedDate', value: any[]) => ReferralEventsQueryBuilder;
560
+ /** @documentationMaturity preview */
561
+ in: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
562
+ /** @documentationMaturity preview */
563
+ exists: (propertyName: '_createdDate' | '_updatedDate', value: boolean) => ReferralEventsQueryBuilder;
564
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
565
+ * @documentationMaturity preview
746
566
  */
747
- rewardedReferringCustomerId?: string;
748
- /**
749
- * The referred friend ID.
750
- * @readonly
567
+ ascending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
568
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
569
+ * @documentationMaturity preview
751
570
  */
752
- rewardedReferredFriendId?: string;
753
- }
754
- declare enum Reward {
755
- /** Unknown reward type. */
756
- UNKNOWN = "UNKNOWN",
757
- /** Reward is a coupon. */
758
- COUPON = "COUPON",
759
- /** Reward is loyalty points. */
760
- LOYALTY_POINTS = "LOYALTY_POINTS",
761
- /** No reward. */
762
- NOTHING = "NOTHING"
763
- }
764
- interface CursorQuery extends CursorQueryPagingMethodOneOf {
765
- /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
766
- cursorPaging?: CursorPaging;
767
- /**
768
- * Filter object in the following format:
769
- * `"filter" : {
770
- * "fieldName1": "value1",
771
- * "fieldName2":{"$operator":"value2"}
772
- * }`
773
- * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
571
+ descending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
572
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
573
+ * @documentationMaturity preview
774
574
  */
775
- filter?: Record<string, any> | null;
776
- /**
777
- * Sort object in the following format:
778
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
575
+ limit: (limit: number) => ReferralEventsQueryBuilder;
576
+ /** @param cursor - A pointer to specific record
577
+ * @documentationMaturity preview
779
578
  */
780
- sort?: Sorting[];
781
- }
782
- /** @oneof */
783
- interface CursorQueryPagingMethodOneOf {
784
- /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
785
- cursorPaging?: CursorPaging;
786
- }
787
- interface Sorting {
788
- /** Name of the field to sort by. */
789
- fieldName?: string;
790
- /** Sort order. */
791
- order?: SortOrder;
792
- }
793
- declare enum SortOrder {
794
- ASC = "ASC",
795
- DESC = "DESC"
579
+ skipTo: (cursor: string) => ReferralEventsQueryBuilder;
580
+ /** @documentationMaturity preview */
581
+ find: () => Promise<ReferralEventsQueryResult>;
796
582
  }
797
- interface CursorPaging {
798
- /** Maximum number of items to return in the results. */
799
- limit?: number | null;
800
- /**
801
- * Pointer to the next or previous page in the list of results.
802
- *
803
- * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
804
- * Not relevant for the first request.
805
- */
806
- cursor?: string | null;
583
+ interface QueryReferringCustomerTotalsOptions {
584
+ /** Query to filter ReferringCustomerTotals. */
585
+ query?: CursorQuery$1;
586
+ /** List of contact ids to filter ReferringCustomerTotals. */
587
+ contactIds?: string[];
807
588
  }
808
- interface CursorPagingMetadata {
809
- /** Number of items returned in the response. */
810
- count?: number | null;
811
- /** Cursor strings that point to the next page, previous page, or both. */
812
- cursors?: Cursors$2;
813
- /**
814
- * Whether there are more pages to retrieve following the current page.
815
- *
816
- * + `true`: Another page of results can be retrieved.
817
- * + `false`: This is the last page.
818
- */
819
- hasNext?: boolean | null;
589
+ interface QueryReferredFriendActionsOptions {
590
+ /** Query to filter ReferredFriendActions. */
591
+ query?: CursorQuery$1;
592
+ /** List of contact ids to filter ReferredFriendActions. */
593
+ contactIds?: string[];
820
594
  }
821
- interface Cursors$2 {
822
- /** Cursor string pointing to the next page in the list of results. */
823
- next?: string | null;
824
- /** Cursor pointing to the previous page in the list of results. */
825
- prev?: string | null;
595
+
596
+ type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
597
+ interface HttpClient$3 {
598
+ request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
599
+ fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
826
600
  }
827
- interface GetReferralStatisticsResponse {
828
- /** Total sign ups completed by referred friends */
829
- totalSignUpsCompleted?: number;
830
- /** Total actions completed by referred friends */
831
- totalActionsCompleted?: number;
832
- /** Total amount of purchases made by referred friends */
833
- totalAmountGenerated?: string;
601
+ type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
602
+ type HttpResponse$3<T = any> = {
603
+ data: T;
604
+ status: number;
605
+ statusText: string;
606
+ headers: any;
607
+ request?: any;
608
+ };
609
+ type RequestOptions$3<_TResponse = any, Data = any> = {
610
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
611
+ url: string;
612
+ data?: Data;
613
+ params?: URLSearchParams;
614
+ } & APIMetadata$3;
615
+ type APIMetadata$3 = {
616
+ methodFqn?: string;
617
+ entityFqdn?: string;
618
+ packageName?: string;
619
+ };
620
+ type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
621
+ type EventDefinition$2<Payload = unknown, Type extends string = string> = {
622
+ __type: 'event-definition';
623
+ type: Type;
624
+ isDomainEvent?: boolean;
625
+ transformations?: (envelope: unknown) => Payload;
626
+ __payload: Payload;
627
+ };
628
+ declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
629
+ type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
630
+ type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
631
+
632
+ declare global {
633
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
634
+ interface SymbolConstructor {
635
+ readonly observable: symbol;
636
+ }
834
637
  }
835
- interface QueryReferringCustomerTotalsResponse {
836
- /** List of ReferringCustomerTotals that match the query. */
837
- referringCustomerTotals?: ReferringCustomerTotal[];
838
- /** Paging metadata. */
839
- metadata?: CursorPagingMetadata;
638
+
639
+ declare function getReferralEvent$1(httpClient: HttpClient$3): (referralEventId: string) => Promise<ReferralEvent & {
640
+ referredFriendSignupEvent?: {
641
+ referredFriendId: string;
642
+ } | undefined;
643
+ successfulReferralEvent?: {
644
+ referredFriendId: string;
645
+ referringCustomerId: string;
646
+ } | undefined;
647
+ actionEvent?: {
648
+ referredFriendId: string;
649
+ referringCustomerId: string;
650
+ trigger?: {
651
+ appId: string;
652
+ activityType: string;
653
+ } | undefined;
654
+ } | undefined;
655
+ rewardEvent?: {
656
+ rewardedReferringCustomerId: string;
657
+ rewardedReferredFriendId: string;
658
+ referralRewardId: string;
659
+ rewardType: Reward;
660
+ } | undefined;
661
+ }>;
662
+ declare function queryReferralEvent$1(httpClient: HttpClient$3): () => ReferralEventsQueryBuilder;
663
+ declare function getReferralStatistics$1(httpClient: HttpClient$3): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
664
+ declare function queryReferringCustomerTotals$1(httpClient: HttpClient$3): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
665
+ declare function queryReferredFriendActions$1(httpClient: HttpClient$3): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
666
+ declare const onReferralEventCreated$1: EventDefinition$2<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
667
+
668
+ declare const getReferralEvent: BuildRESTFunction$3<typeof getReferralEvent$1>;
669
+ declare const queryReferralEvent: BuildRESTFunction$3<typeof queryReferralEvent$1>;
670
+ declare const getReferralStatistics: BuildRESTFunction$3<typeof getReferralStatistics$1>;
671
+ declare const queryReferringCustomerTotals: BuildRESTFunction$3<typeof queryReferringCustomerTotals$1>;
672
+ declare const queryReferredFriendActions: BuildRESTFunction$3<typeof queryReferredFriendActions$1>;
673
+ declare const onReferralEventCreated: BuildEventDefinition$2<typeof onReferralEventCreated$1>;
674
+
675
+ declare const context$3_getReferralEvent: typeof getReferralEvent;
676
+ declare const context$3_getReferralStatistics: typeof getReferralStatistics;
677
+ declare const context$3_onReferralEventCreated: typeof onReferralEventCreated;
678
+ declare const context$3_queryReferralEvent: typeof queryReferralEvent;
679
+ declare const context$3_queryReferredFriendActions: typeof queryReferredFriendActions;
680
+ declare const context$3_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
681
+ declare namespace context$3 {
682
+ export { context$3_getReferralEvent as getReferralEvent, context$3_getReferralStatistics as getReferralStatistics, context$3_onReferralEventCreated as onReferralEventCreated, context$3_queryReferralEvent as queryReferralEvent, context$3_queryReferredFriendActions as queryReferredFriendActions, context$3_queryReferringCustomerTotals as queryReferringCustomerTotals };
840
683
  }
841
- interface ReferringCustomerTotal {
842
- /**
843
- * Referring customer id.
844
- * @readonly
845
- */
846
- referringCustomerId?: string;
847
- /**
848
- * Contact id.
849
- * @readonly
850
- */
851
- contactId?: string;
852
- /**
853
- * Last successful referral date.
854
- * @readonly
855
- */
856
- lastSuccessfulReferral?: Date;
857
- /**
858
- * Total successful referrals made by this customer.
859
- * @readonly
860
- */
861
- totalSuccessfulReferrals?: number;
862
- /**
863
- * Total amount generated by friends referred by this customer.
864
- * @readonly
865
- */
866
- totalAmountGenerated?: string;
684
+
685
+ /** ReferralReward is the main entity of ReferralRewards that can be used for lorem ipsum dolor */
686
+ interface ReferralReward extends ReferralRewardReceiverOneOf, ReferralRewardRewardTypeOptionsOneOf {
867
687
  /**
868
- * Last friend action date.
688
+ * Referring customer ID.
869
689
  * @readonly
870
690
  */
871
- lastFriendAction?: Date;
691
+ rewardedReferringCustomerId?: string;
872
692
  /**
873
- * Total friends that have actions done.
693
+ * Referred friend ID.
874
694
  * @readonly
875
695
  */
876
- totalFriendsWithActions?: number;
877
- }
878
- interface QueryReferredFriendActionsResponse {
879
- /** List of ReferredFriendActions that match the query. */
880
- referredFriendActions?: ReferredFriendAction[];
881
- /** Paging metadata. */
882
- metadata?: CursorPagingMetadata;
883
- }
884
- interface ReferredFriendAction extends ReferredFriendActionRewardTypeOptionsOneOf {
696
+ rewardedReferredFriendId?: string;
885
697
  /** Coupon reward type options. */
886
698
  coupon?: V1Coupon;
887
699
  /** Loyalty points reward type options. */
888
- loyaltyPoints?: LoyaltyPoints;
889
- /**
890
- * Referred friend id.
891
- * @readonly
892
- */
893
- referredFriendId?: string;
700
+ loyaltyPoints?: V1LoyaltyPoints;
894
701
  /**
895
- * Contact id.
702
+ * ReferralReward ID.
896
703
  * @readonly
897
704
  */
898
- contactId?: string;
705
+ _id?: string | null;
706
+ /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision. */
707
+ revision?: string | null;
899
708
  /**
900
- * First action trigger.
709
+ * Represents the time this ReferralReward was created.
901
710
  * @readonly
902
711
  */
903
- trigger?: V1Trigger;
712
+ _createdDate?: Date;
904
713
  /**
905
- * First action date.
714
+ * Represents the time this ReferralReward was last updated.
906
715
  * @readonly
907
716
  */
908
- actionDate?: Date;
909
- /** Issued reward type. */
910
- rewardType?: Reward;
911
- /** Total number of actions. */
912
- totalActions?: number;
717
+ _updatedDate?: Date;
718
+ /** Reward type. */
719
+ rewardType?: RewardTypeType;
720
+ }
721
+ /** @oneof */
722
+ interface ReferralRewardReceiverOneOf {
913
723
  /**
914
- * Total amount spent by this referred friend.
724
+ * Referring customer ID.
915
725
  * @readonly
916
726
  */
917
- totalAmountSpent?: string;
727
+ rewardedReferringCustomerId?: string;
918
728
  /**
919
- * friend signup date.
729
+ * Referred friend ID.
920
730
  * @readonly
921
731
  */
922
- signupDate?: Date;
732
+ rewardedReferredFriendId?: string;
923
733
  }
924
734
  /** @oneof */
925
- interface ReferredFriendActionRewardTypeOptionsOneOf {
735
+ interface ReferralRewardRewardTypeOptionsOneOf {
926
736
  /** Coupon reward type options. */
927
737
  coupon?: V1Coupon;
928
738
  /** Loyalty points reward type options. */
929
- loyaltyPoints?: LoyaltyPoints;
739
+ loyaltyPoints?: V1LoyaltyPoints;
740
+ }
741
+ declare enum RewardTypeType {
742
+ /** Unknown reward type. */
743
+ UNKNOWN = "UNKNOWN",
744
+ /** Coupon reward type. */
745
+ COUPON = "COUPON",
746
+ /** Loyalty points reward type. */
747
+ LOYALTY_POINTS = "LOYALTY_POINTS",
748
+ /** No reward. */
749
+ NOTHING = "NOTHING"
930
750
  }
931
751
  interface V1Coupon {
932
752
  /**
@@ -961,17 +781,17 @@ declare enum Status$1 {
961
781
  DELETED = "DELETED"
962
782
  }
963
783
  interface Coupon extends CouponDiscountTypeOptionsOneOf, CouponScopeOrMinSubtotalOneOf {
964
- /** Options for fixed amount discount type. */
784
+ /** Options for fixed amount discount type */
965
785
  fixedAmountOptions?: FixedAmountDiscount;
966
- /** Options for percentage discount type. */
786
+ /** Options for percentage discount type */
967
787
  percentageOptions?: PercentageDiscount;
968
788
  /** Limit the coupon to carts with a subtotal above this number. */
969
789
  minimumSubtotal?: number;
970
790
  /** Specifies the type of line items this coupon will apply to. */
971
791
  scope?: CouponScope;
972
- /** Coupon name. */
792
+ /** Coupon name */
973
793
  name?: string;
974
- /** Coupon discount type. */
794
+ /** Coupon discount type */
975
795
  discountType?: DiscountType;
976
796
  /** Limit the coupon to only apply to one item in cart. */
977
797
  limitedToOneItem?: boolean | null;
@@ -982,9 +802,9 @@ interface Coupon extends CouponDiscountTypeOptionsOneOf, CouponScopeOrMinSubtota
982
802
  }
983
803
  /** @oneof */
984
804
  interface CouponDiscountTypeOptionsOneOf {
985
- /** Options for fixed amount discount type. */
805
+ /** Options for fixed amount discount type */
986
806
  fixedAmountOptions?: FixedAmountDiscount;
987
- /** Options for percentage discount type. */
807
+ /** Options for percentage discount type */
988
808
  percentageOptions?: PercentageDiscount;
989
809
  }
990
810
  /** @oneof */
@@ -995,93 +815,114 @@ interface CouponScopeOrMinSubtotalOneOf {
995
815
  scope?: CouponScope;
996
816
  }
997
817
  declare enum DiscountType {
998
- /** Unknown discount type. */
999
818
  UNKNOWN = "UNKNOWN",
1000
- /** Discount as a fixed amount. */
819
+ /** Discount as a fixed amount */
1001
820
  FIXED_AMOUNT = "FIXED_AMOUNT",
1002
- /** Discount as a percentage. */
821
+ /** Discount as a percentage */
1003
822
  PERCENTAGE = "PERCENTAGE",
1004
- /** Free shipping. */
823
+ /** Free shipping */
1005
824
  FREE_SHIPPING = "FREE_SHIPPING"
1006
825
  }
1007
826
  interface FixedAmountDiscount {
1008
- /** Fixed amount to discount. */
827
+ /** Fixed amount to discount */
1009
828
  amount?: number;
1010
829
  }
1011
830
  interface PercentageDiscount {
1012
- /** Percentage to discount. */
1013
831
  percentage?: number;
1014
832
  }
1015
833
  interface CouponScope {
1016
- /** Namespace of the coupon scope. */
1017
834
  namespace?: string;
1018
- /** Group of the coupon scope. */
1019
835
  group?: Group;
1020
836
  }
1021
837
  interface Group {
1022
- /** Name of the group. */
1023
838
  name?: string;
1024
- /** Entity ID of the group. */
1025
839
  entityId?: string | null;
1026
840
  }
1027
- interface LoyaltyPoints {
1028
- /**
1029
- * Loyalty transaction ID.
1030
- * @readonly
1031
- */
1032
- transactionId?: string;
841
+ interface V1LoyaltyPoints {
842
+ /**
843
+ * Loyalty transaction ID.
844
+ * @readonly
845
+ */
846
+ transactionId?: string;
847
+ /**
848
+ * Loyalty points amount given.
849
+ * @readonly
850
+ */
851
+ amount?: number;
852
+ }
853
+ interface CursorQuery extends CursorQueryPagingMethodOneOf {
854
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
855
+ cursorPaging?: CursorPaging;
856
+ /**
857
+ * Filter object in the following format:
858
+ * `"filter" : {
859
+ * "fieldName1": "value1",
860
+ * "fieldName2":{"$operator":"value2"}
861
+ * }`
862
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
863
+ */
864
+ filter?: Record<string, any> | null;
865
+ /**
866
+ * Sort object in the following format:
867
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
868
+ */
869
+ sort?: Sorting[];
870
+ }
871
+ /** @oneof */
872
+ interface CursorQueryPagingMethodOneOf {
873
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
874
+ cursorPaging?: CursorPaging;
875
+ }
876
+ interface Sorting {
877
+ /** Name of the field to sort by. */
878
+ fieldName?: string;
879
+ /** Sort order. */
880
+ order?: SortOrder;
881
+ }
882
+ declare enum SortOrder {
883
+ ASC = "ASC",
884
+ DESC = "DESC"
885
+ }
886
+ interface CursorPaging {
887
+ /** Maximum number of items to return in the results. */
888
+ limit?: number | null;
1033
889
  /**
1034
- * Loyalty points amount given.
1035
- * @readonly
890
+ * Pointer to the next or previous page in the list of results.
891
+ *
892
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
893
+ * Not relevant for the first request.
1036
894
  */
1037
- amount?: number;
1038
- }
1039
- interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
1040
- /** ID of a site visitor that has not logged in to the site. */
1041
- anonymousVisitorId?: string;
1042
- /** ID of a site visitor that has logged in to the site. */
1043
- memberId?: string;
1044
- /** ID of a Wix user (site owner, contributor, etc.). */
1045
- wixUserId?: string;
1046
- /** ID of an app. */
1047
- appId?: string;
1048
- /** @readonly */
1049
- identityType?: WebhookIdentityType$2;
1050
- }
1051
- /** @oneof */
1052
- interface IdentificationDataIdOneOf$2 {
1053
- /** ID of a site visitor that has not logged in to the site. */
1054
- anonymousVisitorId?: string;
1055
- /** ID of a site visitor that has logged in to the site. */
1056
- memberId?: string;
1057
- /** ID of a Wix user (site owner, contributor, etc.). */
1058
- wixUserId?: string;
1059
- /** ID of an app. */
1060
- appId?: string;
895
+ cursor?: string | null;
1061
896
  }
1062
- declare enum WebhookIdentityType$2 {
1063
- UNKNOWN = "UNKNOWN",
1064
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1065
- MEMBER = "MEMBER",
1066
- WIX_USER = "WIX_USER",
1067
- APP = "APP"
897
+ interface QueryReferralRewardsResponse {
898
+ /** The retrieved ReferralRewards. */
899
+ referralRewards?: ReferralReward[];
900
+ /** Metadata for paging. */
901
+ metadata?: CursorPagingMetadata;
1068
902
  }
1069
- interface GetReferralStatisticsResponseNonNullableFields {
1070
- totalSignUpsCompleted: number;
1071
- totalActionsCompleted: number;
1072
- totalAmountGenerated: string;
903
+ interface CursorPagingMetadata {
904
+ /** Number of items returned in the response. */
905
+ count?: number | null;
906
+ /** Cursor strings that point to the next page, previous page, or both. */
907
+ cursors?: Cursors$2;
908
+ /**
909
+ * Whether there are more pages to retrieve following the current page.
910
+ *
911
+ * + `true`: Another page of results can be retrieved.
912
+ * + `false`: This is the last page.
913
+ */
914
+ hasNext?: boolean | null;
1073
915
  }
1074
- interface QueryReferringCustomerTotalsResponseNonNullableFields {
1075
- referringCustomerTotals: {
1076
- referringCustomerId: string;
1077
- contactId: string;
1078
- totalSuccessfulReferrals: number;
1079
- totalAmountGenerated: string;
1080
- totalFriendsWithActions: number;
1081
- }[];
916
+ interface Cursors$2 {
917
+ /** Cursor string pointing to the next page in the list of results. */
918
+ next?: string | null;
919
+ /** Cursor pointing to the previous page in the list of results. */
920
+ prev?: string | null;
1082
921
  }
1083
- interface QueryReferredFriendActionsResponseNonNullableFields {
1084
- referredFriendActions: {
922
+ interface QueryReferralRewardsResponseNonNullableFields {
923
+ referralRewards: {
924
+ rewardedReferringCustomerId: string;
925
+ rewardedReferredFriendId: string;
1085
926
  coupon?: {
1086
927
  _id: string;
1087
928
  code: string;
@@ -1108,150 +949,12 @@ interface QueryReferredFriendActionsResponseNonNullableFields {
1108
949
  transactionId: string;
1109
950
  amount: number;
1110
951
  };
1111
- referredFriendId: string;
1112
- contactId: string;
1113
- trigger?: {
1114
- appId: string;
1115
- activityType: string;
1116
- };
1117
- rewardType: Reward;
1118
- totalActions: number;
1119
- totalAmountSpent: string;
952
+ rewardType: RewardTypeType;
1120
953
  }[];
1121
954
  }
1122
- interface BaseEventMetadata$2 {
1123
- /** App instance ID. */
1124
- instanceId?: string | null;
1125
- /** Event type. */
1126
- eventType?: string;
1127
- /** The identification type and identity data. */
1128
- identity?: IdentificationData$2;
1129
- }
1130
- interface EventMetadata$2 extends BaseEventMetadata$2 {
1131
- /**
1132
- * Unique event ID.
1133
- * Allows clients to ignore duplicate webhooks.
1134
- */
1135
- _id?: string;
1136
- /**
1137
- * Assumes actions are also always typed to an entity_type
1138
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
1139
- */
1140
- entityFqdn?: string;
1141
- /**
1142
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1143
- * This is although the created/updated/deleted notion is duplication of the oneof types
1144
- * Example: created/updated/deleted/started/completed/email_opened
1145
- */
1146
- slug?: string;
1147
- /** ID of the entity associated with the event. */
1148
- entityId?: string;
1149
- /** Event timestamp. */
1150
- eventTime?: Date;
1151
- /**
1152
- * Whether the event was triggered as a result of a privacy regulation application
1153
- * (for example, GDPR).
1154
- */
1155
- triggeredByAnonymizeRequest?: boolean | null;
1156
- /** If present, indicates the action that triggered the event. */
1157
- originatedFrom?: string | null;
1158
- /**
1159
- * A sequence number defining the order of updates to the underlying entity.
1160
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
1161
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1162
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1163
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1164
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1165
- */
1166
- entityEventSequence?: string | null;
1167
- }
1168
- interface ReferralEventCreatedEnvelope {
1169
- entity: ReferralEvent;
1170
- metadata: EventMetadata$2;
1171
- }
1172
- interface QueryCursorResult$2 {
1173
- cursors: Cursors$2;
1174
- hasNext: () => boolean;
1175
- hasPrev: () => boolean;
1176
- length: number;
1177
- pageSize: number;
1178
- }
1179
- interface ReferralEventsQueryResult extends QueryCursorResult$2 {
1180
- items: ReferralEvent[];
1181
- query: ReferralEventsQueryBuilder;
1182
- next: () => Promise<ReferralEventsQueryResult>;
1183
- prev: () => Promise<ReferralEventsQueryResult>;
1184
- }
1185
- interface ReferralEventsQueryBuilder {
1186
- /** @param propertyName - Property whose value is compared with `value`.
1187
- * @param value - Value to compare against.
1188
- * @documentationMaturity preview
1189
- */
1190
- eq: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1191
- /** @param propertyName - Property whose value is compared with `value`.
1192
- * @param value - Value to compare against.
1193
- * @documentationMaturity preview
1194
- */
1195
- ne: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1196
- /** @param propertyName - Property whose value is compared with `value`.
1197
- * @param value - Value to compare against.
1198
- * @documentationMaturity preview
1199
- */
1200
- ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1201
- /** @param propertyName - Property whose value is compared with `value`.
1202
- * @param value - Value to compare against.
1203
- * @documentationMaturity preview
1204
- */
1205
- gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1206
- /** @param propertyName - Property whose value is compared with `value`.
1207
- * @param value - Value to compare against.
1208
- * @documentationMaturity preview
1209
- */
1210
- le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1211
- /** @param propertyName - Property whose value is compared with `value`.
1212
- * @param value - Value to compare against.
1213
- * @documentationMaturity preview
1214
- */
1215
- lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1216
- /** @param propertyName - Property whose value is compared with `values`.
1217
- * @param values - List of values to compare against.
1218
- * @documentationMaturity preview
1219
- */
1220
- hasSome: (propertyName: '_createdDate' | '_updatedDate', value: any[]) => ReferralEventsQueryBuilder;
1221
- /** @documentationMaturity preview */
1222
- in: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1223
- /** @documentationMaturity preview */
1224
- exists: (propertyName: '_createdDate' | '_updatedDate', value: boolean) => ReferralEventsQueryBuilder;
1225
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1226
- * @documentationMaturity preview
1227
- */
1228
- ascending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
1229
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1230
- * @documentationMaturity preview
1231
- */
1232
- descending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
1233
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1234
- * @documentationMaturity preview
1235
- */
1236
- limit: (limit: number) => ReferralEventsQueryBuilder;
1237
- /** @param cursor - A pointer to specific record
1238
- * @documentationMaturity preview
1239
- */
1240
- skipTo: (cursor: string) => ReferralEventsQueryBuilder;
1241
- /** @documentationMaturity preview */
1242
- find: () => Promise<ReferralEventsQueryResult>;
1243
- }
1244
- interface QueryReferringCustomerTotalsOptions {
1245
- /** Query to filter ReferringCustomerTotals. */
1246
- query?: CursorQuery;
1247
- /** List of contact ids to filter ReferringCustomerTotals. */
1248
- contactIds?: string[];
1249
- }
1250
- interface QueryReferredFriendActionsOptions {
1251
- /** Query to filter ReferredFriendActions. */
1252
- query?: CursorQuery;
1253
- /** List of contact ids to filter ReferredFriendActions. */
1254
- contactIds?: string[];
955
+ interface QueryReferralRewardsOptions {
956
+ /** Filter by contact id or set to "me" for current identity's rewards. */
957
+ contactId?: string | null;
1255
958
  }
1256
959
 
1257
960
  type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
@@ -1279,16 +982,6 @@ type APIMetadata$2 = {
1279
982
  packageName?: string;
1280
983
  };
1281
984
  type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
1282
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
1283
- __type: 'event-definition';
1284
- type: Type;
1285
- isDomainEvent?: boolean;
1286
- transformations?: (envelope: unknown) => Payload;
1287
- __payload: Payload;
1288
- };
1289
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
1290
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
1291
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
1292
985
 
1293
986
  declare global {
1294
987
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -1297,50 +990,46 @@ declare global {
1297
990
  }
1298
991
  }
1299
992
 
1300
- declare function getReferralEvent$1(httpClient: HttpClient$2): (referralEventId: string) => Promise<ReferralEvent & {
1301
- referredFriendSignupEvent?: {
1302
- referredFriendId: string;
1303
- } | undefined;
1304
- successfulReferralEvent?: {
1305
- referredFriendId: string;
1306
- referringCustomerId: string;
1307
- } | undefined;
1308
- actionEvent?: {
1309
- referredFriendId: string;
1310
- referringCustomerId: string;
1311
- trigger?: {
1312
- appId: string;
1313
- activityType: string;
993
+ declare function getReferralReward$1(httpClient: HttpClient$2): (_id: string) => Promise<ReferralReward & {
994
+ rewardedReferringCustomerId: string;
995
+ rewardedReferredFriendId: string;
996
+ coupon?: {
997
+ _id: string;
998
+ code: string;
999
+ status: Status$1;
1000
+ couponSpecification?: {
1001
+ fixedAmountOptions?: {
1002
+ amount: number;
1003
+ } | undefined;
1004
+ percentageOptions?: {
1005
+ percentage: number;
1006
+ } | undefined;
1007
+ minimumSubtotal: number;
1008
+ scope?: {
1009
+ namespace: string;
1010
+ group?: {
1011
+ name: string;
1012
+ } | undefined;
1013
+ } | undefined;
1014
+ name: string;
1015
+ discountType: DiscountType;
1314
1016
  } | undefined;
1315
1017
  } | undefined;
1316
- rewardEvent?: {
1317
- rewardedReferringCustomerId: string;
1318
- rewardedReferredFriendId: string;
1319
- referralRewardId: string;
1320
- rewardType: Reward;
1018
+ loyaltyPoints?: {
1019
+ transactionId: string;
1020
+ amount: number;
1321
1021
  } | undefined;
1022
+ rewardType: RewardTypeType;
1322
1023
  }>;
1323
- declare function queryReferralEvent$1(httpClient: HttpClient$2): () => ReferralEventsQueryBuilder;
1324
- declare function getReferralStatistics$1(httpClient: HttpClient$2): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
1325
- declare function queryReferringCustomerTotals$1(httpClient: HttpClient$2): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
1326
- declare function queryReferredFriendActions$1(httpClient: HttpClient$2): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
1327
- declare const onReferralEventCreated$1: EventDefinition$2<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
1024
+ declare function queryReferralRewards$1(httpClient: HttpClient$2): (query: CursorQuery, options?: QueryReferralRewardsOptions) => Promise<QueryReferralRewardsResponse & QueryReferralRewardsResponseNonNullableFields>;
1328
1025
 
1329
- declare const getReferralEvent: BuildRESTFunction$2<typeof getReferralEvent$1>;
1330
- declare const queryReferralEvent: BuildRESTFunction$2<typeof queryReferralEvent$1>;
1331
- declare const getReferralStatistics: BuildRESTFunction$2<typeof getReferralStatistics$1>;
1332
- declare const queryReferringCustomerTotals: BuildRESTFunction$2<typeof queryReferringCustomerTotals$1>;
1333
- declare const queryReferredFriendActions: BuildRESTFunction$2<typeof queryReferredFriendActions$1>;
1334
- declare const onReferralEventCreated: BuildEventDefinition$2<typeof onReferralEventCreated$1>;
1026
+ declare const getReferralReward: BuildRESTFunction$2<typeof getReferralReward$1>;
1027
+ declare const queryReferralRewards: BuildRESTFunction$2<typeof queryReferralRewards$1>;
1335
1028
 
1336
- declare const context$2_getReferralEvent: typeof getReferralEvent;
1337
- declare const context$2_getReferralStatistics: typeof getReferralStatistics;
1338
- declare const context$2_onReferralEventCreated: typeof onReferralEventCreated;
1339
- declare const context$2_queryReferralEvent: typeof queryReferralEvent;
1340
- declare const context$2_queryReferredFriendActions: typeof queryReferredFriendActions;
1341
- declare const context$2_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
1029
+ declare const context$2_getReferralReward: typeof getReferralReward;
1030
+ declare const context$2_queryReferralRewards: typeof queryReferralRewards;
1342
1031
  declare namespace context$2 {
1343
- export { context$2_getReferralEvent as getReferralEvent, context$2_getReferralStatistics as getReferralStatistics, context$2_onReferralEventCreated as onReferralEventCreated, context$2_queryReferralEvent as queryReferralEvent, context$2_queryReferredFriendActions as queryReferredFriendActions, context$2_queryReferringCustomerTotals as queryReferringCustomerTotals };
1032
+ export { context$2_getReferralReward as getReferralReward, context$2_queryReferralRewards as queryReferralRewards };
1344
1033
  }
1345
1034
 
1346
1035
  /** ReferredFriend is the main entity of ReferredFriends that can be used for lorem ipsum dolor */
@@ -2002,4 +1691,4 @@ declare namespace context {
2002
1691
  export { context_deleteReferringCustomer as deleteReferringCustomer, context_generateReferringCustomerForContact as generateReferringCustomerForContact, context_getReferringCustomer as getReferringCustomer, context_getReferringCustomerByReferralCode as getReferringCustomerByReferralCode, context_onReferringCustomerCreated as onReferringCustomerCreated, context_onReferringCustomerDeleted as onReferringCustomerDeleted, context_queryReferringCustomers as queryReferringCustomers };
2003
1692
  }
2004
1693
 
2005
- export { context as customers, context$1 as friends, context$3 as programs, context$2 as tracker };
1694
+ export { context as customers, context$1 as friends, context$2 as rewards, context$3 as tracker };