@wix/crm 1.0.132 → 1.0.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +1,131 @@
1
- type RESTFunctionDescriptor$5<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$5) => T;
2
- interface HttpClient$5 {
3
- request<TResponse, TData = any>(req: RequestOptionsFactory$5<TResponse, TData>): Promise<HttpResponse$5<TResponse>>;
1
+ type HostModule<T, H extends Host> = {
2
+ __type: 'host';
3
+ create(host: H): T;
4
+ };
5
+ type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
+ type Host<Environment = unknown> = {
7
+ channel: {
8
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
+ disconnect: () => void;
10
+ } | Promise<{
11
+ disconnect: () => void;
12
+ }>;
13
+ };
14
+ environment?: Environment;
15
+ /**
16
+ * Optional name of the environment, use for logging
17
+ */
18
+ name?: string;
19
+ /**
20
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
21
+ */
22
+ apiBaseUrl?: string;
23
+ /**
24
+ * Possible data to be provided by every host, for cross cutting concerns
25
+ * like internationalization, billing, etc.
26
+ */
27
+ essentials?: {
28
+ /**
29
+ * The language of the currently viewed session
30
+ */
31
+ language?: string;
32
+ /**
33
+ * The locale of the currently viewed session
34
+ */
35
+ locale?: string;
36
+ /**
37
+ * Any headers that should be passed through to the API requests
38
+ */
39
+ passThroughHeaders?: Record<string, string>;
40
+ };
41
+ };
42
+
43
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
44
+ interface HttpClient {
45
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
4
46
  fetchWithAuth: typeof fetch;
5
47
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
+ getActiveToken?: () => string | undefined;
6
49
  }
7
- type RequestOptionsFactory$5<TResponse = any, TData = any> = (context: any) => RequestOptions$5<TResponse, TData>;
8
- type HttpResponse$5<T = any> = {
50
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
+ type HttpResponse<T = any> = {
9
52
  data: T;
10
53
  status: number;
11
54
  statusText: string;
12
55
  headers: any;
13
56
  request?: any;
14
57
  };
15
- type RequestOptions$5<_TResponse = any, Data = any> = {
58
+ type RequestOptions<_TResponse = any, Data = any> = {
16
59
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
17
60
  url: string;
18
61
  data?: Data;
19
62
  params?: URLSearchParams;
20
- } & APIMetadata$5;
21
- type APIMetadata$5 = {
63
+ } & APIMetadata;
64
+ type APIMetadata = {
22
65
  methodFqn?: string;
23
66
  entityFqdn?: string;
24
67
  packageName?: string;
25
68
  };
26
- type BuildRESTFunction$5<T extends RESTFunctionDescriptor$5> = T extends RESTFunctionDescriptor$5<infer U> ? U : never;
27
- type EventDefinition$4<Payload = unknown, Type extends string = string> = {
69
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
28
71
  __type: 'event-definition';
29
72
  type: Type;
30
73
  isDomainEvent?: boolean;
31
74
  transformations?: (envelope: unknown) => Payload;
32
75
  __payload: Payload;
33
76
  };
34
- declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
35
- type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
36
- type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
77
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
78
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
79
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
80
+
81
+ type ServicePluginMethodInput = {
82
+ request: any;
83
+ metadata: any;
84
+ };
85
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
+ type ServicePluginMethodMetadata = {
87
+ name: string;
88
+ primaryHttpMappingPath: string;
89
+ transformations: {
90
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
91
+ toREST: (...args: unknown[]) => unknown;
92
+ };
93
+ };
94
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
95
+ __type: 'service-plugin-definition';
96
+ componentType: string;
97
+ methods: ServicePluginMethodMetadata[];
98
+ __contract: Contract;
99
+ };
100
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
101
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
102
+ declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
103
+
104
+ type RequestContext = {
105
+ isSSR: boolean;
106
+ host: string;
107
+ protocol?: string;
108
+ };
109
+ type ResponseTransformer = (data: any, headers?: any) => any;
110
+ /**
111
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
+ */
115
+ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
+ type AmbassadorRequestOptions<T = any> = {
117
+ _?: T;
118
+ url?: string;
119
+ method?: Method;
120
+ params?: any;
121
+ data?: any;
122
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
123
+ };
124
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
125
+ __isAmbassador: boolean;
126
+ };
127
+ type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
128
+ type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
37
129
 
38
130
  declare global {
39
131
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -42,6 +134,348 @@ declare global {
42
134
  }
43
135
  }
44
136
 
