@wix/referral 1.0.0 → 1.0.2
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.
- package/build/cjs/context.d.ts +2 -0
- package/build/cjs/context.js +3 -1
- package/build/cjs/context.js.map +1 -1
- package/build/cjs/index.d.ts +2 -0
- package/build/cjs/index.js +3 -1
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/meta.d.ts +2 -0
- package/build/cjs/meta.js +3 -1
- package/build/cjs/meta.js.map +1 -1
- package/build/es/context.d.ts +2 -0
- package/build/es/context.js +2 -0
- package/build/es/context.js.map +1 -1
- package/build/es/index.d.ts +2 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -1
- package/build/es/meta.d.ts +2 -0
- package/build/es/meta.js +2 -0
- package/build/es/meta.js.map +1 -1
- package/package.json +5 -4
- package/type-bundles/context.bundle.d.ts +727 -59
- package/type-bundles/index.bundle.d.ts +1256 -147
- package/type-bundles/meta.bundle.d.ts +859 -73
|
@@ -154,7 +154,7 @@ interface CursorPagingMetadata {
|
|
|
154
154
|
/** Number of items returned in the response. */
|
|
155
155
|
count?: number | null;
|
|
156
156
|
/** Cursor strings that point to the next page, previous page, or both. */
|
|
157
|
-
cursors?: Cursors;
|
|
157
|
+
cursors?: Cursors$2;
|
|
158
158
|
/**
|
|
159
159
|
* Whether there are more pages to retrieve following the current page.
|
|
160
160
|
*
|
|
@@ -163,7 +163,7 @@ interface CursorPagingMetadata {
|
|
|
163
163
|
*/
|
|
164
164
|
hasNext?: boolean | null;
|
|
165
165
|
}
|
|
166
|
-
interface Cursors {
|
|
166
|
+
interface Cursors$2 {
|
|
167
167
|
/** Cursor string pointing to the next page in the list of results. */
|
|
168
168
|
next?: string | null;
|
|
169
169
|
/** Cursor pointing to the previous page in the list of results. */
|
|
@@ -275,33 +275,34 @@ interface ReferredFriendActionRewardTypeOptionsOneOf {
|
|
|
275
275
|
}
|
|
276
276
|
interface V1Coupon {
|
|
277
277
|
/**
|
|
278
|
-
* Coupon
|
|
278
|
+
* Coupon ID.
|
|
279
279
|
* @readonly
|
|
280
280
|
*/
|
|
281
281
|
_id?: string;
|
|
282
282
|
/**
|
|
283
|
-
* Coupon code
|
|
283
|
+
* Coupon code.
|
|
284
284
|
* @readonly
|
|
285
285
|
*/
|
|
286
286
|
code?: string;
|
|
287
287
|
/**
|
|
288
|
-
* Coupon status
|
|
288
|
+
* Coupon status.
|
|
289
289
|
* @readonly
|
|
290
290
|
*/
|
|
291
|
-
status?: Status;
|
|
291
|
+
status?: Status$1;
|
|
292
292
|
/**
|
|
293
|
-
* Coupon specification
|
|
293
|
+
* Coupon specification.
|
|
294
294
|
* @readonly
|
|
295
295
|
*/
|
|
296
296
|
couponSpecification?: Coupon;
|
|
297
297
|
}
|
|
298
|
-
declare enum Status {
|
|
298
|
+
declare enum Status$1 {
|
|
299
|
+
/** Unknown coupon status. */
|
|
299
300
|
UNKNOWN = "UNKNOWN",
|
|
300
|
-
/** Coupon is active and can be applied */
|
|
301
|
+
/** Coupon is active and can be applied. */
|
|
301
302
|
ACTIVE = "ACTIVE",
|
|
302
|
-
/** Coupon was already applied and can not be used anymore */
|
|
303
|
+
/** Coupon was already applied and can not be used anymore. */
|
|
303
304
|
APPLIED = "APPLIED",
|
|
304
|
-
/** Coupon was deleted */
|
|
305
|
+
/** Coupon was deleted. */
|
|
305
306
|
DELETED = "DELETED"
|
|
306
307
|
}
|
|
307
308
|
interface Coupon extends CouponDiscountTypeOptionsOneOf, CouponScopeOrMinSubtotalOneOf {
|
|
@@ -364,17 +365,17 @@ interface Group {
|
|
|
364
365
|
}
|
|
365
366
|
interface LoyaltyPoints {
|
|
366
367
|
/**
|
|
367
|
-
* Loyalty transaction
|
|
368
|
+
* Loyalty transaction ID.
|
|
368
369
|
* @readonly
|
|
369
370
|
*/
|
|
370
371
|
transactionId?: string;
|
|
371
372
|
/**
|
|
372
|
-
* Loyalty points amount given
|
|
373
|
+
* Loyalty points amount given.
|
|
373
374
|
* @readonly
|
|
374
375
|
*/
|
|
375
376
|
amount?: number;
|
|
376
377
|
}
|
|
377
|
-
interface IdentificationData extends IdentificationDataIdOneOf {
|
|
378
|
+
interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
|
|
378
379
|
/** ID of a site visitor that has not logged in to the site. */
|
|
379
380
|
anonymousVisitorId?: string;
|
|
380
381
|
/** ID of a site visitor that has logged in to the site. */
|
|
@@ -384,10 +385,10 @@ interface IdentificationData extends IdentificationDataIdOneOf {
|
|
|
384
385
|
/** ID of an app. */
|
|
385
386
|
appId?: string;
|
|
386
387
|
/** @readonly */
|
|
387
|
-
identityType?: WebhookIdentityType;
|
|
388
|
+
identityType?: WebhookIdentityType$2;
|
|
388
389
|
}
|
|
389
390
|
/** @oneof */
|
|
390
|
-
interface IdentificationDataIdOneOf {
|
|
391
|
+
interface IdentificationDataIdOneOf$2 {
|
|
391
392
|
/** ID of a site visitor that has not logged in to the site. */
|
|
392
393
|
anonymousVisitorId?: string;
|
|
393
394
|
/** ID of a site visitor that has logged in to the site. */
|
|
@@ -397,7 +398,7 @@ interface IdentificationDataIdOneOf {
|
|
|
397
398
|
/** ID of an app. */
|
|
398
399
|
appId?: string;
|
|
399
400
|
}
|
|
400
|
-
declare enum WebhookIdentityType {
|
|
401
|
+
declare enum WebhookIdentityType$2 {
|
|
401
402
|
UNKNOWN = "UNKNOWN",
|
|
402
403
|
ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
|
|
403
404
|
MEMBER = "MEMBER",
|
|
@@ -423,7 +424,7 @@ interface QueryReferredFriendActionsResponseNonNullableFields {
|
|
|
423
424
|
coupon?: {
|
|
424
425
|
_id: string;
|
|
425
426
|
code: string;
|
|
426
|
-
status: Status;
|
|
427
|
+
status: Status$1;
|
|
427
428
|
couponSpecification?: {
|
|
428
429
|
fixedAmountOptions?: {
|
|
429
430
|
amount: number;
|
|
@@ -457,15 +458,15 @@ interface QueryReferredFriendActionsResponseNonNullableFields {
|
|
|
457
458
|
totalAmountSpent: string;
|
|
458
459
|
}[];
|
|
459
460
|
}
|
|
460
|
-
interface BaseEventMetadata {
|
|
461
|
+
interface BaseEventMetadata$2 {
|
|
461
462
|
/** App instance ID. */
|
|
462
463
|
instanceId?: string | null;
|
|
463
464
|
/** Event type. */
|
|
464
465
|
eventType?: string;
|
|
465
466
|
/** The identification type and identity data. */
|
|
466
|
-
identity?: IdentificationData;
|
|
467
|
+
identity?: IdentificationData$2;
|
|
467
468
|
}
|
|
468
|
-
interface EventMetadata extends BaseEventMetadata {
|
|
469
|
+
interface EventMetadata$2 extends BaseEventMetadata$2 {
|
|
469
470
|
/**
|
|
470
471
|
* Unique event ID.
|
|
471
472
|
* Allows clients to ignore duplicate webhooks.
|
|
@@ -505,16 +506,16 @@ interface EventMetadata extends BaseEventMetadata {
|
|
|
505
506
|
}
|
|
506
507
|
interface ReferralEventCreatedEnvelope {
|
|
507
508
|
entity: ReferralEvent;
|
|
508
|
-
metadata: EventMetadata;
|
|
509
|
+
metadata: EventMetadata$2;
|
|
509
510
|
}
|
|
510
|
-
interface QueryCursorResult {
|
|
511
|
-
cursors: Cursors;
|
|
511
|
+
interface QueryCursorResult$2 {
|
|
512
|
+
cursors: Cursors$2;
|
|
512
513
|
hasNext: () => boolean;
|
|
513
514
|
hasPrev: () => boolean;
|
|
514
515
|
length: number;
|
|
515
516
|
pageSize: number;
|
|
516
517
|
}
|
|
517
|
-
interface ReferralEventsQueryResult extends QueryCursorResult {
|
|
518
|
+
interface ReferralEventsQueryResult extends QueryCursorResult$2 {
|
|
518
519
|
items: ReferralEvent[];
|
|
519
520
|
query: ReferralEventsQueryBuilder;
|
|
520
521
|
next: () => Promise<ReferralEventsQueryResult>;
|
|
@@ -592,42 +593,50 @@ interface QueryReferredFriendActionsOptions {
|
|
|
592
593
|
contactIds?: string[];
|
|
593
594
|
}
|
|
594
595
|
|
|
595
|
-
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
596
|
-
interface HttpClient {
|
|
597
|
-
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
596
|
+
type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
|
|
597
|
+
interface HttpClient$2 {
|
|
598
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
|
|
599
|
+
fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
|
|
598
600
|
}
|
|
599
|
-
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
600
|
-
type HttpResponse<T = any> = {
|
|
601
|
+
type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
|
|
602
|
+
type HttpResponse$2<T = any> = {
|
|
601
603
|
data: T;
|
|
602
604
|
status: number;
|
|
603
605
|
statusText: string;
|
|
604
606
|
headers: any;
|
|
605
607
|
request?: any;
|
|
606
608
|
};
|
|
607
|
-
type RequestOptions<_TResponse = any, Data = any> = {
|
|
609
|
+
type RequestOptions$2<_TResponse = any, Data = any> = {
|
|
608
610
|
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
609
611
|
url: string;
|
|
610
612
|
data?: Data;
|
|
611
613
|
params?: URLSearchParams;
|
|
612
|
-
} & APIMetadata;
|
|
613
|
-
type APIMetadata = {
|
|
614
|
+
} & APIMetadata$2;
|
|
615
|
+
type APIMetadata$2 = {
|
|
614
616
|
methodFqn?: string;
|
|
615
617
|
entityFqdn?: string;
|
|
616
618
|
packageName?: string;
|
|
617
619
|
};
|
|
618
|
-
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
619
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
620
|
+
type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
|
|
621
|
+
type EventDefinition$2<Payload = unknown, Type extends string = string> = {
|
|
620
622
|
__type: 'event-definition';
|
|
621
623
|
type: Type;
|
|
622
624
|
isDomainEvent?: boolean;
|
|
623
|
-
transformations?: unknown;
|
|
625
|
+
transformations?: (envelope: unknown) => Payload;
|
|
624
626
|
__payload: Payload;
|
|
625
627
|
};
|
|
626
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean,
|
|
627
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
628
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
628
|
+
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
629
|
+
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
630
|
+
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
629
631
|
|
|
630
|
-
declare
|
|
632
|
+
declare global {
|
|
633
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
634
|
+
interface SymbolConstructor {
|
|
635
|
+
readonly observable: symbol;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
declare function getReferralEvent$1(httpClient: HttpClient$2): (referralEventId: string) => Promise<ReferralEvent & {
|
|
631
640
|
referredFriendSignupEvent?: {
|
|
632
641
|
referredFriendId: string;
|
|
633
642
|
} | undefined;
|
|
@@ -650,27 +659,686 @@ declare function getReferralEvent$1(httpClient: HttpClient): (referralEventId: s
|
|
|
650
659
|
rewardType: Reward;
|
|
651
660
|
} | undefined;
|
|
652
661
|
}>;
|
|
653
|
-
declare function queryReferralEvent$1(httpClient: HttpClient): () => ReferralEventsQueryBuilder;
|
|
654
|
-
declare function getReferralStatistics$1(httpClient: HttpClient): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
|
|
655
|
-
declare function queryReferringCustomerTotals$1(httpClient: HttpClient): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
|
|
656
|
-
declare function queryReferredFriendActions$1(httpClient: HttpClient): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
|
|
657
|
-
declare const onReferralEventCreated$1: EventDefinition<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
|
|
662
|
+
declare function queryReferralEvent$1(httpClient: HttpClient$2): () => ReferralEventsQueryBuilder;
|
|
663
|
+
declare function getReferralStatistics$1(httpClient: HttpClient$2): () => Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
|
|
664
|
+
declare function queryReferringCustomerTotals$1(httpClient: HttpClient$2): (options?: QueryReferringCustomerTotalsOptions) => Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
|
|
665
|
+
declare function queryReferredFriendActions$1(httpClient: HttpClient$2): (options?: QueryReferredFriendActionsOptions) => Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
|
|
666
|
+
declare const onReferralEventCreated$1: EventDefinition$2<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
|
|
667
|
+
|
|
668
|
+
declare const getReferralEvent: BuildRESTFunction$2<typeof getReferralEvent$1>;
|
|
669
|
+
declare const queryReferralEvent: BuildRESTFunction$2<typeof queryReferralEvent$1>;
|
|
670
|
+
declare const getReferralStatistics: BuildRESTFunction$2<typeof getReferralStatistics$1>;
|
|
671
|
+
declare const queryReferringCustomerTotals: BuildRESTFunction$2<typeof queryReferringCustomerTotals$1>;
|
|
672
|
+
declare const queryReferredFriendActions: BuildRESTFunction$2<typeof queryReferredFriendActions$1>;
|
|
673
|
+
declare const onReferralEventCreated: BuildEventDefinition$2<typeof onReferralEventCreated$1>;
|
|
674
|
+
|
|
675
|
+
declare const context$2_getReferralEvent: typeof getReferralEvent;
|
|
676
|
+
declare const context$2_getReferralStatistics: typeof getReferralStatistics;
|
|
677
|
+
declare const context$2_onReferralEventCreated: typeof onReferralEventCreated;
|
|
678
|
+
declare const context$2_queryReferralEvent: typeof queryReferralEvent;
|
|
679
|
+
declare const context$2_queryReferredFriendActions: typeof queryReferredFriendActions;
|
|
680
|
+
declare const context$2_queryReferringCustomerTotals: typeof queryReferringCustomerTotals;
|
|
681
|
+
declare namespace context$2 {
|
|
682
|
+
export { context$2_getReferralEvent as getReferralEvent, context$2_getReferralStatistics as getReferralStatistics, context$2_onReferralEventCreated as onReferralEventCreated, context$2_queryReferralEvent as queryReferralEvent, context$2_queryReferredFriendActions as queryReferredFriendActions, context$2_queryReferringCustomerTotals as queryReferringCustomerTotals };
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/** ReferredFriend is the main entity of ReferredFriends that can be used for lorem ipsum dolor */
|
|
686
|
+
interface ReferredFriend {
|
|
687
|
+
/**
|
|
688
|
+
* ReferredFriend ID.
|
|
689
|
+
* @readonly
|
|
690
|
+
*/
|
|
691
|
+
_id?: string;
|
|
692
|
+
/**
|
|
693
|
+
* ReferredFriend Contact ID.
|
|
694
|
+
* @readonly
|
|
695
|
+
*/
|
|
696
|
+
contactId?: string;
|
|
697
|
+
/**
|
|
698
|
+
* Customer who referred.
|
|
699
|
+
* @readonly
|
|
700
|
+
*/
|
|
701
|
+
referringCustomerId?: string;
|
|
702
|
+
/** Status of the ReferredFriend. */
|
|
703
|
+
status?: Status;
|
|
704
|
+
/**
|
|
705
|
+
* 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.
|
|
706
|
+
* @readonly
|
|
707
|
+
*/
|
|
708
|
+
revision?: string | null;
|
|
709
|
+
/**
|
|
710
|
+
* Represents the time this ReferredFriend was created.
|
|
711
|
+
* @readonly
|
|
712
|
+
*/
|
|
713
|
+
_createdDate?: Date;
|
|
714
|
+
/**
|
|
715
|
+
* Represents the time this ReferredFriend was last updated.
|
|
716
|
+
* @readonly
|
|
717
|
+
*/
|
|
718
|
+
_updatedDate?: Date;
|
|
719
|
+
}
|
|
720
|
+
declare enum Status {
|
|
721
|
+
/** Unknown status. */
|
|
722
|
+
UNKNOWN = "UNKNOWN",
|
|
723
|
+
/** Initial status, when Referred friend joins site as member. */
|
|
724
|
+
SIGN_UP_COMPLETED = "SIGN_UP_COMPLETED",
|
|
725
|
+
/** After complete some actions (eg. Purchase Order), Action Completed Status is used. */
|
|
726
|
+
ACTIONS_COMPLETED = "ACTIONS_COMPLETED"
|
|
727
|
+
}
|
|
728
|
+
interface CreateReferredFriendResponse {
|
|
729
|
+
/** The created ReferredFriend. */
|
|
730
|
+
referredFriend?: ReferredFriend;
|
|
731
|
+
}
|
|
732
|
+
interface GetReferredFriendResponse {
|
|
733
|
+
/** The retrieved ReferredFriend. */
|
|
734
|
+
referredFriend?: ReferredFriend;
|
|
735
|
+
}
|
|
736
|
+
interface Cursors$1 {
|
|
737
|
+
/** Cursor string pointing to the next page in the list of results. */
|
|
738
|
+
next?: string | null;
|
|
739
|
+
/** Cursor pointing to the previous page in the list of results. */
|
|
740
|
+
prev?: string | null;
|
|
741
|
+
}
|
|
742
|
+
interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
|
|
743
|
+
/** ID of a site visitor that has not logged in to the site. */
|
|
744
|
+
anonymousVisitorId?: string;
|
|
745
|
+
/** ID of a site visitor that has logged in to the site. */
|
|
746
|
+
memberId?: string;
|
|
747
|
+
/** ID of a Wix user (site owner, contributor, etc.). */
|
|
748
|
+
wixUserId?: string;
|
|
749
|
+
/** ID of an app. */
|
|
750
|
+
appId?: string;
|
|
751
|
+
/** @readonly */
|
|
752
|
+
identityType?: WebhookIdentityType$1;
|
|
753
|
+
}
|
|
754
|
+
/** @oneof */
|
|
755
|
+
interface IdentificationDataIdOneOf$1 {
|
|
756
|
+
/** ID of a site visitor that has not logged in to the site. */
|
|
757
|
+
anonymousVisitorId?: string;
|
|
758
|
+
/** ID of a site visitor that has logged in to the site. */
|
|
759
|
+
memberId?: string;
|
|
760
|
+
/** ID of a Wix user (site owner, contributor, etc.). */
|
|
761
|
+
wixUserId?: string;
|
|
762
|
+
/** ID of an app. */
|
|
763
|
+
appId?: string;
|
|
764
|
+
}
|
|
765
|
+
declare enum WebhookIdentityType$1 {
|
|
766
|
+
UNKNOWN = "UNKNOWN",
|
|
767
|
+
ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
|
|
768
|
+
MEMBER = "MEMBER",
|
|
769
|
+
WIX_USER = "WIX_USER",
|
|
770
|
+
APP = "APP"
|
|
771
|
+
}
|
|
772
|
+
interface CreateReferredFriendResponseNonNullableFields {
|
|
773
|
+
referredFriend?: {
|
|
774
|
+
_id: string;
|
|
775
|
+
contactId: string;
|
|
776
|
+
referringCustomerId: string;
|
|
777
|
+
status: Status;
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
interface GetReferredFriendResponseNonNullableFields {
|
|
781
|
+
referredFriend?: {
|
|
782
|
+
_id: string;
|
|
783
|
+
contactId: string;
|
|
784
|
+
referringCustomerId: string;
|
|
785
|
+
status: Status;
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
interface BaseEventMetadata$1 {
|
|
789
|
+
/** App instance ID. */
|
|
790
|
+
instanceId?: string | null;
|
|
791
|
+
/** Event type. */
|
|
792
|
+
eventType?: string;
|
|
793
|
+
/** The identification type and identity data. */
|
|
794
|
+
identity?: IdentificationData$1;
|
|
795
|
+
}
|
|
796
|
+
interface EventMetadata$1 extends BaseEventMetadata$1 {
|
|
797
|
+
/**
|
|
798
|
+
* Unique event ID.
|
|
799
|
+
* Allows clients to ignore duplicate webhooks.
|
|
800
|
+
*/
|
|
801
|
+
_id?: string;
|
|
802
|
+
/**
|
|
803
|
+
* Assumes actions are also always typed to an entity_type
|
|
804
|
+
* Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
|
|
805
|
+
*/
|
|
806
|
+
entityFqdn?: string;
|
|
807
|
+
/**
|
|
808
|
+
* This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
|
|
809
|
+
* This is although the created/updated/deleted notion is duplication of the oneof types
|
|
810
|
+
* Example: created/updated/deleted/started/completed/email_opened
|
|
811
|
+
*/
|
|
812
|
+
slug?: string;
|
|
813
|
+
/** ID of the entity associated with the event. */
|
|
814
|
+
entityId?: string;
|
|
815
|
+
/** Event timestamp. */
|
|
816
|
+
eventTime?: Date;
|
|
817
|
+
/**
|
|
818
|
+
* Whether the event was triggered as a result of a privacy regulation application
|
|
819
|
+
* (for example, GDPR).
|
|
820
|
+
*/
|
|
821
|
+
triggeredByAnonymizeRequest?: boolean | null;
|
|
822
|
+
/** If present, indicates the action that triggered the event. */
|
|
823
|
+
originatedFrom?: string | null;
|
|
824
|
+
/**
|
|
825
|
+
* A sequence number defining the order of updates to the underlying entity.
|
|
826
|
+
* For example, given that some entity was updated at 16:00 and than again at 16:01,
|
|
827
|
+
* it is guaranteed that the sequence number of the second update is strictly higher than the first.
|
|
828
|
+
* As the consumer, you can use this value to ensure that you handle messages in the correct order.
|
|
829
|
+
* To do so, you will need to persist this number on your end, and compare the sequence number from the
|
|
830
|
+
* message against the one you have stored. Given that the stored number is higher, you should ignore the message.
|
|
831
|
+
*/
|
|
832
|
+
entityEventSequence?: string | null;
|
|
833
|
+
}
|
|
834
|
+
interface ReferredFriendCreatedEnvelope {
|
|
835
|
+
entity: ReferredFriend;
|
|
836
|
+
metadata: EventMetadata$1;
|
|
837
|
+
}
|
|
838
|
+
interface ReferredFriendUpdatedEnvelope {
|
|
839
|
+
entity: ReferredFriend;
|
|
840
|
+
metadata: EventMetadata$1;
|
|
841
|
+
}
|
|
842
|
+
interface ReferredFriendDeletedEnvelope {
|
|
843
|
+
metadata: EventMetadata$1;
|
|
844
|
+
}
|
|
845
|
+
interface UpdateReferredFriend {
|
|
846
|
+
/**
|
|
847
|
+
* ReferredFriend ID.
|
|
848
|
+
* @readonly
|
|
849
|
+
*/
|
|
850
|
+
_id?: string;
|
|
851
|
+
/**
|
|
852
|
+
* ReferredFriend Contact ID.
|
|
853
|
+
* @readonly
|
|
854
|
+
*/
|
|
855
|
+
contactId?: string;
|
|
856
|
+
/**
|
|
857
|
+
* Customer who referred.
|
|
858
|
+
* @readonly
|
|
859
|
+
*/
|
|
860
|
+
referringCustomerId?: string;
|
|
861
|
+
/** Status of the ReferredFriend. */
|
|
862
|
+
status?: Status;
|
|
863
|
+
/**
|
|
864
|
+
* 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.
|
|
865
|
+
* @readonly
|
|
866
|
+
*/
|
|
867
|
+
revision?: string | null;
|
|
868
|
+
/**
|
|
869
|
+
* Represents the time this ReferredFriend was created.
|
|
870
|
+
* @readonly
|
|
871
|
+
*/
|
|
872
|
+
_createdDate?: Date;
|
|
873
|
+
/**
|
|
874
|
+
* Represents the time this ReferredFriend was last updated.
|
|
875
|
+
* @readonly
|
|
876
|
+
*/
|
|
877
|
+
_updatedDate?: Date;
|
|
878
|
+
}
|
|
879
|
+
interface DeleteReferredFriendOptions {
|
|
880
|
+
/** The revision of the ReferredFriend. */
|
|
881
|
+
revision?: string;
|
|
882
|
+
}
|
|
883
|
+
interface QueryCursorResult$1 {
|
|
884
|
+
cursors: Cursors$1;
|
|
885
|
+
hasNext: () => boolean;
|
|
886
|
+
hasPrev: () => boolean;
|
|
887
|
+
length: number;
|
|
888
|
+
pageSize: number;
|
|
889
|
+
}
|
|
890
|
+
interface ReferredFriendsQueryResult extends QueryCursorResult$1 {
|
|
891
|
+
items: ReferredFriend[];
|
|
892
|
+
query: ReferredFriendsQueryBuilder;
|
|
893
|
+
next: () => Promise<ReferredFriendsQueryResult>;
|
|
894
|
+
prev: () => Promise<ReferredFriendsQueryResult>;
|
|
895
|
+
}
|
|
896
|
+
interface ReferredFriendsQueryBuilder {
|
|
897
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
898
|
+
* @param value - Value to compare against.
|
|
899
|
+
* @documentationMaturity preview
|
|
900
|
+
*/
|
|
901
|
+
eq: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
|
|
902
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
903
|
+
* @param value - Value to compare against.
|
|
904
|
+
* @documentationMaturity preview
|
|
905
|
+
*/
|
|
906
|
+
ne: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
|
|
907
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
908
|
+
* @param value - Value to compare against.
|
|
909
|
+
* @documentationMaturity preview
|
|
910
|
+
*/
|
|
911
|
+
ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
|
|
912
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
913
|
+
* @param value - Value to compare against.
|
|
914
|
+
* @documentationMaturity preview
|
|
915
|
+
*/
|
|
916
|
+
gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
|
|
917
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
918
|
+
* @param value - Value to compare against.
|
|
919
|
+
* @documentationMaturity preview
|
|
920
|
+
*/
|
|
921
|
+
le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
|
|
922
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
923
|
+
* @param value - Value to compare against.
|
|
924
|
+
* @documentationMaturity preview
|
|
925
|
+
*/
|
|
926
|
+
lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
|
|
927
|
+
/** @param propertyName - Property whose value is compared with `string`.
|
|
928
|
+
* @param string - String to compare against. Case-insensitive.
|
|
929
|
+
* @documentationMaturity preview
|
|
930
|
+
*/
|
|
931
|
+
startsWith: (propertyName: 'referringCustomerId', value: string) => ReferredFriendsQueryBuilder;
|
|
932
|
+
/** @param propertyName - Property whose value is compared with `values`.
|
|
933
|
+
* @param values - List of values to compare against.
|
|
934
|
+
* @documentationMaturity preview
|
|
935
|
+
*/
|
|
936
|
+
hasSome: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any[]) => ReferredFriendsQueryBuilder;
|
|
937
|
+
/** @documentationMaturity preview */
|
|
938
|
+
in: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: any) => ReferredFriendsQueryBuilder;
|
|
939
|
+
/** @documentationMaturity preview */
|
|
940
|
+
exists: (propertyName: 'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate', value: boolean) => ReferredFriendsQueryBuilder;
|
|
941
|
+
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
|
|
942
|
+
* @documentationMaturity preview
|
|
943
|
+
*/
|
|
944
|
+
ascending: (...propertyNames: Array<'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate'>) => ReferredFriendsQueryBuilder;
|
|
945
|
+
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
|
|
946
|
+
* @documentationMaturity preview
|
|
947
|
+
*/
|
|
948
|
+
descending: (...propertyNames: Array<'referringCustomerId' | 'status' | '_createdDate' | '_updatedDate'>) => ReferredFriendsQueryBuilder;
|
|
949
|
+
/** @param limit - Number of items to return, which is also the `pageSize` of the results object.
|
|
950
|
+
* @documentationMaturity preview
|
|
951
|
+
*/
|
|
952
|
+
limit: (limit: number) => ReferredFriendsQueryBuilder;
|
|
953
|
+
/** @param cursor - A pointer to specific record
|
|
954
|
+
* @documentationMaturity preview
|
|
955
|
+
*/
|
|
956
|
+
skipTo: (cursor: string) => ReferredFriendsQueryBuilder;
|
|
957
|
+
/** @documentationMaturity preview */
|
|
958
|
+
find: () => Promise<ReferredFriendsQueryResult>;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
|
|
962
|
+
interface HttpClient$1 {
|
|
963
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
|
|
964
|
+
fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
|
|
965
|
+
}
|
|
966
|
+
type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
|
|
967
|
+
type HttpResponse$1<T = any> = {
|
|
968
|
+
data: T;
|
|
969
|
+
status: number;
|
|
970
|
+
statusText: string;
|
|
971
|
+
headers: any;
|
|
972
|
+
request?: any;
|
|
973
|
+
};
|
|
974
|
+
type RequestOptions$1<_TResponse = any, Data = any> = {
|
|
975
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
976
|
+
url: string;
|
|
977
|
+
data?: Data;
|
|
978
|
+
params?: URLSearchParams;
|
|
979
|
+
} & APIMetadata$1;
|
|
980
|
+
type APIMetadata$1 = {
|
|
981
|
+
methodFqn?: string;
|
|
982
|
+
entityFqdn?: string;
|
|
983
|
+
packageName?: string;
|
|
984
|
+
};
|
|
985
|
+
type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
|
|
986
|
+
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
987
|
+
__type: 'event-definition';
|
|
988
|
+
type: Type;
|
|
989
|
+
isDomainEvent?: boolean;
|
|
990
|
+
transformations?: (envelope: unknown) => Payload;
|
|
991
|
+
__payload: Payload;
|
|
992
|
+
};
|
|
993
|
+
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
994
|
+
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
995
|
+
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
996
|
+
|
|
997
|
+
declare global {
|
|
998
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
999
|
+
interface SymbolConstructor {
|
|
1000
|
+
readonly observable: symbol;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
declare function createReferredFriend$1(httpClient: HttpClient$1): () => Promise<CreateReferredFriendResponse & CreateReferredFriendResponseNonNullableFields>;
|
|
1005
|
+
declare function getReferredFriend$1(httpClient: HttpClient$1): (referredFriendId: string) => Promise<GetReferredFriendResponse & GetReferredFriendResponseNonNullableFields>;
|
|
1006
|
+
declare function getReferredFriendByContactId$1(httpClient: HttpClient$1): (contactId: string) => Promise<ReferredFriend & {
|
|
1007
|
+
_id: string;
|
|
1008
|
+
contactId: string;
|
|
1009
|
+
referringCustomerId: string;
|
|
1010
|
+
status: Status;
|
|
1011
|
+
}>;
|
|
1012
|
+
declare function updateReferredFriend$1(httpClient: HttpClient$1): (_id: string, referredFriend: UpdateReferredFriend) => Promise<ReferredFriend & {
|
|
1013
|
+
_id: string;
|
|
1014
|
+
contactId: string;
|
|
1015
|
+
referringCustomerId: string;
|
|
1016
|
+
status: Status;
|
|
1017
|
+
}>;
|
|
1018
|
+
declare function deleteReferredFriend$1(httpClient: HttpClient$1): (referredFriendId: string, options?: DeleteReferredFriendOptions) => Promise<void>;
|
|
1019
|
+
declare function queryReferredFriend$1(httpClient: HttpClient$1): () => ReferredFriendsQueryBuilder;
|
|
1020
|
+
declare const onReferredFriendCreated$1: EventDefinition$1<ReferredFriendCreatedEnvelope, "wix.loyalty.referral.v1.referred_friend_created">;
|
|
1021
|
+
declare const onReferredFriendUpdated$1: EventDefinition$1<ReferredFriendUpdatedEnvelope, "wix.loyalty.referral.v1.referred_friend_updated">;
|
|
1022
|
+
declare const onReferredFriendDeleted$1: EventDefinition$1<ReferredFriendDeletedEnvelope, "wix.loyalty.referral.v1.referred_friend_deleted">;
|
|
1023
|
+
|
|
1024
|
+
declare const createReferredFriend: BuildRESTFunction$1<typeof createReferredFriend$1>;
|
|
1025
|
+
declare const getReferredFriend: BuildRESTFunction$1<typeof getReferredFriend$1>;
|
|
1026
|
+
declare const getReferredFriendByContactId: BuildRESTFunction$1<typeof getReferredFriendByContactId$1>;
|
|
1027
|
+
declare const updateReferredFriend: BuildRESTFunction$1<typeof updateReferredFriend$1>;
|
|
1028
|
+
declare const deleteReferredFriend: BuildRESTFunction$1<typeof deleteReferredFriend$1>;
|
|
1029
|
+
declare const queryReferredFriend: BuildRESTFunction$1<typeof queryReferredFriend$1>;
|
|
1030
|
+
declare const onReferredFriendCreated: BuildEventDefinition$1<typeof onReferredFriendCreated$1>;
|
|
1031
|
+
declare const onReferredFriendUpdated: BuildEventDefinition$1<typeof onReferredFriendUpdated$1>;
|
|
1032
|
+
declare const onReferredFriendDeleted: BuildEventDefinition$1<typeof onReferredFriendDeleted$1>;
|
|
1033
|
+
|
|
1034
|
+
declare const context$1_createReferredFriend: typeof createReferredFriend;
|
|
1035
|
+
declare const context$1_deleteReferredFriend: typeof deleteReferredFriend;
|
|
1036
|
+
declare const context$1_getReferredFriend: typeof getReferredFriend;
|
|
1037
|
+
declare const context$1_getReferredFriendByContactId: typeof getReferredFriendByContactId;
|
|
1038
|
+
declare const context$1_onReferredFriendCreated: typeof onReferredFriendCreated;
|
|
1039
|
+
declare const context$1_onReferredFriendDeleted: typeof onReferredFriendDeleted;
|
|
1040
|
+
declare const context$1_onReferredFriendUpdated: typeof onReferredFriendUpdated;
|
|
1041
|
+
declare const context$1_queryReferredFriend: typeof queryReferredFriend;
|
|
1042
|
+
declare const context$1_updateReferredFriend: typeof updateReferredFriend;
|
|
1043
|
+
declare namespace context$1 {
|
|
1044
|
+
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 };
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/** ReferringCustomer is the main entity of ReferringCustomers. */
|
|
1048
|
+
interface ReferringCustomer {
|
|
1049
|
+
/**
|
|
1050
|
+
* ReferringCustomer id.
|
|
1051
|
+
* @readonly
|
|
1052
|
+
*/
|
|
1053
|
+
_id?: string;
|
|
1054
|
+
/**
|
|
1055
|
+
* Contact id.
|
|
1056
|
+
* @readonly
|
|
1057
|
+
*/
|
|
1058
|
+
contactId?: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* Referral code.
|
|
1061
|
+
* @readonly
|
|
1062
|
+
*/
|
|
1063
|
+
referralCode?: string;
|
|
1064
|
+
/** 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. */
|
|
1065
|
+
revision?: string | null;
|
|
1066
|
+
/**
|
|
1067
|
+
* Represents the time this ReferringCustomer was created.
|
|
1068
|
+
* @readonly
|
|
1069
|
+
*/
|
|
1070
|
+
_createdDate?: Date;
|
|
1071
|
+
/**
|
|
1072
|
+
* Represents the time this ReferringCustomer was last updated.
|
|
1073
|
+
* @readonly
|
|
1074
|
+
*/
|
|
1075
|
+
_updatedDate?: Date;
|
|
1076
|
+
}
|
|
1077
|
+
interface GenerateReferringCustomerForContactResponse {
|
|
1078
|
+
/** The created ReferringCustomer. */
|
|
1079
|
+
referringCustomer?: ReferringCustomer;
|
|
1080
|
+
}
|
|
1081
|
+
interface GetReferringCustomerByReferralCodeResponse {
|
|
1082
|
+
/** The retrieved ReferringCustomer. */
|
|
1083
|
+
referringCustomer?: ReferringCustomer;
|
|
1084
|
+
}
|
|
1085
|
+
interface Cursors {
|
|
1086
|
+
/** Cursor string pointing to the next page in the list of results. */
|
|
1087
|
+
next?: string | null;
|
|
1088
|
+
/** Cursor pointing to the previous page in the list of results. */
|
|
1089
|
+
prev?: string | null;
|
|
1090
|
+
}
|
|
1091
|
+
interface IdentificationData extends IdentificationDataIdOneOf {
|
|
1092
|
+
/** ID of a site visitor that has not logged in to the site. */
|
|
1093
|
+
anonymousVisitorId?: string;
|
|
1094
|
+
/** ID of a site visitor that has logged in to the site. */
|
|
1095
|
+
memberId?: string;
|
|
1096
|
+
/** ID of a Wix user (site owner, contributor, etc.). */
|
|
1097
|
+
wixUserId?: string;
|
|
1098
|
+
/** ID of an app. */
|
|
1099
|
+
appId?: string;
|
|
1100
|
+
/** @readonly */
|
|
1101
|
+
identityType?: WebhookIdentityType;
|
|
1102
|
+
}
|
|
1103
|
+
/** @oneof */
|
|
1104
|
+
interface IdentificationDataIdOneOf {
|
|
1105
|
+
/** ID of a site visitor that has not logged in to the site. */
|
|
1106
|
+
anonymousVisitorId?: string;
|
|
1107
|
+
/** ID of a site visitor that has logged in to the site. */
|
|
1108
|
+
memberId?: string;
|
|
1109
|
+
/** ID of a Wix user (site owner, contributor, etc.). */
|
|
1110
|
+
wixUserId?: string;
|
|
1111
|
+
/** ID of an app. */
|
|
1112
|
+
appId?: string;
|
|
1113
|
+
}
|
|
1114
|
+
declare enum WebhookIdentityType {
|
|
1115
|
+
UNKNOWN = "UNKNOWN",
|
|
1116
|
+
ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
|
|
1117
|
+
MEMBER = "MEMBER",
|
|
1118
|
+
WIX_USER = "WIX_USER",
|
|
1119
|
+
APP = "APP"
|
|
1120
|
+
}
|
|
1121
|
+
interface GenerateReferringCustomerForContactResponseNonNullableFields {
|
|
1122
|
+
referringCustomer?: {
|
|
1123
|
+
_id: string;
|
|
1124
|
+
contactId: string;
|
|
1125
|
+
referralCode: string;
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
interface GetReferringCustomerByReferralCodeResponseNonNullableFields {
|
|
1129
|
+
referringCustomer?: {
|
|
1130
|
+
_id: string;
|
|
1131
|
+
contactId: string;
|
|
1132
|
+
referralCode: string;
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
interface BaseEventMetadata {
|
|
1136
|
+
/** App instance ID. */
|
|
1137
|
+
instanceId?: string | null;
|
|
1138
|
+
/** Event type. */
|
|
1139
|
+
eventType?: string;
|
|
1140
|
+
/** The identification type and identity data. */
|
|
1141
|
+
identity?: IdentificationData;
|
|
1142
|
+
}
|
|
1143
|
+
interface EventMetadata extends BaseEventMetadata {
|
|
1144
|
+
/**
|
|
1145
|
+
* Unique event ID.
|
|
1146
|
+
* Allows clients to ignore duplicate webhooks.
|
|
1147
|
+
*/
|
|
1148
|
+
_id?: string;
|
|
1149
|
+
/**
|
|
1150
|
+
* Assumes actions are also always typed to an entity_type
|
|
1151
|
+
* Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
|
|
1152
|
+
*/
|
|
1153
|
+
entityFqdn?: string;
|
|
1154
|
+
/**
|
|
1155
|
+
* This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
|
|
1156
|
+
* This is although the created/updated/deleted notion is duplication of the oneof types
|
|
1157
|
+
* Example: created/updated/deleted/started/completed/email_opened
|
|
1158
|
+
*/
|
|
1159
|
+
slug?: string;
|
|
1160
|
+
/** ID of the entity associated with the event. */
|
|
1161
|
+
entityId?: string;
|
|
1162
|
+
/** Event timestamp. */
|
|
1163
|
+
eventTime?: Date;
|
|
1164
|
+
/**
|
|
1165
|
+
* Whether the event was triggered as a result of a privacy regulation application
|
|
1166
|
+
* (for example, GDPR).
|
|
1167
|
+
*/
|
|
1168
|
+
triggeredByAnonymizeRequest?: boolean | null;
|
|
1169
|
+
/** If present, indicates the action that triggered the event. */
|
|
1170
|
+
originatedFrom?: string | null;
|
|
1171
|
+
/**
|
|
1172
|
+
* A sequence number defining the order of updates to the underlying entity.
|
|
1173
|
+
* For example, given that some entity was updated at 16:00 and than again at 16:01,
|
|
1174
|
+
* it is guaranteed that the sequence number of the second update is strictly higher than the first.
|
|
1175
|
+
* As the consumer, you can use this value to ensure that you handle messages in the correct order.
|
|
1176
|
+
* To do so, you will need to persist this number on your end, and compare the sequence number from the
|
|
1177
|
+
* message against the one you have stored. Given that the stored number is higher, you should ignore the message.
|
|
1178
|
+
*/
|
|
1179
|
+
entityEventSequence?: string | null;
|
|
1180
|
+
}
|
|
1181
|
+
interface ReferringCustomerCreatedEnvelope {
|
|
1182
|
+
entity: ReferringCustomer;
|
|
1183
|
+
metadata: EventMetadata;
|
|
1184
|
+
}
|
|
1185
|
+
interface ReferringCustomerDeletedEnvelope {
|
|
1186
|
+
metadata: EventMetadata;
|
|
1187
|
+
}
|
|
1188
|
+
interface QueryCursorResult {
|
|
1189
|
+
cursors: Cursors;
|
|
1190
|
+
hasNext: () => boolean;
|
|
1191
|
+
hasPrev: () => boolean;
|
|
1192
|
+
length: number;
|
|
1193
|
+
pageSize: number;
|
|
1194
|
+
}
|
|
1195
|
+
interface ReferringCustomersQueryResult extends QueryCursorResult {
|
|
1196
|
+
items: ReferringCustomer[];
|
|
1197
|
+
query: ReferringCustomersQueryBuilder;
|
|
1198
|
+
next: () => Promise<ReferringCustomersQueryResult>;
|
|
1199
|
+
prev: () => Promise<ReferringCustomersQueryResult>;
|
|
1200
|
+
}
|
|
1201
|
+
interface ReferringCustomersQueryBuilder {
|
|
1202
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
1203
|
+
* @param value - Value to compare against.
|
|
1204
|
+
* @documentationMaturity preview
|
|
1205
|
+
*/
|
|
1206
|
+
eq: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
|
|
1207
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
1208
|
+
* @param value - Value to compare against.
|
|
1209
|
+
* @documentationMaturity preview
|
|
1210
|
+
*/
|
|
1211
|
+
ne: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
|
|
1212
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
1213
|
+
* @param value - Value to compare against.
|
|
1214
|
+
* @documentationMaturity preview
|
|
1215
|
+
*/
|
|
1216
|
+
ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
|
|
1217
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
1218
|
+
* @param value - Value to compare against.
|
|
1219
|
+
* @documentationMaturity preview
|
|
1220
|
+
*/
|
|
1221
|
+
gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
|
|
1222
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
1223
|
+
* @param value - Value to compare against.
|
|
1224
|
+
* @documentationMaturity preview
|
|
1225
|
+
*/
|
|
1226
|
+
le: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
|
|
1227
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
1228
|
+
* @param value - Value to compare against.
|
|
1229
|
+
* @documentationMaturity preview
|
|
1230
|
+
*/
|
|
1231
|
+
lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
|
|
1232
|
+
/** @param propertyName - Property whose value is compared with `string`.
|
|
1233
|
+
* @param string - String to compare against. Case-insensitive.
|
|
1234
|
+
* @documentationMaturity preview
|
|
1235
|
+
*/
|
|
1236
|
+
startsWith: (propertyName: 'contactId' | 'referralCode', value: string) => ReferringCustomersQueryBuilder;
|
|
1237
|
+
/** @param propertyName - Property whose value is compared with `values`.
|
|
1238
|
+
* @param values - List of values to compare against.
|
|
1239
|
+
* @documentationMaturity preview
|
|
1240
|
+
*/
|
|
1241
|
+
hasSome: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: any[]) => ReferringCustomersQueryBuilder;
|
|
1242
|
+
/** @documentationMaturity preview */
|
|
1243
|
+
in: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: any) => ReferringCustomersQueryBuilder;
|
|
1244
|
+
/** @documentationMaturity preview */
|
|
1245
|
+
exists: (propertyName: 'contactId' | 'referralCode' | '_createdDate' | '_updatedDate', value: boolean) => ReferringCustomersQueryBuilder;
|
|
1246
|
+
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
|
|
1247
|
+
* @documentationMaturity preview
|
|
1248
|
+
*/
|
|
1249
|
+
ascending: (...propertyNames: Array<'contactId' | 'referralCode' | '_createdDate' | '_updatedDate'>) => ReferringCustomersQueryBuilder;
|
|
1250
|
+
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
|
|
1251
|
+
* @documentationMaturity preview
|
|
1252
|
+
*/
|
|
1253
|
+
descending: (...propertyNames: Array<'contactId' | 'referralCode' | '_createdDate' | '_updatedDate'>) => ReferringCustomersQueryBuilder;
|
|
1254
|
+
/** @param limit - Number of items to return, which is also the `pageSize` of the results object.
|
|
1255
|
+
* @documentationMaturity preview
|
|
1256
|
+
*/
|
|
1257
|
+
limit: (limit: number) => ReferringCustomersQueryBuilder;
|
|
1258
|
+
/** @param cursor - A pointer to specific record
|
|
1259
|
+
* @documentationMaturity preview
|
|
1260
|
+
*/
|
|
1261
|
+
skipTo: (cursor: string) => ReferringCustomersQueryBuilder;
|
|
1262
|
+
/** @documentationMaturity preview */
|
|
1263
|
+
find: () => Promise<ReferringCustomersQueryResult>;
|
|
1264
|
+
}
|
|
1265
|
+
interface DeleteReferringCustomerOptions {
|
|
1266
|
+
/** The revision of the ReferringCustomer. */
|
|
1267
|
+
revision?: string;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
1271
|
+
interface HttpClient {
|
|
1272
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
1273
|
+
fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
|
|
1274
|
+
}
|
|
1275
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
1276
|
+
type HttpResponse<T = any> = {
|
|
1277
|
+
data: T;
|
|
1278
|
+
status: number;
|
|
1279
|
+
statusText: string;
|
|
1280
|
+
headers: any;
|
|
1281
|
+
request?: any;
|
|
1282
|
+
};
|
|
1283
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
1284
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1285
|
+
url: string;
|
|
1286
|
+
data?: Data;
|
|
1287
|
+
params?: URLSearchParams;
|
|
1288
|
+
} & APIMetadata;
|
|
1289
|
+
type APIMetadata = {
|
|
1290
|
+
methodFqn?: string;
|
|
1291
|
+
entityFqdn?: string;
|
|
1292
|
+
packageName?: string;
|
|
1293
|
+
};
|
|
1294
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
1295
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
1296
|
+
__type: 'event-definition';
|
|
1297
|
+
type: Type;
|
|
1298
|
+
isDomainEvent?: boolean;
|
|
1299
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1300
|
+
__payload: Payload;
|
|
1301
|
+
};
|
|
1302
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
1303
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
1304
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
1305
|
+
|
|
1306
|
+
declare global {
|
|
1307
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1308
|
+
interface SymbolConstructor {
|
|
1309
|
+
readonly observable: symbol;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
declare function generateReferringCustomerForContact$1(httpClient: HttpClient): (contactId: string) => Promise<GenerateReferringCustomerForContactResponse & GenerateReferringCustomerForContactResponseNonNullableFields>;
|
|
1314
|
+
declare function getReferringCustomer$1(httpClient: HttpClient): (referringCustomerId: string) => Promise<ReferringCustomer & {
|
|
1315
|
+
_id: string;
|
|
1316
|
+
contactId: string;
|
|
1317
|
+
referralCode: string;
|
|
1318
|
+
}>;
|
|
1319
|
+
declare function getReferringCustomerByReferralCode$1(httpClient: HttpClient): (referralCode: string) => Promise<GetReferringCustomerByReferralCodeResponse & GetReferringCustomerByReferralCodeResponseNonNullableFields>;
|
|
1320
|
+
declare function queryReferringCustomers$1(httpClient: HttpClient): () => ReferringCustomersQueryBuilder;
|
|
1321
|
+
declare function deleteReferringCustomer$1(httpClient: HttpClient): (referringCustomerId: string, options?: DeleteReferringCustomerOptions) => Promise<void>;
|
|
1322
|
+
declare const onReferringCustomerCreated$1: EventDefinition<ReferringCustomerCreatedEnvelope, "wix.loyalty.referral.v1.referring_customer_created">;
|
|
1323
|
+
declare const onReferringCustomerDeleted$1: EventDefinition<ReferringCustomerDeletedEnvelope, "wix.loyalty.referral.v1.referring_customer_deleted">;
|
|
658
1324
|
|
|
659
|
-
declare const
|
|
660
|
-
declare const
|
|
661
|
-
declare const
|
|
662
|
-
declare const
|
|
663
|
-
declare const
|
|
664
|
-
declare const
|
|
1325
|
+
declare const generateReferringCustomerForContact: BuildRESTFunction<typeof generateReferringCustomerForContact$1>;
|
|
1326
|
+
declare const getReferringCustomer: BuildRESTFunction<typeof getReferringCustomer$1>;
|
|
1327
|
+
declare const getReferringCustomerByReferralCode: BuildRESTFunction<typeof getReferringCustomerByReferralCode$1>;
|
|
1328
|
+
declare const queryReferringCustomers: BuildRESTFunction<typeof queryReferringCustomers$1>;
|
|
1329
|
+
declare const deleteReferringCustomer: BuildRESTFunction<typeof deleteReferringCustomer$1>;
|
|
1330
|
+
declare const onReferringCustomerCreated: BuildEventDefinition<typeof onReferringCustomerCreated$1>;
|
|
1331
|
+
declare const onReferringCustomerDeleted: BuildEventDefinition<typeof onReferringCustomerDeleted$1>;
|
|
665
1332
|
|
|
666
|
-
declare const
|
|
667
|
-
declare const
|
|
668
|
-
declare const
|
|
669
|
-
declare const
|
|
670
|
-
declare const
|
|
671
|
-
declare const
|
|
1333
|
+
declare const context_deleteReferringCustomer: typeof deleteReferringCustomer;
|
|
1334
|
+
declare const context_generateReferringCustomerForContact: typeof generateReferringCustomerForContact;
|
|
1335
|
+
declare const context_getReferringCustomer: typeof getReferringCustomer;
|
|
1336
|
+
declare const context_getReferringCustomerByReferralCode: typeof getReferringCustomerByReferralCode;
|
|
1337
|
+
declare const context_onReferringCustomerCreated: typeof onReferringCustomerCreated;
|
|
1338
|
+
declare const context_onReferringCustomerDeleted: typeof onReferringCustomerDeleted;
|
|
1339
|
+
declare const context_queryReferringCustomers: typeof queryReferringCustomers;
|
|
672
1340
|
declare namespace context {
|
|
673
|
-
export {
|
|
1341
|
+
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 };
|
|
674
1342
|
}
|
|
675
1343
|
|
|
676
|
-
export { context as tracker };
|
|
1344
|
+
export { context as customers, context$1 as friends, context$2 as tracker };
|