@wix/referral 1.0.1 → 1.0.3

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,379 +1,1753 @@
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$1;
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$1;
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$1 extends CouponDiscountTypeOptionsOneOf$1, CouponScopeOrMinSubtotalOneOf$1 {
75
+ /** Options for fixed amount discount type. */
76
+ fixedAmountOptions?: FixedAmountDiscount$1;
77
+ /** Options for percentage discount type. */
78
+ percentageOptions?: PercentageDiscount$1;
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$1;
83
+ /** Coupon name. */
84
+ name?: string;
85
+ /** Coupon discount type. */
86
+ discountType?: DiscountType$1;
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$1 {
96
+ /** Options for fixed amount discount type. */
97
+ fixedAmountOptions?: FixedAmountDiscount$1;
98
+ /** Options for percentage discount type. */
99
+ percentageOptions?: PercentageDiscount$1;
63
100
  }
64
- interface V1Trigger {
65
- /** The app id of the app that triggered the event. */
101
+ /** @oneof */
102
+ interface CouponScopeOrMinSubtotalOneOf$1 {
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$1;
107
+ }
108
+ declare enum DiscountType$1 {
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$1 {
119
+ /** Fixed amount to discount. */
120
+ amount?: number;
121
+ }
122
+ interface PercentageDiscount$1 {
123
+ /** Percentage to discount. */
124
+ percentage?: number;
125
+ }
126
+ interface CouponScope$1 {
127
+ /** Namespace of the coupon scope. */
128
+ namespace?: string;
129
+ /** Group of the coupon scope. */
130
+ group?: Group$1;
131
+ }
132
+ interface Group$1 {
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$3 {
181
+ /** Cursor string pointing to the next page in the list of results. */
182
+ next?: string | null;
183
+ /** Cursor pointing to the previous page in the list of results. */
184
+ prev?: string | null;
185
+ }
186
+ interface UpdateReferralProgramResponse {
187
+ /** The updated ReferralProgram. */
188
+ referralProgram?: ReferralProgram;
189
+ }
190
+ interface ActivateReferralProgramResponse {
191
+ /** The activated ReferralProgram. */
192
+ referralProgram?: ReferralProgram;
193
+ }
194
+ interface PauseReferralProgramResponse {
195
+ /** The paused ReferralProgram. */
196
+ referralProgram?: ReferralProgram;
197
+ }
198
+ interface GetAISocialMediaPostsSuggestionsResponse {
199
+ /** The generated suggestions. */
200
+ suggestions?: AISocialMediaPostSuggestion[];
201
+ /** The refer friends page URL. */
202
+ referFriendsPageUrl?: string | null;
203
+ }
204
+ interface AISocialMediaPostSuggestion {
205
+ /** The suggested post content. */
206
+ postContent?: string;
207
+ /** The suggested hashtags. */
208
+ hashtags?: string[];
209
+ }
210
+ interface GenerateAISocialMediaPostsSuggestionsResponse {
211
+ /** The generated suggestions. */
212
+ suggestions?: AISocialMediaPostSuggestion[];
213
+ /** The refer friends page URL. */
214
+ referFriendsPageUrl?: string | null;
215
+ }
216
+ interface GetReferralProgramPremiumFeaturesResponse {
217
+ /**
218
+ * Set to true if user has referral program feature.
219
+ * @readonly
220
+ */
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. */
66
231
  appId?: string;
67
- /** The activity type that triggered the event. */
68
- activityType?: string;
232
+ /** @readonly */
233
+ identityType?: WebhookIdentityType$3;
234
+ }
235
+ /** @oneof */
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;
245
+ }
246
+ declare enum WebhookIdentityType$3 {
247
+ UNKNOWN = "UNKNOWN",
248
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
249
+ MEMBER = "MEMBER",
250
+ WIX_USER = "WIX_USER",
251
+ APP = "APP"
252
+ }
253
+ interface GetReferralProgramResponseNonNullableFields {
254
+ referralProgram?: {
255
+ status: ProgramStatus;
256
+ referredFriendReward?: {
257
+ couponOptions?: {
258
+ fixedAmountOptions?: {
259
+ amount: number;
260
+ };
261
+ percentageOptions?: {
262
+ percentage: number;
263
+ };
264
+ minimumSubtotal: number;
265
+ scope?: {
266
+ namespace: string;
267
+ group?: {
268
+ name: string;
269
+ };
270
+ };
271
+ name: string;
272
+ discountType: DiscountType$1;
273
+ };
274
+ loyaltyPointsOptions?: {
275
+ amount: number;
276
+ };
277
+ type: Type;
278
+ };
279
+ referringCustomerReward?: {
280
+ couponOptions?: {
281
+ fixedAmountOptions?: {
282
+ amount: number;
283
+ };
284
+ percentageOptions?: {
285
+ percentage: number;
286
+ };
287
+ minimumSubtotal: number;
288
+ scope?: {
289
+ namespace: string;
290
+ group?: {
291
+ name: string;
292
+ };
293
+ };
294
+ name: string;
295
+ discountType: DiscountType$1;
296
+ };
297
+ loyaltyPointsOptions?: {
298
+ amount: number;
299
+ };
300
+ type: Type;
301
+ };
302
+ successfulReferralActions: Action[];
303
+ isPremium: boolean;
304
+ emails?: {
305
+ encourageToReferFriends: App[];
306
+ notifyCustomersAboutReward: boolean;
307
+ };
308
+ };
309
+ }
310
+ interface UpdateReferralProgramResponseNonNullableFields {
311
+ referralProgram?: {
312
+ status: ProgramStatus;
313
+ referredFriendReward?: {
314
+ couponOptions?: {
315
+ fixedAmountOptions?: {
316
+ amount: number;
317
+ };
318
+ percentageOptions?: {
319
+ percentage: number;
320
+ };
321
+ minimumSubtotal: number;
322
+ scope?: {
323
+ namespace: string;
324
+ group?: {
325
+ name: string;
326
+ };
327
+ };
328
+ name: string;
329
+ discountType: DiscountType$1;
330
+ };
331
+ loyaltyPointsOptions?: {
332
+ amount: number;
333
+ };
334
+ type: Type;
335
+ };
336
+ referringCustomerReward?: {
337
+ couponOptions?: {
338
+ fixedAmountOptions?: {
339
+ amount: number;
340
+ };
341
+ percentageOptions?: {
342
+ percentage: number;
343
+ };
344
+ minimumSubtotal: number;
345
+ scope?: {
346
+ namespace: string;
347
+ group?: {
348
+ name: string;
349
+ };
350
+ };
351
+ name: string;
352
+ discountType: DiscountType$1;
353
+ };
354
+ loyaltyPointsOptions?: {
355
+ amount: number;
356
+ };
357
+ type: Type;
358
+ };
359
+ successfulReferralActions: Action[];
360
+ isPremium: boolean;
361
+ emails?: {
362
+ encourageToReferFriends: App[];
363
+ notifyCustomersAboutReward: boolean;
364
+ };
365
+ };
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$1;
387
+ };
388
+ loyaltyPointsOptions?: {
389
+ amount: number;
390
+ };
391
+ type: Type;
392
+ };
393
+ referringCustomerReward?: {
394
+ couponOptions?: {
395
+ fixedAmountOptions?: {
396
+ amount: number;
397
+ };
398
+ percentageOptions?: {
399
+ percentage: number;
400
+ };
401
+ minimumSubtotal: number;
402
+ scope?: {
403
+ namespace: string;
404
+ group?: {
405
+ name: string;
406
+ };
407
+ };
408
+ name: string;
409
+ discountType: DiscountType$1;
410
+ };
411
+ loyaltyPointsOptions?: {
412
+ amount: number;
413
+ };
414
+ type: Type;
415
+ };
416
+ successfulReferralActions: Action[];
417
+ isPremium: boolean;
418
+ emails?: {
419
+ encourageToReferFriends: App[];
420
+ notifyCustomersAboutReward: boolean;
421
+ };
422
+ };
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$1;
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$1;
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$3;
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$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
581
+ interface HttpClient$3 {
582
+ request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
583
+ fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
584
+ }
585
+ type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
586
+ type HttpResponse$3<T = any> = {
587
+ data: T;
588
+ status: number;
589
+ statusText: string;
590
+ headers: any;
591
+ request?: any;
592
+ };
593
+ type RequestOptions$3<_TResponse = any, Data = any> = {
594
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
595
+ url: string;
596
+ data?: Data;
597
+ params?: URLSearchParams;
598
+ } & APIMetadata$3;
599
+ type APIMetadata$3 = {
600
+ methodFqn?: string;
601
+ entityFqdn?: string;
602
+ packageName?: string;
603
+ };
604
+ type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
605
+ type EventDefinition$3<Payload = unknown, Type extends string = string> = {
606
+ __type: 'event-definition';
607
+ type: Type;
608
+ isDomainEvent?: boolean;
609
+ transformations?: (envelope: unknown) => Payload;
610
+ __payload: Payload;
611
+ };
612
+ declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
613
+ type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
614
+ type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
615
+
616
+ declare global {
617
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
618
+ interface SymbolConstructor {
619
+ readonly observable: symbol;
620
+ }
621
+ }
622
+
623
+ declare function getReferralProgram$1(httpClient: HttpClient$3): () => Promise<GetReferralProgramResponse & GetReferralProgramResponseNonNullableFields>;
624
+ declare function queryReferralPrograms$1(httpClient: HttpClient$3): () => ReferralProgramsQueryBuilder;
625
+ declare function updateReferralProgram$1(httpClient: HttpClient$3): (referralProgram: ReferralProgram) => Promise<UpdateReferralProgramResponse & UpdateReferralProgramResponseNonNullableFields>;
626
+ declare function activateReferralProgram$1(httpClient: HttpClient$3): () => Promise<ActivateReferralProgramResponse & ActivateReferralProgramResponseNonNullableFields>;
627
+ declare function pauseReferralProgram$1(httpClient: HttpClient$3): () => Promise<PauseReferralProgramResponse & PauseReferralProgramResponseNonNullableFields>;
628
+ declare function getAiSocialMediaPostsSuggestions$1(httpClient: HttpClient$3): (options?: GetAiSocialMediaPostsSuggestionsOptions) => Promise<GetAISocialMediaPostsSuggestionsResponse & GetAISocialMediaPostsSuggestionsResponseNonNullableFields>;
629
+ declare function generateAiSocialMediaPostsSuggestions$1(httpClient: HttpClient$3): (options?: GenerateAiSocialMediaPostsSuggestionsOptions) => Promise<GenerateAISocialMediaPostsSuggestionsResponse & GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields>;
630
+ declare function getReferralProgramPremiumFeatures$1(httpClient: HttpClient$3): () => Promise<GetReferralProgramPremiumFeaturesResponse & GetReferralProgramPremiumFeaturesResponseNonNullableFields>;
631
+ declare const onProgramUpdated$1: EventDefinition$3<ProgramUpdatedEnvelope, "wix.loyalty.referral.v1.program_updated">;
632
+
633
+ declare const getReferralProgram: BuildRESTFunction$3<typeof getReferralProgram$1>;
634
+ declare const queryReferralPrograms: BuildRESTFunction$3<typeof queryReferralPrograms$1>;
635
+ declare const updateReferralProgram: BuildRESTFunction$3<typeof updateReferralProgram$1>;
636
+ declare const activateReferralProgram: BuildRESTFunction$3<typeof activateReferralProgram$1>;
637
+ declare const pauseReferralProgram: BuildRESTFunction$3<typeof pauseReferralProgram$1>;
638
+ declare const getAiSocialMediaPostsSuggestions: BuildRESTFunction$3<typeof getAiSocialMediaPostsSuggestions$1>;
639
+ declare const generateAiSocialMediaPostsSuggestions: BuildRESTFunction$3<typeof generateAiSocialMediaPostsSuggestions$1>;
640
+ declare const getReferralProgramPremiumFeatures: BuildRESTFunction$3<typeof getReferralProgramPremiumFeatures$1>;
641
+ declare const onProgramUpdated: BuildEventDefinition$3<typeof onProgramUpdated$1>;
642
+
643
+ declare const context$3_activateReferralProgram: typeof activateReferralProgram;
644
+ declare const context$3_generateAiSocialMediaPostsSuggestions: typeof generateAiSocialMediaPostsSuggestions;
645
+ declare const context$3_getAiSocialMediaPostsSuggestions: typeof getAiSocialMediaPostsSuggestions;
646
+ declare const context$3_getReferralProgram: typeof getReferralProgram;
647
+ declare const context$3_getReferralProgramPremiumFeatures: typeof getReferralProgramPremiumFeatures;
648
+ declare const context$3_onProgramUpdated: typeof onProgramUpdated;
649
+ declare const context$3_pauseReferralProgram: typeof pauseReferralProgram;
650
+ declare const context$3_queryReferralPrograms: typeof queryReferralPrograms;
651
+ declare const context$3_updateReferralProgram: typeof updateReferralProgram;
652
+ declare namespace context$3 {
653
+ export { context$3_activateReferralProgram as activateReferralProgram, context$3_generateAiSocialMediaPostsSuggestions as generateAiSocialMediaPostsSuggestions, context$3_getAiSocialMediaPostsSuggestions as getAiSocialMediaPostsSuggestions, context$3_getReferralProgram as getReferralProgram, context$3_getReferralProgramPremiumFeatures as getReferralProgramPremiumFeatures, context$3_onProgramUpdated as onProgramUpdated, context$3_pauseReferralProgram as pauseReferralProgram, context$3_queryReferralPrograms as queryReferralPrograms, context$3_updateReferralProgram as updateReferralProgram };
654
+ }
655
+
656
+ /** ReferralEvent. */
657
+ interface ReferralEvent extends ReferralEventEventTypeOneOf {
658
+ /** ReferredFriendSignupEvent is an event that is triggered when a referred friend signs up. */
659
+ referredFriendSignupEvent?: ReferredFriendSignupEvent;
660
+ /** SuccessfulReferralEvent is an event that is triggered when a referral is successful. */
661
+ successfulReferralEvent?: V1SuccessfulReferralEvent;
662
+ /** ActionEvent is an event that is triggered when an action is performed. */
663
+ actionEvent?: V1ActionEvent;
664
+ /** RewardEvent is an event that is triggered when a reward is given. */
665
+ rewardEvent?: RewardEvent;
666
+ /**
667
+ * ReferralEvent ID.
668
+ * @readonly
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 extends CursorQueryPagingMethodOneOf {
765
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
766
+ cursorPaging?: CursorPaging;
767
+ /**
768
+ * Filter object in the following format:
769
+ * `"filter" : {
770
+ * "fieldName1": "value1",
771
+ * "fieldName2":{"$operator":"value2"}
772
+ * }`
773
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
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[];
781
+ }
782
+ /** @oneof */
783
+ interface CursorQueryPagingMethodOneOf {
784
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
785
+ cursorPaging?: CursorPaging;
786
+ }
787
+ interface Sorting {
788
+ /** Name of the field to sort by. */
789
+ fieldName?: string;
790
+ /** Sort order. */
791
+ order?: SortOrder;
792
+ }
793
+ declare enum SortOrder {
794
+ ASC = "ASC",
795
+ DESC = "DESC"
796
+ }
797
+ interface CursorPaging {
798
+ /** Maximum number of items to return in the results. */
799
+ limit?: number | null;
800
+ /**
801
+ * Pointer to the next or previous page in the list of results.
802
+ *
803
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
804
+ * Not relevant for the first request.
805
+ */
806
+ cursor?: string | null;
807
+ }
808
+ interface CursorPagingMetadata {
809
+ /** Number of items returned in the response. */
810
+ count?: number | null;
811
+ /** Cursor strings that point to the next page, previous page, or both. */
812
+ cursors?: Cursors$2;
813
+ /**
814
+ * Whether there are more pages to retrieve following the current page.
815
+ *
816
+ * + `true`: Another page of results can be retrieved.
817
+ * + `false`: This is the last page.
818
+ */
819
+ hasNext?: boolean | null;
820
+ }
821
+ interface Cursors$2 {
822
+ /** Cursor string pointing to the next page in the list of results. */
823
+ next?: string | null;
824
+ /** Cursor pointing to the previous page in the list of results. */
825
+ prev?: string | null;
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;
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;
883
+ }
884
+ interface ReferredFriendAction extends ReferredFriendActionRewardTypeOptionsOneOf {
885
+ /** Coupon reward type options. */
886
+ coupon?: V1Coupon;
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;
928
+ /** Loyalty points reward type options. */
929
+ loyaltyPoints?: LoyaltyPoints;
930
+ }
931
+ interface V1Coupon {
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$1;
947
+ /**
948
+ * Coupon specification.
949
+ * @readonly
950
+ */
951
+ couponSpecification?: Coupon;
952
+ }
953
+ declare enum Status$1 {
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 extends CouponDiscountTypeOptionsOneOf, CouponScopeOrMinSubtotalOneOf {
964
+ /** Options for fixed amount discount type. */
965
+ fixedAmountOptions?: FixedAmountDiscount;
966
+ /** Options for percentage discount type. */
967
+ percentageOptions?: PercentageDiscount;
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;
972
+ /** Coupon name. */
973
+ name?: string;
974
+ /** Coupon discount type. */
975
+ discountType?: DiscountType;
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 {
985
+ /** Options for fixed amount discount type. */
986
+ fixedAmountOptions?: FixedAmountDiscount;
987
+ /** Options for percentage discount type. */
988
+ percentageOptions?: PercentageDiscount;
989
+ }
990
+ /** @oneof */
991
+ interface CouponScopeOrMinSubtotalOneOf {
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;
996
+ }
997
+ declare enum DiscountType {
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 {
1008
+ /** Fixed amount to discount. */
1009
+ amount?: number;
1010
+ }
1011
+ interface PercentageDiscount {
1012
+ /** Percentage to discount. */
1013
+ percentage?: number;
1014
+ }
1015
+ interface CouponScope {
1016
+ /** Namespace of the coupon scope. */
1017
+ namespace?: string;
1018
+ /** Group of the coupon scope. */
1019
+ group?: Group;
1020
+ }
1021
+ interface Group {
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$1;
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;
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$2;
1174
+ hasNext: () => boolean;
1175
+ hasPrev: () => boolean;
1176
+ length: number;
1177
+ pageSize: number;
1178
+ }
1179
+ interface ReferralEventsQueryResult extends QueryCursorResult$2 {
1180
+ items: ReferralEvent[];
1181
+ query: ReferralEventsQueryBuilder;
1182
+ next: () => Promise<ReferralEventsQueryResult>;
1183
+ prev: () => Promise<ReferralEventsQueryResult>;
1184
+ }
1185
+ interface ReferralEventsQueryBuilder {
1186
+ /** @param propertyName - Property whose value is compared with `value`.
1187
+ * @param value - Value to compare against.
1188
+ * @documentationMaturity preview
1189
+ */
1190
+ eq: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1191
+ /** @param propertyName - Property whose value is compared with `value`.
1192
+ * @param value - Value to compare against.
1193
+ * @documentationMaturity preview
1194
+ */
1195
+ ne: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1196
+ /** @param propertyName - Property whose value is compared with `value`.
1197
+ * @param value - Value to compare against.
1198
+ * @documentationMaturity preview
1199
+ */
1200
+ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1201
+ /** @param propertyName - Property whose value is compared with `value`.
1202
+ * @param value - Value to compare against.
1203
+ * @documentationMaturity preview
1204
+ */
1205
+ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1206
+ /** @param propertyName - Property whose value is compared with `value`.
1207
+ * @param value - Value to compare against.
1208
+ * @documentationMaturity preview
1209
+ */
1210
+ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1211
+ /** @param propertyName - Property whose value is compared with `value`.
1212
+ * @param value - Value to compare against.
1213
+ * @documentationMaturity preview
1214
+ */
1215
+ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1216
+ /** @param propertyName - Property whose value is compared with `values`.
1217
+ * @param values - List of values to compare against.
1218
+ * @documentationMaturity preview
1219
+ */
1220
+ hasSome: (propertyName: '_createdDate' | '_updatedDate', value: any[]) => ReferralEventsQueryBuilder;
1221
+ /** @documentationMaturity preview */
1222
+ in: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1223
+ /** @documentationMaturity preview */
1224
+ exists: (propertyName: '_createdDate' | '_updatedDate', value: boolean) => ReferralEventsQueryBuilder;
1225
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1226
+ * @documentationMaturity preview
1227
+ */
1228
+ ascending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
1229
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1230
+ * @documentationMaturity preview
1231
+ */
1232
+ descending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
1233
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1234
+ * @documentationMaturity preview
1235
+ */
1236
+ limit: (limit: number) => ReferralEventsQueryBuilder;
1237
+ /** @param cursor - A pointer to specific record
1238
+ * @documentationMaturity preview
1239
+ */
1240
+ skipTo: (cursor: string) => ReferralEventsQueryBuilder;
1241
+ /** @documentationMaturity preview */
1242
+ find: () => Promise<ReferralEventsQueryResult>;
1243
+ }
1244
+ interface QueryReferringCustomerTotalsOptions {
1245
+ /** Query to filter ReferringCustomerTotals. */
1246
+ query?: CursorQuery;
1247
+ /** List of contact ids to filter ReferringCustomerTotals. */
1248
+ contactIds?: string[];
1249
+ }
1250
+ interface QueryReferredFriendActionsOptions {
1251
+ /** Query to filter ReferredFriendActions. */
1252
+ query?: CursorQuery;
1253
+ /** List of contact ids to filter ReferredFriendActions. */
1254
+ contactIds?: string[];
1255
+ }
1256
+
1257
+ type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
1258
+ interface HttpClient$2 {
1259
+ request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
1260
+ fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
1261
+ }
1262
+ type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
1263
+ type HttpResponse$2<T = any> = {
1264
+ data: T;
1265
+ status: number;
1266
+ statusText: string;
1267
+ headers: any;
1268
+ request?: any;
1269
+ };
1270
+ type RequestOptions$2<_TResponse = any, Data = any> = {
1271
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1272
+ url: string;
1273
+ data?: Data;
1274
+ params?: URLSearchParams;
1275
+ } & APIMetadata$2;
1276
+ type APIMetadata$2 = {
1277
+ methodFqn?: string;
1278
+ entityFqdn?: string;
1279
+ packageName?: string;
1280
+ };
1281
+ type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
1282
+ type EventDefinition$2<Payload = unknown, Type extends string = string> = {
1283
+ __type: 'event-definition';
1284
+ type: Type;
1285
+ isDomainEvent?: boolean;
1286
+ transformations?: (envelope: unknown) => Payload;
1287
+ __payload: Payload;
1288
+ };
1289
+ declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
1290
+ type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
1291
+ type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
1292
+
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
+ }
1298
+ }
1299
+
1300
+ declare function getReferralEvent$1(httpClient: HttpClient$2): (referralEventId: string) => Promise<ReferralEvent & {
1301
+ referredFriendSignupEvent?: {
1302
+ referredFriendId: string;
1303
+ } | undefined;
1304
+ successfulReferralEvent?: {
1305
+ referredFriendId: string;
1306
+ referringCustomerId: string;
1307
+ } | undefined;
1308
+ actionEvent?: {
1309
+ referredFriendId: string;
1310
+ referringCustomerId: string;
1311
+ trigger?: {
1312
+ appId: string;
1313
+ activityType: string;
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$2): () => ReferralEventsQueryBuilder;
1324
+ declare function getReferralStatistics$1(httpClient: HttpClient$2): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
1325
+ declare function queryReferringCustomerTotals$1(httpClient: HttpClient$2): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
1326
+ declare function queryReferredFriendActions$1(httpClient: HttpClient$2): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
1327
+ declare const onReferralEventCreated$1: EventDefinition$2<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
1328
+
1329
+ declare const getReferralEvent: BuildRESTFunction$2<typeof getReferralEvent$1>;
1330
+ declare const queryReferralEvent: BuildRESTFunction$2<typeof queryReferralEvent$1>;
1331
+ declare const getReferralStatistics: BuildRESTFunction$2<typeof getReferralStatistics$1>;
1332
+ declare const queryReferringCustomerTotals: BuildRESTFunction$2<typeof queryReferringCustomerTotals$1>;
1333
+ declare const queryReferredFriendActions: BuildRESTFunction$2<typeof queryReferredFriendActions$1>;
1334
+ declare const onReferralEventCreated: BuildEventDefinition$2<typeof onReferralEventCreated$1>;
1335
+
1336
+ declare const context$2_getReferralEvent: typeof getReferralEvent;
1337
+ declare const context$2_getReferralStatistics: typeof getReferralStatistics;
1338
+ declare const context$2_onReferralEventCreated: typeof onReferralEventCreated;
1339
+ declare const context$2_queryReferralEvent: typeof queryReferralEvent;
1340
+ declare const context$2_queryReferredFriendActions: typeof queryReferredFriendActions;
1341
+ declare const context$2_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
1342
+ declare namespace context$2 {
1343
+ export { context$2_getReferralEvent as getReferralEvent, context$2_getReferralStatistics as getReferralStatistics, context$2_onReferralEventCreated as onReferralEventCreated, context$2_queryReferralEvent as queryReferralEvent, context$2_queryReferredFriendActions as queryReferredFriendActions, context$2_queryReferringCustomerTotals as queryReferringCustomerTotals };
69
1344
  }
70
- interface RewardEvent extends RewardEventReceiverOneOf {
1345
+
1346
+ /** ReferredFriend is the main entity of ReferredFriends that can be used for lorem ipsum dolor */
1347
+ interface ReferredFriend {
71
1348
  /**
72
- * The referring customer ID.
1349
+ * ReferredFriend ID.
73
1350
  * @readonly
74
1351
  */
75
- rewardedReferringCustomerId?: string;
1352
+ _id?: string;
76
1353
  /**
77
- * The referred friend ID.
1354
+ * ReferredFriend Contact ID.
78
1355
  * @readonly
79
1356
  */
80
- rewardedReferredFriendId?: string;
81
- /** The referral reward ID. */
82
- referralRewardId?: string;
83
- /** The reward type. */
84
- rewardType?: Reward;
85
- }
86
- /** @oneof */
87
- interface RewardEventReceiverOneOf {
1357
+ contactId?: string;
88
1358
  /**
89
- * The referring customer ID.
1359
+ * Customer who referred.
90
1360
  * @readonly
91
1361
  */
92
- rewardedReferringCustomerId?: string;
1362
+ referringCustomerId?: string;
1363
+ /** Status of the ReferredFriend. */
1364
+ status?: Status;
93
1365
  /**
94
- * The referred friend ID.
1366
+ * Represents the current state of an item. Each time the item is modified, its `revision` changes by the server. for an update operation to succeed, you MUST pass the latest revision.
95
1367
  * @readonly
96
1368
  */
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;
1369
+ revision?: string | null;
112
1370
  /**
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`
1371
+ * Represents the time this ReferredFriend was created.
1372
+ * @readonly
119
1373
  */
120
- filter?: Record<string, any> | null;
1374
+ _createdDate?: Date;
121
1375
  /**
122
- * Sort object in the following format:
123
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
1376
+ * Represents the time this ReferredFriend was last updated.
1377
+ * @readonly
124
1378
  */
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;
1379
+ _updatedDate?: Date;
137
1380
  }
138
- declare enum SortOrder {
139
- ASC = "ASC",
140
- DESC = "DESC"
1381
+ declare enum Status {
1382
+ /** Unknown status. */
1383
+ UNKNOWN = "UNKNOWN",
1384
+ /** Initial status, when Referred friend joins site as member. */
1385
+ SIGN_UP_COMPLETED = "SIGN_UP_COMPLETED",
1386
+ /** After complete some actions (eg. Purchase Order), Action Completed Status is used. */
1387
+ ACTIONS_COMPLETED = "ACTIONS_COMPLETED"
141
1388
  }
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;
1389
+ interface CreateReferredFriendResponse {
1390
+ /** The created ReferredFriend. */
1391
+ referredFriend?: ReferredFriend;
152
1392
  }
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;
1393
+ interface GetReferredFriendResponse {
1394
+ /** The retrieved ReferredFriend. */
1395
+ referredFriend?: ReferredFriend;
165
1396
  }
166
- interface Cursors {
1397
+ interface Cursors$1 {
167
1398
  /** Cursor string pointing to the next page in the list of results. */
168
1399
  next?: string | null;
169
1400
  /** Cursor pointing to the previous page in the list of results. */
170
1401
  prev?: string | null;
171
1402
  }
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;
1403
+ interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
1404
+ /** ID of a site visitor that has not logged in to the site. */
1405
+ anonymousVisitorId?: string;
1406
+ /** ID of a site visitor that has logged in to the site. */
1407
+ memberId?: string;
1408
+ /** ID of a Wix user (site owner, contributor, etc.). */
1409
+ wixUserId?: string;
1410
+ /** ID of an app. */
1411
+ appId?: string;
1412
+ /** @readonly */
1413
+ identityType?: WebhookIdentityType$1;
179
1414
  }
180
- interface QueryReferringCustomerTotalsResponse {
181
- /** List of ReferringCustomerTotals that match the query. */
182
- referringCustomerTotals?: ReferringCustomerTotal[];
183
- /** Paging metadata. */
184
- metadata?: CursorPagingMetadata;
1415
+ /** @oneof */
1416
+ interface IdentificationDataIdOneOf$1 {
1417
+ /** ID of a site visitor that has not logged in to the site. */
1418
+ anonymousVisitorId?: string;
1419
+ /** ID of a site visitor that has logged in to the site. */
1420
+ memberId?: string;
1421
+ /** ID of a Wix user (site owner, contributor, etc.). */
1422
+ wixUserId?: string;
1423
+ /** ID of an app. */
1424
+ appId?: string;
185
1425
  }
186
- interface ReferringCustomerTotal {
1426
+ declare enum WebhookIdentityType$1 {
1427
+ UNKNOWN = "UNKNOWN",
1428
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1429
+ MEMBER = "MEMBER",
1430
+ WIX_USER = "WIX_USER",
1431
+ APP = "APP"
1432
+ }
1433
+ interface CreateReferredFriendResponseNonNullableFields {
1434
+ referredFriend?: {
1435
+ _id: string;
1436
+ contactId: string;
1437
+ referringCustomerId: string;
1438
+ status: Status;
1439
+ };
1440
+ }
1441
+ interface GetReferredFriendResponseNonNullableFields {
1442
+ referredFriend?: {
1443
+ _id: string;
1444
+ contactId: string;
1445
+ referringCustomerId: string;
1446
+ status: Status;
1447
+ };
1448
+ }
1449
+ interface BaseEventMetadata$1 {
1450
+ /** App instance ID. */
1451
+ instanceId?: string | null;
1452
+ /** Event type. */
1453
+ eventType?: string;
1454
+ /** The identification type and identity data. */
1455
+ identity?: IdentificationData$1;
1456
+ }
1457
+ interface EventMetadata$1 extends BaseEventMetadata$1 {
187
1458
  /**
188
- * Referring customer id.
189
- * @readonly
1459
+ * Unique event ID.
1460
+ * Allows clients to ignore duplicate webhooks.
190
1461
  */
191
- referringCustomerId?: string;
1462
+ _id?: string;
192
1463
  /**
193
- * Contact id.
194
- * @readonly
1464
+ * Assumes actions are also always typed to an entity_type
1465
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
195
1466
  */
196
- contactId?: string;
1467
+ entityFqdn?: string;
197
1468
  /**
198
- * Last successful referral date.
199
- * @readonly
1469
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1470
+ * This is although the created/updated/deleted notion is duplication of the oneof types
1471
+ * Example: created/updated/deleted/started/completed/email_opened
200
1472
  */
201
- lastSuccessfulReferral?: Date;
1473
+ slug?: string;
1474
+ /** ID of the entity associated with the event. */
1475
+ entityId?: string;
1476
+ /** Event timestamp. */
1477
+ eventTime?: Date;
202
1478
  /**
203
- * Total successful referrals made by this customer.
204
- * @readonly
1479
+ * Whether the event was triggered as a result of a privacy regulation application
1480
+ * (for example, GDPR).
205
1481
  */
206
- totalSuccessfulReferrals?: number;
1482
+ triggeredByAnonymizeRequest?: boolean | null;
1483
+ /** If present, indicates the action that triggered the event. */
1484
+ originatedFrom?: string | null;
207
1485
  /**
208
- * Total amount generated by friends referred by this customer.
1486
+ * A sequence number defining the order of updates to the underlying entity.
1487
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
1488
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1489
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1490
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
1491
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1492
+ */
1493
+ entityEventSequence?: string | null;
1494
+ }
1495
+ interface ReferredFriendCreatedEnvelope {
1496
+ entity: ReferredFriend;
1497
+ metadata: EventMetadata$1;
1498
+ }
1499
+ interface ReferredFriendUpdatedEnvelope {
1500
+ entity: ReferredFriend;
1501
+ metadata: EventMetadata$1;
1502
+ }
1503
+ interface ReferredFriendDeletedEnvelope {
1504
+ metadata: EventMetadata$1;
1505
+ }
1506
+ interface UpdateReferredFriend {
1507
+ /**
1508
+ * ReferredFriend ID.
209
1509
  * @readonly
210
1510
  */
211
- totalAmountGenerated?: string;
1511
+ _id?: string;
212
1512
  /**
213
- * Last friend action date.
1513
+ * ReferredFriend Contact ID.
214
1514
  * @readonly
215
1515
  */
216
- lastFriendAction?: Date;
1516
+ contactId?: string;
217
1517
  /**
218
- * Total friends that have actions done.
1518
+ * Customer who referred.
219
1519
  * @readonly
220
1520
  */
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;
1521
+ referringCustomerId?: string;
1522
+ /** Status of the ReferredFriend. */
1523
+ status?: Status;
234
1524
  /**
235
- * Referred friend id.
1525
+ * Represents the current state of an item. Each time the item is modified, its `revision` changes by the server. for an update operation to succeed, you MUST pass the latest revision.
236
1526
  * @readonly
237
1527
  */
238
- referredFriendId?: string;
1528
+ revision?: string | null;
239
1529
  /**
240
- * Contact id.
1530
+ * Represents the time this ReferredFriend was created.
241
1531
  * @readonly
242
1532
  */
243
- contactId?: string;
1533
+ _createdDate?: Date;
244
1534
  /**
245
- * First action trigger.
1535
+ * Represents the time this ReferredFriend was last updated.
246
1536
  * @readonly
247
1537
  */
248
- trigger?: V1Trigger;
249
- /**
250
- * First action date.
251
- * @readonly
1538
+ _updatedDate?: Date;
1539
+ }
1540
+ interface DeleteReferredFriendOptions {
1541
+ /** The revision of the ReferredFriend. */
1542
+ revision?: string;
1543
+ }
1544
+ interface QueryCursorResult$1 {
1545
+ cursors: Cursors$1;
1546
+ hasNext: () => boolean;
1547
+ hasPrev: () => boolean;
1548
+ length: number;
1549
+ pageSize: number;
1550
+ }
1551
+ interface ReferredFriendsQueryResult extends QueryCursorResult$1 {
1552
+ items: ReferredFriend[];
1553
+ query: ReferredFriendsQueryBuilder;
1554
+ next: () => Promise<ReferredFriendsQueryResult>;
1555
+ prev: () => Promise<ReferredFriendsQueryResult>;
1556
+ }
1557
+ interface ReferredFriendsQueryBuilder {
1558
+ /** @param propertyName - Property whose value is compared with `value`.
1559
+ * @param value - Value to compare against.
1560
+ * @documentationMaturity preview
1561
+ */
1562
+ eq: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
1563
+ /** @param propertyName - Property whose value is compared with `value`.
1564
+ * @param value - Value to compare against.
1565
+ * @documentationMaturity preview
1566
+ */
1567
+ ne: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
1568
+ /** @param propertyName - Property whose value is compared with `value`.
1569
+ * @param value - Value to compare against.
1570
+ * @documentationMaturity preview
1571
+ */
1572
+ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
1573
+ /** @param propertyName - Property whose value is compared with `value`.
1574
+ * @param value - Value to compare against.
1575
+ * @documentationMaturity preview
1576
+ */
1577
+ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
1578
+ /** @param propertyName - Property whose value is compared with `value`.
1579
+ * @param value - Value to compare against.
1580
+ * @documentationMaturity preview
1581
+ */
1582
+ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
1583
+ /** @param propertyName - Property whose value is compared with `value`.
1584
+ * @param value - Value to compare against.
1585
+ * @documentationMaturity preview
1586
+ */
1587
+ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
1588
+ /** @param propertyName - Property whose value is compared with `string`.
1589
+ * @param string - String to compare against. Case-insensitive.
1590
+ * @documentationMaturity preview
1591
+ */
1592
+ startsWith: (propertyName: 'referringCustomerId', value: string) => ReferredFriendsQueryBuilder;
1593
+ /** @param propertyName - Property whose value is compared with `values`.
1594
+ * @param values - List of values to compare against.
1595
+ * @documentationMaturity preview
1596
+ */
1597
+ hasSome: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any[]) => ReferredFriendsQueryBuilder;
1598
+ /** @documentationMaturity preview */
1599
+ in: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
1600
+ /** @documentationMaturity preview */
1601
+ exists: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: boolean) => ReferredFriendsQueryBuilder;
1602
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1603
+ * @documentationMaturity preview
1604
+ */
1605
+ ascending: (...propertyNames: Array<'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate'>) => ReferredFriendsQueryBuilder;
1606
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1607
+ * @documentationMaturity preview
252
1608
  */
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
1609
+ descending: (...propertyNames: Array<'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate'>) => ReferredFriendsQueryBuilder;
1610
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1611
+ * @documentationMaturity preview
261
1612
  */
262
- totalAmountSpent?: string;
263
- /**
264
- * friend signup date.
265
- * @readonly
1613
+ limit: (limit: number) => ReferredFriendsQueryBuilder;
1614
+ /** @param cursor - A pointer to specific record
1615
+ * @documentationMaturity preview
266
1616
  */
267
- signupDate?: Date;
1617
+ skipTo: (cursor: string) => ReferredFriendsQueryBuilder;
1618
+ /** @documentationMaturity preview */
1619
+ find: () => Promise<ReferredFriendsQueryResult>;
268
1620
  }
269
- /** @oneof */
270
- interface ReferredFriendActionRewardTypeOptionsOneOf {
271
- /** Coupon reward type options. */
272
- coupon?: V1Coupon;
273
- /** Loyalty points reward type options. */
274
- loyaltyPoints?: LoyaltyPoints;
1621
+
1622
+ type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
1623
+ interface HttpClient$1 {
1624
+ request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
1625
+ fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
275
1626
  }
276
- interface V1Coupon {
1627
+ type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
1628
+ type HttpResponse$1<T = any> = {
1629
+ data: T;
1630
+ status: number;
1631
+ statusText: string;
1632
+ headers: any;
1633
+ request?: any;
1634
+ };
1635
+ type RequestOptions$1<_TResponse = any, Data = any> = {
1636
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1637
+ url: string;
1638
+ data?: Data;
1639
+ params?: URLSearchParams;
1640
+ } & APIMetadata$1;
1641
+ type APIMetadata$1 = {
1642
+ methodFqn?: string;
1643
+ entityFqdn?: string;
1644
+ packageName?: string;
1645
+ };
1646
+ type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
1647
+ type EventDefinition$1<Payload = unknown, Type extends string = string> = {
1648
+ __type: 'event-definition';
1649
+ type: Type;
1650
+ isDomainEvent?: boolean;
1651
+ transformations?: (envelope: unknown) => Payload;
1652
+ __payload: Payload;
1653
+ };
1654
+ declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
1655
+ type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
1656
+ type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
1657
+
1658
+ declare global {
1659
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1660
+ interface SymbolConstructor {
1661
+ readonly observable: symbol;
1662
+ }
1663
+ }
1664
+
1665
+ declare function createReferredFriend$1(httpClient: HttpClient$1): () => Promise<CreateReferredFriendResponse & CreateReferredFriendResponseNonNullableFields>;
1666
+ declare function getReferredFriend$1(httpClient: HttpClient$1): (referredFriendId: string) => Promise<GetReferredFriendResponse & GetReferredFriendResponseNonNullableFields>;
1667
+ declare function getReferredFriendByContactId$1(httpClient: HttpClient$1): (contactId: string) => Promise<ReferredFriend & {
1668
+ _id: string;
1669
+ contactId: string;
1670
+ referringCustomerId: string;
1671
+ status: Status;
1672
+ }>;
1673
+ declare function updateReferredFriend$1(httpClient: HttpClient$1): (_id: string, referredFriend: UpdateReferredFriend) => Promise<ReferredFriend & {
1674
+ _id: string;
1675
+ contactId: string;
1676
+ referringCustomerId: string;
1677
+ status: Status;
1678
+ }>;
1679
+ declare function deleteReferredFriend$1(httpClient: HttpClient$1): (referredFriendId: string, options?: DeleteReferredFriendOptions) => Promise<void>;
1680
+ declare function queryReferredFriend$1(httpClient: HttpClient$1): () => ReferredFriendsQueryBuilder;
1681
+ declare const onReferredFriendCreated$1: EventDefinition$1<ReferredFriendCreatedEnvelope, "wix.loyalty.referral.v1.referred_friend_created">;
1682
+ declare const onReferredFriendUpdated$1: EventDefinition$1<ReferredFriendUpdatedEnvelope, "wix.loyalty.referral.v1.referred_friend_updated">;
1683
+ declare const onReferredFriendDeleted$1: EventDefinition$1<ReferredFriendDeletedEnvelope, "wix.loyalty.referral.v1.referred_friend_deleted">;
1684
+
1685
+ declare const createReferredFriend: BuildRESTFunction$1<typeof createReferredFriend$1>;
1686
+ declare const getReferredFriend: BuildRESTFunction$1<typeof getReferredFriend$1>;
1687
+ declare const getReferredFriendByContactId: BuildRESTFunction$1<typeof getReferredFriendByContactId$1>;
1688
+ declare const updateReferredFriend: BuildRESTFunction$1<typeof updateReferredFriend$1>;
1689
+ declare const deleteReferredFriend: BuildRESTFunction$1<typeof deleteReferredFriend$1>;
1690
+ declare const queryReferredFriend: BuildRESTFunction$1<typeof queryReferredFriend$1>;
1691
+ declare const onReferredFriendCreated: BuildEventDefinition$1<typeof onReferredFriendCreated$1>;
1692
+ declare const onReferredFriendUpdated: BuildEventDefinition$1<typeof onReferredFriendUpdated$1>;
1693
+ declare const onReferredFriendDeleted: BuildEventDefinition$1<typeof onReferredFriendDeleted$1>;
1694
+
1695
+ declare const context$1_createReferredFriend: typeof createReferredFriend;
1696
+ declare const context$1_deleteReferredFriend: typeof deleteReferredFriend;
1697
+ declare const context$1_getReferredFriend: typeof getReferredFriend;
1698
+ declare const context$1_getReferredFriendByContactId: typeof getReferredFriendByContactId;
1699
+ declare const context$1_onReferredFriendCreated: typeof onReferredFriendCreated;
1700
+ declare const context$1_onReferredFriendDeleted: typeof onReferredFriendDeleted;
1701
+ declare const context$1_onReferredFriendUpdated: typeof onReferredFriendUpdated;
1702
+ declare const context$1_queryReferredFriend: typeof queryReferredFriend;
1703
+ declare const context$1_updateReferredFriend: typeof updateReferredFriend;
1704
+ declare namespace context$1 {
1705
+ export { context$1_createReferredFriend as createReferredFriend, context$1_deleteReferredFriend as deleteReferredFriend, context$1_getReferredFriend as getReferredFriend, context$1_getReferredFriendByContactId as getReferredFriendByContactId, context$1_onReferredFriendCreated as onReferredFriendCreated, context$1_onReferredFriendDeleted as onReferredFriendDeleted, context$1_onReferredFriendUpdated as onReferredFriendUpdated, context$1_queryReferredFriend as queryReferredFriend, context$1_updateReferredFriend as updateReferredFriend };
1706
+ }
1707
+
1708
+ /** ReferringCustomer is the main entity of ReferringCustomers. */
1709
+ interface ReferringCustomer {
277
1710
  /**
278
- * Coupon ID.
1711
+ * ReferringCustomer id.
279
1712
  * @readonly
280
1713
  */
281
1714
  _id?: string;
282
1715
  /**
283
- * Coupon code.
284
- * @readonly
285
- */
286
- code?: string;
287
- /**
288
- * Coupon status.
1716
+ * Contact id.
289
1717
  * @readonly
290
1718
  */
291
- status?: Status;
1719
+ contactId?: string;
292
1720
  /**
293
- * Coupon specification.
1721
+ * Referral code.
294
1722
  * @readonly
295
1723
  */
296
- couponSpecification?: Coupon;
297
- }
298
- declare enum Status {
299
- /** Unknown coupon status. */
300
- UNKNOWN = "UNKNOWN",
301
- /** Coupon is active and can be applied. */
302
- ACTIVE = "ACTIVE",
303
- /** Coupon was already applied and can not be used anymore. */
304
- APPLIED = "APPLIED",
305
- /** Coupon was deleted. */
306
- DELETED = "DELETED"
307
- }
308
- interface Coupon extends CouponDiscountTypeOptionsOneOf, CouponScopeOrMinSubtotalOneOf {
309
- /** Options for fixed amount discount type */
310
- fixedAmountOptions?: FixedAmountDiscount;
311
- /** Options for percentage discount type */
312
- percentageOptions?: PercentageDiscount;
313
- /** Limit the coupon to carts with a subtotal above this number. */
314
- minimumSubtotal?: number;
315
- /** Specifies the type of line items this coupon will apply to. */
316
- scope?: CouponScope;
317
- /** Coupon name */
318
- name?: string;
319
- /** Coupon discount type */
320
- discountType?: DiscountType;
321
- /** Limit the coupon to only apply to one item in cart. */
322
- limitedToOneItem?: boolean | null;
323
- /** If true, coupon also applies to subscriptions. */
324
- appliesToSubscriptions?: boolean | null;
325
- /** Specifies the amount of discounted cycles for subscription item. See Stores Coupons documentation for more info. */
326
- discountedCycleCount?: number | null;
327
- }
328
- /** @oneof */
329
- interface CouponDiscountTypeOptionsOneOf {
330
- /** Options for fixed amount discount type */
331
- fixedAmountOptions?: FixedAmountDiscount;
332
- /** Options for percentage discount type */
333
- percentageOptions?: PercentageDiscount;
334
- }
335
- /** @oneof */
336
- interface CouponScopeOrMinSubtotalOneOf {
337
- /** Limit the coupon to carts with a subtotal above this number. */
338
- minimumSubtotal?: number;
339
- /** Specifies the type of line items this coupon will apply to. */
340
- scope?: CouponScope;
341
- }
342
- declare enum DiscountType {
343
- UNKNOWN = "UNKNOWN",
344
- /** Discount as a fixed amount */
345
- FIXED_AMOUNT = "FIXED_AMOUNT",
346
- /** Discount as a percentage */
347
- PERCENTAGE = "PERCENTAGE",
348
- /** Free shipping */
349
- FREE_SHIPPING = "FREE_SHIPPING"
350
- }
351
- interface FixedAmountDiscount {
352
- /** Fixed amount to discount */
353
- amount?: number;
354
- }
355
- interface PercentageDiscount {
356
- percentage?: number;
357
- }
358
- interface CouponScope {
359
- namespace?: string;
360
- group?: Group;
361
- }
362
- interface Group {
363
- name?: string;
364
- entityId?: string | null;
365
- }
366
- interface LoyaltyPoints {
1724
+ referralCode?: string;
1725
+ /** Represents the current state of an item. Each time the item is modified, its `revision` changes by the server. for an update operation to succeed, you MUST pass the latest revision. */
1726
+ revision?: string | null;
367
1727
  /**
368
- * Loyalty transaction ID.
1728
+ * Represents the time this ReferringCustomer was created.
369
1729
  * @readonly
370
1730
  */
371
- transactionId?: string;
1731
+ _createdDate?: Date;
372
1732
  /**
373
- * Loyalty points amount given.
1733
+ * Represents the time this ReferringCustomer was last updated.
374
1734
  * @readonly
375
1735
  */
376
- amount?: number;
1736
+ _updatedDate?: Date;
1737
+ }
1738
+ interface GenerateReferringCustomerForContactResponse {
1739
+ /** The created ReferringCustomer. */
1740
+ referringCustomer?: ReferringCustomer;
1741
+ }
1742
+ interface GetReferringCustomerByReferralCodeResponse {
1743
+ /** The retrieved ReferringCustomer. */
1744
+ referringCustomer?: ReferringCustomer;
1745
+ }
1746
+ interface Cursors {
1747
+ /** Cursor string pointing to the next page in the list of results. */
1748
+ next?: string | null;
1749
+ /** Cursor pointing to the previous page in the list of results. */
1750
+ prev?: string | null;
377
1751
  }
378
1752
  interface IdentificationData extends IdentificationDataIdOneOf {
379
1753
  /** ID of a site visitor that has not logged in to the site. */
@@ -405,58 +1779,19 @@ declare enum WebhookIdentityType {
405
1779
  WIX_USER = "WIX_USER",
406
1780
  APP = "APP"
407
1781
  }
408
- interface GetReferralStatisticsResponseNonNullableFields {
409
- totalSignUpsCompleted: number;
410
- totalActionsCompleted: number;
411
- totalAmountGenerated: string;
412
- }
413
- interface QueryReferringCustomerTotalsResponseNonNullableFields {
414
- referringCustomerTotals: {
415
- referringCustomerId: string;
1782
+ interface GenerateReferringCustomerForContactResponseNonNullableFields {
1783
+ referringCustomer?: {
1784
+ _id: string;
416
1785
  contactId: string;
417
- totalSuccessfulReferrals: number;
418
- totalAmountGenerated: string;
419
- totalFriendsWithActions: number;
420
- }[];
1786
+ referralCode: string;
1787
+ };
421
1788
  }
422
- interface QueryReferredFriendActionsResponseNonNullableFields {
423
- referredFriendActions: {
424
- coupon?: {
425
- _id: string;
426
- code: string;
427
- status: Status;
428
- couponSpecification?: {
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;
444
- };
445
- };
446
- loyaltyPoints?: {
447
- transactionId: string;
448
- amount: number;
449
- };
450
- referredFriendId: string;
1789
+ interface GetReferringCustomerByReferralCodeResponseNonNullableFields {
1790
+ referringCustomer?: {
1791
+ _id: string;
451
1792
  contactId: string;
452
- trigger?: {
453
- appId: string;
454
- activityType: string;
455
- };
456
- rewardType: Reward;
457
- totalActions: number;
458
- totalAmountSpent: string;
459
- }[];
1793
+ referralCode: string;
1794
+ };
460
1795
  }
461
1796
  interface BaseEventMetadata {
462
1797
  /** App instance ID. */
@@ -504,8 +1839,11 @@ interface EventMetadata extends BaseEventMetadata {
504
1839
  */
505
1840
  entityEventSequence?: string | null;
506
1841
  }
507
- interface ReferralEventCreatedEnvelope {
508
- entity: ReferralEvent;
1842
+ interface ReferringCustomerCreatedEnvelope {
1843
+ entity: ReferringCustomer;
1844
+ metadata: EventMetadata;
1845
+ }
1846
+ interface ReferringCustomerDeletedEnvelope {
509
1847
  metadata: EventMetadata;
510
1848
  }
511
1849
  interface QueryCursorResult {
@@ -515,87 +1853,85 @@ interface QueryCursorResult {
515
1853
  length: number;
516
1854
  pageSize: number;
517
1855
  }
518
- interface ReferralEventsQueryResult extends QueryCursorResult {
519
- items: ReferralEvent[];
520
- query: ReferralEventsQueryBuilder;
521
- next: () => Promise<ReferralEventsQueryResult>;
522
- prev: () => Promise<ReferralEventsQueryResult>;
1856
+ interface ReferringCustomersQueryResult extends QueryCursorResult {
1857
+ items: ReferringCustomer[];
1858
+ query: ReferringCustomersQueryBuilder;
1859
+ next: () => Promise<ReferringCustomersQueryResult>;
1860
+ prev: () => Promise<ReferringCustomersQueryResult>;
523
1861
  }
524
- interface ReferralEventsQueryBuilder {
1862
+ interface ReferringCustomersQueryBuilder {
525
1863
  /** @param propertyName - Property whose value is compared with `value`.
526
1864
  * @param value - Value to compare against.
527
1865
  * @documentationMaturity preview
528
1866
  */
529
- eq: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1867
+ eq: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
530
1868
  /** @param propertyName - Property whose value is compared with `value`.
531
1869
  * @param value - Value to compare against.
532
1870
  * @documentationMaturity preview
533
1871
  */
534
- ne: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1872
+ ne: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
535
1873
  /** @param propertyName - Property whose value is compared with `value`.
536
1874
  * @param value - Value to compare against.
537
1875
  * @documentationMaturity preview
538
1876
  */
539
- ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1877
+ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
540
1878
  /** @param propertyName - Property whose value is compared with `value`.
541
1879
  * @param value - Value to compare against.
542
1880
  * @documentationMaturity preview
543
1881
  */
544
- gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1882
+ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
545
1883
  /** @param propertyName - Property whose value is compared with `value`.
546
1884
  * @param value - Value to compare against.
547
1885
  * @documentationMaturity preview
548
1886
  */
549
- le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1887
+ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
550
1888
  /** @param propertyName - Property whose value is compared with `value`.
551
1889
  * @param value - Value to compare against.
552
1890
  * @documentationMaturity preview
553
1891
  */
554
- lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1892
+ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
1893
+ /** @param propertyName - Property whose value is compared with `string`.
1894
+ * @param string - String to compare against. Case-insensitive.
1895
+ * @documentationMaturity preview
1896
+ */
1897
+ startsWith: (propertyName: 'contactId' | 'referralCode', value: string) => ReferringCustomersQueryBuilder;
555
1898
  /** @param propertyName - Property whose value is compared with `values`.
556
1899
  * @param values - List of values to compare against.
557
1900
  * @documentationMaturity preview
558
1901
  */
559
- hasSome: (propertyName: '_createdDate' | '_updatedDate', value: any[]) => ReferralEventsQueryBuilder;
1902
+ hasSome: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: any[]) => ReferringCustomersQueryBuilder;
560
1903
  /** @documentationMaturity preview */
561
- in: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferralEventsQueryBuilder;
1904
+ in: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
562
1905
  /** @documentationMaturity preview */
563
- exists: (propertyName: '_createdDate' | '_updatedDate', value: boolean) => ReferralEventsQueryBuilder;
1906
+ exists: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: boolean) => ReferringCustomersQueryBuilder;
564
1907
  /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
565
1908
  * @documentationMaturity preview
566
1909
  */
567
- ascending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
1910
+ ascending: (...propertyNames: Array<'contactId' | 'referralCode' | '_createdDate' | '_updatedDate'>) => ReferringCustomersQueryBuilder;
568
1911
  /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
569
1912
  * @documentationMaturity preview
570
1913
  */
571
- descending: (...propertyNames: Array<'_createdDate' | '_updatedDate'>) => ReferralEventsQueryBuilder;
1914
+ descending: (...propertyNames: Array<'contactId' | 'referralCode' | '_createdDate' | '_updatedDate'>) => ReferringCustomersQueryBuilder;
572
1915
  /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
573
1916
  * @documentationMaturity preview
574
1917
  */
575
- limit: (limit: number) => ReferralEventsQueryBuilder;
1918
+ limit: (limit: number) => ReferringCustomersQueryBuilder;
576
1919
  /** @param cursor - A pointer to specific record
577
1920
  * @documentationMaturity preview
578
1921
  */
579
- skipTo: (cursor: string) => ReferralEventsQueryBuilder;
1922
+ skipTo: (cursor: string) => ReferringCustomersQueryBuilder;
580
1923
  /** @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[];
1924
+ find: () => Promise<ReferringCustomersQueryResult>;
588
1925
  }
589
- interface QueryReferredFriendActionsOptions {
590
- /** Query to filter ReferredFriendActions. */
591
- query?: CursorQuery;
592
- /** List of contact ids to filter ReferredFriendActions. */
593
- contactIds?: string[];
1926
+ interface DeleteReferringCustomerOptions {
1927
+ /** The revision of the ReferringCustomer. */
1928
+ revision?: string;
594
1929
  }
595
1930
 
596
1931
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
597
1932
  interface HttpClient {
598
1933
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
1934
+ fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
599
1935
  }
600
1936
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
601
1937
  type HttpResponse<T = any> = {
@@ -621,57 +1957,49 @@ type EventDefinition<Payload = unknown, Type extends string = string> = {
621
1957
  __type: 'event-definition';
622
1958
  type: Type;
623
1959
  isDomainEvent?: boolean;
624
- transformations?: unknown;
1960
+ transformations?: (envelope: unknown) => Payload;
625
1961
  __payload: Payload;
626
1962
  };
627
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
1963
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
628
1964
  type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
629
1965
  type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
630
1966
 
631
- declare function getReferralEvent$1(httpClient: HttpClient): (referralEventId: string) => Promise<ReferralEvent & {
632
- referredFriendSignupEvent?: {
633
- referredFriendId: string;
634
- } | undefined;
635
- successfulReferralEvent?: {
636
- referredFriendId: string;
637
- referringCustomerId: string;
638
- } | undefined;
639
- actionEvent?: {
640
- referredFriendId: string;
641
- referringCustomerId: string;
642
- trigger?: {
643
- appId: string;
644
- activityType: string;
645
- } | undefined;
646
- } | undefined;
647
- rewardEvent?: {
648
- rewardedReferringCustomerId: string;
649
- rewardedReferredFriendId: string;
650
- referralRewardId: string;
651
- rewardType: Reward;
652
- } | undefined;
1967
+ declare global {
1968
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1969
+ interface SymbolConstructor {
1970
+ readonly observable: symbol;
1971
+ }
1972
+ }
1973
+
1974
+ declare function generateReferringCustomerForContact$1(httpClient: HttpClient): (contactId: string) => Promise<GenerateReferringCustomerForContactResponse & GenerateReferringCustomerForContactResponseNonNullableFields>;
1975
+ declare function getReferringCustomer$1(httpClient: HttpClient): (referringCustomerId: string) => Promise<ReferringCustomer & {
1976
+ _id: string;
1977
+ contactId: string;
1978
+ referralCode: string;
653
1979
  }>;
654
- declare function queryReferralEvent$1(httpClient: HttpClient): () => ReferralEventsQueryBuilder;
655
- declare function getReferralStatistics$1(httpClient: HttpClient): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
656
- declare function queryReferringCustomerTotals$1(httpClient: HttpClient): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
657
- declare function queryReferredFriendActions$1(httpClient: HttpClient): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
658
- declare const onReferralEventCreated$1: EventDefinition<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
1980
+ declare function getReferringCustomerByReferralCode$1(httpClient: HttpClient): (referralCode: string) => Promise<GetReferringCustomerByReferralCodeResponse & GetReferringCustomerByReferralCodeResponseNonNullableFields>;
1981
+ declare function queryReferringCustomers$1(httpClient: HttpClient): () => ReferringCustomersQueryBuilder;
1982
+ declare function deleteReferringCustomer$1(httpClient: HttpClient): (referringCustomerId: string, options?: DeleteReferringCustomerOptions) => Promise<void>;
1983
+ declare const onReferringCustomerCreated$1: EventDefinition<ReferringCustomerCreatedEnvelope, "wix.loyalty.referral.v1.referring_customer_created">;
1984
+ declare const onReferringCustomerDeleted$1: EventDefinition<ReferringCustomerDeletedEnvelope, "wix.loyalty.referral.v1.referring_customer_deleted">;
659
1985
 
660
- declare const getReferralEvent: BuildRESTFunction<typeof getReferralEvent$1>;
661
- declare const queryReferralEvent: BuildRESTFunction<typeof queryReferralEvent$1>;
662
- declare const getReferralStatistics: BuildRESTFunction<typeof getReferralStatistics$1>;
663
- declare const queryReferringCustomerTotals: BuildRESTFunction<typeof queryReferringCustomerTotals$1>;
664
- declare const queryReferredFriendActions: BuildRESTFunction<typeof queryReferredFriendActions$1>;
665
- declare const onReferralEventCreated: BuildEventDefinition<typeof onReferralEventCreated$1>;
1986
+ declare const generateReferringCustomerForContact: BuildRESTFunction<typeof generateReferringCustomerForContact$1>;
1987
+ declare const getReferringCustomer: BuildRESTFunction<typeof getReferringCustomer$1>;
1988
+ declare const getReferringCustomerByReferralCode: BuildRESTFunction<typeof getReferringCustomerByReferralCode$1>;
1989
+ declare const queryReferringCustomers: BuildRESTFunction<typeof queryReferringCustomers$1>;
1990
+ declare const deleteReferringCustomer: BuildRESTFunction<typeof deleteReferringCustomer$1>;
1991
+ declare const onReferringCustomerCreated: BuildEventDefinition<typeof onReferringCustomerCreated$1>;
1992
+ declare const onReferringCustomerDeleted: BuildEventDefinition<typeof onReferringCustomerDeleted$1>;
666
1993
 
667
- declare const context_getReferralEvent: typeof getReferralEvent;
668
- declare const context_getReferralStatistics: typeof getReferralStatistics;
669
- declare const context_onReferralEventCreated: typeof onReferralEventCreated;
670
- declare const context_queryReferralEvent: typeof queryReferralEvent;
671
- declare const context_queryReferredFriendActions: typeof queryReferredFriendActions;
672
- declare const context_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
1994
+ declare const context_deleteReferringCustomer: typeof deleteReferringCustomer;
1995
+ declare const context_generateReferringCustomerForContact: typeof generateReferringCustomerForContact;
1996
+ declare const context_getReferringCustomer: typeof getReferringCustomer;
1997
+ declare const context_getReferringCustomerByReferralCode: typeof getReferringCustomerByReferralCode;
1998
+ declare const context_onReferringCustomerCreated: typeof onReferringCustomerCreated;
1999
+ declare const context_onReferringCustomerDeleted: typeof onReferringCustomerDeleted;
2000
+ declare const context_queryReferringCustomers: typeof queryReferringCustomers;
673
2001
  declare namespace context {
674
- 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 };
2002
+ 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 };
675
2003
  }
676
2004
 
677
- export { context as tracker };
2005
+ export { context as customers, context$1 as friends, context$3 as programs, context$2 as tracker };