137
+ declare const emptyObjectSymbol: unique symbol;
138
+
139
+ /**
140
+ Represents a strictly empty plain object, the `{}` value.
141
+
142
+ 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)).
143
+
144
+ @example
145
+ ```
146
+ import type {EmptyObject} from 'type-fest';
147
+
148
+ // The following illustrates the problem with `{}`.
149
+ const foo1: {} = {}; // Pass
150
+ const foo2: {} = []; // Pass
151
+ const foo3: {} = 42; // Pass
152
+ const foo4: {} = {a: 1}; // Pass
153
+
154
+ // With `EmptyObject` only the first case is valid.
155
+ const bar1: EmptyObject = {}; // Pass
156
+ const bar2: EmptyObject = 42; // Fail
157
+ const bar3: EmptyObject = []; // Fail
158
+ const bar4: EmptyObject = {a: 1}; // Fail
159
+ ```
160
+
161
+ 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}.
162
+
163
+ @category Object
164
+ */
165
+ type EmptyObject = {[emptyObjectSymbol]?: never};
166
+
167
+ /**
168
+ Returns a boolean for whether the two given types are equal.
169
+
170
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
171
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
172
+
173
+ Use-cases:
174
+ - If you want to make a conditional branch based on the result of a comparison of two types.
175
+
176
+ @example
177
+ ```
178
+ import type {IsEqual} from 'type-fest';
179
+
180
+ // This type returns a boolean for whether the given array includes the given item.
181
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
182
+ type Includes<Value extends readonly any[], Item> =
183
+ Value extends readonly [Value[0], ...infer rest]
184
+ ? IsEqual<Value[0], Item> extends true
185
+ ? true
186
+ : Includes<rest, Item>
187
+ : false;
188
+ ```
189
+
190
+ @category Type Guard
191
+ @category Utilities
192
+ */
193
+ type IsEqual<A, B> =
194
+ (<G>() => G extends A ? 1 : 2) extends
195
+ (<G>() => G extends B ? 1 : 2)
196
+ ? true
197
+ : false;
198
+
199
+ /**
200
+ Filter out keys from an object.
201
+
202
+ Returns `never` if `Exclude` is strictly equal to `Key`.
203
+ Returns `never` if `Key` extends `Exclude`.
204
+ Returns `Key` otherwise.
205
+
206
+ @example
207
+ ```
208
+ type Filtered = Filter<'foo', 'foo'>;
209
+ //=> never
210
+ ```
211
+
212
+ @example
213
+ ```
214
+ type Filtered = Filter<'bar', string>;
215
+ //=> never
216
+ ```
217
+
218
+ @example
219
+ ```
220
+ type Filtered = Filter<'bar', 'foo'>;
221
+ //=> 'bar'
222
+ ```
223
+
224
+ @see {Except}
225
+ */
226
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
+
228
+ type ExceptOptions = {
229
+ /**
230
+ Disallow assigning non-specified properties.
231
+
232
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
233
+
234
+ @default false
235
+ */
236
+ requireExactProps?: boolean;
237
+ };
238
+
239
+ /**
240
+ Create a type from an object type without certain keys.
241
+
242
+ We recommend setting the `requireExactProps` option to `true`.
243
+
244
+ 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.
245
+
246
+ 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)).
247
+
248
+ @example
249
+ ```
250
+ import type {Except} from 'type-fest';
251
+
252
+ type Foo = {
253
+ a: number;
254
+ b: string;
255
+ };
256
+
257
+ type FooWithoutA = Except<Foo, 'a'>;
258
+ //=> {b: string}
259
+
260
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
261
+ //=> errors: 'a' does not exist in type '{ b: string; }'
262
+
263
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
264
+ //=> {a: number} & Partial<Record<"b", never>>
265
+
266
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
267
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
268
+ ```
269
+
270
+ @category Object
271
+ */
272
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
274
+ } & (Options['requireExactProps'] extends true
275
+ ? Partial<Record<KeysType, never>>
276
+ : {});
277
+
278
+ /**
279
+ Returns a boolean for whether the given type is `never`.
280
+
281
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
+ @link https://stackoverflow.com/a/53984913/10292952
283
+ @link https://www.zhenghao.io/posts/ts-never
284
+
285
+ Useful in type utilities, such as checking if something does not occur.
286
+
287
+ @example
288
+ ```
289
+ import type {IsNever, And} from 'type-fest';
290
+
291
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
+ type AreStringsEqual<A extends string, B extends string> =
293
+ And<
294
+ IsNever<Exclude<A, B>> extends true ? true : false,
295
+ IsNever<Exclude<B, A>> extends true ? true : false
296
+ >;
297
+
298
+ type EndIfEqual<I extends string, O extends string> =
299
+ AreStringsEqual<I, O> extends true
300
+ ? never
301
+ : void;
302
+
303
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
+ if (input === output) {
305
+ process.exit(0);
306
+ }
307
+ }
308
+
309
+ endIfEqual('abc', 'abc');
310
+ //=> never
311
+
312
+ endIfEqual('abc', '123');
313
+ //=> void
314
+ ```
315
+
316
+ @category Type Guard
317
+ @category Utilities
318
+ */
319
+ type IsNever<T> = [T] extends [never] ? true : false;
320
+
321
+ /**
322
+ An if-else-like type that resolves depending on whether the given type is `never`.
323
+
324
+ @see {@link IsNever}
325
+
326
+ @example
327
+ ```
328
+ import type {IfNever} from 'type-fest';
329
+
330
+ type ShouldBeTrue = IfNever<never>;
331
+ //=> true
332
+
333
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
+ //=> 'bar'
335
+ ```
336
+
337
+ @category Type Guard
338
+ @category Utilities
339
+ */
340
+ type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
+ IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
+ );
343
+
344
+ /**
345
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
346
+
347
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
348
+
349
+ @example
350
+ ```
351
+ import type {ConditionalKeys} from 'type-fest';
352
+
353
+ interface Example {
354
+ a: string;
355
+ b: string | number;
356
+ c?: string;
357
+ d: {};
358
+ }
359
+
360
+ type StringKeysOnly = ConditionalKeys<Example, string>;
361
+ //=> 'a'
362
+ ```
363
+
364
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
365
+
366
+ @example
367
+ ```
368
+ import type {ConditionalKeys} from 'type-fest';
369
+
370
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
371
+ //=> 'a' | 'c'
372
+ ```
373
+
374
+ @category Object
375
+ */
376
+ type ConditionalKeys<Base, Condition> =
377
+ {
378
+ // Map through all the keys of the given base type.
379
+ [Key in keyof Base]-?:
380
+ // Pick only keys with types extending the given `Condition` type.
381
+ Base[Key] extends Condition
382
+ // Retain this key
383
+ // If the value for the key extends never, only include it if `Condition` also extends never
384
+ ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
385
+ // Discard this key since the condition fails.
386
+ : never;
387
+ // Convert the produced object into a union type of the keys which passed the conditional test.
388
+ }[keyof Base];
389
+
390
+ /**
391
+ Exclude keys from a shape that matches the given `Condition`.
392
+
393
+ 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.
394
+
395
+ @example
396
+ ```
397
+ import type {Primitive, ConditionalExcept} from 'type-fest';
398
+
399
+ class Awesome {
400
+ name: string;
401
+ successes: number;
402
+ failures: bigint;
403
+
404
+ run() {}
405
+ }
406
+
407
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
408
+ //=> {run: () => void}
409
+ ```
410
+
411
+ @example
412
+ ```
413
+ import type {ConditionalExcept} from 'type-fest';
414
+
415
+ interface Example {
416
+ a: string;
417
+ b: string | number;
418
+ c: () => void;
419
+ d: {};
420
+ }
421
+
422
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
423
+ //=> {b: string | number; c: () => void; d: {}}
424
+ ```
425
+
426
+ @category Object
427
+ */
428
+ type ConditionalExcept<Base, Condition> = Except<
429
+ Base,
430
+ ConditionalKeys<Base, Condition>
431
+ >;
432
+
433
+ /**
434
+ * Descriptors are objects that describe the API of a module, and the module
435
+ * can either be a REST module or a host module.
436
+ * This type is recursive, so it can describe nested modules.
437
+ */
438
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
+ [key: string]: Descriptors | PublicMetadata | any;
440
+ };
441
+ /**
442
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
443
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
444
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
445
+ * do not match the given host (as they will not work with the given host).
446
+ */
447
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
448
+ done: T;
449
+ recurse: T extends {
450
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
451
+ } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
452
+ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
453
+ -1,
454
+ 0,
455
+ 1,
456
+ 2,
457
+ 3,
458
+ 4,
459
+ 5
460
+ ][Depth]> : never;
461
+ }, EmptyObject>;
462
+ }[Depth extends -1 ? 'done' : 'recurse'];
463
+ type PublicMetadata = {
464
+ PACKAGE_NAME?: string;
465
+ };
466
+
467
+ declare global {
468
+ interface ContextualClient {
469
+ }
470
+ }
471
+ /**
472
+ * A type used to create concerete types from SDK descriptors in
473
+ * case a contextual client is available.
474
+ */
475
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
+ host: Host;
477
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
478
+
45
479
  interface ContactAttachment extends ContactAttachmentMediaOneOf {
46
480
  /** The attachment's image (if the attachment is of type IMAGE) */
47
481
  image?: string;
@@ -420,7 +854,7 @@ interface GetAttachmentIdentifiers {
420
854
  attachmentId: string;
421
855
  }
422
856
 
423
- declare function generateAttachmentUploadUrl$1(httpClient: HttpClient$5): GenerateAttachmentUploadUrlSignature;
857
+ declare function generateAttachmentUploadUrl$1(httpClient: HttpClient): GenerateAttachmentUploadUrlSignature;
424
858
  interface GenerateAttachmentUploadUrlSignature {
425
859
  /**
426
860
  * Generates an upload URL to allow external clients to upload a file as an attachment to a given contact.
@@ -432,7 +866,7 @@ interface GenerateAttachmentUploadUrlSignature {
432
866
  */
433
867
  (contactId: string, fileName: string, options: GenerateAttachmentUploadUrlOptions): Promise<GenerateAttachmentUploadUrlResponse & GenerateAttachmentUploadUrlResponseNonNullableFields>;
434
868
  }
435
- declare function listAttachments$1(httpClient: HttpClient$5): ListAttachmentsSignature;
869
+ declare function listAttachments$1(httpClient: HttpClient): ListAttachmentsSignature;
436
870
  interface ListAttachmentsSignature {
437
871
  /**
438
872
  * List Attachments.
@@ -440,14 +874,14 @@ interface ListAttachmentsSignature {
440
874
  */
441
875
  (contactId: string, options?: ListAttachmentsOptions | undefined): Promise<ListAttachmentsResponse & ListAttachmentsResponseNonNullableFields>;
442
876
  }
443
- declare function deleteAttachment$1(httpClient: HttpClient$5): DeleteAttachmentSignature;
877
+ declare function deleteAttachment$1(httpClient: HttpClient): DeleteAttachmentSignature;
444
878
  interface DeleteAttachmentSignature {
445
879
  /**
446
880
  * Deletes an attachment from contact
447
881
  */
448
882
  (identifiers: DeleteAttachmentIdentifiers): Promise<void>;
449
883
  }
450
- declare function getAttachment$1(httpClient: HttpClient$5): GetAttachmentSignature;
884
+ declare function getAttachment$1(httpClient: HttpClient): GetAttachmentSignature;
451
885
  interface GetAttachmentSignature {
452
886
  /**
453
887
  * Retrieves an attachment.
@@ -455,15 +889,15 @@ interface GetAttachmentSignature {
455
889
  */
456
890
  (identifiers: GetAttachmentIdentifiers): Promise<ContactAttachment & ContactAttachmentNonNullableFields>;
457
891
  }
458
- declare const onAttachmentCreated$1: EventDefinition$4<AttachmentCreatedEnvelope, "wix.contacts.v4.attachment_created">;
459
- declare const onAttachmentDeleted$1: EventDefinition$4<AttachmentDeletedEnvelope, "wix.contacts.v4.attachment_deleted">;
892
+ declare const onAttachmentCreated$1: EventDefinition<AttachmentCreatedEnvelope, "wix.contacts.v4.attachment_created">;
893
+ declare const onAttachmentDeleted$1: EventDefinition<AttachmentDeletedEnvelope, "wix.contacts.v4.attachment_deleted">;
460
894
 
461
- declare function createEventModule$4<T extends EventDefinition$4<any, string>>(eventDefinition: T): BuildEventDefinition$4<T> & T;
895
+ declare function createEventModule$4<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
462
896
 
463
- declare const generateAttachmentUploadUrl: BuildRESTFunction$5<typeof generateAttachmentUploadUrl$1> & typeof generateAttachmentUploadUrl$1;
464
- declare const listAttachments: BuildRESTFunction$5<typeof listAttachments$1> & typeof listAttachments$1;
465
- declare const deleteAttachment: BuildRESTFunction$5<typeof deleteAttachment$1> & typeof deleteAttachment$1;
466
- declare const getAttachment: BuildRESTFunction$5<typeof getAttachment$1> & typeof getAttachment$1;
897
+ declare const generateAttachmentUploadUrl: MaybeContext<BuildRESTFunction<typeof generateAttachmentUploadUrl$1> & typeof generateAttachmentUploadUrl$1>;
898
+ declare const listAttachments: MaybeContext<BuildRESTFunction<typeof listAttachments$1> & typeof listAttachments$1>;
899
+ declare const deleteAttachment: MaybeContext<BuildRESTFunction<typeof deleteAttachment$1> & typeof deleteAttachment$1>;
900
+ declare const getAttachment: MaybeContext<BuildRESTFunction<typeof getAttachment$1> & typeof getAttachment$1>;
467
901
 
468
902
  type _publicOnAttachmentCreatedType = typeof onAttachmentCreated$1;
469
903
  /**
@@ -524,50 +958,6 @@ declare namespace index_d$5 {
524
958
  export { type ActionEvent$4 as ActionEvent, type index_d$5_AttachmentCreatedEnvelope as AttachmentCreatedEnvelope, type index_d$5_AttachmentDeletedEnvelope as AttachmentDeletedEnvelope, type index_d$5_AttachmentMedia as AttachmentMedia, type index_d$5_AttachmentMediaMediaOneOf as AttachmentMediaMediaOneOf, type index_d$5_AttachmentMetadata as AttachmentMetadata, type index_d$5_AttachmentSource as AttachmentSource, index_d$5_AttachmentType as AttachmentType, type BaseEventMetadata$4 as BaseEventMetadata, type index_d$5_ContactAttachment as ContactAttachment, type index_d$5_ContactAttachmentMediaOneOf as ContactAttachmentMediaOneOf, type index_d$5_ContactAttachmentNonNullableFields as ContactAttachmentNonNullableFields, type index_d$5_CreateDemoAttachmentRequest as CreateDemoAttachmentRequest, type index_d$5_CreateDemoAttachmentResponse as CreateDemoAttachmentResponse, type index_d$5_CrmAttachment as CrmAttachment, index_d$5_CrmAttachmentAttachmentType as CrmAttachmentAttachmentType, type index_d$5_CrmAttachmentUploadedEvent as CrmAttachmentUploadedEvent, type index_d$5_DeleteAttachmentIdentifiers as DeleteAttachmentIdentifiers, type index_d$5_DeleteAttachmentRequest as DeleteAttachmentRequest, type index_d$5_DeleteAttachmentResponse as DeleteAttachmentResponse, index_d$5_DemoContactType as DemoContactType, type DomainEvent$4 as DomainEvent, type DomainEventBodyOneOf$4 as DomainEventBodyOneOf, type Empty$1 as Empty, type EntityCreatedEvent$4 as EntityCreatedEvent, type EntityDeletedEvent$4 as EntityDeletedEvent, type EntityUpdatedEvent$4 as EntityUpdatedEvent, type EventMetadata$4 as EventMetadata, type index_d$5_GenerateAttachmentUploadUrlOptions as GenerateAttachmentUploadUrlOptions, type index_d$5_GenerateAttachmentUploadUrlRequest as GenerateAttachmentUploadUrlRequest, type index_d$5_GenerateAttachmentUploadUrlResponse as GenerateAttachmentUploadUrlResponse, type index_d$5_GenerateAttachmentUploadUrlResponseNonNullableFields as GenerateAttachmentUploadUrlResponseNonNullableFields, type index_d$5_GetAttachmentIdentifiers as GetAttachmentIdentifiers, type index_d$5_GetAttachmentRequest as GetAttachmentRequest, type index_d$5_GetAttachmentResponse as GetAttachmentResponse, type index_d$5_GetAttachmentResponseNonNullableFields as GetAttachmentResponseNonNullableFields, type IdentificationData$5 as IdentificationData, type IdentificationDataIdOneOf$5 as IdentificationDataIdOneOf, type index_d$5_ListAttachmentsOptions as ListAttachmentsOptions, type index_d$5_ListAttachmentsRequest as ListAttachmentsRequest, type index_d$5_ListAttachmentsResponse as ListAttachmentsResponse, type index_d$5_ListAttachmentsResponseNonNullableFields as ListAttachmentsResponseNonNullableFields, type index_d$5_MediaFileUploadedEvent as MediaFileUploadedEvent, type MessageEnvelope$5 as MessageEnvelope, type Paging$4 as Paging, type PagingMetadata$3 as PagingMetadata, WebhookIdentityType$5 as WebhookIdentityType, type index_d$5__publicOnAttachmentCreatedType as _publicOnAttachmentCreatedType, type index_d$5__publicOnAttachmentDeletedType as _publicOnAttachmentDeletedType, index_d$5_deleteAttachment as deleteAttachment, index_d$5_generateAttachmentUploadUrl as generateAttachmentUploadUrl, index_d$5_getAttachment as getAttachment, index_d$5_listAttachments as listAttachments, index_d$5_onAttachmentCreated as onAttachmentCreated, index_d$5_onAttachmentDeleted as onAttachmentDeleted, onAttachmentCreated$1 as publicOnAttachmentCreated, onAttachmentDeleted$1 as publicOnAttachmentDeleted };
525
959
  }
526
960
 
527
- type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
528
- interface HttpClient$4 {
529
- request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
530
- fetchWithAuth: typeof fetch;
531
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
532
- }
533
- type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
534
- type HttpResponse$4<T = any> = {
535
- data: T;
536
- status: number;
537
- statusText: string;
538
- headers: any;
539
- request?: any;
540
- };
541
- type RequestOptions$4<_TResponse = any, Data = any> = {
542
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
543
- url: string;
544
- data?: Data;
545
- params?: URLSearchParams;
546
- } & APIMetadata$4;
547
- type APIMetadata$4 = {
548
- methodFqn?: string;
549
- entityFqdn?: string;
550
- packageName?: string;
551
- };
552
- type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
553
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
554
- __type: 'event-definition';
555
- type: Type;
556
- isDomainEvent?: boolean;
557
- transformations?: (envelope: unknown) => Payload;
558
- __payload: Payload;
559
- };
560
- declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
561
- type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
562
- type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
563
-
564
- declare global {
565
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
566
- interface SymbolConstructor {
567
- readonly observable: symbol;
568
- }
569
- }
570
-
571
961
  interface Contact {
572
962
  /**
573
963
  * Contact ID.
@@ -2483,7 +2873,7 @@ interface GetContactOptions {
2483
2873
  fieldsets?: ContactFieldSet[];
2484
2874
  }
2485
2875
 
2486
- declare function createContact$1(httpClient: HttpClient$4): CreateContactSignature;
2876
+ declare function createContact$1(httpClient: HttpClient): CreateContactSignature;
2487
2877
  interface CreateContactSignature {
2488
2878
  /**
2489
2879
  * Creates a new contact.
@@ -2504,7 +2894,7 @@ interface CreateContactSignature {
2504
2894
  */
2505
2895
  (info: ContactInfo$2, options?: CreateContactOptions | undefined): Promise<CreateContactResponse & CreateContactResponseNonNullableFields>;
2506
2896
  }
