@wix/crm 1.0.133 → 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,9 +1,9 @@
1
- type HostModule$5<T, H extends Host$5> = {
1
+ type HostModule<T, H extends Host> = {
2
2
  __type: 'host';
3
3
  create(host: H): T;
4
4
  };
5
- type HostModuleAPI$5<T extends HostModule$5<any, any>> = T extends HostModule$5<infer U, any> ? U : never;
6
- type Host$5<Environment = unknown> = {
5
+ type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
+ type Host<Environment = unknown> = {
7
7
  channel: {
8
8
  observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
9
  disconnect: () => void;
@@ -40,92 +40,92 @@ type Host$5<Environment = unknown> = {
40
40
  };
41
41
  };
42
42
 
43
- type RESTFunctionDescriptor$5<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$5) => T;
44
- interface HttpClient$5 {
45
- request<TResponse, TData = any>(req: RequestOptionsFactory$5<TResponse, TData>): Promise<HttpResponse$5<TResponse>>;
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>>;
46
46
  fetchWithAuth: typeof fetch;
47
47
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
48
  getActiveToken?: () => string | undefined;
49
49
  }
50
- type RequestOptionsFactory$5<TResponse = any, TData = any> = (context: any) => RequestOptions$5<TResponse, TData>;
51
- type HttpResponse$5<T = any> = {
50
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
+ type HttpResponse<T = any> = {
52
52
  data: T;
53
53
  status: number;
54
54
  statusText: string;
55
55
  headers: any;
56
56
  request?: any;
57
57
  };
58
- type RequestOptions$5<_TResponse = any, Data = any> = {
58
+ type RequestOptions<_TResponse = any, Data = any> = {
59
59
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
60
60
  url: string;
61
61
  data?: Data;
62
62
  params?: URLSearchParams;
63
- } & APIMetadata$5;
64
- type APIMetadata$5 = {
63
+ } & APIMetadata;
64
+ type APIMetadata = {
65
65
  methodFqn?: string;
66
66
  entityFqdn?: string;
67
67
  packageName?: string;
68
68
  };
69
- type BuildRESTFunction$5<T extends RESTFunctionDescriptor$5> = T extends RESTFunctionDescriptor$5<infer U> ? U : never;
70
- type EventDefinition$5<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> = {
71
71
  __type: 'event-definition';
72
72
  type: Type;
73
73
  isDomainEvent?: boolean;
74
74
  transformations?: (envelope: unknown) => Payload;
75
75
  __payload: Payload;
76
76
  };
77
- declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
78
- type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
79
- type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<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
80
 
81
- type ServicePluginMethodInput$5 = {
81
+ type ServicePluginMethodInput = {
82
82
  request: any;
83
83
  metadata: any;
84
84
  };
85
- type ServicePluginContract$5 = Record<string, (payload: ServicePluginMethodInput$5) => unknown | Promise<unknown>>;
86
- type ServicePluginMethodMetadata$5 = {
85
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
+ type ServicePluginMethodMetadata = {
87
87
  name: string;
88
88
  primaryHttpMappingPath: string;
89
89
  transformations: {
90
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$5;
90
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
91
91
  toREST: (...args: unknown[]) => unknown;
92
92
  };
93
93
  };
94
- type ServicePluginDefinition$5<Contract extends ServicePluginContract$5> = {
94
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
95
95
  __type: 'service-plugin-definition';
96
96
  componentType: string;
97
- methods: ServicePluginMethodMetadata$5[];
97
+ methods: ServicePluginMethodMetadata[];
98
98
  __contract: Contract;
99
99
  };
100
- declare function ServicePluginDefinition$5<Contract extends ServicePluginContract$5>(componentType: string, methods: ServicePluginMethodMetadata$5[]): ServicePluginDefinition$5<Contract>;
101
- type BuildServicePluginDefinition$5<T extends ServicePluginDefinition$5<any>> = (implementation: T['__contract']) => void;
102
- declare const SERVICE_PLUGIN_ERROR_TYPE$5 = "wix_spi_error";
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
103
 
104
- type RequestContext$5 = {
104
+ type RequestContext = {
105
105
  isSSR: boolean;
106
106
  host: string;
107
107
  protocol?: string;
108
108
  };
109
- type ResponseTransformer$5 = (data: any, headers?: any) => any;
109
+ type ResponseTransformer = (data: any, headers?: any) => any;
110
110
  /**
111
111
  * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
112
  * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
113
  * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
114
  */
115
- type Method$5 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
- type AmbassadorRequestOptions$5<T = any> = {
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
117
  _?: T;
118
118
  url?: string;
119
- method?: Method$5;
119
+ method?: Method;
120
120
  params?: any;
121
121
  data?: any;
122
- transformResponse?: ResponseTransformer$5 | ResponseTransformer$5[];
122
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
123
123
  };
124
- type AmbassadorFactory$5<Request, Response> = (payload: Request) => ((context: RequestContext$5) => AmbassadorRequestOptions$5<Response>) & {
124
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
125
125
  __isAmbassador: boolean;
126
126
  };
127
- type AmbassadorFunctionDescriptor$5<Request = any, Response = any> = AmbassadorFactory$5<Request, Response>;
128
- type BuildAmbassadorFunction$5<T extends AmbassadorFunctionDescriptor$5> = T extends AmbassadorFunctionDescriptor$5<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
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;
129
129
 
130
130
  declare global {
131
131
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -134,7 +134,7 @@ declare global {
134
134
  }
135
135
  }
136
136
 
137
- declare const emptyObjectSymbol$5: unique symbol;
137
+ declare const emptyObjectSymbol: unique symbol;
138
138
 
139
139
  /**
140
140
  Represents a strictly empty plain object, the `{}` value.
@@ -162,7 +162,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
162
162
 
163
163
  @category Object
164
164
  */
165
- type EmptyObject$5 = {[emptyObjectSymbol$5]?: never};
165
+ type EmptyObject = {[emptyObjectSymbol]?: never};
166
166
 
167
167
  /**
168
168
  Returns a boolean for whether the two given types are equal.
@@ -190,7 +190,7 @@ type Includes<Value extends readonly any[], Item> =
190
190
  @category Type Guard
191
191
  @category Utilities
192
192
  */
193
- type IsEqual$5<A, B> =
193
+ type IsEqual<A, B> =
194
194
  (<G>() => G extends A ? 1 : 2) extends
195
195
  (<G>() => G extends B ? 1 : 2)
196
196
  ? true
@@ -223,9 +223,9 @@ type Filtered = Filter<'bar', 'foo'>;
223
223
 
224
224
  @see {Except}
225
225
  */
226
- type Filter$5<KeyType, ExcludeType> = IsEqual$5<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
226
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
227
 
228
- type ExceptOptions$5 = {
228
+ type ExceptOptions = {
229
229
  /**
230
230
  Disallow assigning non-specified properties.
231
231
 
@@ -269,8 +269,8 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
269
269
 
270
270
  @category Object
271
271
  */
272
- type Except$5<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$5 = {requireExactProps: false}> = {
273
- [KeyType in keyof ObjectType as Filter$5<KeyType, KeysType>]: ObjectType[KeyType];
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
274
  } & (Options['requireExactProps'] extends true
275
275
  ? Partial<Record<KeysType, never>>
276
276
  : {});
@@ -316,7 +316,7 @@ endIfEqual('abc', '123');
316
316
  @category Type Guard
317
317
  @category Utilities
318
318
  */
319
- type IsNever$5<T> = [T] extends [never] ? true : false;
319
+ type IsNever<T> = [T] extends [never] ? true : false;
320
320
 
321
321
  /**
322
322
  An if-else-like type that resolves depending on whether the given type is `never`.
@@ -337,8 +337,8 @@ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
337
337
  @category Type Guard
338
338
  @category Utilities
339
339
  */
340
- type IfNever$5<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
- IsNever$5<T> extends true ? TypeIfNever : TypeIfNotNever
340
+ type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
+ IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
342
  );
343
343
 
344
344
  /**
@@ -373,7 +373,7 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
373
373
 
374
374
  @category Object
375
375
  */
376
- type ConditionalKeys$5<Base, Condition> =
376
+ type ConditionalKeys<Base, Condition> =
377
377
  {
378
378
  // Map through all the keys of the given base type.
379
379
  [Key in keyof Base]-?:
@@ -381,7 +381,7 @@ type ConditionalKeys$5<Base, Condition> =
381
381
  Base[Key] extends Condition
382
382
  // Retain this key
383
383
  // If the value for the key extends never, only include it if `Condition` also extends never
384
- ? IfNever$5<Base[Key], IfNever$5<Condition, Key, never>, Key>
384
+ ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
385
385
  // Discard this key since the condition fails.
386
386
  : never;
387
387
  // Convert the produced object into a union type of the keys which passed the conditional test.
@@ -425,9 +425,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
425
425
 
426
426
  @category Object
427
427
  */
428
- type ConditionalExcept$5<Base, Condition> = Except$5<
428
+ type ConditionalExcept<Base, Condition> = Except<
429
429
  Base,
430
- ConditionalKeys$5<Base, Condition>
430
+ ConditionalKeys<Base, Condition>
431
431
  >;
432
432
 
433
433
  /**
@@ -435,8 +435,8 @@ ConditionalKeys$5<Base, Condition>
435
435
  * can either be a REST module or a host module.
436
436
  * This type is recursive, so it can describe nested modules.
437
437
  */
438
- type Descriptors$5 = RESTFunctionDescriptor$5 | AmbassadorFunctionDescriptor$5 | HostModule$5<any, any> | EventDefinition$5<any> | ServicePluginDefinition$5<any> | {
439
- [key: string]: Descriptors$5 | PublicMetadata$5 | any;
438
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
+ [key: string]: Descriptors | PublicMetadata | any;
440
440
  };
441
441
  /**
442
442
  * This type takes in a descriptors object of a certain Host (including an `unknown` host)
@@ -444,12 +444,12 @@ type Descriptors$5 = RESTFunctionDescriptor$5 | AmbassadorFunctionDescriptor$5 |
444
444
  * Any non-descriptor properties are removed from the returned object, including descriptors that
445
445
  * do not match the given host (as they will not work with the given host).
446
446
  */
447
- type BuildDescriptors$5<T extends Descriptors$5, H extends Host$5<any> | undefined, Depth extends number = 5> = {
447
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
448
448
  done: T;
449
449
  recurse: T extends {
450
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$5;
451
- } ? never : T extends AmbassadorFunctionDescriptor$5 ? BuildAmbassadorFunction$5<T> : T extends RESTFunctionDescriptor$5 ? BuildRESTFunction$5<T> : T extends EventDefinition$5<any> ? BuildEventDefinition$5<T> : T extends ServicePluginDefinition$5<any> ? BuildServicePluginDefinition$5<T> : T extends HostModule$5<any, any> ? HostModuleAPI$5<T> : ConditionalExcept$5<{
452
- [Key in keyof T]: T[Key] extends Descriptors$5 ? BuildDescriptors$5<T[Key], H, [
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
453
  -1,
454
454
  0,
455
455
  1,
@@ -458,9 +458,9 @@ type BuildDescriptors$5<T extends Descriptors$5, H extends Host$5<any> | undefin
458
458
  4,
459
459
  5
460
460
  ][Depth]> : never;
461
- }, EmptyObject$5>;
461
+ }, EmptyObject>;
462
462
  }[Depth extends -1 ? 'done' : 'recurse'];
463
- type PublicMetadata$5 = {
463
+ type PublicMetadata = {
464
464
  PACKAGE_NAME?: string;
465
465
  };
466
466
 
@@ -472,9 +472,9 @@ declare global {
472
472
  * A type used to create concerete types from SDK descriptors in
473
473
  * case a contextual client is available.
474
474
  */
475
- type MaybeContext$5<T extends Descriptors$5> = globalThis.ContextualClient extends {
476
- host: Host$5;
477
- } ? BuildDescriptors$5<T, globalThis.ContextualClient['host']> : T;
475
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
+ host: Host;
477
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
478
478
 
479
479
  interface ContactAttachment extends ContactAttachmentMediaOneOf {
480
480
  /** The attachment's image (if the attachment is of type IMAGE) */
@@ -854,7 +854,7 @@ interface GetAttachmentIdentifiers {
854
854
  attachmentId: string;
855
855
  }
856
856
 
857
- declare function generateAttachmentUploadUrl$1(httpClient: HttpClient$5): GenerateAttachmentUploadUrlSignature;
857
+ declare function generateAttachmentUploadUrl$1(httpClient: HttpClient): GenerateAttachmentUploadUrlSignature;
858
858
  interface GenerateAttachmentUploadUrlSignature {
859
859
  /**
860
860
  * Generates an upload URL to allow external clients to upload a file as an attachment to a given contact.
@@ -866,7 +866,7 @@ interface GenerateAttachmentUploadUrlSignature {
866
866
  */
867
867
  (contactId: string, fileName: string, options: GenerateAttachmentUploadUrlOptions): Promise<GenerateAttachmentUploadUrlResponse & GenerateAttachmentUploadUrlResponseNonNullableFields>;
868
868
  }
869
- declare function listAttachments$1(httpClient: HttpClient$5): ListAttachmentsSignature;
869
+ declare function listAttachments$1(httpClient: HttpClient): ListAttachmentsSignature;
870
870
  interface ListAttachmentsSignature {
871
871
  /**
872
872
  * List Attachments.
@@ -874,14 +874,14 @@ interface ListAttachmentsSignature {
874
874
  */
875
875
  (contactId: string, options?: ListAttachmentsOptions | undefined): Promise<ListAttachmentsResponse & ListAttachmentsResponseNonNullableFields>;
876
876
  }
877
- declare function deleteAttachment$1(httpClient: HttpClient$5): DeleteAttachmentSignature;
877
+ declare function deleteAttachment$1(httpClient: HttpClient): DeleteAttachmentSignature;
878
878
  interface DeleteAttachmentSignature {
879
879
  /**
880
880
  * Deletes an attachment from contact
881
881
  */
882
882
  (identifiers: DeleteAttachmentIdentifiers): Promise<void>;
883
883
  }
884
- declare function getAttachment$1(httpClient: HttpClient$5): GetAttachmentSignature;
884
+ declare function getAttachment$1(httpClient: HttpClient): GetAttachmentSignature;
885
885
  interface GetAttachmentSignature {
886
886
  /**
887
887
  * Retrieves an attachment.
@@ -889,15 +889,15 @@ interface GetAttachmentSignature {
889
889
  */
890
890
  (identifiers: GetAttachmentIdentifiers): Promise<ContactAttachment & ContactAttachmentNonNullableFields>;
891
891
  }
892
- declare const onAttachmentCreated$1: EventDefinition$5<AttachmentCreatedEnvelope, "wix.contacts.v4.attachment_created">;
893
- declare const onAttachmentDeleted$1: EventDefinition$5<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">;
894
894
 
895
- declare function createEventModule$4<T extends EventDefinition$5<any, string>>(eventDefinition: T): BuildEventDefinition$5<T> & T;
895
+ declare function createEventModule$4<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
896
896
 
897
- declare const generateAttachmentUploadUrl: MaybeContext$5<BuildRESTFunction$5<typeof generateAttachmentUploadUrl$1> & typeof generateAttachmentUploadUrl$1>;
898
- declare const listAttachments: MaybeContext$5<BuildRESTFunction$5<typeof listAttachments$1> & typeof listAttachments$1>;
899
- declare const deleteAttachment: MaybeContext$5<BuildRESTFunction$5<typeof deleteAttachment$1> & typeof deleteAttachment$1>;
900
- declare const getAttachment: MaybeContext$5<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>;
901
901
 
902
902
  type _publicOnAttachmentCreatedType = typeof onAttachmentCreated$1;
903
903
  /**
@@ -958,565 +958,87 @@ declare namespace context$5 {
958
958
  export { type ActionEvent$4 as ActionEvent, type context$5_AttachmentCreatedEnvelope as AttachmentCreatedEnvelope, type context$5_AttachmentDeletedEnvelope as AttachmentDeletedEnvelope, type context$5_AttachmentMedia as AttachmentMedia, type context$5_AttachmentMediaMediaOneOf as AttachmentMediaMediaOneOf, type context$5_AttachmentMetadata as AttachmentMetadata, type context$5_AttachmentSource as AttachmentSource, context$5_AttachmentType as AttachmentType, type BaseEventMetadata$4 as BaseEventMetadata, type context$5_ContactAttachment as ContactAttachment, type context$5_ContactAttachmentMediaOneOf as ContactAttachmentMediaOneOf, type context$5_ContactAttachmentNonNullableFields as ContactAttachmentNonNullableFields, type context$5_CreateDemoAttachmentRequest as CreateDemoAttachmentRequest, type context$5_CreateDemoAttachmentResponse as CreateDemoAttachmentResponse, type context$5_CrmAttachment as CrmAttachment, context$5_CrmAttachmentAttachmentType as CrmAttachmentAttachmentType, type context$5_CrmAttachmentUploadedEvent as CrmAttachmentUploadedEvent, type context$5_DeleteAttachmentIdentifiers as DeleteAttachmentIdentifiers, type context$5_DeleteAttachmentRequest as DeleteAttachmentRequest, type context$5_DeleteAttachmentResponse as DeleteAttachmentResponse, context$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 context$5_GenerateAttachmentUploadUrlOptions as GenerateAttachmentUploadUrlOptions, type context$5_GenerateAttachmentUploadUrlRequest as GenerateAttachmentUploadUrlRequest, type context$5_GenerateAttachmentUploadUrlResponse as GenerateAttachmentUploadUrlResponse, type context$5_GenerateAttachmentUploadUrlResponseNonNullableFields as GenerateAttachmentUploadUrlResponseNonNullableFields, type context$5_GetAttachmentIdentifiers as GetAttachmentIdentifiers, type context$5_GetAttachmentRequest as GetAttachmentRequest, type context$5_GetAttachmentResponse as GetAttachmentResponse, type context$5_GetAttachmentResponseNonNullableFields as GetAttachmentResponseNonNullableFields, type IdentificationData$5 as IdentificationData, type IdentificationDataIdOneOf$5 as IdentificationDataIdOneOf, type context$5_ListAttachmentsOptions as ListAttachmentsOptions, type context$5_ListAttachmentsRequest as ListAttachmentsRequest, type context$5_ListAttachmentsResponse as ListAttachmentsResponse, type context$5_ListAttachmentsResponseNonNullableFields as ListAttachmentsResponseNonNullableFields, type context$5_MediaFileUploadedEvent as MediaFileUploadedEvent, type MessageEnvelope$5 as MessageEnvelope, type Paging$4 as Paging, type PagingMetadata$3 as PagingMetadata, WebhookIdentityType$5 as WebhookIdentityType, type context$5__publicOnAttachmentCreatedType as _publicOnAttachmentCreatedType, type context$5__publicOnAttachmentDeletedType as _publicOnAttachmentDeletedType, context$5_deleteAttachment as deleteAttachment, context$5_generateAttachmentUploadUrl as generateAttachmentUploadUrl, context$5_getAttachment as getAttachment, context$5_listAttachments as listAttachments, context$5_onAttachmentCreated as onAttachmentCreated, context$5_onAttachmentDeleted as onAttachmentDeleted, onAttachmentCreated$1 as publicOnAttachmentCreated, onAttachmentDeleted$1 as publicOnAttachmentDeleted };
959
959
  }
960
960
 
961
- type HostModule$4<T, H extends Host$4> = {
962
- __type: 'host';
963
- create(host: H): T;
964
- };
965
- type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
966
- type Host$4<Environment = unknown> = {
967
- channel: {
968
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
969
- disconnect: () => void;
970
- } | Promise<{
971
- disconnect: () => void;
972
- }>;
973
- };
974
- environment?: Environment;
961
+ interface Contact {
975
962
  /**
976
- * Optional name of the environment, use for logging
963
+ * Contact ID.
964
+ * @readonly
977
965
  */
978
- name?: string;
966
+ _id?: string;
979
967
  /**
980
- * Optional bast url to use for API requests, for example `www.wixapis.com`
968
+ * Revision number, which increments by 1 each time the contact is updated.
969
+ * To prevent conflicting changes,
970
+ * the existing `revision` must be used when updating a contact.
971
+ * @readonly
981
972
  */
982
- apiBaseUrl?: string;
973
+ revision?: number;
983
974
  /**
984
- * Possible data to be provided by every host, for cross cutting concerns
985
- * like internationalization, billing, etc.
975
+ * Details about the contact's source.
976
+ * @readonly
986
977
  */
987
- essentials?: {
988
- /**
989
- * The language of the currently viewed session
990
- */
991
- language?: string;
992
- /**
993
- * The locale of the currently viewed session
994
- */
995
- locale?: string;
996
- /**
997
- * Any headers that should be passed through to the API requests
998
- */
999
- passThroughHeaders?: Record<string, string>;
1000
- };
1001
- };
1002
-
1003
- type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
1004
- interface HttpClient$4 {
1005
- request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
1006
- fetchWithAuth: typeof fetch;
1007
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
1008
- getActiveToken?: () => string | undefined;
978
+ source?: ContactSource;
979
+ /**
980
+ * Date and time the contact was created.
981
+ * @readonly
982
+ */
983
+ _createdDate?: Date;
984
+ /**
985
+ * Date and time the contact was last updated.
986
+ * @readonly
987
+ */
988
+ _updatedDate?: Date;
989
+ /**
990
+ * Details about the contact's last action in the site.
991
+ * @readonly
992
+ */
993
+ lastActivity?: ContactActivity$1;
994
+ /**
995
+ * Contact's primary phone and email.
996
+ *
997
+ * This property reflects the email address in `contactInfo.emails` where `primary` is `true`.
998
+ * @readonly
999
+ */
1000
+ primaryInfo?: PrimaryContactInfo;
1001
+ /** Contact's details. */
1002
+ info?: ContactInfo$2;
1009
1003
  }
1010
- type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
1011
- type HttpResponse$4<T = any> = {
1012
- data: T;
1013
- status: number;
1014
- statusText: string;
1015
- headers: any;
1016
- request?: any;
1017
- };
1018
- type RequestOptions$4<_TResponse = any, Data = any> = {
1019
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1020
- url: string;
1021
- data?: Data;
1022
- params?: URLSearchParams;
1023
- } & APIMetadata$4;
1024
- type APIMetadata$4 = {
1025
- methodFqn?: string;
1026
- entityFqdn?: string;
1027
- packageName?: string;
1028
- };
1029
- type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
1030
- type EventDefinition$4<Payload = unknown, Type extends string = string> = {
1031
- __type: 'event-definition';
1032
- type: Type;
1033
- isDomainEvent?: boolean;
1034
- transformations?: (envelope: unknown) => Payload;
1035
- __payload: Payload;
1036
- };
1037
- declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
1038
- type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
1039
- type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
1040
-
1041
- type ServicePluginMethodInput$4 = {
1042
- request: any;
1043
- metadata: any;
1044
- };
1045
- type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
1046
- type ServicePluginMethodMetadata$4 = {
1047
- name: string;
1048
- primaryHttpMappingPath: string;
1049
- transformations: {
1050
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
1051
- toREST: (...args: unknown[]) => unknown;
1052
- };
1053
- };
1054
- type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
1055
- __type: 'service-plugin-definition';
1056
- componentType: string;
1057
- methods: ServicePluginMethodMetadata$4[];
1058
- __contract: Contract;
1059
- };
1060
- declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
1061
- type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
1062
- declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
1063
-
1064
- type RequestContext$4 = {
1065
- isSSR: boolean;
1066
- host: string;
1067
- protocol?: string;
1068
- };
1069
- type ResponseTransformer$4 = (data: any, headers?: any) => any;
1070
- /**
1071
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
1072
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
1073
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
1074
- */
1075
- type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
1076
- type AmbassadorRequestOptions$4<T = any> = {
1077
- _?: T;
1078
- url?: string;
1079
- method?: Method$4;
1080
- params?: any;
1081
- data?: any;
1082
- transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
1083
- };
1084
- type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
1085
- __isAmbassador: boolean;
1086
- };
1087
- type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
1088
- type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
1089
-
1090
- declare global {
1091
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1092
- interface SymbolConstructor {
1093
- readonly observable: symbol;
1094
- }
1004
+ interface ContactSource {
1005
+ /**
1006
+ * Source type.
1007
+ * @readonly
1008
+ */
1009
+ sourceType?: ContactSourceType$1;
1010
+ /**
1011
+ * App ID, if the contact was created by an app.
1012
+ * @readonly
1013
+ */
1014
+ appId?: string | null;
1095
1015
  }
1096
-
1097
- declare const emptyObjectSymbol$4: unique symbol;
1098
-
1099
- /**
1100
- Represents a strictly empty plain object, the `{}` value.
1101
-
1102
- 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)).
1103
-
1104
- @example
1105
- ```
1106
- import type {EmptyObject} from 'type-fest';
1107
-
1108
- // The following illustrates the problem with `{}`.
1109
- const foo1: {} = {}; // Pass
1110
- const foo2: {} = []; // Pass
1111
- const foo3: {} = 42; // Pass
1112
- const foo4: {} = {a: 1}; // Pass
1113
-
1114
- // With `EmptyObject` only the first case is valid.
1115
- const bar1: EmptyObject = {}; // Pass
1116
- const bar2: EmptyObject = 42; // Fail
1117
- const bar3: EmptyObject = []; // Fail
1118
- const bar4: EmptyObject = {a: 1}; // Fail
1119
- ```
1120
-
1121
- 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}.
1122
-
1123
- @category Object
1124
- */
1125
- type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
1126
-
1127
- /**
1128
- Returns a boolean for whether the two given types are equal.
1129
-
1130
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
1131
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
1132
-
1133
- Use-cases:
1134
- - If you want to make a conditional branch based on the result of a comparison of two types.
1135
-
1136
- @example
1137
- ```
1138
- import type {IsEqual} from 'type-fest';
1139
-
1140
- // This type returns a boolean for whether the given array includes the given item.
1141
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
1142
- type Includes<Value extends readonly any[], Item> =
1143
- Value extends readonly [Value[0], ...infer rest]
1144
- ? IsEqual<Value[0], Item> extends true
1145
- ? true
1146
- : Includes<rest, Item>
1147
- : false;
1148
- ```
1149
-
1150
- @category Type Guard
1151
- @category Utilities
1152
- */
1153
- type IsEqual$4<A, B> =
1154
- (<G>() => G extends A ? 1 : 2) extends
1155
- (<G>() => G extends B ? 1 : 2)
1156
- ? true
1157
- : false;
1158
-
1159
- /**
1160
- Filter out keys from an object.
1161
-
1162
- Returns `never` if `Exclude` is strictly equal to `Key`.
1163
- Returns `never` if `Key` extends `Exclude`.
1164
- Returns `Key` otherwise.
1165
-
1166
- @example
1167
- ```
1168
- type Filtered = Filter<'foo', 'foo'>;
1169
- //=> never
1170
- ```
1171
-
1172
- @example
1173
- ```
1174
- type Filtered = Filter<'bar', string>;
1175
- //=> never
1176
- ```
1177
-
1178
- @example
1179
- ```
1180
- type Filtered = Filter<'bar', 'foo'>;
1181
- //=> 'bar'
1182
- ```
1183
-
1184
- @see {Except}
1185
- */
1186
- type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1187
-
1188
- type ExceptOptions$4 = {
1189
- /**
1190
- Disallow assigning non-specified properties.
1191
-
1192
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1193
-
1194
- @default false
1195
- */
1196
- requireExactProps?: boolean;
1197
- };
1198
-
1199
- /**
1200
- Create a type from an object type without certain keys.
1201
-
1202
- We recommend setting the `requireExactProps` option to `true`.
1203
-
1204
- 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.
1205
-
1206
- 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)).
1207
-
1208
- @example
1209
- ```
1210
- import type {Except} from 'type-fest';
1211
-
1212
- type Foo = {
1213
- a: number;
1214
- b: string;
1215
- };
1216
-
1217
- type FooWithoutA = Except<Foo, 'a'>;
1218
- //=> {b: string}
1219
-
1220
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1221
- //=> errors: 'a' does not exist in type '{ b: string; }'
1222
-
1223
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1224
- //=> {a: number} & Partial<Record<"b", never>>
1225
-
1226
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1227
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1228
- ```
1229
-
1230
- @category Object
1231
- */
1232
- type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
1233
- [KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
1234
- } & (Options['requireExactProps'] extends true
1235
- ? Partial<Record<KeysType, never>>
1236
- : {});
1237
-
1238
- /**
1239
- Returns a boolean for whether the given type is `never`.
1240
-
1241
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
1242
- @link https://stackoverflow.com/a/53984913/10292952
1243
- @link https://www.zhenghao.io/posts/ts-never
1244
-
1245
- Useful in type utilities, such as checking if something does not occur.
1246
-
1247
- @example
1248
- ```
1249
- import type {IsNever, And} from 'type-fest';
1250
-
1251
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
1252
- type AreStringsEqual<A extends string, B extends string> =
1253
- And<
1254
- IsNever<Exclude<A, B>> extends true ? true : false,
1255
- IsNever<Exclude<B, A>> extends true ? true : false
1256
- >;
1257
-
1258
- type EndIfEqual<I extends string, O extends string> =
1259
- AreStringsEqual<I, O> extends true
1260
- ? never
1261
- : void;
1262
-
1263
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
1264
- if (input === output) {
1265
- process.exit(0);
1266
- }
1267
- }
1268
-
1269
- endIfEqual('abc', 'abc');
1270
- //=> never
1271
-
1272
- endIfEqual('abc', '123');
1273
- //=> void
1274
- ```
1275
-
1276
- @category Type Guard
1277
- @category Utilities
1278
- */
1279
- type IsNever$4<T> = [T] extends [never] ? true : false;
1280
-
1281
- /**
1282
- An if-else-like type that resolves depending on whether the given type is `never`.
1283
-
1284
- @see {@link IsNever}
1285
-
1286
- @example
1287
- ```
1288
- import type {IfNever} from 'type-fest';
1289
-
1290
- type ShouldBeTrue = IfNever<never>;
1291
- //=> true
1292
-
1293
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
1294
- //=> 'bar'
1295
- ```
1296
-
1297
- @category Type Guard
1298
- @category Utilities
1299
- */
1300
- type IfNever$4<T, TypeIfNever = true, TypeIfNotNever = false> = (
1301
- IsNever$4<T> extends true ? TypeIfNever : TypeIfNotNever
1302
- );
1303
-
1304
- /**
1305
- Extract the keys from a type where the value type of the key extends the given `Condition`.
1306
-
1307
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1308
-
1309
- @example
1310
- ```
1311
- import type {ConditionalKeys} from 'type-fest';
1312
-
1313
- interface Example {
1314
- a: string;
1315
- b: string | number;
1316
- c?: string;
1317
- d: {};
1318
- }
1319
-
1320
- type StringKeysOnly = ConditionalKeys<Example, string>;
1321
- //=> 'a'
1322
- ```
1323
-
1324
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1325
-
1326
- @example
1327
- ```
1328
- import type {ConditionalKeys} from 'type-fest';
1329
-
1330
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1331
- //=> 'a' | 'c'
1332
- ```
1333
-
1334
- @category Object
1335
- */
1336
- type ConditionalKeys$4<Base, Condition> =
1337
- {
1338
- // Map through all the keys of the given base type.
1339
- [Key in keyof Base]-?:
1340
- // Pick only keys with types extending the given `Condition` type.
1341
- Base[Key] extends Condition
1342
- // Retain this key
1343
- // If the value for the key extends never, only include it if `Condition` also extends never
1344
- ? IfNever$4<Base[Key], IfNever$4<Condition, Key, never>, Key>
1345
- // Discard this key since the condition fails.
1346
- : never;
1347
- // Convert the produced object into a union type of the keys which passed the conditional test.
1348
- }[keyof Base];
1349
-
1350
- /**
1351
- Exclude keys from a shape that matches the given `Condition`.
1352
-
1353
- 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.
1354
-
1355
- @example
1356
- ```
1357
- import type {Primitive, ConditionalExcept} from 'type-fest';
1358
-
1359
- class Awesome {
1360
- name: string;
1361
- successes: number;
1362
- failures: bigint;
1363
-
1364
- run() {}
1016
+ declare enum ContactSourceType$1 {
1017
+ OTHER = "OTHER",
1018
+ ADMIN = "ADMIN",
1019
+ WIX_APP = "WIX_APP",
1020
+ IMPORT = "IMPORT",
1021
+ THIRD_PARTY = "THIRD_PARTY",
1022
+ WIX_BOOKINGS = "WIX_BOOKINGS",
1023
+ WIX_CHAT = "WIX_CHAT",
1024
+ WIX_EMAIL_MARKETING = "WIX_EMAIL_MARKETING",
1025
+ WIX_EVENTS = "WIX_EVENTS",
1026
+ WIX_FORMS = "WIX_FORMS",
1027
+ WIX_GROUPS = "WIX_GROUPS",
1028
+ WIX_HOTELS = "WIX_HOTELS",
1029
+ WIX_MARKET_PLACE = "WIX_MARKET_PLACE",
1030
+ WIX_MUSIC = "WIX_MUSIC",
1031
+ WIX_RESTAURANTS = "WIX_RESTAURANTS",
1032
+ WIX_SITE_MEMBERS = "WIX_SITE_MEMBERS",
1033
+ WIX_STORES = "WIX_STORES",
1034
+ WIX_CODE = "WIX_CODE",
1035
+ HOPP = "HOPP"
1365
1036
  }
1366
-
1367
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1368
- //=> {run: () => void}
1369
- ```
1370
-
1371
- @example
1372
- ```
1373
- import type {ConditionalExcept} from 'type-fest';
1374
-
1375
- interface Example {
1376
- a: string;
1377
- b: string | number;
1378
- c: () => void;
1379
- d: {};
1380
- }
1381
-
1382
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
1383
- //=> {b: string | number; c: () => void; d: {}}
1384
- ```
1385
-
1386
- @category Object
1387
- */
1388
- type ConditionalExcept$4<Base, Condition> = Except$4<
1389
- Base,
1390
- ConditionalKeys$4<Base, Condition>
1391
- >;
1392
-
1393
- /**
1394
- * Descriptors are objects that describe the API of a module, and the module
1395
- * can either be a REST module or a host module.
1396
- * This type is recursive, so it can describe nested modules.
1397
- */
1398
- type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$4<any> | ServicePluginDefinition$4<any> | {
1399
- [key: string]: Descriptors$4 | PublicMetadata$4 | any;
1400
- };
1401
- /**
1402
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1403
- * and returns an object with the same structure, but with all descriptors replaced with their API.
1404
- * Any non-descriptor properties are removed from the returned object, including descriptors that
1405
- * do not match the given host (as they will not work with the given host).
1406
- */
1407
- type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
1408
- done: T;
1409
- recurse: T extends {
1410
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
1411
- } ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
1412
- [Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
1413
- -1,
1414
- 0,
1415
- 1,
1416
- 2,
1417
- 3,
1418
- 4,
1419
- 5
1420
- ][Depth]> : never;
1421
- }, EmptyObject$4>;
1422
- }[Depth extends -1 ? 'done' : 'recurse'];
1423
- type PublicMetadata$4 = {
1424
- PACKAGE_NAME?: string;
1425
- };
1426
-
1427
- declare global {
1428
- interface ContextualClient {
1429
- }
1430
- }
1431
- /**
1432
- * A type used to create concerete types from SDK descriptors in
1433
- * case a contextual client is available.
1434
- */
1435
- type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
1436
- host: Host$4;
1437
- } ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
1438
-
1439
- interface Contact {
1440
- /**
1441
- * Contact ID.
1442
- * @readonly
1443
- */
1444
- _id?: string;
1445
- /**
1446
- * Revision number, which increments by 1 each time the contact is updated.
1447
- * To prevent conflicting changes,
1448
- * the existing `revision` must be used when updating a contact.
1449
- * @readonly
1450
- */
1451
- revision?: number;
1452
- /**
1453
- * Details about the contact's source.
1454
- * @readonly
1455
- */
1456
- source?: ContactSource;
1457
- /**
1458
- * Date and time the contact was created.
1459
- * @readonly
1460
- */
1461
- _createdDate?: Date;
1462
- /**
1463
- * Date and time the contact was last updated.
1464
- * @readonly
1465
- */
1466
- _updatedDate?: Date;
1467
- /**
1468
- * Details about the contact's last action in the site.
1469
- * @readonly
1470
- */
1471
- lastActivity?: ContactActivity$1;
1472
- /**
1473
- * Contact's primary phone and email.
1474
- *
1475
- * This property reflects the email address in `contactInfo.emails` where `primary` is `true`.
1476
- * @readonly
1477
- */
1478
- primaryInfo?: PrimaryContactInfo;
1479
- /** Contact's details. */
1480
- info?: ContactInfo$2;
1481
- }
1482
- interface ContactSource {
1483
- /**
1484
- * Source type.
1485
- * @readonly
1486
- */
1487
- sourceType?: ContactSourceType$1;
1488
- /**
1489
- * App ID, if the contact was created by an app.
1490
- * @readonly
1491
- */
1492
- appId?: string | null;
1493
- }
1494
- declare enum ContactSourceType$1 {
1495
- OTHER = "OTHER",
1496
- ADMIN = "ADMIN",
1497
- WIX_APP = "WIX_APP",
1498
- IMPORT = "IMPORT",
1499
- THIRD_PARTY = "THIRD_PARTY",
1500
- WIX_BOOKINGS = "WIX_BOOKINGS",
1501
- WIX_CHAT = "WIX_CHAT",
1502
- WIX_EMAIL_MARKETING = "WIX_EMAIL_MARKETING",
1503
- WIX_EVENTS = "WIX_EVENTS",
1504
- WIX_FORMS = "WIX_FORMS",
1505
- WIX_GROUPS = "WIX_GROUPS",
1506
- WIX_HOTELS = "WIX_HOTELS",
1507
- WIX_MARKET_PLACE = "WIX_MARKET_PLACE",
1508
- WIX_MUSIC = "WIX_MUSIC",
1509
- WIX_RESTAURANTS = "WIX_RESTAURANTS",
1510
- WIX_SITE_MEMBERS = "WIX_SITE_MEMBERS",
1511
- WIX_STORES = "WIX_STORES",
1512
- WIX_CODE = "WIX_CODE",
1513
- HOPP = "HOPP"
1514
- }
1515
- interface ContactActivity$1 {
1516
- /** Date and time of the last action. */
1517
- activityDate?: Date;
1518
- /** */
1519
- activityType?: ContactActivityType$1;
1037
+ interface ContactActivity$1 {
1038
+ /** Date and time of the last action. */
1039
+ activityDate?: Date;
1040
+ /** */
1041
+ activityType?: ContactActivityType$1;
1520
1042
  }
1521
1043
  declare enum ContactActivityType$1 {
1522
1044
  /** Last visit to your site (any unknown activity) */
@@ -3351,7 +2873,7 @@ interface GetContactOptions {
3351
2873
  fieldsets?: ContactFieldSet[];
3352
2874
  }
3353
2875
 
3354
- declare function createContact$1(httpClient: HttpClient$4): CreateContactSignature;
2876
+ declare function createContact$1(httpClient: HttpClient): CreateContactSignature;
3355
2877
  interface CreateContactSignature {
3356
2878
  /**
3357
2879
  * Creates a new contact.
@@ -3372,7 +2894,7 @@ interface CreateContactSignature {
3372
2894
  */
3373
2895
  (info: ContactInfo$2, options?: CreateContactOptions | undefined): Promise<CreateContactResponse & CreateContactResponseNonNullableFields>;
3374
2896
  }
3375
- declare function updateContact$1(httpClient: HttpClient$4): UpdateContactSignature;
2897
+ declare function updateContact$1(httpClient: HttpClient): UpdateContactSignature;
3376
2898
  interface UpdateContactSignature {
3377
2899
  /**
3378
2900
  * Updates a contact's properties.
@@ -3392,7 +2914,7 @@ interface UpdateContactSignature {
3392
2914
  */
3393
2915
  (contactId: string, info: ContactInfo$2, revision: number | null, options?: UpdateContactOptions | undefined): Promise<UpdateContactResponse & UpdateContactResponseNonNullableFields>;
3394
2916
  }
3395
- declare function mergeContacts$1(httpClient: HttpClient$4): MergeContactsSignature;
2917
+ declare function mergeContacts$1(httpClient: HttpClient): MergeContactsSignature;
3396
2918
  interface MergeContactsSignature {
3397
2919
  /**
3398
2920
  * Merges source contacts into a target contact.
@@ -3418,7 +2940,7 @@ interface MergeContactsSignature {
3418
2940
  */
3419
2941
  (targetContactId: string, targetContactRevision: number | null, options?: MergeContactsOptions | undefined): Promise<MergeContactsResponse & MergeContactsResponseNonNullableFields>;
3420
2942
  }
3421
- declare function deleteContact$1(httpClient: HttpClient$4): DeleteContactSignature;
2943
+ declare function deleteContact$1(httpClient: HttpClient): DeleteContactSignature;
3422
2944
  interface DeleteContactSignature {
3423
2945
  /**
3424
2946
  * Deletes a contact who is not a site member or contributor.
@@ -3436,7 +2958,7 @@ interface DeleteContactSignature {
3436
2958
  */
3437
2959
  (contactId: string): Promise<void>;
3438
2960
  }
3439
- declare function labelContact$1(httpClient: HttpClient$4): LabelContactSignature;
2961
+ declare function labelContact$1(httpClient: HttpClient): LabelContactSignature;
3440
2962
  interface LabelContactSignature {
3441
2963
  /**
3442
2964
  * Adds labels to a contact.
@@ -3458,7 +2980,7 @@ interface LabelContactSignature {
3458
2980
  */
3459
2981
  (contactId: string, labelKeys: string[]): Promise<LabelContactResponse & LabelContactResponseNonNullableFields>;
3460
2982
  }
3461
- declare function unlabelContact$1(httpClient: HttpClient$4): UnlabelContactSignature;
2983
+ declare function unlabelContact$1(httpClient: HttpClient): UnlabelContactSignature;
3462
2984
  interface UnlabelContactSignature {
3463
2985
  /**
3464
2986
  * Removes labels from a contact.
@@ -3474,7 +2996,7 @@ interface UnlabelContactSignature {
3474
2996
  */
3475
2997
  (contactId: string, labelKeys: string[]): Promise<UnlabelContactResponse & UnlabelContactResponseNonNullableFields>;
3476
2998
  }
3477
- declare function queryContacts$1(httpClient: HttpClient$4): QueryContactsSignature;
2999
+ declare function queryContacts$1(httpClient: HttpClient): QueryContactsSignature;
3478
3000
  interface QueryContactsSignature {
3479
3001
  /**
3480
3002
  * Creates a query to retrieve a list of contacts.
@@ -3496,7 +3018,7 @@ interface QueryContactsSignature {
3496
3018
  */
3497
3019
  (options?: QueryContactsOptions | undefined): ContactsQueryBuilder;
3498
3020
  }
3499
- declare function getContact$1(httpClient: HttpClient$4): GetContactSignature;
3021
+ declare function getContact$1(httpClient: HttpClient): GetContactSignature;
3500
3022
  interface GetContactSignature {
3501
3023
  /**
3502
3024
  * Retrieves a contact.
@@ -3517,21 +3039,21 @@ interface GetContactSignature {
3517
3039
  */
3518
3040
  (_id: string, options?: GetContactOptions | undefined): Promise<Contact & ContactNonNullableFields>;
3519
3041
  }
3520
- declare const onContactCreated$1: EventDefinition$4<ContactCreatedEnvelope, "wix.contacts.v4.contact_created">;
3521
- declare const onContactUpdated$1: EventDefinition$4<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">;
3522
- declare const onContactMerged$1: EventDefinition$4<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">;
3523
- declare const onContactDeleted$1: EventDefinition$4<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">;
3524
3046
 
3525
- declare function createEventModule$3<T extends EventDefinition$4<any, string>>(eventDefinition: T): BuildEventDefinition$4<T> & T;
3047
+ declare function createEventModule$3<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
3526
3048
 
3527
- declare const createContact: MaybeContext$4<BuildRESTFunction$4<typeof createContact$1> & typeof createContact$1>;
3528
- declare const updateContact: MaybeContext$4<BuildRESTFunction$4<typeof updateContact$1> & typeof updateContact$1>;
3529
- declare const mergeContacts: MaybeContext$4<BuildRESTFunction$4<typeof mergeContacts$1> & typeof mergeContacts$1>;
3530
- declare const deleteContact: MaybeContext$4<BuildRESTFunction$4<typeof deleteContact$1> & typeof deleteContact$1>;
3531
- declare const labelContact: MaybeContext$4<BuildRESTFunction$4<typeof labelContact$1> & typeof labelContact$1>;
3532
- declare const unlabelContact: MaybeContext$4<BuildRESTFunction$4<typeof unlabelContact$1> & typeof unlabelContact$1>;
3533
- declare const queryContacts: MaybeContext$4<BuildRESTFunction$4<typeof queryContacts$1> & typeof queryContacts$1>;
3534
- declare const getContact: MaybeContext$4<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>;
3535
3057
 
3536
3058
  type _publicOnContactCreatedType = typeof onContactCreated$1;
3537
3059
  /**
@@ -3718,573 +3240,95 @@ declare namespace context$4 {
3718
3240
  export { context$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 context$4_ApplicationError as ApplicationError, type AssigneesWrapper$1 as AssigneesWrapper, type BaseEventMetadata$3 as BaseEventMetadata, type context$4_BulkActionMetadata as BulkActionMetadata, type context$4_BulkAddSegmentToContactsRequest as BulkAddSegmentToContactsRequest, type context$4_BulkAddSegmentToContactsResponse as BulkAddSegmentToContactsResponse, type context$4_BulkDeleteContactsRequest as BulkDeleteContactsRequest, type context$4_BulkDeleteContactsResponse as BulkDeleteContactsResponse, type context$4_BulkLabelAndUnlabelContactsRequest as BulkLabelAndUnlabelContactsRequest, type context$4_BulkLabelAndUnlabelContactsResponse as BulkLabelAndUnlabelContactsResponse, type context$4_BulkRemoveSegmentFromContactsRequest as BulkRemoveSegmentFromContactsRequest, type context$4_BulkRemoveSegmentFromContactsResponse as BulkRemoveSegmentFromContactsResponse, type context$4_BulkUpdateContactsRequest as BulkUpdateContactsRequest, type context$4_BulkUpdateContactsResponse as BulkUpdateContactsResponse, type context$4_BulkUpsertContactsRequest as BulkUpsertContactsRequest, type context$4_BulkUpsertContactsResponse as BulkUpsertContactsResponse, type context$4_BulkUpsertContactsResponseMetadata as BulkUpsertContactsResponseMetadata, type context$4_Contact as Contact, type ContactActivity$1 as ContactActivity, ContactActivityType$1 as ContactActivityType, type context$4_ContactAddedToSegment as ContactAddedToSegment, type ContactAddress$1 as ContactAddress, type ContactAddressesWrapper$1 as ContactAddressesWrapper, type context$4_ContactChanged as ContactChanged, type context$4_ContactCreatedEnvelope as ContactCreatedEnvelope, type context$4_ContactDeletedEnvelope as ContactDeletedEnvelope, type ContactEmail$1 as ContactEmail, type context$4_ContactEmailSubscriptionUpdated as ContactEmailSubscriptionUpdated, type ContactEmailsWrapper$1 as ContactEmailsWrapper, context$4_ContactFieldSet as ContactFieldSet, type ContactInfo$2 as ContactInfo, type context$4_ContactMerged as ContactMerged, type context$4_ContactMergedEnvelope as ContactMergedEnvelope, type ContactName$1 as ContactName, type context$4_ContactNonNullableFields as ContactNonNullableFields, type ContactPhone$1 as ContactPhone, type context$4_ContactPhoneSubscriptionUpdated as ContactPhoneSubscriptionUpdated, type ContactPhonesWrapper$1 as ContactPhonesWrapper, type ContactPicture$1 as ContactPicture, type context$4_ContactPrimaryInfoUpdated as ContactPrimaryInfoUpdated, type context$4_ContactRemovedFromSegment as ContactRemovedFromSegment, type context$4_ContactSource as ContactSource, ContactSourceType$1 as ContactSourceType, type context$4_ContactSubmitted as ContactSubmitted, type context$4_ContactUpdatedEnvelope as ContactUpdatedEnvelope, type context$4_ContactsFacet as ContactsFacet, context$4_ContactsFacetType as ContactsFacetType, type context$4_ContactsQueryBuilder as ContactsQueryBuilder, type context$4_ContactsQueryResult as ContactsQueryResult, type context$4_CountContactsRequest as CountContactsRequest, type context$4_CountContactsResponse as CountContactsResponse, type context$4_CreateContactOptions as CreateContactOptions, type context$4_CreateContactRequest as CreateContactRequest, type context$4_CreateContactResponse as CreateContactResponse, type context$4_CreateContactResponseNonNullableFields as CreateContactResponseNonNullableFields, type CursorPaging$1 as CursorPaging, type CursorPagingMetadata$1 as CursorPagingMetadata, type Cursors$1 as Cursors, type context$4_DeleteContactRequest as DeleteContactRequest, type context$4_DeleteContactResponse as DeleteContactResponse, type DomainEvent$3 as DomainEvent, type DomainEventBodyOneOf$3 as DomainEventBodyOneOf, type context$4_DuplicateContactExists as DuplicateContactExists, context$4_EmailDeliverabilityStatus as EmailDeliverabilityStatus, EmailTag$1 as EmailTag, type EntityCreatedEvent$3 as EntityCreatedEvent, type EntityDeletedEvent$3 as EntityDeletedEvent, type EntityUpdatedEvent$3 as EntityUpdatedEvent, type context$4_Error as Error, type EventMetadata$3 as EventMetadata, type ExtendedFieldsWrapper$1 as ExtendedFieldsWrapper, type context$4_GeneratePictureUploadUrlRequest as GeneratePictureUploadUrlRequest, type context$4_GeneratePictureUploadUrlResponse as GeneratePictureUploadUrlResponse, type context$4_GetContactOptions as GetContactOptions, type context$4_GetContactRequest as GetContactRequest, type context$4_GetContactResponse as GetContactResponse, type context$4_GetContactResponseNonNullableFields as GetContactResponseNonNullableFields, context$4_GetContactResponseType as GetContactResponseType, type context$4_GroupInfo as GroupInfo, type IdentificationData$4 as IdentificationData, type IdentificationDataIdOneOf$4 as IdentificationDataIdOneOf, ImageProvider$1 as ImageProvider, type context$4_Item as Item, type context$4_ItemMetadata as ItemMetadata, type context$4_LabelAndUnlabelContactRequest as LabelAndUnlabelContactRequest, type context$4_LabelAndUnlabelContactResponse as LabelAndUnlabelContactResponse, type context$4_LabelContactRequest as LabelContactRequest, type context$4_LabelContactResponse as LabelContactResponse, type context$4_LabelContactResponseNonNullableFields as LabelContactResponseNonNullableFields, type LabelsWrapper$1 as LabelsWrapper, type context$4_LastActivityUpdate as LastActivityUpdate, type context$4_ListContactIdsBySegmentRequest as ListContactIdsBySegmentRequest, type context$4_ListContactIdsBySegmentResponse as ListContactIdsBySegmentResponse, type context$4_ListContactsRequest as ListContactsRequest, type context$4_ListContactsResponse as ListContactsResponse, type context$4_ListFacetsRequest as ListFacetsRequest, type context$4_ListFacetsResponse as ListFacetsResponse, type LocationsWrapper$1 as LocationsWrapper, type context$4_MemberInfo as MemberInfo, context$4_MemberStatus as MemberStatus, type context$4_MergeContactsOptions as MergeContactsOptions, type context$4_MergeContactsRequest as MergeContactsRequest, type context$4_MergeContactsResponse as MergeContactsResponse, type context$4_MergeContactsResponseNonNullableFields as MergeContactsResponseNonNullableFields, type MessageEnvelope$4 as MessageEnvelope, type context$4_Metadata as Metadata, context$4_Mode as Mode, type Paging$3 as Paging, type PagingMetadata$2 as PagingMetadata, context$4_PhoneDeliverabilityStatus as PhoneDeliverabilityStatus, PhoneTag$1 as PhoneTag, type context$4_PreviewMergeContactsRequest as PreviewMergeContactsRequest, type context$4_PreviewMergeContactsResponse as PreviewMergeContactsResponse, type context$4_PrimaryContactInfo as PrimaryContactInfo, type context$4_PrimaryEmail as PrimaryEmail, type context$4_PrimaryPhone as PrimaryPhone, type context$4_PrimarySubscriptionStatus as PrimarySubscriptionStatus, context$4_PrivacyStatus as PrivacyStatus, type context$4_ProfileInfo as ProfileInfo, type Query$2 as Query, type context$4_QueryContactsOptions as QueryContactsOptions, type context$4_QueryContactsRequest as QueryContactsRequest, type context$4_QueryContactsResponse as QueryContactsResponse, type context$4_QueryContactsResponseNonNullableFields as QueryContactsResponseNonNullableFields, type context$4_QueryFacetsRequest as QueryFacetsRequest, type context$4_QueryFacetsResponse as QueryFacetsResponse, type RestoreInfo$2 as RestoreInfo, context$4_Role as Role, type context$4_Search as Search, type context$4_SearchContactsRequest as SearchContactsRequest, type context$4_SearchContactsResponse as SearchContactsResponse, type context$4_SearchDetails as SearchDetails, type context$4_SearchPagingMethodOneOf as SearchPagingMethodOneOf, type context$4_SegmentsWrapper as SegmentsWrapper, type context$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, context$4_SubscriptionStatus as SubscriptionStatus, type context$4_SyncSubmitContactRequest as SyncSubmitContactRequest, type context$4_SyncSubmitContactResponse as SyncSubmitContactResponse, type context$4_UnlabelContactRequest as UnlabelContactRequest, type context$4_UnlabelContactResponse as UnlabelContactResponse, type context$4_UnlabelContactResponseNonNullableFields as UnlabelContactResponseNonNullableFields, type context$4_UpdateContactOptions as UpdateContactOptions, type context$4_UpdateContactRequest as UpdateContactRequest, type context$4_UpdateContactResponse as UpdateContactResponse, type context$4_UpdateContactResponseNonNullableFields as UpdateContactResponseNonNullableFields, type context$4_UpsertContactRequest as UpsertContactRequest, type context$4_UpsertContactResponse as UpsertContactResponse, context$4_UpsertContactResponseAction as UpsertContactResponseAction, type context$4_UserInfo as UserInfo, WebhookIdentityType$4 as WebhookIdentityType, type context$4__publicOnContactCreatedType as _publicOnContactCreatedType, type context$4__publicOnContactDeletedType as _publicOnContactDeletedType, type context$4__publicOnContactMergedType as _publicOnContactMergedType, type context$4__publicOnContactUpdatedType as _publicOnContactUpdatedType, context$4_createContact as createContact, context$4_deleteContact as deleteContact, context$4_getContact as getContact, context$4_labelContact as labelContact, context$4_mergeContacts as mergeContacts, context$4_onContactCreated as onContactCreated, context$4_onContactDeleted as onContactDeleted, context$4_onContactMerged as onContactMerged, context$4_onContactUpdated as onContactUpdated, onContactCreated$1 as publicOnContactCreated, onContactDeleted$1 as publicOnContactDeleted, onContactMerged$1 as publicOnContactMerged, onContactUpdated$1 as publicOnContactUpdated, context$4_queryContacts as queryContacts, context$4_unlabelContact as unlabelContact, context$4_updateContact as updateContact };
3719
3241
  }
3720
3242
 
3721
- type HostModule$3<T, H extends Host$3> = {
3722
- __type: 'host';
3723
- create(host: H): T;
3724
- };
3725
- type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
3726
- type Host$3<Environment = unknown> = {
3727
- channel: {
3728
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
3729
- disconnect: () => void;
3730
- } | Promise<{
3731
- disconnect: () => void;
3732
- }>;
3733
- };
3734
- environment?: Environment;
3243
+ /** Extended field that was found or created. */
3244
+ interface ExtendedField {
3735
3245
  /**
3736
- * Optional name of the environment, use for logging
3246
+ * Extended field namespace.
3247
+ *
3248
+ * Extended fields created by site collaborators or 3rd-party apps
3249
+ * are automatically assigned to the `custom` namespace.
3250
+ * @readonly
3737
3251
  */
3738
- name?: string;
3252
+ namespace?: string | null;
3739
3253
  /**
3740
- * Optional bast url to use for API requests, for example `www.wixapis.com`
3254
+ * Extended field key.
3255
+ *
3256
+ * When accessing contact data,
3257
+ * extended field data is available at `fields[key]`.
3258
+ * For example, if the key is "custom.notes",
3259
+ * the value can be accessed at `fields["custom.notes"]`.
3260
+ *
3261
+ * `key` is generated when the extended field is created
3262
+ * and cannot be modified, even if `displayName` changes.
3263
+ * @readonly
3741
3264
  */
3742
- apiBaseUrl?: string;
3265
+ key?: string;
3266
+ /** Display name shown in the Contact List. */
3267
+ displayName?: string;
3743
3268
  /**
3744
- * Possible data to be provided by every host, for cross cutting concerns
3745
- * like internationalization, billing, etc.
3269
+ * Type of data the field holds.
3270
+ *
3271
+ * One of:
3272
+ * - `"TEXT"`: Accepts strings.
3273
+ * - `"NUMBER"`: Accepts floats.
3274
+ * - `"DATE"`: Accepts dates formatted as `YYYY-MM-DD`.
3275
+ * - `"URL"`: Accepts strings. Prepends `https://` if no protocol is included.
3276
+ * @readonly
3746
3277
  */
3747
- essentials?: {
3748
- /**
3749
- * The language of the currently viewed session
3750
- */
3751
- language?: string;
3752
- /**
3753
- * The locale of the currently viewed session
3754
- */
3755
- locale?: string;
3756
- /**
3757
- * Any headers that should be passed through to the API requests
3758
- */
3759
- passThroughHeaders?: Record<string, string>;
3760
- };
3761
- };
3762
-
3763
- type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
3764
- interface HttpClient$3 {
3765
- request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
3766
- fetchWithAuth: typeof fetch;
3767
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
3768
- getActiveToken?: () => string | undefined;
3278
+ dataType?: FieldDataType;
3279
+ /**
3280
+ * Indicates whether the extended field is a system field or custom field.
3281
+ *
3282
+ * One of:
3283
+ * - `"SYSTEM"`: System field managed by Wix. System fields cannot be modified by 3rd-party apps or site contributors.
3284
+ * - `"USER_DEFINED"`: Custom field that can be modified by 3rd-party apps or site admins.
3285
+ * @readonly
3286
+ */
3287
+ fieldType?: FieldType;
3288
+ /**
3289
+ * Date and time the field was created.
3290
+ * @readonly
3291
+ */
3292
+ _createdDate?: Date;
3293
+ /**
3294
+ * Date and time the field was last updated.
3295
+ * @readonly
3296
+ */
3297
+ _updatedDate?: Date;
3298
+ /**
3299
+ * Field description, if the field is a system field.
3300
+ * @readonly
3301
+ */
3302
+ description?: string | null;
3769
3303
  }
3770
- type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
3771
- type HttpResponse$3<T = any> = {
3772
- data: T;
3773
- status: number;
3774
- statusText: string;
3775
- headers: any;
3776
- request?: any;
3777
- };
3778
- type RequestOptions$3<_TResponse = any, Data = any> = {
3779
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
3780
- url: string;
3781
- data?: Data;
3782
- params?: URLSearchParams;
3783
- } & APIMetadata$3;
3784
- type APIMetadata$3 = {
3785
- methodFqn?: string;
3786
- entityFqdn?: string;
3787
- packageName?: string;
3788
- };
3789
- type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
3790
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
3791
- __type: 'event-definition';
3792
- type: Type;
3793
- isDomainEvent?: boolean;
3794
- transformations?: (envelope: unknown) => Payload;
3795
- __payload: Payload;
3796
- };
3797
- declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
3798
- type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
3799
- type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
3800
-
3801
- type ServicePluginMethodInput$3 = {
3802
- request: any;
3803
- metadata: any;
3804
- };
3805
- type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
3806
- type ServicePluginMethodMetadata$3 = {
3807
- name: string;
3808
- primaryHttpMappingPath: string;
3809
- transformations: {
3810
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
3811
- toREST: (...args: unknown[]) => unknown;
3812
- };
3813
- };
3814
- type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
3815
- __type: 'service-plugin-definition';
3816
- componentType: string;
3817
- methods: ServicePluginMethodMetadata$3[];
3818
- __contract: Contract;
3819
- };
3820
- declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
3821
- type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
3822
- declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
3823
-
3824
- type RequestContext$3 = {
3825
- isSSR: boolean;
3826
- host: string;
3827
- protocol?: string;
3828
- };
3829
- type ResponseTransformer$3 = (data: any, headers?: any) => any;
3830
- /**
3831
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
3832
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
3833
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
3834
- */
3835
- type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
3836
- type AmbassadorRequestOptions$3<T = any> = {
3837
- _?: T;
3838
- url?: string;
3839
- method?: Method$3;
3840
- params?: any;
3841
- data?: any;
3842
- transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
3843
- };
3844
- type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
3845
- __isAmbassador: boolean;
3846
- };
3847
- type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
3848
- type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
3849
-
3850
- declare global {
3851
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
3852
- interface SymbolConstructor {
3853
- readonly observable: symbol;
3854
- }
3304
+ declare enum FieldDataType {
3305
+ UNKNOWN_DATA_TYPE = "UNKNOWN_DATA_TYPE",
3306
+ TEXT = "TEXT",
3307
+ NUMBER = "NUMBER",
3308
+ DATE = "DATE",
3309
+ URL = "URL"
3855
3310
  }
3856
-
3857
- declare const emptyObjectSymbol$3: unique symbol;
3858
-
3859
- /**
3860
- Represents a strictly empty plain object, the `{}` value.
3861
-
3862
- 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)).
3863
-
3864
- @example
3865
- ```
3866
- import type {EmptyObject} from 'type-fest';
3867
-
3868
- // The following illustrates the problem with `{}`.
3869
- const foo1: {} = {}; // Pass
3870
- const foo2: {} = []; // Pass
3871
- const foo3: {} = 42; // Pass
3872
- const foo4: {} = {a: 1}; // Pass
3873
-
3874
- // With `EmptyObject` only the first case is valid.
3875
- const bar1: EmptyObject = {}; // Pass
3876
- const bar2: EmptyObject = 42; // Fail
3877
- const bar3: EmptyObject = []; // Fail
3878
- const bar4: EmptyObject = {a: 1}; // Fail
3879
- ```
3880
-
3881
- 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}.
3882
-
3883
- @category Object
3884
- */
3885
- type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
3886
-
3887
- /**
3888
- Returns a boolean for whether the two given types are equal.
3889
-
3890
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
3891
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
3892
-
3893
- Use-cases:
3894
- - If you want to make a conditional branch based on the result of a comparison of two types.
3895
-
3896
- @example
3897
- ```
3898
- import type {IsEqual} from 'type-fest';
3899
-
3900
- // This type returns a boolean for whether the given array includes the given item.
3901
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
3902
- type Includes<Value extends readonly any[], Item> =
3903
- Value extends readonly [Value[0], ...infer rest]
3904
- ? IsEqual<Value[0], Item> extends true
3905
- ? true
3906
- : Includes<rest, Item>
3907
- : false;
3908
- ```
3909
-
3910
- @category Type Guard
3911
- @category Utilities
3912
- */
3913
- type IsEqual$3<A, B> =
3914
- (<G>() => G extends A ? 1 : 2) extends
3915
- (<G>() => G extends B ? 1 : 2)
3916
- ? true
3917
- : false;
3918
-
3919
- /**
3920
- Filter out keys from an object.
3921
-
3922
- Returns `never` if `Exclude` is strictly equal to `Key`.
3923
- Returns `never` if `Key` extends `Exclude`.
3924
- Returns `Key` otherwise.
3925
-
3926
- @example
3927
- ```
3928
- type Filtered = Filter<'foo', 'foo'>;
3929
- //=> never
3930
- ```
3931
-
3932
- @example
3933
- ```
3934
- type Filtered = Filter<'bar', string>;
3935
- //=> never
3936
- ```
3937
-
3938
- @example
3939
- ```
3940
- type Filtered = Filter<'bar', 'foo'>;
3941
- //=> 'bar'
3942
- ```
3943
-
3944
- @see {Except}
3945
- */
3946
- type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
3947
-
3948
- type ExceptOptions$3 = {
3949
- /**
3950
- Disallow assigning non-specified properties.
3951
-
3952
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
3953
-
3954
- @default false
3955
- */
3956
- requireExactProps?: boolean;
3957
- };
3958
-
3959
- /**
3960
- Create a type from an object type without certain keys.
3961
-
3962
- We recommend setting the `requireExactProps` option to `true`.
3963
-
3964
- 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.
3965
-
3966
- 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)).
3967
-
3968
- @example
3969
- ```
3970
- import type {Except} from 'type-fest';
3971
-
3972
- type Foo = {
3973
- a: number;
3974
- b: string;
3975
- };
3976
-
3977
- type FooWithoutA = Except<Foo, 'a'>;
3978
- //=> {b: string}
3979
-
3980
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
3981
- //=> errors: 'a' does not exist in type '{ b: string; }'
3982
-
3983
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
3984
- //=> {a: number} & Partial<Record<"b", never>>
3985
-
3986
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
3987
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
3988
- ```
3989
-
3990
- @category Object
3991
- */
3992
- type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
3993
- [KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
3994
- } & (Options['requireExactProps'] extends true
3995
- ? Partial<Record<KeysType, never>>
3996
- : {});
3997
-
3998
- /**
3999
- Returns a boolean for whether the given type is `never`.
4000
-
4001
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
4002
- @link https://stackoverflow.com/a/53984913/10292952
4003
- @link https://www.zhenghao.io/posts/ts-never
4004
-
4005
- Useful in type utilities, such as checking if something does not occur.
4006
-
4007
- @example
4008
- ```
4009
- import type {IsNever, And} from 'type-fest';
4010
-
4011
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
4012
- type AreStringsEqual<A extends string, B extends string> =
4013
- And<
4014
- IsNever<Exclude<A, B>> extends true ? true : false,
4015
- IsNever<Exclude<B, A>> extends true ? true : false
4016
- >;
4017
-
4018
- type EndIfEqual<I extends string, O extends string> =
4019
- AreStringsEqual<I, O> extends true
4020
- ? never
4021
- : void;
4022
-
4023
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
4024
- if (input === output) {
4025
- process.exit(0);
4026
- }
3311
+ declare enum FieldType {
3312
+ UNKNOWN = "UNKNOWN",
3313
+ SYSTEM = "SYSTEM",
3314
+ USER_DEFINED = "USER_DEFINED"
4027
3315
  }
4028
-
4029
- endIfEqual('abc', 'abc');
4030
- //=> never
4031
-
4032
- endIfEqual('abc', '123');
4033
- //=> void
4034
- ```
4035
-
4036
- @category Type Guard
4037
- @category Utilities
4038
- */
4039
- type IsNever$3<T> = [T] extends [never] ? true : false;
4040
-
4041
- /**
4042
- An if-else-like type that resolves depending on whether the given type is `never`.
4043
-
4044
- @see {@link IsNever}
4045
-
4046
- @example
4047
- ```
4048
- import type {IfNever} from 'type-fest';
4049
-
4050
- type ShouldBeTrue = IfNever<never>;
4051
- //=> true
4052
-
4053
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
4054
- //=> 'bar'
4055
- ```
4056
-
4057
- @category Type Guard
4058
- @category Utilities
4059
- */
4060
- type IfNever$3<T, TypeIfNever = true, TypeIfNotNever = false> = (
4061
- IsNever$3<T> extends true ? TypeIfNever : TypeIfNotNever
4062
- );
4063
-
4064
- /**
4065
- Extract the keys from a type where the value type of the key extends the given `Condition`.
4066
-
4067
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
4068
-
4069
- @example
4070
- ```
4071
- import type {ConditionalKeys} from 'type-fest';
4072
-
4073
- interface Example {
4074
- a: string;
4075
- b: string | number;
4076
- c?: string;
4077
- d: {};
4078
- }
4079
-
4080
- type StringKeysOnly = ConditionalKeys<Example, string>;
4081
- //=> 'a'
4082
- ```
4083
-
4084
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
4085
-
4086
- @example
4087
- ```
4088
- import type {ConditionalKeys} from 'type-fest';
4089
-
4090
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
4091
- //=> 'a' | 'c'
4092
- ```
4093
-
4094
- @category Object
4095
- */
4096
- type ConditionalKeys$3<Base, Condition> =
4097
- {
4098
- // Map through all the keys of the given base type.
4099
- [Key in keyof Base]-?:
4100
- // Pick only keys with types extending the given `Condition` type.
4101
- Base[Key] extends Condition
4102
- // Retain this key
4103
- // If the value for the key extends never, only include it if `Condition` also extends never
4104
- ? IfNever$3<Base[Key], IfNever$3<Condition, Key, never>, Key>
4105
- // Discard this key since the condition fails.
4106
- : never;
4107
- // Convert the produced object into a union type of the keys which passed the conditional test.
4108
- }[keyof Base];
4109
-
4110
- /**
4111
- Exclude keys from a shape that matches the given `Condition`.
4112
-
4113
- 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.
4114
-
4115
- @example
4116
- ```
4117
- import type {Primitive, ConditionalExcept} from 'type-fest';
4118
-
4119
- class Awesome {
4120
- name: string;
4121
- successes: number;
4122
- failures: bigint;
4123
-
4124
- run() {}
4125
- }
4126
-
4127
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
4128
- //=> {run: () => void}
4129
- ```
4130
-
4131
- @example
4132
- ```
4133
- import type {ConditionalExcept} from 'type-fest';
4134
-
4135
- interface Example {
4136
- a: string;
4137
- b: string | number;
4138
- c: () => void;
4139
- d: {};
4140
- }
4141
-
4142
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
4143
- //=> {b: string | number; c: () => void; d: {}}
4144
- ```
4145
-
4146
- @category Object
4147
- */
4148
- type ConditionalExcept$3<Base, Condition> = Except$3<
4149
- Base,
4150
- ConditionalKeys$3<Base, Condition>
4151
- >;
4152
-
4153
- /**
4154
- * Descriptors are objects that describe the API of a module, and the module
4155
- * can either be a REST module or a host module.
4156
- * This type is recursive, so it can describe nested modules.
4157
- */
4158
- type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$3<any> | ServicePluginDefinition$3<any> | {
4159
- [key: string]: Descriptors$3 | PublicMetadata$3 | any;
4160
- };
4161
- /**
4162
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
4163
- * and returns an object with the same structure, but with all descriptors replaced with their API.
4164
- * Any non-descriptor properties are removed from the returned object, including descriptors that
4165
- * do not match the given host (as they will not work with the given host).
4166
- */
4167
- type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
4168
- done: T;
4169
- recurse: T extends {
4170
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
4171
- } ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$3<any> ? BuildEventDefinition$3<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
4172
- [Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
4173
- -1,
4174
- 0,
4175
- 1,
4176
- 2,
4177
- 3,
4178
- 4,
4179
- 5
4180
- ][Depth]> : never;
4181
- }, EmptyObject$3>;
4182
- }[Depth extends -1 ? 'done' : 'recurse'];
4183
- type PublicMetadata$3 = {
4184
- PACKAGE_NAME?: string;
4185
- };
4186
-
4187
- declare global {
4188
- interface ContextualClient {
4189
- }
4190
- }
4191
- /**
4192
- * A type used to create concerete types from SDK descriptors in
4193
- * case a contextual client is available.
4194
- */
4195
- type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
4196
- host: Host$3;
4197
- } ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
4198
-
4199
- /** Extended field that was found or created. */
4200
- interface ExtendedField {
4201
- /**
4202
- * Extended field namespace.
4203
- *
4204
- * Extended fields created by site collaborators or 3rd-party apps
4205
- * are automatically assigned to the `custom` namespace.
4206
- * @readonly
4207
- */
4208
- namespace?: string | null;
4209
- /**
4210
- * Extended field key.
4211
- *
4212
- * When accessing contact data,
4213
- * extended field data is available at `fields[key]`.
4214
- * For example, if the key is "custom.notes",
4215
- * the value can be accessed at `fields["custom.notes"]`.
4216
- *
4217
- * `key` is generated when the extended field is created
4218
- * and cannot be modified, even if `displayName` changes.
4219
- * @readonly
4220
- */
4221
- key?: string;
4222
- /** Display name shown in the Contact List. */
4223
- displayName?: string;
4224
- /**
4225
- * Type of data the field holds.
4226
- *
4227
- * One of:
4228
- * - `"TEXT"`: Accepts strings.
4229
- * - `"NUMBER"`: Accepts floats.
4230
- * - `"DATE"`: Accepts dates formatted as `YYYY-MM-DD`.
4231
- * - `"URL"`: Accepts strings. Prepends `https://` if no protocol is included.
4232
- * @readonly
4233
- */
4234
- dataType?: FieldDataType;
4235
- /**
4236
- * Indicates whether the extended field is a system field or custom field.
4237
- *
4238
- * One of:
4239
- * - `"SYSTEM"`: System field managed by Wix. System fields cannot be modified by 3rd-party apps or site contributors.
4240
- * - `"USER_DEFINED"`: Custom field that can be modified by 3rd-party apps or site admins.
4241
- * @readonly
4242
- */
4243
- fieldType?: FieldType;
4244
- /**
4245
- * Date and time the field was created.
4246
- * @readonly
4247
- */
4248
- _createdDate?: Date;
4249
- /**
4250
- * Date and time the field was last updated.
4251
- * @readonly
4252
- */
4253
- _updatedDate?: Date;
4254
- /**
4255
- * Field description, if the field is a system field.
4256
- * @readonly
4257
- */
4258
- description?: string | null;
4259
- }
4260
- declare enum FieldDataType {
4261
- UNKNOWN_DATA_TYPE = "UNKNOWN_DATA_TYPE",
4262
- TEXT = "TEXT",
4263
- NUMBER = "NUMBER",
4264
- DATE = "DATE",
4265
- URL = "URL"
4266
- }
4267
- declare enum FieldType {
4268
- UNKNOWN = "UNKNOWN",
4269
- SYSTEM = "SYSTEM",
4270
- USER_DEFINED = "USER_DEFINED"
4271
- }
4272
- /** Extended field filter options. */
4273
- interface ListExtendedFieldsRequest {
4274
- /** Filter for fields of the specified type. */
4275
- fieldType?: FieldType;
4276
- /**
4277
- * Filter for fields in the specified namespace.
4278
- * Fields created by site contributors or 3rd-party apps
4279
- * are automatically assigned to the `custom` namespace.
4280
- */
4281
- namespace?: string | null;
4282
- /** Filter for fields where `displayName` starts with the specified case-sensitive string. */
4283
- startsWith?: string | null;
4284
- /** Sorting options. */
4285
- sort?: Sorting$2;
4286
- /** Paging options. */
4287
- paging?: Paging$2;
3316
+ /** Extended field filter options. */
3317
+ interface ListExtendedFieldsRequest {
3318
+ /** Filter for fields of the specified type. */
3319
+ fieldType?: FieldType;
3320
+ /**
3321
+ * Filter for fields in the specified namespace.
3322
+ * Fields created by site contributors or 3rd-party apps
3323
+ * are automatically assigned to the `custom` namespace.
3324
+ */
3325
+ namespace?: string | null;
3326
+ /** Filter for fields where `displayName` starts with the specified case-sensitive string. */
3327
+ startsWith?: string | null;
3328
+ /** Sorting options. */
3329
+ sort?: Sorting$2;
3330
+ /** Paging options. */
3331
+ paging?: Paging$2;
4288
3332
  }
4289
3333
  interface Sorting$2 {
4290
3334
  /** Name of the field to sort by. */
@@ -4767,7 +3811,7 @@ interface FieldsQueryBuilder {
4767
3811
  find: () => Promise<FieldsQueryResult>;
4768
3812
  }
4769
3813
 
4770
- declare function findOrCreateExtendedField$1(httpClient: HttpClient$3): FindOrCreateExtendedFieldSignature;
3814
+ declare function findOrCreateExtendedField$1(httpClient: HttpClient): FindOrCreateExtendedFieldSignature;
4771
3815
  interface FindOrCreateExtendedFieldSignature {
4772
3816
  /**
4773
3817
  * Retrieves a custom field with a given name, or creates one if it doesn't exist.
@@ -4796,7 +3840,7 @@ interface FindOrCreateExtendedFieldSignature {
4796
3840
  */
4797
3841
  (displayName: string, dataType: FieldDataType): Promise<FindOrCreateExtendedFieldResponse & FindOrCreateExtendedFieldResponseNonNullableFields>;
4798
3842
  }
4799
- declare function getExtendedField$1(httpClient: HttpClient$3): GetExtendedFieldSignature;
3843
+ declare function getExtendedField$1(httpClient: HttpClient): GetExtendedFieldSignature;
4800
3844
  interface GetExtendedFieldSignature {
4801
3845
  /**
4802
3846
  * Retrieves an extended field.
@@ -4815,7 +3859,7 @@ interface GetExtendedFieldSignature {
4815
3859
  */
4816
3860
  (key: string): Promise<ExtendedField & ExtendedFieldNonNullableFields>;
4817
3861
  }
4818
- declare function renameExtendedField$1(httpClient: HttpClient$3): RenameExtendedFieldSignature;
3862
+ declare function renameExtendedField$1(httpClient: HttpClient): RenameExtendedFieldSignature;
4819
3863
  interface RenameExtendedFieldSignature {
4820
3864
  /**
4821
3865
  * Renames an extended field.
@@ -4835,7 +3879,7 @@ interface RenameExtendedFieldSignature {
4835
3879
  */
4836
3880
  (key: string, field: RenameExtendedField): Promise<ExtendedField & ExtendedFieldNonNullableFields>;
4837
3881
  }
4838
- declare function deleteExtendedField$1(httpClient: HttpClient$3): DeleteExtendedFieldSignature;
3882
+ declare function deleteExtendedField$1(httpClient: HttpClient): DeleteExtendedFieldSignature;
4839
3883
  interface DeleteExtendedFieldSignature {
4840
3884
  /**
4841
3885
  * Deletes an extended field.
@@ -4848,7 +3892,7 @@ interface DeleteExtendedFieldSignature {
4848
3892
  */
4849
3893
  (key: string): Promise<void>;
4850
3894
  }
4851
- declare function queryExtendedFields$1(httpClient: HttpClient$3): QueryExtendedFieldsSignature;
3895
+ declare function queryExtendedFields$1(httpClient: HttpClient): QueryExtendedFieldsSignature;
4852
3896
  interface QueryExtendedFieldsSignature {
4853
3897
  /**
4854
3898
  * Creates a query to retrieve a list of extended fields.
@@ -4868,17 +3912,17 @@ interface QueryExtendedFieldsSignature {
4868
3912
  */
4869
3913
  (): FieldsQueryBuilder;
4870
3914
  }
4871
- declare const onExtendedFieldCreated$1: EventDefinition$3<ExtendedFieldCreatedEnvelope, "wix.contacts.v4.extended-field_created">;
4872
- declare const onExtendedFieldUpdated$1: EventDefinition$3<ExtendedFieldUpdatedEnvelope, "wix.contacts.v4.extended-field_updated">;
4873
- declare const onExtendedFieldDeleted$1: EventDefinition$3<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">;
4874
3918
 
4875
- declare function createEventModule$2<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
3919
+ declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
4876
3920
 
4877
- declare const findOrCreateExtendedField: MaybeContext$3<BuildRESTFunction$3<typeof findOrCreateExtendedField$1> & typeof findOrCreateExtendedField$1>;
4878
- declare const getExtendedField: MaybeContext$3<BuildRESTFunction$3<typeof getExtendedField$1> & typeof getExtendedField$1>;
4879
- declare const renameExtendedField: MaybeContext$3<BuildRESTFunction$3<typeof renameExtendedField$1> & typeof renameExtendedField$1>;
4880
- declare const deleteExtendedField: MaybeContext$3<BuildRESTFunction$3<typeof deleteExtendedField$1> & typeof deleteExtendedField$1>;
4881
- declare const queryExtendedFields: MaybeContext$3<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>;
4882
3926
 
4883
3927
  type _publicOnExtendedFieldCreatedType = typeof onExtendedFieldCreated$1;
4884
3928
  /**
@@ -4943,551 +3987,73 @@ declare namespace context$3 {
4943
3987
  export { type ActionEvent$2 as ActionEvent, type BaseEventMetadata$2 as BaseEventMetadata, type context$3_DeleteExtendedFieldRequest as DeleteExtendedFieldRequest, type context$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 context$3_ExtendedField as ExtendedField, type context$3_ExtendedFieldCreatedEnvelope as ExtendedFieldCreatedEnvelope, type context$3_ExtendedFieldDeletedEnvelope as ExtendedFieldDeletedEnvelope, type context$3_ExtendedFieldNonNullableFields as ExtendedFieldNonNullableFields, type context$3_ExtendedFieldUpdatedEnvelope as ExtendedFieldUpdatedEnvelope, context$3_FieldDataType as FieldDataType, context$3_FieldType as FieldType, type context$3_FieldsQueryBuilder as FieldsQueryBuilder, type context$3_FieldsQueryResult as FieldsQueryResult, type context$3_FindOrCreateExtendedFieldRequest as FindOrCreateExtendedFieldRequest, type context$3_FindOrCreateExtendedFieldResponse as FindOrCreateExtendedFieldResponse, type context$3_FindOrCreateExtendedFieldResponseNonNullableFields as FindOrCreateExtendedFieldResponseNonNullableFields, type GdprListRequest$1 as GdprListRequest, type GdprListResponse$1 as GdprListResponse, type context$3_GetExtendedFieldByLegacyIdRequest as GetExtendedFieldByLegacyIdRequest, type context$3_GetExtendedFieldByLegacyIdResponse as GetExtendedFieldByLegacyIdResponse, type context$3_GetExtendedFieldRequest as GetExtendedFieldRequest, type context$3_GetExtendedFieldResponse as GetExtendedFieldResponse, type context$3_GetExtendedFieldResponseNonNullableFields as GetExtendedFieldResponseNonNullableFields, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type context$3_ListExtendedFieldsRequest as ListExtendedFieldsRequest, type context$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 context$3_QueryExtendedFieldsRequest as QueryExtendedFieldsRequest, type context$3_QueryExtendedFieldsResponse as QueryExtendedFieldsResponse, type context$3_QueryExtendedFieldsResponseNonNullableFields as QueryExtendedFieldsResponseNonNullableFields, type context$3_RenameExtendedField as RenameExtendedField, type RestoreInfo$1 as RestoreInfo, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, type context$3_UpdateExtendedFieldRequest as UpdateExtendedFieldRequest, type context$3_UpdateExtendedFieldResponse as UpdateExtendedFieldResponse, type context$3_UpdateExtendedFieldResponseNonNullableFields as UpdateExtendedFieldResponseNonNullableFields, WebhookIdentityType$3 as WebhookIdentityType, type context$3__publicOnExtendedFieldCreatedType as _publicOnExtendedFieldCreatedType, type context$3__publicOnExtendedFieldDeletedType as _publicOnExtendedFieldDeletedType, type context$3__publicOnExtendedFieldUpdatedType as _publicOnExtendedFieldUpdatedType, context$3_deleteExtendedField as deleteExtendedField, context$3_findOrCreateExtendedField as findOrCreateExtendedField, context$3_getExtendedField as getExtendedField, context$3_onExtendedFieldCreated as onExtendedFieldCreated, context$3_onExtendedFieldDeleted as onExtendedFieldDeleted, context$3_onExtendedFieldUpdated as onExtendedFieldUpdated, onExtendedFieldCreated$1 as publicOnExtendedFieldCreated, onExtendedFieldDeleted$1 as publicOnExtendedFieldDeleted, onExtendedFieldUpdated$1 as publicOnExtendedFieldUpdated, context$3_queryExtendedFields as queryExtendedFields, context$3_renameExtendedField as renameExtendedField };
4944
3988
  }
4945
3989
 
4946
- type HostModule$2<T, H extends Host$2> = {
4947
- __type: 'host';
4948
- create(host: H): T;
4949
- };
4950
- type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
4951
- type Host$2<Environment = unknown> = {
4952
- channel: {
4953
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
4954
- disconnect: () => void;
4955
- } | Promise<{
4956
- disconnect: () => void;
4957
- }>;
4958
- };
4959
- environment?: Environment;
3990
+ /** Label that was found or created. */
3991
+ interface ContactLabel {
4960
3992
  /**
4961
- * Optional name of the environment, use for logging
3993
+ * Label namespace.
3994
+ *
3995
+ * Labels created by site admins or 3rd-party apps
3996
+ * are automatically assigned to the `custom` namespace.
3997
+ * @readonly
4962
3998
  */
4963
- name?: string;
3999
+ namespace?: string | null;
4964
4000
  /**
4965
- * Optional bast url to use for API requests, for example `www.wixapis.com`
4001
+ * Display name for the namespace,
4002
+ * used to organize the list of labels in the site Dashboard.
4003
+ * @readonly
4966
4004
  */
4967
- apiBaseUrl?: string;
4005
+ namespaceDisplayName?: string | null;
4968
4006
  /**
4969
- * Possible data to be provided by every host, for cross cutting concerns
4970
- * like internationalization, billing, etc.
4007
+ * Label key.
4008
+ *
4009
+ * `key` is generated when the label is created.
4010
+ * It cannot be modified, even if `displayName` is updated.
4011
+ * @readonly
4971
4012
  */
4972
- essentials?: {
4973
- /**
4974
- * The language of the currently viewed session
4975
- */
4976
- language?: string;
4977
- /**
4978
- * The locale of the currently viewed session
4979
- */
4980
- locale?: string;
4981
- /**
4982
- * Any headers that should be passed through to the API requests
4983
- */
4984
- passThroughHeaders?: Record<string, string>;
4985
- };
4986
- };
4987
-
4988
- type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
4989
- interface HttpClient$2 {
4990
- request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
4991
- fetchWithAuth: typeof fetch;
4992
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
4993
- getActiveToken?: () => string | undefined;
4013
+ key?: string;
4014
+ /** Label display name shown in the Dashboard. */
4015
+ displayName?: string;
4016
+ /**
4017
+ * Label type.
4018
+ *
4019
+ * - `"SYSTEM"`: The label is a default system label for the Contact List.
4020
+ * - `"USER_DEFINED"`: The label was created by a site contributor or 3rd-party app.
4021
+ * - `"WIX_APP_DEFINED"`: The label was created by a Wix app.
4022
+ * @readonly
4023
+ */
4024
+ labelType?: LabelType;
4025
+ /**
4026
+ * Date and time the label was created.
4027
+ * @readonly
4028
+ */
4029
+ _createdDate?: Date;
4030
+ /**
4031
+ * Date and time the label was last updated.
4032
+ * @readonly
4033
+ */
4034
+ _updatedDate?: Date;
4994
4035
  }
4995
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
4996
- type HttpResponse$2<T = any> = {
4997
- data: T;
4998
- status: number;
4999
- statusText: string;
5000
- headers: any;
5001
- request?: any;
5002
- };
5003
- type RequestOptions$2<_TResponse = any, Data = any> = {
5004
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
5005
- url: string;
5006
- data?: Data;
5007
- params?: URLSearchParams;
5008
- } & APIMetadata$2;
5009
- type APIMetadata$2 = {
5010
- methodFqn?: string;
5011
- entityFqdn?: string;
5012
- packageName?: string;
5013
- };
5014
- type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
5015
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
5016
- __type: 'event-definition';
5017
- type: Type;
5018
- isDomainEvent?: boolean;
5019
- transformations?: (envelope: unknown) => Payload;
5020
- __payload: Payload;
5021
- };
5022
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
5023
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
5024
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
5025
-
5026
- type ServicePluginMethodInput$2 = {
5027
- request: any;
5028
- metadata: any;
5029
- };
5030
- type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
5031
- type ServicePluginMethodMetadata$2 = {
5032
- name: string;
5033
- primaryHttpMappingPath: string;
5034
- transformations: {
5035
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
5036
- toREST: (...args: unknown[]) => unknown;
5037
- };
5038
- };
5039
- type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
5040
- __type: 'service-plugin-definition';
5041
- componentType: string;
5042
- methods: ServicePluginMethodMetadata$2[];
5043
- __contract: Contract;
5044
- };
5045
- declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
5046
- type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
5047
- declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
5048
-
5049
- type RequestContext$2 = {
5050
- isSSR: boolean;
5051
- host: string;
5052
- protocol?: string;
5053
- };
5054
- type ResponseTransformer$2 = (data: any, headers?: any) => any;
5055
- /**
5056
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
5057
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
5058
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
5059
- */
5060
- type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
5061
- type AmbassadorRequestOptions$2<T = any> = {
5062
- _?: T;
5063
- url?: string;
5064
- method?: Method$2;
5065
- params?: any;
5066
- data?: any;
5067
- transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
5068
- };
5069
- type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
5070
- __isAmbassador: boolean;
5071
- };
5072
- type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
5073
- type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
5074
-
5075
- declare global {
5076
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5077
- interface SymbolConstructor {
5078
- readonly observable: symbol;
5079
- }
4036
+ declare enum LabelType {
4037
+ /** Need UNKNOWN to be able to fetch all labels */
4038
+ UNKNOWN = "UNKNOWN",
4039
+ SYSTEM = "SYSTEM",
4040
+ USER_DEFINED = "USER_DEFINED",
4041
+ WIX_APP_DEFINED = "WIX_APP_DEFINED"
5080
4042
  }
5081
-
5082
- declare const emptyObjectSymbol$2: unique symbol;
5083
-
5084
- /**
5085
- Represents a strictly empty plain object, the `{}` value.
5086
-
5087
- 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)).
5088
-
5089
- @example
5090
- ```
5091
- import type {EmptyObject} from 'type-fest';
5092
-
5093
- // The following illustrates the problem with `{}`.
5094
- const foo1: {} = {}; // Pass
5095
- const foo2: {} = []; // Pass
5096
- const foo3: {} = 42; // Pass
5097
- const foo4: {} = {a: 1}; // Pass
5098
-
5099
- // With `EmptyObject` only the first case is valid.
5100
- const bar1: EmptyObject = {}; // Pass
5101
- const bar2: EmptyObject = 42; // Fail
5102
- const bar3: EmptyObject = []; // Fail
5103
- const bar4: EmptyObject = {a: 1}; // Fail
5104
- ```
5105
-
5106
- 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}.
5107
-
5108
- @category Object
5109
- */
5110
- type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
5111
-
5112
- /**
5113
- Returns a boolean for whether the two given types are equal.
5114
-
5115
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
5116
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
5117
-
5118
- Use-cases:
5119
- - If you want to make a conditional branch based on the result of a comparison of two types.
5120
-
5121
- @example
5122
- ```
5123
- import type {IsEqual} from 'type-fest';
5124
-
5125
- // This type returns a boolean for whether the given array includes the given item.
5126
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
5127
- type Includes<Value extends readonly any[], Item> =
5128
- Value extends readonly [Value[0], ...infer rest]
5129
- ? IsEqual<Value[0], Item> extends true
5130
- ? true
5131
- : Includes<rest, Item>
5132
- : false;
5133
- ```
5134
-
5135
- @category Type Guard
5136
- @category Utilities
5137
- */
5138
- type IsEqual$2<A, B> =
5139
- (<G>() => G extends A ? 1 : 2) extends
5140
- (<G>() => G extends B ? 1 : 2)
5141
- ? true
5142
- : false;
5143
-
5144
- /**
5145
- Filter out keys from an object.
5146
-
5147
- Returns `never` if `Exclude` is strictly equal to `Key`.
5148
- Returns `never` if `Key` extends `Exclude`.
5149
- Returns `Key` otherwise.
5150
-
5151
- @example
5152
- ```
5153
- type Filtered = Filter<'foo', 'foo'>;
5154
- //=> never
5155
- ```
5156
-
5157
- @example
5158
- ```
5159
- type Filtered = Filter<'bar', string>;
5160
- //=> never
5161
- ```
5162
-
5163
- @example
5164
- ```
5165
- type Filtered = Filter<'bar', 'foo'>;
5166
- //=> 'bar'
5167
- ```
5168
-
5169
- @see {Except}
5170
- */
5171
- type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
5172
-
5173
- type ExceptOptions$2 = {
5174
- /**
5175
- Disallow assigning non-specified properties.
5176
-
5177
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
5178
-
5179
- @default false
5180
- */
5181
- requireExactProps?: boolean;
5182
- };
5183
-
5184
- /**
5185
- Create a type from an object type without certain keys.
5186
-
5187
- We recommend setting the `requireExactProps` option to `true`.
5188
-
5189
- 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.
5190
-
5191
- 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)).
5192
-
5193
- @example
5194
- ```
5195
- import type {Except} from 'type-fest';
5196
-
5197
- type Foo = {
5198
- a: number;
5199
- b: string;
5200
- };
5201
-
5202
- type FooWithoutA = Except<Foo, 'a'>;
5203
- //=> {b: string}
5204
-
5205
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
5206
- //=> errors: 'a' does not exist in type '{ b: string; }'
5207
-
5208
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
5209
- //=> {a: number} & Partial<Record<"b", never>>
5210
-
5211
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
5212
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
5213
- ```
5214
-
5215
- @category Object
5216
- */
5217
- type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
5218
- [KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
5219
- } & (Options['requireExactProps'] extends true
5220
- ? Partial<Record<KeysType, never>>
5221
- : {});
5222
-
5223
- /**
5224
- Returns a boolean for whether the given type is `never`.
5225
-
5226
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
5227
- @link https://stackoverflow.com/a/53984913/10292952
5228
- @link https://www.zhenghao.io/posts/ts-never
5229
-
5230
- Useful in type utilities, such as checking if something does not occur.
5231
-
5232
- @example
5233
- ```
5234
- import type {IsNever, And} from 'type-fest';
5235
-
5236
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
5237
- type AreStringsEqual<A extends string, B extends string> =
5238
- And<
5239
- IsNever<Exclude<A, B>> extends true ? true : false,
5240
- IsNever<Exclude<B, A>> extends true ? true : false
5241
- >;
5242
-
5243
- type EndIfEqual<I extends string, O extends string> =
5244
- AreStringsEqual<I, O> extends true
5245
- ? never
5246
- : void;
5247
-
5248
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
5249
- if (input === output) {
5250
- process.exit(0);
5251
- }
5252
- }
5253
-
5254
- endIfEqual('abc', 'abc');
5255
- //=> never
5256
-
5257
- endIfEqual('abc', '123');
5258
- //=> void
5259
- ```
5260
-
5261
- @category Type Guard
5262
- @category Utilities
5263
- */
5264
- type IsNever$2<T> = [T] extends [never] ? true : false;
5265
-
5266
- /**
5267
- An if-else-like type that resolves depending on whether the given type is `never`.
5268
-
5269
- @see {@link IsNever}
5270
-
5271
- @example
5272
- ```
5273
- import type {IfNever} from 'type-fest';
5274
-
5275
- type ShouldBeTrue = IfNever<never>;
5276
- //=> true
5277
-
5278
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
5279
- //=> 'bar'
5280
- ```
5281
-
5282
- @category Type Guard
5283
- @category Utilities
5284
- */
5285
- type IfNever$2<T, TypeIfNever = true, TypeIfNotNever = false> = (
5286
- IsNever$2<T> extends true ? TypeIfNever : TypeIfNotNever
5287
- );
5288
-
5289
- /**
5290
- Extract the keys from a type where the value type of the key extends the given `Condition`.
5291
-
5292
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
5293
-
5294
- @example
5295
- ```
5296
- import type {ConditionalKeys} from 'type-fest';
5297
-
5298
- interface Example {
5299
- a: string;
5300
- b: string | number;
5301
- c?: string;
5302
- d: {};
5303
- }
5304
-
5305
- type StringKeysOnly = ConditionalKeys<Example, string>;
5306
- //=> 'a'
5307
- ```
5308
-
5309
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
5310
-
5311
- @example
5312
- ```
5313
- import type {ConditionalKeys} from 'type-fest';
5314
-
5315
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
5316
- //=> 'a' | 'c'
5317
- ```
5318
-
5319
- @category Object
5320
- */
5321
- type ConditionalKeys$2<Base, Condition> =
5322
- {
5323
- // Map through all the keys of the given base type.
5324
- [Key in keyof Base]-?:
5325
- // Pick only keys with types extending the given `Condition` type.
5326
- Base[Key] extends Condition
5327
- // Retain this key
5328
- // If the value for the key extends never, only include it if `Condition` also extends never
5329
- ? IfNever$2<Base[Key], IfNever$2<Condition, Key, never>, Key>
5330
- // Discard this key since the condition fails.
5331
- : never;
5332
- // Convert the produced object into a union type of the keys which passed the conditional test.
5333
- }[keyof Base];
5334
-
5335
- /**
5336
- Exclude keys from a shape that matches the given `Condition`.
5337
-
5338
- 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.
5339
-
5340
- @example
5341
- ```
5342
- import type {Primitive, ConditionalExcept} from 'type-fest';
5343
-
5344
- class Awesome {
5345
- name: string;
5346
- successes: number;
5347
- failures: bigint;
5348
-
5349
- run() {}
5350
- }
5351
-
5352
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
5353
- //=> {run: () => void}
5354
- ```
5355
-
5356
- @example
5357
- ```
5358
- import type {ConditionalExcept} from 'type-fest';
5359
-
5360
- interface Example {
5361
- a: string;
5362
- b: string | number;
5363
- c: () => void;
5364
- d: {};
5365
- }
5366
-
5367
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
5368
- //=> {b: string | number; c: () => void; d: {}}
5369
- ```
5370
-
5371
- @category Object
5372
- */
5373
- type ConditionalExcept$2<Base, Condition> = Except$2<
5374
- Base,
5375
- ConditionalKeys$2<Base, Condition>
5376
- >;
5377
-
5378
- /**
5379
- * Descriptors are objects that describe the API of a module, and the module
5380
- * can either be a REST module or a host module.
5381
- * This type is recursive, so it can describe nested modules.
5382
- */
5383
- type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$2<any> | ServicePluginDefinition$2<any> | {
5384
- [key: string]: Descriptors$2 | PublicMetadata$2 | any;
5385
- };
5386
- /**
5387
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
5388
- * and returns an object with the same structure, but with all descriptors replaced with their API.
5389
- * Any non-descriptor properties are removed from the returned object, including descriptors that
5390
- * do not match the given host (as they will not work with the given host).
5391
- */
5392
- type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
5393
- done: T;
5394
- recurse: T extends {
5395
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
5396
- } ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
5397
- [Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
5398
- -1,
5399
- 0,
5400
- 1,
5401
- 2,
5402
- 3,
5403
- 4,
5404
- 5
5405
- ][Depth]> : never;
5406
- }, EmptyObject$2>;
5407
- }[Depth extends -1 ? 'done' : 'recurse'];
5408
- type PublicMetadata$2 = {
5409
- PACKAGE_NAME?: string;
5410
- };
5411
-
5412
- declare global {
5413
- interface ContextualClient {
5414
- }
5415
- }
5416
- /**
5417
- * A type used to create concerete types from SDK descriptors in
5418
- * case a contextual client is available.
5419
- */
5420
- type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
5421
- host: Host$2;
5422
- } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
5423
-
5424
- /** Label that was found or created. */
5425
- interface ContactLabel {
5426
- /**
5427
- * Label namespace.
5428
- *
5429
- * Labels created by site admins or 3rd-party apps
5430
- * are automatically assigned to the `custom` namespace.
5431
- * @readonly
5432
- */
5433
- namespace?: string | null;
5434
- /**
5435
- * Display name for the namespace,
5436
- * used to organize the list of labels in the site Dashboard.
5437
- * @readonly
5438
- */
5439
- namespaceDisplayName?: string | null;
5440
- /**
5441
- * Label key.
5442
- *
5443
- * `key` is generated when the label is created.
5444
- * It cannot be modified, even if `displayName` is updated.
5445
- * @readonly
5446
- */
5447
- key?: string;
5448
- /** Label display name shown in the Dashboard. */
5449
- displayName?: string;
5450
- /**
5451
- * Label type.
5452
- *
5453
- * - `"SYSTEM"`: The label is a default system label for the Contact List.
5454
- * - `"USER_DEFINED"`: The label was created by a site contributor or 3rd-party app.
5455
- * - `"WIX_APP_DEFINED"`: The label was created by a Wix app.
5456
- * @readonly
5457
- */
5458
- labelType?: LabelType;
5459
- /**
5460
- * Date and time the label was created.
5461
- * @readonly
5462
- */
5463
- _createdDate?: Date;
5464
- /**
5465
- * Date and time the label was last updated.
5466
- * @readonly
5467
- */
5468
- _updatedDate?: Date;
5469
- }
5470
- declare enum LabelType {
5471
- /** Need UNKNOWN to be able to fetch all labels */
5472
- UNKNOWN = "UNKNOWN",
5473
- SYSTEM = "SYSTEM",
5474
- USER_DEFINED = "USER_DEFINED",
5475
- WIX_APP_DEFINED = "WIX_APP_DEFINED"
5476
- }
5477
- /** Label filter options. */
5478
- interface ListLabelsRequest {
5479
- /** Filter for labels of the specified type. */
5480
- labelType?: LabelType;
5481
- /** Filter for labels in the specified namespace. */
5482
- namespace?: string | null;
5483
- /** Filter for labels where `displayName` starts with the specified case-sensitive string. */
5484
- startsWith?: string | null;
5485
- /** Sorting options. */
5486
- sort?: Sorting$1;
5487
- /** Paging options. */
5488
- paging?: Paging$1;
5489
- /** Language for localization. */
5490
- language?: string | null;
4043
+ /** Label filter options. */
4044
+ interface ListLabelsRequest {
4045
+ /** Filter for labels of the specified type. */
4046
+ labelType?: LabelType;
4047
+ /** Filter for labels in the specified namespace. */
4048
+ namespace?: string | null;
4049
+ /** Filter for labels where `displayName` starts with the specified case-sensitive string. */
4050
+ startsWith?: string | null;
4051
+ /** Sorting options. */
4052
+ sort?: Sorting$1;
4053
+ /** Paging options. */
4054
+ paging?: Paging$1;
4055
+ /** Language for localization. */
4056
+ language?: string | null;
5491
4057
  }
5492
4058
  interface Sorting$1 {
5493
4059
  /** Name of the field to sort by. */
@@ -6015,7 +4581,7 @@ interface LabelsQueryBuilder {
6015
4581
  find: () => Promise<LabelsQueryResult>;
6016
4582
  }
6017
4583
 
6018
- declare function findOrCreateLabel$1(httpClient: HttpClient$2): FindOrCreateLabelSignature;
4584
+ declare function findOrCreateLabel$1(httpClient: HttpClient): FindOrCreateLabelSignature;
6019
4585
  interface FindOrCreateLabelSignature {
6020
4586
  /**
6021
4587
  * Retrieves a label with a given name, or creates one if it doesn't exist.
@@ -6038,7 +4604,7 @@ interface FindOrCreateLabelSignature {
6038
4604
  */
6039
4605
  (displayName: string, options?: FindOrCreateLabelOptions | undefined): Promise<FindOrCreateLabelResponse & FindOrCreateLabelResponseNonNullableFields>;
6040
4606
  }
6041
- declare function getLabel$1(httpClient: HttpClient$2): GetLabelSignature;
4607
+ declare function getLabel$1(httpClient: HttpClient): GetLabelSignature;
6042
4608
  interface GetLabelSignature {
6043
4609
  /**
6044
4610
  * Retrieves a label by the specified label key.
@@ -6053,7 +4619,7 @@ interface GetLabelSignature {
6053
4619
  */
6054
4620
  (key: string, options?: GetLabelOptions | undefined): Promise<ContactLabel & ContactLabelNonNullableFields>;
6055
4621
  }
6056
- declare function renameLabel$1(httpClient: HttpClient$2): RenameLabelSignature;
4622
+ declare function renameLabel$1(httpClient: HttpClient): RenameLabelSignature;
6057
4623
  interface RenameLabelSignature {
6058
4624
  /**
6059
4625
  * Renames a label.
@@ -6070,7 +4636,7 @@ interface RenameLabelSignature {
6070
4636
  */
6071
4637
  (key: string, label: RenameLabel, options?: RenameLabelOptions | undefined): Promise<ContactLabel & ContactLabelNonNullableFields>;
6072
4638
  }
6073
- declare function deleteLabel$1(httpClient: HttpClient$2): DeleteLabelSignature;
4639
+ declare function deleteLabel$1(httpClient: HttpClient): DeleteLabelSignature;
6074
4640
  interface DeleteLabelSignature {
6075
4641
  /**
6076
4642
  * Deletes a label from the site and removes it from contacts it applies to.
@@ -6082,7 +4648,7 @@ interface DeleteLabelSignature {
6082
4648
  */
6083
4649
  (key: string): Promise<void>;
6084
4650
  }
6085
- declare function queryLabels$1(httpClient: HttpClient$2): QueryLabelsSignature;
4651
+ declare function queryLabels$1(httpClient: HttpClient): QueryLabelsSignature;
6086
4652
  interface QueryLabelsSignature {
6087
4653
  /**
6088
4654
  * Creates a query to retrieve a list of labels.
@@ -6105,17 +4671,17 @@ interface QueryLabelsSignature {
6105
4671
  */
6106
4672
  (options?: QueryLabelsOptions | undefined): LabelsQueryBuilder;
6107
4673
  }
6108
- declare const onLabelCreated$1: EventDefinition$2<LabelCreatedEnvelope, "wix.contacts.v4.label_created">;
6109
- declare const onLabelUpdated$1: EventDefinition$2<LabelUpdatedEnvelope, "wix.contacts.v4.label_updated">;
6110
- declare const onLabelDeleted$1: EventDefinition$2<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">;
6111
4677
 
6112
- declare function createEventModule$1<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
4678
+ declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
6113
4679
 
6114
- declare const findOrCreateLabel: MaybeContext$2<BuildRESTFunction$2<typeof findOrCreateLabel$1> & typeof findOrCreateLabel$1>;
6115
- declare const getLabel: MaybeContext$2<BuildRESTFunction$2<typeof getLabel$1> & typeof getLabel$1>;
6116
- declare const renameLabel: MaybeContext$2<BuildRESTFunction$2<typeof renameLabel$1> & typeof renameLabel$1>;
6117
- declare const deleteLabel: MaybeContext$2<BuildRESTFunction$2<typeof deleteLabel$1> & typeof deleteLabel$1>;
6118
- declare const queryLabels: MaybeContext$2<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>;
6119
4685
 
6120
4686
  type _publicOnLabelCreatedType = typeof onLabelCreated$1;
6121
4687
  /**
@@ -6193,614 +4759,136 @@ declare namespace context$2 {
6193
4759
  export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type context$2_ContactLabel as ContactLabel, type context$2_ContactLabelNamespace as ContactLabelNamespace, type context$2_ContactLabelNonNullableFields as ContactLabelNonNullableFields, type context$2_DeleteLabelRequest as DeleteLabelRequest, type context$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 context$2_FindOrCreateLabelOptions as FindOrCreateLabelOptions, type context$2_FindOrCreateLabelRequest as FindOrCreateLabelRequest, type context$2_FindOrCreateLabelResponse as FindOrCreateLabelResponse, type context$2_FindOrCreateLabelResponseNonNullableFields as FindOrCreateLabelResponseNonNullableFields, type context$2_GdprListRequest as GdprListRequest, type context$2_GdprListResponse as GdprListResponse, type context$2_GetLabelByLegacyIdRequest as GetLabelByLegacyIdRequest, type context$2_GetLabelByLegacyIdResponse as GetLabelByLegacyIdResponse, type context$2_GetLabelOptions as GetLabelOptions, type context$2_GetLabelRequest as GetLabelRequest, type context$2_GetLabelResponse as GetLabelResponse, type context$2_GetLabelResponseNonNullableFields as GetLabelResponseNonNullableFields, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type context$2_LabelCreatedEnvelope as LabelCreatedEnvelope, type context$2_LabelDeletedEnvelope as LabelDeletedEnvelope, context$2_LabelType as LabelType, type context$2_LabelUpdatedEnvelope as LabelUpdatedEnvelope, type context$2_LabelsQueryBuilder as LabelsQueryBuilder, type context$2_LabelsQueryResult as LabelsQueryResult, type context$2_LabelsQuotaReached as LabelsQuotaReached, type context$2_ListLabelNamespacesRequest as ListLabelNamespacesRequest, type context$2_ListLabelNamespacesResponse as ListLabelNamespacesResponse, type context$2_ListLabelsRequest as ListLabelsRequest, type context$2_ListLabelsResponse as ListLabelsResponse, type MessageEnvelope$2 as MessageEnvelope, type Paging$1 as Paging, type context$2_PagingMetadata as PagingMetadata, type context$2_PurgeRequest as PurgeRequest, type context$2_PurgeResponse as PurgeResponse, type context$2_Query as Query, type context$2_QueryLabelsOptions as QueryLabelsOptions, type context$2_QueryLabelsRequest as QueryLabelsRequest, type context$2_QueryLabelsResponse as QueryLabelsResponse, type context$2_QueryLabelsResponseNonNullableFields as QueryLabelsResponseNonNullableFields, type context$2_RenameLabel as RenameLabel, type context$2_RenameLabelOptions as RenameLabelOptions, type context$2_RestoreInfo as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, type context$2_UpdateLabelRequest as UpdateLabelRequest, type context$2_UpdateLabelResponse as UpdateLabelResponse, type context$2_UpdateLabelResponseNonNullableFields as UpdateLabelResponseNonNullableFields, WebhookIdentityType$2 as WebhookIdentityType, type context$2__publicOnLabelCreatedType as _publicOnLabelCreatedType, type context$2__publicOnLabelDeletedType as _publicOnLabelDeletedType, type context$2__publicOnLabelUpdatedType as _publicOnLabelUpdatedType, context$2_deleteLabel as deleteLabel, context$2_findOrCreateLabel as findOrCreateLabel, context$2_getLabel as getLabel, context$2_onLabelCreated as onLabelCreated, context$2_onLabelDeleted as onLabelDeleted, context$2_onLabelUpdated as onLabelUpdated, onLabelCreated$1 as publicOnLabelCreated, onLabelDeleted$1 as publicOnLabelDeleted, onLabelUpdated$1 as publicOnLabelUpdated, context$2_queryLabels as queryLabels, context$2_renameLabel as renameLabel };
6194
4760
  }
6195
4761
 
6196
- type HostModule$1<T, H extends Host$1> = {
6197
- __type: 'host';
6198
- create(host: H): T;
6199
- };
6200
- type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
6201
- type Host$1<Environment = unknown> = {
6202
- channel: {
6203
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
6204
- disconnect: () => void;
6205
- } | Promise<{
6206
- disconnect: () => void;
6207
- }>;
6208
- };
6209
- environment?: Environment;
4762
+ /** Dummy message for fqdn validation */
4763
+ interface SubmitContact {
4764
+ /** Submit Contact Id */
4765
+ _id?: string | null;
4766
+ }
4767
+ interface SubmitContactRequest {
6210
4768
  /**
6211
- * Optional name of the environment, use for logging
4769
+ * Contact's information.
4770
+ * To reconcile with an existing contact,
4771
+ * a phone or email must be provided,
4772
+ * or the current session identity must be attached to a contact or member.
4773
+ *
4774
+ * If no existing contact can be found,
4775
+ * a new contact is created with the specified information.
4776
+ *
4777
+ * <!--ONLY:REST-->
4778
+ * Required if there's no contextual identity or given `contactId`.
4779
+ * <!--END:ONLY:REST-->
6212
4780
  */
6213
- name?: string;
4781
+ info?: ContactInfo$1;
4782
+ /** Pass through data, to be posted on Contact Submitted Domain Event (optional). */
4783
+ passThroughData?: string | null;
6214
4784
  /**
6215
- * Optional bast url to use for API requests, for example `www.wixapis.com`
4785
+ * Existing Contact ID (optional).
4786
+ * Requires permission `CONTACTS.SUBMIT_WITH_OVERRIDES`
6216
4787
  */
6217
- apiBaseUrl?: string;
4788
+ contactId?: string | null;
4789
+ }
4790
+ interface ContactInfo$1 {
4791
+ /** Contact's first and last name. */
4792
+ name?: ContactName;
4793
+ /** Contact's email addresses. */
4794
+ emails?: ContactEmailsWrapper;
4795
+ /** Contact's phone numbers. */
4796
+ phones?: ContactPhonesWrapper;
4797
+ /** Contact's street addresses. */
4798
+ addresses?: ContactAddressesWrapper;
4799
+ /** Contact's company name. */
4800
+ company?: string | null;
6218
4801
  /**
6219
- * Possible data to be provided by every host, for cross cutting concerns
6220
- * like internationalization, billing, etc.
4802
+ * Contact's job title.
4803
+ * Corresponds to the **Position** field in the Dashboard.
6221
4804
  */
6222
- essentials?: {
6223
- /**
6224
- * The language of the currently viewed session
6225
- */
6226
- language?: string;
6227
- /**
6228
- * The locale of the currently viewed session
6229
- */
6230
- locale?: string;
6231
- /**
6232
- * Any headers that should be passed through to the API requests
6233
- */
6234
- passThroughHeaders?: Record<string, string>;
6235
- };
6236
- };
6237
-
6238
- type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
6239
- interface HttpClient$1 {
6240
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
6241
- fetchWithAuth: typeof fetch;
6242
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
6243
- getActiveToken?: () => string | undefined;
4805
+ jobTitle?: string | null;
4806
+ /** Birth date in `YYYY-MM-DD` format. For example, `2020-03-15`. */
4807
+ birthdate?: string | null;
4808
+ /**
4809
+ * Locale in
4810
+ * [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
4811
+ * Typically, this is a lowercase 2-letter language code,
4812
+ * followed by a hyphen, followed by an uppercase 2-letter country code.
4813
+ * For example, `en-US` for U.S. English, and `de-DE` for Germany German.
4814
+ */
4815
+ locale?: string | null;
4816
+ /**
4817
+ * List of contact's labels.
4818
+ * Labels are used to organize contacts.
4819
+ * When setting the `labelKeys` property,
4820
+ * only labels that already exist in the site's Contacts List can be used.
4821
+ * Labels can be added and removed using
4822
+ * [Label Contact](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/label-contact) and
4823
+ * [Unlabel Contact](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/unlabel-contact),
4824
+ * respectively.
4825
+ *
4826
+ * To view or manage site labels, use the
4827
+ * [Labels API](https://dev.wix.com/api/rest/contacts/labels).
4828
+ */
4829
+ labelKeys?: LabelsWrapper;
4830
+ /**
4831
+ * Additional custom fields.
4832
+ * This includes fields managed by Wix, by 3rd-party apps, and by the site.
4833
+ *
4834
+ * Empty fields are not returned.
4835
+ */
4836
+ extendedFields?: ExtendedFieldsWrapper;
4837
+ /** Contact's profile picture. */
4838
+ picture?: ContactPicture;
6244
4839
  }
6245
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
6246
- type HttpResponse$1<T = any> = {
6247
- data: T;
6248
- status: number;
6249
- statusText: string;
6250
- headers: any;
6251
- request?: any;
6252
- };
6253
- type RequestOptions$1<_TResponse = any, Data = any> = {
6254
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
6255
- url: string;
6256
- data?: Data;
6257
- params?: URLSearchParams;
6258
- } & APIMetadata$1;
6259
- type APIMetadata$1 = {
6260
- methodFqn?: string;
6261
- entityFqdn?: string;
6262
- packageName?: string;
6263
- };
6264
- type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
6265
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
6266
- __type: 'event-definition';
6267
- type: Type;
6268
- isDomainEvent?: boolean;
6269
- transformations?: (envelope: unknown) => Payload;
6270
- __payload: Payload;
6271
- };
6272
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
6273
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
6274
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
6275
-
6276
- type ServicePluginMethodInput$1 = {
6277
- request: any;
6278
- metadata: any;
6279
- };
6280
- type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
6281
- type ServicePluginMethodMetadata$1 = {
6282
- name: string;
6283
- primaryHttpMappingPath: string;
6284
- transformations: {
6285
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
6286
- toREST: (...args: unknown[]) => unknown;
6287
- };
6288
- };
6289
- type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
6290
- __type: 'service-plugin-definition';
6291
- componentType: string;
6292
- methods: ServicePluginMethodMetadata$1[];
6293
- __contract: Contract;
6294
- };
6295
- declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
6296
- type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
6297
- declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
6298
-
6299
- type RequestContext$1 = {
6300
- isSSR: boolean;
6301
- host: string;
6302
- protocol?: string;
6303
- };
6304
- type ResponseTransformer$1 = (data: any, headers?: any) => any;
6305
- /**
6306
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
6307
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
6308
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
6309
- */
6310
- type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
6311
- type AmbassadorRequestOptions$1<T = any> = {
6312
- _?: T;
6313
- url?: string;
6314
- method?: Method$1;
6315
- params?: any;
6316
- data?: any;
6317
- transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
6318
- };
6319
- type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
6320
- __isAmbassador: boolean;
6321
- };
6322
- type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
6323
- type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
6324
-
6325
- declare global {
6326
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
6327
- interface SymbolConstructor {
6328
- readonly observable: symbol;
6329
- }
4840
+ interface ContactName {
4841
+ /** Contact's first name. */
4842
+ first?: string | null;
4843
+ /** Contact's last name. */
4844
+ last?: string | null;
6330
4845
  }
6331
-
6332
- declare const emptyObjectSymbol$1: unique symbol;
6333
-
6334
- /**
6335
- Represents a strictly empty plain object, the `{}` value.
6336
-
6337
- 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)).
6338
-
6339
- @example
6340
- ```
6341
- import type {EmptyObject} from 'type-fest';
6342
-
6343
- // The following illustrates the problem with `{}`.
6344
- const foo1: {} = {}; // Pass
6345
- const foo2: {} = []; // Pass
6346
- const foo3: {} = 42; // Pass
6347
- const foo4: {} = {a: 1}; // Pass
6348
-
6349
- // With `EmptyObject` only the first case is valid.
6350
- const bar1: EmptyObject = {}; // Pass
6351
- const bar2: EmptyObject = 42; // Fail
6352
- const bar3: EmptyObject = []; // Fail
6353
- const bar4: EmptyObject = {a: 1}; // Fail
6354
- ```
6355
-
6356
- 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}.
6357
-
6358
- @category Object
6359
- */
6360
- type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
6361
-
6362
- /**
6363
- Returns a boolean for whether the two given types are equal.
6364
-
6365
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
6366
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
6367
-
6368
- Use-cases:
6369
- - If you want to make a conditional branch based on the result of a comparison of two types.
6370
-
6371
- @example
6372
- ```
6373
- import type {IsEqual} from 'type-fest';
6374
-
6375
- // This type returns a boolean for whether the given array includes the given item.
6376
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
6377
- type Includes<Value extends readonly any[], Item> =
6378
- Value extends readonly [Value[0], ...infer rest]
6379
- ? IsEqual<Value[0], Item> extends true
6380
- ? true
6381
- : Includes<rest, Item>
6382
- : false;
6383
- ```
6384
-
6385
- @category Type Guard
6386
- @category Utilities
6387
- */
6388
- type IsEqual$1<A, B> =
6389
- (<G>() => G extends A ? 1 : 2) extends
6390
- (<G>() => G extends B ? 1 : 2)
6391
- ? true
6392
- : false;
6393
-
6394
- /**
6395
- Filter out keys from an object.
6396
-
6397
- Returns `never` if `Exclude` is strictly equal to `Key`.
6398
- Returns `never` if `Key` extends `Exclude`.
6399
- Returns `Key` otherwise.
6400
-
6401
- @example
6402
- ```
6403
- type Filtered = Filter<'foo', 'foo'>;
6404
- //=> never
6405
- ```
6406
-
6407
- @example
6408
- ```
6409
- type Filtered = Filter<'bar', string>;
6410
- //=> never
6411
- ```
6412
-
6413
- @example
6414
- ```
6415
- type Filtered = Filter<'bar', 'foo'>;
6416
- //=> 'bar'
6417
- ```
6418
-
6419
- @see {Except}
6420
- */
6421
- type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
6422
-
6423
- type ExceptOptions$1 = {
6424
- /**
6425
- Disallow assigning non-specified properties.
6426
-
6427
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
6428
-
6429
- @default false
6430
- */
6431
- requireExactProps?: boolean;
6432
- };
6433
-
6434
- /**
6435
- Create a type from an object type without certain keys.
6436
-
6437
- We recommend setting the `requireExactProps` option to `true`.
6438
-
6439
- 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.
6440
-
6441
- 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)).
6442
-
6443
- @example
6444
- ```
6445
- import type {Except} from 'type-fest';
6446
-
6447
- type Foo = {
6448
- a: number;
6449
- b: string;
6450
- };
6451
-
6452
- type FooWithoutA = Except<Foo, 'a'>;
6453
- //=> {b: string}
6454
-
6455
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
6456
- //=> errors: 'a' does not exist in type '{ b: string; }'
6457
-
6458
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
6459
- //=> {a: number} & Partial<Record<"b", never>>
6460
-
6461
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
6462
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
6463
- ```
6464
-
6465
- @category Object
6466
- */
6467
- type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
6468
- [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
6469
- } & (Options['requireExactProps'] extends true
6470
- ? Partial<Record<KeysType, never>>
6471
- : {});
6472
-
6473
- /**
6474
- Returns a boolean for whether the given type is `never`.
6475
-
6476
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
6477
- @link https://stackoverflow.com/a/53984913/10292952
6478
- @link https://www.zhenghao.io/posts/ts-never
6479
-
6480
- Useful in type utilities, such as checking if something does not occur.
6481
-
6482
- @example
6483
- ```
6484
- import type {IsNever, And} from 'type-fest';
6485
-
6486
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
6487
- type AreStringsEqual<A extends string, B extends string> =
6488
- And<
6489
- IsNever<Exclude<A, B>> extends true ? true : false,
6490
- IsNever<Exclude<B, A>> extends true ? true : false
6491
- >;
6492
-
6493
- type EndIfEqual<I extends string, O extends string> =
6494
- AreStringsEqual<I, O> extends true
6495
- ? never
6496
- : void;
6497
-
6498
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
6499
- if (input === output) {
6500
- process.exit(0);
6501
- }
6502
- }
6503
-
6504
- endIfEqual('abc', 'abc');
6505
- //=> never
6506
-
6507
- endIfEqual('abc', '123');
6508
- //=> void
6509
- ```
6510
-
6511
- @category Type Guard
6512
- @category Utilities
6513
- */
6514
- type IsNever$1<T> = [T] extends [never] ? true : false;
6515
-
6516
- /**
6517
- An if-else-like type that resolves depending on whether the given type is `never`.
6518
-
6519
- @see {@link IsNever}
6520
-
6521
- @example
6522
- ```
6523
- import type {IfNever} from 'type-fest';
6524
-
6525
- type ShouldBeTrue = IfNever<never>;
6526
- //=> true
6527
-
6528
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
6529
- //=> 'bar'
6530
- ```
6531
-
6532
- @category Type Guard
6533
- @category Utilities
6534
- */
6535
- type IfNever$1<T, TypeIfNever = true, TypeIfNotNever = false> = (
6536
- IsNever$1<T> extends true ? TypeIfNever : TypeIfNotNever
6537
- );
6538
-
6539
- /**
6540
- Extract the keys from a type where the value type of the key extends the given `Condition`.
6541
-
6542
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
6543
-
6544
- @example
6545
- ```
6546
- import type {ConditionalKeys} from 'type-fest';
6547
-
6548
- interface Example {
6549
- a: string;
6550
- b: string | number;
6551
- c?: string;
6552
- d: {};
6553
- }
6554
-
6555
- type StringKeysOnly = ConditionalKeys<Example, string>;
6556
- //=> 'a'
6557
- ```
6558
-
6559
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
6560
-
6561
- @example
6562
- ```
6563
- import type {ConditionalKeys} from 'type-fest';
6564
-
6565
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
6566
- //=> 'a' | 'c'
6567
- ```
6568
-
6569
- @category Object
6570
- */
6571
- type ConditionalKeys$1<Base, Condition> =
6572
- {
6573
- // Map through all the keys of the given base type.
6574
- [Key in keyof Base]-?:
6575
- // Pick only keys with types extending the given `Condition` type.
6576
- Base[Key] extends Condition
6577
- // Retain this key
6578
- // If the value for the key extends never, only include it if `Condition` also extends never
6579
- ? IfNever$1<Base[Key], IfNever$1<Condition, Key, never>, Key>
6580
- // Discard this key since the condition fails.
6581
- : never;
6582
- // Convert the produced object into a union type of the keys which passed the conditional test.
6583
- }[keyof Base];
6584
-
6585
- /**
6586
- Exclude keys from a shape that matches the given `Condition`.
6587
-
6588
- 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.
6589
-
6590
- @example
6591
- ```
6592
- import type {Primitive, ConditionalExcept} from 'type-fest';
6593
-
6594
- class Awesome {
6595
- name: string;
6596
- successes: number;
6597
- failures: bigint;
6598
-
6599
- run() {}
6600
- }
6601
-
6602
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
6603
- //=> {run: () => void}
6604
- ```
6605
-
6606
- @example
6607
- ```
6608
- import type {ConditionalExcept} from 'type-fest';
6609
-
6610
- interface Example {
6611
- a: string;
6612
- b: string | number;
6613
- c: () => void;
6614
- d: {};
6615
- }
6616
-
6617
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
6618
- //=> {b: string | number; c: () => void; d: {}}
6619
- ```
6620
-
6621
- @category Object
6622
- */
6623
- type ConditionalExcept$1<Base, Condition> = Except$1<
6624
- Base,
6625
- ConditionalKeys$1<Base, Condition>
6626
- >;
6627
-
6628
- /**
6629
- * Descriptors are objects that describe the API of a module, and the module
6630
- * can either be a REST module or a host module.
6631
- * This type is recursive, so it can describe nested modules.
6632
- */
6633
- type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$1<any> | ServicePluginDefinition$1<any> | {
6634
- [key: string]: Descriptors$1 | PublicMetadata$1 | any;
6635
- };
6636
- /**
6637
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
6638
- * and returns an object with the same structure, but with all descriptors replaced with their API.
6639
- * Any non-descriptor properties are removed from the returned object, including descriptors that
6640
- * do not match the given host (as they will not work with the given host).
6641
- */
6642
- type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
6643
- done: T;
6644
- recurse: T extends {
6645
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
6646
- } ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
6647
- [Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
6648
- -1,
6649
- 0,
6650
- 1,
6651
- 2,
6652
- 3,
6653
- 4,
6654
- 5
6655
- ][Depth]> : never;
6656
- }, EmptyObject$1>;
6657
- }[Depth extends -1 ? 'done' : 'recurse'];
6658
- type PublicMetadata$1 = {
6659
- PACKAGE_NAME?: string;
6660
- };
6661
-
6662
- declare global {
6663
- interface ContextualClient {
6664
- }
4846
+ interface ContactEmailsWrapper {
4847
+ /** List of up to 50 email addresses. */
4848
+ items?: ContactEmail[];
6665
4849
  }
6666
- /**
6667
- * A type used to create concerete types from SDK descriptors in
6668
- * case a contextual client is available.
6669
- */
6670
- type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
6671
- host: Host$1;
6672
- } ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
6673
-
6674
- /** Dummy message for fqdn validation */
6675
- interface SubmitContact {
6676
- /** Submit Contact Id */
4850
+ interface ContactEmail {
4851
+ /**
4852
+ * Email ID.
4853
+ * @readonly
4854
+ */
6677
4855
  _id?: string | null;
6678
- }
6679
- interface SubmitContactRequest {
6680
4856
  /**
6681
- * Contact's information.
6682
- * To reconcile with an existing contact,
6683
- * a phone or email must be provided,
6684
- * or the current session identity must be attached to a contact or member.
6685
- *
6686
- * If no existing contact can be found,
6687
- * a new contact is created with the specified information.
4857
+ * Email type.
6688
4858
  *
6689
- * <!--ONLY:REST-->
6690
- * Required if there's no contextual identity or given `contactId`.
6691
- * <!--END:ONLY:REST-->
4859
+ * `UNTAGGED` is shown as "Other" in the Contact List.
6692
4860
  */
6693
- info?: ContactInfo$1;
6694
- /** Pass through data, to be posted on Contact Submitted Domain Event (optional). */
6695
- passThroughData?: string | null;
4861
+ tag?: EmailTag;
4862
+ /** Email address. */
4863
+ email?: string;
6696
4864
  /**
6697
- * Existing Contact ID (optional).
6698
- * Requires permission `CONTACTS.SUBMIT_WITH_OVERRIDES`
4865
+ * Indicates whether this is the contact's primary email address.
4866
+ * When changing `primary` to `true` for an email,
4867
+ * the contact's other emails become `false`.
4868
+ * It also affects the subscription status to marketing emails that are decided based on the primary email.
6699
4869
  */
6700
- contactId?: string | null;
4870
+ primary?: boolean | null;
6701
4871
  }
6702
- interface ContactInfo$1 {
6703
- /** Contact's first and last name. */
6704
- name?: ContactName;
6705
- /** Contact's email addresses. */
6706
- emails?: ContactEmailsWrapper;
6707
- /** Contact's phone numbers. */
6708
- phones?: ContactPhonesWrapper;
6709
- /** Contact's street addresses. */
6710
- addresses?: ContactAddressesWrapper;
6711
- /** Contact's company name. */
6712
- company?: string | null;
4872
+ declare enum EmailTag {
4873
+ UNTAGGED = "UNTAGGED",
4874
+ MAIN = "MAIN",
4875
+ HOME = "HOME",
4876
+ WORK = "WORK"
4877
+ }
4878
+ interface ContactPhonesWrapper {
4879
+ /** List of up to 50 phone numbers. */
4880
+ items?: ContactPhone[];
4881
+ }
4882
+ interface ContactPhone {
6713
4883
  /**
6714
- * Contact's job title.
6715
- * Corresponds to the **Position** field in the Dashboard.
4884
+ * Phone ID.
4885
+ * @readonly
6716
4886
  */
6717
- jobTitle?: string | null;
6718
- /** Birth date in `YYYY-MM-DD` format. For example, `2020-03-15`. */
6719
- birthdate?: string | null;
4887
+ _id?: string | null;
6720
4888
  /**
6721
- * Locale in
6722
- * [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
6723
- * Typically, this is a lowercase 2-letter language code,
6724
- * followed by a hyphen, followed by an uppercase 2-letter country code.
6725
- * For example, `en-US` for U.S. English, and `de-DE` for Germany German.
6726
- */
6727
- locale?: string | null;
6728
- /**
6729
- * List of contact's labels.
6730
- * Labels are used to organize contacts.
6731
- * When setting the `labelKeys` property,
6732
- * only labels that already exist in the site's Contacts List can be used.
6733
- * Labels can be added and removed using
6734
- * [Label Contact](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/label-contact) and
6735
- * [Unlabel Contact](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/unlabel-contact),
6736
- * respectively.
6737
- *
6738
- * To view or manage site labels, use the
6739
- * [Labels API](https://dev.wix.com/api/rest/contacts/labels).
6740
- */
6741
- labelKeys?: LabelsWrapper;
6742
- /**
6743
- * Additional custom fields.
6744
- * This includes fields managed by Wix, by 3rd-party apps, and by the site.
6745
- *
6746
- * Empty fields are not returned.
6747
- */
6748
- extendedFields?: ExtendedFieldsWrapper;
6749
- /** Contact's profile picture. */
6750
- picture?: ContactPicture;
6751
- }
6752
- interface ContactName {
6753
- /** Contact's first name. */
6754
- first?: string | null;
6755
- /** Contact's last name. */
6756
- last?: string | null;
6757
- }
6758
- interface ContactEmailsWrapper {
6759
- /** List of up to 50 email addresses. */
6760
- items?: ContactEmail[];
6761
- }
6762
- interface ContactEmail {
6763
- /**
6764
- * Email ID.
6765
- * @readonly
6766
- */
6767
- _id?: string | null;
6768
- /**
6769
- * Email type.
6770
- *
6771
- * `UNTAGGED` is shown as "Other" in the Contact List.
6772
- */
6773
- tag?: EmailTag;
6774
- /** Email address. */
6775
- email?: string;
6776
- /**
6777
- * Indicates whether this is the contact's primary email address.
6778
- * When changing `primary` to `true` for an email,
6779
- * the contact's other emails become `false`.
6780
- * It also affects the subscription status to marketing emails that are decided based on the primary email.
6781
- */
6782
- primary?: boolean | null;
6783
- }
6784
- declare enum EmailTag {
6785
- UNTAGGED = "UNTAGGED",
6786
- MAIN = "MAIN",
6787
- HOME = "HOME",
6788
- WORK = "WORK"
6789
- }
6790
- interface ContactPhonesWrapper {
6791
- /** List of up to 50 phone numbers. */
6792
- items?: ContactPhone[];
6793
- }
6794
- interface ContactPhone {
6795
- /**
6796
- * Phone ID.
6797
- * @readonly
6798
- */
6799
- _id?: string | null;
6800
- /**
6801
- * Phone type.
6802
- *
6803
- * `UNTAGGED` is shown as "Other" in the Contact List.
4889
+ * Phone type.
4890
+ *
4891
+ * `UNTAGGED` is shown as "Other" in the Contact List.
6804
4892
  */
6805
4893
  tag?: PhoneTag;
6806
4894
  /** [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. */
@@ -7219,587 +5307,109 @@ interface IdentificationDataIdOneOf$1 {
7219
5307
  /** ID of a site visitor that has logged in to the site. */
7220
5308
  memberId?: string;
7221
5309
  /** ID of a Wix user (site owner, contributor, etc.). */
7222
- wixUserId?: string;
7223
- /** ID of an app. */
7224
- appId?: string;
7225
- }
7226
- declare enum WebhookIdentityType$1 {
7227
- UNKNOWN = "UNKNOWN",
7228
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
7229
- MEMBER = "MEMBER",
7230
- WIX_USER = "WIX_USER",
7231
- APP = "APP"
7232
- }
7233
- interface SubmitContactResponseNonNullableFields {
7234
- contactId: string;
7235
- identityType: IdentityType;
7236
- newContact: boolean;
7237
- }
7238
- interface AppendOrCreateContactOptions {
7239
- /**
7240
- * Contact's information.
7241
- * To reconcile with an existing contact,
7242
- * a phone or email must be provided,
7243
- * or the current session identity must be attached to a contact or member.
7244
- *
7245
- * If no existing contact can be found,
7246
- * a new contact is created with the specified information.
7247
- *
7248
- * <!--ONLY:REST-->
7249
- * Required if there's no contextual identity or given `contactId`.
7250
- * <!--END:ONLY:REST-->
7251
- */
7252
- info?: ContactInfo$1;
7253
- /** Pass through data, to be posted on Contact Submitted Domain Event (optional). */
7254
- passThroughData?: string | null;
7255
- /**
7256
- * Existing Contact ID (optional).
7257
- * Requires permission `CONTACTS.SUBMIT_WITH_OVERRIDES`
7258
- */
7259
- contactId?: string | null;
7260
- }
7261
-
7262
- declare function appendOrCreateContact$1(httpClient: HttpClient$1): AppendOrCreateContactSignature;
7263
- interface AppendOrCreateContactSignature {
7264
- /**
7265
- * Appends an existing contact or creates a contact if it doesn't exist.
7266
- *
7267
- * For internal docs, see
7268
- * [Submit Contacts](crm.contact-submit-service.introduction).
7269
- */
7270
- (options?: AppendOrCreateContactOptions | undefined): Promise<SubmitContactResponse & SubmitContactResponseNonNullableFields>;
7271
- }
7272
-
7273
- declare const appendOrCreateContact: MaybeContext$1<BuildRESTFunction$1<typeof appendOrCreateContact$1> & typeof appendOrCreateContact$1>;
7274
-
7275
- type context$1_ActivityIcon = ActivityIcon;
7276
- type context$1_Address = Address;
7277
- type context$1_AddressLocation = AddressLocation;
7278
- type context$1_AddressStreetOneOf = AddressStreetOneOf;
7279
- type context$1_AddressTag = AddressTag;
7280
- declare const context$1_AddressTag: typeof AddressTag;
7281
- type context$1_AppendOrCreateContactOptions = AppendOrCreateContactOptions;
7282
- type context$1_AssigneesWrapper = AssigneesWrapper;
7283
- type context$1_ContactActivity = ContactActivity;
7284
- type context$1_ContactActivityType = ContactActivityType;
7285
- declare const context$1_ContactActivityType: typeof ContactActivityType;
7286
- type context$1_ContactAddress = ContactAddress;
7287
- type context$1_ContactAddressesWrapper = ContactAddressesWrapper;
7288
- type context$1_ContactEmail = ContactEmail;
7289
- type context$1_ContactEmailsWrapper = ContactEmailsWrapper;
7290
- type context$1_ContactName = ContactName;
7291
- type context$1_ContactPhone = ContactPhone;
7292
- type context$1_ContactPhonesWrapper = ContactPhonesWrapper;
7293
- type context$1_ContactPicture = ContactPicture;
7294
- type context$1_ContactSourceType = ContactSourceType;
7295
- declare const context$1_ContactSourceType: typeof ContactSourceType;
7296
- type context$1_ContactToSubmit = ContactToSubmit;
7297
- type context$1_EmailTag = EmailTag;
7298
- declare const context$1_EmailTag: typeof EmailTag;
7299
- type context$1_ExtendedFieldsWrapper = ExtendedFieldsWrapper;
7300
- type context$1_IdentityType = IdentityType;
7301
- declare const context$1_IdentityType: typeof IdentityType;
7302
- type context$1_ImageProvider = ImageProvider;
7303
- declare const context$1_ImageProvider: typeof ImageProvider;
7304
- type context$1_LabelsWrapper = LabelsWrapper;
7305
- type context$1_LocationsWrapper = LocationsWrapper;
7306
- type context$1_PhoneTag = PhoneTag;
7307
- declare const context$1_PhoneTag: typeof PhoneTag;
7308
- type context$1_StreetAddress = StreetAddress;
7309
- type context$1_Subdivision = Subdivision;
7310
- type context$1_SubdivisionType = SubdivisionType;
7311
- declare const context$1_SubdivisionType: typeof SubdivisionType;
7312
- type context$1_SubmitContact = SubmitContact;
7313
- type context$1_SubmitContactOptions = SubmitContactOptions;
7314
- type context$1_SubmitContactRequest = SubmitContactRequest;
7315
- type context$1_SubmitContactResponse = SubmitContactResponse;
7316
- type context$1_SubmitContactResponseNonNullableFields = SubmitContactResponseNonNullableFields;
7317
- type context$1_SubmitOperation = SubmitOperation;
7318
- declare const context$1_SubmitOperation: typeof SubmitOperation;
7319
- type context$1_SubmitVisitorIdRequest = SubmitVisitorIdRequest;
7320
- type context$1_SubmitVisitorIdResponse = SubmitVisitorIdResponse;
7321
- declare const context$1_appendOrCreateContact: typeof appendOrCreateContact;
7322
- declare namespace context$1 {
7323
- export { type context$1_ActivityIcon as ActivityIcon, type context$1_Address as Address, type context$1_AddressLocation as AddressLocation, type context$1_AddressStreetOneOf as AddressStreetOneOf, context$1_AddressTag as AddressTag, type context$1_AppendOrCreateContactOptions as AppendOrCreateContactOptions, type context$1_AssigneesWrapper as AssigneesWrapper, type context$1_ContactActivity as ContactActivity, context$1_ContactActivityType as ContactActivityType, type context$1_ContactAddress as ContactAddress, type context$1_ContactAddressesWrapper as ContactAddressesWrapper, type context$1_ContactEmail as ContactEmail, type context$1_ContactEmailsWrapper as ContactEmailsWrapper, type ContactInfo$1 as ContactInfo, type context$1_ContactName as ContactName, type context$1_ContactPhone as ContactPhone, type context$1_ContactPhonesWrapper as ContactPhonesWrapper, type context$1_ContactPicture as ContactPicture, context$1_ContactSourceType as ContactSourceType, type context$1_ContactToSubmit as ContactToSubmit, context$1_EmailTag as EmailTag, type context$1_ExtendedFieldsWrapper as ExtendedFieldsWrapper, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, context$1_IdentityType as IdentityType, context$1_ImageProvider as ImageProvider, type context$1_LabelsWrapper as LabelsWrapper, type context$1_LocationsWrapper as LocationsWrapper, type MessageEnvelope$1 as MessageEnvelope, context$1_PhoneTag as PhoneTag, type context$1_StreetAddress as StreetAddress, type context$1_Subdivision as Subdivision, context$1_SubdivisionType as SubdivisionType, type context$1_SubmitContact as SubmitContact, type context$1_SubmitContactOptions as SubmitContactOptions, type context$1_SubmitContactRequest as SubmitContactRequest, type context$1_SubmitContactResponse as SubmitContactResponse, type context$1_SubmitContactResponseNonNullableFields as SubmitContactResponseNonNullableFields, context$1_SubmitOperation as SubmitOperation, type context$1_SubmitVisitorIdRequest as SubmitVisitorIdRequest, type context$1_SubmitVisitorIdResponse as SubmitVisitorIdResponse, WebhookIdentityType$1 as WebhookIdentityType, context$1_appendOrCreateContact as appendOrCreateContact };
7324
- }
7325
-
7326
- type HostModule<T, H extends Host> = {
7327
- __type: 'host';
7328
- create(host: H): T;
7329
- };
7330
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
7331
- type Host<Environment = unknown> = {
7332
- channel: {
7333
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
7334
- disconnect: () => void;
7335
- } | Promise<{
7336
- disconnect: () => void;
7337
- }>;
7338
- };
7339
- environment?: Environment;
7340
- /**
7341
- * Optional name of the environment, use for logging
7342
- */
7343
- name?: string;
7344
- /**
7345
- * Optional bast url to use for API requests, for example `www.wixapis.com`
7346
- */
7347
- apiBaseUrl?: string;
7348
- /**
7349
- * Possible data to be provided by every host, for cross cutting concerns
7350
- * like internationalization, billing, etc.
7351
- */
7352
- essentials?: {
7353
- /**
7354
- * The language of the currently viewed session
7355
- */
7356
- language?: string;
7357
- /**
7358
- * The locale of the currently viewed session
7359
- */
7360
- locale?: string;
7361
- /**
7362
- * Any headers that should be passed through to the API requests
7363
- */
7364
- passThroughHeaders?: Record<string, string>;
7365
- };
7366
- };
7367
-
7368
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
7369
- interface HttpClient {
7370
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
7371
- fetchWithAuth: typeof fetch;
7372
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
7373
- getActiveToken?: () => string | undefined;
7374
- }
7375
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
7376
- type HttpResponse<T = any> = {
7377
- data: T;
7378
- status: number;
7379
- statusText: string;
7380
- headers: any;
7381
- request?: any;
7382
- };
7383
- type RequestOptions<_TResponse = any, Data = any> = {
7384
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
7385
- url: string;
7386
- data?: Data;
7387
- params?: URLSearchParams;
7388
- } & APIMetadata;
7389
- type APIMetadata = {
7390
- methodFqn?: string;
7391
- entityFqdn?: string;
7392
- packageName?: string;
7393
- };
7394
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
7395
- type EventDefinition<Payload = unknown, Type extends string = string> = {
7396
- __type: 'event-definition';
7397
- type: Type;
7398
- isDomainEvent?: boolean;
7399
- transformations?: (envelope: unknown) => Payload;
7400
- __payload: Payload;
7401
- };
7402
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
7403
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
7404
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
7405
-
7406
- type ServicePluginMethodInput = {
7407
- request: any;
7408
- metadata: any;
7409
- };
7410
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
7411
- type ServicePluginMethodMetadata = {
7412
- name: string;
7413
- primaryHttpMappingPath: string;
7414
- transformations: {
7415
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
7416
- toREST: (...args: unknown[]) => unknown;
7417
- };
7418
- };
7419
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
7420
- __type: 'service-plugin-definition';
7421
- componentType: string;
7422
- methods: ServicePluginMethodMetadata[];
7423
- __contract: Contract;
7424
- };
7425
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
7426
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
7427
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
7428
-
7429
- type RequestContext = {
7430
- isSSR: boolean;
7431
- host: string;
7432
- protocol?: string;
7433
- };
7434
- type ResponseTransformer = (data: any, headers?: any) => any;
7435
- /**
7436
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
7437
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
7438
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
7439
- */
7440
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
7441
- type AmbassadorRequestOptions<T = any> = {
7442
- _?: T;
7443
- url?: string;
7444
- method?: Method;
7445
- params?: any;
7446
- data?: any;
7447
- transformResponse?: ResponseTransformer | ResponseTransformer[];
7448
- };
7449
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
7450
- __isAmbassador: boolean;
7451
- };
7452
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
7453
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
7454
-
7455
- declare global {
7456
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
7457
- interface SymbolConstructor {
7458
- readonly observable: symbol;
7459
- }
7460
- }
7461
-
7462
- declare const emptyObjectSymbol: unique symbol;
7463
-
7464
- /**
7465
- Represents a strictly empty plain object, the `{}` value.
7466
-
7467
- 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)).
7468
-
7469
- @example
7470
- ```
7471
- import type {EmptyObject} from 'type-fest';
7472
-
7473
- // The following illustrates the problem with `{}`.
7474
- const foo1: {} = {}; // Pass
7475
- const foo2: {} = []; // Pass
7476
- const foo3: {} = 42; // Pass
7477
- const foo4: {} = {a: 1}; // Pass
7478
-
7479
- // With `EmptyObject` only the first case is valid.
7480
- const bar1: EmptyObject = {}; // Pass
7481
- const bar2: EmptyObject = 42; // Fail
7482
- const bar3: EmptyObject = []; // Fail
7483
- const bar4: EmptyObject = {a: 1}; // Fail
7484
- ```
7485
-
7486
- 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}.
7487
-
7488
- @category Object
7489
- */
7490
- type EmptyObject = {[emptyObjectSymbol]?: never};
7491
-
7492
- /**
7493
- Returns a boolean for whether the two given types are equal.
7494
-
7495
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
7496
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
7497
-
7498
- Use-cases:
7499
- - If you want to make a conditional branch based on the result of a comparison of two types.
7500
-
7501
- @example
7502
- ```
7503
- import type {IsEqual} from 'type-fest';
7504
-
7505
- // This type returns a boolean for whether the given array includes the given item.
7506
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
7507
- type Includes<Value extends readonly any[], Item> =
7508
- Value extends readonly [Value[0], ...infer rest]
7509
- ? IsEqual<Value[0], Item> extends true
7510
- ? true
7511
- : Includes<rest, Item>
7512
- : false;
7513
- ```
7514
-
7515
- @category Type Guard
7516
- @category Utilities
7517
- */
7518
- type IsEqual<A, B> =
7519
- (<G>() => G extends A ? 1 : 2) extends
7520
- (<G>() => G extends B ? 1 : 2)
7521
- ? true
7522
- : false;
7523
-
7524
- /**
7525
- Filter out keys from an object.
7526
-
7527
- Returns `never` if `Exclude` is strictly equal to `Key`.
7528
- Returns `never` if `Key` extends `Exclude`.
7529
- Returns `Key` otherwise.
7530
-
7531
- @example
7532
- ```
7533
- type Filtered = Filter<'foo', 'foo'>;
7534
- //=> never
7535
- ```
7536
-
7537
- @example
7538
- ```
7539
- type Filtered = Filter<'bar', string>;
7540
- //=> never
7541
- ```
7542
-
7543
- @example
7544
- ```
7545
- type Filtered = Filter<'bar', 'foo'>;
7546
- //=> 'bar'
7547
- ```
7548
-
7549
- @see {Except}
7550
- */
7551
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
7552
-
7553
- type ExceptOptions = {
7554
- /**
7555
- Disallow assigning non-specified properties.
7556
-
7557
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
7558
-
7559
- @default false
7560
- */
7561
- requireExactProps?: boolean;
7562
- };
7563
-
7564
- /**
7565
- Create a type from an object type without certain keys.
7566
-
7567
- We recommend setting the `requireExactProps` option to `true`.
7568
-
7569
- 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.
7570
-
7571
- 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)).
7572
-
7573
- @example
7574
- ```
7575
- import type {Except} from 'type-fest';
7576
-
7577
- type Foo = {
7578
- a: number;
7579
- b: string;
7580
- };
7581
-
7582
- type FooWithoutA = Except<Foo, 'a'>;
7583
- //=> {b: string}
7584
-
7585
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
7586
- //=> errors: 'a' does not exist in type '{ b: string; }'
7587
-
7588
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
7589
- //=> {a: number} & Partial<Record<"b", never>>
7590
-
7591
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
7592
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
7593
- ```
7594
-
7595
- @category Object
7596
- */
7597
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
7598
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
7599
- } & (Options['requireExactProps'] extends true
7600
- ? Partial<Record<KeysType, never>>
7601
- : {});
7602
-
7603
- /**
7604
- Returns a boolean for whether the given type is `never`.
7605
-
7606
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
7607
- @link https://stackoverflow.com/a/53984913/10292952
7608
- @link https://www.zhenghao.io/posts/ts-never
7609
-
7610
- Useful in type utilities, such as checking if something does not occur.
7611
-
7612
- @example
7613
- ```
7614
- import type {IsNever, And} from 'type-fest';
7615
-
7616
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
7617
- type AreStringsEqual<A extends string, B extends string> =
7618
- And<
7619
- IsNever<Exclude<A, B>> extends true ? true : false,
7620
- IsNever<Exclude<B, A>> extends true ? true : false
7621
- >;
7622
-
7623
- type EndIfEqual<I extends string, O extends string> =
7624
- AreStringsEqual<I, O> extends true
7625
- ? never
7626
- : void;
7627
-
7628
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
7629
- if (input === output) {
7630
- process.exit(0);
7631
- }
5310
+ wixUserId?: string;
5311
+ /** ID of an app. */
5312
+ appId?: string;
7632
5313
  }
