@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,676 @@
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 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`
119
+ */
120
+ filter?: Record<string, any> | null;
121
+ /**
122
+ * Sort object in the following format:
123
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
124
+ */
125
+ sort?: Sorting[];
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"
141
+ }
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;
152
+ }
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;
158
+ /**
159
+ * Whether there are more pages to retrieve following the current page.
160
+ *
161
+ * + `true`: Another page of results can be retrieved.
162
+ * + `false`: This is the last page.
163
+ */
164
+ hasNext?: boolean | null;
165
+ }
166
+ interface Cursors {
167
+ /** Cursor string pointing to the next page in the list of results. */
168
+ next?: string | null;
169
+ /** Cursor pointing to the previous page in the list of results. */
170
+ prev?: string | null;
171
+ }
172
+ interface GetReferralStatisticsResponse {
173
+ /** Total sign ups completed by referred friends */
174
+ totalSignUpsCompleted?: number;
175
+ /** Total actions completed by referred friends */
176
+ totalActionsCompleted?: number;
177
+ /** Total amount of purchases made by referred friends */
178
+ totalAmountGenerated?: string;
179
+ }
180
+ interface QueryReferringCustomerTotalsResponse {
181
+ /** List of ReferringCustomerTotals that match the query. */
182
+ referringCustomerTotals?: ReferringCustomerTotal[];
183
+ /** Paging metadata. */
184
+ metadata?: CursorPagingMetadata;
185
+ }
186
+ interface ReferringCustomerTotal {
187
+ /**
188
+ * Referring customer id.
189
+ * @readonly
190
+ */
191
+ referringCustomerId?: string;
192
+ /**
193
+ * Contact id.
194
+ * @readonly
195
+ */
196
+ contactId?: string;
197
+ /**
198
+ * Last successful referral date.
199
+ * @readonly
200
+ */
201
+ lastSuccessfulReferral?: Date;
202
+ /**
203
+ * Total successful referrals made by this customer.
204
+ * @readonly
205
+ */
206
+ totalSuccessfulReferrals?: number;
207
+ /**
208
+ * Total amount generated by friends referred by this customer.
209
+ * @readonly
210
+ */
211
+ totalAmountGenerated?: string;
212
+ /**
213
+ * Last friend action date.
214
+ * @readonly
215
+ */
216
+ lastFriendAction?: Date;
217
+ /**
218
+ * Total friends that have actions done.
219
+ * @readonly
220
+ */
221
+ totalFriendsWithActions?: number;
222
+ }
223
+ interface QueryReferredFriendActionsResponse {
224
+ /** List of ReferredFriendActions that match the query. */
225
+ referredFriendActions?: ReferredFriendAction[];
226
+ /** Paging metadata. */
227
+ metadata?: CursorPagingMetadata;
228
+ }
229
+ interface ReferredFriendAction extends ReferredFriendActionRewardTypeOptionsOneOf {
230
+ /** Coupon reward type options. */
231
+ coupon?: V1Coupon;
232
+ /** Loyalty points reward type options. */
233
+ loyaltyPoints?: LoyaltyPoints;
234
+ /**
235
+ * Referred friend id.
236
+ * @readonly
237
+ */
238
+ referredFriendId?: string;
239
+ /**
240
+ * Contact id.
241
+ * @readonly
242
+ */
243
+ contactId?: string;
244
+ /**
245
+ * First action trigger.
246
+ * @readonly
247
+ */
248
+ trigger?: V1Trigger;
249
+ /**
250
+ * First action date.
251
+ * @readonly
252
+ */
253
+ actionDate?: Date;
254
+ /** Issued reward type. */
255
+ rewardType?: Reward;
256
+ /** Total number of actions. */
257
+ totalActions?: number;
258
+ /**
259
+ * Total amount spent by this referred friend.
260
+ * @readonly
261
+ */
262
+ totalAmountSpent?: string;
263
+ /**
264
+ * friend signup date.
265
+ * @readonly
266
+ */
267
+ signupDate?: Date;
268
+ }
269
+ /** @oneof */
270
+ interface ReferredFriendActionRewardTypeOptionsOneOf {
271
+ /** Coupon reward type options. */
272
+ coupon?: V1Coupon;
273
+ /** Loyalty points reward type options. */
274
+ loyaltyPoints?: LoyaltyPoints;
275
+ }
276
+ interface V1Coupon {
277
+ /**
278
+ * Coupon id
279
+ * @readonly
280
+ */
281
+ _id?: string;
282
+ /**
283
+ * Coupon code
284
+ * @readonly
285
+ */
286
+ code?: string;
287
+ /**
288
+ * Coupon status
289
+ * @readonly
290
+ */
291
+ status?: Status;
292
+ /**
293
+ * Coupon specification
294
+ * @readonly
295
+ */
296
+ couponSpecification?: Coupon;
297
+ }
298
+ declare enum Status {
299
+ UNKNOWN = "UNKNOWN",
300
+ /** Coupon is active and can be applied */
301
+ ACTIVE = "ACTIVE",
302
+ /** Coupon was already applied and can not be used anymore */
303
+ APPLIED = "APPLIED",
304
+ /** Coupon was deleted */
305
+ DELETED = "DELETED"
306
+ }
307
+ interface Coupon extends CouponDiscountTypeOptionsOneOf, CouponScopeOrMinSubtotalOneOf {
308
+ /** Options for fixed amount discount type */
309
+ fixedAmountOptions?: FixedAmountDiscount;
310
+ /** Options for percentage discount type */
311
+ percentageOptions?: PercentageDiscount;
312
+ /** Limit the coupon to carts with a subtotal above this number. */
313
+ minimumSubtotal?: number;
314
+ /** Specifies the type of line items this coupon will apply to. */
315
+ scope?: CouponScope;
316
+ /** Coupon name */
317
+ name?: string;
318
+ /** Coupon discount type */
319
+ discountType?: DiscountType;
320
+ /** Limit the coupon to only apply to one item in cart. */
321
+ limitedToOneItem?: boolean | null;
322
+ /** If true, coupon also applies to subscriptions. */
323
+ appliesToSubscriptions?: boolean | null;
324
+ /** Specifies the amount of discounted cycles for subscription item. See Stores Coupons documentation for more info. */
325
+ discountedCycleCount?: number | null;
326
+ }
327
+ /** @oneof */
328
+ interface CouponDiscountTypeOptionsOneOf {
329
+ /** Options for fixed amount discount type */
330
+ fixedAmountOptions?: FixedAmountDiscount;
331
+ /** Options for percentage discount type */
332
+ percentageOptions?: PercentageDiscount;
333
+ }
334
+ /** @oneof */
335
+ interface CouponScopeOrMinSubtotalOneOf {
336
+ /** Limit the coupon to carts with a subtotal above this number. */
337
+ minimumSubtotal?: number;
338
+ /** Specifies the type of line items this coupon will apply to. */
339
+ scope?: CouponScope;
340
+ }
341
+ declare enum DiscountType {
342
+ UNKNOWN = "UNKNOWN",
343
+ /** Discount as a fixed amount */
344
+ FIXED_AMOUNT = "FIXED_AMOUNT",
345
+ /** Discount as a percentage */
346
+ PERCENTAGE = "PERCENTAGE",
347
+ /** Free shipping */
348
+ FREE_SHIPPING = "FREE_SHIPPING"
349
+ }
350
+ interface FixedAmountDiscount {
351
+ /** Fixed amount to discount */
352
+ amount?: number;
353
+ }
354
+ interface PercentageDiscount {
355
+ percentage?: number;
356
+ }
357
+ interface CouponScope {
358
+ namespace?: string;
359
+ group?: Group;
360
+ }
361
+ interface Group {
362
+ name?: string;
363
+ entityId?: string | null;
364
+ }
365
+ interface LoyaltyPoints {
366
+ /**
367
+ * Loyalty transaction id
368
+ * @readonly
369
+ */
370
+ transactionId?: string;
371
+ /**
372
+ * Loyalty points amount given
373
+ * @readonly
374
+ */
375
+ amount?: number;
376
+ }
377
+ interface IdentificationData extends IdentificationDataIdOneOf {
378
+ /** ID of a site visitor that has not logged in to the site. */
379
+ anonymousVisitorId?: string;
380
+ /** ID of a site visitor that has logged in to the site. */
381
+ memberId?: string;
382
+ /** ID of a Wix user (site owner, contributor, etc.). */
383
+ wixUserId?: string;
384
+ /** ID of an app. */
385
+ appId?: string;
386
+ /** @readonly */
387
+ identityType?: WebhookIdentityType;
388
+ }
389
+ /** @oneof */
390
+ interface IdentificationDataIdOneOf {
391
+ /** ID of a site visitor that has not logged in to the site. */
392
+ anonymousVisitorId?: string;
393
+ /** ID of a site visitor that has logged in to the site. */
394
+ memberId?: string;
395
+ /** ID of a Wix user (site owner, contributor, etc.). */
396
+ wixUserId?: string;
397
+ /** ID of an app. */
398
+ appId?: string;
399
+ }
400
+ declare enum WebhookIdentityType {
401
+ UNKNOWN = "UNKNOWN",
402
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
403
+ MEMBER = "MEMBER",
404
+ WIX_USER = "WIX_USER",
405
+ APP = "APP"
406
+ }
407
+ interface GetReferralStatisticsResponseNonNullableFields {
408
+ totalSignUpsCompleted: number;
409
+ totalActionsCompleted: number;
410
+ totalAmountGenerated: string;
411
+ }
412
+ interface QueryReferringCustomerTotalsResponseNonNullableFields {
413
+ referringCustomerTotals: {
414
+ referringCustomerId: string;
415
+ contactId: string;
416
+ totalSuccessfulReferrals: number;
417
+ totalAmountGenerated: string;
418
+ totalFriendsWithActions: number;
419
+ }[];
420
+ }
421
+ interface QueryReferredFriendActionsResponseNonNullableFields {
422
+ referredFriendActions: {
423
+ coupon?: {
424
+ _id: string;
425
+ code: string;
426
+ status: Status;
427
+ couponSpecification?: {
428
+ fixedAmountOptions?: {
429
+ amount: number;
430
+ };
431
+ percentageOptions?: {
432
+ percentage: number;
433
+ };
434
+ minimumSubtotal: number;
435
+ scope?: {
436
+ namespace: string;
437
+ group?: {
438
+ name: string;
439
+ };
440
+ };
441
+ name: string;
442
+ discountType: DiscountType;
443
+ };
444
+ };
445
+ loyaltyPoints?: {
446
+ transactionId: string;
447
+ amount: number;
448
+ };
449
+ referredFriendId: string;
450
+ contactId: string;
451
+ trigger?: {
452
+ appId: string;
453
+ activityType: string;
454
+ };
455
+ rewardType: Reward;
456
+ totalActions: number;
457
+ totalAmountSpent: string;
458
+ }[];
459
+ }
460
+ interface BaseEventMetadata {
461
+ /** App instance ID. */
462
+ instanceId?: string | null;
463
+ /** Event type. */
464
+ eventType?: string;
465
+ /** The identification type and identity data. */
466
+ identity?: IdentificationData;
467
+ }
468
+ interface EventMetadata extends BaseEventMetadata {
469
+ /**
470
+ * Unique event ID.
471
+ * Allows clients to ignore duplicate webhooks.
472
+ */
473
+ _id?: string;
474
+ /**
475
+ * Assumes actions are also always typed to an entity_type
476
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
477
+ */
478
+ entityFqdn?: string;
479
+ /**
480
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
481
+ * This is although the created/updated/deleted notion is duplication of the oneof types
482
+ * Example: created/updated/deleted/started/completed/email_opened
483
+ */
484
+ slug?: string;
485
+ /** ID of the entity associated with the event. */
486
+ entityId?: string;
487
+ /** Event timestamp. */
488
+ eventTime?: Date;
489
+ /**
490
+ * Whether the event was triggered as a result of a privacy regulation application
491
+ * (for example, GDPR).
492
+ */
493
+ triggeredByAnonymizeRequest?: boolean | null;
494
+ /** If present, indicates the action that triggered the event. */
495
+ originatedFrom?: string | null;
496
+ /**
497
+ * A sequence number defining the order of updates to the underlying entity.
498
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
499
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
500
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
501
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
502
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
503
+ */
504
+ entityEventSequence?: string | null;
505
+ }
506
+ interface ReferralEventCreatedEnvelope {
507
+ entity: ReferralEvent;
508
+ metadata: EventMetadata;
509
+ }
510
+ interface QueryCursorResult {
511
+ cursors: Cursors;
512
+ hasNext: () => boolean;
513
+ hasPrev: () => boolean;
514
+ length: number;
515
+ pageSize: number;
516
+ }
517
+ interface ReferralEventsQueryResult extends QueryCursorResult {
518
+ items: ReferralEvent[];
519
+ query: ReferralEventsQueryBuilder;
520
+ next: () => Promise<ReferralEventsQueryResult>;
521
+ prev: () => Promise<ReferralEventsQueryResult>;
522
+ }
523
+ interface ReferralEventsQueryBuilder {
524
+ /** @param propertyName - Property whose value is compared with `value`.
525
+ * @param value - Value to compare against.
526
+ * @documentationMaturity preview
527
+ */
528
+ eq: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
529
+ /** @param propertyName - Property whose value is compared with `value`.
530
+ * @param value - Value to compare against.
531
+ * @documentationMaturity preview
532
+ */
533
+ ne: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
534
+ /** @param propertyName - Property whose value is compared with `value`.
535
+ * @param value - Value to compare against.
536
+ * @documentationMaturity preview
537
+ */
538
+ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
539
+ /** @param propertyName - Property whose value is compared with `value`.
540
+ * @param value - Value to compare against.
541
+ * @documentationMaturity preview
542
+ */
543
+ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
544
+ /** @param propertyName - Property whose value is compared with `value`.
545
+ * @param value - Value to compare against.
546
+ * @documentationMaturity preview
547
+ */
548
+ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
549
+ /** @param propertyName - Property whose value is compared with `value`.
550
+ * @param value - Value to compare against.
551
+ * @documentationMaturity preview
552
+ */
553
+ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
554
+ /** @param propertyName - Property whose value is compared with `values`.
555
+ * @param values - List of values to compare against.
556
+ * @documentationMaturity preview
557
+ */
558
+ hasSome: (propertyName: '_createdDate' | '_updatedDate', value: any[]) => ReferralEventsQueryBuilder;
559
+ /** @documentationMaturity preview */
560
+ in: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
561
+ /** @documentationMaturity preview */
562
+ exists: (propertyName: '_createdDate' | '_updatedDate', value: boolean) => ReferralEventsQueryBuilder;
563
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
564
+ * @documentationMaturity preview
565
+ */
566
+ ascending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
567
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
568
+ * @documentationMaturity preview
569
+ */
570
+ descending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
571
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
572
+ * @documentationMaturity preview
573
+ */
574
+ limit: (limit: number) => ReferralEventsQueryBuilder;
575
+ /** @param cursor - A pointer to specific record
576
+ * @documentationMaturity preview
577
+ */
578
+ skipTo: (cursor: string) => ReferralEventsQueryBuilder;
579
+ /** @documentationMaturity preview */
580
+ find: () => Promise<ReferralEventsQueryResult>;
581
+ }
582
+ interface QueryReferringCustomerTotalsOptions {
583
+ /** Query to filter ReferringCustomerTotals. */
584
+ query?: CursorQuery;
585
+ /** List of contact ids to filter ReferringCustomerTotals. */
586
+ contactIds?: string[];
587
+ }
588
+ interface QueryReferredFriendActionsOptions {
589
+ /** Query to filter ReferredFriendActions. */
590
+ query?: CursorQuery;
591
+ /** List of contact ids to filter ReferredFriendActions. */
592
+ contactIds?: string[];
593
+ }
594
+
595
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
596
+ interface HttpClient {
597
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
598
+ }
599
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
600
+ type HttpResponse<T = any> = {
601
+ data: T;
602
+ status: number;
603
+ statusText: string;
604
+ headers: any;
605
+ request?: any;
606
+ };
607
+ type RequestOptions<_TResponse = any, Data = any> = {
608
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
609
+ url: string;
610
+ data?: Data;
611
+ params?: URLSearchParams;
612
+ } & APIMetadata;
613
+ type APIMetadata = {
614
+ methodFqn?: string;
615
+ entityFqdn?: string;
616
+ packageName?: string;
617
+ };
618
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
619
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
620
+ __type: 'event-definition';
621
+ type: Type;
622
+ isDomainEvent?: boolean;
623
+ transformations?: unknown;
624
+ __payload: Payload;
625
+ };
626
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
627
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
628
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
629
+
630
+ declare function getReferralEvent$1(httpClient: HttpClient): (referralEventId: string) => Promise<ReferralEvent & {
631
+ referredFriendSignupEvent?: {
632
+ referredFriendId: string;
633
+ } | undefined;
634
+ successfulReferralEvent?: {
635
+ referredFriendId: string;
636
+ referringCustomerId: string;
637
+ } | undefined;
638
+ actionEvent?: {
639
+ referredFriendId: string;
640
+ referringCustomerId: string;
641
+ trigger?: {
642
+ appId: string;
643
+ activityType: string;
644
+ } | undefined;
645
+ } | undefined;
646
+ rewardEvent?: {
647
+ rewardedReferringCustomerId: string;
648
+ rewardedReferredFriendId: string;
649
+ referralRewardId: string;
650
+ rewardType: Reward;
651
+ } | undefined;
652
+ }>;
653
+ declare function queryReferralEvent$1(httpClient: HttpClient): () => ReferralEventsQueryBuilder;
654
+ declare function getReferralStatistics$1(httpClient: HttpClient): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
655
+ declare function queryReferringCustomerTotals$1(httpClient: HttpClient): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
656
+ declare function queryReferredFriendActions$1(httpClient: HttpClient): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
657
+ declare const onReferralEventCreated$1: EventDefinition<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
658
+
659
+ declare const getReferralEvent: BuildRESTFunction<typeof getReferralEvent$1>;
660
+ declare const queryReferralEvent: BuildRESTFunction<typeof queryReferralEvent$1>;
661
+ declare const getReferralStatistics: BuildRESTFunction<typeof getReferralStatistics$1>;
662
+ declare const queryReferringCustomerTotals: BuildRESTFunction<typeof queryReferringCustomerTotals$1>;
663
+ declare const queryReferredFriendActions: BuildRESTFunction<typeof queryReferredFriendActions$1>;
664
+ declare const onReferralEventCreated: BuildEventDefinition<typeof onReferralEventCreated$1>;
665
+
666
+ declare const context_getReferralEvent: typeof getReferralEvent;
667
+ declare const context_getReferralStatistics: typeof getReferralStatistics;
668
+ declare const context_onReferralEventCreated: typeof onReferralEventCreated;
669
+ declare const context_queryReferralEvent: typeof queryReferralEvent;
670
+ declare const context_queryReferredFriendActions: typeof queryReferredFriendActions;
671
+ declare const context_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
672
+ declare namespace context {
673
+ export { context_getReferralEvent as getReferralEvent, context_getReferralStatistics as getReferralStatistics, context_onReferralEventCreated as onReferralEventCreated, context_queryReferralEvent as queryReferralEvent, context_queryReferredFriendActions as queryReferredFriendActions, context_queryReferringCustomerTotals as queryReferringCustomerTotals };
674
+ }
675
+
676
+ export { context as tracker };