2507
- declare function updateContact$1(httpClient: HttpClient$4): UpdateContactSignature;
2897
+ declare function updateContact$1(httpClient: HttpClient): UpdateContactSignature;
2508
2898
  interface UpdateContactSignature {
2509
2899
  /**
2510
2900
  * Updates a contact's properties.
@@ -2524,7 +2914,7 @@ interface UpdateContactSignature {
2524
2914
  */
2525
2915
  (contactId: string, info: ContactInfo$2, revision: number | null, options?: UpdateContactOptions | undefined): Promise<UpdateContactResponse & UpdateContactResponseNonNullableFields>;
2526
2916
  }
2527
- declare function mergeContacts$1(httpClient: HttpClient$4): MergeContactsSignature;
2917
+ declare function mergeContacts$1(httpClient: HttpClient): MergeContactsSignature;
2528
2918
  interface MergeContactsSignature {
2529
2919
  /**
2530
2920
  * Merges source contacts into a target contact.
@@ -2550,7 +2940,7 @@ interface MergeContactsSignature {
2550
2940
  */
2551
2941
  (targetContactId: string, targetContactRevision: number | null, options?: MergeContactsOptions | undefined): Promise<MergeContactsResponse & MergeContactsResponseNonNullableFields>;
2552
2942
  }
2553
- declare function deleteContact$1(httpClient: HttpClient$4): DeleteContactSignature;
2943
+ declare function deleteContact$1(httpClient: HttpClient): DeleteContactSignature;
2554
2944
  interface DeleteContactSignature {
2555
2945
  /**
2556
2946
  * Deletes a contact who is not a site member or contributor.
@@ -2568,7 +2958,7 @@ interface DeleteContactSignature {
2568
2958
  */
2569
2959
  (contactId: string): Promise<void>;
2570
2960
  }
2571
- declare function labelContact$1(httpClient: HttpClient$4): LabelContactSignature;
2961
+ declare function labelContact$1(httpClient: HttpClient): LabelContactSignature;
2572
2962
  interface LabelContactSignature {
2573
2963
  /**
2574
2964
  * Adds labels to a contact.
@@ -2590,7 +2980,7 @@ interface LabelContactSignature {
2590
2980
  */
2591
2981
  (contactId: string, labelKeys: string[]): Promise<LabelContactResponse & LabelContactResponseNonNullableFields>;
2592
2982
  }
2593
- declare function unlabelContact$1(httpClient: HttpClient$4): UnlabelContactSignature;
2983
+ declare function unlabelContact$1(httpClient: HttpClient): UnlabelContactSignature;
2594
2984
  interface UnlabelContactSignature {
2595
2985
  /**
2596
2986
  * Removes labels from a contact.
@@ -2606,7 +2996,7 @@ interface UnlabelContactSignature {
2606
2996
  */
2607
2997
  (contactId: string, labelKeys: string[]): Promise<UnlabelContactResponse & UnlabelContactResponseNonNullableFields>;
2608
2998
  }
2609
- declare function queryContacts$1(httpClient: HttpClient$4): QueryContactsSignature;
2999
+ declare function queryContacts$1(httpClient: HttpClient): QueryContactsSignature;
2610
3000
  interface QueryContactsSignature {
2611
3001
  /**
2612
3002
  * Creates a query to retrieve a list of contacts.
@@ -2628,7 +3018,7 @@ interface QueryContactsSignature {
2628
3018
  */
2629
3019
  (options?: QueryContactsOptions | undefined): ContactsQueryBuilder;
2630
3020
  }
