@wix/referral 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.
@@ -1,277 +1,1413 @@
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;
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;
11
5
  /**
12
- * ReferralEvent ID.
6
+ * Referral program status.
13
7
  * @readonly
14
8
  */
15
- _id?: string | null;
9
+ status?: ProgramStatus;
16
10
  /** 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. */
17
11
  revision?: string | null;
18
12
  /**
19
- * Represents the time this ReferralEvent was created.
13
+ * Program's creation date and time.
20
14
  * @readonly
21
15
  */
22
16
  _createdDate?: Date;
23
17
  /**
24
- * Represents the time this ReferralEvent was last updated.
18
+ * Program's last update date and time
25
19
  * @readonly
26
20
  */
27
21
  _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
+ }
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"
48
+ }
49
+ interface Reward$1 extends RewardOptionsOneOf {
50
+ /** Options for coupon reward type. */
51
+ couponOptions?: Coupon$2;
52
+ /** Options for Loyalty points reward type. */
53
+ loyaltyPointsOptions?: LoyaltyPoints$1;
54
+ /** Type of the reward. */
55
+ type?: Type;
28
56
  }
29
57
  /** @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;
58
+ interface RewardOptionsOneOf {
59
+ /** Options for coupon reward type. */
60
+ couponOptions?: Coupon$2;
61
+ /** Options for Loyalty points reward type. */
62
+ loyaltyPointsOptions?: LoyaltyPoints$1;
39
63
  }
