@wix/referral 1.0.0

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.
@@ -0,0 +1,948 @@
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;
11
+ /**
12
+ * ReferralEvent ID.
13
+ * @readonly
14
+ */
15
+ _id?: string | null;
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. */
17
+ revision?: string | null;
18
+ /**
19
+ * Represents the time this ReferralEvent was created.
20
+ * @readonly
21
+ */
22
+ _createdDate?: Date;
23
+ /**
24
+ * Represents the time this ReferralEvent was last updated.
25
+ * @readonly
26
+ */
27
+ _updatedDate?: Date;
28
+ }
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;
69
+ }
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;
85
+ }
86
+ /** @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;
98
+ }
99
+ declare enum Reward {
100
+ /** Unknown reward type. */
101
+ 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"
108
+ }
109
+ interface CreateReferralEventRequest {
110
+ /** ReferralEvent to be created */
111
+ referralEvent?: ReferralEvent;
112
+ }
113
+ interface CreateReferralEventResponse {
114
+ /** The created ReferralEvent */
115
+ referralEvent?: ReferralEvent;
116
+ }
117
+ interface GetReferralEventRequest {
118
+ /** Id of the ReferralEvent to retrieve */
119
+ referralEventId: string;
120
+ }
121
+ interface GetReferralEventResponse {
122
+ /** The retrieved ReferralEvent */
123
+ referralEvent?: ReferralEvent;
124
+ }
125
+ interface QueryReferralEventRequest {
126
+ /** Query to filter ReferralEvents. */
127
+ query: CursorQuery;
128
+ }
129
+ interface CursorQuery extends CursorQueryPagingMethodOneOf {
130
+ /** 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`. */
131
+ cursorPaging?: CursorPaging;
132
+ /**
133
+ * Filter object in the following format:
134
+ * `"filter" : {
135
+ * "fieldName1": "value1",
136
+ * "fieldName2":{"$operator":"value2"}
137
+ * }`
138
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
139
+ */
140
+ filter?: Record<string, any> | null;
141
+ /**
142
+ * Sort object in the following format:
143
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
144
+ */
145
+ sort?: Sorting[];
146
+ }
147
+ /** @oneof */
148
+ interface CursorQueryPagingMethodOneOf {
149
+ /** 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`. */
150
+ cursorPaging?: CursorPaging;
151
+ }
152
+ interface Sorting {
153
+ /** Name of the field to sort by. */
154
+ fieldName?: string;
155
+ /** Sort order. */
156
+ order?: SortOrder;
157
+ }
158
+ declare enum SortOrder {
159
+ ASC = "ASC",
160
+ DESC = "DESC"
161
+ }
162
+ interface CursorPaging {
163
+ /** Maximum number of items to return in the results. */
164
+ limit?: number | null;
165
+ /**
166
+ * Pointer to the next or previous page in the list of results.
167
+ *
168
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
169
+ * Not relevant for the first request.
170
+ */
171
+ cursor?: string | null;
172
+ }
173
+ interface QueryReferralEventResponse {
174
+ /** List of ReferralEvents that match the query. */
175
+ referralEvents?: ReferralEvent[];
176
+ /** Paging metadata. */
177
+ metadata?: CursorPagingMetadata;
178
+ }
179
+ interface CursorPagingMetadata {
180
+ /** Number of items returned in the response. */
181
+ count?: number | null;
182
+ /** Cursor strings that point to the next page, previous page, or both. */
183
+ cursors?: Cursors;
184
+ /**
185
+ * Whether there are more pages to retrieve following the current page.
186
+ *
187
+ * + `true`: Another page of results can be retrieved.
188
+ * + `false`: This is the last page.
189
+ */
190
+ hasNext?: boolean | null;
191
+ }
192
+ interface Cursors {
193
+ /** Cursor string pointing to the next page in the list of results. */
194
+ next?: string | null;
195
+ /** Cursor pointing to the previous page in the list of results. */
196
+ prev?: string | null;
197
+ }
198
+ interface GetReferralStatisticsRequest {
199
+ }
200
+ interface GetReferralStatisticsResponse {
201
+ /** Total sign ups completed by referred friends */
202
+ totalSignUpsCompleted?: number;
203
+ /** Total actions completed by referred friends */
204
+ totalActionsCompleted?: number;
205
+ /** Total amount of purchases made by referred friends */
206
+ totalAmountGenerated?: string;
207
+ }
208
+ interface QueryReferringCustomerTotalsRequest {
209
+ /** Query to filter ReferringCustomerTotals. */
210
+ query?: CursorQuery;
211
+ /** List of contact ids to filter ReferringCustomerTotals. */
212
+ contactIds?: string[];
213
+ }
214
+ interface QueryReferringCustomerTotalsResponse {
215
+ /** List of ReferringCustomerTotals that match the query. */
216
+ referringCustomerTotals?: ReferringCustomerTotal[];
217
+ /** Paging metadata. */
218
+ metadata?: CursorPagingMetadata;
219
+ }
220
+ interface ReferringCustomerTotal {
221
+ /**
222
+ * Referring customer id.
223
+ * @readonly
224
+ */
225
+ referringCustomerId?: string;
226
+ /**
227
+ * Contact id.
228
+ * @readonly
229
+ */
230
+ contactId?: string;
231
+ /**
232
+ * Last successful referral date.
233
+ * @readonly
234
+ */
235
+ lastSuccessfulReferral?: Date;
236
+ /**
237
+ * Total successful referrals made by this customer.
238
+ * @readonly
239
+ */
240
+ totalSuccessfulReferrals?: number;
241
+ /**
242
+ * Total amount generated by friends referred by this customer.
243
+ * @readonly
244
+ */
245
+ totalAmountGenerated?: string;
246
+ /**
247
+ * Last friend action date.
248
+ * @readonly
249
+ */
250
+ lastFriendAction?: Date;
251
+ /**
252
+ * Total friends that have actions done.
253
+ * @readonly
254
+ */
255
+ totalFriendsWithActions?: number;
256
+ }
257
+ interface QueryReferredFriendActionsRequest {
258
+ /** Query to filter ReferredFriendActions. */
259
+ query?: CursorQuery;
260
+ /** List of contact ids to filter ReferredFriendActions. */
261
+ contactIds?: string[];
262
+ }
263
+ interface QueryReferredFriendActionsResponse {
264
+ /** List of ReferredFriendActions that match the query. */
265
+ referredFriendActions?: ReferredFriendAction[];
266
+ /** Paging metadata. */
267
+ metadata?: CursorPagingMetadata;
268
+ }
269
+ interface ReferredFriendAction extends ReferredFriendActionRewardTypeOptionsOneOf {
270
+ /** Coupon reward type options. */
271
+ coupon?: V1Coupon;
272
+ /** Loyalty points reward type options. */
273
+ loyaltyPoints?: LoyaltyPoints;
274
+ /**
275
+ * Referred friend id.
276
+ * @readonly
277
+ */
278
+ referredFriendId?: string;
279
+ /**
280
+ * Contact id.
281
+ * @readonly
282
+ */
283
+ contactId?: string;
284
+ /**
285
+ * First action trigger.
286
+ * @readonly
287
+ */
288
+ trigger?: V1Trigger;
289
+ /**
290
+ * First action date.
291
+ * @readonly
292
+ */
293
+ actionDate?: Date;
294
+ /** Issued reward type. */
295
+ rewardType?: Reward;
296
+ /** Total number of actions. */
297
+ totalActions?: number;
298
+ /**
299
+ * Total amount spent by this referred friend.
300
+ * @readonly
301
+ */
302
+ totalAmountSpent?: string;
303
+ /**
304
+ * friend signup date.
305
+ * @readonly
306
+ */
307
+ signupDate?: Date;
308
+ }
309
+ /** @oneof */
310
+ interface ReferredFriendActionRewardTypeOptionsOneOf {
311
+ /** Coupon reward type options. */
312
+ coupon?: V1Coupon;
313
+ /** Loyalty points reward type options. */
314
+ loyaltyPoints?: LoyaltyPoints;
315
+ }
316
+ interface V1Coupon {
317
+ /**
318
+ * Coupon id
319
+ * @readonly
320
+ */
321
+ _id?: string;
322
+ /**
323
+ * Coupon code
324
+ * @readonly
325
+ */
326
+ code?: string;
327
+ /**
328
+ * Coupon status
329
+ * @readonly
330
+ */
331
+ status?: Status;
332
+ /**
333
+ * Coupon specification
334
+ * @readonly
335
+ */
336
+ couponSpecification?: Coupon;
337
+ }
338
+ declare enum Status {
339
+ UNKNOWN = "UNKNOWN",
340
+ /** Coupon is active and can be applied */
341
+ ACTIVE = "ACTIVE",
342
+ /** Coupon was already applied and can not be used anymore */
343
+ APPLIED = "APPLIED",
344
+ /** Coupon was deleted */
345
+ DELETED = "DELETED"
346
+ }
347
+ interface Coupon extends CouponDiscountTypeOptionsOneOf, CouponScopeOrMinSubtotalOneOf {
348
+ /** Options for fixed amount discount type */
349
+ fixedAmountOptions?: FixedAmountDiscount;
350
+ /** Options for percentage discount type */
351
+ percentageOptions?: PercentageDiscount;
352
+ /** Limit the coupon to carts with a subtotal above this number. */
353
+ minimumSubtotal?: number;
354
+ /** Specifies the type of line items this coupon will apply to. */
355
+ scope?: CouponScope;
356
+ /** Coupon name */
357
+ name?: string;
358
+ /** Coupon discount type */
359
+ discountType?: DiscountType;
360
+ /** Limit the coupon to only apply to one item in cart. */
361
+ limitedToOneItem?: boolean | null;
362
+ /** If true, coupon also applies to subscriptions. */
363
+ appliesToSubscriptions?: boolean | null;
364
+ /** Specifies the amount of discounted cycles for subscription item. See Stores Coupons documentation for more info. */
365
+ discountedCycleCount?: number | null;
366
+ }
367
+ /** @oneof */
368
+ interface CouponDiscountTypeOptionsOneOf {
369
+ /** Options for fixed amount discount type */
370
+ fixedAmountOptions?: FixedAmountDiscount;
371
+ /** Options for percentage discount type */
372
+ percentageOptions?: PercentageDiscount;
373
+ }
374
+ /** @oneof */
375
+ interface CouponScopeOrMinSubtotalOneOf {
376
+ /** Limit the coupon to carts with a subtotal above this number. */
377
+ minimumSubtotal?: number;
378
+ /** Specifies the type of line items this coupon will apply to. */
379
+ scope?: CouponScope;
380
+ }
381
+ declare enum DiscountType {
382
+ UNKNOWN = "UNKNOWN",
383
+ /** Discount as a fixed amount */
384
+ FIXED_AMOUNT = "FIXED_AMOUNT",
385
+ /** Discount as a percentage */
386
+ PERCENTAGE = "PERCENTAGE",
387
+ /** Free shipping */
388
+ FREE_SHIPPING = "FREE_SHIPPING"
389
+ }
390
+ interface FixedAmountDiscount {
391
+ /** Fixed amount to discount */
392
+ amount?: number;
393
+ }
394
+ interface PercentageDiscount {
395
+ percentage?: number;
396
+ }
397
+ interface CouponScope {
398
+ namespace?: string;
399
+ group?: Group;
400
+ }
401
+ interface Group {
402
+ name?: string;
403
+ entityId?: string | null;
404
+ }
405
+ interface LoyaltyPoints {
406
+ /**
407
+ * Loyalty transaction id
408
+ * @readonly
409
+ */
410
+ transactionId?: string;
411
+ /**
412
+ * Loyalty points amount given
413
+ * @readonly
414
+ */
415
+ amount?: number;
416
+ }
417
+ interface DomainEvent extends DomainEventBodyOneOf {
418
+ createdEvent?: EntityCreatedEvent;
419
+ updatedEvent?: EntityUpdatedEvent;
420
+ deletedEvent?: EntityDeletedEvent;
421
+ actionEvent?: ActionEvent;
422
+ /**
423
+ * Unique event ID.
424
+ * Allows clients to ignore duplicate webhooks.
425
+ */
426
+ _id?: string;
427
+ /**
428
+ * Assumes actions are also always typed to an entity_type
429
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
430
+ */
431
+ entityFqdn?: string;
432
+ /**
433
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
434
+ * This is although the created/updated/deleted notion is duplication of the oneof types
435
+ * Example: created/updated/deleted/started/completed/email_opened
436
+ */
437
+ slug?: string;
438
+ /** ID of the entity associated with the event. */
439
+ entityId?: string;
440
+ /** Event timestamp. */
441
+ eventTime?: Date;
442
+ /**
443
+ * Whether the event was triggered as a result of a privacy regulation application
444
+ * (for example, GDPR).
445
+ */
446
+ triggeredByAnonymizeRequest?: boolean | null;
447
+ /** If present, indicates the action that triggered the event. */
448
+ originatedFrom?: string | null;
449
+ /**
450
+ * A sequence number defining the order of updates to the underlying entity.
451
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
452
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
453
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
454
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
455
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
456
+ */
457
+ entityEventSequence?: string | null;
458
+ }
459
+ /** @oneof */
460
+ interface DomainEventBodyOneOf {
461
+ createdEvent?: EntityCreatedEvent;
462
+ updatedEvent?: EntityUpdatedEvent;
463
+ deletedEvent?: EntityDeletedEvent;
464
+ actionEvent?: ActionEvent;
465
+ }
466
+ interface EntityCreatedEvent {
467
+ entity?: string;
468
+ }
469
+ interface UndeleteInfo {
470
+ deletedDate?: Date;
471
+ }
472
+ interface EntityUpdatedEvent {
473
+ /**
474
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
475
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
476
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
477
+ */
478
+ currentEntity?: string;
479
+ }
480
+ interface EntityDeletedEvent {
481
+ /** Entity that was deleted */
482
+ deletedEntity?: string | null;
483
+ }
484
+ interface ActionEvent {
485
+ body?: string;
486
+ }
487
+ interface Empty {
488
+ }
489
+ interface SuccessfulReferralEvent {
490
+ /** ReferredFriend that completed his referral details */
491
+ referredFriendDetails?: ReferredFriendDetails;
492
+ }
493
+ interface ReferredFriendDetails {
494
+ /**
495
+ * ReferredFriend ID
496
+ * @readonly
497
+ */
498
+ referredFriendId?: string;
499
+ /**
500
+ * ReferredFriend Contact ID
501
+ * @readonly
502
+ */
503
+ contactId?: string;
504
+ /**
505
+ * Customer who referred this ReferredFriend
506
+ * @readonly
507
+ */
508
+ referringCustomerId?: string;
509
+ }
510
+ interface ReferredFriendActionEvent {
511
+ referredFriendDetails?: ReferredFriendDetails;
512
+ trigger?: Trigger;
513
+ amount?: string | null;
514
+ currency?: string | null;
515
+ orderId?: string | null;
516
+ }
517
+ interface Trigger {
518
+ appId?: string;
519
+ activityType?: string;
520
+ }
521
+ interface MessageEnvelope {
522
+ /** App instance ID. */
523
+ instanceId?: string | null;
524
+ /** Event type. */
525
+ eventType?: string;
526
+ /** The identification type and identity data. */
527
+ identity?: IdentificationData;
528
+ /** Stringify payload. */
529
+ data?: string;
530
+ }
531
+ interface IdentificationData extends IdentificationDataIdOneOf {
532
+ /** ID of a site visitor that has not logged in to the site. */
533
+ anonymousVisitorId?: string;
534
+ /** ID of a site visitor that has logged in to the site. */
535
+ memberId?: string;
536
+ /** ID of a Wix user (site owner, contributor, etc.). */
537
+ wixUserId?: string;
538
+ /** ID of an app. */
539
+ appId?: string;
540
+ /** @readonly */
541
+ identityType?: WebhookIdentityType;
542
+ }
543
+ /** @oneof */
544
+ interface IdentificationDataIdOneOf {
545
+ /** ID of a site visitor that has not logged in to the site. */
546
+ anonymousVisitorId?: string;
547
+ /** ID of a site visitor that has logged in to the site. */
548
+ memberId?: string;
549
+ /** ID of a Wix user (site owner, contributor, etc.). */
550
+ wixUserId?: string;
551
+ /** ID of an app. */
552
+ appId?: string;
553
+ }
554
+ declare enum WebhookIdentityType {
555
+ UNKNOWN = "UNKNOWN",
556
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
557
+ MEMBER = "MEMBER",
558
+ WIX_USER = "WIX_USER",
559
+ APP = "APP"
560
+ }
561
+ interface GetReferralEventResponseNonNullableFields {
562
+ referralEvent?: {
563
+ referredFriendSignupEvent?: {
564
+ referredFriendId: string;
565
+ };
566
+ successfulReferralEvent?: {
567
+ referredFriendId: string;
568
+ referringCustomerId: string;
569
+ };
570
+ actionEvent?: {
571
+ referredFriendId: string;
572
+ referringCustomerId: string;
573
+ trigger?: {
574
+ appId: string;
575
+ activityType: string;
576
+ };
577
+ };
578
+ rewardEvent?: {
579
+ rewardedReferringCustomerId: string;
580
+ rewardedReferredFriendId: string;
581
+ referralRewardId: string;
582
+ rewardType: Reward;
583
+ };
584
+ };
585
+ }
586
+ interface QueryReferralEventResponseNonNullableFields {
587
+ referralEvents: {
588
+ referredFriendSignupEvent?: {
589
+ referredFriendId: string;
590
+ };
591
+ successfulReferralEvent?: {
592
+ referredFriendId: string;
593
+ referringCustomerId: string;
594
+ };
595
+ actionEvent?: {
596
+ referredFriendId: string;
597
+ referringCustomerId: string;
598
+ trigger?: {
599
+ appId: string;
600
+ activityType: string;
601
+ };
602
+ };
603
+ rewardEvent?: {
604
+ rewardedReferringCustomerId: string;
605
+ rewardedReferredFriendId: string;
606
+ referralRewardId: string;
607
+ rewardType: Reward;
608
+ };
609
+ }[];
610
+ }
611
+ interface GetReferralStatisticsResponseNonNullableFields {
612
+ totalSignUpsCompleted: number;
613
+ totalActionsCompleted: number;
614
+ totalAmountGenerated: string;
615
+ }
616
+ interface QueryReferringCustomerTotalsResponseNonNullableFields {
617
+ referringCustomerTotals: {
618
+ referringCustomerId: string;
619
+ contactId: string;
620
+ totalSuccessfulReferrals: number;
621
+ totalAmountGenerated: string;
622
+ totalFriendsWithActions: number;
623
+ }[];
624
+ }
625
+ interface QueryReferredFriendActionsResponseNonNullableFields {
626
+ referredFriendActions: {
627
+ coupon?: {
628
+ _id: string;
629
+ code: string;
630
+ status: Status;
631
+ couponSpecification?: {
632
+ fixedAmountOptions?: {
633
+ amount: number;
634
+ };
635
+ percentageOptions?: {
636
+ percentage: number;
637
+ };
638
+ minimumSubtotal: number;
639
+ scope?: {
640
+ namespace: string;
641
+ group?: {
642
+ name: string;
643
+ };
644
+ };
645
+ name: string;
646
+ discountType: DiscountType;
647
+ };
648
+ };
649
+ loyaltyPoints?: {
650
+ transactionId: string;
651
+ amount: number;
652
+ };
653
+ referredFriendId: string;
654
+ contactId: string;
655
+ trigger?: {
656
+ appId: string;
657
+ activityType: string;
658
+ };
659
+ rewardType: Reward;
660
+ totalActions: number;
661
+ totalAmountSpent: string;
662
+ }[];
663
+ }
664
+ interface BaseEventMetadata {
665
+ /** App instance ID. */
666
+ instanceId?: string | null;
667
+ /** Event type. */
668
+ eventType?: string;
669
+ /** The identification type and identity data. */
670
+ identity?: IdentificationData;
671
+ }
672
+ interface EventMetadata extends BaseEventMetadata {
673
+ /**
674
+ * Unique event ID.
675
+ * Allows clients to ignore duplicate webhooks.
676
+ */
677
+ _id?: string;
678
+ /**
679
+ * Assumes actions are also always typed to an entity_type
680
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
681
+ */
682
+ entityFqdn?: string;
683
+ /**
684
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
685
+ * This is although the created/updated/deleted notion is duplication of the oneof types
686
+ * Example: created/updated/deleted/started/completed/email_opened
687
+ */
688
+ slug?: string;
689
+ /** ID of the entity associated with the event. */
690
+ entityId?: string;
691
+ /** Event timestamp. */
692
+ eventTime?: Date;
693
+ /**
694
+ * Whether the event was triggered as a result of a privacy regulation application
695
+ * (for example, GDPR).
696
+ */
697
+ triggeredByAnonymizeRequest?: boolean | null;
698
+ /** If present, indicates the action that triggered the event. */
699
+ originatedFrom?: string | null;
700
+ /**
701
+ * A sequence number defining the order of updates to the underlying entity.
702
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
703
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
704
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
705
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
706
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
707
+ */
708
+ entityEventSequence?: string | null;
709
+ }
710
+ interface ReferralEventCreatedEnvelope {
711
+ entity: ReferralEvent;
712
+ metadata: EventMetadata;
713
+ }
714
+ interface QueryCursorResult {
715
+ cursors: Cursors;
716
+ hasNext: () => boolean;
717
+ hasPrev: () => boolean;
718
+ length: number;
719
+ pageSize: number;
720
+ }
721
+ interface ReferralEventsQueryResult extends QueryCursorResult {
722
+ items: ReferralEvent[];
723
+ query: ReferralEventsQueryBuilder;
724
+ next: () => Promise<ReferralEventsQueryResult>;
725
+ prev: () => Promise<ReferralEventsQueryResult>;
726
+ }
727
+ interface ReferralEventsQueryBuilder {
728
+ /** @param propertyName - Property whose value is compared with `value`.
729
+ * @param value - Value to compare against.
730
+ * @documentationMaturity preview
731
+ */
732
+ eq: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
733
+ /** @param propertyName - Property whose value is compared with `value`.
734
+ * @param value - Value to compare against.
735
+ * @documentationMaturity preview
736
+ */
737
+ ne: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
738
+ /** @param propertyName - Property whose value is compared with `value`.
739
+ * @param value - Value to compare against.
740
+ * @documentationMaturity preview
741
+ */
742
+ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
743
+ /** @param propertyName - Property whose value is compared with `value`.
744
+ * @param value - Value to compare against.
745
+ * @documentationMaturity preview
746
+ */
747
+ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
748
+ /** @param propertyName - Property whose value is compared with `value`.
749
+ * @param value - Value to compare against.
750
+ * @documentationMaturity preview
751
+ */
752
+ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
753
+ /** @param propertyName - Property whose value is compared with `value`.
754
+ * @param value - Value to compare against.
755
+ * @documentationMaturity preview
756
+ */
757
+ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
758
+ /** @param propertyName - Property whose value is compared with `values`.
759
+ * @param values - List of values to compare against.
760
+ * @documentationMaturity preview
761
+ */
762
+ hasSome: (propertyName: '_createdDate' | '_updatedDate', value: any[]) => ReferralEventsQueryBuilder;
763
+ /** @documentationMaturity preview */
764
+ in: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
765
+ /** @documentationMaturity preview */
766
+ exists: (propertyName: '_createdDate' | '_updatedDate', value: boolean) => ReferralEventsQueryBuilder;
767
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
768
+ * @documentationMaturity preview
769
+ */
770
+ ascending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
771
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
772
+ * @documentationMaturity preview
773
+ */
774
+ descending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
775
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
776
+ * @documentationMaturity preview
777
+ */
778
+ limit: (limit: number) => ReferralEventsQueryBuilder;
779
+ /** @param cursor - A pointer to specific record
780
+ * @documentationMaturity preview
781
+ */
782
+ skipTo: (cursor: string) => ReferralEventsQueryBuilder;
783
+ /** @documentationMaturity preview */
784
+ find: () => Promise<ReferralEventsQueryResult>;
785
+ }
786
+ interface QueryReferringCustomerTotalsOptions {
787
+ /** Query to filter ReferringCustomerTotals. */
788
+ query?: CursorQuery;
789
+ /** List of contact ids to filter ReferringCustomerTotals. */
790
+ contactIds?: string[];
791
+ }
792
+ interface QueryReferredFriendActionsOptions {
793
+ /** Query to filter ReferredFriendActions. */
794
+ query?: CursorQuery;
795
+ /** List of contact ids to filter ReferredFriendActions. */
796
+ contactIds?: string[];
797
+ }
798
+
799
+ interface HttpClient {
800
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
801
+ }
802
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
803
+ type HttpResponse<T = any> = {
804
+ data: T;
805
+ status: number;
806
+ statusText: string;
807
+ headers: any;
808
+ request?: any;
809
+ };
810
+ type RequestOptions<_TResponse = any, Data = any> = {
811
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
812
+ url: string;
813
+ data?: Data;
814
+ params?: URLSearchParams;
815
+ } & APIMetadata;
816
+ type APIMetadata = {
817
+ methodFqn?: string;
818
+ entityFqdn?: string;
819
+ packageName?: string;
820
+ };
821
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
822
+ __type: 'event-definition';
823
+ type: Type;
824
+ isDomainEvent?: boolean;
825
+ transformations?: unknown;
826
+ __payload: Payload;
827
+ };
828
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
829
+
830
+ declare const __metadata: {
831
+ PACKAGE_NAME: string;
832
+ };
833
+ declare function getReferralEvent(httpClient: HttpClient): (referralEventId: string) => Promise<ReferralEvent & {
834
+ referredFriendSignupEvent?: {
835
+ referredFriendId: string;
836
+ } | undefined;
837
+ successfulReferralEvent?: {
838
+ referredFriendId: string;
839
+ referringCustomerId: string;
840
+ } | undefined;
841
+ actionEvent?: {
842
+ referredFriendId: string;
843
+ referringCustomerId: string;
844
+ trigger?: {
845
+ appId: string;
846
+ activityType: string;
847
+ } | undefined;
848
+ } | undefined;
849
+ rewardEvent?: {
850
+ rewardedReferringCustomerId: string;
851
+ rewardedReferredFriendId: string;
852
+ referralRewardId: string;
853
+ rewardType: Reward;
854
+ } | undefined;
855
+ }>;
856
+ declare function queryReferralEvent(httpClient: HttpClient): () => ReferralEventsQueryBuilder;
857
+ declare function getReferralStatistics(httpClient: HttpClient): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
858
+ declare function queryReferringCustomerTotals(httpClient: HttpClient): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
859
+ declare function queryReferredFriendActions(httpClient: HttpClient): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
860
+ declare const onReferralEventCreated: EventDefinition<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
861
+
862
+ type index_d_ActionEvent = ActionEvent;
863
+ type index_d_BaseEventMetadata = BaseEventMetadata;
864
+ type index_d_Coupon = Coupon;
865
+ type index_d_CouponDiscountTypeOptionsOneOf = CouponDiscountTypeOptionsOneOf;
866
+ type index_d_CouponScope = CouponScope;
867
+ type index_d_CouponScopeOrMinSubtotalOneOf = CouponScopeOrMinSubtotalOneOf;
868
+ type index_d_CreateReferralEventRequest = CreateReferralEventRequest;
869
+ type index_d_CreateReferralEventResponse = CreateReferralEventResponse;
870
+ type index_d_CursorPaging = CursorPaging;
871
+ type index_d_CursorPagingMetadata = CursorPagingMetadata;
872
+ type index_d_CursorQuery = CursorQuery;
873
+ type index_d_CursorQueryPagingMethodOneOf = CursorQueryPagingMethodOneOf;
874
+ type index_d_Cursors = Cursors;
875
+ type index_d_DiscountType = DiscountType;
876
+ declare const index_d_DiscountType: typeof DiscountType;
877
+ type index_d_DomainEvent = DomainEvent;
878
+ type index_d_DomainEventBodyOneOf = DomainEventBodyOneOf;
879
+ type index_d_Empty = Empty;
880
+ type index_d_EntityCreatedEvent = EntityCreatedEvent;
881
+ type index_d_EntityDeletedEvent = EntityDeletedEvent;
882
+ type index_d_EntityUpdatedEvent = EntityUpdatedEvent;
883
+ type index_d_EventMetadata = EventMetadata;
884
+ type index_d_FixedAmountDiscount = FixedAmountDiscount;
885
+ type index_d_GetReferralEventRequest = GetReferralEventRequest;
886
+ type index_d_GetReferralEventResponse = GetReferralEventResponse;
887
+ type index_d_GetReferralEventResponseNonNullableFields = GetReferralEventResponseNonNullableFields;
888
+ type index_d_GetReferralStatisticsRequest = GetReferralStatisticsRequest;
889
+ type index_d_GetReferralStatisticsResponse = GetReferralStatisticsResponse;
890
+ type index_d_GetReferralStatisticsResponseNonNullableFields = GetReferralStatisticsResponseNonNullableFields;
891
+ type index_d_Group = Group;
892
+ type index_d_IdentificationData = IdentificationData;
893
+ type index_d_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
894
+ type index_d_LoyaltyPoints = LoyaltyPoints;
895
+ type index_d_MessageEnvelope = MessageEnvelope;
896
+ type index_d_PercentageDiscount = PercentageDiscount;
897
+ type index_d_QueryReferralEventRequest = QueryReferralEventRequest;
898
+ type index_d_QueryReferralEventResponse = QueryReferralEventResponse;
899
+ type index_d_QueryReferralEventResponseNonNullableFields = QueryReferralEventResponseNonNullableFields;
900
+ type index_d_QueryReferredFriendActionsOptions = QueryReferredFriendActionsOptions;
901
+ type index_d_QueryReferredFriendActionsRequest = QueryReferredFriendActionsRequest;
902
+ type index_d_QueryReferredFriendActionsResponse = QueryReferredFriendActionsResponse;
903
+ type index_d_QueryReferredFriendActionsResponseNonNullableFields = QueryReferredFriendActionsResponseNonNullableFields;
904
+ type index_d_QueryReferringCustomerTotalsOptions = QueryReferringCustomerTotalsOptions;
905
+ type index_d_QueryReferringCustomerTotalsRequest = QueryReferringCustomerTotalsRequest;
906
+ type index_d_QueryReferringCustomerTotalsResponse = QueryReferringCustomerTotalsResponse;
907
+ type index_d_QueryReferringCustomerTotalsResponseNonNullableFields = QueryReferringCustomerTotalsResponseNonNullableFields;
908
+ type index_d_ReferralEvent = ReferralEvent;
909
+ type index_d_ReferralEventCreatedEnvelope = ReferralEventCreatedEnvelope;
910
+ type index_d_ReferralEventEventTypeOneOf = ReferralEventEventTypeOneOf;
911
+ type index_d_ReferralEventsQueryBuilder = ReferralEventsQueryBuilder;
912
+ type index_d_ReferralEventsQueryResult = ReferralEventsQueryResult;
913
+ type index_d_ReferredFriendAction = ReferredFriendAction;
914
+ type index_d_ReferredFriendActionEvent = ReferredFriendActionEvent;
915
+ type index_d_ReferredFriendActionRewardTypeOptionsOneOf = ReferredFriendActionRewardTypeOptionsOneOf;
916
+ type index_d_ReferredFriendDetails = ReferredFriendDetails;
917
+ type index_d_ReferredFriendSignupEvent = ReferredFriendSignupEvent;
918
+ type index_d_ReferringCustomerTotal = ReferringCustomerTotal;
919
+ type index_d_Reward = Reward;
920
+ declare const index_d_Reward: typeof Reward;
921
+ type index_d_RewardEvent = RewardEvent;
922
+ type index_d_RewardEventReceiverOneOf = RewardEventReceiverOneOf;
923
+ type index_d_SortOrder = SortOrder;
924
+ declare const index_d_SortOrder: typeof SortOrder;
925
+ type index_d_Sorting = Sorting;
926
+ type index_d_Status = Status;
927
+ declare const index_d_Status: typeof Status;
928
+ type index_d_SuccessfulReferralEvent = SuccessfulReferralEvent;
929
+ type index_d_Trigger = Trigger;
930
+ type index_d_UndeleteInfo = UndeleteInfo;
931
+ type index_d_V1ActionEvent = V1ActionEvent;
932
+ type index_d_V1Coupon = V1Coupon;
933
+ type index_d_V1SuccessfulReferralEvent = V1SuccessfulReferralEvent;
934
+ type index_d_V1Trigger = V1Trigger;
935
+ type index_d_WebhookIdentityType = WebhookIdentityType;
936
+ declare const index_d_WebhookIdentityType: typeof WebhookIdentityType;
937
+ declare const index_d___metadata: typeof __metadata;
938
+ declare const index_d_getReferralEvent: typeof getReferralEvent;
939
+ declare const index_d_getReferralStatistics: typeof getReferralStatistics;
940
+ declare const index_d_onReferralEventCreated: typeof onReferralEventCreated;
941
+ declare const index_d_queryReferralEvent: typeof queryReferralEvent;
942
+ declare const index_d_queryReferredFriendActions: typeof queryReferredFriendActions;
943
+ declare const index_d_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
944
+ declare namespace index_d {
945
+ export { type index_d_ActionEvent as ActionEvent, type index_d_BaseEventMetadata as BaseEventMetadata, type index_d_Coupon as Coupon, type index_d_CouponDiscountTypeOptionsOneOf as CouponDiscountTypeOptionsOneOf, type index_d_CouponScope as CouponScope, type index_d_CouponScopeOrMinSubtotalOneOf as CouponScopeOrMinSubtotalOneOf, type index_d_CreateReferralEventRequest as CreateReferralEventRequest, type index_d_CreateReferralEventResponse as CreateReferralEventResponse, type index_d_CursorPaging as CursorPaging, type index_d_CursorPagingMetadata as CursorPagingMetadata, type index_d_CursorQuery as CursorQuery, type index_d_CursorQueryPagingMethodOneOf as CursorQueryPagingMethodOneOf, type index_d_Cursors as Cursors, index_d_DiscountType as DiscountType, type index_d_DomainEvent as DomainEvent, type index_d_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d_Empty as Empty, type index_d_EntityCreatedEvent as EntityCreatedEvent, type index_d_EntityDeletedEvent as EntityDeletedEvent, type index_d_EntityUpdatedEvent as EntityUpdatedEvent, type index_d_EventMetadata as EventMetadata, type index_d_FixedAmountDiscount as FixedAmountDiscount, type index_d_GetReferralEventRequest as GetReferralEventRequest, type index_d_GetReferralEventResponse as GetReferralEventResponse, type index_d_GetReferralEventResponseNonNullableFields as GetReferralEventResponseNonNullableFields, type index_d_GetReferralStatisticsRequest as GetReferralStatisticsRequest, type index_d_GetReferralStatisticsResponse as GetReferralStatisticsResponse, type index_d_GetReferralStatisticsResponseNonNullableFields as GetReferralStatisticsResponseNonNullableFields, type index_d_Group as Group, type index_d_IdentificationData as IdentificationData, type index_d_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type index_d_LoyaltyPoints as LoyaltyPoints, type index_d_MessageEnvelope as MessageEnvelope, type index_d_PercentageDiscount as PercentageDiscount, type index_d_QueryReferralEventRequest as QueryReferralEventRequest, type index_d_QueryReferralEventResponse as QueryReferralEventResponse, type index_d_QueryReferralEventResponseNonNullableFields as QueryReferralEventResponseNonNullableFields, type index_d_QueryReferredFriendActionsOptions as QueryReferredFriendActionsOptions, type index_d_QueryReferredFriendActionsRequest as QueryReferredFriendActionsRequest, type index_d_QueryReferredFriendActionsResponse as QueryReferredFriendActionsResponse, type index_d_QueryReferredFriendActionsResponseNonNullableFields as QueryReferredFriendActionsResponseNonNullableFields, type index_d_QueryReferringCustomerTotalsOptions as QueryReferringCustomerTotalsOptions, type index_d_QueryReferringCustomerTotalsRequest as QueryReferringCustomerTotalsRequest, type index_d_QueryReferringCustomerTotalsResponse as QueryReferringCustomerTotalsResponse, type index_d_QueryReferringCustomerTotalsResponseNonNullableFields as QueryReferringCustomerTotalsResponseNonNullableFields, type index_d_ReferralEvent as ReferralEvent, type index_d_ReferralEventCreatedEnvelope as ReferralEventCreatedEnvelope, type index_d_ReferralEventEventTypeOneOf as ReferralEventEventTypeOneOf, type index_d_ReferralEventsQueryBuilder as ReferralEventsQueryBuilder, type index_d_ReferralEventsQueryResult as ReferralEventsQueryResult, type index_d_ReferredFriendAction as ReferredFriendAction, type index_d_ReferredFriendActionEvent as ReferredFriendActionEvent, type index_d_ReferredFriendActionRewardTypeOptionsOneOf as ReferredFriendActionRewardTypeOptionsOneOf, type index_d_ReferredFriendDetails as ReferredFriendDetails, type index_d_ReferredFriendSignupEvent as ReferredFriendSignupEvent, type index_d_ReferringCustomerTotal as ReferringCustomerTotal, index_d_Reward as Reward, type index_d_RewardEvent as RewardEvent, type index_d_RewardEventReceiverOneOf as RewardEventReceiverOneOf, index_d_SortOrder as SortOrder, type index_d_Sorting as Sorting, index_d_Status as Status, type index_d_SuccessfulReferralEvent as SuccessfulReferralEvent, type index_d_Trigger as Trigger, type index_d_UndeleteInfo as UndeleteInfo, type index_d_V1ActionEvent as V1ActionEvent, type index_d_V1Coupon as V1Coupon, type index_d_V1SuccessfulReferralEvent as V1SuccessfulReferralEvent, type index_d_V1Trigger as V1Trigger, index_d_WebhookIdentityType as WebhookIdentityType, index_d___metadata as __metadata, index_d_getReferralEvent as getReferralEvent, index_d_getReferralStatistics as getReferralStatistics, index_d_onReferralEventCreated as onReferralEventCreated, index_d_queryReferralEvent as queryReferralEvent, index_d_queryReferredFriendActions as queryReferredFriendActions, index_d_queryReferringCustomerTotals as queryReferringCustomerTotals };
946
+ }
947
+
948
+ export { index_d as tracker };