2631
- declare function getContact$1(httpClient: HttpClient$4): GetContactSignature;
3021
+ declare function getContact$1(httpClient: HttpClient): GetContactSignature;
2632
3022
  interface GetContactSignature {
2633
3023
  /**
2634
3024
  * Retrieves a contact.
@@ -2649,21 +3039,21 @@ interface GetContactSignature {
2649
3039
  */
2650
3040
  (_id: string, options?: GetContactOptions | undefined): Promise<Contact & ContactNonNullableFields>;
2651
3041
  }
2652
- declare const onContactCreated$1: EventDefinition$3<ContactCreatedEnvelope, "wix.contacts.v4.contact_created">;
2653
- declare const onContactUpdated$1: EventDefinition$3<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">;
2654
- declare const onContactMerged$1: EventDefinition$3<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">;
2655
- declare const onContactDeleted$1: EventDefinition$3<ContactDeletedEnvelope, "wix.contacts.v4.contact_deleted">;
3042
+ declare const onContactCreated$1: EventDefinition<ContactCreatedEnvelope, "wix.contacts.v4.contact_created">;
3043
+ declare const onContactUpdated$1: EventDefinition<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">;
3044
+ declare const onContactMerged$1: EventDefinition<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">;
3045
+ declare const onContactDeleted$1: EventDefinition<ContactDeletedEnvelope, "wix.contacts.v4.contact_deleted">;
2656
3046
 
2657
- declare function createEventModule$3<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
3047
+ declare function createEventModule$3<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
2658
3048
 
2659
- declare const createContact: BuildRESTFunction$4<typeof createContact$1> & typeof createContact$1;
2660
- declare const updateContact: BuildRESTFunction$4<typeof updateContact$1> & typeof updateContact$1;
2661
- declare const mergeContacts: BuildRESTFunction$4<typeof mergeContacts$1> & typeof mergeContacts$1;
2662
- declare const deleteContact: BuildRESTFunction$4<typeof deleteContact$1> & typeof deleteContact$1;
2663
- declare const labelContact: BuildRESTFunction$4<typeof labelContact$1> & typeof labelContact$1;
2664
- declare const unlabelContact: BuildRESTFunction$4<typeof unlabelContact$1> & typeof unlabelContact$1;
2665
- declare const queryContacts: BuildRESTFunction$4<typeof queryContacts$1> & typeof queryContacts$1;
2666
- declare const getContact: BuildRESTFunction$4<typeof getContact$1> & typeof getContact$1;
3049
+ declare const createContact: MaybeContext<BuildRESTFunction<typeof createContact$1> & typeof createContact$1>;
3050
+ declare const updateContact: MaybeContext<BuildRESTFunction<typeof updateContact$1> & typeof updateContact$1>;
3051
+ declare const mergeContacts: MaybeContext<BuildRESTFunction<typeof mergeContacts$1> & typeof mergeContacts$1>;
3052
+ declare const deleteContact: MaybeContext<BuildRESTFunction<typeof deleteContact$1> & typeof deleteContact$1>;
3053
+ declare const labelContact: MaybeContext<BuildRESTFunction<typeof labelContact$1> & typeof labelContact$1>;
3054
+ declare const unlabelContact: MaybeContext<BuildRESTFunction<typeof unlabelContact$1> & typeof unlabelContact$1>;
3055
+ declare const queryContacts: MaybeContext<BuildRESTFunction<typeof queryContacts$1> & typeof queryContacts$1>;
3056
+ declare const getContact: MaybeContext<BuildRESTFunction<typeof getContact$1> & typeof getContact$1>;
2667
3057
 
2668
3058
  type _publicOnContactCreatedType = typeof onContactCreated$1;
