@wix/payments 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- type HostModule<T, H extends Host> = {
1
+ type HostModule$2<T, H extends Host$2> = {
2
2
  __type: 'host';
3
3
  create(host: H): T;
4
4
  };
5
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
- type Host<Environment = unknown> = {
5
+ type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
6
+ type Host$2<Environment = unknown> = {
7
7
  channel: {
8
8
  observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
9
  disconnect: () => void;
@@ -36,92 +36,92 @@ type Host<Environment = unknown> = {
36
36
  };
37
37
  };
38
38
 
39
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
40
- interface HttpClient {
41
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
39
+ type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
40
+ interface HttpClient$2 {
41
+ request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
42
42
  fetchWithAuth: typeof fetch;
43
43
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
44
44
  getActiveToken?: () => string | undefined;
45
45
  }
46
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
47
- type HttpResponse<T = any> = {
46
+ type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
47
+ type HttpResponse$2<T = any> = {
48
48
  data: T;
49
49
  status: number;
50
50
  statusText: string;
51
51
  headers: any;
52
52
  request?: any;
53
53
  };
54
- type RequestOptions<_TResponse = any, Data = any> = {
54
+ type RequestOptions$2<_TResponse = any, Data = any> = {
55
55
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
56
56
  url: string;
57
57
  data?: Data;
58
58
  params?: URLSearchParams;
59
- } & APIMetadata;
60
- type APIMetadata = {
59
+ } & APIMetadata$2;
60
+ type APIMetadata$2 = {
61
61
  methodFqn?: string;
62
62
  entityFqdn?: string;
63
63
  packageName?: string;
64
64
  };
65
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
66
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
65
+ type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
66
+ type EventDefinition$4<Payload = unknown, Type extends string = string> = {
67
67
  __type: 'event-definition';
68
68
  type: Type;
69
69
  isDomainEvent?: boolean;
70
70
  transformations?: (envelope: unknown) => Payload;
71
71
  __payload: Payload;
72
72
  };
73
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
74
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
75
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
73
+ declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
74
+ type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
75
+ type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
76
76
 
77
- type ServicePluginMethodInput = {
77
+ type ServicePluginMethodInput$2 = {
78
78
  request: any;
79
79
  metadata: any;
80
80
  };
81
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
82
- type ServicePluginMethodMetadata = {
81
+ type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
82
+ type ServicePluginMethodMetadata$2 = {
83
83
  name: string;
84
84
  primaryHttpMappingPath: string;
85
85
  transformations: {
86
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
86
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
87
87
  toREST: (...args: unknown[]) => unknown;
88
88
  };
89
89
  };
90
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
90
+ type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
91
91
  __type: 'service-plugin-definition';
92
92
  componentType: string;
93
- methods: ServicePluginMethodMetadata[];
93
+ methods: ServicePluginMethodMetadata$2[];
94
94
  __contract: Contract;
95
95
  };
96
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
97
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
98
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
96
+ declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
97
+ type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
98
+ declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
99
99
 
100
- type RequestContext = {
100
+ type RequestContext$2 = {
101
101
  isSSR: boolean;
102
102
  host: string;
103
103
  protocol?: string;
104
104
  };
105
- type ResponseTransformer = (data: any, headers?: any) => any;
105
+ type ResponseTransformer$2 = (data: any, headers?: any) => any;
106
106
  /**
107
107
  * Ambassador request options types are copied mostly from AxiosRequestConfig.
108
108
  * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
109
109
  * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
110
110
  */
111
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
112
- type AmbassadorRequestOptions<T = any> = {
111
+ type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
112
+ type AmbassadorRequestOptions$2<T = any> = {
113
113
  _?: T;
114
114
  url?: string;
115
- method?: Method;
115
+ method?: Method$2;
116
116
  params?: any;
117
117
  data?: any;
118
- transformResponse?: ResponseTransformer | ResponseTransformer[];
118
+ transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
119
119
  };
120
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
120
+ type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
121
121
  __isAmbassador: boolean;
122
122
  };
123
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
124
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
123
+ type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
124
+ type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
125
125
 
126
126
  declare global {
127
127
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -130,7 +130,7 @@ declare global {
130
130
  }
131
131
  }
132
132
 
133
- declare const emptyObjectSymbol: unique symbol;
133
+ declare const emptyObjectSymbol$2: unique symbol;
134
134
 
135
135
  /**
136
136
  Represents a strictly empty plain object, the `{}` value.
@@ -158,7 +158,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
158
158
 
159
159
  @category Object
160
160
  */
161
- type EmptyObject = {[emptyObjectSymbol]?: never};
161
+ type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
162
162
 
163
163
  /**
164
164
  Returns a boolean for whether the two given types are equal.
@@ -186,7 +186,7 @@ type Includes<Value extends readonly any[], Item> =
186
186
  @category Type Guard
187
187
  @category Utilities
188
188
  */
189
- type IsEqual<A, B> =
189
+ type IsEqual$2<A, B> =
190
190
  (<G>() => G extends A ? 1 : 2) extends
191
191
  (<G>() => G extends B ? 1 : 2)
192
192
  ? true
@@ -219,9 +219,9 @@ type Filtered = Filter<'bar', 'foo'>;
219
219
 
220
220
  @see {Except}
221
221
  */
222
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
222
+ type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
223
223
 
224
- type ExceptOptions = {
224
+ type ExceptOptions$2 = {
225
225
  /**
226
226
  Disallow assigning non-specified properties.
227
227
 
@@ -265,8 +265,8 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
265
265
 
266
266
  @category Object
267
267
  */
268
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
269
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
268
+ type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
269
+ [KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
270
270
  } & (Options['requireExactProps'] extends true
271
271
  ? Partial<Record<KeysType, never>>
272
272
  : {});
@@ -303,7 +303,7 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
303
303
 
304
304
  @category Object
305
305
  */
306
- type ConditionalKeys<Base, Condition> = NonNullable<
306
+ type ConditionalKeys$2<Base, Condition> = NonNullable<
307
307
  // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
308
308
  {
309
309
  // Map through all the keys of the given base type.
@@ -357,9 +357,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
357
357
 
358
358
  @category Object
359
359
  */
360
- type ConditionalExcept<Base, Condition> = Except<
360
+ type ConditionalExcept$2<Base, Condition> = Except$2<
361
361
  Base,
362
- ConditionalKeys<Base, Condition>
362
+ ConditionalKeys$2<Base, Condition>
363
363
  >;
364
364
 
365
365
  /**
@@ -367,8 +367,8 @@ ConditionalKeys<Base, Condition>
367
367
  * can either be a REST module or a host module.
368
368
  * This type is recursive, so it can describe nested modules.
369
369
  */
370
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$2<any> | ServicePluginDefinition<any> | {
371
- [key: string]: Descriptors | PublicMetadata | any;
370
+ type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$4<any> | ServicePluginDefinition$2<any> | {
371
+ [key: string]: Descriptors$2 | PublicMetadata$2 | any;
372
372
  };
373
373
  /**
374
374
  * This type takes in a descriptors object of a certain Host (including an `unknown` host)
@@ -376,12 +376,12 @@ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostM
376
376
  * Any non-descriptor properties are removed from the returned object, including descriptors that
377
377
  * do not match the given host (as they will not work with the given host).
378
378
  */
379
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
379
+ type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
380
380
  done: T;
381
381
  recurse: T extends {
382
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
383
- } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
384
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
382
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
383
+ } ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
384
+ [Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
385
385
  -1,
386
386
  0,
387
387
  1,
@@ -390,9 +390,9 @@ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, De
390
390
  4,
391
391
  5
392
392
  ][Depth]> : never;
393
- }, EmptyObject>;
393
+ }, EmptyObject$2>;
394
394
  }[Depth extends -1 ? 'done' : 'recurse'];
395
- type PublicMetadata = {
395
+ type PublicMetadata$2 = {
396
396
  PACKAGE_NAME?: string;
397
397
  };
398
398
 
@@ -404,9 +404,9 @@ declare global {
404
404
  * A type used to create concerete types from SDK descriptors in
405
405
  * case a contextual client is available.
406
406
  */
407
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
408
- host: Host;
409
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
407
+ type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
408
+ host: Host$2;
409
+ } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
410
410
 
411
411
  interface OnboardingAvailability {
412
412
  /**
@@ -733,47 +733,47 @@ interface UpdatePartnerFlowOptions {
733
733
  partnerFlow?: PartnerFlow;
734
734
  }
735
735
 
736
- declare function getOnboardingAvailability$1(httpClient: HttpClient): GetOnboardingAvailabilitySignature;
736
+ declare function getOnboardingAvailability$1(httpClient: HttpClient$2): GetOnboardingAvailabilitySignature;
737
737
  interface GetOnboardingAvailabilitySignature {
738
738
  /**
739
739
  * Fetch current state of onboarding availability for meta site.
740
740
  */
741
741
  (): Promise<GetOnboardingAvailabilityResponse & GetOnboardingAvailabilityResponseNonNullableFields>;
742
742
  }
743
- declare function updateCbdFlow$1(httpClient: HttpClient): UpdateCbdFlowSignature;
743
+ declare function updateCbdFlow$1(httpClient: HttpClient$2): UpdateCbdFlowSignature;
744
744
  interface UpdateCbdFlowSignature {
745
745
  /**
746
746
  * Update current state of CBD flow for meta site.
747
747
  */
748
748
  (options?: UpdateCbdFlowOptions | undefined): Promise<UpdateCbdFlowResponse & UpdateCbdFlowResponseNonNullableFields>;
749
749
  }
750
- declare function updateRestrictedGoodsFlow$1(httpClient: HttpClient): UpdateRestrictedGoodsFlowSignature;
750
+ declare function updateRestrictedGoodsFlow$1(httpClient: HttpClient$2): UpdateRestrictedGoodsFlowSignature;
751
751
  interface UpdateRestrictedGoodsFlowSignature {
752
752
  /**
753
753
  * Update current state of Restricted Goods flow for meta site.
754
754
  */
755
755
  (options?: UpdateRestrictedGoodsFlowOptions | undefined): Promise<UpdateRestrictedGoodsFlowResponse & UpdateRestrictedGoodsFlowResponseNonNullableFields>;
756
756
  }
757
- declare function updatePartnerFlow$1(httpClient: HttpClient): UpdatePartnerFlowSignature;
757
+ declare function updatePartnerFlow$1(httpClient: HttpClient$2): UpdatePartnerFlowSignature;
758
758
  interface UpdatePartnerFlowSignature {
759
759
  /**
760
760
  * Update current state of partner flow for meta site.
761
761
  */
762
762
  (options?: UpdatePartnerFlowOptions | undefined): Promise<UpdatePartnerFlowResponse & UpdatePartnerFlowResponseNonNullableFields>;
763
763
  }
764
- declare const onOnboardingAvailabilityCreated$1: EventDefinition$2<OnboardingAvailabilityCreatedEnvelope, "wix.cashier.onboarding_availability.v1.onboarding_availability_created">;
765
- declare const onOnboardingAvailabilityUpdated$1: EventDefinition$2<OnboardingAvailabilityUpdatedEnvelope, "wix.cashier.onboarding_availability.v1.onboarding_availability_updated">;
764
+ declare const onOnboardingAvailabilityCreated$1: EventDefinition$4<OnboardingAvailabilityCreatedEnvelope, "wix.cashier.onboarding_availability.v1.onboarding_availability_created">;
765
+ declare const onOnboardingAvailabilityUpdated$1: EventDefinition$4<OnboardingAvailabilityUpdatedEnvelope, "wix.cashier.onboarding_availability.v1.onboarding_availability_updated">;
766
766
 
767
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
767
+ type EventDefinition$3<Payload = unknown, Type extends string = string> = {
768
768
  __type: 'event-definition';
769
769
  type: Type;
770
770
  isDomainEvent?: boolean;
771
771
  transformations?: (envelope: unknown) => Payload;
772
772
  __payload: Payload;
773
773
  };
774
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
775
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
776
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
774
+ declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
775
+ type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
776
+ type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
777
777
 
778
778
  declare global {
779
779
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -782,12 +782,12 @@ declare global {
782
782
  }
783
783
  }
784
784
 
785
- declare function createEventModule$1<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
785
+ declare function createEventModule$1<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
786
786
 
787
- declare const getOnboardingAvailability: MaybeContext<BuildRESTFunction<typeof getOnboardingAvailability$1> & typeof getOnboardingAvailability$1>;
788
- declare const updateCbdFlow: MaybeContext<BuildRESTFunction<typeof updateCbdFlow$1> & typeof updateCbdFlow$1>;
789
- declare const updateRestrictedGoodsFlow: MaybeContext<BuildRESTFunction<typeof updateRestrictedGoodsFlow$1> & typeof updateRestrictedGoodsFlow$1>;
790
- declare const updatePartnerFlow: MaybeContext<BuildRESTFunction<typeof updatePartnerFlow$1> & typeof updatePartnerFlow$1>;
787
+ declare const getOnboardingAvailability: MaybeContext$2<BuildRESTFunction$2<typeof getOnboardingAvailability$1> & typeof getOnboardingAvailability$1>;
788
+ declare const updateCbdFlow: MaybeContext$2<BuildRESTFunction$2<typeof updateCbdFlow$1> & typeof updateCbdFlow$1>;
789
+ declare const updateRestrictedGoodsFlow: MaybeContext$2<BuildRESTFunction$2<typeof updateRestrictedGoodsFlow$1> & typeof updateRestrictedGoodsFlow$1>;
790
+ declare const updatePartnerFlow: MaybeContext$2<BuildRESTFunction$2<typeof updatePartnerFlow$1> & typeof updatePartnerFlow$1>;
791
791
 
792
792
  type _publicOnOnboardingAvailabilityCreatedType = typeof onOnboardingAvailabilityCreated$1;
793
793
  /** */
@@ -837,129 +837,949 @@ declare namespace index_d$2 {
837
837
  export { type ActionEvent$1 as ActionEvent, type index_d$2_AttestationInfo as AttestationInfo, type BaseEventMetadata$1 as BaseEventMetadata, type index_d$2_CbdFlow as CbdFlow, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type index_d$2_GetOnboardingAvailabilityRequest as GetOnboardingAvailabilityRequest, type index_d$2_GetOnboardingAvailabilityResponse as GetOnboardingAvailabilityResponse, type index_d$2_GetOnboardingAvailabilityResponseNonNullableFields as GetOnboardingAvailabilityResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type index_d$2_OnboardingAvailability as OnboardingAvailability, type index_d$2_OnboardingAvailabilityCreatedEnvelope as OnboardingAvailabilityCreatedEnvelope, type index_d$2_OnboardingAvailabilityUpdatedEnvelope as OnboardingAvailabilityUpdatedEnvelope, type index_d$2_PartnerFlow as PartnerFlow, index_d$2_PartnerFlowStatus as PartnerFlowStatus, type RestoreInfo$1 as RestoreInfo, index_d$2_RestrictedGoodsCategory as RestrictedGoodsCategory, type index_d$2_RestrictedGoodsFlow as RestrictedGoodsFlow, index_d$2_RestrictedGoodsFlowStatus as RestrictedGoodsFlowStatus, Status$1 as Status, type index_d$2_UpdateCbdFlowOptions as UpdateCbdFlowOptions, type index_d$2_UpdateCbdFlowRequest as UpdateCbdFlowRequest, type index_d$2_UpdateCbdFlowResponse as UpdateCbdFlowResponse, type index_d$2_UpdateCbdFlowResponseNonNullableFields as UpdateCbdFlowResponseNonNullableFields, type index_d$2_UpdatePartnerFlowOptions as UpdatePartnerFlowOptions, type index_d$2_UpdatePartnerFlowRequest as UpdatePartnerFlowRequest, type index_d$2_UpdatePartnerFlowResponse as UpdatePartnerFlowResponse, type index_d$2_UpdatePartnerFlowResponseNonNullableFields as UpdatePartnerFlowResponseNonNullableFields, type index_d$2_UpdateRestrictedGoodsFlowOptions as UpdateRestrictedGoodsFlowOptions, type index_d$2_UpdateRestrictedGoodsFlowRequest as UpdateRestrictedGoodsFlowRequest, type index_d$2_UpdateRestrictedGoodsFlowResponse as UpdateRestrictedGoodsFlowResponse, type index_d$2_UpdateRestrictedGoodsFlowResponseNonNullableFields as UpdateRestrictedGoodsFlowResponseNonNullableFields, WebhookIdentityType$1 as WebhookIdentityType, type index_d$2__publicOnOnboardingAvailabilityCreatedType as _publicOnOnboardingAvailabilityCreatedType, type index_d$2__publicOnOnboardingAvailabilityUpdatedType as _publicOnOnboardingAvailabilityUpdatedType, index_d$2_getOnboardingAvailability as getOnboardingAvailability, index_d$2_onOnboardingAvailabilityCreated as onOnboardingAvailabilityCreated, index_d$2_onOnboardingAvailabilityUpdated as onOnboardingAvailabilityUpdated, onOnboardingAvailabilityCreated$1 as publicOnOnboardingAvailabilityCreated, onOnboardingAvailabilityUpdated$1 as publicOnOnboardingAvailabilityUpdated, index_d$2_updateCbdFlow as updateCbdFlow, index_d$2_updatePartnerFlow as updatePartnerFlow, index_d$2_updateRestrictedGoodsFlow as updateRestrictedGoodsFlow };
838
838
  }
839
839
 
840
- /** Provider platform event */
841
- interface ProviderPlatformEvent extends ProviderPlatformEventResourceOneOf {
842
- /** Refund event data. */
843
- refund?: RefundEvent;
844
- /** Transaction event data. */
845
- transaction?: TransactionEvent;
840
+ type HostModule$1<T, H extends Host$1> = {
841
+ __type: 'host';
842
+ create(host: H): T;
843
+ };
844
+ type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
845
+ type Host$1<Environment = unknown> = {
846
+ channel: {
847
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
848
+ disconnect: () => void;
849
+ } | Promise<{
850
+ disconnect: () => void;
851
+ }>;
852
+ };
853
+ environment?: Environment;
846
854
  /**
847
- * This field is ignored, do not send it.
848
- * @deprecated
855
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
849
856
  */
850
- pluginId?: string;
851
- }
852
- /** @oneof */
853
- interface ProviderPlatformEventResourceOneOf {
854
- /** Refund event data. */
855
- refund?: RefundEvent;
856
- /** Transaction event data. */
857
- transaction?: TransactionEvent;
858
- }
859
- interface RefundEvent {
860
- /** Wix transaction ID. */
861
- wixTransactionId?: string;
862
- /** PSP refund ID. */
863
- pluginRefundId?: string;
864
- /** Wix [reason code](https://dev.wix.com/api/rest/all-apis/provider-platform/reason-codes#all-apis_provider-platform_reason-codes_refund-declined) indicating a failed request. */
865
- reasonCode?: number;
866
- /** Refunded amount. */
867
- amount?: string;
868
- /** Wix refund ID. This field is only required when a merchant initiates a refund from the Wix dashboard. */
869
- wixRefundId?: string | null;
870
- /** PSP-specific error code. */
871
- errorCode?: string | null;
872
- /** PSP-specific error message. */
873
- errorMessage?: string | null;
874
- }
875
- interface TransactionEvent {
876
- /** Wix transaction ID. */
877
- wixTransactionId?: string;
878
- /** PSP transaction ID. */
879
- pluginTransactionId?: string;
880
- /** Wix [reason code](https://dev.wix.com/api/rest/all-apis/provider-platform/reason-codes) indicating a failed or pending request. */
881
- reasonCode?: number;
882
- /** PSP-specific error code. */
883
- errorCode?: string | null;
884
- /** PSP-specific error message. */
885
- errorMessage?: string | null;
886
- /** Token data for stored payment method. */
887
- credentialsOnFile?: CredentialsOnFile;
888
- /** Details of actual customer's card, obtained from a Funding PAN as opposed to a Device PAN. */
889
- cardDetails?: CardDetails;
890
- }
891
- interface CredentialsOnFile extends CredentialsOnFileInfoOneOf {
892
- /** Network token data. */
893
- cardReference?: CardReference;
894
- /** Provider generated token data. */
895
- paymentMethodReference?: PaymentMethodReference;
896
- }
897
- /** @oneof */
898
- interface CredentialsOnFileInfoOneOf {
899
- /** Network token data. */
900
- cardReference?: CardReference;
901
- /** Provider generated token data. */
902
- paymentMethodReference?: PaymentMethodReference;
903
- }
904
- interface CardReference {
905
- /** Network token. */
906
- networkTransactionId?: string;
907
- /** Directory Server transaction ID */
908
- dsTransactionId?: string | null;
909
- }
910
- interface PaymentMethodReference {
911
- /** Payment method token created by the PSP. */
912
- token?: string;
913
- }
914
- interface CardDetails {
915
- /** Issuer (business) identification number. First 6 or 8 digits of the card's number. */
916
- bin?: string | null;
917
- /** Last 4 digits of the card's number. */
918
- lastFour?: string | null;
919
- }
920
- /** Submit event request */
921
- interface SubmitEventRequest {
922
- /** Event data. */
923
- event: ProviderPlatformEvent;
924
- }
925
- /** Submit event response */
926
- interface SubmitEventResponse {
927
- }
928
-
929
- declare function submitEvent$1(httpClient: HttpClient): SubmitEventSignature;
930
- interface SubmitEventSignature {
857
+ apiBaseUrl?: string;
931
858
  /**
932
- * This Wix API is used by a Payment Service Provider (PSP) to send webhooks about payment and refund states to Wix.
933
- *
934
- * Calls to this endpoint must include a `User-Agent` header with the name of the PSP and the integration version in this format: `{PSP}/{version}`.
935
- * PSP's create their own version numbers.
936
- *
937
- * > You cannot try out this endpoint because an `Authorization` header value has to be obtained
938
- * > with the OAuth 2.0 client credentials flow for a specific scope.
939
- * > So please ignore the **Authorization** section below as well as the **Try It Out** button.
940
- * @param - Event data.
941
- * @returns Submit event response
859
+ * Possible data to be provided by every host, for cross cutting concerns
860
+ * like internationalization, billing, etc.
942
861
  */
943
- (event: ProviderPlatformEvent): Promise<void>;
862
+ essentials?: {
863
+ /**
864
+ * The language of the currently viewed session
865
+ */
866
+ language?: string;
867
+ /**
868
+ * The locale of the currently viewed session
869
+ */
870
+ locale?: string;
871
+ /**
872
+ * Any headers that should be passed through to the API requests
873
+ */
874
+ passThroughHeaders?: Record<string, string>;
875
+ };
876
+ };
877
+
878
+ type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
879
+ interface HttpClient$1 {
880
+ request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
881
+ fetchWithAuth: typeof fetch;
882
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
883
+ getActiveToken?: () => string | undefined;
944
884
  }
885
+ type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
886
+ type HttpResponse$1<T = any> = {
887
+ data: T;
888
+ status: number;
889
+ statusText: string;
890
+ headers: any;
891
+ request?: any;
892
+ };
893
+ type RequestOptions$1<_TResponse = any, Data = any> = {
894
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
895
+ url: string;
896
+ data?: Data;
897
+ params?: URLSearchParams;
898
+ } & APIMetadata$1;
899
+ type APIMetadata$1 = {
900
+ methodFqn?: string;
901
+ entityFqdn?: string;
902
+ packageName?: string;
903
+ };
904
+ type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
905
+ type EventDefinition$2<Payload = unknown, Type extends string = string> = {
906
+ __type: 'event-definition';
907
+ type: Type;
908
+ isDomainEvent?: boolean;
909
+ transformations?: (envelope: unknown) => Payload;
910
+ __payload: Payload;
911
+ };
912
+ declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
913
+ type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
914
+ type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
945
915
 
946
- declare const submitEvent: MaybeContext<BuildRESTFunction<typeof submitEvent$1> & typeof submitEvent$1>;
916
+ type ServicePluginMethodInput$1 = {
917
+ request: any;
918
+ metadata: any;
919
+ };
920
+ type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
921
+ type ServicePluginMethodMetadata$1 = {
922
+ name: string;
923
+ primaryHttpMappingPath: string;
924
+ transformations: {
925
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
926
+ toREST: (...args: unknown[]) => unknown;
927
+ };
928
+ };
929
+ type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
930
+ __type: 'service-plugin-definition';
931
+ componentType: string;
932
+ methods: ServicePluginMethodMetadata$1[];
933
+ __contract: Contract;
934
+ };
935
+ declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
936
+ type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
937
+ declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
947
938
 
948
- type index_d$1_CardDetails = CardDetails;
949
- type index_d$1_CardReference = CardReference;
950
- type index_d$1_CredentialsOnFile = CredentialsOnFile;
951
- type index_d$1_CredentialsOnFileInfoOneOf = CredentialsOnFileInfoOneOf;
952
- type index_d$1_PaymentMethodReference = PaymentMethodReference;
953
- type index_d$1_ProviderPlatformEvent = ProviderPlatformEvent;
954
- type index_d$1_ProviderPlatformEventResourceOneOf = ProviderPlatformEventResourceOneOf;
955
- type index_d$1_RefundEvent = RefundEvent;
956
- type index_d$1_SubmitEventRequest = SubmitEventRequest;
957
- type index_d$1_SubmitEventResponse = SubmitEventResponse;
958
- type index_d$1_TransactionEvent = TransactionEvent;
959
- declare const index_d$1_submitEvent: typeof submitEvent;
960
- declare namespace index_d$1 {
961
- export { type index_d$1_CardDetails as CardDetails, type index_d$1_CardReference as CardReference, type index_d$1_CredentialsOnFile as CredentialsOnFile, type index_d$1_CredentialsOnFileInfoOneOf as CredentialsOnFileInfoOneOf, type index_d$1_PaymentMethodReference as PaymentMethodReference, type index_d$1_ProviderPlatformEvent as ProviderPlatformEvent, type index_d$1_ProviderPlatformEventResourceOneOf as ProviderPlatformEventResourceOneOf, type index_d$1_RefundEvent as RefundEvent, type index_d$1_SubmitEventRequest as SubmitEventRequest, type index_d$1_SubmitEventResponse as SubmitEventResponse, type index_d$1_TransactionEvent as TransactionEvent, index_d$1_submitEvent as submitEvent };
962
- }
939
+ type RequestContext$1 = {
940
+ isSSR: boolean;
941
+ host: string;
942
+ protocol?: string;
943
+ };
944
+ type ResponseTransformer$1 = (data: any, headers?: any) => any;
945
+ /**
946
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
947
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
948
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
949
+ */
950
+ type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
951
+ type AmbassadorRequestOptions$1<T = any> = {
952
+ _?: T;
953
+ url?: string;
954
+ method?: Method$1;
955
+ params?: any;
956
+ data?: any;
957
+ transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
958
+ };
959
+ type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
960
+ __isAmbassador: boolean;
961
+ };
962
+ type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
963
+ type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
964
+
965
+ declare global {
966
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
967
+ interface SymbolConstructor {
968
+ readonly observable: symbol;
969
+ }
970
+ }
971
+
972
+ declare const emptyObjectSymbol$1: unique symbol;
973
+
974
+ /**
975
+ Represents a strictly empty plain object, the `{}` value.
976
+
977
+ 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)).
978
+
979
+ @example
980
+ ```
981
+ import type {EmptyObject} from 'type-fest';
982
+
983
+ // The following illustrates the problem with `{}`.
984
+ const foo1: {} = {}; // Pass
985
+ const foo2: {} = []; // Pass
986
+ const foo3: {} = 42; // Pass
987
+ const foo4: {} = {a: 1}; // Pass
988
+
989
+ // With `EmptyObject` only the first case is valid.
990
+ const bar1: EmptyObject = {}; // Pass
991
+ const bar2: EmptyObject = 42; // Fail
992
+ const bar3: EmptyObject = []; // Fail
993
+ const bar4: EmptyObject = {a: 1}; // Fail
994
+ ```
995
+
996
+ 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}.
997
+
998
+ @category Object
999
+ */
1000
+ type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
1001
+
1002
+ /**
1003
+ Returns a boolean for whether the two given types are equal.
1004
+
1005
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
1006
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
1007
+
1008
+ Use-cases:
1009
+ - If you want to make a conditional branch based on the result of a comparison of two types.
1010
+
1011
+ @example
1012
+ ```
1013
+ import type {IsEqual} from 'type-fest';
1014
+
1015
+ // This type returns a boolean for whether the given array includes the given item.
1016
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
1017
+ type Includes<Value extends readonly any[], Item> =
1018
+ Value extends readonly [Value[0], ...infer rest]
1019
+ ? IsEqual<Value[0], Item> extends true
1020
+ ? true
1021
+ : Includes<rest, Item>
1022
+ : false;
1023
+ ```
1024
+
1025
+ @category Type Guard
1026
+ @category Utilities
1027
+ */
1028
+ type IsEqual$1<A, B> =
1029
+ (<G>() => G extends A ? 1 : 2) extends
1030
+ (<G>() => G extends B ? 1 : 2)
1031
+ ? true
1032
+ : false;
1033
+
1034
+ /**
1035
+ Filter out keys from an object.
1036
+
1037
+ Returns `never` if `Exclude` is strictly equal to `Key`.
1038
+ Returns `never` if `Key` extends `Exclude`.
1039
+ Returns `Key` otherwise.
1040
+
1041
+ @example
1042
+ ```
1043
+ type Filtered = Filter<'foo', 'foo'>;
1044
+ //=> never
1045
+ ```
1046
+
1047
+ @example
1048
+ ```
1049
+ type Filtered = Filter<'bar', string>;
1050
+ //=> never
1051
+ ```
1052
+
1053
+ @example
1054
+ ```
1055
+ type Filtered = Filter<'bar', 'foo'>;
1056
+ //=> 'bar'
1057
+ ```
1058
+
1059
+ @see {Except}
1060
+ */
1061
+ type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1062
+
1063
+ type ExceptOptions$1 = {
1064
+ /**
1065
+ Disallow assigning non-specified properties.
1066
+
1067
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1068
+
1069
+ @default false
1070
+ */
1071
+ requireExactProps?: boolean;
1072
+ };
1073
+
1074
+ /**
1075
+ Create a type from an object type without certain keys.
1076
+
1077
+ We recommend setting the `requireExactProps` option to `true`.
1078
+
1079
+ 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.
1080
+
1081
+ 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)).
1082
+
1083
+ @example
1084
+ ```
1085
+ import type {Except} from 'type-fest';
1086
+
1087
+ type Foo = {
1088
+ a: number;
1089
+ b: string;
1090
+ };
1091
+
1092
+ type FooWithoutA = Except<Foo, 'a'>;
1093
+ //=> {b: string}
1094
+
1095
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1096
+ //=> errors: 'a' does not exist in type '{ b: string; }'
1097
+
1098
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1099
+ //=> {a: number} & Partial<Record<"b", never>>
1100
+
1101
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1102
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1103
+ ```
1104
+
1105
+ @category Object
1106
+ */
1107
+ type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
1108
+ [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
1109
+ } & (Options['requireExactProps'] extends true
1110
+ ? Partial<Record<KeysType, never>>
1111
+ : {});
1112
+
1113
+ /**
1114
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
1115
+
1116
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1117
+
1118
+ @example
1119
+ ```
1120
+ import type {ConditionalKeys} from 'type-fest';
1121
+
1122
+ interface Example {
1123
+ a: string;
1124
+ b: string | number;
1125
+ c?: string;
1126
+ d: {};
1127
+ }
1128
+
1129
+ type StringKeysOnly = ConditionalKeys<Example, string>;
1130
+ //=> 'a'
1131
+ ```
1132
+
1133
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1134
+
1135
+ @example
1136
+ ```
1137
+ import type {ConditionalKeys} from 'type-fest';
1138
+
1139
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1140
+ //=> 'a' | 'c'
1141
+ ```
1142
+
1143
+ @category Object
1144
+ */
1145
+ type ConditionalKeys$1<Base, Condition> = NonNullable<
1146
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1147
+ {
1148
+ // Map through all the keys of the given base type.
1149
+ [Key in keyof Base]:
1150
+ // Pick only keys with types extending the given `Condition` type.
1151
+ Base[Key] extends Condition
1152
+ // Retain this key since the condition passes.
1153
+ ? Key
1154
+ // Discard this key since the condition fails.
1155
+ : never;
1156
+
1157
+ // Convert the produced object into a union type of the keys which passed the conditional test.
1158
+ }[keyof Base]
1159
+ >;
1160
+
1161
+ /**
1162
+ Exclude keys from a shape that matches the given `Condition`.
1163
+
1164
+ 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.
1165
+
1166
+ @example
1167
+ ```
1168
+ import type {Primitive, ConditionalExcept} from 'type-fest';
1169
+
1170
+ class Awesome {
1171
+ name: string;
1172
+ successes: number;
1173
+ failures: bigint;
1174
+
1175
+ run() {}
1176
+ }
1177
+
1178
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1179
+ //=> {run: () => void}
1180
+ ```
1181
+
1182
+ @example
1183
+ ```
1184
+ import type {ConditionalExcept} from 'type-fest';
1185
+
1186
+ interface Example {
1187
+ a: string;
1188
+ b: string | number;
1189
+ c: () => void;
1190
+ d: {};
1191
+ }
1192
+
1193
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
1194
+ //=> {b: string | number; c: () => void; d: {}}
1195
+ ```
1196
+
1197
+ @category Object
1198
+ */
1199
+ type ConditionalExcept$1<Base, Condition> = Except$1<
1200
+ Base,
1201
+ ConditionalKeys$1<Base, Condition>
1202
+ >;
1203
+
1204
+ /**
1205
+ * Descriptors are objects that describe the API of a module, and the module
1206
+ * can either be a REST module or a host module.
1207
+ * This type is recursive, so it can describe nested modules.
1208
+ */
1209
+ type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$2<any> | ServicePluginDefinition$1<any> | {
1210
+ [key: string]: Descriptors$1 | PublicMetadata$1 | any;
1211
+ };
1212
+ /**
1213
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1214
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
1215
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
1216
+ * do not match the given host (as they will not work with the given host).
1217
+ */
1218
+ type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
1219
+ done: T;
1220
+ recurse: T extends {
1221
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
1222
+ } ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
1223
+ [Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
1224
+ -1,
1225
+ 0,
1226
+ 1,
1227
+ 2,
1228
+ 3,
1229
+ 4,
1230
+ 5
1231
+ ][Depth]> : never;
1232
+ }, EmptyObject$1>;
1233
+ }[Depth extends -1 ? 'done' : 'recurse'];
1234
+ type PublicMetadata$1 = {
1235
+ PACKAGE_NAME?: string;
1236
+ };
1237
+
1238
+ declare global {
1239
+ interface ContextualClient {
1240
+ }
1241
+ }
1242
+ /**
1243
+ * A type used to create concerete types from SDK descriptors in
1244
+ * case a contextual client is available.
1245
+ */
1246
+ type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
1247
+ host: Host$1;
1248
+ } ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
1249
+
1250
+ /** Provider platform event */
1251
+ interface ProviderPlatformEvent extends ProviderPlatformEventResourceOneOf {
1252
+ /** Refund event data. */
1253
+ refund?: RefundEvent;
1254
+ /** Transaction event data. */
1255
+ transaction?: TransactionEvent;
1256
+ /**
1257
+ * This field is ignored, do not send it.
1258
+ * @deprecated
1259
+ */
1260
+ pluginId?: string;
1261
+ }
1262
+ /** @oneof */
1263
+ interface ProviderPlatformEventResourceOneOf {
1264
+ /** Refund event data. */
1265
+ refund?: RefundEvent;
1266
+ /** Transaction event data. */
1267
+ transaction?: TransactionEvent;
1268
+ }
1269
+ interface RefundEvent {
1270
+ /** Wix transaction ID. */
1271
+ wixTransactionId?: string;
1272
+ /** PSP refund ID. */
1273
+ pluginRefundId?: string;
1274
+ /** Wix [reason code](https://dev.wix.com/api/rest/all-apis/provider-platform/reason-codes#all-apis_provider-platform_reason-codes_refund-declined) indicating a failed request. */
1275
+ reasonCode?: number;
1276
+ /** Refunded amount. */
1277
+ amount?: string;
1278
+ /** Wix refund ID. This field is only required when a merchant initiates a refund from the Wix dashboard. */
1279
+ wixRefundId?: string | null;
1280
+ /** PSP-specific error code. */
1281
+ errorCode?: string | null;
1282
+ /** PSP-specific error message. */
1283
+ errorMessage?: string | null;
1284
+ }
1285
+ interface TransactionEvent {
1286
+ /** Wix transaction ID. */
1287
+ wixTransactionId?: string;
1288
+ /** PSP transaction ID. */
1289
+ pluginTransactionId?: string;
1290
+ /** Wix [reason code](https://dev.wix.com/api/rest/all-apis/provider-platform/reason-codes) indicating a failed or pending request. */
1291
+ reasonCode?: number;
1292
+ /** PSP-specific error code. */
1293
+ errorCode?: string | null;
1294
+ /** PSP-specific error message. */
1295
+ errorMessage?: string | null;
1296
+ /** Token data for stored payment method. */
1297
+ credentialsOnFile?: CredentialsOnFile;
1298
+ /** Details of actual customer's card, obtained from a Funding PAN as opposed to a Device PAN. */
1299
+ cardDetails?: CardDetails;
1300
+ }
1301
+ interface CredentialsOnFile extends CredentialsOnFileInfoOneOf {
1302
+ /** Network token data. */
1303
+ cardReference?: CardReference;
1304
+ /** Provider generated token data. */
1305
+ paymentMethodReference?: PaymentMethodReference;
1306
+ }
1307
+ /** @oneof */
1308
+ interface CredentialsOnFileInfoOneOf {
1309
+ /** Network token data. */
1310
+ cardReference?: CardReference;
1311
+ /** Provider generated token data. */
1312
+ paymentMethodReference?: PaymentMethodReference;
1313
+ }
1314
+ interface CardReference {
1315
+ /** Network token. */
1316
+ networkTransactionId?: string;
1317
+ /** Directory Server transaction ID */
1318
+ dsTransactionId?: string | null;
1319
+ }
1320
+ interface PaymentMethodReference {
1321
+ /** Payment method token created by the PSP. */
1322
+ token?: string;
1323
+ }
1324
+ interface CardDetails {
1325
+ /** Issuer (business) identification number. First 6 or 8 digits of the card's number. */
1326
+ bin?: string | null;
1327
+ /** Last 4 digits of the card's number. */
1328
+ lastFour?: string | null;
1329
+ }
1330
+ /** Submit event request */
1331
+ interface SubmitEventRequest {
1332
+ /** Event data. */
1333
+ event: ProviderPlatformEvent;
1334
+ }
1335
+ /** Submit event response */
1336
+ interface SubmitEventResponse {
1337
+ }
1338
+
1339
+ declare function submitEvent$1(httpClient: HttpClient$1): SubmitEventSignature;
1340
+ interface SubmitEventSignature {
1341
+ /**
1342
+ * This Wix API is used by a Payment Service Provider (PSP) to send webhooks about payment and refund states to Wix.
1343
+ *
1344
+ * Calls to this endpoint must include a `User-Agent` header with the name of the PSP and the integration version in this format: `{PSP}/{version}`.
1345
+ * PSP's create their own version numbers.
1346
+ *
1347
+ * > You cannot try out this endpoint because an `Authorization` header value has to be obtained
1348
+ * > with the OAuth 2.0 client credentials flow for a specific scope.
1349
+ * > So please ignore the **Authorization** section below as well as the **Try It Out** button.
1350
+ * @param - Event data.
1351
+ * @returns Submit event response
1352
+ */
1353
+ (event: ProviderPlatformEvent): Promise<void>;
1354
+ }
1355
+
1356
+ declare const submitEvent: MaybeContext$1<BuildRESTFunction$1<typeof submitEvent$1> & typeof submitEvent$1>;
1357
+
1358
+ type index_d$1_CardDetails = CardDetails;
1359
+ type index_d$1_CardReference = CardReference;
1360
+ type index_d$1_CredentialsOnFile = CredentialsOnFile;
1361
+ type index_d$1_CredentialsOnFileInfoOneOf = CredentialsOnFileInfoOneOf;
1362
+ type index_d$1_PaymentMethodReference = PaymentMethodReference;
1363
+ type index_d$1_ProviderPlatformEvent = ProviderPlatformEvent;
1364
+ type index_d$1_ProviderPlatformEventResourceOneOf = ProviderPlatformEventResourceOneOf;
1365
+ type index_d$1_RefundEvent = RefundEvent;
1366
+ type index_d$1_SubmitEventRequest = SubmitEventRequest;
1367
+ type index_d$1_SubmitEventResponse = SubmitEventResponse;
1368
+ type index_d$1_TransactionEvent = TransactionEvent;
1369
+ declare const index_d$1_submitEvent: typeof submitEvent;
1370
+ declare namespace index_d$1 {
1371
+ export { type index_d$1_CardDetails as CardDetails, type index_d$1_CardReference as CardReference, type index_d$1_CredentialsOnFile as CredentialsOnFile, type index_d$1_CredentialsOnFileInfoOneOf as CredentialsOnFileInfoOneOf, type index_d$1_PaymentMethodReference as PaymentMethodReference, type index_d$1_ProviderPlatformEvent as ProviderPlatformEvent, type index_d$1_ProviderPlatformEventResourceOneOf as ProviderPlatformEventResourceOneOf, type index_d$1_RefundEvent as RefundEvent, type index_d$1_SubmitEventRequest as SubmitEventRequest, type index_d$1_SubmitEventResponse as SubmitEventResponse, type index_d$1_TransactionEvent as TransactionEvent, index_d$1_submitEvent as submitEvent };
1372
+ }
1373
+
1374
+ type HostModule<T, H extends Host> = {
1375
+ __type: 'host';
1376
+ create(host: H): T;
1377
+ };
1378
+ type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
1379
+ type Host<Environment = unknown> = {
1380
+ channel: {
1381
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
1382
+ disconnect: () => void;
1383
+ } | Promise<{
1384
+ disconnect: () => void;
1385
+ }>;
1386
+ };
1387
+ environment?: Environment;
1388
+ /**
1389
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
1390
+ */
1391
+ apiBaseUrl?: string;
1392
+ /**
1393
+ * Possible data to be provided by every host, for cross cutting concerns
1394
+ * like internationalization, billing, etc.
1395
+ */
1396
+ essentials?: {
1397
+ /**
1398
+ * The language of the currently viewed session
1399
+ */
1400
+ language?: string;
1401
+ /**
1402
+ * The locale of the currently viewed session
1403
+ */
1404
+ locale?: string;
1405
+ /**
1406
+ * Any headers that should be passed through to the API requests
1407
+ */
1408
+ passThroughHeaders?: Record<string, string>;
1409
+ };
1410
+ };
1411
+
1412
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
1413
+ interface HttpClient {
1414
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
1415
+ fetchWithAuth: typeof fetch;
1416
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
1417
+ getActiveToken?: () => string | undefined;
1418
+ }
1419
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
1420
+ type HttpResponse<T = any> = {
1421
+ data: T;
1422
+ status: number;
1423
+ statusText: string;
1424
+ headers: any;
1425
+ request?: any;
1426
+ };
1427
+ type RequestOptions<_TResponse = any, Data = any> = {
1428
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1429
+ url: string;
1430
+ data?: Data;
1431
+ params?: URLSearchParams;
1432
+ } & APIMetadata;
1433
+ type APIMetadata = {
1434
+ methodFqn?: string;
1435
+ entityFqdn?: string;
1436
+ packageName?: string;
1437
+ };
1438
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
1439
+ type EventDefinition$1<Payload = unknown, Type extends string = string> = {
1440
+ __type: 'event-definition';
1441
+ type: Type;
1442
+ isDomainEvent?: boolean;
1443
+ transformations?: (envelope: unknown) => Payload;
1444
+ __payload: Payload;
1445
+ };
1446
+ declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
1447
+ type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
1448
+ type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
1449
+
1450
+ type ServicePluginMethodInput = {
1451
+ request: any;
1452
+ metadata: any;
1453
+ };
1454
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
1455
+ type ServicePluginMethodMetadata = {
1456
+ name: string;
1457
+ primaryHttpMappingPath: string;
1458
+ transformations: {
1459
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
1460
+ toREST: (...args: unknown[]) => unknown;
1461
+ };
1462
+ };
1463
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
1464
+ __type: 'service-plugin-definition';
1465
+ componentType: string;
1466
+ methods: ServicePluginMethodMetadata[];
1467
+ __contract: Contract;
1468
+ };
1469
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
1470
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
1471
+ declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
1472
+
1473
+ type RequestContext = {
1474
+ isSSR: boolean;
1475
+ host: string;
1476
+ protocol?: string;
1477
+ };
1478
+ type ResponseTransformer = (data: any, headers?: any) => any;
1479
+ /**
1480
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
1481
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
1482
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
1483
+ */
1484
+ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
1485
+ type AmbassadorRequestOptions<T = any> = {
1486
+ _?: T;
1487
+ url?: string;
1488
+ method?: Method;
1489
+ params?: any;
1490
+ data?: any;
1491
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
1492
+ };
1493
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
1494
+ __isAmbassador: boolean;
1495
+ };
1496
+ type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
1497
+ type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
1498
+
1499
+ declare global {
1500
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1501
+ interface SymbolConstructor {
1502
+ readonly observable: symbol;
1503
+ }
1504
+ }
1505
+
1506
+ declare const emptyObjectSymbol: unique symbol;
1507
+
1508
+ /**
1509
+ Represents a strictly empty plain object, the `{}` value.
1510
+
1511
+ 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)).
1512
+
1513
+ @example
1514
+ ```
1515
+ import type {EmptyObject} from 'type-fest';
1516
+
1517
+ // The following illustrates the problem with `{}`.
1518
+ const foo1: {} = {}; // Pass
1519
+ const foo2: {} = []; // Pass
1520
+ const foo3: {} = 42; // Pass
1521
+ const foo4: {} = {a: 1}; // Pass
1522
+
1523
+ // With `EmptyObject` only the first case is valid.
1524
+ const bar1: EmptyObject = {}; // Pass
1525
+ const bar2: EmptyObject = 42; // Fail
1526
+ const bar3: EmptyObject = []; // Fail
1527
+ const bar4: EmptyObject = {a: 1}; // Fail
1528
+ ```
1529
+
1530
+ 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}.
1531
+
1532
+ @category Object
1533
+ */
1534
+ type EmptyObject = {[emptyObjectSymbol]?: never};
1535
+
1536
+ /**
1537
+ Returns a boolean for whether the two given types are equal.
1538
+
1539
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
1540
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
1541
+
1542
+ Use-cases:
1543
+ - If you want to make a conditional branch based on the result of a comparison of two types.
1544
+
1545
+ @example
1546
+ ```
1547
+ import type {IsEqual} from 'type-fest';
1548
+
1549
+ // This type returns a boolean for whether the given array includes the given item.
1550
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
1551
+ type Includes<Value extends readonly any[], Item> =
1552
+ Value extends readonly [Value[0], ...infer rest]
1553
+ ? IsEqual<Value[0], Item> extends true
1554
+ ? true
1555
+ : Includes<rest, Item>
1556
+ : false;
1557
+ ```
1558
+
1559
+ @category Type Guard
1560
+ @category Utilities
1561
+ */
1562
+ type IsEqual<A, B> =
1563
+ (<G>() => G extends A ? 1 : 2) extends
1564
+ (<G>() => G extends B ? 1 : 2)
1565
+ ? true
1566
+ : false;
1567
+
1568
+ /**
1569
+ Filter out keys from an object.
1570
+
1571
+ Returns `never` if `Exclude` is strictly equal to `Key`.
1572
+ Returns `never` if `Key` extends `Exclude`.
1573
+ Returns `Key` otherwise.
1574
+
1575
+ @example
1576
+ ```
1577
+ type Filtered = Filter<'foo', 'foo'>;
1578
+ //=> never
1579
+ ```
1580
+
1581
+ @example
1582
+ ```
1583
+ type Filtered = Filter<'bar', string>;
1584
+ //=> never
1585
+ ```
1586
+
1587
+ @example
1588
+ ```
1589
+ type Filtered = Filter<'bar', 'foo'>;
1590
+ //=> 'bar'
1591
+ ```
1592
+
1593
+ @see {Except}
1594
+ */
1595
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1596
+
1597
+ type ExceptOptions = {
1598
+ /**
1599
+ Disallow assigning non-specified properties.
1600
+
1601
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1602
+
1603
+ @default false
1604
+ */
1605
+ requireExactProps?: boolean;
1606
+ };
1607
+
1608
+ /**
1609
+ Create a type from an object type without certain keys.
1610
+
1611
+ We recommend setting the `requireExactProps` option to `true`.
1612
+
1613
+ 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.
1614
+
1615
+ 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)).
1616
+
1617
+ @example
1618
+ ```
1619
+ import type {Except} from 'type-fest';
1620
+
1621
+ type Foo = {
1622
+ a: number;
1623
+ b: string;
1624
+ };
1625
+
1626
+ type FooWithoutA = Except<Foo, 'a'>;
1627
+ //=> {b: string}
1628
+
1629
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1630
+ //=> errors: 'a' does not exist in type '{ b: string; }'
1631
+
1632
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1633
+ //=> {a: number} & Partial<Record<"b", never>>
1634
+
1635
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1636
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1637
+ ```
1638
+
1639
+ @category Object
1640
+ */
1641
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
1642
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
1643
+ } & (Options['requireExactProps'] extends true
1644
+ ? Partial<Record<KeysType, never>>
1645
+ : {});
1646
+
1647
+ /**
1648
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
1649
+
1650
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1651
+
1652
+ @example
1653
+ ```
1654
+ import type {ConditionalKeys} from 'type-fest';
1655
+
1656
+ interface Example {
1657
+ a: string;
1658
+ b: string | number;
1659
+ c?: string;
1660
+ d: {};
1661
+ }
1662
+
1663
+ type StringKeysOnly = ConditionalKeys<Example, string>;
1664
+ //=> 'a'
1665
+ ```
1666
+
1667
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1668
+
1669
+ @example
1670
+ ```
1671
+ import type {ConditionalKeys} from 'type-fest';
1672
+
1673
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1674
+ //=> 'a' | 'c'
1675
+ ```
1676
+
1677
+ @category Object
1678
+ */
1679
+ type ConditionalKeys<Base, Condition> = NonNullable<
1680
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1681
+ {
1682
+ // Map through all the keys of the given base type.
1683
+ [Key in keyof Base]:
1684
+ // Pick only keys with types extending the given `Condition` type.
1685
+ Base[Key] extends Condition
1686
+ // Retain this key since the condition passes.
1687
+ ? Key
1688
+ // Discard this key since the condition fails.
1689
+ : never;
1690
+
1691
+ // Convert the produced object into a union type of the keys which passed the conditional test.
1692
+ }[keyof Base]
1693
+ >;
1694
+
1695
+ /**
1696
+ Exclude keys from a shape that matches the given `Condition`.
1697
+
1698
+ 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.
1699
+
1700
+ @example
1701
+ ```
1702
+ import type {Primitive, ConditionalExcept} from 'type-fest';
1703
+
1704
+ class Awesome {
1705
+ name: string;
1706
+ successes: number;
1707
+ failures: bigint;
1708
+
1709
+ run() {}
1710
+ }
1711
+
1712
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1713
+ //=> {run: () => void}
1714
+ ```
1715
+
1716
+ @example
1717
+ ```
1718
+ import type {ConditionalExcept} from 'type-fest';
1719
+
1720
+ interface Example {
1721
+ a: string;
1722
+ b: string | number;
1723
+ c: () => void;
1724
+ d: {};
1725
+ }
1726
+
1727
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
1728
+ //=> {b: string | number; c: () => void; d: {}}
1729
+ ```
1730
+
1731
+ @category Object
1732
+ */
1733
+ type ConditionalExcept<Base, Condition> = Except<
1734
+ Base,
1735
+ ConditionalKeys<Base, Condition>
1736
+ >;
1737
+
1738
+ /**
1739
+ * Descriptors are objects that describe the API of a module, and the module
1740
+ * can either be a REST module or a host module.
1741
+ * This type is recursive, so it can describe nested modules.
1742
+ */
1743
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$1<any> | ServicePluginDefinition<any> | {
1744
+ [key: string]: Descriptors | PublicMetadata | any;
1745
+ };
1746
+ /**
1747
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1748
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
1749
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
1750
+ * do not match the given host (as they will not work with the given host).
1751
+ */
1752
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
1753
+ done: T;
1754
+ recurse: T extends {
1755
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
1756
+ } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
1757
+ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
1758
+ -1,
1759
+ 0,
1760
+ 1,
1761
+ 2,
1762
+ 3,
1763
+ 4,
1764
+ 5
1765
+ ][Depth]> : never;
1766
+ }, EmptyObject>;
1767
+ }[Depth extends -1 ? 'done' : 'recurse'];
1768
+ type PublicMetadata = {
1769
+ PACKAGE_NAME?: string;
1770
+ };
1771
+
1772
+ declare global {
1773
+ interface ContextualClient {
1774
+ }
1775
+ }
1776
+ /**
1777
+ * A type used to create concerete types from SDK descriptors in
1778
+ * case a contextual client is available.
1779
+ */
1780
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
1781
+ host: Host;
1782
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
963
1783
 
964
1784
  /**
965
1785
  * A refund a record of an attempt of
@@ -1648,8 +2468,8 @@ interface GetRefundabilitySignature {
1648
2468
  */
1649
2469
  (chargeId: string): Promise<GetRefundabilityResponse & GetRefundabilityResponseNonNullableFields>;
1650
2470
  }
1651
- declare const onRefundCreated$1: EventDefinition$2<RefundCreatedEnvelope, "wix.payments.refunds.v1.refund_created">;
1652
- declare const onRefundUpdated$1: EventDefinition$2<RefundUpdatedEnvelope, "wix.payments.refunds.v1.refund_updated">;
2471
+ declare const onRefundCreated$1: EventDefinition$1<RefundCreatedEnvelope, "wix.payments.refunds.v1.refund_created">;
2472
+ declare const onRefundUpdated$1: EventDefinition$1<RefundUpdatedEnvelope, "wix.payments.refunds.v1.refund_updated">;
1653
2473
 
1654
2474
  type EventDefinition<Payload = unknown, Type extends string = string> = {
1655
2475
  __type: 'event-definition';