40
- interface ReferredFriendSignupEvent {
41
- /** The referred friend ID. */
42
- referredFriendId?: string;
64
+ declare enum Type {
65
+ /** Unknown reward type. */
66
+ UNKNOWN = "UNKNOWN",
67
+ /** Coupon reward type. */
68
+ COUPON = "COUPON",
69
+ /** Loyalty points reward type. */
70
+ LOYALTY_POINTS = "LOYALTY_POINTS",
71
+ /** No reward type. */
72
+ NOTHING = "NOTHING"
43
73
  }
44
- interface V1SuccessfulReferralEvent {
45
- /** The referred friend ID. */
46
- referredFriendId?: string;
47
- /** The referring customer ID. */
48
- referringCustomerId?: string;
74
+ interface Coupon$2 extends CouponDiscountTypeOptionsOneOf$2, CouponScopeOrMinSubtotalOneOf$2 {
75
+ /** Options for fixed amount discount type. */
76
+ fixedAmountOptions?: FixedAmountDiscount$2;
77
+ /** Options for percentage discount type. */
78
+ percentageOptions?: PercentageDiscount$2;
79
+ /** Limit the coupon to carts with a subtotal above this number. */
80
+ minimumSubtotal?: number;
81
+ /** Specifies the type of line items this coupon will apply to. */
82
+ scope?: CouponScope$2;
83
+ /** Coupon name. */
84
+ name?: string;
85
+ /** Coupon discount type. */
86
+ discountType?: DiscountType$2;
87
+ /** Limit the coupon to only apply to one item in cart. */
88
+ limitedToOneItem?: boolean | null;
89
+ /** If true, coupon also applies to subscriptions. */
90
+ appliesToSubscriptions?: boolean | null;
91
+ /** Specifies the amount of discounted cycles for subscription item. See Stores Coupons documentation for more info. */
92
+ discountedCycleCount?: number | null;
49
93
  }
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;
94
+ /** @oneof */
95
+ interface CouponDiscountTypeOptionsOneOf$2 {
96
+ /** Options for fixed amount discount type. */
97
+ fixedAmountOptions?: FixedAmountDiscount$2;
98
+ /** Options for percentage discount type. */
99
+ percentageOptions?: PercentageDiscount$2;
63
100
  }
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;
101
+ /** @oneof */
102
+ interface CouponScopeOrMinSubtotalOneOf$2 {
103
+ /** Limit the coupon to carts with a subtotal above this number. */
104
+ minimumSubtotal?: number;
105
+ /** Specifies the type of line items this coupon will apply to. */
106
+ scope?: CouponScope$2;
69
107
  }
70
- interface RewardEvent extends RewardEventReceiverOneOf {
71
- /**
72
- * The referring customer ID.
73
- * @readonly
74
- */
75
- rewardedReferringCustomerId?: string;
108
+ declare enum DiscountType$2 {
109
+ /** Unknown discount type. */
110
+ UNKNOWN = "UNKNOWN",
111
+ /** Discount as a fixed amount. */
112
+ FIXED_AMOUNT = "FIXED_AMOUNT",
113
+ /** Discount as a percentage. */
114
+ PERCENTAGE = "PERCENTAGE",
115
+ /** Free shipping. */
116
+ FREE_SHIPPING = "FREE_SHIPPING"
117
+ }
118
+ interface FixedAmountDiscount$2 {
119
+ /** Fixed amount to discount. */
120
+ amount?: number;
121
+ }
122
+ interface PercentageDiscount$2 {
123
+ /** Percentage to discount. */
124
+ percentage?: number;
125
+ }
126
+ interface CouponScope$2 {
127
+ /** Namespace of the coupon scope. */
128
+ namespace?: string;
129
+ /** Group of the coupon scope. */
130
+ group?: Group$2;
131
+ }
132
+ interface Group$2 {
133
+ /** Name of the group. */
134
+ name?: string;
135
+ /** Entity ID of the group. */
136
+ entityId?: string | null;
137
+ }
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$4 {
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 {
76
217
  /**
77
- * The referred friend ID.
218
+ * Set to true if user has referral program feature.
78
219
  * @readonly
79
220
  */
80
- rewardedReferredFriendId?: string;
81
- /** The referral reward ID. */
82
- referralRewardId?: string;
83
- /** The reward type. */
84
- rewardType?: Reward;
221
+ referralProgram?: boolean;
222
+ }
223
+ interface IdentificationData$3 extends IdentificationDataIdOneOf$3 {
224
+ /** ID of a site visitor that has not logged in to the site. */
225
+ anonymousVisitorId?: string;
226
+ /** ID of a site visitor that has logged in to the site. */
227
+ memberId?: string;
228
+ /** ID of a Wix user (site owner, contributor, etc.). */
229
+ wixUserId?: string;
230
+ /** ID of an app. */
231
+ appId?: string;
232
+ /** @readonly */
233
+ identityType?: WebhookIdentityType$3;
85
234
  }
86
235
  /** @oneof */
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;
236
+ interface IdentificationDataIdOneOf$3 {
237
+ /** ID of a site visitor that has not logged in to the site. */
238
+ anonymousVisitorId?: string;
239
+ /** ID of a site visitor that has logged in to the site. */
240
+ memberId?: string;
241
+ /** ID of a Wix user (site owner, contributor, etc.). */
242
+ wixUserId?: string;
243
+ /** ID of an app. */
244
+ appId?: string;
98
245
  }
99
- declare enum Reward {
100
- /** Unknown reward type. */
246
+ declare enum WebhookIdentityType$3 {
101
247
  UNKNOWN = "UNKNOWN",
102
- /** Reward is a coupon. */
103
- COUPON = "COUPON",
104
- /** Reward is loyalty points. */
105
- LOYALTY_POINTS = "LOYALTY_POINTS",
106
- /** No reward. */
107
- NOTHING = "NOTHING"
248
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
249
+ MEMBER = "MEMBER",
250
+ WIX_USER = "WIX_USER",
251
+ APP = "APP"
108
252
  }
109
- interface CursorQuery extends CursorQueryPagingMethodOneOf {
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;
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`
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$2;
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$2;
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$2;
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$2;
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
+ };
366
+ }
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$2;
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$2;
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
+ };
423
+ }
424
+ interface PauseReferralProgramResponseNonNullableFields {
425
+ referralProgram?: {
426
+ status: ProgramStatus;
427
+ referredFriendReward?: {
428
+ couponOptions?: {
429
+ fixedAmountOptions?: {
430
+ amount: number;
431
+ };
432
+ percentageOptions?: {
433
+ percentage: number;
434
+ };
435
+ minimumSubtotal: number;
436
+ scope?: {
437
+ namespace: string;
438
+ group?: {
439
+ name: string;
440
+ };
441
+ };
442
+ name: string;
443
+ discountType: DiscountType$2;
444
+ };
445
+ loyaltyPointsOptions?: {
446
+ amount: number;
447
+ };
448
+ type: Type;
449
+ };
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$2;
467
+ };
468
+ loyaltyPointsOptions?: {
469
+ amount: number;
470
+ };
471
+ type: Type;
472
+ };
473
+ successfulReferralActions: Action[];
474
+ isPremium: boolean;
475
+ emails?: {
476
+ encourageToReferFriends: App[];
477
+ notifyCustomersAboutReward: boolean;
478
+ };
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[];
491
+ }[];
492
+ }
493
+ interface GetReferralProgramPremiumFeaturesResponseNonNullableFields {
494
+ referralProgram: boolean;
495
+ }
496
+ interface BaseEventMetadata$3 {
497
+ /** App instance ID. */
498
+ instanceId?: string | null;
499
+ /** Event type. */
500
+ eventType?: string;
501
+ /** The identification type and identity data. */
502
+ identity?: IdentificationData$3;
503
+ }
504
+ interface EventMetadata$3 extends BaseEventMetadata$3 {
505
+ /**
506
+ * Unique event ID.
507
+ * Allows clients to ignore duplicate webhooks.
508
+ */
509
+ _id?: string;
510
+ /**
511
+ * Assumes actions are also always typed to an entity_type
512
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
513
+ */
514
+ entityFqdn?: string;
515
+ /**
516
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
517
+ * This is although the created/updated/deleted notion is duplication of the oneof types
518
+ * Example: created/updated/deleted/started/completed/email_opened
519
+ */
520
+ slug?: string;
521
+ /** ID of the entity associated with the event. */
522
+ entityId?: string;
523
+ /** Event timestamp. */
524
+ eventTime?: Date;
525
+ /**
526
+ * Whether the event was triggered as a result of a privacy regulation application
527
+ * (for example, GDPR).
528
+ */
529
+ triggeredByAnonymizeRequest?: boolean | null;
530
+ /** If present, indicates the action that triggered the event. */
531
+ originatedFrom?: string | null;
532
+ /**
533
+ * A sequence number defining the order of updates to the underlying entity.
534
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
535
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
536
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
537
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
538
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
539
+ */
540
+ entityEventSequence?: string | null;
541
+ }
542
+ interface ProgramUpdatedEnvelope {
543
+ entity: ReferralProgram;
544
+ metadata: EventMetadata$3;
545
+ }
546
+ interface QueryCursorResult$3 {
547
+ cursors: Cursors$4;
548
+ hasNext: () => boolean;
549
+ hasPrev: () => boolean;
550
+ length: number;
551
+ pageSize: number;
552
+ }
553
+ interface ReferralProgramsQueryResult extends QueryCursorResult$3 {
554
+ items: ReferralProgram[];
555
+ query: ReferralProgramsQueryBuilder;
556
+ next: () => Promise<ReferralProgramsQueryResult>;
557
+ prev: () => Promise<ReferralProgramsQueryResult>;
558
+ }
559
+ interface ReferralProgramsQueryBuilder {
560
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
561
+ * @documentationMaturity preview
562
+ */
563
+ limit: (limit: number) => ReferralProgramsQueryBuilder;
564
+ /** @param cursor - A pointer to specific record
565
+ * @documentationMaturity preview
566
+ */
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$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
581
+ interface HttpClient$4 {
582
+ request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
583
+ fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
584
+ }
585
+ type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
586
+ type HttpResponse$4<T = any> = {
587
+ data: T;
588
+ status: number;
589
+ statusText: string;
590
+ headers: any;
591
+ request?: any;
592
+ };
593
+ type RequestOptions$4<_TResponse = any, Data = any> = {
594
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
595
+ url: string;
596
+ data?: Data;
597
+ params?: URLSearchParams;
598
+ } & APIMetadata$4;
599
+ type APIMetadata$4 = {
600
+ methodFqn?: string;
601
+ entityFqdn?: string;
602
+ packageName?: string;
603
+ };
604
+ type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<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$4): () => Promise<GetReferralProgramResponse & GetReferralProgramResponseNonNullableFields>;
624
+ declare function queryReferralPrograms$1(httpClient: HttpClient$4): () => ReferralProgramsQueryBuilder;
625
+ declare function updateReferralProgram$1(httpClient: HttpClient$4): (referralProgram: ReferralProgram) => Promise<UpdateReferralProgramResponse & UpdateReferralProgramResponseNonNullableFields>;
626
+ declare function activateReferralProgram$1(httpClient: HttpClient$4): () => Promise<ActivateReferralProgramResponse & ActivateReferralProgramResponseNonNullableFields>;
627
+ declare function pauseReferralProgram$1(httpClient: HttpClient$4): () => Promise<PauseReferralProgramResponse & PauseReferralProgramResponseNonNullableFields>;
628
+ declare function getAiSocialMediaPostsSuggestions$1(httpClient: HttpClient$4): (options?: GetAiSocialMediaPostsSuggestionsOptions) => Promise<GetAISocialMediaPostsSuggestionsResponse & GetAISocialMediaPostsSuggestionsResponseNonNullableFields>;
629
+ declare function generateAiSocialMediaPostsSuggestions$1(httpClient: HttpClient$4): (options?: GenerateAiSocialMediaPostsSuggestionsOptions) => Promise<GenerateAISocialMediaPostsSuggestionsResponse & GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields>;
630
+ declare function getReferralProgramPremiumFeatures$1(httpClient: HttpClient$4): () => Promise<GetReferralProgramPremiumFeaturesResponse & GetReferralProgramPremiumFeaturesResponseNonNullableFields>;
631
+ declare const onProgramUpdated$1: EventDefinition$3<ProgramUpdatedEnvelope, "wix.loyalty.referral.v1.program_updated">;
632
+
633
+ declare const getReferralProgram: BuildRESTFunction$4<typeof getReferralProgram$1>;
634
+ declare const queryReferralPrograms: BuildRESTFunction$4<typeof queryReferralPrograms$1>;
635
+ declare const updateReferralProgram: BuildRESTFunction$4<typeof updateReferralProgram$1>;
636
+ declare const activateReferralProgram: BuildRESTFunction$4<typeof activateReferralProgram$1>;
637
+ declare const pauseReferralProgram: BuildRESTFunction$4<typeof pauseReferralProgram$1>;
638
+ declare const getAiSocialMediaPostsSuggestions: BuildRESTFunction$4<typeof getAiSocialMediaPostsSuggestions$1>;
639
+ declare const generateAiSocialMediaPostsSuggestions: BuildRESTFunction$4<typeof generateAiSocialMediaPostsSuggestions$1>;
640
+ declare const getReferralProgramPremiumFeatures: BuildRESTFunction$4<typeof getReferralProgramPremiumFeatures$1>;
641
+ declare const onProgramUpdated: BuildEventDefinition$3<typeof onProgramUpdated$1>;
642
+
643
+ declare const context$4_activateReferralProgram: typeof activateReferralProgram;
644
+ declare const context$4_generateAiSocialMediaPostsSuggestions: typeof generateAiSocialMediaPostsSuggestions;
645
+ declare const context$4_getAiSocialMediaPostsSuggestions: typeof getAiSocialMediaPostsSuggestions;
646
+ declare const context$4_getReferralProgram: typeof getReferralProgram;
647
+ declare const context$4_getReferralProgramPremiumFeatures: typeof getReferralProgramPremiumFeatures;
648
+ declare const context$4_onProgramUpdated: typeof onProgramUpdated;
649
+ declare const context$4_pauseReferralProgram: typeof pauseReferralProgram;
650
+ declare const context$4_queryReferralPrograms: typeof queryReferralPrograms;
651
+ declare const context$4_updateReferralProgram: typeof updateReferralProgram;
652
+ declare namespace context$4 {
653
+ export { context$4_activateReferralProgram as activateReferralProgram, context$4_generateAiSocialMediaPostsSuggestions as generateAiSocialMediaPostsSuggestions, context$4_getAiSocialMediaPostsSuggestions as getAiSocialMediaPostsSuggestions, context$4_getReferralProgram as getReferralProgram, context$4_getReferralProgramPremiumFeatures as getReferralProgramPremiumFeatures, context$4_onProgramUpdated as onProgramUpdated, context$4_pauseReferralProgram as pauseReferralProgram, context$4_queryReferralPrograms as queryReferralPrograms, context$4_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
669
+ */
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
676
+ */
677
+ _createdDate?: Date;
678
+ /**
679
+ * Represents the time this ReferralEvent was last updated.
680
+ * @readonly
681
+ */
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
729
+ */
730
+ rewardedReferringCustomerId?: string;
731
+ /**
732
+ * The referred friend ID.
733
+ * @readonly
734
+ */
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
746
+ */
747
+ rewardedReferringCustomerId?: string;
748
+ /**
749
+ * The referred friend ID.
750
+ * @readonly
751
+ */
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$1 extends CursorQueryPagingMethodOneOf$1 {
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$1;
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`
774
+ */
775
+ filter?: Record<string, any> | null;
776
+ /**
777
+ * Sort object in the following format:
778
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
779
+ */
780
+ sort?: Sorting$1[];
781
+ }
782
+ /** @oneof */
783
+ interface CursorQueryPagingMethodOneOf$1 {
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$1;
786
+ }
787
+ interface Sorting$1 {
788
+ /** Name of the field to sort by. */
789
+ fieldName?: string;
790
+ /** Sort order. */
791
+ order?: SortOrder$1;
792
+ }
793
+ declare enum SortOrder$1 {
794
+ ASC = "ASC",
795
+ DESC = "DESC"
796
+ }
797
+ interface CursorPaging$1 {
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;
807
+ }
808
+ interface CursorPagingMetadata$1 {
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$3;
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;
820
+ }
821
+ interface Cursors$3 {
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;
826
+ }
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;
834
+ }
835
+ interface QueryReferringCustomerTotalsResponse {
836
+ /** List of ReferringCustomerTotals that match the query. */
837
+ referringCustomerTotals?: ReferringCustomerTotal[];
838
+ /** Paging metadata. */
839
+ metadata?: CursorPagingMetadata$1;
840
+ }
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;
867
+ /**
868
+ * Last friend action date.
869
+ * @readonly
870
+ */
871
+ lastFriendAction?: Date;
872
+ /**
873
+ * Total friends that have actions done.
874
+ * @readonly
875
+ */
876
+ totalFriendsWithActions?: number;
877
+ }
878
+ interface QueryReferredFriendActionsResponse {
879
+ /** List of ReferredFriendActions that match the query. */
880
+ referredFriendActions?: ReferredFriendAction[];
881
+ /** Paging metadata. */
882
+ metadata?: CursorPagingMetadata$1;
883
+ }
884
+ interface ReferredFriendAction extends ReferredFriendActionRewardTypeOptionsOneOf {
885
+ /** Coupon reward type options. */
886
+ coupon?: V1Coupon$1;
887
+ /** Loyalty points reward type options. */
888
+ loyaltyPoints?: LoyaltyPoints;
889
+ /**
890
+ * Referred friend id.
891
+ * @readonly
892
+ */
893
+ referredFriendId?: string;
894
+ /**
895
+ * Contact id.
896
+ * @readonly
897
+ */
898
+ contactId?: string;
899
+ /**
900
+ * First action trigger.
901
+ * @readonly
902
+ */
903
+ trigger?: V1Trigger;
904
+ /**
905
+ * First action date.
906
+ * @readonly
907
+ */
908
+ actionDate?: Date;
909
+ /** Issued reward type. */
910
+ rewardType?: Reward;
911
+ /** Total number of actions. */
912
+ totalActions?: number;
913
+ /**
914
+ * Total amount spent by this referred friend.
915
+ * @readonly
916
+ */
917
+ totalAmountSpent?: string;
918
+ /**
919
+ * friend signup date.
920
+ * @readonly
921
+ */
922
+ signupDate?: Date;
923
+ }
924
+ /** @oneof */
925
+ interface ReferredFriendActionRewardTypeOptionsOneOf {
926
+ /** Coupon reward type options. */
927
+ coupon?: V1Coupon$1;
928
+ /** Loyalty points reward type options. */
929
+ loyaltyPoints?: LoyaltyPoints;
930
+ }
931
+ interface V1Coupon$1 {
932
+ /**
933
+ * Coupon ID.
934
+ * @readonly
935
+ */
936
+ _id?: string;
937
+ /**
938
+ * Coupon code.
939
+ * @readonly
940
+ */
941
+ code?: string;
942
+ /**
943
+ * Coupon status.
944
+ * @readonly
945
+ */
946
+ status?: Status$2;
947
+ /**
948
+ * Coupon specification.
949
+ * @readonly
950
+ */
951
+ couponSpecification?: Coupon$1;
952
+ }
953
+ declare enum Status$2 {
954
+ /** Unknown coupon status. */
955
+ UNKNOWN = "UNKNOWN",
956
+ /** Coupon is active and can be applied. */
957
+ ACTIVE = "ACTIVE",
958
+ /** Coupon was already applied and can not be used anymore. */
959
+ APPLIED = "APPLIED",
960
+ /** Coupon was deleted. */
961
+ DELETED = "DELETED"
962
+ }
963
+ interface Coupon$1 extends CouponDiscountTypeOptionsOneOf$1, CouponScopeOrMinSubtotalOneOf$1 {
964
+ /** Options for fixed amount discount type. */
965
+ fixedAmountOptions?: FixedAmountDiscount$1;
966
+ /** Options for percentage discount type. */
967
+ percentageOptions?: PercentageDiscount$1;
968
+ /** Limit the coupon to carts with a subtotal above this number. */
969
+ minimumSubtotal?: number;
970
+ /** Specifies the type of line items this coupon will apply to. */
971
+ scope?: CouponScope$1;
972
+ /** Coupon name. */
973
+ name?: string;
974
+ /** Coupon discount type. */
975
+ discountType?: DiscountType$1;
976
+ /** Limit the coupon to only apply to one item in cart. */
977
+ limitedToOneItem?: boolean | null;
978
+ /** If true, coupon also applies to subscriptions. */
979
+ appliesToSubscriptions?: boolean | null;
980
+ /** Specifies the amount of discounted cycles for subscription item. See Stores Coupons documentation for more info. */
981
+ discountedCycleCount?: number | null;
982
+ }
983
+ /** @oneof */
984
+ interface CouponDiscountTypeOptionsOneOf$1 {
985
+ /** Options for fixed amount discount type. */
986
+ fixedAmountOptions?: FixedAmountDiscount$1;
987
+ /** Options for percentage discount type. */
988
+ percentageOptions?: PercentageDiscount$1;
989
+ }
990
+ /** @oneof */
991
+ interface CouponScopeOrMinSubtotalOneOf$1 {
992
+ /** Limit the coupon to carts with a subtotal above this number. */
993
+ minimumSubtotal?: number;
994
+ /** Specifies the type of line items this coupon will apply to. */
995
+ scope?: CouponScope$1;
996
+ }
997
+ declare enum DiscountType$1 {
998
+ /** Unknown discount type. */
999
+ UNKNOWN = "UNKNOWN",
1000
+ /** Discount as a fixed amount. */
1001
+ FIXED_AMOUNT = "FIXED_AMOUNT",
1002
+ /** Discount as a percentage. */
1003
+ PERCENTAGE = "PERCENTAGE",
1004
+ /** Free shipping. */
1005
+ FREE_SHIPPING = "FREE_SHIPPING"
1006
+ }
1007
+ interface FixedAmountDiscount$1 {
1008
+ /** Fixed amount to discount. */
1009
+ amount?: number;
1010
+ }
1011
+ interface PercentageDiscount$1 {
1012
+ /** Percentage to discount. */
1013
+ percentage?: number;
1014
+ }
1015
+ interface CouponScope$1 {
1016
+ /** Namespace of the coupon scope. */
1017
+ namespace?: string;
1018
+ /** Group of the coupon scope. */
1019
+ group?: Group$1;
1020
+ }
1021
+ interface Group$1 {
1022
+ /** Name of the group. */
1023
+ name?: string;
1024
+ /** Entity ID of the group. */
1025
+ entityId?: string | null;
1026
+ }
1027
+ interface LoyaltyPoints {
1028
+ /**
1029
+ * Loyalty transaction ID.
1030
+ * @readonly
1031
+ */
1032
+ transactionId?: string;
1033
+ /**
1034
+ * Loyalty points amount given.
1035
+ * @readonly
1036
+ */
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;
1061
+ }
1062
+ declare enum WebhookIdentityType$2 {
1063
+ UNKNOWN = "UNKNOWN",
1064
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1065
+ MEMBER = "MEMBER",
1066
+ WIX_USER = "WIX_USER",
1067
+ APP = "APP"
1068
+ }
1069
+ interface GetReferralStatisticsResponseNonNullableFields {
1070
+ totalSignUpsCompleted: number;
1071
+ totalActionsCompleted: number;
1072
+ totalAmountGenerated: string;
1073
+ }
1074
+ interface QueryReferringCustomerTotalsResponseNonNullableFields {
1075
+ referringCustomerTotals: {
1076
+ referringCustomerId: string;
1077
+ contactId: string;
1078
+ totalSuccessfulReferrals: number;
1079
+ totalAmountGenerated: string;
1080
+ totalFriendsWithActions: number;
1081
+ }[];
1082
+ }
1083
+ interface QueryReferredFriendActionsResponseNonNullableFields {
1084
+ referredFriendActions: {
1085
+ coupon?: {
1086
+ _id: string;
1087
+ code: string;
1088
+ status: Status$2;
1089
+ couponSpecification?: {
1090
+ fixedAmountOptions?: {
1091
+ amount: number;
1092
+ };
1093
+ percentageOptions?: {
1094
+ percentage: number;
1095
+ };
1096
+ minimumSubtotal: number;
1097
+ scope?: {
1098
+ namespace: string;
1099
+ group?: {
1100
+ name: string;
1101
+ };
1102
+ };
1103
+ name: string;
1104
+ discountType: DiscountType$1;
1105
+ };
1106
+ };
1107
+ loyaltyPoints?: {
1108
+ transactionId: string;
1109
+ amount: number;
1110
+ };
1111
+ referredFriendId: string;
1112
+ contactId: string;
1113
+ trigger?: {
1114
+ appId: string;
1115
+ activityType: string;
1116
+ };
1117
+ rewardType: Reward;
1118
+ totalActions: number;
1119
+ totalAmountSpent: string;
1120
+ }[];
1121
+ }
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$3;
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
119
1235
  */
120
- filter?: Record<string, any> | null;
121
- /**
122
- * Sort object in the following format:
123
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
1236
+ limit: (limit: number) => ReferralEventsQueryBuilder;
1237
+ /** @param cursor - A pointer to specific record
1238
+ * @documentationMaturity preview
124
1239
  */
125
- sort?: Sorting[];
126
- }
127
- /** @oneof */
128
- interface CursorQueryPagingMethodOneOf {
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;
131
- }
132
- interface Sorting {
133
- /** Name of the field to sort by. */
134
- fieldName?: string;
135
- /** Sort order. */
136
- order?: SortOrder;
137
- }
138
- declare enum SortOrder {
139
- ASC = "ASC",
140
- DESC = "DESC"
1240
+ skipTo: (cursor: string) => ReferralEventsQueryBuilder;
1241
+ /** @documentationMaturity preview */
1242
+ find: () => Promise<ReferralEventsQueryResult>;
141
1243
  }
142
- interface CursorPaging {
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;
1244
+ interface QueryReferringCustomerTotalsOptions {
1245
+ /** Query to filter ReferringCustomerTotals. */
1246
+ query?: CursorQuery$1;
1247
+ /** List of contact ids to filter ReferringCustomerTotals. */
1248
+ contactIds?: string[];
152
1249
  }
153
- interface CursorPagingMetadata {
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$2;
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;
1250
+ interface QueryReferredFriendActionsOptions {
1251
+ /** Query to filter ReferredFriendActions. */
1252
+ query?: CursorQuery$1;
1253
+ /** List of contact ids to filter ReferredFriendActions. */
1254
+ contactIds?: string[];
165
1255
  }
166
- interface Cursors$2 {
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;
1256
+
1257
+ type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
1258
+ interface HttpClient$3 {
1259
+ request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
1260
+ fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
171
1261
  }
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;
1262
+ type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
1263
+ type HttpResponse$3<T = any> = {
1264
+ data: T;
1265
+ status: number;
1266
+ statusText: string;
1267
+ headers: any;
1268
+ request?: any;
1269
+ };
1270
+ type RequestOptions$3<_TResponse = any, Data = any> = {
1271
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1272
+ url: string;
1273
+ data?: Data;
1274
+ params?: URLSearchParams;
1275
+ } & APIMetadata$3;
1276
+ type APIMetadata$3 = {
1277
+ methodFqn?: string;
1278
+ entityFqdn?: string;
1279
+ packageName?: string;
1280
+ };
1281
+ type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<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
+
1293
+ declare global {
1294
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1295
+ interface SymbolConstructor {
1296
+ readonly observable: symbol;
1297
+ }
179
1298
  }
180
- interface QueryReferringCustomerTotalsResponse {
181
- /** List of ReferringCustomerTotals that match the query. */
182
- referringCustomerTotals?: ReferringCustomerTotal[];
183
- /** Paging metadata. */
184
- metadata?: CursorPagingMetadata;
1299
+
1300
+ declare function getReferralEvent$1(httpClient: HttpClient$3): (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;
1314
+ } | undefined;
1315
+ } | undefined;
1316
+ rewardEvent?: {
1317
+ rewardedReferringCustomerId: string;
1318
+ rewardedReferredFriendId: string;
1319
+ referralRewardId: string;
1320
+ rewardType: Reward;
1321
+ } | undefined;
1322
+ }>;
1323
+ declare function queryReferralEvent$1(httpClient: HttpClient$3): () => ReferralEventsQueryBuilder;
1324
+ declare function getReferralStatistics$1(httpClient: HttpClient$3): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
1325
+ declare function queryReferringCustomerTotals$1(httpClient: HttpClient$3): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
1326
+ declare function queryReferredFriendActions$1(httpClient: HttpClient$3): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
1327
+ declare const onReferralEventCreated$1: EventDefinition$2<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
1328
+
1329
+ declare const getReferralEvent: BuildRESTFunction$3<typeof getReferralEvent$1>;
1330
+ declare const queryReferralEvent: BuildRESTFunction$3<typeof queryReferralEvent$1>;
1331
+ declare const getReferralStatistics: BuildRESTFunction$3<typeof getReferralStatistics$1>;
1332
+ declare const queryReferringCustomerTotals: BuildRESTFunction$3<typeof queryReferringCustomerTotals$1>;
1333
+ declare const queryReferredFriendActions: BuildRESTFunction$3<typeof queryReferredFriendActions$1>;
1334
+ declare const onReferralEventCreated: BuildEventDefinition$2<typeof onReferralEventCreated$1>;
1335
+
1336
+ declare const context$3_getReferralEvent: typeof getReferralEvent;
1337
+ declare const context$3_getReferralStatistics: typeof getReferralStatistics;
1338
+ declare const context$3_onReferralEventCreated: typeof onReferralEventCreated;
1339
+ declare const context$3_queryReferralEvent: typeof queryReferralEvent;
1340
+ declare const context$3_queryReferredFriendActions: typeof queryReferredFriendActions;
1341
+ declare const context$3_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
1342
+ declare namespace context$3 {
1343
+ 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 };
185
1344
  }
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;
1345
+
1346
+ /** ReferralReward is the main entity of ReferralRewards that can be used for lorem ipsum dolor */
1347
+ interface ReferralReward extends ReferralRewardReceiverOneOf, ReferralRewardRewardTypeOptionsOneOf {
212
1348
  /**
213
- * Last friend action date.
1349
+ * Referring customer ID.
214
1350
  * @readonly
215
1351
  */
216
- lastFriendAction?: Date;
1352
+ rewardedReferringCustomerId?: string;
217
1353
  /**
218
- * Total friends that have actions done.
1354
+ * Referred friend ID.
219
1355
  * @readonly
220
1356
  */
221
- totalFriendsWithActions?: number;
222
- }
223
- interface QueryReferredFriendActionsResponse {
224
- /** List of ReferredFriendActions that match the query. */
225
- referredFriendActions?: ReferredFriendAction[];
226
- /** Paging metadata. */
227
- metadata?: CursorPagingMetadata;
228
- }
229
- interface ReferredFriendAction extends ReferredFriendActionRewardTypeOptionsOneOf {
1357
+ rewardedReferredFriendId?: string;
230
1358
  /** Coupon reward type options. */
231
1359
  coupon?: V1Coupon;
232
1360
  /** Loyalty points reward type options. */
233
- loyaltyPoints?: LoyaltyPoints;
234
- /**
235
- * Referred friend id.
236
- * @readonly
237
- */
238
- referredFriendId?: string;
1361
+ loyaltyPoints?: V1LoyaltyPoints;
239
1362
  /**
240
- * Contact id.
1363
+ * ReferralReward ID.
241
1364
  * @readonly
242
1365
  */
243
- contactId?: string;
1366
+ _id?: string | null;
1367
+ /** 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. */
1368
+ revision?: string | null;
244
1369
  /**
245
- * First action trigger.
1370
+ * Represents the time this ReferralReward was created.
246
1371
  * @readonly
247
1372
  */
248
- trigger?: V1Trigger;
1373
+ _createdDate?: Date;
249
1374
  /**
250
- * First action date.
1375
+ * Represents the time this ReferralReward was last updated.
251
1376
  * @readonly
252
1377
  */
253
- actionDate?: Date;
254
- /** Issued reward type. */
255
- rewardType?: Reward;
256
- /** Total number of actions. */
257
- totalActions?: number;
1378
+ _updatedDate?: Date;
1379
+ /** Reward type. */
1380
+ rewardType?: RewardTypeType;
1381
+ }
1382
+ /** @oneof */
1383
+ interface ReferralRewardReceiverOneOf {
258
1384
  /**
259
- * Total amount spent by this referred friend.
1385
+ * Referring customer ID.
260
1386
  * @readonly
261
1387
  */
262
- totalAmountSpent?: string;
1388
+ rewardedReferringCustomerId?: string;
263
1389
  /**
264
- * friend signup date.
1390
+ * Referred friend ID.
265
1391
  * @readonly
266
1392
  */
267
- signupDate?: Date;
1393
+ rewardedReferredFriendId?: string;
268
1394
  }
269
1395
  /** @oneof */
270
- interface ReferredFriendActionRewardTypeOptionsOneOf {
1396
+ interface ReferralRewardRewardTypeOptionsOneOf {
271
1397
  /** Coupon reward type options. */
272
1398
  coupon?: V1Coupon;
273
1399
  /** Loyalty points reward type options. */
274
- loyaltyPoints?: LoyaltyPoints;
1400
+ loyaltyPoints?: V1LoyaltyPoints;
1401
+ }
1402
+ declare enum RewardTypeType {
1403
+ /** Unknown reward type. */
1404
+ UNKNOWN = "UNKNOWN",
1405
+ /** Coupon reward type. */
1406
+ COUPON = "COUPON",
1407
+ /** Loyalty points reward type. */
1408
+ LOYALTY_POINTS = "LOYALTY_POINTS",
1409
+ /** No reward. */
1410
+ NOTHING = "NOTHING"
275
1411
  }
276
1412
  interface V1Coupon {
277
1413
  /**
@@ -359,68 +1495,95 @@ interface CouponScope {
359
1495
  namespace?: string;
360
1496
  group?: Group;
361
1497
  }
362
- interface Group {
363
- name?: string;
364
- entityId?: string | null;
1498
+ interface Group {
1499
+ name?: string;
1500
+ entityId?: string | null;
1501
+ }
1502
+ interface V1LoyaltyPoints {
1503
+ /**
1504
+ * Loyalty transaction ID.
1505
+ * @readonly
1506
+ */
1507
+ transactionId?: string;
1508
+ /**
1509
+ * Loyalty points amount given.
1510
+ * @readonly
1511
+ */
1512
+ amount?: number;
1513
+ }
1514
+ interface CursorQuery extends CursorQueryPagingMethodOneOf {
1515
+ /** 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`. */
1516
+ cursorPaging?: CursorPaging;
1517
+ /**
1518
+ * Filter object in the following format:
1519
+ * `"filter" : {
1520
+ * "fieldName1": "value1",
1521
+ * "fieldName2":{"$operator":"value2"}
1522
+ * }`
1523
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
1524
+ */
1525
+ filter?: Record<string, any> | null;
1526
+ /**
1527
+ * Sort object in the following format:
1528
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
1529
+ */
1530
+ sort?: Sorting[];
1531
+ }
1532
+ /** @oneof */
1533
+ interface CursorQueryPagingMethodOneOf {
1534
+ /** 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`. */
1535
+ cursorPaging?: CursorPaging;
1536
+ }
1537
+ interface Sorting {
1538
+ /** Name of the field to sort by. */
1539
+ fieldName?: string;
1540
+ /** Sort order. */
1541
+ order?: SortOrder;
1542
+ }
1543
+ declare enum SortOrder {
1544
+ ASC = "ASC",
1545
+ DESC = "DESC"
365
1546
  }
366
- interface LoyaltyPoints {
367
- /**
368
- * Loyalty transaction ID.
369
- * @readonly
370
- */
371
- transactionId?: string;
1547
+ interface CursorPaging {
1548
+ /** Maximum number of items to return in the results. */
1549
+ limit?: number | null;
372
1550
  /**
373
- * Loyalty points amount given.
374
- * @readonly
1551
+ * Pointer to the next or previous page in the list of results.
1552
+ *
1553
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
1554
+ * Not relevant for the first request.
375
1555
  */
376
- amount?: number;
377
- }
378
- interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
379
- /** ID of a site visitor that has not logged in to the site. */
380
- anonymousVisitorId?: string;
381
- /** ID of a site visitor that has logged in to the site. */
382
- memberId?: string;
383
- /** ID of a Wix user (site owner, contributor, etc.). */
384
- wixUserId?: string;
385
- /** ID of an app. */
386
- appId?: string;
387
- /** @readonly */
388
- identityType?: WebhookIdentityType$2;
389
- }
390
- /** @oneof */
391
- interface IdentificationDataIdOneOf$2 {
392
- /** ID of a site visitor that has not logged in to the site. */
393
- anonymousVisitorId?: string;
394
- /** ID of a site visitor that has logged in to the site. */
395
- memberId?: string;
396
- /** ID of a Wix user (site owner, contributor, etc.). */
397
- wixUserId?: string;
398
- /** ID of an app. */
399
- appId?: string;
1556
+ cursor?: string | null;
400
1557
  }
401
- declare enum WebhookIdentityType$2 {
402
- UNKNOWN = "UNKNOWN",
403
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
404
- MEMBER = "MEMBER",
405
- WIX_USER = "WIX_USER",
406
- APP = "APP"
1558
+ interface QueryReferralRewardsResponse {
1559
+ /** The retrieved ReferralRewards. */
1560
+ referralRewards?: ReferralReward[];
1561
+ /** Metadata for paging. */
1562
+ metadata?: CursorPagingMetadata;
407
1563
  }
408
- interface GetReferralStatisticsResponseNonNullableFields {
409
- totalSignUpsCompleted: number;
410
- totalActionsCompleted: number;
411
- totalAmountGenerated: string;
1564
+ interface CursorPagingMetadata {
1565
+ /** Number of items returned in the response. */
1566
+ count?: number | null;
1567
+ /** Cursor strings that point to the next page, previous page, or both. */
1568
+ cursors?: Cursors$2;
1569
+ /**
1570
+ * Whether there are more pages to retrieve following the current page.
1571
+ *
1572
+ * + `true`: Another page of results can be retrieved.
1573
+ * + `false`: This is the last page.
1574
+ */
1575
+ hasNext?: boolean | null;
412
1576
  }
413
- interface QueryReferringCustomerTotalsResponseNonNullableFields {
414
- referringCustomerTotals: {
415
- referringCustomerId: string;
416
- contactId: string;
417
- totalSuccessfulReferrals: number;
418
- totalAmountGenerated: string;
419
- totalFriendsWithActions: number;
420
- }[];
1577
+ interface Cursors$2 {
1578
+ /** Cursor string pointing to the next page in the list of results. */
1579
+ next?: string | null;
1580
+ /** Cursor pointing to the previous page in the list of results. */
1581
+ prev?: string | null;
421
1582
  }
422
- interface QueryReferredFriendActionsResponseNonNullableFields {
423
- referredFriendActions: {
1583
+ interface QueryReferralRewardsResponseNonNullableFields {
1584
+ referralRewards: {
1585
+ rewardedReferringCustomerId: string;
1586
+ rewardedReferredFriendId: string;
424
1587
  coupon?: {
425
1588
  _id: string;
426
1589
  code: string;
@@ -447,150 +1610,12 @@ interface QueryReferredFriendActionsResponseNonNullableFields {
447
1610
  transactionId: string;
448
1611
  amount: number;
449
1612
  };
450
- referredFriendId: string;
451
- contactId: string;
452
- trigger?: {
453
- appId: string;
454
- activityType: string;
455
- };
456
- rewardType: Reward;
457
- totalActions: number;
458
- totalAmountSpent: string;
1613
+ rewardType: RewardTypeType;
459
1614
  }[];
460
1615
  }
461
- interface BaseEventMetadata$2 {
462
- /** App instance ID. */
463
- instanceId?: string | null;
464
- /** Event type. */
465
- eventType?: string;
466
- /** The identification type and identity data. */
467
- identity?: IdentificationData$2;
468
- }
469
- interface EventMetadata$2 extends BaseEventMetadata$2 {
470
- /**
471
- * Unique event ID.
472
- * Allows clients to ignore duplicate webhooks.
473
- */
474
- _id?: string;
475
- /**
476
- * Assumes actions are also always typed to an entity_type
477
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
478
- */
479
- entityFqdn?: string;
480
- /**
481
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
482
- * This is although the created/updated/deleted notion is duplication of the oneof types
483
- * Example: created/updated/deleted/started/completed/email_opened
484
- */
485
- slug?: string;
486
- /** ID of the entity associated with the event. */
487
- entityId?: string;
488
- /** Event timestamp. */
489
- eventTime?: Date;
490
- /**
491
- * Whether the event was triggered as a result of a privacy regulation application
492
- * (for example, GDPR).
493
- */
494
- triggeredByAnonymizeRequest?: boolean | null;
495
- /** If present, indicates the action that triggered the event. */
496
- originatedFrom?: string | null;
497
- /**
498
- * A sequence number defining the order of updates to the underlying entity.
499
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
500
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
501
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
502
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
503
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
504
- */
505
- entityEventSequence?: string | null;
506
- }
507
- interface ReferralEventCreatedEnvelope {
508
- entity: ReferralEvent;
509
- metadata: EventMetadata$2;
510
- }
511
- interface QueryCursorResult$2 {
512
- cursors: Cursors$2;
513
- hasNext: () => boolean;
514
- hasPrev: () => boolean;
515
- length: number;
516
- pageSize: number;
517
- }
518
- interface ReferralEventsQueryResult extends QueryCursorResult$2 {
519
- items: ReferralEvent[];
520
- query: ReferralEventsQueryBuilder;
521
- next: () => Promise<ReferralEventsQueryResult>;
522
- prev: () => Promise<ReferralEventsQueryResult>;
523
- }
524
- interface ReferralEventsQueryBuilder {
525
- /** @param propertyName - Property whose value is compared with `value`.
526
- * @param value - Value to compare against.
527
- * @documentationMaturity preview
528
- */
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.
532
- * @documentationMaturity preview
533
- */
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
538
- */
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
543
- */
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
548
- */
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
553
- */
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
558
- */
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
566
- */
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
570
- */
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
574
- */
575
- limit: (limit: number) => ReferralEventsQueryBuilder;
576
- /** @param cursor - A pointer to specific record
577
- * @documentationMaturity preview
578
- */
579
- skipTo: (cursor: string) => ReferralEventsQueryBuilder;
580
- /** @documentationMaturity preview */
581
- find: () => Promise<ReferralEventsQueryResult>;
582
- }
583
- interface QueryReferringCustomerTotalsOptions {
584
- /** Query to filter ReferringCustomerTotals. */
585
- query?: CursorQuery;
586
- /** List of contact ids to filter ReferringCustomerTotals. */
587
- contactIds?: string[];
588
- }
589
- interface QueryReferredFriendActionsOptions {
590
- /** Query to filter ReferredFriendActions. */
591
- query?: CursorQuery;
592
- /** List of contact ids to filter ReferredFriendActions. */
593
- contactIds?: string[];
1616
+ interface QueryReferralRewardsOptions {
1617
+ /** Filter by contact id or set to "me" for current identity's rewards. */
1618
+ contactId?: string | null;
594
1619
  }
595
1620
 
596
1621
  type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
@@ -618,16 +1643,6 @@ type APIMetadata$2 = {
618
1643
  packageName?: string;
619
1644
  };
620
1645
  type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<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
1646
 
632
1647
  declare global {
633
1648
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -636,50 +1651,46 @@ declare global {
636
1651
  }
637
1652
  }
638
1653
 
639
- declare function getReferralEvent$1(httpClient: HttpClient$2): (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;
1654
+ declare function getReferralReward$1(httpClient: HttpClient$2): (_id: string) => Promise<ReferralReward & {
1655
+ rewardedReferringCustomerId: string;
1656
+ rewardedReferredFriendId: string;
1657
+ coupon?: {
1658
+ _id: string;
1659
+ code: string;
1660
+ status: Status$1;
1661
+ couponSpecification?: {
1662
+ fixedAmountOptions?: {
1663
+ amount: number;
1664
+ } | undefined;
1665
+ percentageOptions?: {
1666
+ percentage: number;
1667
+ } | undefined;
1668
+ minimumSubtotal: number;
1669
+ scope?: {
1670
+ namespace: string;
1671
+ group?: {
1672
+ name: string;
1673
+ } | undefined;
1674
+ } | undefined;
1675
+ name: string;
1676
+ discountType: DiscountType;
653
1677
  } | undefined;
654
1678
  } | undefined;
655
- rewardEvent?: {
656
- rewardedReferringCustomerId: string;
657
- rewardedReferredFriendId: string;
658
- referralRewardId: string;
659
- rewardType: Reward;
1679
+ loyaltyPoints?: {
1680
+ transactionId: string;
1681
+ amount: number;
660
1682
  } | undefined;
1683
+ rewardType: RewardTypeType;
661
1684
  }>;
662
- declare function queryReferralEvent$1(httpClient: HttpClient$2): () => ReferralEventsQueryBuilder;
663
- declare function getReferralStatistics$1(httpClient: HttpClient$2): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
664
- declare function queryReferringCustomerTotals$1(httpClient: HttpClient$2): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
665
- declare function queryReferredFriendActions$1(httpClient: HttpClient$2): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
666
- declare const onReferralEventCreated$1: EventDefinition$2<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
1685
+ declare function queryReferralRewards$1(httpClient: HttpClient$2): (query: CursorQuery, options?: QueryReferralRewardsOptions) => Promise<QueryReferralRewardsResponse & QueryReferralRewardsResponseNonNullableFields>;
667
1686
 
668
- declare const getReferralEvent: BuildRESTFunction$2<typeof getReferralEvent$1>;
669
- declare const queryReferralEvent: BuildRESTFunction$2<typeof queryReferralEvent$1>;
670
- declare const getReferralStatistics: BuildRESTFunction$2<typeof getReferralStatistics$1>;
671
- declare const queryReferringCustomerTotals: BuildRESTFunction$2<typeof queryReferringCustomerTotals$1>;
672
- declare const queryReferredFriendActions: BuildRESTFunction$2<typeof queryReferredFriendActions$1>;
673
- declare const onReferralEventCreated: BuildEventDefinition$2<typeof onReferralEventCreated$1>;
1687
+ declare const getReferralReward: BuildRESTFunction$2<typeof getReferralReward$1>;
1688
+ declare const queryReferralRewards: BuildRESTFunction$2<typeof queryReferralRewards$1>;
674
1689
 
675
- declare const context$2_getReferralEvent: typeof getReferralEvent;
676
- declare const context$2_getReferralStatistics: typeof getReferralStatistics;
677
- declare const context$2_onReferralEventCreated: typeof onReferralEventCreated;
678
- declare const context$2_queryReferralEvent: typeof queryReferralEvent;
679
- declare const context$2_queryReferredFriendActions: typeof queryReferredFriendActions;
680
- declare const context$2_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
1690
+ declare const context$2_getReferralReward: typeof getReferralReward;
1691
+ declare const context$2_queryReferralRewards: typeof queryReferralRewards;
681
1692
  declare namespace context$2 {
682
- 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 };
1693
+ export { context$2_getReferralReward as getReferralReward, context$2_queryReferralRewards as queryReferralRewards };
683
1694
  }
684
1695
 
685
1696
  /** ReferredFriend is the main entity of ReferredFriends that can be used for lorem ipsum dolor */
@@ -1341,4 +2352,4 @@ declare namespace context {
1341
2352
  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 };
1342
2353
  }
1343
2354
 
1344
- export { context as customers, context$1 as friends, context$2 as tracker };
2355
+ export { context as customers, context$1 as friends, context$4 as programs, context$2 as rewards, context$3 as tracker };