@wix/payments 1.0.20 → 1.0.22

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$2<T, H extends Host$2> = {
1
+ type HostModule<T, H extends Host> = {
2
2
  __type: 'host';
3
3
  create(host: H): T;
4
4
  };
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> = {
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;
@@ -12,6 +12,10 @@ type Host$2<Environment = unknown> = {
12
12
  }>;
13
13
  };
14
14
  environment?: Environment;
15
+ /**
16
+ * Optional name of the environment, use for logging
17
+ */
18
+ name?: string;
15
19
  /**
16
20
  * Optional bast url to use for API requests, for example `www.wixapis.com`
17
21
  */
@@ -36,92 +40,92 @@ type Host$2<Environment = unknown> = {
36
40
  };
37
41
  };
38
42
 
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>>;
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>>;
42
46
  fetchWithAuth: typeof fetch;
43
47
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
44
48
  getActiveToken?: () => string | undefined;
45
49
  }
46
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
47
- type HttpResponse$2<T = any> = {
50
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
+ type HttpResponse<T = any> = {
48
52
  data: T;
49
53
  status: number;
50
54
  statusText: string;
51
55
  headers: any;
52
56
  request?: any;
53
57
  };
54
- type RequestOptions$2<_TResponse = any, Data = any> = {
58
+ type RequestOptions<_TResponse = any, Data = any> = {
55
59
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
56
60
  url: string;
57
61
  data?: Data;
58
62
  params?: URLSearchParams;
59
- } & APIMetadata$2;
60
- type APIMetadata$2 = {
63
+ } & APIMetadata;
64
+ type APIMetadata = {
61
65
  methodFqn?: string;
62
66
  entityFqdn?: string;
63
67
  packageName?: string;
64
68
  };
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> = {
69
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
67
71
  __type: 'event-definition';
68
72
  type: Type;
69
73
  isDomainEvent?: boolean;
70
74
  transformations?: (envelope: unknown) => Payload;
71
75
  __payload: Payload;
72
76
  };
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;
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;
76
80
 
77
- type ServicePluginMethodInput$2 = {
81
+ type ServicePluginMethodInput = {
78
82
  request: any;
79
83
  metadata: any;
80
84
  };
81
- type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
82
- type ServicePluginMethodMetadata$2 = {
85
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
+ type ServicePluginMethodMetadata = {
83
87
  name: string;
84
88
  primaryHttpMappingPath: string;
85
89
  transformations: {
86
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
90
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
87
91
  toREST: (...args: unknown[]) => unknown;
88
92
  };
89
93
  };
90
- type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
94
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
91
95
  __type: 'service-plugin-definition';
92
96
  componentType: string;
93
- methods: ServicePluginMethodMetadata$2[];
97
+ methods: ServicePluginMethodMetadata[];
94
98
  __contract: Contract;
95
99
  };
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";
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";
99
103
 
100
- type RequestContext$2 = {
104
+ type RequestContext = {
101
105
  isSSR: boolean;
102
106
  host: string;
103
107
  protocol?: string;
104
108
  };
105
- type ResponseTransformer$2 = (data: any, headers?: any) => any;
109
+ type ResponseTransformer = (data: any, headers?: any) => any;
106
110
  /**
107
111
  * Ambassador request options types are copied mostly from AxiosRequestConfig.
108
112
  * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
109
113
  * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
110
114
  */
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> = {
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> = {
113
117
  _?: T;
114
118
  url?: string;
115
- method?: Method$2;
119
+ method?: Method;
116
120
  params?: any;
117
121
  data?: any;
118
- transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
122
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
119
123
  };
120
- type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
124
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
121
125
  __isAmbassador: boolean;
122
126
  };
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;
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;
125
129
 
126
130
  declare global {
127
131
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -130,7 +134,7 @@ declare global {
130
134
  }
131
135
  }
132
136
 
133
- declare const emptyObjectSymbol$2: unique symbol;
137
+ declare const emptyObjectSymbol: unique symbol;
134
138
 
135
139
  /**
136
140
  Represents a strictly empty plain object, the `{}` value.
@@ -158,7 +162,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
158
162
 
159
163
  @category Object
160
164
  */
161
- type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
165
+ type EmptyObject = {[emptyObjectSymbol]?: never};
162
166
 
163
167
  /**
164
168
  Returns a boolean for whether the two given types are equal.
@@ -186,7 +190,7 @@ type Includes<Value extends readonly any[], Item> =
186
190
  @category Type Guard
187
191
  @category Utilities
188
192
  */
189
- type IsEqual$2<A, B> =
193
+ type IsEqual<A, B> =
190
194
  (<G>() => G extends A ? 1 : 2) extends
191
195
  (<G>() => G extends B ? 1 : 2)
192
196
  ? true
@@ -219,9 +223,9 @@ type Filtered = Filter<'bar', 'foo'>;
219
223
 
220
224
  @see {Except}
221
225
  */
222
- type Filter$2<KeyType, ExcludeType> = IsEqual$2<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);
223
227
 
224
- type ExceptOptions$2 = {
228
+ type ExceptOptions = {
225
229
  /**
226
230
  Disallow assigning non-specified properties.
227
231
 
@@ -265,12 +269,78 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
265
269
 
266
270
  @category Object
267
271
  */
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];
272
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
270
274
  } & (Options['requireExactProps'] extends true
271
275
  ? Partial<Record<KeysType, never>>
272
276
  : {});
273
277
 
278
+ /**
279
+ Returns a boolean for whether the given type is `never`.
280
+
281
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
+ @link https://stackoverflow.com/a/53984913/10292952
283
+ @link https://www.zhenghao.io/posts/ts-never
284
+
285
+ Useful in type utilities, such as checking if something does not occur.
286
+
287
+ @example
288
+ ```
289
+ import type {IsNever, And} from 'type-fest';
290
+
291
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
+ type AreStringsEqual<A extends string, B extends string> =
293
+ And<
294
+ IsNever<Exclude<A, B>> extends true ? true : false,
295
+ IsNever<Exclude<B, A>> extends true ? true : false
296
+ >;
297
+
298
+ type EndIfEqual<I extends string, O extends string> =
299
+ AreStringsEqual<I, O> extends true
300
+ ? never
301
+ : void;
302
+
303
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
+ if (input === output) {
305
+ process.exit(0);
306
+ }
307
+ }
308
+
309
+ endIfEqual('abc', 'abc');
310
+ //=> never
311
+
312
+ endIfEqual('abc', '123');
313
+ //=> void
314
+ ```
315
+
316
+ @category Type Guard
317
+ @category Utilities
318
+ */
319
+ type IsNever<T> = [T] extends [never] ? true : false;
320
+
321
+ /**
322
+ An if-else-like type that resolves depending on whether the given type is `never`.
323
+
324
+ @see {@link IsNever}
325
+
326
+ @example
327
+ ```
328
+ import type {IfNever} from 'type-fest';
329
+
330
+ type ShouldBeTrue = IfNever<never>;
331
+ //=> true
332
+
333
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
+ //=> 'bar'
335
+ ```
336
+
337
+ @category Type Guard
338
+ @category Utilities
339
+ */
340
+ type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
+ IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
+ );
343
+
274
344
  /**
275
345
  Extract the keys from a type where the value type of the key extends the given `Condition`.
276
346
 
@@ -303,21 +373,19 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
303
373
 
304
374
  @category Object
305
375
  */
306
- type ConditionalKeys$2<Base, Condition> = NonNullable<
307
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
376
+ type ConditionalKeys<Base, Condition> =
308
377
  {
309
378
  // Map through all the keys of the given base type.
310
- [Key in keyof Base]:
379
+ [Key in keyof Base]-?:
311
380
  // Pick only keys with types extending the given `Condition` type.
312
381
  Base[Key] extends Condition
313
- // Retain this key since the condition passes.
314
- ? Key
382
+ // Retain this key
383
+ // If the value for the key extends never, only include it if `Condition` also extends never
384
+ ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
315
385
  // Discard this key since the condition fails.
316
386
  : never;
317
-
318
387
  // Convert the produced object into a union type of the keys which passed the conditional test.
319
- }[keyof Base]
320
- >;
388
+ }[keyof Base];
321
389
 
322
390
  /**
323
391
  Exclude keys from a shape that matches the given `Condition`.
@@ -357,9 +425,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
357
425
 
358
426
  @category Object
359
427
  */
360
- type ConditionalExcept$2<Base, Condition> = Except$2<
428
+ type ConditionalExcept<Base, Condition> = Except<
361
429
  Base,
362
- ConditionalKeys$2<Base, Condition>
430
+ ConditionalKeys<Base, Condition>
363
431
  >;
364
432
 
365
433
  /**
@@ -367,8 +435,8 @@ ConditionalKeys$2<Base, Condition>
367
435
  * can either be a REST module or a host module.
368
436
  * This type is recursive, so it can describe nested modules.
369
437
  */
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;
438
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
+ [key: string]: Descriptors | PublicMetadata | any;
372
440
  };