7633
-
7634
- endIfEqual('abc', 'abc');
7635
- //=> never
7636
-
7637
- endIfEqual('abc', '123');
7638
- //=> void
7639
- ```
7640
-
7641
- @category Type Guard
7642
- @category Utilities
7643
- */
7644
- type IsNever<T> = [T] extends [never] ? true : false;
7645
-
7646
- /**
7647
- An if-else-like type that resolves depending on whether the given type is `never`.
7648
-
7649
- @see {@link IsNever}
7650
-
7651
- @example
7652
- ```
7653
- import type {IfNever} from 'type-fest';
7654
-
7655
- type ShouldBeTrue = IfNever<never>;
7656
- //=> true
7657
-
7658
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
7659
- //=> 'bar'
7660
- ```
7661
-
7662
- @category Type Guard
7663
- @category Utilities
7664
- */
7665
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
7666
- IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
7667
- );
7668
-
7669
- /**
7670
- Extract the keys from a type where the value type of the key extends the given `Condition`.
7671
-
7672
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
7673
-
7674
- @example
7675
- ```
7676
- import type {ConditionalKeys} from 'type-fest';
7677
-
7678
- interface Example {
7679
- a: string;
7680
- b: string | number;
7681
- c?: string;
7682
- d: {};
5314
+ declare enum WebhookIdentityType$1 {
5315
+ UNKNOWN = "UNKNOWN",
5316
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
5317
+ MEMBER = "MEMBER",
5318
+ WIX_USER = "WIX_USER",
5319
+ APP = "APP"
7683
5320
  }
7684
-
7685
- type StringKeysOnly = ConditionalKeys<Example, string>;
7686
- //=> 'a'
7687
- ```
7688
-
7689
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
7690
-
7691
- @example
7692
- ```
7693
- import type {ConditionalKeys} from 'type-fest';
7694
-
7695
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
7696
- //=> 'a' | 'c'
7697
- ```
7698
-
7699
- @category Object
7700
- */
7701
- type ConditionalKeys<Base, Condition> =
7702
- {
7703
- // Map through all the keys of the given base type.
7704
- [Key in keyof Base]-?:
7705
- // Pick only keys with types extending the given `Condition` type.
7706
- Base[Key] extends Condition
7707
- // Retain this key
7708
- // If the value for the key extends never, only include it if `Condition` also extends never
7709
- ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
7710
- // Discard this key since the condition fails.
7711
- : never;
7712
- // Convert the produced object into a union type of the keys which passed the conditional test.
7713
- }[keyof Base];
7714
-
7715
- /**
7716
- Exclude keys from a shape that matches the given `Condition`.
7717
-
7718
- 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.
7719
-
7720
- @example
7721
- ```
7722
- import type {Primitive, ConditionalExcept} from 'type-fest';
7723
-
7724
- class Awesome {
7725
- name: string;
7726
- successes: number;
7727
- failures: bigint;
7728
-
7729
- run() {}
5321
+ interface SubmitContactResponseNonNullableFields {
5322
+ contactId: string;
5323
+ identityType: IdentityType;
5324
+ newContact: boolean;
7730
5325
  }
7731
-
7732
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
7733
- //=> {run: () => void}
7734
- ```
7735
-
7736
- @example
7737
- ```
7738
- import type {ConditionalExcept} from 'type-fest';
7739
-
7740
- interface Example {
7741
- a: string;
7742
- b: string | number;
7743
- c: () => void;
7744
- d: {};
5326
+ interface AppendOrCreateContactOptions {
5327
+ /**
5328
+ * Contact's information.
5329
+ * To reconcile with an existing contact,
5330
+ * a phone or email must be provided,
5331
+ * or the current session identity must be attached to a contact or member.
5332
+ *
5333
+ * If no existing contact can be found,
5334
+ * a new contact is created with the specified information.
5335
+ *
5336
+ * <!--ONLY:REST-->
5337
+ * Required if there's no contextual identity or given `contactId`.
5338
+ * <!--END:ONLY:REST-->
5339
+ */
5340
+ info?: ContactInfo$1;
5341
+ /** Pass through data, to be posted on Contact Submitted Domain Event (optional). */
5342
+ passThroughData?: string | null;
5343
+ /**
5344
+ * Existing Contact ID (optional).
5345
+ * Requires permission `CONTACTS.SUBMIT_WITH_OVERRIDES`
5346
+ */
5347
+ contactId?: string | null;
7745
5348
  }
7746
5349
 
7747
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
7748
- //=> {b: string | number; c: () => void; d: {}}
7749
- ```
7750
-
7751
- @category Object
7752
- */
7753
- type ConditionalExcept<Base, Condition> = Except<
7754
- Base,
7755
- ConditionalKeys<Base, Condition>
7756
- >;
5350
+ declare function appendOrCreateContact$1(httpClient: HttpClient): AppendOrCreateContactSignature;
5351
+ interface AppendOrCreateContactSignature {
5352
+ /**
5353
+ * Appends an existing contact or creates a contact if it doesn't exist.
5354
+ *
5355
+ * For internal docs, see
5356
+ * [Submit Contacts](crm.contact-submit-service.introduction).
5357
+ */
5358
+ (options?: AppendOrCreateContactOptions | undefined): Promise<SubmitContactResponse & SubmitContactResponseNonNullableFields>;
5359
+ }
7757
5360
 
7758
- /**
7759
- * Descriptors are objects that describe the API of a module, and the module
7760
- * can either be a REST module or a host module.
7761
- * This type is recursive, so it can describe nested modules.
7762
- */
7763
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
7764
- [key: string]: Descriptors | PublicMetadata | any;
7765
- };
7766
- /**
7767
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
7768
- * and returns an object with the same structure, but with all descriptors replaced with their API.
7769
- * Any non-descriptor properties are removed from the returned object, including descriptors that
7770
- * do not match the given host (as they will not work with the given host).
7771
- */
7772
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
7773
- done: T;
7774
- recurse: T extends {
7775
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
7776
- } ? 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<{
7777
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
7778
- -1,
7779
- 0,
7780
- 1,
7781
- 2,
7782
- 3,
7783
- 4,
7784
- 5
7785
- ][Depth]> : never;
7786
- }, EmptyObject>;
7787
- }[Depth extends -1 ? 'done' : 'recurse'];
7788
- type PublicMetadata = {
7789
- PACKAGE_NAME?: string;
7790
- };
5361
+ declare const appendOrCreateContact: MaybeContext<BuildRESTFunction<typeof appendOrCreateContact$1> & typeof appendOrCreateContact$1>;
7791
5362
 
7792
- declare global {
7793
- interface ContextualClient {
7794
- }
5363
+ type context$1_ActivityIcon = ActivityIcon;
5364
+ type context$1_Address = Address;
5365
+ type context$1_AddressLocation = AddressLocation;
5366
+ type context$1_AddressStreetOneOf = AddressStreetOneOf;
5367
+ type context$1_AddressTag = AddressTag;
5368
+ declare const context$1_AddressTag: typeof AddressTag;
5369
+ type context$1_AppendOrCreateContactOptions = AppendOrCreateContactOptions;
5370
+ type context$1_AssigneesWrapper = AssigneesWrapper;
5371
+ type context$1_ContactActivity = ContactActivity;
5372
+ type context$1_ContactActivityType = ContactActivityType;
5373
+ declare const context$1_ContactActivityType: typeof ContactActivityType;
5374
+ type context$1_ContactAddress = ContactAddress;
5375
+ type context$1_ContactAddressesWrapper = ContactAddressesWrapper;
5376
+ type context$1_ContactEmail = ContactEmail;
5377
+ type context$1_ContactEmailsWrapper = ContactEmailsWrapper;
5378
+ type context$1_ContactName = ContactName;
5379
+ type context$1_ContactPhone = ContactPhone;
5380
+ type context$1_ContactPhonesWrapper = ContactPhonesWrapper;
5381
+ type context$1_ContactPicture = ContactPicture;
5382
+ type context$1_ContactSourceType = ContactSourceType;
5383
+ declare const context$1_ContactSourceType: typeof ContactSourceType;
5384
+ type context$1_ContactToSubmit = ContactToSubmit;
5385
+ type context$1_EmailTag = EmailTag;
5386
+ declare const context$1_EmailTag: typeof EmailTag;
5387
+ type context$1_ExtendedFieldsWrapper = ExtendedFieldsWrapper;
5388
+ type context$1_IdentityType = IdentityType;
5389
+ declare const context$1_IdentityType: typeof IdentityType;
5390
+ type context$1_ImageProvider = ImageProvider;
5391
+ declare const context$1_ImageProvider: typeof ImageProvider;
5392
+ type context$1_LabelsWrapper = LabelsWrapper;
5393
+ type context$1_LocationsWrapper = LocationsWrapper;
5394
+ type context$1_PhoneTag = PhoneTag;
5395
+ declare const context$1_PhoneTag: typeof PhoneTag;
5396
+ type context$1_StreetAddress = StreetAddress;
5397
+ type context$1_Subdivision = Subdivision;
5398
+ type context$1_SubdivisionType = SubdivisionType;
5399
+ declare const context$1_SubdivisionType: typeof SubdivisionType;
5400
+ type context$1_SubmitContact = SubmitContact;
5401
+ type context$1_SubmitContactOptions = SubmitContactOptions;
5402
+ type context$1_SubmitContactRequest = SubmitContactRequest;
5403
+ type context$1_SubmitContactResponse = SubmitContactResponse;
5404
+ type context$1_SubmitContactResponseNonNullableFields = SubmitContactResponseNonNullableFields;
5405
+ type context$1_SubmitOperation = SubmitOperation;
5406
+ declare const context$1_SubmitOperation: typeof SubmitOperation;
5407
+ type context$1_SubmitVisitorIdRequest = SubmitVisitorIdRequest;
5408
+ type context$1_SubmitVisitorIdResponse = SubmitVisitorIdResponse;
5409
+ declare const context$1_appendOrCreateContact: typeof appendOrCreateContact;
5410
+ declare namespace context$1 {
5411
+ export { type context$1_ActivityIcon as ActivityIcon, type context$1_Address as Address, type context$1_AddressLocation as AddressLocation, type context$1_AddressStreetOneOf as AddressStreetOneOf, context$1_AddressTag as AddressTag, type context$1_AppendOrCreateContactOptions as AppendOrCreateContactOptions, type context$1_AssigneesWrapper as AssigneesWrapper, type context$1_ContactActivity as ContactActivity, context$1_ContactActivityType as ContactActivityType, type context$1_ContactAddress as ContactAddress, type context$1_ContactAddressesWrapper as ContactAddressesWrapper, type context$1_ContactEmail as ContactEmail, type context$1_ContactEmailsWrapper as ContactEmailsWrapper, type ContactInfo$1 as ContactInfo, type context$1_ContactName as ContactName, type context$1_ContactPhone as ContactPhone, type context$1_ContactPhonesWrapper as ContactPhonesWrapper, type context$1_ContactPicture as ContactPicture, context$1_ContactSourceType as ContactSourceType, type context$1_ContactToSubmit as ContactToSubmit, context$1_EmailTag as EmailTag, type context$1_ExtendedFieldsWrapper as ExtendedFieldsWrapper, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, context$1_IdentityType as IdentityType, context$1_ImageProvider as ImageProvider, type context$1_LabelsWrapper as LabelsWrapper, type context$1_LocationsWrapper as LocationsWrapper, type MessageEnvelope$1 as MessageEnvelope, context$1_PhoneTag as PhoneTag, type context$1_StreetAddress as StreetAddress, type context$1_Subdivision as Subdivision, context$1_SubdivisionType as SubdivisionType, type context$1_SubmitContact as SubmitContact, type context$1_SubmitContactOptions as SubmitContactOptions, type context$1_SubmitContactRequest as SubmitContactRequest, type context$1_SubmitContactResponse as SubmitContactResponse, type context$1_SubmitContactResponseNonNullableFields as SubmitContactResponseNonNullableFields, context$1_SubmitOperation as SubmitOperation, type context$1_SubmitVisitorIdRequest as SubmitVisitorIdRequest, type context$1_SubmitVisitorIdResponse as SubmitVisitorIdResponse, WebhookIdentityType$1 as WebhookIdentityType, context$1_appendOrCreateContact as appendOrCreateContact };
7795
5412
  }
7796
- /**
7797
- * A type used to create concerete types from SDK descriptors in
7798
- * case a contextual client is available.
7799
- */
7800
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
7801
- host: Host;
7802
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
7803
5413
 
7804
5414
  interface Task {
7805
5415
  /**