@wix/referral 1.0.39 → 1.0.40

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,9 +1,9 @@
1
- type HostModule<T, H extends Host> = {
1
+ type HostModule$4<T, H extends Host$4> = {
2
2
  __type: 'host';
3
3
  create(host: H): T;
4
4
  };
5
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
- type Host<Environment = unknown> = {
5
+ type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
6
+ type Host$4<Environment = unknown> = {
7
7
  channel: {
8
8
  observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
9
  disconnect: () => void;
@@ -36,92 +36,92 @@ type Host<Environment = unknown> = {
36
36
  };
37
37
  };
38
38
 
39
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
40
- interface HttpClient {
41
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
39
+ type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
40
+ interface HttpClient$4 {
41
+ request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
42
42
  fetchWithAuth: typeof fetch;
43
43
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
44
44
  getActiveToken?: () => string | undefined;
45
45
  }
46
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
47
- type HttpResponse<T = any> = {
46
+ type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
47
+ type HttpResponse$4<T = any> = {
48
48
  data: T;
49
49
  status: number;
50
50
  statusText: string;
51
51
  headers: any;
52
52
  request?: any;
53
53
  };
54
- type RequestOptions<_TResponse = any, Data = any> = {
54
+ type RequestOptions$4<_TResponse = any, Data = any> = {
55
55
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
56
56
  url: string;
57
57
  data?: Data;
58
58
  params?: URLSearchParams;
59
- } & APIMetadata;
60
- type APIMetadata = {
59
+ } & APIMetadata$4;
60
+ type APIMetadata$4 = {
61
61
  methodFqn?: string;
62
62
  entityFqdn?: string;
63
63
  packageName?: string;
64
64
  };
65
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
66
- type EventDefinition$4<Payload = unknown, Type extends string = string> = {
65
+ type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
66
+ type EventDefinition$8<Payload = unknown, Type extends string = string> = {
67
67
  __type: 'event-definition';
68
68
  type: Type;
69
69
  isDomainEvent?: boolean;
70
70
  transformations?: (envelope: unknown) => Payload;
71
71
  __payload: Payload;
72
72
  };
73
- declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
74
- type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
75
- type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
73
+ declare function EventDefinition$8<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$8<Payload, Type>;
74
+ type EventHandler$8<T extends EventDefinition$8> = (payload: T['__payload']) => void | Promise<void>;
75
+ type BuildEventDefinition$8<T extends EventDefinition$8<any, string>> = (handler: EventHandler$8<T>) => void;
76
76
 
77
- type ServicePluginMethodInput = {
77
+ type ServicePluginMethodInput$4 = {
78
78
  request: any;
79
79
  metadata: any;
80
80
  };
81
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
82
- type ServicePluginMethodMetadata = {
81
+ type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
82
+ type ServicePluginMethodMetadata$4 = {
83
83
  name: string;
84
84
  primaryHttpMappingPath: string;
85
85
  transformations: {
86
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
86
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
87
87
  toREST: (...args: unknown[]) => unknown;
88
88
  };
89
89
  };
90
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
90
+ type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
91
91
  __type: 'service-plugin-definition';
92
92
  componentType: string;
93
- methods: ServicePluginMethodMetadata[];
93
+ methods: ServicePluginMethodMetadata$4[];
94
94
  __contract: Contract;
95
95
  };
96
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
97
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
98
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
96
+ declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
97
+ type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
98
+ declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
99
99
 
100
- type RequestContext = {
100
+ type RequestContext$4 = {
101
101
  isSSR: boolean;
102
102
  host: string;
103
103
  protocol?: string;
104
104
  };
105
- type ResponseTransformer = (data: any, headers?: any) => any;
105
+ type ResponseTransformer$4 = (data: any, headers?: any) => any;
106
106
  /**
107
107
  * Ambassador request options types are copied mostly from AxiosRequestConfig.
108
108
  * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
109
109
  * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
110
110
  */
111
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
112
- type AmbassadorRequestOptions<T = any> = {
111
+ type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
112
+ type AmbassadorRequestOptions$4<T = any> = {
113
113
  _?: T;
114
114
  url?: string;
115
- method?: Method;
115
+ method?: Method$4;
116
116
  params?: any;
117
117
  data?: any;
118
- transformResponse?: ResponseTransformer | ResponseTransformer[];
118
+ transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
119
119
  };
120
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
120
+ type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
121
121
  __isAmbassador: boolean;
122
122
  };
123
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
124
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
123
+ type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
124
+ type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
125
125
 
126
126
  declare global {
127
127
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -130,7 +130,7 @@ declare global {
130
130
  }
131
131
  }
132
132
 
133
- declare const emptyObjectSymbol: unique symbol;
133
+ declare const emptyObjectSymbol$4: unique symbol;
134
134
 
135
135
  /**
136
136
  Represents a strictly empty plain object, the `{}` value.
@@ -158,7 +158,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
158
158
 
159
159
  @category Object
160
160
  */
161
- type EmptyObject = {[emptyObjectSymbol]?: never};
161
+ type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
162
162
 
163
163
  /**
164
164
  Returns a boolean for whether the two given types are equal.
@@ -186,7 +186,7 @@ type Includes<Value extends readonly any[], Item> =
186
186
  @category Type Guard
187
187
  @category Utilities
188
188
  */
189
- type IsEqual<A, B> =
189
+ type IsEqual$4<A, B> =
190
190
  (<G>() => G extends A ? 1 : 2) extends
191
191
  (<G>() => G extends B ? 1 : 2)
192
192
  ? true
@@ -219,9 +219,9 @@ type Filtered = Filter<'bar', 'foo'>;
219
219
 
220
220
  @see {Except}
221
221
  */
222
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
222
+ type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
223
223
 
224
- type ExceptOptions = {
224
+ type ExceptOptions$4 = {
225
225
  /**
226
226
  Disallow assigning non-specified properties.
227
227
 
@@ -265,8 +265,8 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
265
265
 
266
266
  @category Object
267
267
  */
268
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
269
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
268
+ type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
269
+ [KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
270
270
  } & (Options['requireExactProps'] extends true
271
271
  ? Partial<Record<KeysType, never>>
272
272
  : {});
@@ -303,7 +303,7 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
303
303
 
304
304
  @category Object
305
305
  */
306
- type ConditionalKeys<Base, Condition> = NonNullable<
306
+ type ConditionalKeys$4<Base, Condition> = NonNullable<
307
307
  // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
308
308
  {
309
309
  // Map through all the keys of the given base type.
@@ -357,9 +357,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
357
357
 
358
358
  @category Object
359
359
  */
360
- type ConditionalExcept<Base, Condition> = Except<
360
+ type ConditionalExcept$4<Base, Condition> = Except$4<
361
361
  Base,
362
- ConditionalKeys<Base, Condition>
362
+ ConditionalKeys$4<Base, Condition>
363
363
  >;
364
364
 
365
365
  /**
@@ -367,8 +367,8 @@ ConditionalKeys<Base, Condition>
367
367
  * can either be a REST module or a host module.
368
368
  * This type is recursive, so it can describe nested modules.
369
369
  */
370
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$4<any> | ServicePluginDefinition<any> | {
371
- [key: string]: Descriptors | PublicMetadata | any;
370
+ type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$8<any> | ServicePluginDefinition$4<any> | {
371
+ [key: string]: Descriptors$4 | PublicMetadata$4 | any;
372
372
  };
373
373
  /**
374
374
  * This type takes in a descriptors object of a certain Host (including an `unknown` host)
@@ -376,12 +376,12 @@ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostM
376
376
  * Any non-descriptor properties are removed from the returned object, including descriptors that
377
377
  * do not match the given host (as they will not work with the given host).
378
378
  */
379
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
379
+ type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
380
380
  done: T;
381
381
  recurse: T extends {
382
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
383
- } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
384
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
382
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
383
+ } ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$8<any> ? BuildEventDefinition$8<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
384
+ [Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
385
385
  -1,
386
386
  0,
387
387
  1,
@@ -390,9 +390,9 @@ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, De
390
390
  4,
391
391
  5
392
392
  ][Depth]> : never;
393
- }, EmptyObject>;
393
+ }, EmptyObject$4>;
394
394
  }[Depth extends -1 ? 'done' : 'recurse'];
395
- type PublicMetadata = {
395
+ type PublicMetadata$4 = {
396
396
  PACKAGE_NAME?: string;
397
397
  };
398
398
 
@@ -404,9 +404,9 @@ declare global {
404
404
  * A type used to create concerete types from SDK descriptors in
405
405
  * case a contextual client is available.
406
406
  */
407
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
408
- host: Host;
409
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
407
+ type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
408
+ host: Host$4;
409
+ } ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
410
410
 
411
411
  interface ReferralProgram {
412
412
  /** Referral program name. */
@@ -1788,14 +1788,14 @@ interface GenerateAiSocialMediaPostsSuggestionsOptions {
1788
1788
  topic?: string;
1789
1789
  }
1790
1790
 
1791
- declare function getReferralProgram$1(httpClient: HttpClient): GetReferralProgramSignature;
1791
+ declare function getReferralProgram$1(httpClient: HttpClient$4): GetReferralProgramSignature;
1792
1792
  interface GetReferralProgramSignature {
1793
1793
  /**
1794
1794
  * Retrieves the referral program.
1795
1795
  */
1796
1796
  (): Promise<GetReferralProgramResponse & GetReferralProgramResponseNonNullableFields>;
1797
1797
  }
1798
- declare function updateReferralProgram$1(httpClient: HttpClient): UpdateReferralProgramSignature;
1798
+ declare function updateReferralProgram$1(httpClient: HttpClient$4): UpdateReferralProgramSignature;
1799
1799
  interface UpdateReferralProgramSignature {
1800
1800
  /**
1801
1801
  * Updates a referral program. Supports partial updates.
@@ -1806,21 +1806,21 @@ interface UpdateReferralProgramSignature {
1806
1806
  */
1807
1807
  (referralProgram: ReferralProgram): Promise<UpdateReferralProgramResponse & UpdateReferralProgramResponseNonNullableFields>;
1808
1808
  }
1809
- declare function activateReferralProgram$1(httpClient: HttpClient): ActivateReferralProgramSignature;
1809
+ declare function activateReferralProgram$1(httpClient: HttpClient$4): ActivateReferralProgramSignature;
1810
1810
  interface ActivateReferralProgramSignature {
1811
1811
  /**
1812
1812
  * Activates the referral program, changing its status to `ACTIVE`.
1813
1813
  */
1814
1814
  (): Promise<ActivateReferralProgramResponse & ActivateReferralProgramResponseNonNullableFields>;
1815
1815
  }
1816
- declare function pauseReferralProgram$1(httpClient: HttpClient): PauseReferralProgramSignature;
1816
+ declare function pauseReferralProgram$1(httpClient: HttpClient$4): PauseReferralProgramSignature;
1817
1817
  interface PauseReferralProgramSignature {
1818
1818
  /**
1819
1819
  * Pauses the referral program, changing its status to `PAUSED`.
1820
1820
  */
1821
1821
  (): Promise<PauseReferralProgramResponse & PauseReferralProgramResponseNonNullableFields>;
1822
1822
  }
1823
- declare function getAiSocialMediaPostsSuggestions$1(httpClient: HttpClient): GetAiSocialMediaPostsSuggestionsSignature;
1823
+ declare function getAiSocialMediaPostsSuggestions$1(httpClient: HttpClient$4): GetAiSocialMediaPostsSuggestionsSignature;
1824
1824
  interface GetAiSocialMediaPostsSuggestionsSignature {
1825
1825
  /**
1826
1826
  * Retrieves pre-generated AI social media post suggestions for promoting the referral program.
@@ -1832,7 +1832,7 @@ interface GetAiSocialMediaPostsSuggestionsSignature {
1832
1832
  */
1833
1833
  (options?: GetAiSocialMediaPostsSuggestionsOptions | undefined): Promise<GetAISocialMediaPostsSuggestionsResponse & GetAISocialMediaPostsSuggestionsResponseNonNullableFields>;
1834
1834
  }
1835
- declare function generateAiSocialMediaPostsSuggestions$1(httpClient: HttpClient): GenerateAiSocialMediaPostsSuggestionsSignature;
1835
+ declare function generateAiSocialMediaPostsSuggestions$1(httpClient: HttpClient$4): GenerateAiSocialMediaPostsSuggestionsSignature;
1836
1836
  interface GenerateAiSocialMediaPostsSuggestionsSignature {
1837
1837
  /**
1838
1838
  * Creates new AI-generated social media post suggestions for promoting the referral program.
@@ -1843,25 +1843,25 @@ interface GenerateAiSocialMediaPostsSuggestionsSignature {
1843
1843
  */
1844
1844
  (options?: GenerateAiSocialMediaPostsSuggestionsOptions | undefined): Promise<GenerateAISocialMediaPostsSuggestionsResponse & GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields>;
1845
1845
  }
1846
- declare function getReferralProgramPremiumFeatures$1(httpClient: HttpClient): GetReferralProgramPremiumFeaturesSignature;
1846
+ declare function getReferralProgramPremiumFeatures$1(httpClient: HttpClient$4): GetReferralProgramPremiumFeaturesSignature;
1847
1847
  interface GetReferralProgramPremiumFeaturesSignature {
1848
1848
  /**
1849
1849
  * Retrieves information about the enabled premium features for the referral program.
1850
1850
  */
1851
1851
  (): Promise<GetReferralProgramPremiumFeaturesResponse & GetReferralProgramPremiumFeaturesResponseNonNullableFields>;
1852
1852
  }
1853
- declare const onProgramUpdated$1: EventDefinition$4<ProgramUpdatedEnvelope, "wix.loyalty.referral.v1.program_updated">;
1853
+ declare const onProgramUpdated$1: EventDefinition$8<ProgramUpdatedEnvelope, "wix.loyalty.referral.v1.program_updated">;
1854
1854
 
1855
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
1855
+ type EventDefinition$7<Payload = unknown, Type extends string = string> = {
1856
1856
  __type: 'event-definition';
1857
1857
  type: Type;
1858
1858
  isDomainEvent?: boolean;
1859
1859
  transformations?: (envelope: unknown) => Payload;
1860
1860
  __payload: Payload;
1861
1861
  };
1862
- declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
1863
- type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
1864
- type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
1862
+ declare function EventDefinition$7<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$7<Payload, Type>;
1863
+ type EventHandler$7<T extends EventDefinition$7> = (payload: T['__payload']) => void | Promise<void>;
1864
+ type BuildEventDefinition$7<T extends EventDefinition$7<any, string>> = (handler: EventHandler$7<T>) => void;
1865
1865
 
1866
1866
  declare global {
1867
1867
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -1870,15 +1870,15 @@ declare global {
1870
1870
  }
1871
1871
  }
1872
1872
 
1873
- declare function createEventModule$3<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
1873
+ declare function createEventModule$3<T extends EventDefinition$7<any, string>>(eventDefinition: T): BuildEventDefinition$7<T> & T;
1874
1874
 
1875
- declare const getReferralProgram: MaybeContext<BuildRESTFunction<typeof getReferralProgram$1> & typeof getReferralProgram$1>;
1876
- declare const updateReferralProgram: MaybeContext<BuildRESTFunction<typeof updateReferralProgram$1> & typeof updateReferralProgram$1>;
1877
- declare const activateReferralProgram: MaybeContext<BuildRESTFunction<typeof activateReferralProgram$1> & typeof activateReferralProgram$1>;
1878
- declare const pauseReferralProgram: MaybeContext<BuildRESTFunction<typeof pauseReferralProgram$1> & typeof pauseReferralProgram$1>;
1879
- declare const getAiSocialMediaPostsSuggestions: MaybeContext<BuildRESTFunction<typeof getAiSocialMediaPostsSuggestions$1> & typeof getAiSocialMediaPostsSuggestions$1>;
1880
- declare const generateAiSocialMediaPostsSuggestions: MaybeContext<BuildRESTFunction<typeof generateAiSocialMediaPostsSuggestions$1> & typeof generateAiSocialMediaPostsSuggestions$1>;
1881
- declare const getReferralProgramPremiumFeatures: MaybeContext<BuildRESTFunction<typeof getReferralProgramPremiumFeatures$1> & typeof getReferralProgramPremiumFeatures$1>;
1875
+ declare const getReferralProgram: MaybeContext$4<BuildRESTFunction$4<typeof getReferralProgram$1> & typeof getReferralProgram$1>;
1876
+ declare const updateReferralProgram: MaybeContext$4<BuildRESTFunction$4<typeof updateReferralProgram$1> & typeof updateReferralProgram$1>;
1877
+ declare const activateReferralProgram: MaybeContext$4<BuildRESTFunction$4<typeof activateReferralProgram$1> & typeof activateReferralProgram$1>;
1878
+ declare const pauseReferralProgram: MaybeContext$4<BuildRESTFunction$4<typeof pauseReferralProgram$1> & typeof pauseReferralProgram$1>;
1879
+ declare const getAiSocialMediaPostsSuggestions: MaybeContext$4<BuildRESTFunction$4<typeof getAiSocialMediaPostsSuggestions$1> & typeof getAiSocialMediaPostsSuggestions$1>;
1880
+ declare const generateAiSocialMediaPostsSuggestions: MaybeContext$4<BuildRESTFunction$4<typeof generateAiSocialMediaPostsSuggestions$1> & typeof generateAiSocialMediaPostsSuggestions$1>;
1881
+ declare const getReferralProgramPremiumFeatures: MaybeContext$4<BuildRESTFunction$4<typeof getReferralProgramPremiumFeatures$1> & typeof getReferralProgramPremiumFeatures$1>;
1882
1882
 
1883
1883
  type _publicOnProgramUpdatedType = typeof onProgramUpdated$1;
1884
1884
  /**
@@ -2007,169 +2007,579 @@ declare namespace context$4 {
2007
2007
  export { type context$4_AISocialMediaPostSuggestion as AISocialMediaPostSuggestion, context$4_Action as Action, type ActionEvent$4 as ActionEvent, type context$4_ActivateReferralProgramRequest as ActivateReferralProgramRequest, type context$4_ActivateReferralProgramResponse as ActivateReferralProgramResponse, type context$4_ActivateReferralProgramResponseNonNullableFields as ActivateReferralProgramResponseNonNullableFields, context$4_App as App, type context$4_Asset as Asset, type BaseEventMetadata$3 as BaseEventMetadata, type context$4_BillingReference as BillingReference, type context$4_BulkGetReferralProgramRequest as BulkGetReferralProgramRequest, type context$4_BulkGetReferralProgramResponse as BulkGetReferralProgramResponse, type context$4_CancellationDetails as CancellationDetails, context$4_ContractSwitchReason as ContractSwitchReason, context$4_ContractSwitchType as ContractSwitchType, type context$4_ContractSwitched as ContractSwitched, type Coupon$2 as Coupon, type CouponDiscountTypeOptionsOneOf$2 as CouponDiscountTypeOptionsOneOf, type CouponScope$2 as CouponScope, type CouponScopeOrMinSubtotalOneOf$2 as CouponScopeOrMinSubtotalOneOf, type context$4_Cycle as Cycle, type context$4_CycleCycleSelectorOneOf as CycleCycleSelectorOneOf, type context$4_DeleteContext as DeleteContext, context$4_DeleteStatus as DeleteStatus, DiscountType$2 as DiscountType, type DomainEvent$4 as DomainEvent, type DomainEventBodyOneOf$4 as DomainEventBodyOneOf, type context$4_Emails as Emails, type Empty$3 as Empty, type EntityCreatedEvent$4 as EntityCreatedEvent, type EntityDeletedEvent$4 as EntityDeletedEvent, type EntityUpdatedEvent$4 as EntityUpdatedEvent, type EventMetadata$3 as EventMetadata, type FixedAmountDiscount$2 as FixedAmountDiscount, type context$4_GenerateAISocialMediaPostsSuggestionsRequest as GenerateAISocialMediaPostsSuggestionsRequest, type context$4_GenerateAISocialMediaPostsSuggestionsResponse as GenerateAISocialMediaPostsSuggestionsResponse, type context$4_GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields as GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields, type context$4_GenerateAiSocialMediaPostsSuggestionsOptions as GenerateAiSocialMediaPostsSuggestionsOptions, type context$4_GetAISocialMediaPostsSuggestionsRequest as GetAISocialMediaPostsSuggestionsRequest, type context$4_GetAISocialMediaPostsSuggestionsResponse as GetAISocialMediaPostsSuggestionsResponse, type context$4_GetAISocialMediaPostsSuggestionsResponseNonNullableFields as GetAISocialMediaPostsSuggestionsResponseNonNullableFields, type context$4_GetAiSocialMediaPostsSuggestionsOptions as GetAiSocialMediaPostsSuggestionsOptions, type context$4_GetReferralProgramPremiumFeaturesRequest as GetReferralProgramPremiumFeaturesRequest, type context$4_GetReferralProgramPremiumFeaturesResponse as GetReferralProgramPremiumFeaturesResponse, type context$4_GetReferralProgramPremiumFeaturesResponseNonNullableFields as GetReferralProgramPremiumFeaturesResponseNonNullableFields, type context$4_GetReferralProgramRequest as GetReferralProgramRequest, type context$4_GetReferralProgramResponse as GetReferralProgramResponse, type context$4_GetReferralProgramResponseNonNullableFields as GetReferralProgramResponseNonNullableFields, type Group$2 as Group, type context$4_HtmlSitePublished as HtmlSitePublished, type IdentificationData$4 as IdentificationData, type IdentificationDataIdOneOf$4 as IdentificationDataIdOneOf, context$4_Initiator as Initiator, type context$4_Interval as Interval, context$4_IntervalUnit as IntervalUnit, type LoyaltyPoints$2 as LoyaltyPoints, type MessageEnvelope$4 as MessageEnvelope, type context$4_MetaSiteSpecialEvent as MetaSiteSpecialEvent, type context$4_MetaSiteSpecialEventPayloadOneOf as MetaSiteSpecialEventPayloadOneOf, context$4_Namespace as Namespace, type context$4_NamespaceChanged as NamespaceChanged, type context$4_OneTime as OneTime, type context$4_Page as Page, type context$4_PauseReferralProgramRequest as PauseReferralProgramRequest, type context$4_PauseReferralProgramResponse as PauseReferralProgramResponse, type context$4_PauseReferralProgramResponseNonNullableFields as PauseReferralProgramResponseNonNullableFields, type PercentageDiscount$2 as PercentageDiscount, type context$4_PremiumFeatures as PremiumFeatures, context$4_PriceIncreaseTrigger as PriceIncreaseTrigger, context$4_ProductAdjustment as ProductAdjustment, type context$4_ProductPriceIncreaseData as ProductPriceIncreaseData, type context$4_ProgramInSite as ProgramInSite, context$4_ProgramStatus as ProgramStatus, type context$4_ProgramUpdatedEnvelope as ProgramUpdatedEnvelope, context$4_ProviderName as ProviderName, type context$4_ReactivationData as ReactivationData, context$4_ReactivationReasonEnum as ReactivationReasonEnum, type context$4_RecurringChargeSucceeded as RecurringChargeSucceeded, type context$4_ReferralProgram as ReferralProgram, type RestoreInfo$4 as RestoreInfo, type Reward$2 as Reward, type RewardOptionsOneOf$1 as RewardOptionsOneOf, type context$4_ServiceProvisioned as ServiceProvisioned, type context$4_ServiceRemoved as ServiceRemoved, type context$4_SiteCreated as SiteCreated, context$4_SiteCreatedContext as SiteCreatedContext, type context$4_SiteDeleted as SiteDeleted, type context$4_SiteHardDeleted as SiteHardDeleted, type context$4_SiteMarkedAsTemplate as SiteMarkedAsTemplate, type context$4_SiteMarkedAsWixSite as SiteMarkedAsWixSite, type context$4_SitePublished as SitePublished, type context$4_SiteRenamed as SiteRenamed, type context$4_SiteTransferred as SiteTransferred, type context$4_SiteUndeleted as SiteUndeleted, type context$4_SiteUnpublished as SiteUnpublished, context$4_State as State, type context$4_StudioAssigned as StudioAssigned, type context$4_StudioUnassigned as StudioUnassigned, type context$4_Subscription as Subscription, type context$4_SubscriptionAssigned as SubscriptionAssigned, type context$4_SubscriptionAutoRenewTurnedOff as SubscriptionAutoRenewTurnedOff, type context$4_SubscriptionAutoRenewTurnedOn as SubscriptionAutoRenewTurnedOn, type context$4_SubscriptionCancelled as SubscriptionCancelled, type context$4_SubscriptionCreated as SubscriptionCreated, type context$4_SubscriptionEvent as SubscriptionEvent, type context$4_SubscriptionEventEventOneOf as SubscriptionEventEventOneOf, type context$4_SubscriptionNearEndOfPeriod as SubscriptionNearEndOfPeriod, type context$4_SubscriptionPendingChange as SubscriptionPendingChange, context$4_SubscriptionStatus as SubscriptionStatus, type context$4_SubscriptionTransferred as SubscriptionTransferred, type context$4_SubscriptionUnassigned as SubscriptionUnassigned, Type$1 as Type, context$4_UnassignReason as UnassignReason, type context$4_UpdateReferralProgramRequest as UpdateReferralProgramRequest, type context$4_UpdateReferralProgramResponse as UpdateReferralProgramResponse, type context$4_UpdateReferralProgramResponseNonNullableFields as UpdateReferralProgramResponseNonNullableFields, WebhookIdentityType$4 as WebhookIdentityType, type context$4__publicOnProgramUpdatedType as _publicOnProgramUpdatedType, context$4_activateReferralProgram as activateReferralProgram, context$4_generateAiSocialMediaPostsSuggestions as generateAiSocialMediaPostsSuggestions, context$4_getAiSocialMediaPostsSuggestions as getAiSocialMediaPostsSuggestions, context$4_getReferralProgram as getReferralProgram, context$4_getReferralProgramPremiumFeatures as getReferralProgramPremiumFeatures, context$4_onProgramUpdated as onProgramUpdated, context$4_pauseReferralProgram as pauseReferralProgram, onProgramUpdated$1 as publicOnProgramUpdated, context$4_updateReferralProgram as updateReferralProgram };
2008
2008
  }
2009
2009
 
2010
- interface ReferralEvent extends ReferralEventEventTypeOneOf {
2011
- /** Event triggered when a referred friend signs up. */
2012
- referredFriendSignupEvent?: ReferredFriendSignupEvent;
2013
- /** Event triggered when a referral is successful. For example, customer places and pays for an order. */
2014
- successfulReferralEvent?: V1SuccessfulReferralEvent;
2015
- /** Event triggered when an action is performed. For example, placing an order. */
2016
- actionEvent?: V1ActionEvent;
2017
- /** Event triggered when a reward is given. */
2018
- rewardEvent?: RewardEvent;
2019
- /**
2020
- * Referral event ID.
2021
- * @readonly
2022
- */
2023
- _id?: string | null;
2024
- /**
2025
- * Revision number, which increments by 1 each time the referral event is updated.
2026
- * To prevent conflicting changes, the current revision must be passed when updating the referral event.
2027
- */
2028
- revision?: string | null;
2029
- /**
2030
- * Date and time the referral event was created.
2031
- * @readonly
2032
- */
2033
- _createdDate?: Date;
2034
- /**
2035
- * Date and time the referral event was last updated.
2036
- * @readonly
2037
- */
2038
- _updatedDate?: Date;
2039
- }
2040
- /** @oneof */
2041
- interface ReferralEventEventTypeOneOf {
2042
- /** Event triggered when a referred friend signs up. */
2043
- referredFriendSignupEvent?: ReferredFriendSignupEvent;
2044
- /** Event triggered when a referral is successful. For example, customer places and pays for an order. */
2045
- successfulReferralEvent?: V1SuccessfulReferralEvent;
2046
- /** Event triggered when an action is performed. For example, placing an order. */
2047
- actionEvent?: V1ActionEvent;
2048
- /** Event triggered when a reward is given. */
2049
- rewardEvent?: RewardEvent;
2050
- }
2051
- interface ReferredFriendSignupEvent {
2052
- /** ID of the referred friend */
2053
- referredFriendId?: string;
2054
- }
2055
- interface V1SuccessfulReferralEvent {
2056
- /** ID of the referred friend */
2057
- referredFriendId?: string;
2058
- /** ID of the referring customer */
2059
- referringCustomerId?: string;
2060
- }
2061
- interface V1ActionEvent {
2062
- /** ID of the referred friend */
2063
- referredFriendId?: string;
2064
- /** ID of the referring customer */
2065
- referringCustomerId?: string;
2066
- /** Trigger for the action */
2067
- trigger?: V1Trigger;
2068
- /** Amount associated with the action. */
2069
- amount?: string | null;
2070
- /** Currency of the amount. */
2071
- currency?: string | null;
2072
- /** ID of the associated order. */
2073
- orderId?: string | null;
2074
- }
2075
- interface V1Trigger {
2076
- /** ID of the app that triggered the event */
2077
- appId?: string;
2078
- /** Type of activity that triggered the event */
2079
- activityType?: string;
2080
- }
2081
- interface RewardEvent extends RewardEventReceiverOneOf {
2082
- /**
2083
- * ID of the rewarded referring customer.
2084
- * @readonly
2085
- */
2086
- rewardedReferringCustomerId?: string;
2087
- /**
2088
- * ID of the rewarded referred friend.
2089
- * @readonly
2090
- */
2091
- rewardedReferredFriendId?: string;
2092
- /** ID of the referral reward. */
2093
- referralRewardId?: string;
2094
- /** Type of reward. */
2095
- rewardType?: Reward$1;
2096
- }
2097
- /** @oneof */
2098
- interface RewardEventReceiverOneOf {
2010
+ type HostModule$3<T, H extends Host$3> = {
2011
+ __type: 'host';
2012
+ create(host: H): T;
2013
+ };
2014
+ type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
2015
+ type Host$3<Environment = unknown> = {
2016
+ channel: {
2017
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
2018
+ disconnect: () => void;
2019
+ } | Promise<{
2020
+ disconnect: () => void;
2021
+ }>;
2022
+ };
2023
+ environment?: Environment;
2099
2024
  /**
2100
- * ID of the rewarded referring customer.
2101
- * @readonly
2025
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
2102
2026
  */
2103
- rewardedReferringCustomerId?: string;
2027
+ apiBaseUrl?: string;
2104
2028
  /**
2105
- * ID of the rewarded referred friend.
2106
- * @readonly
2029
+ * Possible data to be provided by every host, for cross cutting concerns
2030
+ * like internationalization, billing, etc.
2107
2031
  */
2108
- rewardedReferredFriendId?: string;
2109
- }
2110
- declare enum Reward$1 {
2111
- /** Unknown reward. This field is not used. */
2112
- UNKNOWN = "UNKNOWN",
2113
- /** Reward is a coupon */
2114
- COUPON = "COUPON",
2115
- /** Reward is loyalty points. */
2116
- LOYALTY_POINTS = "LOYALTY_POINTS",
2117
- /** No reward. */
2118
- NOTHING = "NOTHING"
2032
+ essentials?: {
2033
+ /**
2034
+ * The language of the currently viewed session
2035
+ */
2036
+ language?: string;
2037
+ /**
2038
+ * The locale of the currently viewed session
2039
+ */
2040
+ locale?: string;
2041
+ /**
2042
+ * Any headers that should be passed through to the API requests
2043
+ */
2044
+ passThroughHeaders?: Record<string, string>;
2045
+ };
2046
+ };
2047
+
2048
+ type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
2049
+ interface HttpClient$3 {
2050
+ request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
2051
+ fetchWithAuth: typeof fetch;
2052
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
2053
+ getActiveToken?: () => string | undefined;
2119
2054
  }
2120
- interface CreateReferralEventRequest {
2121
- /** Referral event to create */
2122
- referralEvent?: ReferralEvent;
2055
+ type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
2056
+ type HttpResponse$3<T = any> = {
2057
+ data: T;
2058
+ status: number;
2059
+ statusText: string;
2060
+ headers: any;
2061
+ request?: any;
2062
+ };
2063
+ type RequestOptions$3<_TResponse = any, Data = any> = {
2064
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
2065
+ url: string;
2066
+ data?: Data;
2067
+ params?: URLSearchParams;
2068
+ } & APIMetadata$3;
2069
+ type APIMetadata$3 = {
2070
+ methodFqn?: string;
2071
+ entityFqdn?: string;
2072
+ packageName?: string;
2073
+ };
2074
+ type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
2075
+ type EventDefinition$6<Payload = unknown, Type extends string = string> = {
2076
+ __type: 'event-definition';
2077
+ type: Type;
2078
+ isDomainEvent?: boolean;
2079
+ transformations?: (envelope: unknown) => Payload;
2080
+ __payload: Payload;
2081
+ };
2082
+ declare function EventDefinition$6<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$6<Payload, Type>;
2083
+ type EventHandler$6<T extends EventDefinition$6> = (payload: T['__payload']) => void | Promise<void>;
2084
+ type BuildEventDefinition$6<T extends EventDefinition$6<any, string>> = (handler: EventHandler$6<T>) => void;
2085
+
2086
+ type ServicePluginMethodInput$3 = {
2087
+ request: any;
2088
+ metadata: any;
2089
+ };
2090
+ type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
2091
+ type ServicePluginMethodMetadata$3 = {
2092
+ name: string;
2093
+ primaryHttpMappingPath: string;
2094
+ transformations: {
2095
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
2096
+ toREST: (...args: unknown[]) => unknown;
2097
+ };
2098
+ };
2099
+ type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
2100
+ __type: 'service-plugin-definition';
2101
+ componentType: string;
2102
+ methods: ServicePluginMethodMetadata$3[];
2103
+ __contract: Contract;
2104
+ };
2105
+ declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
2106
+ type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
2107
+ declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
2108
+
2109
+ type RequestContext$3 = {
2110
+ isSSR: boolean;
2111
+ host: string;
2112
+ protocol?: string;
2113
+ };
2114
+ type ResponseTransformer$3 = (data: any, headers?: any) => any;
2115
+ /**
2116
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
2117
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
2118
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
2119
+ */
2120
+ type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
2121
+ type AmbassadorRequestOptions$3<T = any> = {
2122
+ _?: T;
2123
+ url?: string;
2124
+ method?: Method$3;
2125
+ params?: any;
2126
+ data?: any;
2127
+ transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
2128
+ };
2129
+ type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
2130
+ __isAmbassador: boolean;
2131
+ };
2132
+ type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
2133
+ type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
2134
+
2135
+ declare global {
2136
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
2137
+ interface SymbolConstructor {
2138
+ readonly observable: symbol;
2139
+ }
2123
2140
  }
2124
- interface CreateReferralEventResponse {
2125
- /** Created referral event */
2126
- referralEvent?: ReferralEvent;
2127
- }
2128
- interface GetReferralEventRequest {
2129
- /** ID of the referral event to retrieve. */
2130
- referralEventId: string;
2131
- }
2132
- interface GetReferralEventResponse {
2133
- /** Retrieved referral event. */
2134
- referralEvent?: ReferralEvent;
2135
- }
2136
- interface QueryReferralEventRequest {
2137
- /** Query to filter referral events */
2138
- query: CursorQuery$3;
2141
+
2142
+ declare const emptyObjectSymbol$3: unique symbol;
2143
+
2144
+ /**
2145
+ Represents a strictly empty plain object, the `{}` value.
2146
+
2147
+ When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
2148
+
2149
+ @example
2150
+ ```
2151
+ import type {EmptyObject} from 'type-fest';
2152
+
2153
+ // The following illustrates the problem with `{}`.
2154
+ const foo1: {} = {}; // Pass
2155
+ const foo2: {} = []; // Pass
2156
+ const foo3: {} = 42; // Pass
2157
+ const foo4: {} = {a: 1}; // Pass
2158
+
2159
+ // With `EmptyObject` only the first case is valid.
2160
+ const bar1: EmptyObject = {}; // Pass
2161
+ const bar2: EmptyObject = 42; // Fail
2162
+ const bar3: EmptyObject = []; // Fail
2163
+ const bar4: EmptyObject = {a: 1}; // Fail
2164
+ ```
2165
+
2166
+ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
2167
+
2168
+ @category Object
2169
+ */
2170
+ type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
2171
+
2172
+ /**
2173
+ Returns a boolean for whether the two given types are equal.
2174
+
2175
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
2176
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
2177
+
2178
+ Use-cases:
2179
+ - If you want to make a conditional branch based on the result of a comparison of two types.
2180
+
2181
+ @example
2182
+ ```
2183
+ import type {IsEqual} from 'type-fest';
2184
+
2185
+ // This type returns a boolean for whether the given array includes the given item.
2186
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
2187
+ type Includes<Value extends readonly any[], Item> =
2188
+ Value extends readonly [Value[0], ...infer rest]
2189
+ ? IsEqual<Value[0], Item> extends true
2190
+ ? true
2191
+ : Includes<rest, Item>
2192
+ : false;
2193
+ ```
2194
+
2195
+ @category Type Guard
2196
+ @category Utilities
2197
+ */
2198
+ type IsEqual$3<A, B> =
2199
+ (<G>() => G extends A ? 1 : 2) extends
2200
+ (<G>() => G extends B ? 1 : 2)
2201
+ ? true
2202
+ : false;
2203
+
2204
+ /**
2205
+ Filter out keys from an object.
2206
+
2207
+ Returns `never` if `Exclude` is strictly equal to `Key`.
2208
+ Returns `never` if `Key` extends `Exclude`.
2209
+ Returns `Key` otherwise.
2210
+
2211
+ @example
2212
+ ```
2213
+ type Filtered = Filter<'foo', 'foo'>;
2214
+ //=> never
2215
+ ```
2216
+
2217
+ @example
2218
+ ```
2219
+ type Filtered = Filter<'bar', string>;
2220
+ //=> never
2221
+ ```
2222
+
2223
+ @example
2224
+ ```
2225
+ type Filtered = Filter<'bar', 'foo'>;
2226
+ //=> 'bar'
2227
+ ```
2228
+
2229
+ @see {Except}
2230
+ */
2231
+ type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
2232
+
2233
+ type ExceptOptions$3 = {
2234
+ /**
2235
+ Disallow assigning non-specified properties.
2236
+
2237
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
2238
+
2239
+ @default false
2240
+ */
2241
+ requireExactProps?: boolean;
2242
+ };
2243
+
2244
+ /**
2245
+ Create a type from an object type without certain keys.
2246
+
2247
+ We recommend setting the `requireExactProps` option to `true`.
2248
+
2249
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
2250
+
2251
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
2252
+
2253
+ @example
2254
+ ```
2255
+ import type {Except} from 'type-fest';
2256
+
2257
+ type Foo = {
2258
+ a: number;
2259
+ b: string;
2260
+ };
2261
+
2262
+ type FooWithoutA = Except<Foo, 'a'>;
2263
+ //=> {b: string}
2264
+
2265
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
2266
+ //=> errors: 'a' does not exist in type '{ b: string; }'
2267
+
2268
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
2269
+ //=> {a: number} & Partial<Record<"b", never>>
2270
+
2271
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
2272
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
2273
+ ```
2274
+
2275
+ @category Object
2276
+ */
2277
+ type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
2278
+ [KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
2279
+ } & (Options['requireExactProps'] extends true
2280
+ ? Partial<Record<KeysType, never>>
2281
+ : {});
2282
+
2283
+ /**
2284
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
2285
+
2286
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
2287
+
2288
+ @example
2289
+ ```
2290
+ import type {ConditionalKeys} from 'type-fest';
2291
+
2292
+ interface Example {
2293
+ a: string;
2294
+ b: string | number;
2295
+ c?: string;
2296
+ d: {};
2139
2297
  }
2140
- interface CursorQuery$3 extends CursorQueryPagingMethodOneOf$3 {
2141
- /**
2142
- * Cursor paging options.
2143
- *
2144
- * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).
2145
- */
2146
- cursorPaging?: CursorPaging$3;
2147
- /**
2148
- * Filter object.
2149
- *
2150
- * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
2151
- */
2152
- filter?: Record<string, any> | null;
2153
- /**
2154
- * Sort object.
2155
- *
2156
- * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
2157
- */
2158
- sort?: Sorting$3[];
2298
+
2299
+ type StringKeysOnly = ConditionalKeys<Example, string>;
2300
+ //=> 'a'
2301
+ ```
2302
+
2303
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
2304
+
2305
+ @example
2306
+ ```
2307
+ import type {ConditionalKeys} from 'type-fest';
2308
+
2309
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
2310
+ //=> 'a' | 'c'
2311
+ ```
2312
+
2313
+ @category Object
2314
+ */
2315
+ type ConditionalKeys$3<Base, Condition> = NonNullable<
2316
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
2317
+ {
2318
+ // Map through all the keys of the given base type.
2319
+ [Key in keyof Base]:
2320
+ // Pick only keys with types extending the given `Condition` type.
2321
+ Base[Key] extends Condition
2322
+ // Retain this key since the condition passes.
2323
+ ? Key
2324
+ // Discard this key since the condition fails.
2325
+ : never;
2326
+
2327
+ // Convert the produced object into a union type of the keys which passed the conditional test.
2328
+ }[keyof Base]
2329
+ >;
2330
+
2331
+ /**
2332
+ Exclude keys from a shape that matches the given `Condition`.
2333
+
2334
+ This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
2335
+
2336
+ @example
2337
+ ```
2338
+ import type {Primitive, ConditionalExcept} from 'type-fest';
2339
+
2340
+ class Awesome {
2341
+ name: string;
2342
+ successes: number;
2343
+ failures: bigint;
2344
+
2345
+ run() {}
2159
2346
  }
2160
- /** @oneof */
2161
- interface CursorQueryPagingMethodOneOf$3 {
2162
- /**
2163
- * Cursor paging options.
2164
- *
2165
- * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).
2166
- */
2167
- cursorPaging?: CursorPaging$3;
2347
+
2348
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
2349
+ //=> {run: () => void}
2350
+ ```
2351
+
2352
+ @example
2353
+ ```
2354
+ import type {ConditionalExcept} from 'type-fest';
2355
+
2356
+ interface Example {
2357
+ a: string;
2358
+ b: string | number;
2359
+ c: () => void;
2360
+ d: {};
2168
2361
  }
2169
- interface Sorting$3 {
2170
- /** Name of the field to sort by. */
2171
- fieldName?: string;
2172
- /** Sort order. */
2362
+
2363
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
2364
+ //=> {b: string | number; c: () => void; d: {}}
2365
+ ```
2366
+
2367
+ @category Object
2368
+ */
2369
+ type ConditionalExcept$3<Base, Condition> = Except$3<
2370
+ Base,
2371
+ ConditionalKeys$3<Base, Condition>
2372
+ >;
2373
+
2374
+ /**
2375
+ * Descriptors are objects that describe the API of a module, and the module
2376
+ * can either be a REST module or a host module.
2377
+ * This type is recursive, so it can describe nested modules.
2378
+ */
2379
+ type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$6<any> | ServicePluginDefinition$3<any> | {
2380
+ [key: string]: Descriptors$3 | PublicMetadata$3 | any;
2381
+ };
2382
+ /**
2383
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
2384
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
2385
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
2386
+ * do not match the given host (as they will not work with the given host).
2387
+ */
2388
+ type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
2389
+ done: T;
2390
+ recurse: T extends {
2391
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
2392
+ } ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$6<any> ? BuildEventDefinition$6<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
2393
+ [Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
2394
+ -1,
2395
+ 0,
2396
+ 1,
2397
+ 2,
2398
+ 3,
2399
+ 4,
2400
+ 5
2401
+ ][Depth]> : never;
2402
+ }, EmptyObject$3>;
2403
+ }[Depth extends -1 ? 'done' : 'recurse'];
2404
+ type PublicMetadata$3 = {
2405
+ PACKAGE_NAME?: string;
2406
+ };
2407
+
2408
+ declare global {
2409
+ interface ContextualClient {
2410
+ }
2411
+ }
2412
+ /**
2413
+ * A type used to create concerete types from SDK descriptors in
2414
+ * case a contextual client is available.
2415
+ */
2416
+ type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
2417
+ host: Host$3;
2418
+ } ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
2419
+
2420
+ interface ReferralEvent extends ReferralEventEventTypeOneOf {
2421
+ /** Event triggered when a referred friend signs up. */
2422
+ referredFriendSignupEvent?: ReferredFriendSignupEvent;
2423
+ /** Event triggered when a referral is successful. For example, customer places and pays for an order. */
2424
+ successfulReferralEvent?: V1SuccessfulReferralEvent;
2425
+ /** Event triggered when an action is performed. For example, placing an order. */
2426
+ actionEvent?: V1ActionEvent;
2427
+ /** Event triggered when a reward is given. */
2428
+ rewardEvent?: RewardEvent;
2429
+ /**
2430
+ * Referral event ID.
2431
+ * @readonly
2432
+ */
2433
+ _id?: string | null;
2434
+ /**
2435
+ * Revision number, which increments by 1 each time the referral event is updated.
2436
+ * To prevent conflicting changes, the current revision must be passed when updating the referral event.
2437
+ */
2438
+ revision?: string | null;
2439
+ /**
2440
+ * Date and time the referral event was created.
2441
+ * @readonly
2442
+ */
2443
+ _createdDate?: Date;
2444
+ /**
2445
+ * Date and time the referral event was last updated.
2446
+ * @readonly
2447
+ */
2448
+ _updatedDate?: Date;
2449
+ }
2450
+ /** @oneof */
2451
+ interface ReferralEventEventTypeOneOf {
2452
+ /** Event triggered when a referred friend signs up. */
2453
+ referredFriendSignupEvent?: ReferredFriendSignupEvent;
2454
+ /** Event triggered when a referral is successful. For example, customer places and pays for an order. */
2455
+ successfulReferralEvent?: V1SuccessfulReferralEvent;
2456
+ /** Event triggered when an action is performed. For example, placing an order. */
2457
+ actionEvent?: V1ActionEvent;
2458
+ /** Event triggered when a reward is given. */
2459
+ rewardEvent?: RewardEvent;
2460
+ }
2461
+ interface ReferredFriendSignupEvent {
2462
+ /** ID of the referred friend */
2463
+ referredFriendId?: string;
2464
+ }
2465
+ interface V1SuccessfulReferralEvent {
2466
+ /** ID of the referred friend */
2467
+ referredFriendId?: string;
2468
+ /** ID of the referring customer */
2469
+ referringCustomerId?: string;
2470
+ }
2471
+ interface V1ActionEvent {
2472
+ /** ID of the referred friend */
2473
+ referredFriendId?: string;
2474
+ /** ID of the referring customer */
2475
+ referringCustomerId?: string;
2476
+ /** Trigger for the action */
2477
+ trigger?: V1Trigger;
2478
+ /** Amount associated with the action. */
2479
+ amount?: string | null;
2480
+ /** Currency of the amount. */
2481
+ currency?: string | null;
2482
+ /** ID of the associated order. */
2483
+ orderId?: string | null;
2484
+ }
2485
+ interface V1Trigger {
2486
+ /** ID of the app that triggered the event */
2487
+ appId?: string;
2488
+ /** Type of activity that triggered the event */
2489
+ activityType?: string;
2490
+ }
2491
+ interface RewardEvent extends RewardEventReceiverOneOf {
2492
+ /**
2493
+ * ID of the rewarded referring customer.
2494
+ * @readonly
2495
+ */
2496
+ rewardedReferringCustomerId?: string;
2497
+ /**
2498
+ * ID of the rewarded referred friend.
2499
+ * @readonly
2500
+ */
2501
+ rewardedReferredFriendId?: string;
2502
+ /** ID of the referral reward. */
2503
+ referralRewardId?: string;
2504
+ /** Type of reward. */
2505
+ rewardType?: Reward$1;
2506
+ }
2507
+ /** @oneof */
2508
+ interface RewardEventReceiverOneOf {
2509
+ /**
2510
+ * ID of the rewarded referring customer.
2511
+ * @readonly
2512
+ */
2513
+ rewardedReferringCustomerId?: string;
2514
+ /**
2515
+ * ID of the rewarded referred friend.
2516
+ * @readonly
2517
+ */
2518
+ rewardedReferredFriendId?: string;
2519
+ }
2520
+ declare enum Reward$1 {
2521
+ /** Unknown reward. This field is not used. */
2522
+ UNKNOWN = "UNKNOWN",
2523
+ /** Reward is a coupon */
2524
+ COUPON = "COUPON",
2525
+ /** Reward is loyalty points. */
2526
+ LOYALTY_POINTS = "LOYALTY_POINTS",
2527
+ /** No reward. */
2528
+ NOTHING = "NOTHING"
2529
+ }
2530
+ interface CreateReferralEventRequest {
2531
+ /** Referral event to create */
2532
+ referralEvent?: ReferralEvent;
2533
+ }
2534
+ interface CreateReferralEventResponse {
2535
+ /** Created referral event */
2536
+ referralEvent?: ReferralEvent;
2537
+ }
2538
+ interface GetReferralEventRequest {
2539
+ /** ID of the referral event to retrieve. */
2540
+ referralEventId: string;
2541
+ }
2542
+ interface GetReferralEventResponse {
2543
+ /** Retrieved referral event. */
2544
+ referralEvent?: ReferralEvent;
2545
+ }
2546
+ interface QueryReferralEventRequest {
2547
+ /** Query to filter referral events */
2548
+ query: CursorQuery$3;
2549
+ }
2550
+ interface CursorQuery$3 extends CursorQueryPagingMethodOneOf$3 {
2551
+ /**
2552
+ * Cursor paging options.
2553
+ *
2554
+ * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).
2555
+ */
2556
+ cursorPaging?: CursorPaging$3;
2557
+ /**
2558
+ * Filter object.
2559
+ *
2560
+ * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
2561
+ */
2562
+ filter?: Record<string, any> | null;
2563
+ /**
2564
+ * Sort object.
2565
+ *
2566
+ * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
2567
+ */
2568
+ sort?: Sorting$3[];
2569
+ }
2570
+ /** @oneof */
2571
+ interface CursorQueryPagingMethodOneOf$3 {
2572
+ /**
2573
+ * Cursor paging options.
2574
+ *
2575
+ * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).
2576
+ */
2577
+ cursorPaging?: CursorPaging$3;
2578
+ }
2579
+ interface Sorting$3 {
2580
+ /** Name of the field to sort by. */
2581
+ fieldName?: string;
2582
+ /** Sort order. */
2173
2583
  order?: SortOrder$3;
2174
2584
  }
2175
2585
  declare enum SortOrder$3 {
@@ -2842,7 +3252,7 @@ interface QueryReferredFriendActionsOptions {
2842
3252
  contactIds?: string[];
2843
3253
  }
2844
3254
 
2845
- declare function getReferralEvent$1(httpClient: HttpClient): GetReferralEventSignature;
3255
+ declare function getReferralEvent$1(httpClient: HttpClient$3): GetReferralEventSignature;
2846
3256
  interface GetReferralEventSignature {
2847
3257
  /**
2848
3258
  * Retrieves a referral event by ID.
@@ -2851,7 +3261,7 @@ interface GetReferralEventSignature {
2851
3261
  */
2852
3262
  (referralEventId: string): Promise<ReferralEvent & ReferralEventNonNullableFields>;
2853
3263
  }
2854
- declare function queryReferralEvent$1(httpClient: HttpClient): QueryReferralEventSignature;
3264
+ declare function queryReferralEvent$1(httpClient: HttpClient$3): QueryReferralEventSignature;
2855
3265
  interface QueryReferralEventSignature {
2856
3266
  /**
2857
3267
  * Retrieves a list of referral events, given the provided paging, filtering, and sorting.
@@ -2863,14 +3273,14 @@ interface QueryReferralEventSignature {
2863
3273
  */
2864
3274
  (): ReferralEventsQueryBuilder;
2865
3275
  }
2866
- declare function getReferralStatistics$1(httpClient: HttpClient): GetReferralStatisticsSignature;
3276
+ declare function getReferralStatistics$1(httpClient: HttpClient$3): GetReferralStatisticsSignature;
2867
3277
  interface GetReferralStatisticsSignature {
2868
3278
  /**
2869
3279
  * Retrieves referral statistics.
2870
3280
  */
2871
3281
  (): Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
2872
3282
  }
2873
- declare function queryReferringCustomerTotals$1(httpClient: HttpClient): QueryReferringCustomerTotalsSignature;
3283
+ declare function queryReferringCustomerTotals$1(httpClient: HttpClient$3): QueryReferringCustomerTotalsSignature;
2874
3284
  interface QueryReferringCustomerTotalsSignature {
2875
3285
  /**
2876
3286
  * Retrieves a list of referring customer totals, given the provided paging, filtering, and sorting.
@@ -2882,7 +3292,7 @@ interface QueryReferringCustomerTotalsSignature {
2882
3292
  */
2883
3293
  (options?: QueryReferringCustomerTotalsOptions | undefined): Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
2884
3294
  }
2885
- declare function queryReferredFriendActions$1(httpClient: HttpClient): QueryReferredFriendActionsSignature;
3295
+ declare function queryReferredFriendActions$1(httpClient: HttpClient$3): QueryReferredFriendActionsSignature;
2886
3296
  interface QueryReferredFriendActionsSignature {
2887
3297
  /**
2888
3298
  * Retrieves a list of referred friend actions, given the provided paging, filtering, and sorting.
@@ -2894,18 +3304,18 @@ interface QueryReferredFriendActionsSignature {
2894
3304
  */
2895
3305
  (options?: QueryReferredFriendActionsOptions | undefined): Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
2896
3306
  }
2897
- declare const onReferralEventCreated$1: EventDefinition$4<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
3307
+ declare const onReferralEventCreated$1: EventDefinition$6<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
2898
3308
 
2899
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
3309
+ type EventDefinition$5<Payload = unknown, Type extends string = string> = {
2900
3310
  __type: 'event-definition';
2901
3311
  type: Type;
2902
3312
  isDomainEvent?: boolean;
2903
3313
  transformations?: (envelope: unknown) => Payload;
2904
3314
  __payload: Payload;
2905
3315
  };
2906
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
2907
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
2908
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
3316
+ declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
3317
+ type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
3318
+ type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
2909
3319
 
2910
3320
  declare global {
2911
3321
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -2914,13 +3324,13 @@ declare global {
2914
3324
  }
2915
3325
  }
2916
3326
 
2917
- declare function createEventModule$2<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
3327
+ declare function createEventModule$2<T extends EventDefinition$5<any, string>>(eventDefinition: T): BuildEventDefinition$5<T> & T;
2918
3328
 
2919
- declare const getReferralEvent: MaybeContext<BuildRESTFunction<typeof getReferralEvent$1> & typeof getReferralEvent$1>;
2920
- declare const queryReferralEvent: MaybeContext<BuildRESTFunction<typeof queryReferralEvent$1> & typeof queryReferralEvent$1>;
2921
- declare const getReferralStatistics: MaybeContext<BuildRESTFunction<typeof getReferralStatistics$1> & typeof getReferralStatistics$1>;
2922
- declare const queryReferringCustomerTotals: MaybeContext<BuildRESTFunction<typeof queryReferringCustomerTotals$1> & typeof queryReferringCustomerTotals$1>;
2923
- declare const queryReferredFriendActions: MaybeContext<BuildRESTFunction<typeof queryReferredFriendActions$1> & typeof queryReferredFriendActions$1>;
3329
+ declare const getReferralEvent: MaybeContext$3<BuildRESTFunction$3<typeof getReferralEvent$1> & typeof getReferralEvent$1>;
3330
+ declare const queryReferralEvent: MaybeContext$3<BuildRESTFunction$3<typeof queryReferralEvent$1> & typeof queryReferralEvent$1>;
3331
+ declare const getReferralStatistics: MaybeContext$3<BuildRESTFunction$3<typeof getReferralStatistics$1> & typeof getReferralStatistics$1>;
3332
+ declare const queryReferringCustomerTotals: MaybeContext$3<BuildRESTFunction$3<typeof queryReferringCustomerTotals$1> & typeof queryReferringCustomerTotals$1>;
3333
+ declare const queryReferredFriendActions: MaybeContext$3<BuildRESTFunction$3<typeof queryReferredFriendActions$1> & typeof queryReferredFriendActions$1>;
2924
3334
 
2925
3335
  type _publicOnReferralEventCreatedType = typeof onReferralEventCreated$1;
2926
3336
  /** */
@@ -2973,39 +3383,449 @@ declare namespace context$3 {
2973
3383
  export { type ActionEvent$3 as ActionEvent, type BaseEventMetadata$2 as BaseEventMetadata, type Coupon$1 as Coupon, type CouponDiscountTypeOptionsOneOf$1 as CouponDiscountTypeOptionsOneOf, type CouponScope$1 as CouponScope, type CouponScopeOrMinSubtotalOneOf$1 as CouponScopeOrMinSubtotalOneOf, type context$3_CreateReferralEventRequest as CreateReferralEventRequest, type context$3_CreateReferralEventResponse as CreateReferralEventResponse, type CursorPaging$3 as CursorPaging, type CursorPagingMetadata$3 as CursorPagingMetadata, type CursorQuery$3 as CursorQuery, type CursorQueryPagingMethodOneOf$3 as CursorQueryPagingMethodOneOf, type Cursors$3 as Cursors, DiscountType$1 as DiscountType, type DomainEvent$3 as DomainEvent, type DomainEventBodyOneOf$3 as DomainEventBodyOneOf, type Empty$2 as Empty, type EntityCreatedEvent$3 as EntityCreatedEvent, type EntityDeletedEvent$3 as EntityDeletedEvent, type EntityUpdatedEvent$3 as EntityUpdatedEvent, type EventMetadata$2 as EventMetadata, type FixedAmountDiscount$1 as FixedAmountDiscount, type context$3_GetReferralEventRequest as GetReferralEventRequest, type context$3_GetReferralEventResponse as GetReferralEventResponse, type context$3_GetReferralEventResponseNonNullableFields as GetReferralEventResponseNonNullableFields, type context$3_GetReferralStatisticsRequest as GetReferralStatisticsRequest, type context$3_GetReferralStatisticsResponse as GetReferralStatisticsResponse, type context$3_GetReferralStatisticsResponseNonNullableFields as GetReferralStatisticsResponseNonNullableFields, type Group$1 as Group, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type LoyaltyPoints$1 as LoyaltyPoints, type MessageEnvelope$3 as MessageEnvelope, type PercentageDiscount$1 as PercentageDiscount, type context$3_QueryReferralEventRequest as QueryReferralEventRequest, type context$3_QueryReferralEventResponse as QueryReferralEventResponse, type context$3_QueryReferralEventResponseNonNullableFields as QueryReferralEventResponseNonNullableFields, type context$3_QueryReferredFriendActionsOptions as QueryReferredFriendActionsOptions, type context$3_QueryReferredFriendActionsRequest as QueryReferredFriendActionsRequest, type context$3_QueryReferredFriendActionsResponse as QueryReferredFriendActionsResponse, type context$3_QueryReferredFriendActionsResponseNonNullableFields as QueryReferredFriendActionsResponseNonNullableFields, type context$3_QueryReferringCustomerTotalsOptions as QueryReferringCustomerTotalsOptions, type context$3_QueryReferringCustomerTotalsRequest as QueryReferringCustomerTotalsRequest, type context$3_QueryReferringCustomerTotalsResponse as QueryReferringCustomerTotalsResponse, type context$3_QueryReferringCustomerTotalsResponseNonNullableFields as QueryReferringCustomerTotalsResponseNonNullableFields, type context$3_ReferralEvent as ReferralEvent, type context$3_ReferralEventCreatedEnvelope as ReferralEventCreatedEnvelope, type context$3_ReferralEventEventTypeOneOf as ReferralEventEventTypeOneOf, type context$3_ReferralEventNonNullableFields as ReferralEventNonNullableFields, type context$3_ReferralEventsQueryBuilder as ReferralEventsQueryBuilder, type context$3_ReferralEventsQueryResult as ReferralEventsQueryResult, type context$3_ReferredFriendAction as ReferredFriendAction, type context$3_ReferredFriendActionEvent as ReferredFriendActionEvent, type context$3_ReferredFriendActionRewardTypeOptionsOneOf as ReferredFriendActionRewardTypeOptionsOneOf, type ReferredFriendDetails$2 as ReferredFriendDetails, type context$3_ReferredFriendSignupEvent as ReferredFriendSignupEvent, type context$3_ReferringCustomerTotal as ReferringCustomerTotal, type RestoreInfo$3 as RestoreInfo, Reward$1 as Reward, type context$3_RewardEvent as RewardEvent, type context$3_RewardEventReceiverOneOf as RewardEventReceiverOneOf, SortOrder$3 as SortOrder, type Sorting$3 as Sorting, Status$2 as Status, type SuccessfulReferralEvent$2 as SuccessfulReferralEvent, type context$3_Trigger as Trigger, type context$3_V1ActionEvent as V1ActionEvent, type V1Coupon$1 as V1Coupon, type context$3_V1SuccessfulReferralEvent as V1SuccessfulReferralEvent, type context$3_V1Trigger as V1Trigger, WebhookIdentityType$3 as WebhookIdentityType, type context$3__publicOnReferralEventCreatedType as _publicOnReferralEventCreatedType, context$3_getReferralEvent as getReferralEvent, context$3_getReferralStatistics as getReferralStatistics, context$3_onReferralEventCreated as onReferralEventCreated, onReferralEventCreated$1 as publicOnReferralEventCreated, context$3_queryReferralEvent as queryReferralEvent, context$3_queryReferredFriendActions as queryReferredFriendActions, context$3_queryReferringCustomerTotals as queryReferringCustomerTotals };
2974
3384
  }
2975
3385
 
2976
- interface ReferralReward extends ReferralRewardReceiverOneOf, ReferralRewardRewardTypeOptionsOneOf {
2977
- /**
2978
- * ID of the referring customer who received the reward.
2979
- * @readonly
2980
- */
2981
- rewardedReferringCustomerId?: string;
2982
- /**
2983
- * ID of the referred friend who received the reward.
2984
- * @readonly
2985
- */
2986
- rewardedReferredFriendId?: string;
2987
- /** Details of a coupon reward. Present when `reward_type` is `COUPON`. */
2988
- coupon?: V1Coupon;
2989
- /** Details of a loyalty points reward. Present when `reward_type` is `LOYALTY_POINTS`. */
2990
- loyaltyPoints?: V1LoyaltyPoints;
2991
- /**
2992
- * Referral reward ID.
2993
- * @readonly
2994
- */
2995
- _id?: string | null;
3386
+ type HostModule$2<T, H extends Host$2> = {
3387
+ __type: 'host';
3388
+ create(host: H): T;
3389
+ };
3390
+ type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
3391
+ type Host$2<Environment = unknown> = {
3392
+ channel: {
3393
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
3394
+ disconnect: () => void;
3395
+ } | Promise<{
3396
+ disconnect: () => void;
3397
+ }>;
3398
+ };
3399
+ environment?: Environment;
2996
3400
  /**
2997
- * Revision number, which increments by 1 each time the referral reward is updated.
2998
- * To prevent conflicting changes, the current revision must be passed when updating the referral reward.
3401
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
2999
3402
  */
3000
- revision?: string | null;
3403
+ apiBaseUrl?: string;
3001
3404
  /**
3002
- * Date and time the referral reward was created.
3003
- * @readonly
3405
+ * Possible data to be provided by every host, for cross cutting concerns
3406
+ * like internationalization, billing, etc.
3004
3407
  */
3005
- _createdDate?: Date;
3006
- /**
3007
- * Date and time the referral reward was last updated.
3008
- * @readonly
3408
+ essentials?: {
3409
+ /**
3410
+ * The language of the currently viewed session
3411
+ */
3412
+ language?: string;
3413
+ /**
3414
+ * The locale of the currently viewed session
3415
+ */
3416
+ locale?: string;
3417
+ /**
3418
+ * Any headers that should be passed through to the API requests
3419
+ */
3420
+ passThroughHeaders?: Record<string, string>;
3421
+ };
3422
+ };
3423
+
3424
+ type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
3425
+ interface HttpClient$2 {
3426
+ request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
3427
+ fetchWithAuth: typeof fetch;
3428
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
3429
+ getActiveToken?: () => string | undefined;
3430
+ }
3431
+ type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
3432
+ type HttpResponse$2<T = any> = {
3433
+ data: T;
3434
+ status: number;
3435
+ statusText: string;
3436
+ headers: any;
3437
+ request?: any;
3438
+ };
3439
+ type RequestOptions$2<_TResponse = any, Data = any> = {
3440
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
3441
+ url: string;
3442
+ data?: Data;
3443
+ params?: URLSearchParams;
3444
+ } & APIMetadata$2;
3445
+ type APIMetadata$2 = {
3446
+ methodFqn?: string;
3447
+ entityFqdn?: string;
3448
+ packageName?: string;
3449
+ };
3450
+ type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
3451
+ type EventDefinition$4<Payload = unknown, Type extends string = string> = {
3452
+ __type: 'event-definition';
3453
+ type: Type;
3454
+ isDomainEvent?: boolean;
3455
+ transformations?: (envelope: unknown) => Payload;
3456
+ __payload: Payload;
3457
+ };
3458
+ declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
3459
+ type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
3460
+ type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
3461
+
3462
+ type ServicePluginMethodInput$2 = {
3463
+ request: any;
3464
+ metadata: any;
3465
+ };
3466
+ type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
3467
+ type ServicePluginMethodMetadata$2 = {
3468
+ name: string;
3469
+ primaryHttpMappingPath: string;
3470
+ transformations: {
3471
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
3472
+ toREST: (...args: unknown[]) => unknown;
3473
+ };
3474
+ };
3475
+ type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
3476
+ __type: 'service-plugin-definition';
3477
+ componentType: string;
3478
+ methods: ServicePluginMethodMetadata$2[];
3479
+ __contract: Contract;
3480
+ };
3481
+ declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
3482
+ type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
3483
+ declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
3484
+
3485
+ type RequestContext$2 = {
3486
+ isSSR: boolean;
3487
+ host: string;
3488
+ protocol?: string;
3489
+ };
3490
+ type ResponseTransformer$2 = (data: any, headers?: any) => any;
3491
+ /**
3492
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
3493
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
3494
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
3495
+ */
3496
+ type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
3497
+ type AmbassadorRequestOptions$2<T = any> = {
3498
+ _?: T;
3499
+ url?: string;
3500
+ method?: Method$2;
3501
+ params?: any;
3502
+ data?: any;
3503
+ transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
3504
+ };
3505
+ type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
3506
+ __isAmbassador: boolean;
3507
+ };
3508
+ type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
3509
+ type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
3510
+
3511
+ declare global {
3512
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
3513
+ interface SymbolConstructor {
3514
+ readonly observable: symbol;
3515
+ }
3516
+ }
3517
+
3518
+ declare const emptyObjectSymbol$2: unique symbol;
3519
+
3520
+ /**
3521
+ Represents a strictly empty plain object, the `{}` value.
3522
+
3523
+ When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
3524
+
3525
+ @example
3526
+ ```
3527
+ import type {EmptyObject} from 'type-fest';
3528
+
3529
+ // The following illustrates the problem with `{}`.
3530
+ const foo1: {} = {}; // Pass
3531
+ const foo2: {} = []; // Pass
3532
+ const foo3: {} = 42; // Pass
3533
+ const foo4: {} = {a: 1}; // Pass
3534
+
3535
+ // With `EmptyObject` only the first case is valid.
3536
+ const bar1: EmptyObject = {}; // Pass
3537
+ const bar2: EmptyObject = 42; // Fail
3538
+ const bar3: EmptyObject = []; // Fail
3539
+ const bar4: EmptyObject = {a: 1}; // Fail
3540
+ ```
3541
+
3542
+ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
3543
+
3544
+ @category Object
3545
+ */
3546
+ type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
3547
+
3548
+ /**
3549
+ Returns a boolean for whether the two given types are equal.
3550
+
3551
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
3552
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
3553
+
3554
+ Use-cases:
3555
+ - If you want to make a conditional branch based on the result of a comparison of two types.
3556
+
3557
+ @example
3558
+ ```
3559
+ import type {IsEqual} from 'type-fest';
3560
+
3561
+ // This type returns a boolean for whether the given array includes the given item.
3562
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
3563
+ type Includes<Value extends readonly any[], Item> =
3564
+ Value extends readonly [Value[0], ...infer rest]
3565
+ ? IsEqual<Value[0], Item> extends true
3566
+ ? true
3567
+ : Includes<rest, Item>
3568
+ : false;
3569
+ ```
3570
+
3571
+ @category Type Guard
3572
+ @category Utilities
3573
+ */
3574
+ type IsEqual$2<A, B> =
3575
+ (<G>() => G extends A ? 1 : 2) extends
3576
+ (<G>() => G extends B ? 1 : 2)
3577
+ ? true
3578
+ : false;
3579
+
3580
+ /**
3581
+ Filter out keys from an object.
3582
+
3583
+ Returns `never` if `Exclude` is strictly equal to `Key`.
3584
+ Returns `never` if `Key` extends `Exclude`.
3585
+ Returns `Key` otherwise.
3586
+
3587
+ @example
3588
+ ```
3589
+ type Filtered = Filter<'foo', 'foo'>;
3590
+ //=> never
3591
+ ```
3592
+
3593
+ @example
3594
+ ```
3595
+ type Filtered = Filter<'bar', string>;
3596
+ //=> never
3597
+ ```
3598
+
3599
+ @example
3600
+ ```
3601
+ type Filtered = Filter<'bar', 'foo'>;
3602
+ //=> 'bar'
3603
+ ```
3604
+
3605
+ @see {Except}
3606
+ */
3607
+ type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
3608
+
3609
+ type ExceptOptions$2 = {
3610
+ /**
3611
+ Disallow assigning non-specified properties.
3612
+
3613
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
3614
+
3615
+ @default false
3616
+ */
3617
+ requireExactProps?: boolean;
3618
+ };
3619
+
3620
+ /**
3621
+ Create a type from an object type without certain keys.
3622
+
3623
+ We recommend setting the `requireExactProps` option to `true`.
3624
+
3625
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
3626
+
3627
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
3628
+
3629
+ @example
3630
+ ```
3631
+ import type {Except} from 'type-fest';
3632
+
3633
+ type Foo = {
3634
+ a: number;
3635
+ b: string;
3636
+ };
3637
+
3638
+ type FooWithoutA = Except<Foo, 'a'>;
3639
+ //=> {b: string}
3640
+
3641
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
3642
+ //=> errors: 'a' does not exist in type '{ b: string; }'
3643
+
3644
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
3645
+ //=> {a: number} & Partial<Record<"b", never>>
3646
+
3647
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
3648
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
3649
+ ```
3650
+
3651
+ @category Object
3652
+ */
3653
+ type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
3654
+ [KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
3655
+ } & (Options['requireExactProps'] extends true
3656
+ ? Partial<Record<KeysType, never>>
3657
+ : {});
3658
+
3659
+ /**
3660
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
3661
+
3662
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
3663
+
3664
+ @example
3665
+ ```
3666
+ import type {ConditionalKeys} from 'type-fest';
3667
+
3668
+ interface Example {
3669
+ a: string;
3670
+ b: string | number;
3671
+ c?: string;
3672
+ d: {};
3673
+ }
3674
+
3675
+ type StringKeysOnly = ConditionalKeys<Example, string>;
3676
+ //=> 'a'
3677
+ ```
3678
+
3679
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
3680
+
3681
+ @example
3682
+ ```
3683
+ import type {ConditionalKeys} from 'type-fest';
3684
+
3685
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
3686
+ //=> 'a' | 'c'
3687
+ ```
3688
+
3689
+ @category Object
3690
+ */
3691
+ type ConditionalKeys$2<Base, Condition> = NonNullable<
3692
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
3693
+ {
3694
+ // Map through all the keys of the given base type.
3695
+ [Key in keyof Base]:
3696
+ // Pick only keys with types extending the given `Condition` type.
3697
+ Base[Key] extends Condition
3698
+ // Retain this key since the condition passes.
3699
+ ? Key
3700
+ // Discard this key since the condition fails.
3701
+ : never;
3702
+
3703
+ // Convert the produced object into a union type of the keys which passed the conditional test.
3704
+ }[keyof Base]
3705
+ >;
3706
+
3707
+ /**
3708
+ Exclude keys from a shape that matches the given `Condition`.
3709
+
3710
+ This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
3711
+
3712
+ @example
3713
+ ```
3714
+ import type {Primitive, ConditionalExcept} from 'type-fest';
3715
+
3716
+ class Awesome {
3717
+ name: string;
3718
+ successes: number;
3719
+ failures: bigint;
3720
+
3721
+ run() {}
3722
+ }
3723
+
3724
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
3725
+ //=> {run: () => void}
3726
+ ```
3727
+
3728
+ @example
3729
+ ```
3730
+ import type {ConditionalExcept} from 'type-fest';
3731
+
3732
+ interface Example {
3733
+ a: string;
3734
+ b: string | number;
3735
+ c: () => void;
3736
+ d: {};
3737
+ }
3738
+
3739
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
3740
+ //=> {b: string | number; c: () => void; d: {}}
3741
+ ```
3742
+
3743
+ @category Object
3744
+ */
3745
+ type ConditionalExcept$2<Base, Condition> = Except$2<
3746
+ Base,
3747
+ ConditionalKeys$2<Base, Condition>
3748
+ >;
3749
+
3750
+ /**
3751
+ * Descriptors are objects that describe the API of a module, and the module
3752
+ * can either be a REST module or a host module.
3753
+ * This type is recursive, so it can describe nested modules.
3754
+ */
3755
+ type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$4<any> | ServicePluginDefinition$2<any> | {
3756
+ [key: string]: Descriptors$2 | PublicMetadata$2 | any;
3757
+ };
3758
+ /**
3759
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
3760
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
3761
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
3762
+ * do not match the given host (as they will not work with the given host).
3763
+ */
3764
+ type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
3765
+ done: T;
3766
+ recurse: T extends {
3767
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
3768
+ } ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
3769
+ [Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
3770
+ -1,
3771
+ 0,
3772
+ 1,
3773
+ 2,
3774
+ 3,
3775
+ 4,
3776
+ 5
3777
+ ][Depth]> : never;
3778
+ }, EmptyObject$2>;
3779
+ }[Depth extends -1 ? 'done' : 'recurse'];
3780
+ type PublicMetadata$2 = {
3781
+ PACKAGE_NAME?: string;
3782
+ };
3783
+
3784
+ declare global {
3785
+ interface ContextualClient {
3786
+ }
3787
+ }
3788
+ /**
3789
+ * A type used to create concerete types from SDK descriptors in
3790
+ * case a contextual client is available.
3791
+ */
3792
+ type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
3793
+ host: Host$2;
3794
+ } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
3795
+
3796
+ interface ReferralReward extends ReferralRewardReceiverOneOf, ReferralRewardRewardTypeOptionsOneOf {
3797
+ /**
3798
+ * ID of the referring customer who received the reward.
3799
+ * @readonly
3800
+ */
3801
+ rewardedReferringCustomerId?: string;
3802
+ /**
3803
+ * ID of the referred friend who received the reward.
3804
+ * @readonly
3805
+ */
3806
+ rewardedReferredFriendId?: string;
3807
+ /** Details of a coupon reward. Present when `reward_type` is `COUPON`. */
3808
+ coupon?: V1Coupon;
3809
+ /** Details of a loyalty points reward. Present when `reward_type` is `LOYALTY_POINTS`. */
3810
+ loyaltyPoints?: V1LoyaltyPoints;
3811
+ /**
3812
+ * Referral reward ID.
3813
+ * @readonly
3814
+ */
3815
+ _id?: string | null;
3816
+ /**
3817
+ * Revision number, which increments by 1 each time the referral reward is updated.
3818
+ * To prevent conflicting changes, the current revision must be passed when updating the referral reward.
3819
+ */
3820
+ revision?: string | null;
3821
+ /**
3822
+ * Date and time the referral reward was created.
3823
+ * @readonly
3824
+ */
3825
+ _createdDate?: Date;
3826
+ /**
3827
+ * Date and time the referral reward was last updated.
3828
+ * @readonly
3009
3829
  */
3010
3830
  _updatedDate?: Date;
3011
3831
  /**
@@ -3578,72 +4398,482 @@ interface ReferralRewardsQueryBuilder {
3578
4398
  find: () => Promise<ReferralRewardsQueryResult>;
3579
4399
  }
3580
4400
 
3581
- declare function getReferralReward$1(httpClient: HttpClient): GetReferralRewardSignature;
3582
- interface GetReferralRewardSignature {
3583
- /**
3584
- * Retrieves a referral reward.
3585
- * @param - Referral reward ID.
3586
- * @returns Retrieved referral reward.
3587
- */
3588
- (_id: string): Promise<ReferralReward & ReferralRewardNonNullableFields>;
4401
+ declare function getReferralReward$1(httpClient: HttpClient$2): GetReferralRewardSignature;
4402
+ interface GetReferralRewardSignature {
4403
+ /**
4404
+ * Retrieves a referral reward.
4405
+ * @param - Referral reward ID.
4406
+ * @returns Retrieved referral reward.
4407
+ */
4408
+ (_id: string): Promise<ReferralReward & ReferralRewardNonNullableFields>;
4409
+ }
4410
+ declare function queryReferralRewards$1(httpClient: HttpClient$2): QueryReferralRewardsSignature;
4411
+ interface QueryReferralRewardsSignature {
4412
+ /**
4413
+ * Retrieves a list of referral rewards, given the provided paging, filtering, and sorting.
4414
+ *
4415
+ * To learn about working with _Query_ endpoints, see
4416
+ * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),
4417
+ * [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),
4418
+ * and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).
4419
+ */
4420
+ (options?: QueryReferralRewardsOptions | undefined): ReferralRewardsQueryBuilder;
4421
+ }
4422
+
4423
+ declare const getReferralReward: MaybeContext$2<BuildRESTFunction$2<typeof getReferralReward$1> & typeof getReferralReward$1>;
4424
+ declare const queryReferralRewards: MaybeContext$2<BuildRESTFunction$2<typeof queryReferralRewards$1> & typeof queryReferralRewards$1>;
4425
+
4426
+ type context$2_BulkGetReferralRewardsRequest = BulkGetReferralRewardsRequest;
4427
+ type context$2_BulkGetReferralRewardsResponse = BulkGetReferralRewardsResponse;
4428
+ type context$2_Coupon = Coupon;
4429
+ type context$2_CouponDiscountTypeOptionsOneOf = CouponDiscountTypeOptionsOneOf;
4430
+ type context$2_CouponScope = CouponScope;
4431
+ type context$2_CouponScopeOrMinSubtotalOneOf = CouponScopeOrMinSubtotalOneOf;
4432
+ type context$2_DiscountType = DiscountType;
4433
+ declare const context$2_DiscountType: typeof DiscountType;
4434
+ type context$2_FixedAmountDiscount = FixedAmountDiscount;
4435
+ type context$2_GetReferralRewardRequest = GetReferralRewardRequest;
4436
+ type context$2_GetReferralRewardResponse = GetReferralRewardResponse;
4437
+ type context$2_GetReferralRewardResponseNonNullableFields = GetReferralRewardResponseNonNullableFields;
4438
+ type context$2_Group = Group;
4439
+ type context$2_LoyaltyPoints = LoyaltyPoints;
4440
+ type context$2_PercentageDiscount = PercentageDiscount;
4441
+ type context$2_QueryReferralRewardsOptions = QueryReferralRewardsOptions;
4442
+ type context$2_QueryReferralRewardsRequest = QueryReferralRewardsRequest;
4443
+ type context$2_QueryReferralRewardsResponse = QueryReferralRewardsResponse;
4444
+ type context$2_QueryReferralRewardsResponseNonNullableFields = QueryReferralRewardsResponseNonNullableFields;
4445
+ type context$2_ReferralReward = ReferralReward;
4446
+ type context$2_ReferralRewardNonNullableFields = ReferralRewardNonNullableFields;
4447
+ type context$2_ReferralRewardReceiverOneOf = ReferralRewardReceiverOneOf;
4448
+ type context$2_ReferralRewardRewardTypeOptionsOneOf = ReferralRewardRewardTypeOptionsOneOf;
4449
+ type context$2_ReferralRewardsQueryBuilder = ReferralRewardsQueryBuilder;
4450
+ type context$2_ReferralRewardsQueryResult = ReferralRewardsQueryResult;
4451
+ type context$2_Reward = Reward;
4452
+ type context$2_RewardOptionsOneOf = RewardOptionsOneOf;
4453
+ type context$2_RewardTypeType = RewardTypeType;
4454
+ declare const context$2_RewardTypeType: typeof RewardTypeType;
4455
+ type context$2_RewardsInSite = RewardsInSite;
4456
+ type context$2_Type = Type;
4457
+ declare const context$2_Type: typeof Type;
4458
+ type context$2_V1Coupon = V1Coupon;
4459
+ type context$2_V1LoyaltyPoints = V1LoyaltyPoints;
4460
+ type context$2_ValidateReferralRewardRequest = ValidateReferralRewardRequest;
4461
+ type context$2_ValidateReferralRewardResponse = ValidateReferralRewardResponse;
4462
+ declare const context$2_getReferralReward: typeof getReferralReward;
4463
+ declare const context$2_queryReferralRewards: typeof queryReferralRewards;
4464
+ declare namespace context$2 {
4465
+ export { type ActionEvent$2 as ActionEvent, type context$2_BulkGetReferralRewardsRequest as BulkGetReferralRewardsRequest, type context$2_BulkGetReferralRewardsResponse as BulkGetReferralRewardsResponse, type context$2_Coupon as Coupon, type context$2_CouponDiscountTypeOptionsOneOf as CouponDiscountTypeOptionsOneOf, type context$2_CouponScope as CouponScope, type context$2_CouponScopeOrMinSubtotalOneOf as CouponScopeOrMinSubtotalOneOf, type CursorPaging$2 as CursorPaging, type CursorPagingMetadata$2 as CursorPagingMetadata, type CursorQuery$2 as CursorQuery, type CursorQueryPagingMethodOneOf$2 as CursorQueryPagingMethodOneOf, type Cursors$2 as Cursors, context$2_DiscountType as DiscountType, type DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type Empty$1 as Empty, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type context$2_FixedAmountDiscount as FixedAmountDiscount, type context$2_GetReferralRewardRequest as GetReferralRewardRequest, type context$2_GetReferralRewardResponse as GetReferralRewardResponse, type context$2_GetReferralRewardResponseNonNullableFields as GetReferralRewardResponseNonNullableFields, type context$2_Group as Group, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type context$2_LoyaltyPoints as LoyaltyPoints, type MessageEnvelope$2 as MessageEnvelope, type context$2_PercentageDiscount as PercentageDiscount, type context$2_QueryReferralRewardsOptions as QueryReferralRewardsOptions, type context$2_QueryReferralRewardsRequest as QueryReferralRewardsRequest, type context$2_QueryReferralRewardsResponse as QueryReferralRewardsResponse, type context$2_QueryReferralRewardsResponseNonNullableFields as QueryReferralRewardsResponseNonNullableFields, type context$2_ReferralReward as ReferralReward, type context$2_ReferralRewardNonNullableFields as ReferralRewardNonNullableFields, type context$2_ReferralRewardReceiverOneOf as ReferralRewardReceiverOneOf, type context$2_ReferralRewardRewardTypeOptionsOneOf as ReferralRewardRewardTypeOptionsOneOf, type context$2_ReferralRewardsQueryBuilder as ReferralRewardsQueryBuilder, type context$2_ReferralRewardsQueryResult as ReferralRewardsQueryResult, type ReferredFriendDetails$1 as ReferredFriendDetails, type RestoreInfo$2 as RestoreInfo, type context$2_Reward as Reward, type context$2_RewardOptionsOneOf as RewardOptionsOneOf, context$2_RewardTypeType as RewardTypeType, type context$2_RewardsInSite as RewardsInSite, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, Status$1 as Status, type SuccessfulReferralEvent$1 as SuccessfulReferralEvent, context$2_Type as Type, type context$2_V1Coupon as V1Coupon, type context$2_V1LoyaltyPoints as V1LoyaltyPoints, type context$2_ValidateReferralRewardRequest as ValidateReferralRewardRequest, type context$2_ValidateReferralRewardResponse as ValidateReferralRewardResponse, WebhookIdentityType$2 as WebhookIdentityType, context$2_getReferralReward as getReferralReward, context$2_queryReferralRewards as queryReferralRewards };
4466
+ }
4467
+
4468
+ type HostModule$1<T, H extends Host$1> = {
4469
+ __type: 'host';
4470
+ create(host: H): T;
4471
+ };
4472
+ type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
4473
+ type Host$1<Environment = unknown> = {
4474
+ channel: {
4475
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
4476
+ disconnect: () => void;
4477
+ } | Promise<{
4478
+ disconnect: () => void;
4479
+ }>;
4480
+ };
4481
+ environment?: Environment;
4482
+ /**
4483
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
4484
+ */
4485
+ apiBaseUrl?: string;
4486
+ /**
4487
+ * Possible data to be provided by every host, for cross cutting concerns
4488
+ * like internationalization, billing, etc.
4489
+ */
4490
+ essentials?: {
4491
+ /**
4492
+ * The language of the currently viewed session
4493
+ */
4494
+ language?: string;
4495
+ /**
4496
+ * The locale of the currently viewed session
4497
+ */
4498
+ locale?: string;
4499
+ /**
4500
+ * Any headers that should be passed through to the API requests
4501
+ */
4502
+ passThroughHeaders?: Record<string, string>;
4503
+ };
4504
+ };
4505
+
4506
+ type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
4507
+ interface HttpClient$1 {
4508
+ request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
4509
+ fetchWithAuth: typeof fetch;
4510
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
4511
+ getActiveToken?: () => string | undefined;
4512
+ }
4513
+ type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
4514
+ type HttpResponse$1<T = any> = {
4515
+ data: T;
4516
+ status: number;
4517
+ statusText: string;
4518
+ headers: any;
4519
+ request?: any;
4520
+ };
4521
+ type RequestOptions$1<_TResponse = any, Data = any> = {
4522
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
4523
+ url: string;
4524
+ data?: Data;
4525
+ params?: URLSearchParams;
4526
+ } & APIMetadata$1;
4527
+ type APIMetadata$1 = {
4528
+ methodFqn?: string;
4529
+ entityFqdn?: string;
4530
+ packageName?: string;
4531
+ };
4532
+ type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
4533
+ type EventDefinition$3<Payload = unknown, Type extends string = string> = {
4534
+ __type: 'event-definition';
4535
+ type: Type;
4536
+ isDomainEvent?: boolean;
4537
+ transformations?: (envelope: unknown) => Payload;
4538
+ __payload: Payload;
4539
+ };
4540
+ declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
4541
+ type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
4542
+ type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
4543
+
4544
+ type ServicePluginMethodInput$1 = {
4545
+ request: any;
4546
+ metadata: any;
4547
+ };
4548
+ type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
4549
+ type ServicePluginMethodMetadata$1 = {
4550
+ name: string;
4551
+ primaryHttpMappingPath: string;
4552
+ transformations: {
4553
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
4554
+ toREST: (...args: unknown[]) => unknown;
4555
+ };
4556
+ };
4557
+ type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
4558
+ __type: 'service-plugin-definition';
4559
+ componentType: string;
4560
+ methods: ServicePluginMethodMetadata$1[];
4561
+ __contract: Contract;
4562
+ };
4563
+ declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
4564
+ type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
4565
+ declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
4566
+
4567
+ type RequestContext$1 = {
4568
+ isSSR: boolean;
4569
+ host: string;
4570
+ protocol?: string;
4571
+ };
4572
+ type ResponseTransformer$1 = (data: any, headers?: any) => any;
4573
+ /**
4574
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
4575
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
4576
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
4577
+ */
4578
+ type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
4579
+ type AmbassadorRequestOptions$1<T = any> = {
4580
+ _?: T;
4581
+ url?: string;
4582
+ method?: Method$1;
4583
+ params?: any;
4584
+ data?: any;
4585
+ transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
4586
+ };
4587
+ type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
4588
+ __isAmbassador: boolean;
4589
+ };
4590
+ type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
4591
+ type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
4592
+
4593
+ declare global {
4594
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
4595
+ interface SymbolConstructor {
4596
+ readonly observable: symbol;
4597
+ }
4598
+ }
4599
+
4600
+ declare const emptyObjectSymbol$1: unique symbol;
4601
+
4602
+ /**
4603
+ Represents a strictly empty plain object, the `{}` value.
4604
+
4605
+ When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
4606
+
4607
+ @example
4608
+ ```
4609
+ import type {EmptyObject} from 'type-fest';
4610
+
4611
+ // The following illustrates the problem with `{}`.
4612
+ const foo1: {} = {}; // Pass
4613
+ const foo2: {} = []; // Pass
4614
+ const foo3: {} = 42; // Pass
4615
+ const foo4: {} = {a: 1}; // Pass
4616
+
4617
+ // With `EmptyObject` only the first case is valid.
4618
+ const bar1: EmptyObject = {}; // Pass
4619
+ const bar2: EmptyObject = 42; // Fail
4620
+ const bar3: EmptyObject = []; // Fail
4621
+ const bar4: EmptyObject = {a: 1}; // Fail
4622
+ ```
4623
+
4624
+ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
4625
+
4626
+ @category Object
4627
+ */
4628
+ type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
4629
+
4630
+ /**
4631
+ Returns a boolean for whether the two given types are equal.
4632
+
4633
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
4634
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
4635
+
4636
+ Use-cases:
4637
+ - If you want to make a conditional branch based on the result of a comparison of two types.
4638
+
4639
+ @example
4640
+ ```
4641
+ import type {IsEqual} from 'type-fest';
4642
+
4643
+ // This type returns a boolean for whether the given array includes the given item.
4644
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
4645
+ type Includes<Value extends readonly any[], Item> =
4646
+ Value extends readonly [Value[0], ...infer rest]
4647
+ ? IsEqual<Value[0], Item> extends true
4648
+ ? true
4649
+ : Includes<rest, Item>
4650
+ : false;
4651
+ ```
4652
+
4653
+ @category Type Guard
4654
+ @category Utilities
4655
+ */
4656
+ type IsEqual$1<A, B> =
4657
+ (<G>() => G extends A ? 1 : 2) extends
4658
+ (<G>() => G extends B ? 1 : 2)
4659
+ ? true
4660
+ : false;
4661
+
4662
+ /**
4663
+ Filter out keys from an object.
4664
+
4665
+ Returns `never` if `Exclude` is strictly equal to `Key`.
4666
+ Returns `never` if `Key` extends `Exclude`.
4667
+ Returns `Key` otherwise.
4668
+
4669
+ @example
4670
+ ```
4671
+ type Filtered = Filter<'foo', 'foo'>;
4672
+ //=> never
4673
+ ```
4674
+
4675
+ @example
4676
+ ```
4677
+ type Filtered = Filter<'bar', string>;
4678
+ //=> never
4679
+ ```
4680
+
4681
+ @example
4682
+ ```
4683
+ type Filtered = Filter<'bar', 'foo'>;
4684
+ //=> 'bar'
4685
+ ```
4686
+
4687
+ @see {Except}
4688
+ */
4689
+ type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
4690
+
4691
+ type ExceptOptions$1 = {
4692
+ /**
4693
+ Disallow assigning non-specified properties.
4694
+
4695
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
4696
+
4697
+ @default false
4698
+ */
4699
+ requireExactProps?: boolean;
4700
+ };
4701
+
4702
+ /**
4703
+ Create a type from an object type without certain keys.
4704
+
4705
+ We recommend setting the `requireExactProps` option to `true`.
4706
+
4707
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
4708
+
4709
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
4710
+
4711
+ @example
4712
+ ```
4713
+ import type {Except} from 'type-fest';
4714
+
4715
+ type Foo = {
4716
+ a: number;
4717
+ b: string;
4718
+ };
4719
+
4720
+ type FooWithoutA = Except<Foo, 'a'>;
4721
+ //=> {b: string}
4722
+
4723
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
4724
+ //=> errors: 'a' does not exist in type '{ b: string; }'
4725
+
4726
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
4727
+ //=> {a: number} & Partial<Record<"b", never>>
4728
+
4729
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
4730
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
4731
+ ```
4732
+
4733
+ @category Object
4734
+ */
4735
+ type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
4736
+ [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
4737
+ } & (Options['requireExactProps'] extends true
4738
+ ? Partial<Record<KeysType, never>>
4739
+ : {});
4740
+
4741
+ /**
4742
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
4743
+
4744
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
4745
+
4746
+ @example
4747
+ ```
4748
+ import type {ConditionalKeys} from 'type-fest';
4749
+
4750
+ interface Example {
4751
+ a: string;
4752
+ b: string | number;
4753
+ c?: string;
4754
+ d: {};
3589
4755
  }
3590
- declare function queryReferralRewards$1(httpClient: HttpClient): QueryReferralRewardsSignature;
3591
- interface QueryReferralRewardsSignature {
3592
- /**
3593
- * Retrieves a list of referral rewards, given the provided paging, filtering, and sorting.
3594
- *
3595
- * To learn about working with _Query_ endpoints, see
3596
- * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),
3597
- * [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),
3598
- * and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).
3599
- */
3600
- (options?: QueryReferralRewardsOptions | undefined): ReferralRewardsQueryBuilder;
4756
+
4757
+ type StringKeysOnly = ConditionalKeys<Example, string>;
4758
+ //=> 'a'
4759
+ ```
4760
+
4761
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
4762
+
4763
+ @example
4764
+ ```
4765
+ import type {ConditionalKeys} from 'type-fest';
4766
+
4767
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
4768
+ //=> 'a' | 'c'
4769
+ ```
4770
+
4771
+ @category Object
4772
+ */
4773
+ type ConditionalKeys$1<Base, Condition> = NonNullable<
4774
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
4775
+ {
4776
+ // Map through all the keys of the given base type.
4777
+ [Key in keyof Base]:
4778
+ // Pick only keys with types extending the given `Condition` type.
4779
+ Base[Key] extends Condition
4780
+ // Retain this key since the condition passes.
4781
+ ? Key
4782
+ // Discard this key since the condition fails.
4783
+ : never;
4784
+
4785
+ // Convert the produced object into a union type of the keys which passed the conditional test.
4786
+ }[keyof Base]
4787
+ >;
4788
+
4789
+ /**
4790
+ Exclude keys from a shape that matches the given `Condition`.
4791
+
4792
+ This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
4793
+
4794
+ @example
4795
+ ```
4796
+ import type {Primitive, ConditionalExcept} from 'type-fest';
4797
+
4798
+ class Awesome {
4799
+ name: string;
4800
+ successes: number;
4801
+ failures: bigint;
4802
+
4803
+ run() {}
4804
+ }
4805
+
4806
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
4807
+ //=> {run: () => void}
4808
+ ```
4809
+
4810
+ @example
4811
+ ```
4812
+ import type {ConditionalExcept} from 'type-fest';
4813
+
4814
+ interface Example {
4815
+ a: string;
4816
+ b: string | number;
4817
+ c: () => void;
4818
+ d: {};
3601
4819
  }
3602
4820
 
3603
- declare const getReferralReward: MaybeContext<BuildRESTFunction<typeof getReferralReward$1> & typeof getReferralReward$1>;
3604
- declare const queryReferralRewards: MaybeContext<BuildRESTFunction<typeof queryReferralRewards$1> & typeof queryReferralRewards$1>;
4821
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
4822
+ //=> {b: string | number; c: () => void; d: {}}
4823
+ ```
3605
4824
 
3606
- type context$2_BulkGetReferralRewardsRequest = BulkGetReferralRewardsRequest;
3607
- type context$2_BulkGetReferralRewardsResponse = BulkGetReferralRewardsResponse;
3608
- type context$2_Coupon = Coupon;
3609
- type context$2_CouponDiscountTypeOptionsOneOf = CouponDiscountTypeOptionsOneOf;
3610
- type context$2_CouponScope = CouponScope;
3611
- type context$2_CouponScopeOrMinSubtotalOneOf = CouponScopeOrMinSubtotalOneOf;
3612
- type context$2_DiscountType = DiscountType;
3613
- declare const context$2_DiscountType: typeof DiscountType;
3614
- type context$2_FixedAmountDiscount = FixedAmountDiscount;
3615
- type context$2_GetReferralRewardRequest = GetReferralRewardRequest;
3616
- type context$2_GetReferralRewardResponse = GetReferralRewardResponse;
3617
- type context$2_GetReferralRewardResponseNonNullableFields = GetReferralRewardResponseNonNullableFields;
3618
- type context$2_Group = Group;
3619
- type context$2_LoyaltyPoints = LoyaltyPoints;
3620
- type context$2_PercentageDiscount = PercentageDiscount;
3621
- type context$2_QueryReferralRewardsOptions = QueryReferralRewardsOptions;
3622
- type context$2_QueryReferralRewardsRequest = QueryReferralRewardsRequest;
3623
- type context$2_QueryReferralRewardsResponse = QueryReferralRewardsResponse;
3624
- type context$2_QueryReferralRewardsResponseNonNullableFields = QueryReferralRewardsResponseNonNullableFields;
3625
- type context$2_ReferralReward = ReferralReward;
3626
- type context$2_ReferralRewardNonNullableFields = ReferralRewardNonNullableFields;
3627
- type context$2_ReferralRewardReceiverOneOf = ReferralRewardReceiverOneOf;
3628
- type context$2_ReferralRewardRewardTypeOptionsOneOf = ReferralRewardRewardTypeOptionsOneOf;
3629
- type context$2_ReferralRewardsQueryBuilder = ReferralRewardsQueryBuilder;
3630
- type context$2_ReferralRewardsQueryResult = ReferralRewardsQueryResult;
3631
- type context$2_Reward = Reward;
3632
- type context$2_RewardOptionsOneOf = RewardOptionsOneOf;
3633
- type context$2_RewardTypeType = RewardTypeType;
3634
- declare const context$2_RewardTypeType: typeof RewardTypeType;
3635
- type context$2_RewardsInSite = RewardsInSite;
3636
- type context$2_Type = Type;
3637
- declare const context$2_Type: typeof Type;
3638
- type context$2_V1Coupon = V1Coupon;
3639
- type context$2_V1LoyaltyPoints = V1LoyaltyPoints;
3640
- type context$2_ValidateReferralRewardRequest = ValidateReferralRewardRequest;
3641
- type context$2_ValidateReferralRewardResponse = ValidateReferralRewardResponse;
3642
- declare const context$2_getReferralReward: typeof getReferralReward;
3643
- declare const context$2_queryReferralRewards: typeof queryReferralRewards;
3644
- declare namespace context$2 {
3645
- export { type ActionEvent$2 as ActionEvent, type context$2_BulkGetReferralRewardsRequest as BulkGetReferralRewardsRequest, type context$2_BulkGetReferralRewardsResponse as BulkGetReferralRewardsResponse, type context$2_Coupon as Coupon, type context$2_CouponDiscountTypeOptionsOneOf as CouponDiscountTypeOptionsOneOf, type context$2_CouponScope as CouponScope, type context$2_CouponScopeOrMinSubtotalOneOf as CouponScopeOrMinSubtotalOneOf, type CursorPaging$2 as CursorPaging, type CursorPagingMetadata$2 as CursorPagingMetadata, type CursorQuery$2 as CursorQuery, type CursorQueryPagingMethodOneOf$2 as CursorQueryPagingMethodOneOf, type Cursors$2 as Cursors, context$2_DiscountType as DiscountType, type DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type Empty$1 as Empty, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type context$2_FixedAmountDiscount as FixedAmountDiscount, type context$2_GetReferralRewardRequest as GetReferralRewardRequest, type context$2_GetReferralRewardResponse as GetReferralRewardResponse, type context$2_GetReferralRewardResponseNonNullableFields as GetReferralRewardResponseNonNullableFields, type context$2_Group as Group, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type context$2_LoyaltyPoints as LoyaltyPoints, type MessageEnvelope$2 as MessageEnvelope, type context$2_PercentageDiscount as PercentageDiscount, type context$2_QueryReferralRewardsOptions as QueryReferralRewardsOptions, type context$2_QueryReferralRewardsRequest as QueryReferralRewardsRequest, type context$2_QueryReferralRewardsResponse as QueryReferralRewardsResponse, type context$2_QueryReferralRewardsResponseNonNullableFields as QueryReferralRewardsResponseNonNullableFields, type context$2_ReferralReward as ReferralReward, type context$2_ReferralRewardNonNullableFields as ReferralRewardNonNullableFields, type context$2_ReferralRewardReceiverOneOf as ReferralRewardReceiverOneOf, type context$2_ReferralRewardRewardTypeOptionsOneOf as ReferralRewardRewardTypeOptionsOneOf, type context$2_ReferralRewardsQueryBuilder as ReferralRewardsQueryBuilder, type context$2_ReferralRewardsQueryResult as ReferralRewardsQueryResult, type ReferredFriendDetails$1 as ReferredFriendDetails, type RestoreInfo$2 as RestoreInfo, type context$2_Reward as Reward, type context$2_RewardOptionsOneOf as RewardOptionsOneOf, context$2_RewardTypeType as RewardTypeType, type context$2_RewardsInSite as RewardsInSite, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, Status$1 as Status, type SuccessfulReferralEvent$1 as SuccessfulReferralEvent, context$2_Type as Type, type context$2_V1Coupon as V1Coupon, type context$2_V1LoyaltyPoints as V1LoyaltyPoints, type context$2_ValidateReferralRewardRequest as ValidateReferralRewardRequest, type context$2_ValidateReferralRewardResponse as ValidateReferralRewardResponse, WebhookIdentityType$2 as WebhookIdentityType, context$2_getReferralReward as getReferralReward, context$2_queryReferralRewards as queryReferralRewards };
4825
+ @category Object
4826
+ */
4827
+ type ConditionalExcept$1<Base, Condition> = Except$1<
4828
+ Base,
4829
+ ConditionalKeys$1<Base, Condition>
4830
+ >;
4831
+
4832
+ /**
4833
+ * Descriptors are objects that describe the API of a module, and the module
4834
+ * can either be a REST module or a host module.
4835
+ * This type is recursive, so it can describe nested modules.
4836
+ */
4837
+ type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$3<any> | ServicePluginDefinition$1<any> | {
4838
+ [key: string]: Descriptors$1 | PublicMetadata$1 | any;
4839
+ };
4840
+ /**
4841
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
4842
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
4843
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
4844
+ * do not match the given host (as they will not work with the given host).
4845
+ */
4846
+ type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
4847
+ done: T;
4848
+ recurse: T extends {
4849
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
4850
+ } ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$3<any> ? BuildEventDefinition$3<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
4851
+ [Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
4852
+ -1,
4853
+ 0,
4854
+ 1,
4855
+ 2,
4856
+ 3,
4857
+ 4,
4858
+ 5
4859
+ ][Depth]> : never;
4860
+ }, EmptyObject$1>;
4861
+ }[Depth extends -1 ? 'done' : 'recurse'];
4862
+ type PublicMetadata$1 = {
4863
+ PACKAGE_NAME?: string;
4864
+ };
4865
+
4866
+ declare global {
4867
+ interface ContextualClient {
4868
+ }
3646
4869
  }
4870
+ /**
4871
+ * A type used to create concerete types from SDK descriptors in
4872
+ * case a contextual client is available.
4873
+ */
4874
+ type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
4875
+ host: Host$1;
4876
+ } ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
3647
4877
 
3648
4878
  interface ReferredFriend {
3649
4879
  /**
@@ -4140,178 +5370,588 @@ interface ReferredFriendsQueryBuilder {
4140
5370
  /** @param cursor - A pointer to specific record
4141
5371
  * @documentationMaturity preview
4142
5372
  */
4143
- skipTo: (cursor: string) => ReferredFriendsQueryBuilder;
4144
- /** @documentationMaturity preview */
4145
- find: () => Promise<ReferredFriendsQueryResult>;
5373
+ skipTo: (cursor: string) => ReferredFriendsQueryBuilder;
5374
+ /** @documentationMaturity preview */
5375
+ find: () => Promise<ReferredFriendsQueryResult>;
5376
+ }
5377
+
5378
+ declare function createReferredFriend$1(httpClient: HttpClient$1): CreateReferredFriendSignature;
5379
+ interface CreateReferredFriendSignature {
5380
+ /**
5381
+ * Creates a new referred friend or returns an existing entity if it already exists.
5382
+ *
5383
+ * This method must be called with a [member identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities#site-members).
5384
+ *
5385
+ * A referral code must be provided either in the request or via scope.
5386
+ *
5387
+ * The member must be eligible to become a referred friend.
5388
+ */
5389
+ (options?: CreateReferredFriendOptions | undefined): Promise<CreateReferredFriendResponse & CreateReferredFriendResponseNonNullableFields>;
5390
+ }
5391
+ declare function getReferredFriend$1(httpClient: HttpClient$1): GetReferredFriendSignature;
5392
+ interface GetReferredFriendSignature {
5393
+ /**
5394
+ * Retrieves a referred friend by ID.
5395
+ * @param - ID of the referred friend to retrieve.
5396
+ */
5397
+ (referredFriendId: string): Promise<GetReferredFriendResponse & GetReferredFriendResponseNonNullableFields>;
5398
+ }
5399
+ declare function getReferredFriendByContactId$1(httpClient: HttpClient$1): GetReferredFriendByContactIdSignature;
5400
+ interface GetReferredFriendByContactIdSignature {
5401
+ /**
5402
+ * Retrieves a referred friend by contact ID.
5403
+ *
5404
+ * You can use `me` instead of a specific contact ID to get the referred friend for the current identity's contact.
5405
+ * @param - Contact ID or "me" to get the current identity's contact.
5406
+ * @returns Retrieved referred friend.
5407
+ */
5408
+ (contactId: string): Promise<ReferredFriend & ReferredFriendNonNullableFields>;
5409
+ }
5410
+ declare function updateReferredFriend$1(httpClient: HttpClient$1): UpdateReferredFriendSignature;
5411
+ interface UpdateReferredFriendSignature {
5412
+ /**
5413
+ * Updates a referred friend. Supports partial updates.
5414
+ *
5415
+ * You must pass the latest `revision` for a successful update.
5416
+ * @param - ID of the referred friend.
5417
+ * @returns Updated referred friend.
5418
+ */
5419
+ (_id: string, referredFriend: UpdateReferredFriend): Promise<ReferredFriend & ReferredFriendNonNullableFields>;
5420
+ }
5421
+ declare function deleteReferredFriend$1(httpClient: HttpClient$1): DeleteReferredFriendSignature;
5422
+ interface DeleteReferredFriendSignature {
5423
+ /**
5424
+ * Deletes a referred friend.
5425
+ * @param - ID of the referred friend to delete.
5426
+ */
5427
+ (referredFriendId: string, options?: DeleteReferredFriendOptions | undefined): Promise<void>;
5428
+ }
5429
+ declare function queryReferredFriend$1(httpClient: HttpClient$1): QueryReferredFriendSignature;
5430
+ interface QueryReferredFriendSignature {
5431
+ /**
5432
+ * Creates a query to retrieve a list of referred friends.
5433
+ *
5434
+ * The `queryReferredFriend()` function builds a query to retrieve a list of events and returns a `ReferredFriendsQueryBuilder` object.
5435
+ *
5436
+ * The returned object contains the query definition, which is typically used to run the query using the `find()` function.
5437
+ *
5438
+ * You can refine the query by chaining `ReferredFriendsQueryBuilder` functions onto the query. `ReferredFriendsQueryBuilder` functions enable you to sort, filter, and control the results `queryReferredFriend()` returns.
5439
+ *
5440
+ * `queryReferredFriend()` runs with these `ReferredFriendQueryBuilder` defaults, which you can override:
5441
+ *
5442
+ * - `limit(50)`
5443
+ * - `descending("_createdDate")`
5444
+ *
5445
+ * The functions that are chained to `queryReferredFriend()` are applied in the order they're called. For example, if you apply ascending('status') and then descending('referringCustomerId'), the results are sorted first by the status, and then, if there are multiple results with the same status, the items are sorted by referring customer ID.
5446
+ */
5447
+ (): ReferredFriendsQueryBuilder;
5448
+ }
5449
+ declare const onReferredFriendCreated$1: EventDefinition$3<ReferredFriendCreatedEnvelope, "wix.loyalty.referral.v1.referred_friend_created">;
5450
+ declare const onReferredFriendUpdated$1: EventDefinition$3<ReferredFriendUpdatedEnvelope, "wix.loyalty.referral.v1.referred_friend_updated">;
5451
+ declare const onReferredFriendDeleted$1: EventDefinition$3<ReferredFriendDeletedEnvelope, "wix.loyalty.referral.v1.referred_friend_deleted">;
5452
+
5453
+ type EventDefinition$2<Payload = unknown, Type extends string = string> = {
5454
+ __type: 'event-definition';
5455
+ type: Type;
5456
+ isDomainEvent?: boolean;
5457
+ transformations?: (envelope: unknown) => Payload;
5458
+ __payload: Payload;
5459
+ };
5460
+ declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
5461
+ type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
5462
+ type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
5463
+
5464
+ declare global {
5465
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5466
+ interface SymbolConstructor {
5467
+ readonly observable: symbol;
5468
+ }
5469
+ }
5470
+
5471
+ declare function createEventModule$1<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
5472
+
5473
+ declare const createReferredFriend: MaybeContext$1<BuildRESTFunction$1<typeof createReferredFriend$1> & typeof createReferredFriend$1>;
5474
+ declare const getReferredFriend: MaybeContext$1<BuildRESTFunction$1<typeof getReferredFriend$1> & typeof getReferredFriend$1>;
5475
+ declare const getReferredFriendByContactId: MaybeContext$1<BuildRESTFunction$1<typeof getReferredFriendByContactId$1> & typeof getReferredFriendByContactId$1>;
5476
+ declare const updateReferredFriend: MaybeContext$1<BuildRESTFunction$1<typeof updateReferredFriend$1> & typeof updateReferredFriend$1>;
5477
+ declare const deleteReferredFriend: MaybeContext$1<BuildRESTFunction$1<typeof deleteReferredFriend$1> & typeof deleteReferredFriend$1>;
5478
+ declare const queryReferredFriend: MaybeContext$1<BuildRESTFunction$1<typeof queryReferredFriend$1> & typeof queryReferredFriend$1>;
5479
+
5480
+ type _publicOnReferredFriendCreatedType = typeof onReferredFriendCreated$1;
5481
+ /**
5482
+ * Triggered when a referred friend is created.
5483
+ */
5484
+ declare const onReferredFriendCreated: ReturnType<typeof createEventModule$1<_publicOnReferredFriendCreatedType>>;
5485
+
5486
+ type _publicOnReferredFriendUpdatedType = typeof onReferredFriendUpdated$1;
5487
+ /**
5488
+ * Triggered when a referred friend is updated.
5489
+ */
5490
+ declare const onReferredFriendUpdated: ReturnType<typeof createEventModule$1<_publicOnReferredFriendUpdatedType>>;
5491
+
5492
+ type _publicOnReferredFriendDeletedType = typeof onReferredFriendDeleted$1;
5493
+ /**
5494
+ * Triggered when a referred friend is deleted.
5495
+ */
5496
+ declare const onReferredFriendDeleted: ReturnType<typeof createEventModule$1<_publicOnReferredFriendDeletedType>>;
5497
+
5498
+ type context$1_CreateReferredFriendOptions = CreateReferredFriendOptions;
5499
+ type context$1_CreateReferredFriendRequest = CreateReferredFriendRequest;
5500
+ type context$1_CreateReferredFriendResponse = CreateReferredFriendResponse;
5501
+ type context$1_CreateReferredFriendResponseNonNullableFields = CreateReferredFriendResponseNonNullableFields;
5502
+ type context$1_DeleteReferredFriendOptions = DeleteReferredFriendOptions;
5503
+ type context$1_DeleteReferredFriendRequest = DeleteReferredFriendRequest;
5504
+ type context$1_DeleteReferredFriendResponse = DeleteReferredFriendResponse;
5505
+ type context$1_Empty = Empty;
5506
+ type context$1_GetReferredFriendByContactIdRequest = GetReferredFriendByContactIdRequest;
5507
+ type context$1_GetReferredFriendByContactIdResponse = GetReferredFriendByContactIdResponse;
5508
+ type context$1_GetReferredFriendByContactIdResponseNonNullableFields = GetReferredFriendByContactIdResponseNonNullableFields;
5509
+ type context$1_GetReferredFriendRequest = GetReferredFriendRequest;
5510
+ type context$1_GetReferredFriendResponse = GetReferredFriendResponse;
5511
+ type context$1_GetReferredFriendResponseNonNullableFields = GetReferredFriendResponseNonNullableFields;
5512
+ type context$1_QueryReferredFriendRequest = QueryReferredFriendRequest;
5513
+ type context$1_QueryReferredFriendResponse = QueryReferredFriendResponse;
5514
+ type context$1_QueryReferredFriendResponseNonNullableFields = QueryReferredFriendResponseNonNullableFields;
5515
+ type context$1_ReferredFriend = ReferredFriend;
5516
+ type context$1_ReferredFriendCreatedEnvelope = ReferredFriendCreatedEnvelope;
5517
+ type context$1_ReferredFriendDeletedEnvelope = ReferredFriendDeletedEnvelope;
5518
+ type context$1_ReferredFriendDetails = ReferredFriendDetails;
5519
+ type context$1_ReferredFriendNonNullableFields = ReferredFriendNonNullableFields;
5520
+ type context$1_ReferredFriendUpdatedEnvelope = ReferredFriendUpdatedEnvelope;
5521
+ type context$1_ReferredFriendsQueryBuilder = ReferredFriendsQueryBuilder;
5522
+ type context$1_ReferredFriendsQueryResult = ReferredFriendsQueryResult;
5523
+ type context$1_Status = Status;
5524
+ declare const context$1_Status: typeof Status;
5525
+ type context$1_SuccessfulReferralEvent = SuccessfulReferralEvent;
5526
+ type context$1_UpdateReferredFriend = UpdateReferredFriend;
5527
+ type context$1_UpdateReferredFriendRequest = UpdateReferredFriendRequest;
5528
+ type context$1_UpdateReferredFriendResponse = UpdateReferredFriendResponse;
5529
+ type context$1_UpdateReferredFriendResponseNonNullableFields = UpdateReferredFriendResponseNonNullableFields;
5530
+ type context$1__publicOnReferredFriendCreatedType = _publicOnReferredFriendCreatedType;
5531
+ type context$1__publicOnReferredFriendDeletedType = _publicOnReferredFriendDeletedType;
5532
+ type context$1__publicOnReferredFriendUpdatedType = _publicOnReferredFriendUpdatedType;
5533
+ declare const context$1_createReferredFriend: typeof createReferredFriend;
5534
+ declare const context$1_deleteReferredFriend: typeof deleteReferredFriend;
5535
+ declare const context$1_getReferredFriend: typeof getReferredFriend;
5536
+ declare const context$1_getReferredFriendByContactId: typeof getReferredFriendByContactId;
5537
+ declare const context$1_onReferredFriendCreated: typeof onReferredFriendCreated;
5538
+ declare const context$1_onReferredFriendDeleted: typeof onReferredFriendDeleted;
5539
+ declare const context$1_onReferredFriendUpdated: typeof onReferredFriendUpdated;
5540
+ declare const context$1_queryReferredFriend: typeof queryReferredFriend;
5541
+ declare const context$1_updateReferredFriend: typeof updateReferredFriend;
5542
+ declare namespace context$1 {
5543
+ export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type context$1_CreateReferredFriendOptions as CreateReferredFriendOptions, type context$1_CreateReferredFriendRequest as CreateReferredFriendRequest, type context$1_CreateReferredFriendResponse as CreateReferredFriendResponse, type context$1_CreateReferredFriendResponseNonNullableFields as CreateReferredFriendResponseNonNullableFields, type CursorPaging$1 as CursorPaging, type CursorPagingMetadata$1 as CursorPagingMetadata, type CursorQuery$1 as CursorQuery, type CursorQueryPagingMethodOneOf$1 as CursorQueryPagingMethodOneOf, type Cursors$1 as Cursors, type context$1_DeleteReferredFriendOptions as DeleteReferredFriendOptions, type context$1_DeleteReferredFriendRequest as DeleteReferredFriendRequest, type context$1_DeleteReferredFriendResponse as DeleteReferredFriendResponse, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type context$1_Empty as Empty, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type context$1_GetReferredFriendByContactIdRequest as GetReferredFriendByContactIdRequest, type context$1_GetReferredFriendByContactIdResponse as GetReferredFriendByContactIdResponse, type context$1_GetReferredFriendByContactIdResponseNonNullableFields as GetReferredFriendByContactIdResponseNonNullableFields, type context$1_GetReferredFriendRequest as GetReferredFriendRequest, type context$1_GetReferredFriendResponse as GetReferredFriendResponse, type context$1_GetReferredFriendResponseNonNullableFields as GetReferredFriendResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type context$1_QueryReferredFriendRequest as QueryReferredFriendRequest, type context$1_QueryReferredFriendResponse as QueryReferredFriendResponse, type context$1_QueryReferredFriendResponseNonNullableFields as QueryReferredFriendResponseNonNullableFields, type context$1_ReferredFriend as ReferredFriend, type context$1_ReferredFriendCreatedEnvelope as ReferredFriendCreatedEnvelope, type context$1_ReferredFriendDeletedEnvelope as ReferredFriendDeletedEnvelope, type context$1_ReferredFriendDetails as ReferredFriendDetails, type context$1_ReferredFriendNonNullableFields as ReferredFriendNonNullableFields, type context$1_ReferredFriendUpdatedEnvelope as ReferredFriendUpdatedEnvelope, type context$1_ReferredFriendsQueryBuilder as ReferredFriendsQueryBuilder, type context$1_ReferredFriendsQueryResult as ReferredFriendsQueryResult, type RestoreInfo$1 as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, context$1_Status as Status, type context$1_SuccessfulReferralEvent as SuccessfulReferralEvent, type context$1_UpdateReferredFriend as UpdateReferredFriend, type context$1_UpdateReferredFriendRequest as UpdateReferredFriendRequest, type context$1_UpdateReferredFriendResponse as UpdateReferredFriendResponse, type context$1_UpdateReferredFriendResponseNonNullableFields as UpdateReferredFriendResponseNonNullableFields, WebhookIdentityType$1 as WebhookIdentityType, type context$1__publicOnReferredFriendCreatedType as _publicOnReferredFriendCreatedType, type context$1__publicOnReferredFriendDeletedType as _publicOnReferredFriendDeletedType, type context$1__publicOnReferredFriendUpdatedType as _publicOnReferredFriendUpdatedType, 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, onReferredFriendCreated$1 as publicOnReferredFriendCreated, onReferredFriendDeleted$1 as publicOnReferredFriendDeleted, onReferredFriendUpdated$1 as publicOnReferredFriendUpdated, context$1_queryReferredFriend as queryReferredFriend, context$1_updateReferredFriend as updateReferredFriend };
5544
+ }
5545
+
5546
+ type HostModule<T, H extends Host> = {
5547
+ __type: 'host';
5548
+ create(host: H): T;
5549
+ };
5550
+ type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
5551
+ type Host<Environment = unknown> = {
5552
+ channel: {
5553
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
5554
+ disconnect: () => void;
5555
+ } | Promise<{
5556
+ disconnect: () => void;
5557
+ }>;
5558
+ };
5559
+ environment?: Environment;
5560
+ /**
5561
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
5562
+ */
5563
+ apiBaseUrl?: string;
5564
+ /**
5565
+ * Possible data to be provided by every host, for cross cutting concerns
5566
+ * like internationalization, billing, etc.
5567
+ */
5568
+ essentials?: {
5569
+ /**
5570
+ * The language of the currently viewed session
5571
+ */
5572
+ language?: string;
5573
+ /**
5574
+ * The locale of the currently viewed session
5575
+ */
5576
+ locale?: string;
5577
+ /**
5578
+ * Any headers that should be passed through to the API requests
5579
+ */
5580
+ passThroughHeaders?: Record<string, string>;
5581
+ };
5582
+ };
5583
+
5584
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
5585
+ interface HttpClient {
5586
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
5587
+ fetchWithAuth: typeof fetch;
5588
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
5589
+ getActiveToken?: () => string | undefined;
5590
+ }
5591
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
5592
+ type HttpResponse<T = any> = {
5593
+ data: T;
5594
+ status: number;
5595
+ statusText: string;
5596
+ headers: any;
5597
+ request?: any;
5598
+ };
5599
+ type RequestOptions<_TResponse = any, Data = any> = {
5600
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
5601
+ url: string;
5602
+ data?: Data;
5603
+ params?: URLSearchParams;
5604
+ } & APIMetadata;
5605
+ type APIMetadata = {
5606
+ methodFqn?: string;
5607
+ entityFqdn?: string;
5608
+ packageName?: string;
5609
+ };
5610
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
5611
+ type EventDefinition$1<Payload = unknown, Type extends string = string> = {
5612
+ __type: 'event-definition';
5613
+ type: Type;
5614
+ isDomainEvent?: boolean;
5615
+ transformations?: (envelope: unknown) => Payload;
5616
+ __payload: Payload;
5617
+ };
5618
+ declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
5619
+ type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
5620
+ type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
5621
+
5622
+ type ServicePluginMethodInput = {
5623
+ request: any;
5624
+ metadata: any;
5625
+ };
5626
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
5627
+ type ServicePluginMethodMetadata = {
5628
+ name: string;
5629
+ primaryHttpMappingPath: string;
5630
+ transformations: {
5631
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
5632
+ toREST: (...args: unknown[]) => unknown;
5633
+ };
5634
+ };
5635
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
5636
+ __type: 'service-plugin-definition';
5637
+ componentType: string;
5638
+ methods: ServicePluginMethodMetadata[];
5639
+ __contract: Contract;
5640
+ };
5641
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
5642
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
5643
+ declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
5644
+
5645
+ type RequestContext = {
5646
+ isSSR: boolean;
5647
+ host: string;
5648
+ protocol?: string;
5649
+ };
5650
+ type ResponseTransformer = (data: any, headers?: any) => any;
5651
+ /**
5652
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
5653
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
5654
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
5655
+ */
5656
+ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
5657
+ type AmbassadorRequestOptions<T = any> = {
5658
+ _?: T;
5659
+ url?: string;
5660
+ method?: Method;
5661
+ params?: any;
5662
+ data?: any;
5663
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
5664
+ };
5665
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
5666
+ __isAmbassador: boolean;
5667
+ };
5668
+ type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
5669
+ type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
5670
+
5671
+ declare global {
5672
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5673
+ interface SymbolConstructor {
5674
+ readonly observable: symbol;
5675
+ }
4146
5676
  }
4147
5677
 
4148
- declare function createReferredFriend$1(httpClient: HttpClient): CreateReferredFriendSignature;
4149
- interface CreateReferredFriendSignature {
4150
- /**
4151
- * Creates a new referred friend or returns an existing entity if it already exists.
4152
- *
4153
- * This method must be called with a [member identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities#site-members).
4154
- *
4155
- * A referral code must be provided either in the request or via scope.
4156
- *
4157
- * The member must be eligible to become a referred friend.
4158
- */
4159
- (options?: CreateReferredFriendOptions | undefined): Promise<CreateReferredFriendResponse & CreateReferredFriendResponseNonNullableFields>;
4160
- }
4161
- declare function getReferredFriend$1(httpClient: HttpClient): GetReferredFriendSignature;
4162
- interface GetReferredFriendSignature {
4163
- /**
4164
- * Retrieves a referred friend by ID.
4165
- * @param - ID of the referred friend to retrieve.
4166
- */
4167
- (referredFriendId: string): Promise<GetReferredFriendResponse & GetReferredFriendResponseNonNullableFields>;
4168
- }
4169
- declare function getReferredFriendByContactId$1(httpClient: HttpClient): GetReferredFriendByContactIdSignature;
4170
- interface GetReferredFriendByContactIdSignature {
4171
- /**
4172
- * Retrieves a referred friend by contact ID.
4173
- *
4174
- * You can use `me` instead of a specific contact ID to get the referred friend for the current identity's contact.
4175
- * @param - Contact ID or "me" to get the current identity's contact.
4176
- * @returns Retrieved referred friend.
4177
- */
4178
- (contactId: string): Promise<ReferredFriend & ReferredFriendNonNullableFields>;
4179
- }
4180
- declare function updateReferredFriend$1(httpClient: HttpClient): UpdateReferredFriendSignature;
4181
- interface UpdateReferredFriendSignature {
4182
- /**
4183
- * Updates a referred friend. Supports partial updates.
4184
- *
4185
- * You must pass the latest `revision` for a successful update.
4186
- * @param - ID of the referred friend.
4187
- * @returns Updated referred friend.
4188
- */
4189
- (_id: string, referredFriend: UpdateReferredFriend): Promise<ReferredFriend & ReferredFriendNonNullableFields>;
4190
- }
4191
- declare function deleteReferredFriend$1(httpClient: HttpClient): DeleteReferredFriendSignature;
4192
- interface DeleteReferredFriendSignature {
4193
- /**
4194
- * Deletes a referred friend.
4195
- * @param - ID of the referred friend to delete.
4196
- */
4197
- (referredFriendId: string, options?: DeleteReferredFriendOptions | undefined): Promise<void>;
5678
+ declare const emptyObjectSymbol: unique symbol;
5679
+
5680
+ /**
5681
+ Represents a strictly empty plain object, the `{}` value.
5682
+
5683
+ When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
5684
+
5685
+ @example
5686
+ ```
5687
+ import type {EmptyObject} from 'type-fest';
5688
+
5689
+ // The following illustrates the problem with `{}`.
5690
+ const foo1: {} = {}; // Pass
5691
+ const foo2: {} = []; // Pass
5692
+ const foo3: {} = 42; // Pass
5693
+ const foo4: {} = {a: 1}; // Pass
5694
+
5695
+ // With `EmptyObject` only the first case is valid.
5696
+ const bar1: EmptyObject = {}; // Pass
5697
+ const bar2: EmptyObject = 42; // Fail
5698
+ const bar3: EmptyObject = []; // Fail
5699
+ const bar4: EmptyObject = {a: 1}; // Fail
5700
+ ```
5701
+
5702
+ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
5703
+
5704
+ @category Object
5705
+ */
5706
+ type EmptyObject = {[emptyObjectSymbol]?: never};
5707
+
5708
+ /**
5709
+ Returns a boolean for whether the two given types are equal.
5710
+
5711
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
5712
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
5713
+
5714
+ Use-cases:
5715
+ - If you want to make a conditional branch based on the result of a comparison of two types.
5716
+
5717
+ @example
5718
+ ```
5719
+ import type {IsEqual} from 'type-fest';
5720
+
5721
+ // This type returns a boolean for whether the given array includes the given item.
5722
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
5723
+ type Includes<Value extends readonly any[], Item> =
5724
+ Value extends readonly [Value[0], ...infer rest]
5725
+ ? IsEqual<Value[0], Item> extends true
5726
+ ? true
5727
+ : Includes<rest, Item>
5728
+ : false;
5729
+ ```
5730
+
5731
+ @category Type Guard
5732
+ @category Utilities
5733
+ */
5734
+ type IsEqual<A, B> =
5735
+ (<G>() => G extends A ? 1 : 2) extends
5736
+ (<G>() => G extends B ? 1 : 2)
5737
+ ? true
5738
+ : false;
5739
+
5740
+ /**
5741
+ Filter out keys from an object.
5742
+
5743
+ Returns `never` if `Exclude` is strictly equal to `Key`.
5744
+ Returns `never` if `Key` extends `Exclude`.
5745
+ Returns `Key` otherwise.
5746
+
5747
+ @example
5748
+ ```
5749
+ type Filtered = Filter<'foo', 'foo'>;
5750
+ //=> never
5751
+ ```
5752
+
5753
+ @example
5754
+ ```
5755
+ type Filtered = Filter<'bar', string>;
5756
+ //=> never
5757
+ ```
5758
+
5759
+ @example
5760
+ ```
5761
+ type Filtered = Filter<'bar', 'foo'>;
5762
+ //=> 'bar'
5763
+ ```
5764
+
5765
+ @see {Except}
5766
+ */
5767
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
5768
+
5769
+ type ExceptOptions = {
5770
+ /**
5771
+ Disallow assigning non-specified properties.
5772
+
5773
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
5774
+
5775
+ @default false
5776
+ */
5777
+ requireExactProps?: boolean;
5778
+ };
5779
+
5780
+ /**
5781
+ Create a type from an object type without certain keys.
5782
+
5783
+ We recommend setting the `requireExactProps` option to `true`.
5784
+
5785
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
5786
+
5787
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
5788
+
5789
+ @example
5790
+ ```
5791
+ import type {Except} from 'type-fest';
5792
+
5793
+ type Foo = {
5794
+ a: number;
5795
+ b: string;
5796
+ };
5797
+
5798
+ type FooWithoutA = Except<Foo, 'a'>;
5799
+ //=> {b: string}
5800
+
5801
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
5802
+ //=> errors: 'a' does not exist in type '{ b: string; }'
5803
+
5804
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
5805
+ //=> {a: number} & Partial<Record<"b", never>>
5806
+
5807
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
5808
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
5809
+ ```
5810
+
5811
+ @category Object
5812
+ */
5813
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
5814
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
5815
+ } & (Options['requireExactProps'] extends true
5816
+ ? Partial<Record<KeysType, never>>
5817
+ : {});
5818
+
5819
+ /**
5820
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
5821
+
5822
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
5823
+
5824
+ @example
5825
+ ```
5826
+ import type {ConditionalKeys} from 'type-fest';
5827
+
5828
+ interface Example {
5829
+ a: string;
5830
+ b: string | number;
5831
+ c?: string;
5832
+ d: {};
4198
5833
  }
4199
- declare function queryReferredFriend$1(httpClient: HttpClient): QueryReferredFriendSignature;
4200
- interface QueryReferredFriendSignature {
4201
- /**
4202
- * Creates a query to retrieve a list of referred friends.
4203
- *
4204
- * The `queryReferredFriend()` function builds a query to retrieve a list of events and returns a `ReferredFriendsQueryBuilder` object.
4205
- *
4206
- * The returned object contains the query definition, which is typically used to run the query using the `find()` function.
4207
- *
4208
- * You can refine the query by chaining `ReferredFriendsQueryBuilder` functions onto the query. `ReferredFriendsQueryBuilder` functions enable you to sort, filter, and control the results `queryReferredFriend()` returns.
4209
- *
4210
- * `queryReferredFriend()` runs with these `ReferredFriendQueryBuilder` defaults, which you can override:
4211
- *
4212
- * - `limit(50)`
4213
- * - `descending("_createdDate")`
4214
- *
4215
- * The functions that are chained to `queryReferredFriend()` are applied in the order they're called. For example, if you apply ascending('status') and then descending('referringCustomerId'), the results are sorted first by the status, and then, if there are multiple results with the same status, the items are sorted by referring customer ID.
4216
- */
4217
- (): ReferredFriendsQueryBuilder;
5834
+
5835
+ type StringKeysOnly = ConditionalKeys<Example, string>;
5836
+ //=> 'a'
5837
+ ```
5838
+
5839
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
5840
+
5841
+ @example
5842
+ ```
5843
+ import type {ConditionalKeys} from 'type-fest';
5844
+
5845
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
5846
+ //=> 'a' | 'c'
5847
+ ```
5848
+
5849
+ @category Object
5850
+ */
5851
+ type ConditionalKeys<Base, Condition> = NonNullable<
5852
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
5853
+ {
5854
+ // Map through all the keys of the given base type.
5855
+ [Key in keyof Base]:
5856
+ // Pick only keys with types extending the given `Condition` type.
5857
+ Base[Key] extends Condition
5858
+ // Retain this key since the condition passes.
5859
+ ? Key
5860
+ // Discard this key since the condition fails.
5861
+ : never;
5862
+
5863
+ // Convert the produced object into a union type of the keys which passed the conditional test.
5864
+ }[keyof Base]
5865
+ >;
5866
+
5867
+ /**
5868
+ Exclude keys from a shape that matches the given `Condition`.
5869
+
5870
+ This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
5871
+
5872
+ @example
5873
+ ```
5874
+ import type {Primitive, ConditionalExcept} from 'type-fest';
5875
+
5876
+ class Awesome {
5877
+ name: string;
5878
+ successes: number;
5879
+ failures: bigint;
5880
+
5881
+ run() {}
4218
5882
  }
4219
- declare const onReferredFriendCreated$1: EventDefinition$4<ReferredFriendCreatedEnvelope, "wix.loyalty.referral.v1.referred_friend_created">;
4220
- declare const onReferredFriendUpdated$1: EventDefinition$4<ReferredFriendUpdatedEnvelope, "wix.loyalty.referral.v1.referred_friend_updated">;
4221
- declare const onReferredFriendDeleted$1: EventDefinition$4<ReferredFriendDeletedEnvelope, "wix.loyalty.referral.v1.referred_friend_deleted">;
4222
5883
 
4223
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
4224
- __type: 'event-definition';
4225
- type: Type;
4226
- isDomainEvent?: boolean;
4227
- transformations?: (envelope: unknown) => Payload;
4228
- __payload: Payload;
4229
- };
4230
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
4231
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
4232
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
5884
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
5885
+ //=> {run: () => void}
5886
+ ```
4233
5887
 
4234
- declare global {
4235
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
4236
- interface SymbolConstructor {
4237
- readonly observable: symbol;
4238
- }
5888
+ @example
5889
+ ```
5890
+ import type {ConditionalExcept} from 'type-fest';
5891
+
5892
+ interface Example {
5893
+ a: string;
5894
+ b: string | number;
5895
+ c: () => void;
5896
+ d: {};
4239
5897
  }
4240
5898
 
4241
- declare function createEventModule$1<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
5899
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
5900
+ //=> {b: string | number; c: () => void; d: {}}
5901
+ ```
4242
5902
 
4243
- declare const createReferredFriend: MaybeContext<BuildRESTFunction<typeof createReferredFriend$1> & typeof createReferredFriend$1>;
4244
- declare const getReferredFriend: MaybeContext<BuildRESTFunction<typeof getReferredFriend$1> & typeof getReferredFriend$1>;
4245
- declare const getReferredFriendByContactId: MaybeContext<BuildRESTFunction<typeof getReferredFriendByContactId$1> & typeof getReferredFriendByContactId$1>;
4246
- declare const updateReferredFriend: MaybeContext<BuildRESTFunction<typeof updateReferredFriend$1> & typeof updateReferredFriend$1>;
4247
- declare const deleteReferredFriend: MaybeContext<BuildRESTFunction<typeof deleteReferredFriend$1> & typeof deleteReferredFriend$1>;
4248
- declare const queryReferredFriend: MaybeContext<BuildRESTFunction<typeof queryReferredFriend$1> & typeof queryReferredFriend$1>;
5903
+ @category Object
5904
+ */
5905
+ type ConditionalExcept<Base, Condition> = Except<
5906
+ Base,
5907
+ ConditionalKeys<Base, Condition>
5908
+ >;
4249
5909
 
4250
- type _publicOnReferredFriendCreatedType = typeof onReferredFriendCreated$1;
4251
5910
  /**
4252
- * Triggered when a referred friend is created.
5911
+ * Descriptors are objects that describe the API of a module, and the module
5912
+ * can either be a REST module or a host module.
5913
+ * This type is recursive, so it can describe nested modules.
4253
5914
  */
4254
- declare const onReferredFriendCreated: ReturnType<typeof createEventModule$1<_publicOnReferredFriendCreatedType>>;
4255
-
4256
- type _publicOnReferredFriendUpdatedType = typeof onReferredFriendUpdated$1;
5915
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$1<any> | ServicePluginDefinition<any> | {
5916
+ [key: string]: Descriptors | PublicMetadata | any;
5917
+ };
4257
5918
  /**
4258
- * Triggered when a referred friend is updated.
5919
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
5920
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
5921
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
5922
+ * do not match the given host (as they will not work with the given host).
4259
5923
  */
4260
- declare const onReferredFriendUpdated: ReturnType<typeof createEventModule$1<_publicOnReferredFriendUpdatedType>>;
5924
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
5925
+ done: T;
5926
+ recurse: T extends {
5927
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
5928
+ } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
5929
+ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
5930
+ -1,
5931
+ 0,
5932
+ 1,
5933
+ 2,
5934
+ 3,
5935
+ 4,
5936
+ 5
5937
+ ][Depth]> : never;
5938
+ }, EmptyObject>;
5939
+ }[Depth extends -1 ? 'done' : 'recurse'];
5940
+ type PublicMetadata = {
5941
+ PACKAGE_NAME?: string;
5942
+ };
4261
5943
 
4262
- type _publicOnReferredFriendDeletedType = typeof onReferredFriendDeleted$1;
5944
+ declare global {
5945
+ interface ContextualClient {
5946
+ }
5947
+ }
4263
5948
  /**
4264
- * Triggered when a referred friend is deleted.
5949
+ * A type used to create concerete types from SDK descriptors in
5950
+ * case a contextual client is available.
4265
5951
  */
4266
- declare const onReferredFriendDeleted: ReturnType<typeof createEventModule$1<_publicOnReferredFriendDeletedType>>;
4267
-
4268
- type context$1_CreateReferredFriendOptions = CreateReferredFriendOptions;
4269
- type context$1_CreateReferredFriendRequest = CreateReferredFriendRequest;
4270
- type context$1_CreateReferredFriendResponse = CreateReferredFriendResponse;
4271
- type context$1_CreateReferredFriendResponseNonNullableFields = CreateReferredFriendResponseNonNullableFields;
4272
- type context$1_DeleteReferredFriendOptions = DeleteReferredFriendOptions;
4273
- type context$1_DeleteReferredFriendRequest = DeleteReferredFriendRequest;
4274
- type context$1_DeleteReferredFriendResponse = DeleteReferredFriendResponse;
4275
- type context$1_Empty = Empty;
4276
- type context$1_GetReferredFriendByContactIdRequest = GetReferredFriendByContactIdRequest;
4277
- type context$1_GetReferredFriendByContactIdResponse = GetReferredFriendByContactIdResponse;
4278
- type context$1_GetReferredFriendByContactIdResponseNonNullableFields = GetReferredFriendByContactIdResponseNonNullableFields;
4279
- type context$1_GetReferredFriendRequest = GetReferredFriendRequest;
4280
- type context$1_GetReferredFriendResponse = GetReferredFriendResponse;
4281
- type context$1_GetReferredFriendResponseNonNullableFields = GetReferredFriendResponseNonNullableFields;
4282
- type context$1_QueryReferredFriendRequest = QueryReferredFriendRequest;
4283
- type context$1_QueryReferredFriendResponse = QueryReferredFriendResponse;
4284
- type context$1_QueryReferredFriendResponseNonNullableFields = QueryReferredFriendResponseNonNullableFields;
4285
- type context$1_ReferredFriend = ReferredFriend;
4286
- type context$1_ReferredFriendCreatedEnvelope = ReferredFriendCreatedEnvelope;
4287
- type context$1_ReferredFriendDeletedEnvelope = ReferredFriendDeletedEnvelope;
4288
- type context$1_ReferredFriendDetails = ReferredFriendDetails;
4289
- type context$1_ReferredFriendNonNullableFields = ReferredFriendNonNullableFields;
4290
- type context$1_ReferredFriendUpdatedEnvelope = ReferredFriendUpdatedEnvelope;
4291
- type context$1_ReferredFriendsQueryBuilder = ReferredFriendsQueryBuilder;
4292
- type context$1_ReferredFriendsQueryResult = ReferredFriendsQueryResult;
4293
- type context$1_Status = Status;
4294
- declare const context$1_Status: typeof Status;
4295
- type context$1_SuccessfulReferralEvent = SuccessfulReferralEvent;
4296
- type context$1_UpdateReferredFriend = UpdateReferredFriend;
4297
- type context$1_UpdateReferredFriendRequest = UpdateReferredFriendRequest;
4298
- type context$1_UpdateReferredFriendResponse = UpdateReferredFriendResponse;
4299
- type context$1_UpdateReferredFriendResponseNonNullableFields = UpdateReferredFriendResponseNonNullableFields;
4300
- type context$1__publicOnReferredFriendCreatedType = _publicOnReferredFriendCreatedType;
4301
- type context$1__publicOnReferredFriendDeletedType = _publicOnReferredFriendDeletedType;
4302
- type context$1__publicOnReferredFriendUpdatedType = _publicOnReferredFriendUpdatedType;
4303
- declare const context$1_createReferredFriend: typeof createReferredFriend;
4304
- declare const context$1_deleteReferredFriend: typeof deleteReferredFriend;
4305
- declare const context$1_getReferredFriend: typeof getReferredFriend;
4306
- declare const context$1_getReferredFriendByContactId: typeof getReferredFriendByContactId;
4307
- declare const context$1_onReferredFriendCreated: typeof onReferredFriendCreated;
4308
- declare const context$1_onReferredFriendDeleted: typeof onReferredFriendDeleted;
4309
- declare const context$1_onReferredFriendUpdated: typeof onReferredFriendUpdated;
4310
- declare const context$1_queryReferredFriend: typeof queryReferredFriend;
4311
- declare const context$1_updateReferredFriend: typeof updateReferredFriend;
4312
- declare namespace context$1 {
4313
- export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type context$1_CreateReferredFriendOptions as CreateReferredFriendOptions, type context$1_CreateReferredFriendRequest as CreateReferredFriendRequest, type context$1_CreateReferredFriendResponse as CreateReferredFriendResponse, type context$1_CreateReferredFriendResponseNonNullableFields as CreateReferredFriendResponseNonNullableFields, type CursorPaging$1 as CursorPaging, type CursorPagingMetadata$1 as CursorPagingMetadata, type CursorQuery$1 as CursorQuery, type CursorQueryPagingMethodOneOf$1 as CursorQueryPagingMethodOneOf, type Cursors$1 as Cursors, type context$1_DeleteReferredFriendOptions as DeleteReferredFriendOptions, type context$1_DeleteReferredFriendRequest as DeleteReferredFriendRequest, type context$1_DeleteReferredFriendResponse as DeleteReferredFriendResponse, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type context$1_Empty as Empty, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type context$1_GetReferredFriendByContactIdRequest as GetReferredFriendByContactIdRequest, type context$1_GetReferredFriendByContactIdResponse as GetReferredFriendByContactIdResponse, type context$1_GetReferredFriendByContactIdResponseNonNullableFields as GetReferredFriendByContactIdResponseNonNullableFields, type context$1_GetReferredFriendRequest as GetReferredFriendRequest, type context$1_GetReferredFriendResponse as GetReferredFriendResponse, type context$1_GetReferredFriendResponseNonNullableFields as GetReferredFriendResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type context$1_QueryReferredFriendRequest as QueryReferredFriendRequest, type context$1_QueryReferredFriendResponse as QueryReferredFriendResponse, type context$1_QueryReferredFriendResponseNonNullableFields as QueryReferredFriendResponseNonNullableFields, type context$1_ReferredFriend as ReferredFriend, type context$1_ReferredFriendCreatedEnvelope as ReferredFriendCreatedEnvelope, type context$1_ReferredFriendDeletedEnvelope as ReferredFriendDeletedEnvelope, type context$1_ReferredFriendDetails as ReferredFriendDetails, type context$1_ReferredFriendNonNullableFields as ReferredFriendNonNullableFields, type context$1_ReferredFriendUpdatedEnvelope as ReferredFriendUpdatedEnvelope, type context$1_ReferredFriendsQueryBuilder as ReferredFriendsQueryBuilder, type context$1_ReferredFriendsQueryResult as ReferredFriendsQueryResult, type RestoreInfo$1 as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, context$1_Status as Status, type context$1_SuccessfulReferralEvent as SuccessfulReferralEvent, type context$1_UpdateReferredFriend as UpdateReferredFriend, type context$1_UpdateReferredFriendRequest as UpdateReferredFriendRequest, type context$1_UpdateReferredFriendResponse as UpdateReferredFriendResponse, type context$1_UpdateReferredFriendResponseNonNullableFields as UpdateReferredFriendResponseNonNullableFields, WebhookIdentityType$1 as WebhookIdentityType, type context$1__publicOnReferredFriendCreatedType as _publicOnReferredFriendCreatedType, type context$1__publicOnReferredFriendDeletedType as _publicOnReferredFriendDeletedType, type context$1__publicOnReferredFriendUpdatedType as _publicOnReferredFriendUpdatedType, 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, onReferredFriendCreated$1 as publicOnReferredFriendCreated, onReferredFriendDeleted$1 as publicOnReferredFriendDeleted, onReferredFriendUpdated$1 as publicOnReferredFriendUpdated, context$1_queryReferredFriend as queryReferredFriend, context$1_updateReferredFriend as updateReferredFriend };
4314
- }
5952
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
5953
+ host: Host;
5954
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
4315
5955
 
4316
5956
  interface ReferringCustomer {
4317
5957
  /**
@@ -4776,8 +6416,8 @@ interface DeleteReferringCustomerSignature {
4776
6416
  */
4777
6417
  (referringCustomerId: string, options?: DeleteReferringCustomerOptions | undefined): Promise<void>;
4778
6418
  }
4779
- declare const onReferringCustomerCreated$1: EventDefinition$4<ReferringCustomerCreatedEnvelope, "wix.loyalty.referral.v1.referring_customer_created">;
4780
- declare const onReferringCustomerDeleted$1: EventDefinition$4<ReferringCustomerDeletedEnvelope, "wix.loyalty.referral.v1.referring_customer_deleted">;
6419
+ declare const onReferringCustomerCreated$1: EventDefinition$1<ReferringCustomerCreatedEnvelope, "wix.loyalty.referral.v1.referring_customer_created">;
6420
+ declare const onReferringCustomerDeleted$1: EventDefinition$1<ReferringCustomerDeletedEnvelope, "wix.loyalty.referral.v1.referring_customer_deleted">;
4781
6421
 
4782
6422
  type EventDefinition<Payload = unknown, Type extends string = string> = {
4783
6423
  __type: 'event-definition';