373
441
  /**
374
442
  * This type takes in a descriptors object of a certain Host (including an `unknown` host)
@@ -376,12 +444,12 @@ type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 |
376
444
  * Any non-descriptor properties are removed from the returned object, including descriptors that
377
445
  * do not match the given host (as they will not work with the given host).
378
446
  */
379
- type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
447
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
380
448
  done: T;
381
449
  recurse: T extends {
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, [
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, [
385
453
  -1,
386
454
  0,
387
455
  1,
@@ -390,9 +458,9 @@ type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefin
390
458
  4,
391
459
  5
392
460
  ][Depth]> : never;
393
- }, EmptyObject$2>;
461
+ }, EmptyObject>;
394
462
  }[Depth extends -1 ? 'done' : 'recurse'];
395
- type PublicMetadata$2 = {
463
+ type PublicMetadata = {
396
464
  PACKAGE_NAME?: string;
397
465
  };
398
466
 
@@ -404,9 +472,9 @@ declare global {
404
472
  * A type used to create concerete types from SDK descriptors in
405
473
  * case a contextual client is available.
406
474
  */
407
- type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
408
- host: Host$2;
409
- } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
475
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
+ host: Host;
477
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
410
478
 
411
479
  interface OnboardingAvailability {
412
480
  /**
@@ -448,7 +516,7 @@ interface AttestationInfo {
448
516
  * Date of signing attestation form (only if status is CONFIRMED)
449
517
  * @readonly
450
518
  */
451
- attestationFormSignedDate?: Date;
519
+ attestationFormSignedDate?: Date | null;
452
520
  /** True, if attestation form was signed. False otherwise. */
453
521
  formSigned?: boolean | null;
454
522
  }
@@ -551,7 +619,7 @@ interface DomainEvent$1 extends DomainEventBodyOneOf$1 {
551
619
  /** ID of the entity associated with the event. */
552
620
  entityId?: string;
553
621
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
554
- eventTime?: Date;
622
+ eventTime?: Date | null;
555
623
  /**
556
624
  * Whether the event was triggered as a result of a privacy regulation application
557
625
  * (for example, GDPR).
@@ -580,7 +648,7 @@ interface EntityCreatedEvent$1 {
580
648
  entity?: string;
581
649
  }
582
650
  interface RestoreInfo$1 {
583
- deletedDate?: Date;
651
+ deletedDate?: Date | null;
584
652
  }
585
653
  interface EntityUpdatedEvent$1 {
586
654
  /**
@@ -694,7 +762,7 @@ interface EventMetadata$1 extends BaseEventMetadata$1 {
694
762
  /** ID of the entity associated with the event. */
695
763
  entityId?: string;
696
764
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
697
- eventTime?: Date;
765
+ eventTime?: Date | null;
698
766
  /**
699
767
  * Whether the event was triggered as a result of a privacy regulation application
700
768
  * (for example, GDPR).
@@ -733,61 +801,43 @@ interface UpdatePartnerFlowOptions {
733
801
  partnerFlow?: PartnerFlow;
734
802
  }
735
803
 
736
- declare function getOnboardingAvailability$1(httpClient: HttpClient$2): GetOnboardingAvailabilitySignature;
804
+ declare function getOnboardingAvailability$1(httpClient: HttpClient): GetOnboardingAvailabilitySignature;
737
805
  interface GetOnboardingAvailabilitySignature {
738
806
  /**
739
807
  * Fetch current state of onboarding availability for meta site.
740
808
  */
741
809
  (): Promise<GetOnboardingAvailabilityResponse & GetOnboardingAvailabilityResponseNonNullableFields>;
742
810
  }
743
- declare function updateCbdFlow$1(httpClient: HttpClient$2): UpdateCbdFlowSignature;
811
+ declare function updateCbdFlow$1(httpClient: HttpClient): UpdateCbdFlowSignature;
744
812
  interface UpdateCbdFlowSignature {
745
813
  /**
746
814
  * Update current state of CBD flow for meta site.
747
815
  */
748
816
  (options?: UpdateCbdFlowOptions | undefined): Promise<UpdateCbdFlowResponse & UpdateCbdFlowResponseNonNullableFields>;
749
817
  }
750
- declare function updateRestrictedGoodsFlow$1(httpClient: HttpClient$2): UpdateRestrictedGoodsFlowSignature;
818
+ declare function updateRestrictedGoodsFlow$1(httpClient: HttpClient): UpdateRestrictedGoodsFlowSignature;
751
819
  interface UpdateRestrictedGoodsFlowSignature {
752
820
  /**
753
821
  * Update current state of Restricted Goods flow for meta site.
754
822
  */
755
823
  (options?: UpdateRestrictedGoodsFlowOptions | undefined): Promise<UpdateRestrictedGoodsFlowResponse & UpdateRestrictedGoodsFlowResponseNonNullableFields>;
756
824
  }
757
- declare function updatePartnerFlow$1(httpClient: HttpClient$2): UpdatePartnerFlowSignature;
825
+ declare function updatePartnerFlow$1(httpClient: HttpClient): UpdatePartnerFlowSignature;
758
826
  interface UpdatePartnerFlowSignature {
759
827
  /**
760
828
  * Update current state of partner flow for meta site.
761
829
  */
762
830
  (options?: UpdatePartnerFlowOptions | undefined): Promise<UpdatePartnerFlowResponse & UpdatePartnerFlowResponseNonNullableFields>;
763
831
  }
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
-
767
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
768
- __type: 'event-definition';
769
- type: Type;
770
- isDomainEvent?: boolean;
771
- transformations?: (envelope: unknown) => Payload;
772
- __payload: Payload;
773
- };
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
-
778
- declare global {
779
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
780
- interface SymbolConstructor {
781
- readonly observable: symbol;
782
- }
783
- }
832
+ declare const onOnboardingAvailabilityCreated$1: EventDefinition<OnboardingAvailabilityCreatedEnvelope, "wix.cashier.onboarding_availability.v1.onboarding_availability_created">;
833
+ declare const onOnboardingAvailabilityUpdated$1: EventDefinition<OnboardingAvailabilityUpdatedEnvelope, "wix.cashier.onboarding_availability.v1.onboarding_availability_updated">;
784
834
 
