@wix/referral 1.0.38 → 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.
- package/package.json +3 -3
- package/type-bundles/context.bundle.d.ts +2153 -511
- package/type-bundles/index.bundle.d.ts +2153 -511
|
@@ -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$
|
|
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$
|
|
74
|
-
type EventHandler$
|
|
75
|
-
type BuildEventDefinition$
|
|
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$
|
|
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$
|
|
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$
|
|
1853
|
+
declare const onProgramUpdated$1: EventDefinition$8<ProgramUpdatedEnvelope, "wix.loyalty.referral.v1.program_updated">;
|
|
1854
1854
|
|
|
1855
|
-
type EventDefinition$
|
|
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$
|
|
1863
|
-
type EventHandler$
|
|
1864
|
-
type BuildEventDefinition$
|
|
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,18 +1870,20 @@ declare global {
|
|
|
1870
1870
|
}
|
|
1871
1871
|
}
|
|
1872
1872
|
|
|
1873
|
-
declare function createEventModule$3<T extends EventDefinition$
|
|
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
|
+
/**
|
|
1885
|
+
* Triggered when a referral program is updated.
|
|
1886
|
+
*/
|
|
1885
1887
|
declare const onProgramUpdated: ReturnType<typeof createEventModule$3<_publicOnProgramUpdatedType>>;
|
|
1886
1888
|
|
|
1887
1889
|
type index_d$4_AISocialMediaPostSuggestion = AISocialMediaPostSuggestion;
|
|
@@ -2005,166 +2007,576 @@ declare namespace index_d$4 {
|
|
|
2005
2007
|
export { type index_d$4_AISocialMediaPostSuggestion as AISocialMediaPostSuggestion, index_d$4_Action as Action, type ActionEvent$4 as ActionEvent, type index_d$4_ActivateReferralProgramRequest as ActivateReferralProgramRequest, type index_d$4_ActivateReferralProgramResponse as ActivateReferralProgramResponse, type index_d$4_ActivateReferralProgramResponseNonNullableFields as ActivateReferralProgramResponseNonNullableFields, index_d$4_App as App, type index_d$4_Asset as Asset, type BaseEventMetadata$3 as BaseEventMetadata, type index_d$4_BillingReference as BillingReference, type index_d$4_BulkGetReferralProgramRequest as BulkGetReferralProgramRequest, type index_d$4_BulkGetReferralProgramResponse as BulkGetReferralProgramResponse, type index_d$4_CancellationDetails as CancellationDetails, index_d$4_ContractSwitchReason as ContractSwitchReason, index_d$4_ContractSwitchType as ContractSwitchType, type index_d$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 index_d$4_Cycle as Cycle, type index_d$4_CycleCycleSelectorOneOf as CycleCycleSelectorOneOf, type index_d$4_DeleteContext as DeleteContext, index_d$4_DeleteStatus as DeleteStatus, DiscountType$2 as DiscountType, type DomainEvent$4 as DomainEvent, type DomainEventBodyOneOf$4 as DomainEventBodyOneOf, type index_d$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 index_d$4_GenerateAISocialMediaPostsSuggestionsRequest as GenerateAISocialMediaPostsSuggestionsRequest, type index_d$4_GenerateAISocialMediaPostsSuggestionsResponse as GenerateAISocialMediaPostsSuggestionsResponse, type index_d$4_GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields as GenerateAISocialMediaPostsSuggestionsResponseNonNullableFields, type index_d$4_GenerateAiSocialMediaPostsSuggestionsOptions as GenerateAiSocialMediaPostsSuggestionsOptions, type index_d$4_GetAISocialMediaPostsSuggestionsRequest as GetAISocialMediaPostsSuggestionsRequest, type index_d$4_GetAISocialMediaPostsSuggestionsResponse as GetAISocialMediaPostsSuggestionsResponse, type index_d$4_GetAISocialMediaPostsSuggestionsResponseNonNullableFields as GetAISocialMediaPostsSuggestionsResponseNonNullableFields, type index_d$4_GetAiSocialMediaPostsSuggestionsOptions as GetAiSocialMediaPostsSuggestionsOptions, type index_d$4_GetReferralProgramPremiumFeaturesRequest as GetReferralProgramPremiumFeaturesRequest, type index_d$4_GetReferralProgramPremiumFeaturesResponse as GetReferralProgramPremiumFeaturesResponse, type index_d$4_GetReferralProgramPremiumFeaturesResponseNonNullableFields as GetReferralProgramPremiumFeaturesResponseNonNullableFields, type index_d$4_GetReferralProgramRequest as GetReferralProgramRequest, type index_d$4_GetReferralProgramResponse as GetReferralProgramResponse, type index_d$4_GetReferralProgramResponseNonNullableFields as GetReferralProgramResponseNonNullableFields, type Group$2 as Group, type index_d$4_HtmlSitePublished as HtmlSitePublished, type IdentificationData$4 as IdentificationData, type IdentificationDataIdOneOf$4 as IdentificationDataIdOneOf, index_d$4_Initiator as Initiator, type index_d$4_Interval as Interval, index_d$4_IntervalUnit as IntervalUnit, type LoyaltyPoints$2 as LoyaltyPoints, type MessageEnvelope$4 as MessageEnvelope, type index_d$4_MetaSiteSpecialEvent as MetaSiteSpecialEvent, type index_d$4_MetaSiteSpecialEventPayloadOneOf as MetaSiteSpecialEventPayloadOneOf, index_d$4_Namespace as Namespace, type index_d$4_NamespaceChanged as NamespaceChanged, type index_d$4_OneTime as OneTime, type index_d$4_Page as Page, type index_d$4_PauseReferralProgramRequest as PauseReferralProgramRequest, type index_d$4_PauseReferralProgramResponse as PauseReferralProgramResponse, type index_d$4_PauseReferralProgramResponseNonNullableFields as PauseReferralProgramResponseNonNullableFields, type PercentageDiscount$2 as PercentageDiscount, type index_d$4_PremiumFeatures as PremiumFeatures, index_d$4_PriceIncreaseTrigger as PriceIncreaseTrigger, index_d$4_ProductAdjustment as ProductAdjustment, type index_d$4_ProductPriceIncreaseData as ProductPriceIncreaseData, type index_d$4_ProgramInSite as ProgramInSite, index_d$4_ProgramStatus as ProgramStatus, type index_d$4_ProgramUpdatedEnvelope as ProgramUpdatedEnvelope, index_d$4_ProviderName as ProviderName, type index_d$4_ReactivationData as ReactivationData, index_d$4_ReactivationReasonEnum as ReactivationReasonEnum, type index_d$4_RecurringChargeSucceeded as RecurringChargeSucceeded, type index_d$4_ReferralProgram as ReferralProgram, type RestoreInfo$4 as RestoreInfo, type Reward$2 as Reward, type RewardOptionsOneOf$1 as RewardOptionsOneOf, type index_d$4_ServiceProvisioned as ServiceProvisioned, type index_d$4_ServiceRemoved as ServiceRemoved, type index_d$4_SiteCreated as SiteCreated, index_d$4_SiteCreatedContext as SiteCreatedContext, type index_d$4_SiteDeleted as SiteDeleted, type index_d$4_SiteHardDeleted as SiteHardDeleted, type index_d$4_SiteMarkedAsTemplate as SiteMarkedAsTemplate, type index_d$4_SiteMarkedAsWixSite as SiteMarkedAsWixSite, type index_d$4_SitePublished as SitePublished, type index_d$4_SiteRenamed as SiteRenamed, type index_d$4_SiteTransferred as SiteTransferred, type index_d$4_SiteUndeleted as SiteUndeleted, type index_d$4_SiteUnpublished as SiteUnpublished, index_d$4_State as State, type index_d$4_StudioAssigned as StudioAssigned, type index_d$4_StudioUnassigned as StudioUnassigned, type index_d$4_Subscription as Subscription, type index_d$4_SubscriptionAssigned as SubscriptionAssigned, type index_d$4_SubscriptionAutoRenewTurnedOff as SubscriptionAutoRenewTurnedOff, type index_d$4_SubscriptionAutoRenewTurnedOn as SubscriptionAutoRenewTurnedOn, type index_d$4_SubscriptionCancelled as SubscriptionCancelled, type index_d$4_SubscriptionCreated as SubscriptionCreated, type index_d$4_SubscriptionEvent as SubscriptionEvent, type index_d$4_SubscriptionEventEventOneOf as SubscriptionEventEventOneOf, type index_d$4_SubscriptionNearEndOfPeriod as SubscriptionNearEndOfPeriod, type index_d$4_SubscriptionPendingChange as SubscriptionPendingChange, index_d$4_SubscriptionStatus as SubscriptionStatus, type index_d$4_SubscriptionTransferred as SubscriptionTransferred, type index_d$4_SubscriptionUnassigned as SubscriptionUnassigned, Type$1 as Type, index_d$4_UnassignReason as UnassignReason, type index_d$4_UpdateReferralProgramRequest as UpdateReferralProgramRequest, type index_d$4_UpdateReferralProgramResponse as UpdateReferralProgramResponse, type index_d$4_UpdateReferralProgramResponseNonNullableFields as UpdateReferralProgramResponseNonNullableFields, WebhookIdentityType$4 as WebhookIdentityType, type index_d$4__publicOnProgramUpdatedType as _publicOnProgramUpdatedType, index_d$4_activateReferralProgram as activateReferralProgram, index_d$4_generateAiSocialMediaPostsSuggestions as generateAiSocialMediaPostsSuggestions, index_d$4_getAiSocialMediaPostsSuggestions as getAiSocialMediaPostsSuggestions, index_d$4_getReferralProgram as getReferralProgram, index_d$4_getReferralProgramPremiumFeatures as getReferralProgramPremiumFeatures, index_d$4_onProgramUpdated as onProgramUpdated, index_d$4_pauseReferralProgram as pauseReferralProgram, onProgramUpdated$1 as publicOnProgramUpdated, index_d$4_updateReferralProgram as updateReferralProgram };
|
|
2006
2008
|
}
|
|
2007
2009
|
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
/**
|
|
2023
|
-
* Revision number, which increments by 1 each time the referral event is updated.
|
|
2024
|
-
* To prevent conflicting changes, the current revision must be passed when updating the referral event.
|
|
2025
|
-
*/
|
|
2026
|
-
revision?: string | null;
|
|
2027
|
-
/**
|
|
2028
|
-
* Date and time the referral event was created.
|
|
2029
|
-
* @readonly
|
|
2030
|
-
*/
|
|
2031
|
-
_createdDate?: Date;
|
|
2032
|
-
/**
|
|
2033
|
-
* Date and time the referral event was last updated.
|
|
2034
|
-
* @readonly
|
|
2035
|
-
*/
|
|
2036
|
-
_updatedDate?: Date;
|
|
2037
|
-
}
|
|
2038
|
-
/** @oneof */
|
|
2039
|
-
interface ReferralEventEventTypeOneOf {
|
|
2040
|
-
/** Event triggered when a referred friend signs up. */
|
|
2041
|
-
referredFriendSignupEvent?: ReferredFriendSignupEvent;
|
|
2042
|
-
/** Event triggered when a referral is successful. For example, customer places and pays for an order. */
|
|
2043
|
-
successfulReferralEvent?: V1SuccessfulReferralEvent;
|
|
2044
|
-
/** Event triggered when an action is performed. For example, placing an order. */
|
|
2045
|
-
actionEvent?: V1ActionEvent;
|
|
2046
|
-
/** Event triggered when a reward is given. */
|
|
2047
|
-
rewardEvent?: RewardEvent;
|
|
2048
|
-
}
|
|
2049
|
-
interface ReferredFriendSignupEvent {
|
|
2050
|
-
/** ID of the referred friend */
|
|
2051
|
-
referredFriendId?: string;
|
|
2052
|
-
}
|
|
2053
|
-
interface V1SuccessfulReferralEvent {
|
|
2054
|
-
/** ID of the referred friend */
|
|
2055
|
-
referredFriendId?: string;
|
|
2056
|
-
/** ID of the referring customer */
|
|
2057
|
-
referringCustomerId?: string;
|
|
2058
|
-
}
|
|
2059
|
-
interface V1ActionEvent {
|
|
2060
|
-
/** ID of the referred friend */
|
|
2061
|
-
referredFriendId?: string;
|
|
2062
|
-
/** ID of the referring customer */
|
|
2063
|
-
referringCustomerId?: string;
|
|
2064
|
-
/** Trigger for the action */
|
|
2065
|
-
trigger?: V1Trigger;
|
|
2066
|
-
/** Amount associated with the action. */
|
|
2067
|
-
amount?: string | null;
|
|
2068
|
-
/** Currency of the amount. */
|
|
2069
|
-
currency?: string | null;
|
|
2070
|
-
/** ID of the associated order. */
|
|
2071
|
-
orderId?: string | null;
|
|
2072
|
-
}
|
|
2073
|
-
interface V1Trigger {
|
|
2074
|
-
/** ID of the app that triggered the event */
|
|
2075
|
-
appId?: string;
|
|
2076
|
-
/** Type of activity that triggered the event */
|
|
2077
|
-
activityType?: string;
|
|
2078
|
-
}
|
|
2079
|
-
interface RewardEvent extends RewardEventReceiverOneOf {
|
|
2080
|
-
/**
|
|
2081
|
-
* ID of the rewarded referring customer.
|
|
2082
|
-
* @readonly
|
|
2083
|
-
*/
|
|
2084
|
-
rewardedReferringCustomerId?: string;
|
|
2085
|
-
/**
|
|
2086
|
-
* ID of the rewarded referred friend.
|
|
2087
|
-
* @readonly
|
|
2088
|
-
*/
|
|
2089
|
-
rewardedReferredFriendId?: string;
|
|
2090
|
-
/** ID of the referral reward. */
|
|
2091
|
-
referralRewardId?: string;
|
|
2092
|
-
/** Type of reward. */
|
|
2093
|
-
rewardType?: Reward$1;
|
|
2094
|
-
}
|
|
2095
|
-
/** @oneof */
|
|
2096
|
-
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;
|
|
2097
2024
|
/**
|
|
2098
|
-
*
|
|
2099
|
-
* @readonly
|
|
2025
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
2100
2026
|
*/
|
|
2101
|
-
|
|
2027
|
+
apiBaseUrl?: string;
|
|
2102
2028
|
/**
|
|
2103
|
-
*
|
|
2104
|
-
*
|
|
2029
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
2030
|
+
* like internationalization, billing, etc.
|
|
2105
2031
|
*/
|
|
2106
|
-
|
|
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;
|
|
2107
2054
|
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
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
|
+
}
|
|
2117
2140
|
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
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: {};
|
|
2137
2297
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
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() {}
|
|
2157
2346
|
}
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
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: {};
|
|
2166
2361
|
}
|
|
2167
|
-
|
|
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 {
|
|
2168
2580
|
/** Name of the field to sort by. */
|
|
2169
2581
|
fieldName?: string;
|
|
2170
2582
|
/** Sort order. */
|
|
@@ -2840,7 +3252,7 @@ interface QueryReferredFriendActionsOptions {
|
|
|
2840
3252
|
contactIds?: string[];
|
|
2841
3253
|
}
|
|
2842
3254
|
|
|
2843
|
-
declare function getReferralEvent$1(httpClient: HttpClient): GetReferralEventSignature;
|
|
3255
|
+
declare function getReferralEvent$1(httpClient: HttpClient$3): GetReferralEventSignature;
|
|
2844
3256
|
interface GetReferralEventSignature {
|
|
2845
3257
|
/**
|
|
2846
3258
|
* Retrieves a referral event by ID.
|
|
@@ -2849,7 +3261,7 @@ interface GetReferralEventSignature {
|
|
|
2849
3261
|
*/
|
|
2850
3262
|
(referralEventId: string): Promise<ReferralEvent & ReferralEventNonNullableFields>;
|
|
2851
3263
|
}
|
|
2852
|
-
declare function queryReferralEvent$1(httpClient: HttpClient): QueryReferralEventSignature;
|
|
3264
|
+
declare function queryReferralEvent$1(httpClient: HttpClient$3): QueryReferralEventSignature;
|
|
2853
3265
|
interface QueryReferralEventSignature {
|
|
2854
3266
|
/**
|
|
2855
3267
|
* Retrieves a list of referral events, given the provided paging, filtering, and sorting.
|
|
@@ -2861,14 +3273,14 @@ interface QueryReferralEventSignature {
|
|
|
2861
3273
|
*/
|
|
2862
3274
|
(): ReferralEventsQueryBuilder;
|
|
2863
3275
|
}
|
|
2864
|
-
declare function getReferralStatistics$1(httpClient: HttpClient): GetReferralStatisticsSignature;
|
|
3276
|
+
declare function getReferralStatistics$1(httpClient: HttpClient$3): GetReferralStatisticsSignature;
|
|
2865
3277
|
interface GetReferralStatisticsSignature {
|
|
2866
3278
|
/**
|
|
2867
3279
|
* Retrieves referral statistics.
|
|
2868
3280
|
*/
|
|
2869
3281
|
(): Promise<GetReferralStatisticsResponse & GetReferralStatisticsResponseNonNullableFields>;
|
|
2870
3282
|
}
|
|
2871
|
-
declare function queryReferringCustomerTotals$1(httpClient: HttpClient): QueryReferringCustomerTotalsSignature;
|
|
3283
|
+
declare function queryReferringCustomerTotals$1(httpClient: HttpClient$3): QueryReferringCustomerTotalsSignature;
|
|
2872
3284
|
interface QueryReferringCustomerTotalsSignature {
|
|
2873
3285
|
/**
|
|
2874
3286
|
* Retrieves a list of referring customer totals, given the provided paging, filtering, and sorting.
|
|
@@ -2880,7 +3292,7 @@ interface QueryReferringCustomerTotalsSignature {
|
|
|
2880
3292
|
*/
|
|
2881
3293
|
(options?: QueryReferringCustomerTotalsOptions | undefined): Promise<QueryReferringCustomerTotalsResponse & QueryReferringCustomerTotalsResponseNonNullableFields>;
|
|
2882
3294
|
}
|
|
2883
|
-
declare function queryReferredFriendActions$1(httpClient: HttpClient): QueryReferredFriendActionsSignature;
|
|
3295
|
+
declare function queryReferredFriendActions$1(httpClient: HttpClient$3): QueryReferredFriendActionsSignature;
|
|
2884
3296
|
interface QueryReferredFriendActionsSignature {
|
|
2885
3297
|
/**
|
|
2886
3298
|
* Retrieves a list of referred friend actions, given the provided paging, filtering, and sorting.
|
|
@@ -2892,18 +3304,18 @@ interface QueryReferredFriendActionsSignature {
|
|
|
2892
3304
|
*/
|
|
2893
3305
|
(options?: QueryReferredFriendActionsOptions | undefined): Promise<QueryReferredFriendActionsResponse & QueryReferredFriendActionsResponseNonNullableFields>;
|
|
2894
3306
|
}
|
|
2895
|
-
declare const onReferralEventCreated$1: EventDefinition$
|
|
3307
|
+
declare const onReferralEventCreated$1: EventDefinition$6<ReferralEventCreatedEnvelope, "wix.loyalty.referral.v1.referral_event_created">;
|
|
2896
3308
|
|
|
2897
|
-
type EventDefinition$
|
|
3309
|
+
type EventDefinition$5<Payload = unknown, Type extends string = string> = {
|
|
2898
3310
|
__type: 'event-definition';
|
|
2899
3311
|
type: Type;
|
|
2900
3312
|
isDomainEvent?: boolean;
|
|
2901
3313
|
transformations?: (envelope: unknown) => Payload;
|
|
2902
3314
|
__payload: Payload;
|
|
2903
3315
|
};
|
|
2904
|
-
declare function EventDefinition$
|
|
2905
|
-
type EventHandler$
|
|
2906
|
-
type BuildEventDefinition$
|
|
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;
|
|
2907
3319
|
|
|
2908
3320
|
declare global {
|
|
2909
3321
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -2912,13 +3324,13 @@ declare global {
|
|
|
2912
3324
|
}
|
|
2913
3325
|
}
|
|
2914
3326
|
|
|
2915
|
-
declare function createEventModule$2<T extends EventDefinition$
|
|
3327
|
+
declare function createEventModule$2<T extends EventDefinition$5<any, string>>(eventDefinition: T): BuildEventDefinition$5<T> & T;
|
|
2916
3328
|
|
|
2917
|
-
declare const getReferralEvent: MaybeContext<BuildRESTFunction<typeof getReferralEvent$1> & typeof getReferralEvent$1>;
|
|
2918
|
-
declare const queryReferralEvent: MaybeContext<BuildRESTFunction<typeof queryReferralEvent$1> & typeof queryReferralEvent$1>;
|
|
2919
|
-
declare const getReferralStatistics: MaybeContext<BuildRESTFunction<typeof getReferralStatistics$1> & typeof getReferralStatistics$1>;
|
|
2920
|
-
declare const queryReferringCustomerTotals: MaybeContext<BuildRESTFunction<typeof queryReferringCustomerTotals$1> & typeof queryReferringCustomerTotals$1>;
|
|
2921
|
-
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>;
|
|
2922
3334
|
|
|
2923
3335
|
type _publicOnReferralEventCreatedType = typeof onReferralEventCreated$1;
|
|
2924
3336
|
/** */
|
|
@@ -2971,71 +3383,481 @@ declare namespace index_d$3 {
|
|
|
2971
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 index_d$3_CreateReferralEventRequest as CreateReferralEventRequest, type index_d$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 index_d$3_GetReferralEventRequest as GetReferralEventRequest, type index_d$3_GetReferralEventResponse as GetReferralEventResponse, type index_d$3_GetReferralEventResponseNonNullableFields as GetReferralEventResponseNonNullableFields, type index_d$3_GetReferralStatisticsRequest as GetReferralStatisticsRequest, type index_d$3_GetReferralStatisticsResponse as GetReferralStatisticsResponse, type index_d$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 index_d$3_QueryReferralEventRequest as QueryReferralEventRequest, type index_d$3_QueryReferralEventResponse as QueryReferralEventResponse, type index_d$3_QueryReferralEventResponseNonNullableFields as QueryReferralEventResponseNonNullableFields, type index_d$3_QueryReferredFriendActionsOptions as QueryReferredFriendActionsOptions, type index_d$3_QueryReferredFriendActionsRequest as QueryReferredFriendActionsRequest, type index_d$3_QueryReferredFriendActionsResponse as QueryReferredFriendActionsResponse, type index_d$3_QueryReferredFriendActionsResponseNonNullableFields as QueryReferredFriendActionsResponseNonNullableFields, type index_d$3_QueryReferringCustomerTotalsOptions as QueryReferringCustomerTotalsOptions, type index_d$3_QueryReferringCustomerTotalsRequest as QueryReferringCustomerTotalsRequest, type index_d$3_QueryReferringCustomerTotalsResponse as QueryReferringCustomerTotalsResponse, type index_d$3_QueryReferringCustomerTotalsResponseNonNullableFields as QueryReferringCustomerTotalsResponseNonNullableFields, type index_d$3_ReferralEvent as ReferralEvent, type index_d$3_ReferralEventCreatedEnvelope as ReferralEventCreatedEnvelope, type index_d$3_ReferralEventEventTypeOneOf as ReferralEventEventTypeOneOf, type index_d$3_ReferralEventNonNullableFields as ReferralEventNonNullableFields, type index_d$3_ReferralEventsQueryBuilder as ReferralEventsQueryBuilder, type index_d$3_ReferralEventsQueryResult as ReferralEventsQueryResult, type index_d$3_ReferredFriendAction as ReferredFriendAction, type index_d$3_ReferredFriendActionEvent as ReferredFriendActionEvent, type index_d$3_ReferredFriendActionRewardTypeOptionsOneOf as ReferredFriendActionRewardTypeOptionsOneOf, type ReferredFriendDetails$2 as ReferredFriendDetails, type index_d$3_ReferredFriendSignupEvent as ReferredFriendSignupEvent, type index_d$3_ReferringCustomerTotal as ReferringCustomerTotal, type RestoreInfo$3 as RestoreInfo, Reward$1 as Reward, type index_d$3_RewardEvent as RewardEvent, type index_d$3_RewardEventReceiverOneOf as RewardEventReceiverOneOf, SortOrder$3 as SortOrder, type Sorting$3 as Sorting, Status$2 as Status, type SuccessfulReferralEvent$2 as SuccessfulReferralEvent, type index_d$3_Trigger as Trigger, type index_d$3_V1ActionEvent as V1ActionEvent, type V1Coupon$1 as V1Coupon, type index_d$3_V1SuccessfulReferralEvent as V1SuccessfulReferralEvent, type index_d$3_V1Trigger as V1Trigger, WebhookIdentityType$3 as WebhookIdentityType, type index_d$3__publicOnReferralEventCreatedType as _publicOnReferralEventCreatedType, index_d$3_getReferralEvent as getReferralEvent, index_d$3_getReferralStatistics as getReferralStatistics, index_d$3_onReferralEventCreated as onReferralEventCreated, onReferralEventCreated$1 as publicOnReferralEventCreated, index_d$3_queryReferralEvent as queryReferralEvent, index_d$3_queryReferredFriendActions as queryReferredFriendActions, index_d$3_queryReferringCustomerTotals as queryReferringCustomerTotals };
|
|
2972
3384
|
}
|
|
2973
3385
|
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
loyaltyPoints?: V1LoyaltyPoints;
|
|
2989
|
-
/**
|
|
2990
|
-
* Referral reward ID.
|
|
2991
|
-
* @readonly
|
|
2992
|
-
*/
|
|
2993
|
-
_id?: string | null;
|
|
2994
|
-
/**
|
|
2995
|
-
* Revision number, which increments by 1 each time the referral reward is updated.
|
|
2996
|
-
* To prevent conflicting changes, the current revision must be passed when updating the referral reward.
|
|
2997
|
-
*/
|
|
2998
|
-
revision?: 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;
|
|
2999
3400
|
/**
|
|
3000
|
-
*
|
|
3001
|
-
* @readonly
|
|
3401
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
3002
3402
|
*/
|
|
3003
|
-
|
|
3403
|
+
apiBaseUrl?: string;
|
|
3004
3404
|
/**
|
|
3005
|
-
*
|
|
3006
|
-
*
|
|
3405
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
3406
|
+
* like internationalization, billing, etc.
|
|
3007
3407
|
*/
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
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;
|
|
3019
3430
|
}
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
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
|
+
}
|
|
3032
3516
|
}
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
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
|
|
3829
|
+
*/
|
|
3830
|
+
_updatedDate?: Date;
|
|
3831
|
+
/**
|
|
3832
|
+
* Type of reward given.
|
|
3833
|
+
*
|
|
3834
|
+
* Possible values:
|
|
3835
|
+
* - `UNKNOWN`: Unknown reward.
|
|
3836
|
+
* - `COUPON`: A loyalty coupon is given.
|
|
3837
|
+
* - `LOYALTY_POINTS`: Loyalty points are awarded.
|
|
3838
|
+
* - `NOTHING`: No reward is given.
|
|
3839
|
+
*/
|
|
3840
|
+
rewardType?: RewardTypeType;
|
|
3841
|
+
}
|
|
3842
|
+
/** @oneof */
|
|
3843
|
+
interface ReferralRewardReceiverOneOf {
|
|
3844
|
+
/**
|
|
3845
|
+
* ID of the referring customer who received the reward.
|
|
3846
|
+
* @readonly
|
|
3847
|
+
*/
|
|
3848
|
+
rewardedReferringCustomerId?: string;
|
|
3849
|
+
/**
|
|
3850
|
+
* ID of the referred friend who received the reward.
|
|
3851
|
+
* @readonly
|
|
3852
|
+
*/
|
|
3853
|
+
rewardedReferredFriendId?: string;
|
|
3854
|
+
}
|
|
3855
|
+
/** @oneof */
|
|
3856
|
+
interface ReferralRewardRewardTypeOptionsOneOf {
|
|
3857
|
+
/** Details of a coupon reward. Present when `reward_type` is `COUPON`. */
|
|
3858
|
+
coupon?: V1Coupon;
|
|
3859
|
+
/** Details of a loyalty points reward. Present when `reward_type` is `LOYALTY_POINTS`. */
|
|
3860
|
+
loyaltyPoints?: V1LoyaltyPoints;
|
|
3039
3861
|
}
|
|
3040
3862
|
declare enum RewardTypeType {
|
|
3041
3863
|
/** Unknown reward. */
|
|
@@ -3576,7 +4398,7 @@ interface ReferralRewardsQueryBuilder {
|
|
|
3576
4398
|
find: () => Promise<ReferralRewardsQueryResult>;
|
|
3577
4399
|
}
|
|
3578
4400
|
|
|
3579
|
-
declare function getReferralReward$1(httpClient: HttpClient): GetReferralRewardSignature;
|
|
4401
|
+
declare function getReferralReward$1(httpClient: HttpClient$2): GetReferralRewardSignature;
|
|
3580
4402
|
interface GetReferralRewardSignature {
|
|
3581
4403
|
/**
|
|
3582
4404
|
* Retrieves a referral reward.
|
|
@@ -3585,7 +4407,7 @@ interface GetReferralRewardSignature {
|
|
|
3585
4407
|
*/
|
|
3586
4408
|
(_id: string): Promise<ReferralReward & ReferralRewardNonNullableFields>;
|
|
3587
4409
|
}
|
|
3588
|
-
declare function queryReferralRewards$1(httpClient: HttpClient): QueryReferralRewardsSignature;
|
|
4410
|
+
declare function queryReferralRewards$1(httpClient: HttpClient$2): QueryReferralRewardsSignature;
|
|
3589
4411
|
interface QueryReferralRewardsSignature {
|
|
3590
4412
|
/**
|
|
3591
4413
|
* Retrieves a list of referral rewards, given the provided paging, filtering, and sorting.
|
|
@@ -3598,8 +4420,8 @@ interface QueryReferralRewardsSignature {
|
|
|
3598
4420
|
(options?: QueryReferralRewardsOptions | undefined): ReferralRewardsQueryBuilder;
|
|
3599
4421
|
}
|
|
3600
4422
|
|
|
3601
|
-
declare const getReferralReward: MaybeContext<BuildRESTFunction<typeof getReferralReward$1> & typeof getReferralReward$1>;
|
|
3602
|
-
declare const queryReferralRewards: MaybeContext<BuildRESTFunction<typeof queryReferralRewards$1> & typeof queryReferralRewards$1>;
|
|
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>;
|
|
3603
4425
|
|
|
3604
4426
|
type index_d$2_BulkGetReferralRewardsRequest = BulkGetReferralRewardsRequest;
|
|
3605
4427
|
type index_d$2_BulkGetReferralRewardsResponse = BulkGetReferralRewardsResponse;
|
|
@@ -3643,59 +4465,469 @@ declare namespace index_d$2 {
|
|
|
3643
4465
|
export { type ActionEvent$2 as ActionEvent, type index_d$2_BulkGetReferralRewardsRequest as BulkGetReferralRewardsRequest, type index_d$2_BulkGetReferralRewardsResponse as BulkGetReferralRewardsResponse, type index_d$2_Coupon as Coupon, type index_d$2_CouponDiscountTypeOptionsOneOf as CouponDiscountTypeOptionsOneOf, type index_d$2_CouponScope as CouponScope, type index_d$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, index_d$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 index_d$2_FixedAmountDiscount as FixedAmountDiscount, type index_d$2_GetReferralRewardRequest as GetReferralRewardRequest, type index_d$2_GetReferralRewardResponse as GetReferralRewardResponse, type index_d$2_GetReferralRewardResponseNonNullableFields as GetReferralRewardResponseNonNullableFields, type index_d$2_Group as Group, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type index_d$2_LoyaltyPoints as LoyaltyPoints, type MessageEnvelope$2 as MessageEnvelope, type index_d$2_PercentageDiscount as PercentageDiscount, type index_d$2_QueryReferralRewardsOptions as QueryReferralRewardsOptions, type index_d$2_QueryReferralRewardsRequest as QueryReferralRewardsRequest, type index_d$2_QueryReferralRewardsResponse as QueryReferralRewardsResponse, type index_d$2_QueryReferralRewardsResponseNonNullableFields as QueryReferralRewardsResponseNonNullableFields, type index_d$2_ReferralReward as ReferralReward, type index_d$2_ReferralRewardNonNullableFields as ReferralRewardNonNullableFields, type index_d$2_ReferralRewardReceiverOneOf as ReferralRewardReceiverOneOf, type index_d$2_ReferralRewardRewardTypeOptionsOneOf as ReferralRewardRewardTypeOptionsOneOf, type index_d$2_ReferralRewardsQueryBuilder as ReferralRewardsQueryBuilder, type index_d$2_ReferralRewardsQueryResult as ReferralRewardsQueryResult, type ReferredFriendDetails$1 as ReferredFriendDetails, type RestoreInfo$2 as RestoreInfo, type index_d$2_Reward as Reward, type index_d$2_RewardOptionsOneOf as RewardOptionsOneOf, index_d$2_RewardTypeType as RewardTypeType, type index_d$2_RewardsInSite as RewardsInSite, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, Status$1 as Status, type SuccessfulReferralEvent$1 as SuccessfulReferralEvent, index_d$2_Type as Type, type index_d$2_V1Coupon as V1Coupon, type index_d$2_V1LoyaltyPoints as V1LoyaltyPoints, type index_d$2_ValidateReferralRewardRequest as ValidateReferralRewardRequest, type index_d$2_ValidateReferralRewardResponse as ValidateReferralRewardResponse, WebhookIdentityType$2 as WebhookIdentityType, index_d$2_getReferralReward as getReferralReward, index_d$2_queryReferralRewards as queryReferralRewards };
|
|
3644
4466
|
}
|
|
3645
4467
|
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
*/
|
|
3661
|
-
referringCustomerId?: string;
|
|
3662
|
-
/** Status of the referred friend. */
|
|
3663
|
-
status?: Status;
|
|
3664
|
-
/**
|
|
3665
|
-
* Revision number, which increments by 1 each time the referred friend is updated.
|
|
3666
|
-
* To prevent conflicting changes, the current revision must be passed when updating the referred friend.
|
|
3667
|
-
* @readonly
|
|
3668
|
-
*/
|
|
3669
|
-
revision?: string | null;
|
|
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;
|
|
3670
4482
|
/**
|
|
3671
|
-
*
|
|
3672
|
-
* @readonly
|
|
4483
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
3673
4484
|
*/
|
|
3674
|
-
|
|
4485
|
+
apiBaseUrl?: string;
|
|
3675
4486
|
/**
|
|
3676
|
-
*
|
|
3677
|
-
*
|
|
4487
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
4488
|
+
* like internationalization, billing, etc.
|
|
3678
4489
|
*/
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
}
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
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;
|
|
3696
4512
|
}
|
|
3697
|
-
|
|
3698
|
-
|
|
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: {};
|
|
4755
|
+
}
|
|
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: {};
|
|
4819
|
+
}
|
|
4820
|
+
|
|
4821
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
4822
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
4823
|
+
```
|
|
4824
|
+
|
|
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
|
+
}
|
|
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;
|
|
4877
|
+
|
|
4878
|
+
interface ReferredFriend {
|
|
4879
|
+
/**
|
|
4880
|
+
* ID of the referred friend.
|
|
4881
|
+
* @readonly
|
|
4882
|
+
*/
|
|
4883
|
+
_id?: string;
|
|
4884
|
+
/**
|
|
4885
|
+
* Contact ID of the referred friend.
|
|
4886
|
+
* @readonly
|
|
4887
|
+
*/
|
|
4888
|
+
contactId?: string;
|
|
4889
|
+
/**
|
|
4890
|
+
* ID of the customer who referred this friend.
|
|
4891
|
+
* @readonly
|
|
4892
|
+
*/
|
|
4893
|
+
referringCustomerId?: string;
|
|
4894
|
+
/** Status of the referred friend. */
|
|
4895
|
+
status?: Status;
|
|
4896
|
+
/**
|
|
4897
|
+
* Revision number, which increments by 1 each time the referred friend is updated.
|
|
4898
|
+
* To prevent conflicting changes, the current revision must be passed when updating the referred friend.
|
|
4899
|
+
* @readonly
|
|
4900
|
+
*/
|
|
4901
|
+
revision?: string | null;
|
|
4902
|
+
/**
|
|
4903
|
+
* Date and time the referred friend was created.
|
|
4904
|
+
* @readonly
|
|
4905
|
+
*/
|
|
4906
|
+
_createdDate?: Date;
|
|
4907
|
+
/**
|
|
4908
|
+
* Date and time the referred friend was last updated.
|
|
4909
|
+
* @readonly
|
|
4910
|
+
*/
|
|
4911
|
+
_updatedDate?: Date;
|
|
4912
|
+
}
|
|
4913
|
+
declare enum Status {
|
|
4914
|
+
/** Unknown status. */
|
|
4915
|
+
UNKNOWN = "UNKNOWN",
|
|
4916
|
+
/** Initial status when the referred friend joins the site as a member. */
|
|
4917
|
+
SIGN_UP_COMPLETED = "SIGN_UP_COMPLETED",
|
|
4918
|
+
/** Status after the referred friend completes specific actions, such as making a purchase. */
|
|
4919
|
+
ACTIONS_COMPLETED = "ACTIONS_COMPLETED"
|
|
4920
|
+
}
|
|
4921
|
+
interface CreateReferredFriendRequest {
|
|
4922
|
+
/** Referral code for the referred friend. */
|
|
4923
|
+
referralCode?: string | null;
|
|
4924
|
+
}
|
|
4925
|
+
interface CreateReferredFriendResponse {
|
|
4926
|
+
/** Created referred friend. */
|
|
4927
|
+
referredFriend?: ReferredFriend;
|
|
4928
|
+
}
|
|
4929
|
+
interface GetReferredFriendRequest {
|
|
4930
|
+
/** ID of the referred friend to retrieve. */
|
|
3699
4931
|
referredFriendId: string;
|
|
3700
4932
|
}
|
|
3701
4933
|
interface GetReferredFriendResponse {
|
|
@@ -4138,178 +5370,588 @@ interface ReferredFriendsQueryBuilder {
|
|
|
4138
5370
|
/** @param cursor - A pointer to specific record
|
|
4139
5371
|
* @documentationMaturity preview
|
|
4140
5372
|
*/
|
|
4141
|
-
skipTo: (cursor: string) => ReferredFriendsQueryBuilder;
|
|
4142
|
-
/** @documentationMaturity preview */
|
|
4143
|
-
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 index_d$1_CreateReferredFriendOptions = CreateReferredFriendOptions;
|
|
5499
|
+
type index_d$1_CreateReferredFriendRequest = CreateReferredFriendRequest;
|
|
5500
|
+
type index_d$1_CreateReferredFriendResponse = CreateReferredFriendResponse;
|
|
5501
|
+
type index_d$1_CreateReferredFriendResponseNonNullableFields = CreateReferredFriendResponseNonNullableFields;
|
|
5502
|
+
type index_d$1_DeleteReferredFriendOptions = DeleteReferredFriendOptions;
|
|
5503
|
+
type index_d$1_DeleteReferredFriendRequest = DeleteReferredFriendRequest;
|
|
5504
|
+
type index_d$1_DeleteReferredFriendResponse = DeleteReferredFriendResponse;
|
|
5505
|
+
type index_d$1_Empty = Empty;
|
|
5506
|
+
type index_d$1_GetReferredFriendByContactIdRequest = GetReferredFriendByContactIdRequest;
|
|
5507
|
+
type index_d$1_GetReferredFriendByContactIdResponse = GetReferredFriendByContactIdResponse;
|
|
5508
|
+
type index_d$1_GetReferredFriendByContactIdResponseNonNullableFields = GetReferredFriendByContactIdResponseNonNullableFields;
|
|
5509
|
+
type index_d$1_GetReferredFriendRequest = GetReferredFriendRequest;
|
|
5510
|
+
type index_d$1_GetReferredFriendResponse = GetReferredFriendResponse;
|
|
5511
|
+
type index_d$1_GetReferredFriendResponseNonNullableFields = GetReferredFriendResponseNonNullableFields;
|
|
5512
|
+
type index_d$1_QueryReferredFriendRequest = QueryReferredFriendRequest;
|
|
5513
|
+
type index_d$1_QueryReferredFriendResponse = QueryReferredFriendResponse;
|
|
5514
|
+
type index_d$1_QueryReferredFriendResponseNonNullableFields = QueryReferredFriendResponseNonNullableFields;
|
|
5515
|
+
type index_d$1_ReferredFriend = ReferredFriend;
|
|
5516
|
+
type index_d$1_ReferredFriendCreatedEnvelope = ReferredFriendCreatedEnvelope;
|
|
5517
|
+
type index_d$1_ReferredFriendDeletedEnvelope = ReferredFriendDeletedEnvelope;
|
|
5518
|
+
type index_d$1_ReferredFriendDetails = ReferredFriendDetails;
|
|
5519
|
+
type index_d$1_ReferredFriendNonNullableFields = ReferredFriendNonNullableFields;
|
|
5520
|
+
type index_d$1_ReferredFriendUpdatedEnvelope = ReferredFriendUpdatedEnvelope;
|
|
5521
|
+
type index_d$1_ReferredFriendsQueryBuilder = ReferredFriendsQueryBuilder;
|
|
5522
|
+
type index_d$1_ReferredFriendsQueryResult = ReferredFriendsQueryResult;
|
|
5523
|
+
type index_d$1_Status = Status;
|
|
5524
|
+
declare const index_d$1_Status: typeof Status;
|
|
5525
|
+
type index_d$1_SuccessfulReferralEvent = SuccessfulReferralEvent;
|
|
5526
|
+
type index_d$1_UpdateReferredFriend = UpdateReferredFriend;
|
|
5527
|
+
type index_d$1_UpdateReferredFriendRequest = UpdateReferredFriendRequest;
|
|
5528
|
+
type index_d$1_UpdateReferredFriendResponse = UpdateReferredFriendResponse;
|
|
5529
|
+
type index_d$1_UpdateReferredFriendResponseNonNullableFields = UpdateReferredFriendResponseNonNullableFields;
|
|
5530
|
+
type index_d$1__publicOnReferredFriendCreatedType = _publicOnReferredFriendCreatedType;
|
|
5531
|
+
type index_d$1__publicOnReferredFriendDeletedType = _publicOnReferredFriendDeletedType;
|
|
5532
|
+
type index_d$1__publicOnReferredFriendUpdatedType = _publicOnReferredFriendUpdatedType;
|
|
5533
|
+
declare const index_d$1_createReferredFriend: typeof createReferredFriend;
|
|
5534
|
+
declare const index_d$1_deleteReferredFriend: typeof deleteReferredFriend;
|
|
5535
|
+
declare const index_d$1_getReferredFriend: typeof getReferredFriend;
|
|
5536
|
+
declare const index_d$1_getReferredFriendByContactId: typeof getReferredFriendByContactId;
|
|
5537
|
+
declare const index_d$1_onReferredFriendCreated: typeof onReferredFriendCreated;
|
|
5538
|
+
declare const index_d$1_onReferredFriendDeleted: typeof onReferredFriendDeleted;
|
|
5539
|
+
declare const index_d$1_onReferredFriendUpdated: typeof onReferredFriendUpdated;
|
|
5540
|
+
declare const index_d$1_queryReferredFriend: typeof queryReferredFriend;
|
|
5541
|
+
declare const index_d$1_updateReferredFriend: typeof updateReferredFriend;
|
|
5542
|
+
declare namespace index_d$1 {
|
|
5543
|
+
export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type index_d$1_CreateReferredFriendOptions as CreateReferredFriendOptions, type index_d$1_CreateReferredFriendRequest as CreateReferredFriendRequest, type index_d$1_CreateReferredFriendResponse as CreateReferredFriendResponse, type index_d$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 index_d$1_DeleteReferredFriendOptions as DeleteReferredFriendOptions, type index_d$1_DeleteReferredFriendRequest as DeleteReferredFriendRequest, type index_d$1_DeleteReferredFriendResponse as DeleteReferredFriendResponse, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type index_d$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 index_d$1_GetReferredFriendByContactIdRequest as GetReferredFriendByContactIdRequest, type index_d$1_GetReferredFriendByContactIdResponse as GetReferredFriendByContactIdResponse, type index_d$1_GetReferredFriendByContactIdResponseNonNullableFields as GetReferredFriendByContactIdResponseNonNullableFields, type index_d$1_GetReferredFriendRequest as GetReferredFriendRequest, type index_d$1_GetReferredFriendResponse as GetReferredFriendResponse, type index_d$1_GetReferredFriendResponseNonNullableFields as GetReferredFriendResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type index_d$1_QueryReferredFriendRequest as QueryReferredFriendRequest, type index_d$1_QueryReferredFriendResponse as QueryReferredFriendResponse, type index_d$1_QueryReferredFriendResponseNonNullableFields as QueryReferredFriendResponseNonNullableFields, type index_d$1_ReferredFriend as ReferredFriend, type index_d$1_ReferredFriendCreatedEnvelope as ReferredFriendCreatedEnvelope, type index_d$1_ReferredFriendDeletedEnvelope as ReferredFriendDeletedEnvelope, type index_d$1_ReferredFriendDetails as ReferredFriendDetails, type index_d$1_ReferredFriendNonNullableFields as ReferredFriendNonNullableFields, type index_d$1_ReferredFriendUpdatedEnvelope as ReferredFriendUpdatedEnvelope, type index_d$1_ReferredFriendsQueryBuilder as ReferredFriendsQueryBuilder, type index_d$1_ReferredFriendsQueryResult as ReferredFriendsQueryResult, type RestoreInfo$1 as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, index_d$1_Status as Status, type index_d$1_SuccessfulReferralEvent as SuccessfulReferralEvent, type index_d$1_UpdateReferredFriend as UpdateReferredFriend, type index_d$1_UpdateReferredFriendRequest as UpdateReferredFriendRequest, type index_d$1_UpdateReferredFriendResponse as UpdateReferredFriendResponse, type index_d$1_UpdateReferredFriendResponseNonNullableFields as UpdateReferredFriendResponseNonNullableFields, WebhookIdentityType$1 as WebhookIdentityType, type index_d$1__publicOnReferredFriendCreatedType as _publicOnReferredFriendCreatedType, type index_d$1__publicOnReferredFriendDeletedType as _publicOnReferredFriendDeletedType, type index_d$1__publicOnReferredFriendUpdatedType as _publicOnReferredFriendUpdatedType, index_d$1_createReferredFriend as createReferredFriend, index_d$1_deleteReferredFriend as deleteReferredFriend, index_d$1_getReferredFriend as getReferredFriend, index_d$1_getReferredFriendByContactId as getReferredFriendByContactId, index_d$1_onReferredFriendCreated as onReferredFriendCreated, index_d$1_onReferredFriendDeleted as onReferredFriendDeleted, index_d$1_onReferredFriendUpdated as onReferredFriendUpdated, onReferredFriendCreated$1 as publicOnReferredFriendCreated, onReferredFriendDeleted$1 as publicOnReferredFriendDeleted, onReferredFriendUpdated$1 as publicOnReferredFriendUpdated, index_d$1_queryReferredFriend as queryReferredFriend, index_d$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
|
+
}
|
|
4144
5676
|
}
|
|
4145
5677
|
|
|
4146
|
-
declare
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
}
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
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: {};
|
|
4196
5833
|
}
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
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() {}
|
|
4216
5882
|
}
|
|
4217
|
-
declare const onReferredFriendCreated$1: EventDefinition$4<ReferredFriendCreatedEnvelope, "wix.loyalty.referral.v1.referred_friend_created">;
|
|
4218
|
-
declare const onReferredFriendUpdated$1: EventDefinition$4<ReferredFriendUpdatedEnvelope, "wix.loyalty.referral.v1.referred_friend_updated">;
|
|
4219
|
-
declare const onReferredFriendDeleted$1: EventDefinition$4<ReferredFriendDeletedEnvelope, "wix.loyalty.referral.v1.referred_friend_deleted">;
|
|
4220
5883
|
|
|
4221
|
-
type
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
isDomainEvent?: boolean;
|
|
4225
|
-
transformations?: (envelope: unknown) => Payload;
|
|
4226
|
-
__payload: Payload;
|
|
4227
|
-
};
|
|
4228
|
-
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
4229
|
-
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
4230
|
-
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
5884
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
5885
|
+
//=> {run: () => void}
|
|
5886
|
+
```
|
|
4231
5887
|
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
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: {};
|
|
4237
5897
|
}
|
|
4238
5898
|
|
|
4239
|
-
|
|
5899
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
5900
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
5901
|
+
```
|
|
4240
5902
|
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
5903
|
+
@category Object
|
|
5904
|
+
*/
|
|
5905
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
5906
|
+
Base,
|
|
5907
|
+
ConditionalKeys<Base, Condition>
|
|
5908
|
+
>;
|
|
4247
5909
|
|
|
4248
|
-
type _publicOnReferredFriendCreatedType = typeof onReferredFriendCreated$1;
|
|
4249
5910
|
/**
|
|
4250
|
-
*
|
|
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.
|
|
4251
5914
|
*/
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
5915
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$1<any> | ServicePluginDefinition<any> | {
|
|
5916
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
5917
|
+
};
|
|
4255
5918
|
/**
|
|
4256
|
-
*
|
|
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).
|
|
4257
5923
|
*/
|
|
4258
|
-
|
|
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
|
+
};
|
|
4259
5943
|
|
|
4260
|
-
|
|
5944
|
+
declare global {
|
|
5945
|
+
interface ContextualClient {
|
|
5946
|
+
}
|
|
5947
|
+
}
|
|
4261
5948
|
/**
|
|
4262
|
-
*
|
|
5949
|
+
* A type used to create concerete types from SDK descriptors in
|
|
5950
|
+
* case a contextual client is available.
|
|
4263
5951
|
*/
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
type index_d$1_CreateReferredFriendRequest = CreateReferredFriendRequest;
|
|
4268
|
-
type index_d$1_CreateReferredFriendResponse = CreateReferredFriendResponse;
|
|
4269
|
-
type index_d$1_CreateReferredFriendResponseNonNullableFields = CreateReferredFriendResponseNonNullableFields;
|
|
4270
|
-
type index_d$1_DeleteReferredFriendOptions = DeleteReferredFriendOptions;
|
|
4271
|
-
type index_d$1_DeleteReferredFriendRequest = DeleteReferredFriendRequest;
|
|
4272
|
-
type index_d$1_DeleteReferredFriendResponse = DeleteReferredFriendResponse;
|
|
4273
|
-
type index_d$1_Empty = Empty;
|
|
4274
|
-
type index_d$1_GetReferredFriendByContactIdRequest = GetReferredFriendByContactIdRequest;
|
|
4275
|
-
type index_d$1_GetReferredFriendByContactIdResponse = GetReferredFriendByContactIdResponse;
|
|
4276
|
-
type index_d$1_GetReferredFriendByContactIdResponseNonNullableFields = GetReferredFriendByContactIdResponseNonNullableFields;
|
|
4277
|
-
type index_d$1_GetReferredFriendRequest = GetReferredFriendRequest;
|
|
4278
|
-
type index_d$1_GetReferredFriendResponse = GetReferredFriendResponse;
|
|
4279
|
-
type index_d$1_GetReferredFriendResponseNonNullableFields = GetReferredFriendResponseNonNullableFields;
|
|
4280
|
-
type index_d$1_QueryReferredFriendRequest = QueryReferredFriendRequest;
|
|
4281
|
-
type index_d$1_QueryReferredFriendResponse = QueryReferredFriendResponse;
|
|
4282
|
-
type index_d$1_QueryReferredFriendResponseNonNullableFields = QueryReferredFriendResponseNonNullableFields;
|
|
4283
|
-
type index_d$1_ReferredFriend = ReferredFriend;
|
|
4284
|
-
type index_d$1_ReferredFriendCreatedEnvelope = ReferredFriendCreatedEnvelope;
|
|
4285
|
-
type index_d$1_ReferredFriendDeletedEnvelope = ReferredFriendDeletedEnvelope;
|
|
4286
|
-
type index_d$1_ReferredFriendDetails = ReferredFriendDetails;
|
|
4287
|
-
type index_d$1_ReferredFriendNonNullableFields = ReferredFriendNonNullableFields;
|
|
4288
|
-
type index_d$1_ReferredFriendUpdatedEnvelope = ReferredFriendUpdatedEnvelope;
|
|
4289
|
-
type index_d$1_ReferredFriendsQueryBuilder = ReferredFriendsQueryBuilder;
|
|
4290
|
-
type index_d$1_ReferredFriendsQueryResult = ReferredFriendsQueryResult;
|
|
4291
|
-
type index_d$1_Status = Status;
|
|
4292
|
-
declare const index_d$1_Status: typeof Status;
|
|
4293
|
-
type index_d$1_SuccessfulReferralEvent = SuccessfulReferralEvent;
|
|
4294
|
-
type index_d$1_UpdateReferredFriend = UpdateReferredFriend;
|
|
4295
|
-
type index_d$1_UpdateReferredFriendRequest = UpdateReferredFriendRequest;
|
|
4296
|
-
type index_d$1_UpdateReferredFriendResponse = UpdateReferredFriendResponse;
|
|
4297
|
-
type index_d$1_UpdateReferredFriendResponseNonNullableFields = UpdateReferredFriendResponseNonNullableFields;
|
|
4298
|
-
type index_d$1__publicOnReferredFriendCreatedType = _publicOnReferredFriendCreatedType;
|
|
4299
|
-
type index_d$1__publicOnReferredFriendDeletedType = _publicOnReferredFriendDeletedType;
|
|
4300
|
-
type index_d$1__publicOnReferredFriendUpdatedType = _publicOnReferredFriendUpdatedType;
|
|
4301
|
-
declare const index_d$1_createReferredFriend: typeof createReferredFriend;
|
|
4302
|
-
declare const index_d$1_deleteReferredFriend: typeof deleteReferredFriend;
|
|
4303
|
-
declare const index_d$1_getReferredFriend: typeof getReferredFriend;
|
|
4304
|
-
declare const index_d$1_getReferredFriendByContactId: typeof getReferredFriendByContactId;
|
|
4305
|
-
declare const index_d$1_onReferredFriendCreated: typeof onReferredFriendCreated;
|
|
4306
|
-
declare const index_d$1_onReferredFriendDeleted: typeof onReferredFriendDeleted;
|
|
4307
|
-
declare const index_d$1_onReferredFriendUpdated: typeof onReferredFriendUpdated;
|
|
4308
|
-
declare const index_d$1_queryReferredFriend: typeof queryReferredFriend;
|
|
4309
|
-
declare const index_d$1_updateReferredFriend: typeof updateReferredFriend;
|
|
4310
|
-
declare namespace index_d$1 {
|
|
4311
|
-
export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type index_d$1_CreateReferredFriendOptions as CreateReferredFriendOptions, type index_d$1_CreateReferredFriendRequest as CreateReferredFriendRequest, type index_d$1_CreateReferredFriendResponse as CreateReferredFriendResponse, type index_d$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 index_d$1_DeleteReferredFriendOptions as DeleteReferredFriendOptions, type index_d$1_DeleteReferredFriendRequest as DeleteReferredFriendRequest, type index_d$1_DeleteReferredFriendResponse as DeleteReferredFriendResponse, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type index_d$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 index_d$1_GetReferredFriendByContactIdRequest as GetReferredFriendByContactIdRequest, type index_d$1_GetReferredFriendByContactIdResponse as GetReferredFriendByContactIdResponse, type index_d$1_GetReferredFriendByContactIdResponseNonNullableFields as GetReferredFriendByContactIdResponseNonNullableFields, type index_d$1_GetReferredFriendRequest as GetReferredFriendRequest, type index_d$1_GetReferredFriendResponse as GetReferredFriendResponse, type index_d$1_GetReferredFriendResponseNonNullableFields as GetReferredFriendResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type index_d$1_QueryReferredFriendRequest as QueryReferredFriendRequest, type index_d$1_QueryReferredFriendResponse as QueryReferredFriendResponse, type index_d$1_QueryReferredFriendResponseNonNullableFields as QueryReferredFriendResponseNonNullableFields, type index_d$1_ReferredFriend as ReferredFriend, type index_d$1_ReferredFriendCreatedEnvelope as ReferredFriendCreatedEnvelope, type index_d$1_ReferredFriendDeletedEnvelope as ReferredFriendDeletedEnvelope, type index_d$1_ReferredFriendDetails as ReferredFriendDetails, type index_d$1_ReferredFriendNonNullableFields as ReferredFriendNonNullableFields, type index_d$1_ReferredFriendUpdatedEnvelope as ReferredFriendUpdatedEnvelope, type index_d$1_ReferredFriendsQueryBuilder as ReferredFriendsQueryBuilder, type index_d$1_ReferredFriendsQueryResult as ReferredFriendsQueryResult, type RestoreInfo$1 as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, index_d$1_Status as Status, type index_d$1_SuccessfulReferralEvent as SuccessfulReferralEvent, type index_d$1_UpdateReferredFriend as UpdateReferredFriend, type index_d$1_UpdateReferredFriendRequest as UpdateReferredFriendRequest, type index_d$1_UpdateReferredFriendResponse as UpdateReferredFriendResponse, type index_d$1_UpdateReferredFriendResponseNonNullableFields as UpdateReferredFriendResponseNonNullableFields, WebhookIdentityType$1 as WebhookIdentityType, type index_d$1__publicOnReferredFriendCreatedType as _publicOnReferredFriendCreatedType, type index_d$1__publicOnReferredFriendDeletedType as _publicOnReferredFriendDeletedType, type index_d$1__publicOnReferredFriendUpdatedType as _publicOnReferredFriendUpdatedType, index_d$1_createReferredFriend as createReferredFriend, index_d$1_deleteReferredFriend as deleteReferredFriend, index_d$1_getReferredFriend as getReferredFriend, index_d$1_getReferredFriendByContactId as getReferredFriendByContactId, index_d$1_onReferredFriendCreated as onReferredFriendCreated, index_d$1_onReferredFriendDeleted as onReferredFriendDeleted, index_d$1_onReferredFriendUpdated as onReferredFriendUpdated, onReferredFriendCreated$1 as publicOnReferredFriendCreated, onReferredFriendDeleted$1 as publicOnReferredFriendDeleted, onReferredFriendUpdated$1 as publicOnReferredFriendUpdated, index_d$1_queryReferredFriend as queryReferredFriend, index_d$1_updateReferredFriend as updateReferredFriend };
|
|
4312
|
-
}
|
|
5952
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
5953
|
+
host: Host;
|
|
5954
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
4313
5955
|
|
|
4314
5956
|
interface ReferringCustomer {
|
|
4315
5957
|
/**
|
|
@@ -4774,8 +6416,8 @@ interface DeleteReferringCustomerSignature {
|
|
|
4774
6416
|
*/
|
|
4775
6417
|
(referringCustomerId: string, options?: DeleteReferringCustomerOptions | undefined): Promise<void>;
|
|
4776
6418
|
}
|
|
4777
|
-
declare const onReferringCustomerCreated$1: EventDefinition$
|
|
4778
|
-
declare const onReferringCustomerDeleted$1: EventDefinition$
|
|
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">;
|
|
4779
6421
|
|
|
4780
6422
|
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
4781
6423
|
__type: 'event-definition';
|