2669
3059
  /**
@@ -2850,50 +3240,6 @@ declare namespace index_d$4 {
2850
3240
  export { index_d$4_Action as Action, type ActionEvent$3 as ActionEvent, type ActivityIcon$1 as ActivityIcon, type Address$1 as Address, type AddressLocation$1 as AddressLocation, type AddressStreetOneOf$1 as AddressStreetOneOf, AddressTag$1 as AddressTag, type index_d$4_ApplicationError as ApplicationError, type AssigneesWrapper$1 as AssigneesWrapper, type BaseEventMetadata$3 as BaseEventMetadata, type index_d$4_BulkActionMetadata as BulkActionMetadata, type index_d$4_BulkAddSegmentToContactsRequest as BulkAddSegmentToContactsRequest, type index_d$4_BulkAddSegmentToContactsResponse as BulkAddSegmentToContactsResponse, type index_d$4_BulkDeleteContactsRequest as BulkDeleteContactsRequest, type index_d$4_BulkDeleteContactsResponse as BulkDeleteContactsResponse, type index_d$4_BulkLabelAndUnlabelContactsRequest as BulkLabelAndUnlabelContactsRequest, type index_d$4_BulkLabelAndUnlabelContactsResponse as BulkLabelAndUnlabelContactsResponse, type index_d$4_BulkRemoveSegmentFromContactsRequest as BulkRemoveSegmentFromContactsRequest, type index_d$4_BulkRemoveSegmentFromContactsResponse as BulkRemoveSegmentFromContactsResponse, type index_d$4_BulkUpdateContactsRequest as BulkUpdateContactsRequest, type index_d$4_BulkUpdateContactsResponse as BulkUpdateContactsResponse, type index_d$4_BulkUpsertContactsRequest as BulkUpsertContactsRequest, type index_d$4_BulkUpsertContactsResponse as BulkUpsertContactsResponse, type index_d$4_BulkUpsertContactsResponseMetadata as BulkUpsertContactsResponseMetadata, type index_d$4_Contact as Contact, type ContactActivity$1 as ContactActivity, ContactActivityType$1 as ContactActivityType, type index_d$4_ContactAddedToSegment as ContactAddedToSegment, type ContactAddress$1 as ContactAddress, type ContactAddressesWrapper$1 as ContactAddressesWrapper, type index_d$4_ContactChanged as ContactChanged, type index_d$4_ContactCreatedEnvelope as ContactCreatedEnvelope, type index_d$4_ContactDeletedEnvelope as ContactDeletedEnvelope, type ContactEmail$1 as ContactEmail, type index_d$4_ContactEmailSubscriptionUpdated as ContactEmailSubscriptionUpdated, type ContactEmailsWrapper$1 as ContactEmailsWrapper, index_d$4_ContactFieldSet as ContactFieldSet, type ContactInfo$2 as ContactInfo, type index_d$4_ContactMerged as ContactMerged, type index_d$4_ContactMergedEnvelope as ContactMergedEnvelope, type ContactName$1 as ContactName, type index_d$4_ContactNonNullableFields as ContactNonNullableFields, type ContactPhone$1 as ContactPhone, type index_d$4_ContactPhoneSubscriptionUpdated as ContactPhoneSubscriptionUpdated, type ContactPhonesWrapper$1 as ContactPhonesWrapper, type ContactPicture$1 as ContactPicture, type index_d$4_ContactPrimaryInfoUpdated as ContactPrimaryInfoUpdated, type index_d$4_ContactRemovedFromSegment as ContactRemovedFromSegment, type index_d$4_ContactSource as ContactSource, ContactSourceType$1 as ContactSourceType, type index_d$4_ContactSubmitted as ContactSubmitted, type index_d$4_ContactUpdatedEnvelope as ContactUpdatedEnvelope, type index_d$4_ContactsFacet as ContactsFacet, index_d$4_ContactsFacetType as ContactsFacetType, type index_d$4_ContactsQueryBuilder as ContactsQueryBuilder, type index_d$4_ContactsQueryResult as ContactsQueryResult, type index_d$4_CountContactsRequest as CountContactsRequest, type index_d$4_CountContactsResponse as CountContactsResponse, type index_d$4_CreateContactOptions as CreateContactOptions, type index_d$4_CreateContactRequest as CreateContactRequest, type index_d$4_CreateContactResponse as CreateContactResponse, type index_d$4_CreateContactResponseNonNullableFields as CreateContactResponseNonNullableFields, type CursorPaging$1 as CursorPaging, type CursorPagingMetadata$1 as CursorPagingMetadata, type Cursors$1 as Cursors, type index_d$4_DeleteContactRequest as DeleteContactRequest, type index_d$4_DeleteContactResponse as DeleteContactResponse, type DomainEvent$3 as DomainEvent, type DomainEventBodyOneOf$3 as DomainEventBodyOneOf, type index_d$4_DuplicateContactExists as DuplicateContactExists, index_d$4_EmailDeliverabilityStatus as EmailDeliverabilityStatus, EmailTag$1 as EmailTag, type EntityCreatedEvent$3 as EntityCreatedEvent, type EntityDeletedEvent$3 as EntityDeletedEvent, type EntityUpdatedEvent$3 as EntityUpdatedEvent, type index_d$4_Error as Error, type EventMetadata$3 as EventMetadata, type ExtendedFieldsWrapper$1 as ExtendedFieldsWrapper, type index_d$4_GeneratePictureUploadUrlRequest as GeneratePictureUploadUrlRequest, type index_d$4_GeneratePictureUploadUrlResponse as GeneratePictureUploadUrlResponse, type index_d$4_GetContactOptions as GetContactOptions, type index_d$4_GetContactRequest as GetContactRequest, type index_d$4_GetContactResponse as GetContactResponse, type index_d$4_GetContactResponseNonNullableFields as GetContactResponseNonNullableFields, index_d$4_GetContactResponseType as GetContactResponseType, type index_d$4_GroupInfo as GroupInfo, type IdentificationData$4 as IdentificationData, type IdentificationDataIdOneOf$4 as IdentificationDataIdOneOf, ImageProvider$1 as ImageProvider, type index_d$4_Item as Item, type index_d$4_ItemMetadata as ItemMetadata, type index_d$4_LabelAndUnlabelContactRequest as LabelAndUnlabelContactRequest, type index_d$4_LabelAndUnlabelContactResponse as LabelAndUnlabelContactResponse, type index_d$4_LabelContactRequest as LabelContactRequest, type index_d$4_LabelContactResponse as LabelContactResponse, type index_d$4_LabelContactResponseNonNullableFields as LabelContactResponseNonNullableFields, type LabelsWrapper$1 as LabelsWrapper, type index_d$4_LastActivityUpdate as LastActivityUpdate, type index_d$4_ListContactIdsBySegmentRequest as ListContactIdsBySegmentRequest, type index_d$4_ListContactIdsBySegmentResponse as ListContactIdsBySegmentResponse, type index_d$4_ListContactsRequest as ListContactsRequest, type index_d$4_ListContactsResponse as ListContactsResponse, type index_d$4_ListFacetsRequest as ListFacetsRequest, type index_d$4_ListFacetsResponse as ListFacetsResponse, type LocationsWrapper$1 as LocationsWrapper, type index_d$4_MemberInfo as MemberInfo, index_d$4_MemberStatus as MemberStatus, type index_d$4_MergeContactsOptions as MergeContactsOptions, type index_d$4_MergeContactsRequest as MergeContactsRequest, type index_d$4_MergeContactsResponse as MergeContactsResponse, type index_d$4_MergeContactsResponseNonNullableFields as MergeContactsResponseNonNullableFields, type MessageEnvelope$4 as MessageEnvelope, type index_d$4_Metadata as Metadata, index_d$4_Mode as Mode, type Paging$3 as Paging, type PagingMetadata$2 as PagingMetadata, index_d$4_PhoneDeliverabilityStatus as PhoneDeliverabilityStatus, PhoneTag$1 as PhoneTag, type index_d$4_PreviewMergeContactsRequest as PreviewMergeContactsRequest, type index_d$4_PreviewMergeContactsResponse as PreviewMergeContactsResponse, type index_d$4_PrimaryContactInfo as PrimaryContactInfo, type index_d$4_PrimaryEmail as PrimaryEmail, type index_d$4_PrimaryPhone as PrimaryPhone, type index_d$4_PrimarySubscriptionStatus as PrimarySubscriptionStatus, index_d$4_PrivacyStatus as PrivacyStatus, type index_d$4_ProfileInfo as ProfileInfo, type Query$2 as Query, type index_d$4_QueryContactsOptions as QueryContactsOptions, type index_d$4_QueryContactsRequest as QueryContactsRequest, type index_d$4_QueryContactsResponse as QueryContactsResponse, type index_d$4_QueryContactsResponseNonNullableFields as QueryContactsResponseNonNullableFields, type index_d$4_QueryFacetsRequest as QueryFacetsRequest, type index_d$4_QueryFacetsResponse as QueryFacetsResponse, type RestoreInfo$2 as RestoreInfo, index_d$4_Role as Role, type index_d$4_Search as Search, type index_d$4_SearchContactsRequest as SearchContactsRequest, type index_d$4_SearchContactsResponse as SearchContactsResponse, type index_d$4_SearchDetails as SearchDetails, type index_d$4_SearchPagingMethodOneOf as SearchPagingMethodOneOf, type index_d$4_SegmentsWrapper as SegmentsWrapper, type index_d$4_SessionInfo as SessionInfo, SortOrder$3 as SortOrder, type Sorting$3 as Sorting, type StreetAddress$1 as StreetAddress, type Subdivision$1 as Subdivision, SubdivisionType$1 as SubdivisionType, SubmitOperation$1 as SubmitOperation, index_d$4_SubscriptionStatus as SubscriptionStatus, type index_d$4_SyncSubmitContactRequest as SyncSubmitContactRequest, type index_d$4_SyncSubmitContactResponse as SyncSubmitContactResponse, type index_d$4_UnlabelContactRequest as UnlabelContactRequest, type index_d$4_UnlabelContactResponse as UnlabelContactResponse, type index_d$4_UnlabelContactResponseNonNullableFields as UnlabelContactResponseNonNullableFields, type index_d$4_UpdateContactOptions as UpdateContactOptions, type index_d$4_UpdateContactRequest as UpdateContactRequest, type index_d$4_UpdateContactResponse as UpdateContactResponse, type index_d$4_UpdateContactResponseNonNullableFields as UpdateContactResponseNonNullableFields, type index_d$4_UpsertContactRequest as UpsertContactRequest, type index_d$4_UpsertContactResponse as UpsertContactResponse, index_d$4_UpsertContactResponseAction as UpsertContactResponseAction, type index_d$4_UserInfo as UserInfo, WebhookIdentityType$4 as WebhookIdentityType, type index_d$4__publicOnContactCreatedType as _publicOnContactCreatedType, type index_d$4__publicOnContactDeletedType as _publicOnContactDeletedType, type index_d$4__publicOnContactMergedType as _publicOnContactMergedType, type index_d$4__publicOnContactUpdatedType as _publicOnContactUpdatedType, index_d$4_createContact as createContact, index_d$4_deleteContact as deleteContact, index_d$4_getContact as getContact, index_d$4_labelContact as labelContact, index_d$4_mergeContacts as mergeContacts, index_d$4_onContactCreated as onContactCreated, index_d$4_onContactDeleted as onContactDeleted, index_d$4_onContactMerged as onContactMerged, index_d$4_onContactUpdated as onContactUpdated, onContactCreated$1 as publicOnContactCreated, onContactDeleted$1 as publicOnContactDeleted, onContactMerged$1 as publicOnContactMerged, onContactUpdated$1 as publicOnContactUpdated, index_d$4_queryContacts as queryContacts, index_d$4_unlabelContact as unlabelContact, index_d$4_updateContact as updateContact };
2851
3241
  }
2852
3242
 
2853
- type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
2854
- interface HttpClient$3 {
2855
- request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
2856
- fetchWithAuth: typeof fetch;
2857
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
2858
- }
2859
- type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
2860
- type HttpResponse$3<T = any> = {
2861
- data: T;
2862
- status: number;
2863
- statusText: string;
2864
- headers: any;
2865
- request?: any;
2866
- };
2867
- type RequestOptions$3<_TResponse = any, Data = any> = {
2868
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
2869
- url: string;
2870
- data?: Data;
2871
- params?: URLSearchParams;
2872
- } & APIMetadata$3;
2873
- type APIMetadata$3 = {
2874
- methodFqn?: string;
2875
- entityFqdn?: string;
2876
- packageName?: string;
2877
- };
2878
- type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
2879
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
2880
- __type: 'event-definition';
2881
- type: Type;
2882
- isDomainEvent?: boolean;
2883
- transformations?: (envelope: unknown) => Payload;
2884
- __payload: Payload;
2885
- };
2886
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
2887
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
2888
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
2889
-
2890
- declare global {
2891
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
2892
- interface SymbolConstructor {
2893
- readonly observable: symbol;
2894
- }
2895
- }
2896
-
2897
3243
  /** Extended field that was found or created. */
2898
3244
  interface ExtendedField {
2899
3245
  /**
@@ -3465,7 +3811,7 @@ interface FieldsQueryBuilder {
3465
3811
  find: () => Promise<FieldsQueryResult>;
3466
3812
  }
3467
3813
 
3468
- declare function findOrCreateExtendedField$1(httpClient: HttpClient$3): FindOrCreateExtendedFieldSignature;
3814
+ declare function findOrCreateExtendedField$1(httpClient: HttpClient): FindOrCreateExtendedFieldSignature;
3469
3815
  interface FindOrCreateExtendedFieldSignature {
3470
3816
  /**
3471
3817
  * Retrieves a custom field with a given name, or creates one if it doesn't exist.
@@ -3494,7 +3840,7 @@ interface FindOrCreateExtendedFieldSignature {
3494
3840
  */
3495
3841
  (displayName: string, dataType: FieldDataType): Promise<FindOrCreateExtendedFieldResponse & FindOrCreateExtendedFieldResponseNonNullableFields>;
3496
3842
  }
3497
- declare function getExtendedField$1(httpClient: HttpClient$3): GetExtendedFieldSignature;
3843
+ declare function getExtendedField$1(httpClient: HttpClient): GetExtendedFieldSignature;
3498
3844
  interface GetExtendedFieldSignature {
3499
3845
  /**
3500
3846
  * Retrieves an extended field.
@@ -3513,7 +3859,7 @@ interface GetExtendedFieldSignature {
3513
3859
  */
3514
3860
  (key: string): Promise<ExtendedField & ExtendedFieldNonNullableFields>;
3515
3861
  }
3516
- declare function renameExtendedField$1(httpClient: HttpClient$3): RenameExtendedFieldSignature;
3862
+ declare function renameExtendedField$1(httpClient: HttpClient): RenameExtendedFieldSignature;
3517
3863
  interface RenameExtendedFieldSignature {
3518
3864
  /**
3519
3865
  * Renames an extended field.
@@ -3533,7 +3879,7 @@ interface RenameExtendedFieldSignature {
3533
3879
  */
3534
3880
  (key: string, field: RenameExtendedField): Promise<ExtendedField & ExtendedFieldNonNullableFields>;
3535
3881
  }