785
- declare function createEventModule$1<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
835
+ declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
786
836
 
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>;
837
+ declare const getOnboardingAvailability: MaybeContext<BuildRESTFunction<typeof getOnboardingAvailability$1> & typeof getOnboardingAvailability$1>;
838
+ declare const updateCbdFlow: MaybeContext<BuildRESTFunction<typeof updateCbdFlow$1> & typeof updateCbdFlow$1>;
839
+ declare const updateRestrictedGoodsFlow: MaybeContext<BuildRESTFunction<typeof updateRestrictedGoodsFlow$1> & typeof updateRestrictedGoodsFlow$1>;
840
+ declare const updatePartnerFlow: MaybeContext<BuildRESTFunction<typeof updatePartnerFlow$1> & typeof updatePartnerFlow$1>;
791
841
 
792
842
  type _publicOnOnboardingAvailabilityCreatedType = typeof onOnboardingAvailabilityCreated$1;
793
843
  /** */
@@ -837,953 +887,133 @@ declare namespace index_d$2 {
837
887
  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
888
  }
839
889
 
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;
890
+ /** Provider platform event */
891
+ interface ProviderPlatformEvent extends ProviderPlatformEventResourceOneOf {
892
+ /** Refund event data. */
893
+ refund?: RefundEvent;
894
+ /** Transaction event data. */
895
+ transaction?: TransactionEvent;
854
896
  /**
855
- * Optional bast url to use for API requests, for example `www.wixapis.com`
897
+ * This field is ignored, do not send it.
898
+ * @deprecated
856
899
  */
857
- apiBaseUrl?: string;
900
+ pluginId?: string;
901
+ }
902
+ /** @oneof */
903
+ interface ProviderPlatformEventResourceOneOf {
904
+ /** Refund event data. */
905
+ refund?: RefundEvent;
906
+ /** Transaction event data. */
907
+ transaction?: TransactionEvent;
908
+ }
909
+ interface RefundEvent {
910
+ /** Wix transaction ID. */
911
+ wixTransactionId?: string;
912
+ /** PSP refund ID. */
913
+ pluginRefundId?: string;
914
+ /** 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. */
915
+ reasonCode?: number;
916
+ /** Refunded amount. */
917
+ amount?: string;
918
+ /** Wix refund ID. This field is only required when a merchant initiates a refund from the Wix dashboard. */
919
+ wixRefundId?: string | null;
920
+ /** PSP-specific error code. */
921
+ errorCode?: string | null;
922
+ /** PSP-specific error message. */
923
+ errorMessage?: string | null;
924
+ }
925
+ interface TransactionEvent {
926
+ /** Wix transaction ID. */
927
+ wixTransactionId?: string;
928
+ /** PSP transaction ID. */
929
+ pluginTransactionId?: string;
930
+ /** Wix [reason code](https://dev.wix.com/api/rest/all-apis/provider-platform/reason-codes) indicating a failed or pending request. */
931
+ reasonCode?: number;
932
+ /** PSP-specific error code. */
933
+ errorCode?: string | null;
934
+ /** PSP-specific error message. */
935
+ errorMessage?: string | null;
936
+ /** Token data for stored payment method. */
937
+ credentialsOnFile?: CredentialsOnFile;
938
+ /** Details of actual customer's card, obtained from a Funding PAN as opposed to a Device PAN. */
939
+ cardDetails?: CardDetails;
940
+ }
941
+ interface CredentialsOnFile extends CredentialsOnFileInfoOneOf {
942
+ /** Network token data. */
943
+ cardReference?: CardReference;
944
+ /** Provider generated token data. */
945
+ paymentMethodReference?: PaymentMethodReference;
946
+ }
947
+ /** @oneof */
948
+ interface CredentialsOnFileInfoOneOf {
949
+ /** Network token data. */
950
+ cardReference?: CardReference;
951
+ /** Provider generated token data. */
952
+ paymentMethodReference?: PaymentMethodReference;
953
+ }
954
+ interface CardReference {
955
+ /** Network token. */
956
+ networkTransactionId?: string;
957
+ /** Directory Server transaction ID */
958
+ dsTransactionId?: string | null;
959
+ }
960
+ interface PaymentMethodReference {
961
+ /** Payment method token created by the PSP. */
962
+ token?: string;
963
+ }
964
+ interface CardDetails {
965
+ /** Issuer (business) identification number. First 6 or 8 digits of the card's number. */
966
+ bin?: string | null;
967
+ /** Last 4 digits of the card's number. */
968
+ lastFour?: string | null;
969
+ }
970
+ /** Submit event request */
971
+ interface SubmitEventRequest {
972
+ /** Event data. */
973
+ event: ProviderPlatformEvent;
974
+ }
975
+ /** Submit event response */
976
+ interface SubmitEventResponse {
977
+ }
978
+
979
+ declare function submitEvent$1(httpClient: HttpClient): SubmitEventSignature;
980
+ interface SubmitEventSignature {
858
981
  /**
859
- * Possible data to be provided by every host, for cross cutting concerns
860
- * like internationalization, billing, etc.
982
+ * This Wix API is used by a Payment Service Provider (PSP) to send webhooks about payment and refund states to Wix.
983
+ *
984
+ * 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}`.
985
+ * PSP's create their own version numbers.
986
+ *
987
+ * > You cannot try out this endpoint because an `Authorization` header value has to be obtained
988
+ * > with the OAuth 2.0 client credentials flow for a specific scope.
989
+ * > So please ignore the **Authorization** section below as well as the **Try It Out** button.
990
+ * @param - Event data.
991
+ * @returns Submit event response
861
992
  */
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;
993
+ (event: ProviderPlatformEvent): Promise<void>;
884
994
  }
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;
915
995
 
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";
938
-
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
- };
996
+ declare const submitEvent: MaybeContext<BuildRESTFunction<typeof submitEvent$1> & typeof submitEvent$1>;
1771
997
 