3536
- declare function deleteExtendedField$1(httpClient: HttpClient$3): DeleteExtendedFieldSignature;
3882
+ declare function deleteExtendedField$1(httpClient: HttpClient): DeleteExtendedFieldSignature;
3537
3883
  interface DeleteExtendedFieldSignature {
3538
3884
  /**
3539
3885
  * Deletes an extended field.
@@ -3546,7 +3892,7 @@ interface DeleteExtendedFieldSignature {
3546
3892
  */
3547
3893
  (key: string): Promise<void>;
3548
3894
  }
3549
- declare function queryExtendedFields$1(httpClient: HttpClient$3): QueryExtendedFieldsSignature;
3895
+ declare function queryExtendedFields$1(httpClient: HttpClient): QueryExtendedFieldsSignature;
3550
3896
  interface QueryExtendedFieldsSignature {
3551
3897
  /**
3552
3898
  * Creates a query to retrieve a list of extended fields.
@@ -3566,17 +3912,17 @@ interface QueryExtendedFieldsSignature {
3566
3912
  */
3567
3913
  (): FieldsQueryBuilder;
3568
3914
  }
3569
- declare const onExtendedFieldCreated$1: EventDefinition$2<ExtendedFieldCreatedEnvelope, "wix.contacts.v4.extended-field_created">;
3570
- declare const onExtendedFieldUpdated$1: EventDefinition$2<ExtendedFieldUpdatedEnvelope, "wix.contacts.v4.extended-field_updated">;
3571
- declare const onExtendedFieldDeleted$1: EventDefinition$2<ExtendedFieldDeletedEnvelope, "wix.contacts.v4.extended-field_deleted">;
3915
+ declare const onExtendedFieldCreated$1: EventDefinition<ExtendedFieldCreatedEnvelope, "wix.contacts.v4.extended-field_created">;
3916
+ declare const onExtendedFieldUpdated$1: EventDefinition<ExtendedFieldUpdatedEnvelope, "wix.contacts.v4.extended-field_updated">;
3917
+ declare const onExtendedFieldDeleted$1: EventDefinition<ExtendedFieldDeletedEnvelope, "wix.contacts.v4.extended-field_deleted">;
3572
3918
 
3573
- declare function createEventModule$2<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
3919
+ declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
3574
3920
 
3575
- declare const findOrCreateExtendedField: BuildRESTFunction$3<typeof findOrCreateExtendedField$1> & typeof findOrCreateExtendedField$1;
3576
- declare const getExtendedField: BuildRESTFunction$3<typeof getExtendedField$1> & typeof getExtendedField$1;
3577
- declare const renameExtendedField: BuildRESTFunction$3<typeof renameExtendedField$1> & typeof renameExtendedField$1;
3578
- declare const deleteExtendedField: BuildRESTFunction$3<typeof deleteExtendedField$1> & typeof deleteExtendedField$1;
3579
- declare const queryExtendedFields: BuildRESTFunction$3<typeof queryExtendedFields$1> & typeof queryExtendedFields$1;
3921
+ declare const findOrCreateExtendedField: MaybeContext<BuildRESTFunction<typeof findOrCreateExtendedField$1> & typeof findOrCreateExtendedField$1>;
3922
+ declare const getExtendedField: MaybeContext<BuildRESTFunction<typeof getExtendedField$1> & typeof getExtendedField$1>;
3923
+ declare const renameExtendedField: MaybeContext<BuildRESTFunction<typeof renameExtendedField$1> & typeof renameExtendedField$1>;
3924
+ declare const deleteExtendedField: MaybeContext<BuildRESTFunction<typeof deleteExtendedField$1> & typeof deleteExtendedField$1>;
3925
+ declare const queryExtendedFields: MaybeContext<BuildRESTFunction<typeof queryExtendedFields$1> & typeof queryExtendedFields$1>;
3580
3926
 
3581
3927
  type _publicOnExtendedFieldCreatedType = typeof onExtendedFieldCreated$1;
3582
3928
  /**
@@ -3641,50 +3987,6 @@ declare namespace index_d$3 {
3641
3987
  export { type ActionEvent$2 as ActionEvent, type BaseEventMetadata$2 as BaseEventMetadata, type index_d$3_DeleteExtendedFieldRequest as DeleteExtendedFieldRequest, type index_d$3_DeleteExtendedFieldResponse as DeleteExtendedFieldResponse, type DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type EventMetadata$2 as EventMetadata, type index_d$3_ExtendedField as ExtendedField, type index_d$3_ExtendedFieldCreatedEnvelope as ExtendedFieldCreatedEnvelope, type index_d$3_ExtendedFieldDeletedEnvelope as ExtendedFieldDeletedEnvelope, type index_d$3_ExtendedFieldNonNullableFields as ExtendedFieldNonNullableFields, type index_d$3_ExtendedFieldUpdatedEnvelope as ExtendedFieldUpdatedEnvelope, index_d$3_FieldDataType as FieldDataType, index_d$3_FieldType as FieldType, type index_d$3_FieldsQueryBuilder as FieldsQueryBuilder, type index_d$3_FieldsQueryResult as FieldsQueryResult, type index_d$3_FindOrCreateExtendedFieldRequest as FindOrCreateExtendedFieldRequest, type index_d$3_FindOrCreateExtendedFieldResponse as FindOrCreateExtendedFieldResponse, type index_d$3_FindOrCreateExtendedFieldResponseNonNullableFields as FindOrCreateExtendedFieldResponseNonNullableFields, type GdprListRequest$1 as GdprListRequest, type GdprListResponse$1 as GdprListResponse, type index_d$3_GetExtendedFieldByLegacyIdRequest as GetExtendedFieldByLegacyIdRequest, type index_d$3_GetExtendedFieldByLegacyIdResponse as GetExtendedFieldByLegacyIdResponse, type index_d$3_GetExtendedFieldRequest as GetExtendedFieldRequest, type index_d$3_GetExtendedFieldResponse as GetExtendedFieldResponse, type index_d$3_GetExtendedFieldResponseNonNullableFields as GetExtendedFieldResponseNonNullableFields, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type index_d$3_ListExtendedFieldsRequest as ListExtendedFieldsRequest, type index_d$3_ListExtendedFieldsResponse as ListExtendedFieldsResponse, type MessageEnvelope$3 as MessageEnvelope, type Paging$2 as Paging, type PagingMetadata$1 as PagingMetadata, type PurgeRequest$1 as PurgeRequest, type PurgeResponse$1 as PurgeResponse, type Query$1 as Query, type index_d$3_QueryExtendedFieldsRequest as QueryExtendedFieldsRequest, type index_d$3_QueryExtendedFieldsResponse as QueryExtendedFieldsResponse, type index_d$3_QueryExtendedFieldsResponseNonNullableFields as QueryExtendedFieldsResponseNonNullableFields, type index_d$3_RenameExtendedField as RenameExtendedField, type RestoreInfo$1 as RestoreInfo, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, type index_d$3_UpdateExtendedFieldRequest as UpdateExtendedFieldRequest, type index_d$3_UpdateExtendedFieldResponse as UpdateExtendedFieldResponse, type index_d$3_UpdateExtendedFieldResponseNonNullableFields as UpdateExtendedFieldResponseNonNullableFields, WebhookIdentityType$3 as WebhookIdentityType, type index_d$3__publicOnExtendedFieldCreatedType as _publicOnExtendedFieldCreatedType, type index_d$3__publicOnExtendedFieldDeletedType as _publicOnExtendedFieldDeletedType, type index_d$3__publicOnExtendedFieldUpdatedType as _publicOnExtendedFieldUpdatedType, index_d$3_deleteExtendedField as deleteExtendedField, index_d$3_findOrCreateExtendedField as findOrCreateExtendedField, index_d$3_getExtendedField as getExtendedField, index_d$3_onExtendedFieldCreated as onExtendedFieldCreated, index_d$3_onExtendedFieldDeleted as onExtendedFieldDeleted, index_d$3_onExtendedFieldUpdated as onExtendedFieldUpdated, onExtendedFieldCreated$1 as publicOnExtendedFieldCreated, onExtendedFieldDeleted$1 as publicOnExtendedFieldDeleted, onExtendedFieldUpdated$1 as publicOnExtendedFieldUpdated, index_d$3_queryExtendedFields as queryExtendedFields, index_d$3_renameExtendedField as renameExtendedField };
3642
3988
  }
3643
3989
 
3644
- type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
3645
- interface HttpClient$2 {
3646
- request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
3647
- fetchWithAuth: typeof fetch;
3648
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
3649
- }
3650
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
3651
- type HttpResponse$2<T = any> = {
3652
- data: T;
3653
- status: number;
3654
- statusText: string;
3655
- headers: any;
3656
- request?: any;
3657
- };
3658
- type RequestOptions$2<_TResponse = any, Data = any> = {
3659
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
3660
- url: string;
3661
- data?: Data;
3662
- params?: URLSearchParams;
3663
- } & APIMetadata$2;
3664
- type APIMetadata$2 = {
3665
- methodFqn?: string;
3666
- entityFqdn?: string;
3667
- packageName?: string;
3668
- };
3669
- type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
3670
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
3671
- __type: 'event-definition';
3672
- type: Type;
3673
- isDomainEvent?: boolean;
3674
- transformations?: (envelope: unknown) => Payload;
3675
- __payload: Payload;
3676
- };
3677
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
3678
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
3679
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
3680
-
3681
- declare global {
3682
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
3683
- interface SymbolConstructor {
3684
- readonly observable: symbol;
3685
- }
3686
- }
3687
-
3688
3990
  /** Label that was found or created. */
3689
3991
  interface ContactLabel {
3690
3992
  /**
@@ -4279,7 +4581,7 @@ interface LabelsQueryBuilder {
4279
4581
  find: () => Promise<LabelsQueryResult>;
4280
4582
  }
4281
4583
 
4282
- declare function findOrCreateLabel$1(httpClient: HttpClient$2): FindOrCreateLabelSignature;
4584
+ declare function findOrCreateLabel$1(httpClient: HttpClient): FindOrCreateLabelSignature;
4283
4585
  interface FindOrCreateLabelSignature {
4284
4586
  /**
4285
4587
  * Retrieves a label with a given name, or creates one if it doesn't exist.
@@ -4302,7 +4604,7 @@ interface FindOrCreateLabelSignature {
4302
4604
  */
4303
4605
  (displayName: string, options?: FindOrCreateLabelOptions | undefined): Promise<FindOrCreateLabelResponse & FindOrCreateLabelResponseNonNullableFields>;
4304
4606
  }
4305
- declare function getLabel$1(httpClient: HttpClient$2): GetLabelSignature;
4607
+ declare function getLabel$1(httpClient: HttpClient): GetLabelSignature;
4306
4608
  interface GetLabelSignature {
4307
4609
  /**
4308
4610
  * Retrieves a label by the specified label key.
@@ -4317,7 +4619,7 @@ interface GetLabelSignature {
4317
4619
  */
4318
4620
  (key: string, options?: GetLabelOptions | undefined): Promise<ContactLabel & ContactLabelNonNullableFields>;
4319
4621
  }
4320
- declare function renameLabel$1(httpClient: HttpClient$2): RenameLabelSignature;
4622
+ declare function renameLabel$1(httpClient: HttpClient): RenameLabelSignature;
4321
4623
  interface RenameLabelSignature {
4322
4624
  /**
4323
4625
  * Renames a label.
@@ -4334,7 +4636,7 @@ interface RenameLabelSignature {
4334
4636
  */
4335
4637
  (key: string, label: RenameLabel, options?: RenameLabelOptions | undefined): Promise<ContactLabel & ContactLabelNonNullableFields>;
4336
4638
  }
4337
- declare function deleteLabel$1(httpClient: HttpClient$2): DeleteLabelSignature;
4639
+ declare function deleteLabel$1(httpClient: HttpClient): DeleteLabelSignature;
4338
4640
  interface DeleteLabelSignature {
4339
4641
  /**
4340
4642
  * Deletes a label from the site and removes it from contacts it applies to.
@@ -4346,7 +4648,7 @@ interface DeleteLabelSignature {
4346
4648
  */
4347
4649
  (key: string): Promise<void>;
4348
4650
  }
4349
- declare function queryLabels$1(httpClient: HttpClient$2): QueryLabelsSignature;
4651
+ declare function queryLabels$1(httpClient: HttpClient): QueryLabelsSignature;
4350
4652
  interface QueryLabelsSignature {
4351
4653
  /**
4352
4654
  * Creates a query to retrieve a list of labels.
@@ -4369,17 +4671,17 @@ interface QueryLabelsSignature {
4369
4671
  */
4370
4672
  (options?: QueryLabelsOptions | undefined): LabelsQueryBuilder;
4371
4673
  }
4372
- declare const onLabelCreated$1: EventDefinition$1<LabelCreatedEnvelope, "wix.contacts.v4.label_created">;
4373
- declare const onLabelUpdated$1: EventDefinition$1<LabelUpdatedEnvelope, "wix.contacts.v4.label_updated">;
4374
- declare const onLabelDeleted$1: EventDefinition$1<LabelDeletedEnvelope, "wix.contacts.v4.label_deleted">;
4674
+ declare const onLabelCreated$1: EventDefinition<LabelCreatedEnvelope, "wix.contacts.v4.label_created">;
4675
+ declare const onLabelUpdated$1: EventDefinition<LabelUpdatedEnvelope, "wix.contacts.v4.label_updated">;
4676
+ declare const onLabelDeleted$1: EventDefinition<LabelDeletedEnvelope, "wix.contacts.v4.label_deleted">;
4375
4677
 
4376
- declare function createEventModule$1<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
4678
+ declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
4377
4679
 
4378
- declare const findOrCreateLabel: BuildRESTFunction$2<typeof findOrCreateLabel$1> & typeof findOrCreateLabel$1;
4379
- declare const getLabel: BuildRESTFunction$2<typeof getLabel$1> & typeof getLabel$1;
4380
- declare const renameLabel: BuildRESTFunction$2<typeof renameLabel$1> & typeof renameLabel$1;
4381
- declare const deleteLabel: BuildRESTFunction$2<typeof deleteLabel$1> & typeof deleteLabel$1;
4382
- declare const queryLabels: BuildRESTFunction$2<typeof queryLabels$1> & typeof queryLabels$1;
4680
+ declare const findOrCreateLabel: MaybeContext<BuildRESTFunction<typeof findOrCreateLabel$1> & typeof findOrCreateLabel$1>;
4681
+ declare const getLabel: MaybeContext<BuildRESTFunction<typeof getLabel$1> & typeof getLabel$1>;
4682
+ declare const renameLabel: MaybeContext<BuildRESTFunction<typeof renameLabel$1> & typeof renameLabel$1>;
4683
+ declare const deleteLabel: MaybeContext<BuildRESTFunction<typeof deleteLabel$1> & typeof deleteLabel$1>;
4684
+ declare const queryLabels: MaybeContext<BuildRESTFunction<typeof queryLabels$1> & typeof queryLabels$1>;
4383
4685
 
4384
4686
  type _publicOnLabelCreatedType = typeof onLabelCreated$1;
4385
4687
  /**
@@ -4457,40 +4759,6 @@ declare namespace index_d$2 {
4457
4759
  export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type index_d$2_ContactLabel as ContactLabel, type index_d$2_ContactLabelNamespace as ContactLabelNamespace, type index_d$2_ContactLabelNonNullableFields as ContactLabelNonNullableFields, type index_d$2_DeleteLabelRequest as DeleteLabelRequest, type index_d$2_DeleteLabelResponse as DeleteLabelResponse, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type index_d$2_FindOrCreateLabelOptions as FindOrCreateLabelOptions, type index_d$2_FindOrCreateLabelRequest as FindOrCreateLabelRequest, type index_d$2_FindOrCreateLabelResponse as FindOrCreateLabelResponse, type index_d$2_FindOrCreateLabelResponseNonNullableFields as FindOrCreateLabelResponseNonNullableFields, type index_d$2_GdprListRequest as GdprListRequest, type index_d$2_GdprListResponse as GdprListResponse, type index_d$2_GetLabelByLegacyIdRequest as GetLabelByLegacyIdRequest, type index_d$2_GetLabelByLegacyIdResponse as GetLabelByLegacyIdResponse, type index_d$2_GetLabelOptions as GetLabelOptions, type index_d$2_GetLabelRequest as GetLabelRequest, type index_d$2_GetLabelResponse as GetLabelResponse, type index_d$2_GetLabelResponseNonNullableFields as GetLabelResponseNonNullableFields, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type index_d$2_LabelCreatedEnvelope as LabelCreatedEnvelope, type index_d$2_LabelDeletedEnvelope as LabelDeletedEnvelope, index_d$2_LabelType as LabelType, type index_d$2_LabelUpdatedEnvelope as LabelUpdatedEnvelope, type index_d$2_LabelsQueryBuilder as LabelsQueryBuilder, type index_d$2_LabelsQueryResult as LabelsQueryResult, type index_d$2_LabelsQuotaReached as LabelsQuotaReached, type index_d$2_ListLabelNamespacesRequest as ListLabelNamespacesRequest, type index_d$2_ListLabelNamespacesResponse as ListLabelNamespacesResponse, type index_d$2_ListLabelsRequest as ListLabelsRequest, type index_d$2_ListLabelsResponse as ListLabelsResponse, type MessageEnvelope$2 as MessageEnvelope, type Paging$1 as Paging, type index_d$2_PagingMetadata as PagingMetadata, type index_d$2_PurgeRequest as PurgeRequest, type index_d$2_PurgeResponse as PurgeResponse, type index_d$2_Query as Query, type index_d$2_QueryLabelsOptions as QueryLabelsOptions, type index_d$2_QueryLabelsRequest as QueryLabelsRequest, type index_d$2_QueryLabelsResponse as QueryLabelsResponse, type index_d$2_QueryLabelsResponseNonNullableFields as QueryLabelsResponseNonNullableFields, type index_d$2_RenameLabel as RenameLabel, type index_d$2_RenameLabelOptions as RenameLabelOptions, type index_d$2_RestoreInfo as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, type index_d$2_UpdateLabelRequest as UpdateLabelRequest, type index_d$2_UpdateLabelResponse as UpdateLabelResponse, type index_d$2_UpdateLabelResponseNonNullableFields as UpdateLabelResponseNonNullableFields, WebhookIdentityType$2 as WebhookIdentityType, type index_d$2__publicOnLabelCreatedType as _publicOnLabelCreatedType, type index_d$2__publicOnLabelDeletedType as _publicOnLabelDeletedType, type index_d$2__publicOnLabelUpdatedType as _publicOnLabelUpdatedType, index_d$2_deleteLabel as deleteLabel, index_d$2_findOrCreateLabel as findOrCreateLabel, index_d$2_getLabel as getLabel, index_d$2_onLabelCreated as onLabelCreated, index_d$2_onLabelDeleted as onLabelDeleted, index_d$2_onLabelUpdated as onLabelUpdated, onLabelCreated$1 as publicOnLabelCreated, onLabelDeleted$1 as publicOnLabelDeleted, onLabelUpdated$1 as publicOnLabelUpdated, index_d$2_queryLabels as queryLabels, index_d$2_renameLabel as renameLabel };
4458
4760
  }
4459
4761
 
4460
- type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
4461
- interface HttpClient$1 {
4462
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
4463
- fetchWithAuth: typeof fetch;
4464
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
4465
- }
4466
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
4467
- type HttpResponse$1<T = any> = {
4468
- data: T;
4469
- status: number;
4470
- statusText: string;
4471
- headers: any;
4472
- request?: any;
4473
- };
4474
- type RequestOptions$1<_TResponse = any, Data = any> = {
4475
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
4476
- url: string;
4477
- data?: Data;
4478
- params?: URLSearchParams;
4479
- } & APIMetadata$1;
4480
- type APIMetadata$1 = {
4481
- methodFqn?: string;
4482
- entityFqdn?: string;
4483
- packageName?: string;
4484
- };
4485
- type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
4486
-
4487
- declare global {
4488
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
4489
- interface SymbolConstructor {
4490
- readonly observable: symbol;
4491
- }
4492
- }
4493
-
4494
4762
  /** Dummy message for fqdn validation */