1772
- declare global {
1773
- interface ContextualClient {
1774
- }
998
+ type index_d$1_CardDetails = CardDetails;
999
+ type index_d$1_CardReference = CardReference;
1000
+ type index_d$1_CredentialsOnFile = CredentialsOnFile;
1001
+ type index_d$1_CredentialsOnFileInfoOneOf = CredentialsOnFileInfoOneOf;
1002
+ type index_d$1_PaymentMethodReference = PaymentMethodReference;
1003
+ type index_d$1_ProviderPlatformEvent = ProviderPlatformEvent;
1004
+ type index_d$1_ProviderPlatformEventResourceOneOf = ProviderPlatformEventResourceOneOf;
1005
+ type index_d$1_RefundEvent = RefundEvent;
1006
+ type index_d$1_SubmitEventRequest = SubmitEventRequest;
1007
+ type index_d$1_SubmitEventResponse = SubmitEventResponse;
1008
+ type index_d$1_TransactionEvent = TransactionEvent;
1009
+ declare const index_d$1_submitEvent: typeof submitEvent;
1010
+ declare namespace index_d$1 {
1011
+ 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 };
1775
1012
  }
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;
1783
1013
 
1784
1014
  /**
1785
1015
  * A refund a record of an attempt of
1786
- * returning funds for a charge from a merchant to a customer to who has made a purchase.
1016
+ * returning funds for a charge from a merchant to a buyer who has made a purchase.
1787
1017
  * Read more about refunds in this [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction>).
1788
1018
  */
1789
1019
  interface Refund {
@@ -1803,12 +1033,12 @@ interface Refund {
1803
1033
  * Date and time the refund was created.
1804
1034
  * @readonly
1805
1035
  */
1806
- _createdDate?: Date;
1036
+ _createdDate?: Date | null;
1807
1037
  /**
1808
1038
  * Date and time the refund was last updated.
1809
1039
  * @readonly
1810
1040
  */
1811
- _updatedDate?: Date;
1041
+ _updatedDate?: Date | null;
1812
1042
  /** Data Extensions */
1813
1043
  extendedFields?: ExtendedFields;
1814
1044
  /** ID of charge for which the funds are returned by this refund. */
@@ -1816,7 +1046,7 @@ interface Refund {
1816
1046
  /** Currency of refund, should be the same as currency of charge. */
1817
1047
  currency?: string | null;
1818
1048
  /**
1819
- * Amount of refund in base units, what's returned to the customer.
1049
+ * Amount of refund in base units, what's returned to the buyer.
1820
1050
  * E.g. "12.95".
1821
1051
  */
1822
1052
  amount?: string | null;
@@ -1935,7 +1165,7 @@ interface SyncRefundRequest {
1935
1165
  /** Currency of refund, should be the same as currency of charge. */
1936
1166
  currency?: string | null;
1937
1167
  /**
1938
- * Amount of refund in base units, what's returned to the customer.
1168
+ * Amount of refund in base units, what's returned to the buyer.
1939
1169
  * E.g. "12.95".
1940
1170
  */
1941
1171
  amount?: string | null;
@@ -2179,7 +1409,7 @@ interface DomainEvent extends DomainEventBodyOneOf {
2179
1409
  /** ID of the entity associated with the event. */
2180
1410
  entityId?: string;
2181
1411
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
2182
- eventTime?: Date;
1412
+ eventTime?: Date | null;
2183
1413
  /**
2184
1414
  * Whether the event was triggered as a result of a privacy regulation application
2185
1415
  * (for example, GDPR).
@@ -2208,7 +1438,7 @@ interface EntityCreatedEvent {
2208
1438
  entity?: string;
2209
1439
  }
2210
1440
  interface RestoreInfo {
2211
- deletedDate?: Date;
1441
+ deletedDate?: Date | null;
2212
1442
  }
2213
1443
  interface EntityUpdatedEvent {
2214
1444
  /**
@@ -2323,7 +1553,7 @@ interface EventMetadata extends BaseEventMetadata {
2323
1553
  /** ID of the entity associated with the event. */
2324
1554
  entityId?: string;
2325
1555
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
2326
- eventTime?: Date;
1556
+ eventTime?: Date | null;
2327
1557
  /**
2328
1558
  * Whether the event was triggered as a result of a privacy regulation application
2329
1559
  * (for example, GDPR).
@@ -2468,26 +1698,8 @@ interface GetRefundabilitySignature {
2468
1698
  */
2469
1699
  (chargeId: string): Promise<GetRefundabilityResponse & GetRefundabilityResponseNonNullableFields>;
2470
1700
  }
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">;
2473
-
2474
- type EventDefinition<Payload = unknown, Type extends string = string> = {
2475
- __type: 'event-definition';
2476
- type: Type;
2477
- isDomainEvent?: boolean;
2478
- transformations?: (envelope: unknown) => Payload;
2479
- __payload: Payload;
2480
- };
2481
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
2482
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
2483
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
2484
-
2485
- declare global {
2486
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
2487
- interface SymbolConstructor {
2488
- readonly observable: symbol;
2489
- }
2490
- }
1701
+ declare const onRefundCreated$1: EventDefinition<RefundCreatedEnvelope, "wix.payments.refunds.v1.refund_created">;
1702
+ declare const onRefundUpdated$1: EventDefinition<RefundUpdatedEnvelope, "wix.payments.refunds.v1.refund_updated">;
2491
1703
 
2492
1704
  declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
2493
1705