4495
4763
  interface SubmitContact {
4496
4764
  /** Submit Contact Id */
@@ -5079,7 +5347,7 @@ interface AppendOrCreateContactOptions {
5079
5347
  contactId?: string | null;
5080
5348
  }
5081
5349
 
5082
- declare function appendOrCreateContact$1(httpClient: HttpClient$1): AppendOrCreateContactSignature;
5350
+ declare function appendOrCreateContact$1(httpClient: HttpClient): AppendOrCreateContactSignature;
5083
5351
  interface AppendOrCreateContactSignature {
5084
5352
  /**
5085
5353
  * Appends an existing contact or creates a contact if it doesn't exist.
@@ -5090,7 +5358,7 @@ interface AppendOrCreateContactSignature {
5090
5358
  (options?: AppendOrCreateContactOptions | undefined): Promise<SubmitContactResponse & SubmitContactResponseNonNullableFields>;
5091
5359
  }
5092
5360
 
5093
- declare const appendOrCreateContact: BuildRESTFunction$1<typeof appendOrCreateContact$1> & typeof appendOrCreateContact$1;
5361
+ declare const appendOrCreateContact: MaybeContext<BuildRESTFunction<typeof appendOrCreateContact$1> & typeof appendOrCreateContact$1>;
5094
5362
 
5095
5363
  type index_d$1_ActivityIcon = ActivityIcon;
5096
5364
  type index_d$1_Address = Address;
@@ -5143,50 +5411,6 @@ declare namespace index_d$1 {
5143
5411
  export { type index_d$1_ActivityIcon as ActivityIcon, type index_d$1_Address as Address, type index_d$1_AddressLocation as AddressLocation, type index_d$1_AddressStreetOneOf as AddressStreetOneOf, index_d$1_AddressTag as AddressTag, type index_d$1_AppendOrCreateContactOptions as AppendOrCreateContactOptions, type index_d$1_AssigneesWrapper as AssigneesWrapper, type index_d$1_ContactActivity as ContactActivity, index_d$1_ContactActivityType as ContactActivityType, type index_d$1_ContactAddress as ContactAddress, type index_d$1_ContactAddressesWrapper as ContactAddressesWrapper, type index_d$1_ContactEmail as ContactEmail, type index_d$1_ContactEmailsWrapper as ContactEmailsWrapper, type ContactInfo$1 as ContactInfo, type index_d$1_ContactName as ContactName, type index_d$1_ContactPhone as ContactPhone, type index_d$1_ContactPhonesWrapper as ContactPhonesWrapper, type index_d$1_ContactPicture as ContactPicture, index_d$1_ContactSourceType as ContactSourceType, type index_d$1_ContactToSubmit as ContactToSubmit, index_d$1_EmailTag as EmailTag, type index_d$1_ExtendedFieldsWrapper as ExtendedFieldsWrapper, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, index_d$1_IdentityType as IdentityType, index_d$1_ImageProvider as ImageProvider, type index_d$1_LabelsWrapper as LabelsWrapper, type index_d$1_LocationsWrapper as LocationsWrapper, type MessageEnvelope$1 as MessageEnvelope, index_d$1_PhoneTag as PhoneTag, type index_d$1_StreetAddress as StreetAddress, type index_d$1_Subdivision as Subdivision, index_d$1_SubdivisionType as SubdivisionType, type index_d$1_SubmitContact as SubmitContact, type index_d$1_SubmitContactOptions as SubmitContactOptions, type index_d$1_SubmitContactRequest as SubmitContactRequest, type index_d$1_SubmitContactResponse as SubmitContactResponse, type index_d$1_SubmitContactResponseNonNullableFields as SubmitContactResponseNonNullableFields, index_d$1_SubmitOperation as SubmitOperation, type index_d$1_SubmitVisitorIdRequest as SubmitVisitorIdRequest, type index_d$1_SubmitVisitorIdResponse as SubmitVisitorIdResponse, WebhookIdentityType$1 as WebhookIdentityType, index_d$1_appendOrCreateContact as appendOrCreateContact };
5144
5412
  }
5145
5413
 
5146
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
5147
- interface HttpClient {
5148
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
5149
- fetchWithAuth: typeof fetch;
5150
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
5151
- }
5152
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
5153
- type HttpResponse<T = any> = {
5154
- data: T;
5155
- status: number;
5156
- statusText: string;
5157
- headers: any;
5158
- request?: any;
5159
- };
5160
- type RequestOptions<_TResponse = any, Data = any> = {
5161
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
5162
- url: string;
5163
- data?: Data;
5164
- params?: URLSearchParams;
5165
- } & APIMetadata;
5166
- type APIMetadata = {
5167
- methodFqn?: string;
5168
- entityFqdn?: string;
5169
- packageName?: string;
5170
- };
5171
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
5172
- type EventDefinition<Payload = unknown, Type extends string = string> = {
5173
- __type: 'event-definition';
5174
- type: Type;
5175
- isDomainEvent?: boolean;
5176
- transformations?: (envelope: unknown) => Payload;
5177
- __payload: Payload;
5178
- };
5179
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
5180
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
5181
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
5182
-
5183
- declare global {
5184
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5185
- interface SymbolConstructor {
5186
- readonly observable: symbol;
5187
- }
5188
- }
5189
-
5190
5414
  interface Task {
5191
5415
  /**
5192
5416
  * Task ID.
@@ -5921,13 +6145,13 @@ declare const onTaskDeleted$1: EventDefinition<TaskDeletedEnvelope, "wix.crm.tas
5921
6145
 
5922
6146
  declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
5923
6147
 
5924
- declare const createTask: BuildRESTFunction<typeof createTask$1> & typeof createTask$1;
5925
- declare const getTask: BuildRESTFunction<typeof getTask$1> & typeof getTask$1;
5926
- declare const updateTask: BuildRESTFunction<typeof updateTask$1> & typeof updateTask$1;
5927
- declare const deleteTask: BuildRESTFunction<typeof deleteTask$1> & typeof deleteTask$1;
5928
- declare const queryTasks: BuildRESTFunction<typeof queryTasks$1> & typeof queryTasks$1;
5929
- declare const countTasks: BuildRESTFunction<typeof countTasks$1> & typeof countTasks$1;
5930
- declare const moveTaskAfter: BuildRESTFunction<typeof moveTaskAfter$1> & typeof moveTaskAfter$1;
6148
+ declare const createTask: MaybeContext<BuildRESTFunction<typeof createTask$1> & typeof createTask$1>;
6149
+ declare const getTask: MaybeContext<BuildRESTFunction<typeof getTask$1> & typeof getTask$1>;
6150
+ declare const updateTask: MaybeContext<BuildRESTFunction<typeof updateTask$1> & typeof updateTask$1>;
6151
+ declare const deleteTask: MaybeContext<BuildRESTFunction<typeof deleteTask$1> & typeof deleteTask$1>;
6152
+ declare const queryTasks: MaybeContext<BuildRESTFunction<typeof queryTasks$1> & typeof queryTasks$1>;
6153
+ declare const countTasks: MaybeContext<BuildRESTFunction<typeof countTasks$1> & typeof countTasks$1>;
6154
+ declare const moveTaskAfter: MaybeContext<BuildRESTFunction<typeof moveTaskAfter$1> & typeof moveTaskAfter$1>;
5931
6155
 
5932
6156
  type _publicOnTaskOverdueType = typeof onTaskOverdue$1;
5933
6157
  /**