@wix/app-management 1.0.41 → 1.0.43

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$4<T, H extends Host$4> = {
1
+ type HostModule<T, H extends Host> = {
2
2
  __type: 'host';
3
3
  create(host: H): T;
4
4
  };
5
- type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
6
- type Host$4<Environment = unknown> = {
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$4<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$4<Environment = unknown> = {
36
40
  };
37
41
  };
38
42
 
39
- type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
40
- interface HttpClient$4 {
41
- request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
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$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
47
- type HttpResponse$4<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$4<_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$4;
60
- type APIMetadata$4 = {
63
+ } & APIMetadata;
64
+ type APIMetadata = {
61
65
  methodFqn?: string;
62
66
  entityFqdn?: string;
63
67
  packageName?: string;
64
68
  };
65
- type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
66
- type EventDefinition$5<Payload = unknown, Type extends string = string> = {
69
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
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$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
74
- type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
75
- type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
77
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
78
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
79
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
76
80
 
77
- type ServicePluginMethodInput$4 = {
81
+ type ServicePluginMethodInput = {
78
82
  request: any;
79
83
  metadata: any;
80
84
  };
81
- type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
82
- type ServicePluginMethodMetadata$4 = {
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$4;
90
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
87
91
  toREST: (...args: unknown[]) => unknown;
88
92
  };
89
93
  };
90
- type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
94
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
91
95
  __type: 'service-plugin-definition';
92
96
  componentType: string;
93
- methods: ServicePluginMethodMetadata$4[];
97
+ methods: ServicePluginMethodMetadata[];
94
98
  __contract: Contract;
95
99
  };
96
- declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
97
- type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
98
- declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
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$4 = {
104
+ type RequestContext = {
101
105
  isSSR: boolean;
102
106
  host: string;
103
107
  protocol?: string;
104
108
  };
105
- type ResponseTransformer$4 = (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$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
112
- type AmbassadorRequestOptions$4<T = any> = {
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$4;
119
+ method?: Method;
116
120
  params?: any;
117
121
  data?: any;
118
- transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
122
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
119
123
  };
120
- type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
124
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
121
125
  __isAmbassador: boolean;
122
126
  };
123
- type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
124
- type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
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$4: 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$4 = {[emptyObjectSymbol$4]?: 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$4<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$4<KeyType, ExcludeType> = IsEqual$4<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$4 = {
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$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
269
- [KeyType in keyof ObjectType as Filter$4<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$4<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$4<Base, Condition> = Except$4<
428
+ type ConditionalExcept<Base, Condition> = Except<
361
429
  Base,
362
- ConditionalKeys$4<Base, Condition>
430
+ ConditionalKeys<Base, Condition>
363
431
  >;
364
432
 
365
433
  /**
@@ -367,8 +435,8 @@ ConditionalKeys$4<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$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$5<any> | ServicePluginDefinition$4<any> | {
371
- [key: string]: Descriptors$4 | PublicMetadata$4 | 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$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 |
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$4<T extends Descriptors$4, H extends Host$4<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$4;
383
- } ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$5<any> ? BuildEventDefinition$5<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
384
- [Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
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$4<T extends Descriptors$4, H extends Host$4<any> | undefin
390
458
  4,
391
459
  5
392
460
  ][Depth]> : never;
393
- }, EmptyObject$4>;
461
+ }, EmptyObject>;
394
462
  }[Depth extends -1 ? 'done' : 'recurse'];
395
- type PublicMetadata$4 = {
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$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
408
- host: Host$4;
409
- } ? BuildDescriptors$4<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 AppPlans {
412
480
  /** App ID, as defined in the [app dashboard](https://dev.wix.com/apps/my-apps?viewId=active-apps-view). */
@@ -512,6 +580,13 @@ interface Discount {
512
580
  totalPrice?: string;
513
581
  saleType?: SaleType;
514
582
  }
583
+ declare enum BillingSource {
584
+ UNKNOWN = "UNKNOWN",
585
+ /** plan billing and charges is managed by Wix */
586
+ WIX = "WIX",
587
+ /** plan billing and charges is managed by the app */
588
+ EXTERNAL = "EXTERNAL"
589
+ }
515
590
  interface Price {
516
591
  /**
517
592
  * Price without taxes. For yearly plans, Wix calculates and returns the
@@ -538,6 +613,7 @@ interface Price {
538
613
  */
539
614
  usageBaseOptions?: UsageBasedDetails;
540
615
  discount?: Discount;
616
+ billingSource?: BillingSource;
541
617
  }
542
618
  interface Plan {
543
619
  /**
@@ -662,6 +738,7 @@ interface PriceNonNullableFields {
662
738
  totalPrice: string;
663
739
  billingCycle?: CycleNonNullableFields;
664
740
  discount?: DiscountNonNullableFields;
741
+ billingSource: BillingSource;
665
742
  }
666
743
  interface PlanNonNullableFields {
667
744
  _id: string;
@@ -681,7 +758,7 @@ interface ListAppPlansByAppIdResponseNonNullableFields {
681
758
  appPlans: AppPlansNonNullableFields[];
682
759
  }
683
760
 
684
- declare function listAppPlansByAppId$1(httpClient: HttpClient$4): ListAppPlansByAppIdSignature;
761
+ declare function listAppPlansByAppId$1(httpClient: HttpClient): ListAppPlansByAppIdSignature;
685
762
  interface ListAppPlansByAppIdSignature {
686
763
  /**
687
764
  * Retrieves plans for the given apps.
@@ -715,9 +792,11 @@ interface ListAppPlansByAppIdSignature {
715
792
  (appIds: string[]): Promise<ListAppPlansByAppIdResponse & ListAppPlansByAppIdResponseNonNullableFields>;
716
793
  }
717
794
 
718
- declare const listAppPlansByAppId: MaybeContext$4<BuildRESTFunction$4<typeof listAppPlansByAppId$1> & typeof listAppPlansByAppId$1>;
795
+ declare const listAppPlansByAppId: MaybeContext<BuildRESTFunction<typeof listAppPlansByAppId$1> & typeof listAppPlansByAppId$1>;
719
796
 
720
797
  type index_d$4_AppPlans = AppPlans;
798
+ type index_d$4_BillingSource = BillingSource;
799
+ declare const index_d$4_BillingSource: typeof BillingSource;
721
800
  type index_d$4_Cycle = Cycle;
722
801
  type index_d$4_CycleType = CycleType;
723
802
  declare const index_d$4_CycleType: typeof CycleType;
@@ -740,2042 +819,297 @@ declare const index_d$4_TaxType: typeof TaxType;
740
819
  type index_d$4_UsageBasedDetails = UsageBasedDetails;
741
820
  declare const index_d$4_listAppPlansByAppId: typeof listAppPlansByAppId;
742
821
  declare namespace index_d$4 {
743
- export { type index_d$4_AppPlans as AppPlans, type index_d$4_Cycle as Cycle, index_d$4_CycleType as CycleType, type index_d$4_Discount as Discount, index_d$4_DiscountType as DiscountType, type index_d$4_Duration as Duration, index_d$4_DurationUnit as DurationUnit, type index_d$4_ListAppPlansByAppIdRequest as ListAppPlansByAppIdRequest, type index_d$4_ListAppPlansByAppIdResponse as ListAppPlansByAppIdResponse, type index_d$4_ListAppPlansByAppIdResponseNonNullableFields as ListAppPlansByAppIdResponseNonNullableFields, type index_d$4_Plan as Plan, type index_d$4_Price as Price, index_d$4_SaleType as SaleType, type index_d$4_TaxSettings as TaxSettings, index_d$4_TaxType as TaxType, type index_d$4_UsageBasedDetails as UsageBasedDetails, index_d$4_listAppPlansByAppId as listAppPlansByAppId };
822
+ export { type index_d$4_AppPlans as AppPlans, index_d$4_BillingSource as BillingSource, type index_d$4_Cycle as Cycle, index_d$4_CycleType as CycleType, type index_d$4_Discount as Discount, index_d$4_DiscountType as DiscountType, type index_d$4_Duration as Duration, index_d$4_DurationUnit as DurationUnit, type index_d$4_ListAppPlansByAppIdRequest as ListAppPlansByAppIdRequest, type index_d$4_ListAppPlansByAppIdResponse as ListAppPlansByAppIdResponse, type index_d$4_ListAppPlansByAppIdResponseNonNullableFields as ListAppPlansByAppIdResponseNonNullableFields, type index_d$4_Plan as Plan, type index_d$4_Price as Price, index_d$4_SaleType as SaleType, type index_d$4_TaxSettings as TaxSettings, index_d$4_TaxType as TaxType, type index_d$4_UsageBasedDetails as UsageBasedDetails, index_d$4_listAppPlansByAppId as listAppPlansByAppId };
744
823
  }
745
824
 
746
- type HostModule$3<T, H extends Host$3> = {
747
- __type: 'host';
748
- create(host: H): T;
749
- };
750
- type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
751
- type Host$3<Environment = unknown> = {
752
- channel: {
753
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
754
- disconnect: () => void;
755
- } | Promise<{
756
- disconnect: () => void;
757
- }>;
758
- };
759
- environment?: Environment;
825
+ /**
826
+ * An app instance is a specific occurrence of your app on a particular Wix site.
827
+ * When a site owner installs your app, a unique instance is generated for that
828
+ * specific site. Use the `instanceId` to keep track of the individual data
829
+ * associated with each app instance.
830
+ */
831
+ interface AppInstance {
760
832
  /**
761
- * Optional bast url to use for API requests, for example `www.wixapis.com`
833
+ * ID of the app instance. You can use it to keep track of the individual
834
+ * data that's associated with the specific occurence of your app that's
835
+ * installed on a Wix site.
762
836
  */
763
- apiBaseUrl?: string;
837
+ instanceId?: string;
764
838
  /**
765
- * Possible data to be provided by every host, for cross cutting concerns
766
- * like internationalization, billing, etc.
839
+ * App name, as set by you in the Customs Apps page during the app creation
840
+ * process.
767
841
  */
768
- essentials?: {
769
- /**
770
- * The language of the currently viewed session
771
- */
772
- language?: string;
773
- /**
774
- * The locale of the currently viewed session
775
- */
776
- locale?: string;
777
- /**
778
- * Any headers that should be passed through to the API requests
779
- */
780
- passThroughHeaders?: Record<string, string>;
781
- };
782
- };
783
-
784
- type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
785
- interface HttpClient$3 {
786
- request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
787
- fetchWithAuth: typeof fetch;
788
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
789
- getActiveToken?: () => string | undefined;
842
+ appName?: string;
843
+ /** Version of your app that's installed on the Wix site, as set by you during the app creation process. */
844
+ appVersion?: string | null;
845
+ /**
846
+ * Whether the site owners have installed a free or paid version of your app
847
+ * on their site.
848
+ */
849
+ isFree?: boolean;
850
+ /**
851
+ * Billing information for the app instance. Available only in case
852
+ * `{"isFree": false}`.
853
+ */
854
+ billing?: BillingInfo;
855
+ /**
856
+ * List of [permissions](https://dev.wix.com/docs/build-apps/developer-tools/developers-center/example-app-walkthrough/build-an-app#4-add-permissions)
857
+ * that the site owners have granted your app. You set the list of permissions that
858
+ * your app requires from the site owners in your app's Permissions page during the
859
+ * app creation process.
860
+ */
861
+ permissions?: string[];
862
+ /** Plans available to this app instance. */
863
+ availablePlans?: AvailablePlan[];
864
+ /**
865
+ * ID of the Wix site from which the instance of your app has been cloned.
866
+ * Available only in case `{"copiedFromTemplate": true}`.
867
+ * All visual settings of the Wix site and app data are duplicated during the
868
+ * cloning process. Wix also notifies you in case there is any additional
869
+ * external functionality for the original site.
870
+ */
871
+ originInstanceId?: string | null;
872
+ /**
873
+ * __Deprecated__. This parameter will be removed on March 30, 2023. Use
874
+ * `copiedFromTemplate` instead.
875
+ * @deprecated
876
+ */
877
+ isOriginSiteTemplate?: boolean;
878
+ /** Whether the app instance was created when another Wix site was cloned. */
879
+ copiedFromTemplate?: boolean;
880
+ /** Whether the app instance includes a free trial that hasn't started yet. */
881
+ freeTrialAvailable?: boolean;
790
882
  }
791
- type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
792
- type HttpResponse$3<T = any> = {
793
- data: T;
794
- status: number;
795
- statusText: string;
796
- headers: any;
797
- request?: any;
798
- };
799
- type RequestOptions$3<_TResponse = any, Data = any> = {
800
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
801
- url: string;
802
- data?: Data;
803
- params?: URLSearchParams;
804
- } & APIMetadata$3;
805
- type APIMetadata$3 = {
806
- methodFqn?: string;
807
- entityFqdn?: string;
883
+ interface BillingInfo {
884
+ /** Name of the package that the site owner has paid for. */
808
885
  packageName?: string;
809
- };
810
- type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
811
- type EventDefinition$4<Payload = unknown, Type extends string = string> = {
812
- __type: 'event-definition';
813
- type: Type;
814
- isDomainEvent?: boolean;
815
- transformations?: (envelope: unknown) => Payload;
816
- __payload: Payload;
817
- };
818
- declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
819
- type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
820
- type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
821
-
822
- type ServicePluginMethodInput$3 = {
823
- request: any;
824
- metadata: any;
825
- };
826
- type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
827
- type ServicePluginMethodMetadata$3 = {
828
- name: string;
829
- primaryHttpMappingPath: string;
830
- transformations: {
831
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
832
- toREST: (...args: unknown[]) => unknown;
833
- };
834
- };
835
- type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
836
- __type: 'service-plugin-definition';
837
- componentType: string;
838
- methods: ServicePluginMethodMetadata$3[];
839
- __contract: Contract;
840
- };
841
- declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
842
- type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
843
- declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
844
-
845
- type RequestContext$3 = {
846
- isSSR: boolean;
847
- host: string;
848
- protocol?: string;
849
- };
850
- type ResponseTransformer$3 = (data: any, headers?: any) => any;
851
- /**
852
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
853
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
854
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
855
- */
856
- type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
857
- type AmbassadorRequestOptions$3<T = any> = {
858
- _?: T;
859
- url?: string;
860
- method?: Method$3;
861
- params?: any;
862
- data?: any;
863
- transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
864
- };
865
- type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
866
- __isAmbassador: boolean;
867
- };
868
- type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
869
- type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
870
-
871
- declare global {
872
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
873
- interface SymbolConstructor {
874
- readonly observable: symbol;
875
- }
876
- }
877
-
878
- declare const emptyObjectSymbol$3: unique symbol;
879
-
880
- /**
881
- Represents a strictly empty plain object, the `{}` value.
882
-
883
- 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)).
884
-
885
- @example
886
- ```
887
- import type {EmptyObject} from 'type-fest';
888
-
889
- // The following illustrates the problem with `{}`.
890
- const foo1: {} = {}; // Pass
891
- const foo2: {} = []; // Pass
892
- const foo3: {} = 42; // Pass
893
- const foo4: {} = {a: 1}; // Pass
894
-
895
- // With `EmptyObject` only the first case is valid.
896
- const bar1: EmptyObject = {}; // Pass
897
- const bar2: EmptyObject = 42; // Fail
898
- const bar3: EmptyObject = []; // Fail
899
- const bar4: EmptyObject = {a: 1}; // Fail
900
- ```
901
-
902
- 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}.
903
-
904
- @category Object
905
- */
906
- type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
907
-
908
- /**
909
- Returns a boolean for whether the two given types are equal.
910
-
911
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
912
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
913
-
914
- Use-cases:
915
- - If you want to make a conditional branch based on the result of a comparison of two types.
916
-
917
- @example
918
- ```
919
- import type {IsEqual} from 'type-fest';
920
-
921
- // This type returns a boolean for whether the given array includes the given item.
922
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
923
- type Includes<Value extends readonly any[], Item> =
924
- Value extends readonly [Value[0], ...infer rest]
925
- ? IsEqual<Value[0], Item> extends true
926
- ? true
927
- : Includes<rest, Item>
928
- : false;
929
- ```
930
-
931
- @category Type Guard
932
- @category Utilities
933
- */
934
- type IsEqual$3<A, B> =
935
- (<G>() => G extends A ? 1 : 2) extends
936
- (<G>() => G extends B ? 1 : 2)
937
- ? true
938
- : false;
939
-
940
- /**
941
- Filter out keys from an object.
942
-
943
- Returns `never` if `Exclude` is strictly equal to `Key`.
944
- Returns `never` if `Key` extends `Exclude`.
945
- Returns `Key` otherwise.
946
-
947
- @example
948
- ```
949
- type Filtered = Filter<'foo', 'foo'>;
950
- //=> never
951
- ```
952
-
953
- @example
954
- ```
955
- type Filtered = Filter<'bar', string>;
956
- //=> never
957
- ```
958
-
959
- @example
960
- ```
961
- type Filtered = Filter<'bar', 'foo'>;
962
- //=> 'bar'
963
- ```
964
-
965
- @see {Except}
966
- */
967
- type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
968
-
969
- type ExceptOptions$3 = {
970
- /**
971
- Disallow assigning non-specified properties.
972
-
973
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
974
-
975
- @default false
976
- */
977
- requireExactProps?: boolean;
978
- };
979
-
980
- /**
981
- Create a type from an object type without certain keys.
982
-
983
- We recommend setting the `requireExactProps` option to `true`.
984
-
985
- 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.
986
-
987
- 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)).
988
-
989
- @example
990
- ```
991
- import type {Except} from 'type-fest';
992
-
993
- type Foo = {
994
- a: number;
995
- b: string;
996
- };
997
-
998
- type FooWithoutA = Except<Foo, 'a'>;
999
- //=> {b: string}
1000
-
1001
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1002
- //=> errors: 'a' does not exist in type '{ b: string; }'
1003
-
1004
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1005
- //=> {a: number} & Partial<Record<"b", never>>
1006
-
1007
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1008
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1009
- ```
1010
-
1011
- @category Object
1012
- */
1013
- type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
1014
- [KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
1015
- } & (Options['requireExactProps'] extends true
1016
- ? Partial<Record<KeysType, never>>
1017
- : {});
1018
-
1019
- /**
1020
- Extract the keys from a type where the value type of the key extends the given `Condition`.
1021
-
1022
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1023
-
1024
- @example
1025
- ```
1026
- import type {ConditionalKeys} from 'type-fest';
1027
-
1028
- interface Example {
1029
- a: string;
1030
- b: string | number;
1031
- c?: string;
1032
- d: {};
1033
- }
1034
-
1035
- type StringKeysOnly = ConditionalKeys<Example, string>;
1036
- //=> 'a'
1037
- ```
1038
-
1039
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1040
-
1041
- @example
1042
- ```
1043
- import type {ConditionalKeys} from 'type-fest';
1044
-
1045
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1046
- //=> 'a' | 'c'
1047
- ```
1048
-
1049
- @category Object
1050
- */
1051
- type ConditionalKeys$3<Base, Condition> = NonNullable<
1052
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1053
- {
1054
- // Map through all the keys of the given base type.
1055
- [Key in keyof Base]:
1056
- // Pick only keys with types extending the given `Condition` type.
1057
- Base[Key] extends Condition
1058
- // Retain this key since the condition passes.
1059
- ? Key
1060
- // Discard this key since the condition fails.
1061
- : never;
1062
-
1063
- // Convert the produced object into a union type of the keys which passed the conditional test.
1064
- }[keyof Base]
1065
- >;
1066
-
1067
- /**
1068
- Exclude keys from a shape that matches the given `Condition`.
1069
-
1070
- 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.
1071
-
1072
- @example
1073
- ```
1074
- import type {Primitive, ConditionalExcept} from 'type-fest';
1075
-
1076
- class Awesome {
1077
- name: string;
1078
- successes: number;
1079
- failures: bigint;
1080
-
1081
- run() {}
1082
- }
1083
-
1084
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1085
- //=> {run: () => void}
1086
- ```
1087
-
1088
- @example
1089
- ```
1090
- import type {ConditionalExcept} from 'type-fest';
1091
-
1092
- interface Example {
1093
- a: string;
1094
- b: string | number;
1095
- c: () => void;
1096
- d: {};
1097
- }
1098
-
1099
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
1100
- //=> {b: string | number; c: () => void; d: {}}
1101
- ```
1102
-
1103
- @category Object
1104
- */
1105
- type ConditionalExcept$3<Base, Condition> = Except$3<
1106
- Base,
1107
- ConditionalKeys$3<Base, Condition>
1108
- >;
1109
-
1110
- /**
1111
- * Descriptors are objects that describe the API of a module, and the module
1112
- * can either be a REST module or a host module.
1113
- * This type is recursive, so it can describe nested modules.
1114
- */
1115
- type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$4<any> | ServicePluginDefinition$3<any> | {
1116
- [key: string]: Descriptors$3 | PublicMetadata$3 | any;
1117
- };
1118
- /**
1119
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1120
- * and returns an object with the same structure, but with all descriptors replaced with their API.
1121
- * Any non-descriptor properties are removed from the returned object, including descriptors that
1122
- * do not match the given host (as they will not work with the given host).
1123
- */
1124
- type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
1125
- done: T;
1126
- recurse: T extends {
1127
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
1128
- } ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
1129
- [Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
1130
- -1,
1131
- 0,
1132
- 1,
1133
- 2,
1134
- 3,
1135
- 4,
1136
- 5
1137
- ][Depth]> : never;
1138
- }, EmptyObject$3>;
1139
- }[Depth extends -1 ? 'done' : 'recurse'];
1140
- type PublicMetadata$3 = {
1141
- PACKAGE_NAME?: string;
1142
- };
1143
-
1144
- declare global {
1145
- interface ContextualClient {
1146
- }
1147
- }
1148
- /**
1149
- * A type used to create concerete types from SDK descriptors in
1150
- * case a contextual client is available.
1151
- */
1152
- type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
1153
- host: Host$3;
1154
- } ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
1155
-
1156
- /**
1157
- * An app instance is a specific occurrence of your app on a particular Wix site.
1158
- * When a site owner installs your app, a unique instance is generated for that
1159
- * specific site. Use the `instanceId` to keep track of the individual data
1160
- * associated with each app instance.
1161
- */
1162
- interface AppInstance {
1163
- /**
1164
- * ID of the app instance. You can use it to keep track of the individual
1165
- * data that's associated with the specific occurence of your app that's
1166
- * installed on a Wix site.
1167
- */
1168
- instanceId?: string;
1169
- /**
1170
- * App name, as set by you in the Customs Apps page during the app creation
1171
- * process.
1172
- */
1173
- appName?: string;
1174
- /** Version of your app that's installed on the Wix site, as set by you during the app creation process. */
1175
- appVersion?: string | null;
1176
- /**
1177
- * Whether the site owners have installed a free or paid version of your app
1178
- * on their site.
1179
- */
1180
- isFree?: boolean;
1181
- /**
1182
- * Billing information for the app instance. Available only in case
1183
- * `{"isFree": false}`.
1184
- */
1185
- billing?: BillingInfo;
1186
- /**
1187
- * List of [permissions](https://dev.wix.com/docs/build-apps/developer-tools/developers-center/example-app-walkthrough/build-an-app#4-add-permissions)
1188
- * that the site owners have granted your app. You set the list of permissions that
1189
- * your app requires from the site owners in your app's Permissions page during the
1190
- * app creation process.
1191
- */
1192
- permissions?: string[];
1193
- /** Plans available to this app instance. */
1194
- availablePlans?: AvailablePlan[];
1195
- /**
1196
- * ID of the Wix site from which the instance of your app has been cloned.
1197
- * Available only in case `{"copiedFromTemplate": true}`.
1198
- * All visual settings of the Wix site and app data are duplicated during the
1199
- * cloning process. Wix also notifies you in case there is any additional
1200
- * external functionality for the original site.
1201
- */
1202
- originInstanceId?: string | null;
1203
- /**
1204
- * __Deprecated__. This parameter will be removed on March 30, 2023. Use
1205
- * `copiedFromTemplate` instead.
1206
- * @deprecated
1207
- */
1208
- isOriginSiteTemplate?: boolean;
1209
- /** Whether the app instance was created when another Wix site was cloned. */
1210
- copiedFromTemplate?: boolean;
1211
- /** Whether the app instance includes a free trial that hasn't started yet. */
1212
- freeTrialAvailable?: boolean;
1213
- }
1214
- interface BillingInfo {
1215
- /** Name of the package that the site owner has paid for. */
1216
- packageName?: string;
1217
- /**
1218
- * Interval of the billing cycle. `"ONE_TIME"` means that site owners have
1219
- * purchased unlimited access to the app with a single, upfront payment.
1220
- */
1221
- billingCycle?: PaymentCycle$1;
1222
- /**
1223
- * Date and time the site owners have purchased the app's paid plan in
1224
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1225
- */
1226
- timeStamp?: string;
1227
- /**
1228
- * Date and time the app's current billing cycle ends in
1229
- * `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for yearly and
1230
- * multi-yearly plans.
1231
- */
1232
- expirationDate?: string | null;
1233
- /**
1234
- * Whether the app's subscription automatically renews at the end of the
1235
- * current billing cycle.
1236
- */
1237
- autoRenewing?: boolean | null;
1238
- /** ID of the invoice for the current billing cycle. */
1239
- invoiceId?: string | null;
1240
- /**
1241
- * Information about any discounts applied to the app instance's current billing cycle.
1242
- * If the site owners applied a developer coupon or Wix Voucher
1243
- * when installing the paid version of your app, this field holds the coupon's
1244
- * name or `“Wix discount coupon”`. Site owners may receive a Wix Voucher when
1245
- * upgrading their Wix subscription. If there is no discount for the
1246
- * current billing cycle, the field is an empty string.
1247
- */
1248
- source?: string | null;
1249
- /** Information about the free trial applied, if relevant. */
1250
- freeTrialInfo?: FreeTrialInfo;
1251
- }
1252
- declare enum PaymentCycle$1 {
1253
- NO_CYCLE = "NO_CYCLE",
1254
- MONTHLY = "MONTHLY",
1255
- YEARLY = "YEARLY",
1256
- ONE_TIME = "ONE_TIME",
1257
- TWO_YEARS = "TWO_YEARS",
1258
- THREE_YEARS = "THREE_YEARS",
1259
- FOUR_YEARS = "FOUR_YEARS",
1260
- FIVE_YEARS = "FIVE_YEARS"
1261
- }
1262
- interface FreeTrialInfo {
1263
- /**
1264
- * Current free trial status.
1265
- *
1266
- * Supported values:
1267
- *
1268
- * - `IN_PROGRESS`: The free trial is currently in progress.
1269
- * - `ENDED`: The free trial has ended.
1270
- * - `NOT_AVAILABLE`: No free trial was applied, as none was available.
1271
- * @readonly
1272
- */
1273
- status?: FreeTrialStatus;
1274
- /**
1275
- * When the free trial has ended. Populated only once the free trial is over.
1276
- * @readonly
1277
- */
1278
- endDate?: Date;
1279
- }
1280
- declare enum FreeTrialStatus {
1281
- UNKNOWN_STATUS = "UNKNOWN_STATUS",
1282
- IN_PROGRESS = "IN_PROGRESS",
1283
- ENDED = "ENDED",
1284
- NOT_AVAILABLE = "NOT_AVAILABLE"
1285
- }
1286
- interface AvailablePlan {
1287
- /** Package name of the available plan. */
1288
- packageName?: string;
1289
- /** Source of the available plan. Can be a bundle or 3rd-party app. */
1290
- source?: string;
1291
- }
1292
- interface AppInstalled {
1293
- /** Unique identifier of the app within the website. */
1294
- appId?: string;
1295
- /** Instance ID of the app in the original website (relevant only when this site was [duplicated from another site](https://support.wix.com/en/article/duplicating-your-site-1472847)). */
1296
- originInstanceId?: string | null;
1297
- }
1298
- interface AppRemoved {
1299
- /** Unique identifier of the app within the website. */
1300
- appId?: string;
1301
- }
1302
- interface PaidPlanPurchased {
1303
- /** Date and time of purchase. */
1304
- operationTimeStamp?: Date;
1305
- /** Purchased app plan. */
1306
- vendorProductId?: string;
1307
- /** Selected payment cycle. */
1308
- cycle?: PaymentCycle$1;
1309
- /** Plan expiration date. */
1310
- expiresOn?: Date;
1311
- /** Coupon applied to purchase (if relevant). */
1312
- couponName?: string | null;
1313
- /** Invoice ID. */
1314
- invoiceId?: string | null;
1315
- }
1316
- interface PaidPlanChanged {
1317
- /** Date and time of change. */
1318
- operationTimeStamp?: Date;
1319
- /** Newly purchased app plan. */
1320
- vendorProductId?: string;
1321
- /** Newly selected payment cycle. */
1322
- cycle?: PaymentCycle$1;
1323
- /** Previous app plan. */
1324
- previousVendorProductId?: string | null;
1325
- /** Previous payment cycle. */
1326
- previousCycle?: PaymentCycle$1;
1327
- /** Coupon applied to purchase (if relevant). */
1328
- couponName?: string | null;
1329
- /** Invoice ID. */
1330
- invoiceId?: string | null;
1331
- }
1332
- interface PaidPlanAutoRenewalCancelled {
1333
- /** Date and time of auto-renewal cancellation. */
1334
- operationTimeStamp?: Date;
1335
- /** Current app plan. */
1336
- vendorProductId?: string;
1337
- /** Current payment cycle. */
1338
- cycle?: PaymentCycle$1;
1339
- /** Supported values: `UNKNOWN_CANCELLATION_TYPE_ERROR_STATE`, `USER_CANCEL`, `FAILED_PAYMENT`, `TRANSFER_CANCELLATION_REASON`. Reason provided by app for cancellation (if relevant). */
1340
- cancelReason?: string | null;
1341
- /** Reason provided by site owner for cancellation (if relevant). */
1342
- userReason?: string | null;
1343
- /** Cancellation type. */
1344
- subscriptionCancellationType?: string | null;
1345
- }
1346
- interface GetAppInstanceRequest {
1347
- }
1348
- interface GetAppInstanceResponse {
1349
- /** Retrieved app instance. */
1350
- instance?: AppInstance;
1351
- /** Information about the corresponding Wix site. */
1352
- site?: SiteInfo;
1353
- }
1354
- interface SiteInfo {
1355
- /** Display name of the site. */
1356
- siteDisplayName?: string | null;
1357
- /**
1358
- * 2-letter language code of the site's locale in
1359
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1360
- */
1361
- locale?: string;
1362
- /**
1363
- * 3-letter currency code for the site's billing in
1364
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1365
- */
1366
- paymentCurrency?: string;
1367
- /** Information about the site's supported languages. */
1368
- multilingual?: Multilingual;
1369
- /** URL of the site. Available only in case the site has been published. */
1370
- url?: string | null;
1371
- /** Description of the site. */
1372
- description?: string | null;
1373
- /** Wix apps that are installed on the site. */
1374
- installedWixApps?: string[];
1375
- /**
1376
- * > **Deprecation Notice:** This parameter will be removed on June 30, 2022. Use `ownerInfo` instead.
1377
- * @deprecated
1378
- */
1379
- ownerEmail?: string | null;
1380
- /**
1381
- * Information about the site owner. Available only when calling
1382
- * _Get App Instance_ with the __Read Site Owner Email__ permission scope.
1383
- */
1384
- ownerInfo?: OwnerInfo;
1385
- /** Site ID. */
1386
- siteId?: string;
1387
- }
1388
- interface Multilingual {
1389
- /** Whether the site supports more than a single language. */
1390
- isMultiLingual?: boolean;
1391
- /** List of supported languages. Returned only when `{"isMultiLingual": true}`. */
1392
- supportedLanguages?: SupportedLanguage[];
1393
- }
1394
- interface SupportedLanguage {
1395
- /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
1396
- languageCode?: string;
1397
- /** Locale. */
1398
- locale?: Locale;
1399
- /** Whether the supported language is the primary language for the site. */
1400
- isPrimary?: boolean;
1401
- /** Language icon. */
1402
- countryCode?: string;
1403
- /** How the language will be resolved. For internal use. */
1404
- resolutionMethod?: ResolutionMethod;
1405
- }
1406
- interface Locale {
1407
- /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
1408
- languageCode?: string;
1409
- /** Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. */
1410
- country?: string;
1411
- }
1412
- declare enum ResolutionMethod {
1413
- QUERY_PARAM = "QUERY_PARAM",
1414
- SUBDOMAIN = "SUBDOMAIN",
1415
- SUBDIRECTORY = "SUBDIRECTORY"
1416
- }
1417
- interface OwnerInfo {
1418
- /** Site owner's email address. Identical to the site owner's login email. */
1419
- email?: string;
1420
- /**
1421
- * Supported values: `VERIFIED_OPT_IN`, `VERIFIED_OPT_OUT`,
1422
- * `NOT_VERIFIED_OPT_IN`, `NOT_VERIFIED_OPT_OUT`.
1423
- *
1424
- * Whether the site owner has verified their email and whether they have chosen
1425
- * to receive email notifications from Wix.
1426
- */
1427
- emailStatus?: string;
1428
- }
1429
- interface GetAppInstanceByInstanceIdRequest {
1430
- /** ID of the app instance to retrieve. */
1431
- instanceId?: string;
1432
- }
1433
- interface MessageEnvelope$1 {
1434
- /** App instance ID. */
1435
- instanceId?: string | null;
1436
- /** Event type. */
1437
- eventType?: string;
1438
- /** The identification type and identity data. */
1439
- identity?: IdentificationData$1;
1440
- /** Stringify payload. */
1441
- data?: string;
1442
- }
1443
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
1444
- /** ID of a site visitor that has not logged in to the site. */
1445
- anonymousVisitorId?: string;
1446
- /** ID of a site visitor that has logged in to the site. */
1447
- memberId?: string;
1448
- /** ID of a Wix user (site owner, contributor, etc.). */
1449
- wixUserId?: string;
1450
- /** ID of an app. */
1451
- appId?: string;
1452
- /** @readonly */
1453
- identityType?: WebhookIdentityType$1;
1454
- }
1455
- /** @oneof */
1456
- interface IdentificationDataIdOneOf$1 {
1457
- /** ID of a site visitor that has not logged in to the site. */
1458
- anonymousVisitorId?: string;
1459
- /** ID of a site visitor that has logged in to the site. */
1460
- memberId?: string;
1461
- /** ID of a Wix user (site owner, contributor, etc.). */
1462
- wixUserId?: string;
1463
- /** ID of an app. */
1464
- appId?: string;
1465
- }
1466
- declare enum WebhookIdentityType$1 {
1467
- UNKNOWN = "UNKNOWN",
1468
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1469
- MEMBER = "MEMBER",
1470
- WIX_USER = "WIX_USER",
1471
- APP = "APP"
1472
- }
1473
- interface FreeTrialInfoNonNullableFields {
1474
- status: FreeTrialStatus;
1475
- }
1476
- interface BillingInfoNonNullableFields {
1477
- packageName: string;
1478
- billingCycle: PaymentCycle$1;
1479
- timeStamp: string;
1480
- freeTrialInfo?: FreeTrialInfoNonNullableFields;
1481
- }
1482
- interface AvailablePlanNonNullableFields {
1483
- packageName: string;
1484
- source: string;
1485
- }
1486
- interface AppInstanceNonNullableFields {
1487
- instanceId: string;
1488
- appName: string;
1489
- isFree: boolean;
1490
- billing?: BillingInfoNonNullableFields;
1491
- permissions: string[];
1492
- availablePlans: AvailablePlanNonNullableFields[];
1493
- isOriginSiteTemplate: boolean;
1494
- copiedFromTemplate: boolean;
1495
- freeTrialAvailable: boolean;
1496
- }
1497
- interface LocaleNonNullableFields {
1498
- languageCode: string;
1499
- country: string;
1500
- }
1501
- interface SupportedLanguageNonNullableFields {
1502
- languageCode: string;
1503
- locale?: LocaleNonNullableFields;
1504
- isPrimary: boolean;
1505
- countryCode: string;
1506
- resolutionMethod: ResolutionMethod;
1507
- }
1508
- interface MultilingualNonNullableFields {
1509
- isMultiLingual: boolean;
1510
- supportedLanguages: SupportedLanguageNonNullableFields[];
1511
- }
1512
- interface OwnerInfoNonNullableFields {
1513
- email: string;
1514
- emailStatus: string;
1515
- }
1516
- interface SiteInfoNonNullableFields {
1517
- locale: string;
1518
- paymentCurrency: string;
1519
- multilingual?: MultilingualNonNullableFields;
1520
- installedWixApps: string[];
1521
- ownerInfo?: OwnerInfoNonNullableFields;
1522
- siteId: string;
1523
- }
1524
- interface GetAppInstanceResponseNonNullableFields {
1525
- instance?: AppInstanceNonNullableFields;
1526
- site?: SiteInfoNonNullableFields;
1527
- }
1528
- interface BaseEventMetadata {
1529
- /** App instance ID. */
1530
- instanceId?: string | null;
1531
- /** Event type. */
1532
- eventType?: string;
1533
- /** The identification type and identity data. */
1534
- identity?: IdentificationData$1;
1535
- }
1536
- interface AppInstanceInstalledEnvelope {
1537
- data: AppInstalled;
1538
- metadata: BaseEventMetadata;
1539
- }
1540
- interface AppInstanceRemovedEnvelope {
1541
- data: AppRemoved;
1542
- metadata: BaseEventMetadata;
1543
- }
1544
- interface AppInstancePaidPlanPurchasedEnvelope {
1545
- data: PaidPlanPurchased;
1546
- metadata: BaseEventMetadata;
1547
- }
1548
- interface AppInstancePaidPlanChangedEnvelope {
1549
- data: PaidPlanChanged;
1550
- metadata: BaseEventMetadata;
1551
- }
1552
- interface AppInstancePaidPlanAutoRenewalCancelledEnvelope {
1553
- data: PaidPlanAutoRenewalCancelled;
1554
- metadata: BaseEventMetadata;
1555
- }
1556
-
1557
- declare function getAppInstance$1(httpClient: HttpClient$3): GetAppInstanceSignature;
1558
- interface GetAppInstanceSignature {
1559
- /**
1560
- * Retrieves data about the instance of your app that's installed on a Wix site and data about the site itself.
1561
- *
1562
- * Call this function when you need information about a specific instance of your app and the site it’s installed on. For example, you may need to know whether the user has installed a free or paid version of your app, or to check what other Wix apps are installed on the site.
1563
- *
1564
- * You must authenticate as a [Wix App](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities#wix-apps). If you are calling this function from a [dashboard extension](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/dashboard-extensions/about-dashboard-extensions) in the [CLI](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-cli/about-the-wix-cli-for-apps), Wix App authentication is passed automatically. Otherwise, you need to call the function with [elevated permissions](https://dev.wix.com/docs/sdk/articles/working-with-the-sdk/about-elevated-permissions).
1565
- *
1566
- * If you want `site.ownerInfo` to be included in the response, you must have the __Read Site Owner Email__ permission scope in addition to __WIX_DEVELOPERS.MANAGE_APP_INSTANCE__.
1567
- */
1568
- (): Promise<GetAppInstanceResponse & GetAppInstanceResponseNonNullableFields>;
1569
- }
1570
- declare const onAppInstanceInstalled$1: EventDefinition$4<AppInstanceInstalledEnvelope, "AppInstalled">;
1571
- declare const onAppInstanceRemoved$1: EventDefinition$4<AppInstanceRemovedEnvelope, "AppRemoved">;
1572
- declare const onAppInstancePaidPlanPurchased$1: EventDefinition$4<AppInstancePaidPlanPurchasedEnvelope, "PaidPlanPurchased">;
1573
- declare const onAppInstancePaidPlanChanged$1: EventDefinition$4<AppInstancePaidPlanChangedEnvelope, "PaidPlanChanged">;
1574
- declare const onAppInstancePaidPlanAutoRenewalCancelled$1: EventDefinition$4<AppInstancePaidPlanAutoRenewalCancelledEnvelope, "PaidPlanAutoRenewalCancelled">;
1575
-
1576
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
1577
- __type: 'event-definition';
1578
- type: Type;
1579
- isDomainEvent?: boolean;
1580
- transformations?: (envelope: unknown) => Payload;
1581
- __payload: Payload;
1582
- };
1583
- declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
1584
- type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
1585
- type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
1586
-
1587
- declare global {
1588
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1589
- interface SymbolConstructor {
1590
- readonly observable: symbol;
1591
- }
1592
- }
1593
-
1594
- declare function createEventModule<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
1595
-
1596
- declare const getAppInstance: MaybeContext$3<BuildRESTFunction$3<typeof getAppInstance$1> & typeof getAppInstance$1>;
1597
-
1598
- type _publicOnAppInstanceInstalledType = typeof onAppInstanceInstalled$1;
1599
- /**
1600
- * Triggered when an instance of your app is installed on a Wix site.
1601
- */
1602
- declare const onAppInstanceInstalled: ReturnType<typeof createEventModule<_publicOnAppInstanceInstalledType>>;
1603
-
1604
- type _publicOnAppInstanceRemovedType = typeof onAppInstanceRemoved$1;
1605
- /**
1606
- * Triggered when an instance of your app is uninstalled from a Wix site.
1607
- */
1608
- declare const onAppInstanceRemoved: ReturnType<typeof createEventModule<_publicOnAppInstanceRemovedType>>;
1609
-
1610
- type _publicOnAppInstancePaidPlanPurchasedType = typeof onAppInstancePaidPlanPurchased$1;
1611
- /**
1612
- * Triggered when a site owner purchases a paid plan for your app.
1613
- */
1614
- declare const onAppInstancePaidPlanPurchased: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanPurchasedType>>;
1615
-
1616
- type _publicOnAppInstancePaidPlanChangedType = typeof onAppInstancePaidPlanChanged$1;
1617
- /**
1618
- * Triggered when a site owner upgrades or downgrades their plan for your app.
1619
- */
1620
- declare const onAppInstancePaidPlanChanged: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanChangedType>>;
1621
-
1622
- type _publicOnAppInstancePaidPlanAutoRenewalCancelledType = typeof onAppInstancePaidPlanAutoRenewalCancelled$1;
1623
- /**
1624
- * Triggered when a site owner cancels a paid plan for your app. The
1625
- * site owner can continue to use your app until the end of the current billing
1626
- * cycle.
1627
- */
1628
- declare const onAppInstancePaidPlanAutoRenewalCancelled: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanAutoRenewalCancelledType>>;
1629
-
1630
- type index_d$3_AppInstalled = AppInstalled;
1631
- type index_d$3_AppInstance = AppInstance;
1632
- type index_d$3_AppInstanceInstalledEnvelope = AppInstanceInstalledEnvelope;
1633
- type index_d$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope = AppInstancePaidPlanAutoRenewalCancelledEnvelope;
1634
- type index_d$3_AppInstancePaidPlanChangedEnvelope = AppInstancePaidPlanChangedEnvelope;
1635
- type index_d$3_AppInstancePaidPlanPurchasedEnvelope = AppInstancePaidPlanPurchasedEnvelope;
1636
- type index_d$3_AppInstanceRemovedEnvelope = AppInstanceRemovedEnvelope;
1637
- type index_d$3_AppRemoved = AppRemoved;
1638
- type index_d$3_AvailablePlan = AvailablePlan;
1639
- type index_d$3_BaseEventMetadata = BaseEventMetadata;
1640
- type index_d$3_BillingInfo = BillingInfo;
1641
- type index_d$3_FreeTrialInfo = FreeTrialInfo;
1642
- type index_d$3_FreeTrialStatus = FreeTrialStatus;
1643
- declare const index_d$3_FreeTrialStatus: typeof FreeTrialStatus;
1644
- type index_d$3_GetAppInstanceByInstanceIdRequest = GetAppInstanceByInstanceIdRequest;
1645
- type index_d$3_GetAppInstanceRequest = GetAppInstanceRequest;
1646
- type index_d$3_GetAppInstanceResponse = GetAppInstanceResponse;
1647
- type index_d$3_GetAppInstanceResponseNonNullableFields = GetAppInstanceResponseNonNullableFields;
1648
- type index_d$3_Locale = Locale;
1649
- type index_d$3_Multilingual = Multilingual;
1650
- type index_d$3_OwnerInfo = OwnerInfo;
1651
- type index_d$3_PaidPlanAutoRenewalCancelled = PaidPlanAutoRenewalCancelled;
1652
- type index_d$3_PaidPlanChanged = PaidPlanChanged;
1653
- type index_d$3_PaidPlanPurchased = PaidPlanPurchased;
1654
- type index_d$3_ResolutionMethod = ResolutionMethod;
1655
- declare const index_d$3_ResolutionMethod: typeof ResolutionMethod;
1656
- type index_d$3_SiteInfo = SiteInfo;
1657
- type index_d$3_SupportedLanguage = SupportedLanguage;
1658
- type index_d$3__publicOnAppInstanceInstalledType = _publicOnAppInstanceInstalledType;
1659
- type index_d$3__publicOnAppInstancePaidPlanAutoRenewalCancelledType = _publicOnAppInstancePaidPlanAutoRenewalCancelledType;
1660
- type index_d$3__publicOnAppInstancePaidPlanChangedType = _publicOnAppInstancePaidPlanChangedType;
1661
- type index_d$3__publicOnAppInstancePaidPlanPurchasedType = _publicOnAppInstancePaidPlanPurchasedType;
1662
- type index_d$3__publicOnAppInstanceRemovedType = _publicOnAppInstanceRemovedType;
1663
- declare const index_d$3_getAppInstance: typeof getAppInstance;
1664
- declare const index_d$3_onAppInstanceInstalled: typeof onAppInstanceInstalled;
1665
- declare const index_d$3_onAppInstancePaidPlanAutoRenewalCancelled: typeof onAppInstancePaidPlanAutoRenewalCancelled;
1666
- declare const index_d$3_onAppInstancePaidPlanChanged: typeof onAppInstancePaidPlanChanged;
1667
- declare const index_d$3_onAppInstancePaidPlanPurchased: typeof onAppInstancePaidPlanPurchased;
1668
- declare const index_d$3_onAppInstanceRemoved: typeof onAppInstanceRemoved;
1669
- declare namespace index_d$3 {
1670
- export { type index_d$3_AppInstalled as AppInstalled, type index_d$3_AppInstance as AppInstance, type index_d$3_AppInstanceInstalledEnvelope as AppInstanceInstalledEnvelope, type index_d$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope as AppInstancePaidPlanAutoRenewalCancelledEnvelope, type index_d$3_AppInstancePaidPlanChangedEnvelope as AppInstancePaidPlanChangedEnvelope, type index_d$3_AppInstancePaidPlanPurchasedEnvelope as AppInstancePaidPlanPurchasedEnvelope, type index_d$3_AppInstanceRemovedEnvelope as AppInstanceRemovedEnvelope, type index_d$3_AppRemoved as AppRemoved, type index_d$3_AvailablePlan as AvailablePlan, type index_d$3_BaseEventMetadata as BaseEventMetadata, type index_d$3_BillingInfo as BillingInfo, type index_d$3_FreeTrialInfo as FreeTrialInfo, index_d$3_FreeTrialStatus as FreeTrialStatus, type index_d$3_GetAppInstanceByInstanceIdRequest as GetAppInstanceByInstanceIdRequest, type index_d$3_GetAppInstanceRequest as GetAppInstanceRequest, type index_d$3_GetAppInstanceResponse as GetAppInstanceResponse, type index_d$3_GetAppInstanceResponseNonNullableFields as GetAppInstanceResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type index_d$3_Locale as Locale, type MessageEnvelope$1 as MessageEnvelope, type index_d$3_Multilingual as Multilingual, type index_d$3_OwnerInfo as OwnerInfo, type index_d$3_PaidPlanAutoRenewalCancelled as PaidPlanAutoRenewalCancelled, type index_d$3_PaidPlanChanged as PaidPlanChanged, type index_d$3_PaidPlanPurchased as PaidPlanPurchased, PaymentCycle$1 as PaymentCycle, index_d$3_ResolutionMethod as ResolutionMethod, type index_d$3_SiteInfo as SiteInfo, type index_d$3_SupportedLanguage as SupportedLanguage, WebhookIdentityType$1 as WebhookIdentityType, type index_d$3__publicOnAppInstanceInstalledType as _publicOnAppInstanceInstalledType, type index_d$3__publicOnAppInstancePaidPlanAutoRenewalCancelledType as _publicOnAppInstancePaidPlanAutoRenewalCancelledType, type index_d$3__publicOnAppInstancePaidPlanChangedType as _publicOnAppInstancePaidPlanChangedType, type index_d$3__publicOnAppInstancePaidPlanPurchasedType as _publicOnAppInstancePaidPlanPurchasedType, type index_d$3__publicOnAppInstanceRemovedType as _publicOnAppInstanceRemovedType, index_d$3_getAppInstance as getAppInstance, index_d$3_onAppInstanceInstalled as onAppInstanceInstalled, index_d$3_onAppInstancePaidPlanAutoRenewalCancelled as onAppInstancePaidPlanAutoRenewalCancelled, index_d$3_onAppInstancePaidPlanChanged as onAppInstancePaidPlanChanged, index_d$3_onAppInstancePaidPlanPurchased as onAppInstancePaidPlanPurchased, index_d$3_onAppInstanceRemoved as onAppInstanceRemoved, onAppInstanceInstalled$1 as publicOnAppInstanceInstalled, onAppInstancePaidPlanAutoRenewalCancelled$1 as publicOnAppInstancePaidPlanAutoRenewalCancelled, onAppInstancePaidPlanChanged$1 as publicOnAppInstancePaidPlanChanged, onAppInstancePaidPlanPurchased$1 as publicOnAppInstancePaidPlanPurchased, onAppInstanceRemoved$1 as publicOnAppInstanceRemoved };
1671
- }
1672
-
1673
- type HostModule$2<T, H extends Host$2> = {
1674
- __type: 'host';
1675
- create(host: H): T;
1676
- };
1677
- type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
1678
- type Host$2<Environment = unknown> = {
1679
- channel: {
1680
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
1681
- disconnect: () => void;
1682
- } | Promise<{
1683
- disconnect: () => void;
1684
- }>;
1685
- };
1686
- environment?: Environment;
1687
- /**
1688
- * Optional bast url to use for API requests, for example `www.wixapis.com`
1689
- */
1690
- apiBaseUrl?: string;
1691
- /**
1692
- * Possible data to be provided by every host, for cross cutting concerns
1693
- * like internationalization, billing, etc.
1694
- */
1695
- essentials?: {
1696
- /**
1697
- * The language of the currently viewed session
1698
- */
1699
- language?: string;
1700
- /**
1701
- * The locale of the currently viewed session
1702
- */
1703
- locale?: string;
1704
- /**
1705
- * Any headers that should be passed through to the API requests
1706
- */
1707
- passThroughHeaders?: Record<string, string>;
1708
- };
1709
- };
1710
-
1711
- type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
1712
- interface HttpClient$2 {
1713
- request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
1714
- fetchWithAuth: typeof fetch;
1715
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
1716
- getActiveToken?: () => string | undefined;
1717
- }
1718
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
1719
- type HttpResponse$2<T = any> = {
1720
- data: T;
1721
- status: number;
1722
- statusText: string;
1723
- headers: any;
1724
- request?: any;
1725
- };
1726
- type RequestOptions$2<_TResponse = any, Data = any> = {
1727
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1728
- url: string;
1729
- data?: Data;
1730
- params?: URLSearchParams;
1731
- } & APIMetadata$2;
1732
- type APIMetadata$2 = {
1733
- methodFqn?: string;
1734
- entityFqdn?: string;
1735
- packageName?: string;
1736
- };
1737
- type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
1738
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
1739
- __type: 'event-definition';
1740
- type: Type;
1741
- isDomainEvent?: boolean;
1742
- transformations?: (envelope: unknown) => Payload;
1743
- __payload: Payload;
1744
- };
1745
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
1746
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
1747
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
1748
-
1749
- type ServicePluginMethodInput$2 = {
1750
- request: any;
1751
- metadata: any;
1752
- };
1753
- type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
1754
- type ServicePluginMethodMetadata$2 = {
1755
- name: string;
1756
- primaryHttpMappingPath: string;
1757
- transformations: {
1758
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
1759
- toREST: (...args: unknown[]) => unknown;
1760
- };
1761
- };
1762
- type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
1763
- __type: 'service-plugin-definition';
1764
- componentType: string;
1765
- methods: ServicePluginMethodMetadata$2[];
1766
- __contract: Contract;
1767
- };
1768
- declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
1769
- type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
1770
- declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
1771
-
1772
- type RequestContext$2 = {
1773
- isSSR: boolean;
1774
- host: string;
1775
- protocol?: string;
1776
- };
1777
- type ResponseTransformer$2 = (data: any, headers?: any) => any;
1778
- /**
1779
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
1780
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
1781
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
1782
- */
1783
- type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
1784
- type AmbassadorRequestOptions$2<T = any> = {
1785
- _?: T;
1786
- url?: string;
1787
- method?: Method$2;
1788
- params?: any;
1789
- data?: any;
1790
- transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
1791
- };
1792
- type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
1793
- __isAmbassador: boolean;
1794
- };
1795
- type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
1796
- type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
1797
-
1798
- declare global {
1799
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1800
- interface SymbolConstructor {
1801
- readonly observable: symbol;
1802
- }
1803
- }
1804
-
1805
- declare const emptyObjectSymbol$2: unique symbol;
1806
-
1807
- /**
1808
- Represents a strictly empty plain object, the `{}` value.
1809
-
1810
- 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)).
1811
-
1812
- @example
1813
- ```
1814
- import type {EmptyObject} from 'type-fest';
1815
-
1816
- // The following illustrates the problem with `{}`.
1817
- const foo1: {} = {}; // Pass
1818
- const foo2: {} = []; // Pass
1819
- const foo3: {} = 42; // Pass
1820
- const foo4: {} = {a: 1}; // Pass
1821
-
1822
- // With `EmptyObject` only the first case is valid.
1823
- const bar1: EmptyObject = {}; // Pass
1824
- const bar2: EmptyObject = 42; // Fail
1825
- const bar3: EmptyObject = []; // Fail
1826
- const bar4: EmptyObject = {a: 1}; // Fail
1827
- ```
1828
-
1829
- 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}.
1830
-
1831
- @category Object
1832
- */
1833
- type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
1834
-
1835
- /**
1836
- Returns a boolean for whether the two given types are equal.
1837
-
1838
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
1839
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
1840
-
1841
- Use-cases:
1842
- - If you want to make a conditional branch based on the result of a comparison of two types.
1843
-
1844
- @example
1845
- ```
1846
- import type {IsEqual} from 'type-fest';
1847
-
1848
- // This type returns a boolean for whether the given array includes the given item.
1849
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
1850
- type Includes<Value extends readonly any[], Item> =
1851
- Value extends readonly [Value[0], ...infer rest]
1852
- ? IsEqual<Value[0], Item> extends true
1853
- ? true
1854
- : Includes<rest, Item>
1855
- : false;
1856
- ```
1857
-
1858
- @category Type Guard
1859
- @category Utilities
1860
- */
1861
- type IsEqual$2<A, B> =
1862
- (<G>() => G extends A ? 1 : 2) extends
1863
- (<G>() => G extends B ? 1 : 2)
1864
- ? true
1865
- : false;
1866
-
1867
- /**
1868
- Filter out keys from an object.
1869
-
1870
- Returns `never` if `Exclude` is strictly equal to `Key`.
1871
- Returns `never` if `Key` extends `Exclude`.
1872
- Returns `Key` otherwise.
1873
-
1874
- @example
1875
- ```
1876
- type Filtered = Filter<'foo', 'foo'>;
1877
- //=> never
1878
- ```
1879
-
1880
- @example
1881
- ```
1882
- type Filtered = Filter<'bar', string>;
1883
- //=> never
1884
- ```
1885
-
1886
- @example
1887
- ```
1888
- type Filtered = Filter<'bar', 'foo'>;
1889
- //=> 'bar'
1890
- ```
1891
-
1892
- @see {Except}
1893
- */
1894
- type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1895
-
1896
- type ExceptOptions$2 = {
1897
- /**
1898
- Disallow assigning non-specified properties.
1899
-
1900
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1901
-
1902
- @default false
1903
- */
1904
- requireExactProps?: boolean;
1905
- };
1906
-
1907
- /**
1908
- Create a type from an object type without certain keys.
1909
-
1910
- We recommend setting the `requireExactProps` option to `true`.
1911
-
1912
- 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.
1913
-
1914
- 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)).
1915
-
1916
- @example
1917
- ```
1918
- import type {Except} from 'type-fest';
1919
-
1920
- type Foo = {
1921
- a: number;
1922
- b: string;
1923
- };
1924
-
1925
- type FooWithoutA = Except<Foo, 'a'>;
1926
- //=> {b: string}
1927
-
1928
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1929
- //=> errors: 'a' does not exist in type '{ b: string; }'
1930
-
1931
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1932
- //=> {a: number} & Partial<Record<"b", never>>
1933
-
1934
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1935
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1936
- ```
1937
-
1938
- @category Object
1939
- */
1940
- type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
1941
- [KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
1942
- } & (Options['requireExactProps'] extends true
1943
- ? Partial<Record<KeysType, never>>
1944
- : {});
1945
-
1946
- /**
1947
- Extract the keys from a type where the value type of the key extends the given `Condition`.
1948
-
1949
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1950
-
1951
- @example
1952
- ```
1953
- import type {ConditionalKeys} from 'type-fest';
1954
-
1955
- interface Example {
1956
- a: string;
1957
- b: string | number;
1958
- c?: string;
1959
- d: {};
1960
- }
1961
-
1962
- type StringKeysOnly = ConditionalKeys<Example, string>;
1963
- //=> 'a'
1964
- ```
1965
-
1966
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1967
-
1968
- @example
1969
- ```
1970
- import type {ConditionalKeys} from 'type-fest';
1971
-
1972
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1973
- //=> 'a' | 'c'
1974
- ```
1975
-
1976
- @category Object
1977
- */
1978
- type ConditionalKeys$2<Base, Condition> = NonNullable<
1979
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1980
- {
1981
- // Map through all the keys of the given base type.
1982
- [Key in keyof Base]:
1983
- // Pick only keys with types extending the given `Condition` type.
1984
- Base[Key] extends Condition
1985
- // Retain this key since the condition passes.
1986
- ? Key
1987
- // Discard this key since the condition fails.
1988
- : never;
1989
-
1990
- // Convert the produced object into a union type of the keys which passed the conditional test.
1991
- }[keyof Base]
1992
- >;
1993
-
1994
- /**
1995
- Exclude keys from a shape that matches the given `Condition`.
1996
-
1997
- 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.
1998
-
1999
- @example
2000
- ```
2001
- import type {Primitive, ConditionalExcept} from 'type-fest';
2002
-
2003
- class Awesome {
2004
- name: string;
2005
- successes: number;
2006
- failures: bigint;
2007
-
2008
- run() {}
2009
- }
2010
-
2011
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
2012
- //=> {run: () => void}
2013
- ```
2014
-
2015
- @example
2016
- ```
2017
- import type {ConditionalExcept} from 'type-fest';
2018
-
2019
- interface Example {
2020
- a: string;
2021
- b: string | number;
2022
- c: () => void;
2023
- d: {};
2024
- }
2025
-
2026
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
2027
- //=> {b: string | number; c: () => void; d: {}}
2028
- ```
2029
-
2030
- @category Object
2031
- */
2032
- type ConditionalExcept$2<Base, Condition> = Except$2<
2033
- Base,
2034
- ConditionalKeys$2<Base, Condition>
2035
- >;
2036
-
2037
- /**
2038
- * Descriptors are objects that describe the API of a module, and the module
2039
- * can either be a REST module or a host module.
2040
- * This type is recursive, so it can describe nested modules.
2041
- */
2042
- type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$2<any> | ServicePluginDefinition$2<any> | {
2043
- [key: string]: Descriptors$2 | PublicMetadata$2 | any;
2044
- };
2045
- /**
2046
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
2047
- * and returns an object with the same structure, but with all descriptors replaced with their API.
2048
- * Any non-descriptor properties are removed from the returned object, including descriptors that
2049
- * do not match the given host (as they will not work with the given host).
2050
- */
2051
- type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
2052
- done: T;
2053
- recurse: T extends {
2054
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
2055
- } ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
2056
- [Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
2057
- -1,
2058
- 0,
2059
- 1,
2060
- 2,
2061
- 3,
2062
- 4,
2063
- 5
2064
- ][Depth]> : never;
2065
- }, EmptyObject$2>;
2066
- }[Depth extends -1 ? 'done' : 'recurse'];
2067
- type PublicMetadata$2 = {
2068
- PACKAGE_NAME?: string;
2069
- };
2070
-
2071
- declare global {
2072
- interface ContextualClient {
2073
- }
2074
- }
2075
- /**
2076
- * A type used to create concerete types from SDK descriptors in
2077
- * case a contextual client is available.
2078
- */
2079
- type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
2080
- host: Host$2;
2081
- } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
2082
-
2083
- interface SendBIEventResponse {
2084
- }
2085
- interface SendBIEventRequest {
2086
- /**
2087
- * Name of the event that's triggered in your app.
2088
- *
2089
- * + `"APP_DASHBOARD_LOADED"`: A site onwer or contributor loads your app's dashboard.
2090
- * + `"APP_FINISHED_CONFIGURATION"`: The site owner completes all required configurations for your app in your app's dashboard.
2091
- * + `"APP_UPGRADED"`: The site owner upgrades your app's paid plan. An upgrade means that they have finished the checkout flow on the app's side but not necessarily on Wix's side.
2092
- * + `"PRIMARY_ACTION_PERFORMED"`: A site owner, contributor, or visitor triggers your app's primary action. For example, a site visitor writes a product review using your product review app.
2093
- * + `"CHARGE"`: You charge money from the site owner. For example, when the site owner purchases or renews a subscription for your app. Make sure to also send `eventData` and a key of `sum`.
2094
- * + `"FUNDS_RETURNED"`: Trigger this event when you send money back to a site owner (for example, refunds or chargebacks). Make sure to also send the charge amount inside `eventData`. For example, `{"eventData": {"sum": "5.99"}}`.
2095
- * + `"CUSTOM"`: Any event that's not listed here. Make sure to also send `customEventName`.
2096
- * + `"APP_DEPLOYED"`: Your app’s internal code implementation is changed and might affect user flows or cause a regression.
2097
- * + `"APP_FINISH_BUSINESS_SETUP"`: __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead.
2098
- * + `"APP_SETUP_FINISHED"`: The site owner completes your app's required business setup.
2099
- */
2100
- eventName?: EventName;
2101
- /**
2102
- * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
2103
- *
2104
- * Min: 2 characters
2105
- */
2106
- customEventName?: string | null;
2107
- /**
2108
- * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
2109
- * You may also submit data with keys that aren't listed here.
2110
- *
2111
- * Additional data about your app's event.
2112
- *
2113
- * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
2114
- * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
2115
- * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
2116
- * + `"reason"`: Information about why the event was triggered in your app.
2117
- * + `"app_plan_id"`: ID of the your app's plan as displayed in your app's dashboard. Note that it's the same value as `vendorProductId` in the [Paid Plan Purchased webhook](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/paid-plan-purchased).
2118
- */
2119
- eventData?: Record<string, string>;
2120
- }
2121
- declare enum EventName {
2122
- UNKNOWN = "UNKNOWN",
2123
- APP_DASHBOARD_LOADED = "APP_DASHBOARD_LOADED",
2124
- APP_FINISHED_CONFIGURATION = "APP_FINISHED_CONFIGURATION",
2125
- APP_UPGRADED = "APP_UPGRADED",
2126
- PRIMARY_ACTION_PERFORMED = "PRIMARY_ACTION_PERFORMED",
2127
- CUSTOM = "CUSTOM",
2128
- CHARGE = "CHARGE",
2129
- FUNDS_RETURNED = "FUNDS_RETURNED",
2130
- APP_FINISH_BUSINESS_SETUP = "APP_FINISH_BUSINESS_SETUP",
2131
- APP_DEPLOYED = "APP_DEPLOYED",
2132
- APP_SETUP_FINISHED = "APP_SETUP_FINISHED"
2133
- }
2134
- interface SendBiEventOptions {
2135
- /**
2136
- * Name of the event that's triggered in your app.
2137
- *
2138
- * + `"APP_DASHBOARD_LOADED"`: A site onwer or contributor loads your app's dashboard.
2139
- * + `"APP_FINISHED_CONFIGURATION"`: The site owner completes all required configurations for your app in your app's dashboard.
2140
- * + `"APP_UPGRADED"`: The site owner upgrades your app's paid plan. An upgrade means that they have finished the checkout flow on the app's side but not necessarily on Wix's side.
2141
- * + `"PRIMARY_ACTION_PERFORMED"`: A site owner, contributor, or visitor triggers your app's primary action. For example, a site visitor writes a product review using your product review app.
2142
- * + `"CHARGE"`: You charge money from the site owner. For example, when the site owner purchases or renews a subscription for your app. Make sure to also send `eventData` and a key of `sum`.
2143
- * + `"FUNDS_RETURNED"`: Trigger this event when you send money back to a site owner (for example, refunds or chargebacks). Make sure to also send the charge amount inside `eventData`. For example, `{"eventData": {"sum": "5.99"}}`.
2144
- * + `"CUSTOM"`: Any event that's not listed here. Make sure to also send `customEventName`.
2145
- * + `"APP_DEPLOYED"`: Your app’s internal code implementation is changed and might affect user flows or cause a regression.
2146
- * + `"APP_FINISH_BUSINESS_SETUP"`: __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead.
2147
- * + `"APP_SETUP_FINISHED"`: The site owner completes your app's required business setup.
2148
- */
2149
- eventName?: EventName;
2150
- /**
2151
- * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
2152
- *
2153
- * Min: 2 characters
2154
- */
2155
- customEventName?: string | null;
2156
- /**
2157
- * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
2158
- * You may also submit data with keys that aren't listed here.
2159
- *
2160
- * Additional data about your app's event.
2161
- *
2162
- * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
2163
- * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
2164
- * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
2165
- * + `"reason"`: Information about why the event was triggered in your app.
2166
- * + `"app_plan_id"`: ID of the your app's plan as displayed in your app's dashboard. Note that it's the same value as `vendorProductId` in the [Paid Plan Purchased webhook](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/paid-plan-purchased).
2167
- */
2168
- eventData?: Record<string, string>;
2169
- }
2170
-
2171
- declare function sendBiEvent$1(httpClient: HttpClient$2): SendBiEventSignature;
2172
- interface SendBiEventSignature {
2173
- /**
2174
- * Submit a BI event to Wix.
2175
- */
2176
- (options?: SendBiEventOptions | undefined): Promise<void>;
2177
- }
2178
-
2179
- declare const sendBiEvent: MaybeContext$2<BuildRESTFunction$2<typeof sendBiEvent$1> & typeof sendBiEvent$1>;
2180
-
2181
- type index_d$2_EventName = EventName;
2182
- declare const index_d$2_EventName: typeof EventName;
2183
- type index_d$2_SendBIEventRequest = SendBIEventRequest;
2184
- type index_d$2_SendBIEventResponse = SendBIEventResponse;
2185
- type index_d$2_SendBiEventOptions = SendBiEventOptions;
2186
- declare const index_d$2_sendBiEvent: typeof sendBiEvent;
2187
- declare namespace index_d$2 {
2188
- export { index_d$2_EventName as EventName, type index_d$2_SendBIEventRequest as SendBIEventRequest, type index_d$2_SendBIEventResponse as SendBIEventResponse, type index_d$2_SendBiEventOptions as SendBiEventOptions, index_d$2_sendBiEvent as sendBiEvent };
2189
- }
2190
-
2191
- type HostModule$1<T, H extends Host$1> = {
2192
- __type: 'host';
2193
- create(host: H): T;
2194
- };
2195
- type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
2196
- type Host$1<Environment = unknown> = {
2197
- channel: {
2198
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
2199
- disconnect: () => void;
2200
- } | Promise<{
2201
- disconnect: () => void;
2202
- }>;
2203
- };
2204
- environment?: Environment;
2205
- /**
2206
- * Optional bast url to use for API requests, for example `www.wixapis.com`
2207
- */
2208
- apiBaseUrl?: string;
2209
- /**
2210
- * Possible data to be provided by every host, for cross cutting concerns
2211
- * like internationalization, billing, etc.
2212
- */
2213
- essentials?: {
2214
- /**
2215
- * The language of the currently viewed session
2216
- */
2217
- language?: string;
2218
- /**
2219
- * The locale of the currently viewed session
2220
- */
2221
- locale?: string;
2222
- /**
2223
- * Any headers that should be passed through to the API requests
2224
- */
2225
- passThroughHeaders?: Record<string, string>;
2226
- };
2227
- };
2228
-
2229
- type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
2230
- interface HttpClient$1 {
2231
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
2232
- fetchWithAuth: typeof fetch;
2233
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
2234
- getActiveToken?: () => string | undefined;
2235
- }
2236
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
2237
- type HttpResponse$1<T = any> = {
2238
- data: T;
2239
- status: number;
2240
- statusText: string;
2241
- headers: any;
2242
- request?: any;
2243
- };
2244
- type RequestOptions$1<_TResponse = any, Data = any> = {
2245
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
2246
- url: string;
2247
- data?: Data;
2248
- params?: URLSearchParams;
2249
- } & APIMetadata$1;
2250
- type APIMetadata$1 = {
2251
- methodFqn?: string;
2252
- entityFqdn?: string;
2253
- packageName?: string;
2254
- };
2255
- type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
2256
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
2257
- __type: 'event-definition';
2258
- type: Type;
2259
- isDomainEvent?: boolean;
2260
- transformations?: (envelope: unknown) => Payload;
2261
- __payload: Payload;
2262
- };
2263
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
2264
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
2265
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
2266
-
2267
- type ServicePluginMethodInput$1 = {
2268
- request: any;
2269
- metadata: any;
2270
- };
2271
- type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
2272
- type ServicePluginMethodMetadata$1 = {
2273
- name: string;
2274
- primaryHttpMappingPath: string;
2275
- transformations: {
2276
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
2277
- toREST: (...args: unknown[]) => unknown;
2278
- };
2279
- };
2280
- type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
2281
- __type: 'service-plugin-definition';
2282
- componentType: string;
2283
- methods: ServicePluginMethodMetadata$1[];
2284
- __contract: Contract;
2285
- };
2286
- declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
2287
- type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
2288
- declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
2289
-
2290
- type RequestContext$1 = {
2291
- isSSR: boolean;
2292
- host: string;
2293
- protocol?: string;
2294
- };
2295
- type ResponseTransformer$1 = (data: any, headers?: any) => any;
2296
- /**
2297
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
2298
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
2299
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
2300
- */
2301
- type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
2302
- type AmbassadorRequestOptions$1<T = any> = {
2303
- _?: T;
2304
- url?: string;
2305
- method?: Method$1;
2306
- params?: any;
2307
- data?: any;
2308
- transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
2309
- };
2310
- type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
2311
- __isAmbassador: boolean;
2312
- };
2313
- type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
2314
- type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
2315
-
2316
- declare global {
2317
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
2318
- interface SymbolConstructor {
2319
- readonly observable: symbol;
2320
- }
2321
- }
2322
-
2323
- declare const emptyObjectSymbol$1: unique symbol;
2324
-
2325
- /**
2326
- Represents a strictly empty plain object, the `{}` value.
2327
-
2328
- 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)).
2329
-
2330
- @example
2331
- ```
2332
- import type {EmptyObject} from 'type-fest';
2333
-
2334
- // The following illustrates the problem with `{}`.
2335
- const foo1: {} = {}; // Pass
2336
- const foo2: {} = []; // Pass
2337
- const foo3: {} = 42; // Pass
2338
- const foo4: {} = {a: 1}; // Pass
2339
-
2340
- // With `EmptyObject` only the first case is valid.
2341
- const bar1: EmptyObject = {}; // Pass
2342
- const bar2: EmptyObject = 42; // Fail
2343
- const bar3: EmptyObject = []; // Fail
2344
- const bar4: EmptyObject = {a: 1}; // Fail
2345
- ```
2346
-
2347
- 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}.
2348
-
2349
- @category Object
2350
- */
2351
- type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
2352
-
2353
- /**
2354
- Returns a boolean for whether the two given types are equal.
2355
-
2356
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
2357
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
2358
-
2359
- Use-cases:
2360
- - If you want to make a conditional branch based on the result of a comparison of two types.
2361
-
2362
- @example
2363
- ```
2364
- import type {IsEqual} from 'type-fest';
2365
-
2366
- // This type returns a boolean for whether the given array includes the given item.
2367
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
2368
- type Includes<Value extends readonly any[], Item> =
2369
- Value extends readonly [Value[0], ...infer rest]
2370
- ? IsEqual<Value[0], Item> extends true
2371
- ? true
2372
- : Includes<rest, Item>
2373
- : false;
2374
- ```
2375
-
2376
- @category Type Guard
2377
- @category Utilities
2378
- */
2379
- type IsEqual$1<A, B> =
2380
- (<G>() => G extends A ? 1 : 2) extends
2381
- (<G>() => G extends B ? 1 : 2)
2382
- ? true
2383
- : false;
2384
-
2385
- /**
2386
- Filter out keys from an object.
2387
-
2388
- Returns `never` if `Exclude` is strictly equal to `Key`.
2389
- Returns `never` if `Key` extends `Exclude`.
2390
- Returns `Key` otherwise.
2391
-
2392
- @example
2393
- ```
2394
- type Filtered = Filter<'foo', 'foo'>;
2395
- //=> never
2396
- ```
2397
-
2398
- @example
2399
- ```
2400
- type Filtered = Filter<'bar', string>;
2401
- //=> never
2402
- ```
2403
-
2404
- @example
2405
- ```
2406
- type Filtered = Filter<'bar', 'foo'>;
2407
- //=> 'bar'
2408
- ```
2409
-
2410
- @see {Except}
2411
- */
2412
- type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
2413
-
2414
- type ExceptOptions$1 = {
2415
- /**
2416
- Disallow assigning non-specified properties.
2417
-
2418
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
2419
-
2420
- @default false
2421
- */
2422
- requireExactProps?: boolean;
2423
- };
2424
-
2425
- /**
2426
- Create a type from an object type without certain keys.
2427
-
2428
- We recommend setting the `requireExactProps` option to `true`.
2429
-
2430
- 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.
2431
-
2432
- 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)).
2433
-
2434
- @example
2435
- ```
2436
- import type {Except} from 'type-fest';
2437
-
2438
- type Foo = {
2439
- a: number;
2440
- b: string;
2441
- };
2442
-
2443
- type FooWithoutA = Except<Foo, 'a'>;
2444
- //=> {b: string}
2445
-
2446
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
2447
- //=> errors: 'a' does not exist in type '{ b: string; }'
2448
-
2449
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
2450
- //=> {a: number} & Partial<Record<"b", never>>
2451
-
2452
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
2453
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
2454
- ```
2455
-
2456
- @category Object
2457
- */
2458
- type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
2459
- [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
2460
- } & (Options['requireExactProps'] extends true
2461
- ? Partial<Record<KeysType, never>>
2462
- : {});
2463
-
2464
- /**
2465
- Extract the keys from a type where the value type of the key extends the given `Condition`.
2466
-
2467
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
2468
-
2469
- @example
2470
- ```
2471
- import type {ConditionalKeys} from 'type-fest';
2472
-
2473
- interface Example {
2474
- a: string;
2475
- b: string | number;
2476
- c?: string;
2477
- d: {};
2478
- }
2479
-
2480
- type StringKeysOnly = ConditionalKeys<Example, string>;
2481
- //=> 'a'
2482
- ```
2483
-
2484
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
2485
-
2486
- @example
2487
- ```
2488
- import type {ConditionalKeys} from 'type-fest';
2489
-
2490
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
2491
- //=> 'a' | 'c'
2492
- ```
2493
-
2494
- @category Object
2495
- */
2496
- type ConditionalKeys$1<Base, Condition> = NonNullable<
2497
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
2498
- {
2499
- // Map through all the keys of the given base type.
2500
- [Key in keyof Base]:
2501
- // Pick only keys with types extending the given `Condition` type.
2502
- Base[Key] extends Condition
2503
- // Retain this key since the condition passes.
2504
- ? Key
2505
- // Discard this key since the condition fails.
2506
- : never;
2507
-
2508
- // Convert the produced object into a union type of the keys which passed the conditional test.
2509
- }[keyof Base]
2510
- >;
2511
-
2512
- /**
2513
- Exclude keys from a shape that matches the given `Condition`.
2514
-
2515
- 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.
2516
-
2517
- @example
2518
- ```
2519
- import type {Primitive, ConditionalExcept} from 'type-fest';
2520
-
2521
- class Awesome {
2522
- name: string;
2523
- successes: number;
2524
- failures: bigint;
2525
-
2526
- run() {}
2527
- }
2528
-
2529
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
2530
- //=> {run: () => void}
2531
- ```
2532
-
2533
- @example
2534
- ```
2535
- import type {ConditionalExcept} from 'type-fest';
2536
-
2537
- interface Example {
2538
- a: string;
2539
- b: string | number;
2540
- c: () => void;
2541
- d: {};
2542
- }
2543
-
2544
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
2545
- //=> {b: string | number; c: () => void; d: {}}
2546
- ```
2547
-
2548
- @category Object
2549
- */
2550
- type ConditionalExcept$1<Base, Condition> = Except$1<
2551
- Base,
2552
- ConditionalKeys$1<Base, Condition>
2553
- >;
2554
-
2555
- /**
2556
- * Descriptors are objects that describe the API of a module, and the module
2557
- * can either be a REST module or a host module.
2558
- * This type is recursive, so it can describe nested modules.
2559
- */
2560
- type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$1<any> | ServicePluginDefinition$1<any> | {
2561
- [key: string]: Descriptors$1 | PublicMetadata$1 | any;
2562
- };
2563
- /**
2564
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
2565
- * and returns an object with the same structure, but with all descriptors replaced with their API.
2566
- * Any non-descriptor properties are removed from the returned object, including descriptors that
2567
- * do not match the given host (as they will not work with the given host).
2568
- */
2569
- type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
2570
- done: T;
2571
- recurse: T extends {
2572
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
2573
- } ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
2574
- [Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
2575
- -1,
2576
- 0,
2577
- 1,
2578
- 2,
2579
- 3,
2580
- 4,
2581
- 5
2582
- ][Depth]> : never;
2583
- }, EmptyObject$1>;
2584
- }[Depth extends -1 ? 'done' : 'recurse'];
2585
- type PublicMetadata$1 = {
2586
- PACKAGE_NAME?: string;
2587
- };
2588
-
2589
- declare global {
2590
- interface ContextualClient {
2591
- }
2592
- }
2593
- /**
2594
- * A type used to create concerete types from SDK descriptors in
2595
- * case a contextual client is available.
2596
- */
2597
- type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
2598
- host: Host$1;
2599
- } ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
2600
-
2601
- interface PurchasedItem {
2602
- /** ID of your app's paid plan. */
2603
- productId?: string;
2604
- /** Price of your app's paid plan. For example, `9.95`. */
2605
- price?: string;
2606
886
  /**
2607
- * 3-letter currency code in
2608
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
887
+ * Interval of the billing cycle. `"ONE_TIME"` means that site owners have
888
+ * purchased unlimited access to the app with a single, upfront payment.
2609
889
  */
2610
- currency?: string;
2611
- /** Information about the billing cycle for your app's paid plan. */
2612
- billingCycle?: PaymentCycle;
890
+ billingCycle?: PaymentCycle$1;
2613
891
  /**
2614
- * Date and time the site onwers have purchased your app's paid plan in
892
+ * Date and time the site owners have purchased the app's paid plan in
2615
893
  * `YYYY-MM-DDThh:mm:ss.sssZ` format.
2616
894
  */
2617
- dateCreated?: Date;
2618
- }
2619
- declare enum PaymentCycle {
2620
- NO_CYCLE = "NO_CYCLE",
2621
- MONTHLY = "MONTHLY",
2622
- YEARLY = "YEARLY",
2623
- ONE_TIME = "ONE_TIME",
2624
- TWO_YEARS = "TWO_YEARS",
2625
- THREE_YEARS = "THREE_YEARS",
2626
- FOUR_YEARS = "FOUR_YEARS",
2627
- FIVE_YEARS = "FIVE_YEARS"
2628
- }
2629
- interface InvoiceStatusUpdate {
2630
- /** Invoice payment status. */
2631
- status?: InvoiceStatus;
2632
- /** Wix Premium invoice ID. */
2633
- invoiceId?: string;
2634
- /** App instance ID - a unique ID assigned to each app in each site. */
2635
- instanceId?: string | null;
2636
- /** Whether the invoice is for a single payment or for multiple, recurring payments. */
2637
- recurring?: boolean;
2638
- }
2639
- declare enum InvoiceStatus {
2640
- UNKNOWN_INVOICE_STATUS = "UNKNOWN_INVOICE_STATUS",
2641
- PAYMENT_FAILED = "PAYMENT_FAILED",
2642
- PAID = "PAID",
2643
- REFUNDED = "REFUNDED",
2644
- VOIDED = "VOIDED",
2645
- CHARGEDBACK = "CHARGEDBACK"
2646
- }
2647
- interface GetUrlRequest {
2648
- /**
2649
- * ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard
2650
- * for a list of your app's supported product IDs.
2651
- */
2652
- productId: string;
2653
- /**
2654
- * URL for the Wix checkout page. Redirect site owners to this URL after
2655
- * they've successfully purchased a paid plan for your app.
2656
- */
2657
- successUrl?: string | null;
2658
- /**
2659
- * Whether the checkout is for testing purposes only. Testing is mainly
2660
- * relevant for in-app purchase flows. When `true`, Wix charges the site
2661
- * owners an amount of `0.00`.
2662
- */
2663
- testCheckout?: boolean;
2664
- /** Information about the paid plan's billing cycle. */
2665
- billingCycle?: PaymentCycle;
2666
- /**
2667
- * 2-letter country code in
2668
- * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
2669
- * format.
2670
- *
2671
- * Default: `"US"`
2672
- */
2673
- countryCode?: string | null;
2674
- /**
2675
- * 2-letter language code in
2676
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
2677
- *
2678
- * Default: `"EN"`
2679
- */
2680
- languageCode?: string | null;
2681
- /** Coupon code for the paid plan. Available only in case there is a discount. */
2682
- couponCode?: string | null;
2683
- }
2684
- interface ChargeOverride {
895
+ timeStamp?: string;
2685
896
  /**
2686
- * Override price. In case you omit the override price, Wix charges site
2687
- * owners the app's default price that's configured in the Pricing page of your app's dashboard.
897
+ * Date and time the app's current billing cycle ends in
898
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for yearly and
899
+ * multi-yearly plans.
2688
900
  */
2689
- price?: number;
901
+ expirationDate?: string | null;
2690
902
  /**
2691
- * Override 3-letter currency code in
2692
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
903
+ * Whether the app's subscription automatically renews at the end of the
904
+ * current billing cycle.
2693
905
  */
2694
- currency?: string;
2695
- }
2696
- interface GetUrlResponse {
2697
- /** URL for the Wix checkout page. */
2698
- checkoutUrl?: string;
906
+ autoRenewing?: boolean | null;
907
+ /** ID of the invoice for the current billing cycle. */
908
+ invoiceId?: string | null;
2699
909
  /**
2700
- * Token for the Wix checkout page. The token holds all data about the order
2701
- * you're creating a checkout for. It is [signed](),
2702
- * so you can verify that it comes from Wix.
910
+ * Information about any discounts applied to the app instance's current billing cycle.
911
+ * If the site owners applied a developer coupon or Wix Voucher
912
+ * when installing the paid version of your app, this field holds the coupon's
913
+ * name or `“Wix discount coupon”`. Site owners may receive a Wix Voucher when
914
+ * upgrading their Wix subscription. If there is no discount for the
915
+ * current billing cycle, the field is an empty string.
2703
916
  */
2704
- token?: string | null;
2705
- }
2706
- interface GetPurchaseHistoryRequest {
2707
- }
2708
- interface GetPurchaseHistoryResponse {
2709
- /** Retrieved purchases the site owners have completed for you app. */
2710
- purchases?: PurchasedItem[];
917
+ source?: string | null;
918
+ /** Information about the free trial applied, if relevant. */
919
+ freeTrialInfo?: FreeTrialInfo;
2711
920
  }
2712
- interface GetSitePaymentMethodsStatusRequest {
921
+ declare enum PaymentCycle$1 {
922
+ NO_CYCLE = "NO_CYCLE",
923
+ MONTHLY = "MONTHLY",
924
+ YEARLY = "YEARLY",
925
+ ONE_TIME = "ONE_TIME",
926
+ TWO_YEARS = "TWO_YEARS",
927
+ THREE_YEARS = "THREE_YEARS",
928
+ FOUR_YEARS = "FOUR_YEARS",
929
+ FIVE_YEARS = "FIVE_YEARS"
2713
930
  }
2714
- interface GetSitePaymentMethodsStatusResponse {
931
+ interface FreeTrialInfo {
2715
932
  /**
2716
- * Whether the site owners have enabled at least a single online payment method.
2717
- * Online payment methods include Wix Payments, Stripe, PayPal, and credit
2718
- * cards.
933
+ * Current free trial status.
934
+ *
935
+ * Supported values:
936
+ *
937
+ * - `IN_PROGRESS`: The free trial is currently in progress.
938
+ * - `ENDED`: The free trial has ended.
939
+ * - `NOT_AVAILABLE`: No free trial was applied, as none was available.
940
+ * @readonly
2719
941
  */
2720
- onlineProviderEnabled?: boolean;
2721
- /** Whether the site owners accept offline payments. */
2722
- offlineProviderEnabled?: boolean;
942
+ status?: FreeTrialStatus;
2723
943
  /**
2724
- * Whether the site owners have enabled the
2725
- * [Wix Point of Sale](https://www.wix.com/pos).
2726
- * This allows their customers to make electronic payments in person.
944
+ * When the free trial has ended. Populated only once the free trial is over.
945
+ * @readonly
2727
946
  */
2728
- wixPosProviderEnabled?: boolean;
947
+ endDate?: Date | null;
948
+ }
949
+ declare enum FreeTrialStatus {
950
+ UNKNOWN_STATUS = "UNKNOWN_STATUS",
951
+ IN_PROGRESS = "IN_PROGRESS",
952
+ ENDED = "ENDED",
953
+ NOT_AVAILABLE = "NOT_AVAILABLE"
954
+ }
955
+ interface AvailablePlan {
956
+ /** Package name of the available plan. */
957
+ packageName?: string;
958
+ /** Source of the available plan. Can be a bundle or 3rd-party app. */
959
+ source?: string;
960
+ }
961
+ interface AppInstalled {
962
+ /** Unique identifier of the app within the website. */
963
+ appId?: string;
964
+ /** Instance ID of the app in the original website (relevant only when this site was [duplicated from another site](https://support.wix.com/en/article/duplicating-your-site-1472847)). */
965
+ originInstanceId?: string | null;
966
+ }
967
+ interface AppRemoved {
968
+ /** Unique identifier of the app within the website. */
969
+ appId?: string;
970
+ }
971
+ interface PaidPlanPurchased {
972
+ /** Date and time of purchase. */
973
+ operationTimeStamp?: Date | null;
974
+ /** Purchased app plan. */
975
+ vendorProductId?: string;
976
+ /** Selected payment cycle. */
977
+ cycle?: PaymentCycle$1;
978
+ /** Plan expiration date. */
979
+ expiresOn?: Date | null;
980
+ /** Coupon applied to purchase (if relevant). */
981
+ couponName?: string | null;
982
+ /** Invoice ID. */
983
+ invoiceId?: string | null;
984
+ }
985
+ interface PaidPlanChanged {
986
+ /** Date and time of change. */
987
+ operationTimeStamp?: Date | null;
988
+ /** Newly purchased app plan. */
989
+ vendorProductId?: string;
990
+ /** Newly selected payment cycle. */
991
+ cycle?: PaymentCycle$1;
992
+ /** Previous app plan. */
993
+ previousVendorProductId?: string | null;
994
+ /** Previous payment cycle. */
995
+ previousCycle?: PaymentCycle$1;
996
+ /** Coupon applied to purchase (if relevant). */
997
+ couponName?: string | null;
998
+ /** Invoice ID. */
999
+ invoiceId?: string | null;
1000
+ }
1001
+ interface PaidPlanAutoRenewalCancelled {
1002
+ /** Date and time of auto-renewal cancellation. */
1003
+ operationTimeStamp?: Date | null;
1004
+ /** Current app plan. */
1005
+ vendorProductId?: string;
1006
+ /** Current payment cycle. */
1007
+ cycle?: PaymentCycle$1;
1008
+ /** Supported values: `UNKNOWN_CANCELLATION_TYPE_ERROR_STATE`, `USER_CANCEL`, `FAILED_PAYMENT`, `TRANSFER_CANCELLATION_REASON`. Reason provided by app for cancellation (if relevant). */
1009
+ cancelReason?: string | null;
1010
+ /** Reason provided by site owner for cancellation (if relevant). */
1011
+ userReason?: string | null;
1012
+ /** Cancellation type. */
1013
+ subscriptionCancellationType?: string | null;
1014
+ }
1015
+ interface GetAppInstanceRequest {
1016
+ }
1017
+ interface GetAppInstanceResponse {
1018
+ /** Retrieved app instance. */
1019
+ instance?: AppInstance;
1020
+ /** Information about the corresponding Wix site. */
1021
+ site?: SiteInfo;
1022
+ }
1023
+ interface SiteInfo {
1024
+ /** Display name of the site. */
1025
+ siteDisplayName?: string | null;
2729
1026
  /**
2730
- * Whether the site owners have enabled at least one 3rd-party point-of-sale
2731
- * provider. This allows their customers to make electronic payments in person.
1027
+ * 2-letter language code of the site's locale in
1028
+ * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
2732
1029
  */
2733
- thirdPartyPosProviderEnabled?: boolean;
2734
- }
2735
- interface GetMeteredBillingChargesRequest {
1030
+ locale?: string;
2736
1031
  /**
2737
- * 3-letter currency code in
1032
+ * 3-letter currency code for the site's billing in
2738
1033
  * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
2739
1034
  */
2740
- currency?: string | null;
1035
+ paymentCurrency?: string;
1036
+ /** Information about the site's supported languages. */
1037
+ multilingual?: Multilingual;
1038
+ /** URL of the site. Available only in case the site has been published. */
1039
+ url?: string | null;
1040
+ /** Description of the site. */
1041
+ description?: string | null;
1042
+ /** Wix apps that are installed on the site. */
1043
+ installedWixApps?: string[];
2741
1044
  /**
2742
- * Start of the period you want to retrieve the custom charges for in
2743
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1045
+ * > **Deprecation Notice:** This parameter will be removed on June 30, 2022. Use `ownerInfo` instead.
1046
+ * @deprecated
2744
1047
  */
2745
- startDate?: Date;
1048
+ ownerEmail?: string | null;
2746
1049
  /**
2747
- * End of the period you want to retrieve the custom charges for in
2748
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1050
+ * Information about the site owner. Available only when calling
1051
+ * _Get App Instance_ with the __Read Site Owner Email__ permission scope.
2749
1052
  */
2750
- endDate?: Date;
1053
+ ownerInfo?: OwnerInfo;
1054
+ /** Site ID. */
1055
+ siteId?: string;
2751
1056
  }
2752
- interface GetMeteredBillingChargesResponse {
2753
- /** List of retrieved custom charges. */
2754
- charges?: Charge[];
1057
+ interface Multilingual {
1058
+ /** Whether the site supports more than a single language. */
1059
+ isMultiLingual?: boolean;
1060
+ /** List of supported languages. Returned only when `{"isMultiLingual": true}`. */
1061
+ supportedLanguages?: SupportedLanguage[];
2755
1062
  }
2756
- interface Charge {
2757
- /** ID of the custom charge. The ID consists of 64 characters. */
2758
- _id?: string | null;
2759
- /** Description of the custom charge. */
2760
- description?: string;
1063
+ interface SupportedLanguage {
1064
+ /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
1065
+ languageCode?: string;
1066
+ /** Locale. */
1067
+ locale?: Locale;
1068
+ /** Whether the supported language is the primary language for the site. */
1069
+ isPrimary?: boolean;
1070
+ /** Language icon. */
1071
+ countryCode?: string;
1072
+ /** How the language will be resolved. For internal use. */
1073
+ resolutionMethod?: ResolutionMethod;
1074
+ }
1075
+ interface Locale {
1076
+ /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
1077
+ languageCode?: string;
1078
+ /** Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. */
1079
+ country?: string;
1080
+ }
1081
+ declare enum ResolutionMethod {
1082
+ QUERY_PARAM = "QUERY_PARAM",
1083
+ SUBDOMAIN = "SUBDOMAIN",
1084
+ SUBDIRECTORY = "SUBDIRECTORY"
1085
+ }
1086
+ interface OwnerInfo {
1087
+ /** Site owner's email address. Identical to the site owner's login email. */
1088
+ email?: string;
2761
1089
  /**
2762
- * Charge amount.
1090
+ * Supported values: `VERIFIED_OPT_IN`, `VERIFIED_OPT_OUT`,
1091
+ * `NOT_VERIFIED_OPT_IN`, `NOT_VERIFIED_OPT_OUT`.
2763
1092
  *
2764
- * Min: `0.50`
1093
+ * Whether the site owner has verified their email and whether they have chosen
1094
+ * to receive email notifications from Wix.
2765
1095
  */
2766
- amount?: string;
1096
+ emailStatus?: string;
2767
1097
  }
2768
- interface MessageEnvelope {
1098
+ interface GetAppInstanceByInstanceIdRequest {
1099
+ /** ID of the app instance to retrieve. */
1100
+ instanceId?: string;
1101
+ }
1102
+ interface MessageEnvelope$1 {
2769
1103
  /** App instance ID. */
2770
1104
  instanceId?: string | null;
2771
1105
  /** Event type. */
2772
1106
  eventType?: string;
2773
1107
  /** The identification type and identity data. */
2774
- identity?: IdentificationData;
1108
+ identity?: IdentificationData$1;
2775
1109
  /** Stringify payload. */
2776
1110
  data?: string;
2777
1111
  }
2778
- interface IdentificationData extends IdentificationDataIdOneOf {
1112
+ interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
2779
1113
  /** ID of a site visitor that has not logged in to the site. */
2780
1114
  anonymousVisitorId?: string;
2781
1115
  /** ID of a site visitor that has logged in to the site. */
@@ -2785,10 +1119,10 @@ interface IdentificationData extends IdentificationDataIdOneOf {
2785
1119
  /** ID of an app. */
2786
1120
  appId?: string;
2787
1121
  /** @readonly */
2788
- identityType?: WebhookIdentityType;
1122
+ identityType?: WebhookIdentityType$1;
2789
1123
  }
2790
1124
  /** @oneof */
2791
- interface IdentificationDataIdOneOf {
1125
+ interface IdentificationDataIdOneOf$1 {
2792
1126
  /** ID of a site visitor that has not logged in to the site. */
2793
1127
  anonymousVisitorId?: string;
2794
1128
  /** ID of a site visitor that has logged in to the site. */
@@ -2798,532 +1132,619 @@ interface IdentificationDataIdOneOf {
2798
1132
  /** ID of an app. */
2799
1133
  appId?: string;
2800
1134
  }
2801
- declare enum WebhookIdentityType {
1135
+ declare enum WebhookIdentityType$1 {
2802
1136
  UNKNOWN = "UNKNOWN",
2803
1137
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
2804
1138
  MEMBER = "MEMBER",
2805
1139
  WIX_USER = "WIX_USER",
2806
1140
  APP = "APP"
2807
1141
  }
2808
- interface GetUrlResponseNonNullableFields {
2809
- checkoutUrl: string;
2810
- }
2811
- interface PurchasedItemNonNullableFields {
2812
- productId: string;
2813
- price: string;
2814
- currency: string;
2815
- billingCycle: PaymentCycle;
1142
+ interface FreeTrialInfoNonNullableFields {
1143
+ status: FreeTrialStatus;
2816
1144
  }
2817
- interface GetPurchaseHistoryResponseNonNullableFields {
2818
- purchases: PurchasedItemNonNullableFields[];
1145
+ interface BillingInfoNonNullableFields {
1146
+ packageName: string;
1147
+ billingCycle: PaymentCycle$1;
1148
+ timeStamp: string;
1149
+ freeTrialInfo?: FreeTrialInfoNonNullableFields;
2819
1150
  }
2820
- interface GetUrlOptions {
2821
- /**
2822
- * URL for the Wix checkout page. Redirect site owners to this URL after
2823
- * they've successfully purchased a paid plan for your app.
2824
- */
2825
- successUrl?: string | null;
2826
- /**
2827
- * Whether the checkout is for testing purposes only. Testing is mainly
2828
- * relevant for in-app purchase flows. When `true`, Wix charges the site
2829
- * owners an amount of `0.00`.
2830
- */
2831
- testCheckout?: boolean;
2832
- /** Information about the paid plan's billing cycle. */
2833
- billingCycle?: PaymentCycle;
2834
- /**
2835
- * 2-letter country code in
2836
- * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
2837
- * format.
2838
- *
2839
- * Default: `"US"`
2840
- */
2841
- countryCode?: string | null;
2842
- /**
2843
- * 2-letter language code in
2844
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
2845
- *
2846
- * Default: `"EN"`
2847
- */
2848
- languageCode?: string | null;
2849
- /** Coupon code for the paid plan. Available only in case there is a discount. */
2850
- couponCode?: string | null;
1151
+ interface AvailablePlanNonNullableFields {
1152
+ packageName: string;
1153
+ source: string;
2851
1154
  }
2852
-
2853
- declare function getUrl$1(httpClient: HttpClient$1): GetUrlSignature;
2854
- interface GetUrlSignature {
2855
- /**
2856
- * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.
2857
- *
2858
- *
2859
- * This call succeeds only in case you have previously
2860
- * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).
2861
- *
2862
- * The returned checkout URL is valid for 48 hours.
2863
- *
2864
- * This API allows your app to manage your pricing page outside of Wix while
2865
- * still using the standard Wix checkout flow.
2866
- * @param - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard
2867
- * for a list of your app's supported product IDs.
2868
- */
2869
- (productId: string, options?: GetUrlOptions | undefined): Promise<GetUrlResponse & GetUrlResponseNonNullableFields>;
1155
+ interface AppInstanceNonNullableFields {
1156
+ instanceId: string;
1157
+ appName: string;
1158
+ isFree: boolean;
1159
+ billing?: BillingInfoNonNullableFields;
1160
+ permissions: string[];
1161
+ availablePlans: AvailablePlanNonNullableFields[];
1162
+ isOriginSiteTemplate: boolean;
1163
+ copiedFromTemplate: boolean;
1164
+ freeTrialAvailable: boolean;
2870
1165
  }
2871
- declare function getPurchaseHistory$1(httpClient: HttpClient$1): GetPurchaseHistorySignature;
2872
- interface GetPurchaseHistorySignature {
2873
- /**
2874
- * Retrieves a list of the site owner's past purchases for your app.
2875
- *
2876
- *
2877
- * You don't have to explicitly pass an identifier for the Wix site as part of
2878
- * the request, since this information is taken automatically from the context.
2879
- *
2880
- * The response doesn't include any details about cancellations.
2881
- */
2882
- (): Promise<GetPurchaseHistoryResponse & GetPurchaseHistoryResponseNonNullableFields>;
1166
+ interface LocaleNonNullableFields {
1167
+ languageCode: string;
1168
+ country: string;
2883
1169
  }
2884
-
2885
- declare const getUrl: MaybeContext$1<BuildRESTFunction$1<typeof getUrl$1> & typeof getUrl$1>;
2886
- declare const getPurchaseHistory: MaybeContext$1<BuildRESTFunction$1<typeof getPurchaseHistory$1> & typeof getPurchaseHistory$1>;
2887
-
2888
- type index_d$1_Charge = Charge;
2889
- type index_d$1_ChargeOverride = ChargeOverride;
2890
- type index_d$1_GetMeteredBillingChargesRequest = GetMeteredBillingChargesRequest;
2891
- type index_d$1_GetMeteredBillingChargesResponse = GetMeteredBillingChargesResponse;
2892
- type index_d$1_GetPurchaseHistoryRequest = GetPurchaseHistoryRequest;
2893
- type index_d$1_GetPurchaseHistoryResponse = GetPurchaseHistoryResponse;
2894
- type index_d$1_GetPurchaseHistoryResponseNonNullableFields = GetPurchaseHistoryResponseNonNullableFields;
2895
- type index_d$1_GetSitePaymentMethodsStatusRequest = GetSitePaymentMethodsStatusRequest;
2896
- type index_d$1_GetSitePaymentMethodsStatusResponse = GetSitePaymentMethodsStatusResponse;
2897
- type index_d$1_GetUrlOptions = GetUrlOptions;
2898
- type index_d$1_GetUrlRequest = GetUrlRequest;
2899
- type index_d$1_GetUrlResponse = GetUrlResponse;
2900
- type index_d$1_GetUrlResponseNonNullableFields = GetUrlResponseNonNullableFields;
2901
- type index_d$1_IdentificationData = IdentificationData;
2902
- type index_d$1_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
2903
- type index_d$1_InvoiceStatus = InvoiceStatus;
2904
- declare const index_d$1_InvoiceStatus: typeof InvoiceStatus;
2905
- type index_d$1_InvoiceStatusUpdate = InvoiceStatusUpdate;
2906
- type index_d$1_MessageEnvelope = MessageEnvelope;
2907
- type index_d$1_PaymentCycle = PaymentCycle;
2908
- declare const index_d$1_PaymentCycle: typeof PaymentCycle;
2909
- type index_d$1_PurchasedItem = PurchasedItem;
2910
- type index_d$1_WebhookIdentityType = WebhookIdentityType;
2911
- declare const index_d$1_WebhookIdentityType: typeof WebhookIdentityType;
2912
- declare const index_d$1_getPurchaseHistory: typeof getPurchaseHistory;
2913
- declare const index_d$1_getUrl: typeof getUrl;
2914
- declare namespace index_d$1 {
2915
- export { type index_d$1_Charge as Charge, type index_d$1_ChargeOverride as ChargeOverride, type index_d$1_GetMeteredBillingChargesRequest as GetMeteredBillingChargesRequest, type index_d$1_GetMeteredBillingChargesResponse as GetMeteredBillingChargesResponse, type index_d$1_GetPurchaseHistoryRequest as GetPurchaseHistoryRequest, type index_d$1_GetPurchaseHistoryResponse as GetPurchaseHistoryResponse, type index_d$1_GetPurchaseHistoryResponseNonNullableFields as GetPurchaseHistoryResponseNonNullableFields, type index_d$1_GetSitePaymentMethodsStatusRequest as GetSitePaymentMethodsStatusRequest, type index_d$1_GetSitePaymentMethodsStatusResponse as GetSitePaymentMethodsStatusResponse, type index_d$1_GetUrlOptions as GetUrlOptions, type index_d$1_GetUrlRequest as GetUrlRequest, type index_d$1_GetUrlResponse as GetUrlResponse, type index_d$1_GetUrlResponseNonNullableFields as GetUrlResponseNonNullableFields, type index_d$1_IdentificationData as IdentificationData, type index_d$1_IdentificationDataIdOneOf as IdentificationDataIdOneOf, index_d$1_InvoiceStatus as InvoiceStatus, type index_d$1_InvoiceStatusUpdate as InvoiceStatusUpdate, type index_d$1_MessageEnvelope as MessageEnvelope, index_d$1_PaymentCycle as PaymentCycle, type index_d$1_PurchasedItem as PurchasedItem, index_d$1_WebhookIdentityType as WebhookIdentityType, index_d$1_getPurchaseHistory as getPurchaseHistory, index_d$1_getUrl as getUrl };
1170
+ interface SupportedLanguageNonNullableFields {
1171
+ languageCode: string;
1172
+ locale?: LocaleNonNullableFields;
1173
+ isPrimary: boolean;
1174
+ countryCode: string;
1175
+ resolutionMethod: ResolutionMethod;
2916
1176
  }
2917
-
2918
- type HostModule<T, H extends Host> = {
2919
- __type: 'host';
2920
- create(host: H): T;
2921
- };
2922
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
2923
- type Host<Environment = unknown> = {
2924
- channel: {
2925
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
2926
- disconnect: () => void;
2927
- } | Promise<{
2928
- disconnect: () => void;
2929
- }>;
2930
- };
2931
- environment?: Environment;
2932
- /**
2933
- * Optional bast url to use for API requests, for example `www.wixapis.com`
2934
- */
2935
- apiBaseUrl?: string;
2936
- /**
2937
- * Possible data to be provided by every host, for cross cutting concerns
2938
- * like internationalization, billing, etc.
2939
- */
2940
- essentials?: {
2941
- /**
2942
- * The language of the currently viewed session
2943
- */
2944
- language?: string;
2945
- /**
2946
- * The locale of the currently viewed session
2947
- */
2948
- locale?: string;
2949
- /**
2950
- * Any headers that should be passed through to the API requests
2951
- */
2952
- passThroughHeaders?: Record<string, string>;
2953
- };
2954
- };
2955
-
2956
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
2957
- interface HttpClient {
2958
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
2959
- fetchWithAuth: typeof fetch;
2960
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
2961
- getActiveToken?: () => string | undefined;
1177
+ interface MultilingualNonNullableFields {
1178
+ isMultiLingual: boolean;
1179
+ supportedLanguages: SupportedLanguageNonNullableFields[];
2962
1180
  }
2963
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
2964
- type HttpResponse<T = any> = {
2965
- data: T;
2966
- status: number;
2967
- statusText: string;
2968
- headers: any;
2969
- request?: any;
2970
- };
2971
- type RequestOptions<_TResponse = any, Data = any> = {
2972
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
2973
- url: string;
2974
- data?: Data;
2975
- params?: URLSearchParams;
2976
- } & APIMetadata;
2977
- type APIMetadata = {
2978
- methodFqn?: string;
2979
- entityFqdn?: string;
2980
- packageName?: string;
2981
- };
2982
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
2983
- type EventDefinition<Payload = unknown, Type extends string = string> = {
2984
- __type: 'event-definition';
2985
- type: Type;
2986
- isDomainEvent?: boolean;
2987
- transformations?: (envelope: unknown) => Payload;
2988
- __payload: Payload;
2989
- };
2990
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
2991
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
2992
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
2993
-
2994
- type ServicePluginMethodInput = {
2995
- request: any;
2996
- metadata: any;
2997
- };
2998
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
2999
- type ServicePluginMethodMetadata = {
3000
- name: string;
3001
- primaryHttpMappingPath: string;
3002
- transformations: {
3003
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
3004
- toREST: (...args: unknown[]) => unknown;
3005
- };
3006
- };
3007
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
3008
- __type: 'service-plugin-definition';
3009
- componentType: string;
3010
- methods: ServicePluginMethodMetadata[];
3011
- __contract: Contract;
3012
- };
3013
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
3014
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
3015
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
3016
-
3017
- type RequestContext = {
3018
- isSSR: boolean;
3019
- host: string;
3020
- protocol?: string;
3021
- };
3022
- type ResponseTransformer = (data: any, headers?: any) => any;
3023
- /**
3024
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
3025
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
3026
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
3027
- */
3028
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
3029
- type AmbassadorRequestOptions<T = any> = {
3030
- _?: T;
3031
- url?: string;
3032
- method?: Method;
3033
- params?: any;
3034
- data?: any;
3035
- transformResponse?: ResponseTransformer | ResponseTransformer[];
3036
- };
3037
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
3038
- __isAmbassador: boolean;
3039
- };
3040
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
3041
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
3042
-
3043
- declare global {
3044
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
3045
- interface SymbolConstructor {
3046
- readonly observable: symbol;
3047
- }
1181
+ interface OwnerInfoNonNullableFields {
1182
+ email: string;
1183
+ emailStatus: string;
1184
+ }
1185
+ interface SiteInfoNonNullableFields {
1186
+ locale: string;
1187
+ paymentCurrency: string;
1188
+ multilingual?: MultilingualNonNullableFields;
1189
+ installedWixApps: string[];
1190
+ ownerInfo?: OwnerInfoNonNullableFields;
1191
+ siteId: string;
1192
+ }
1193
+ interface GetAppInstanceResponseNonNullableFields {
1194
+ instance?: AppInstanceNonNullableFields;
1195
+ site?: SiteInfoNonNullableFields;
1196
+ }
1197
+ interface BaseEventMetadata {
1198
+ /** App instance ID. */
1199
+ instanceId?: string | null;
1200
+ /** Event type. */
1201
+ eventType?: string;
1202
+ /** The identification type and identity data. */
1203
+ identity?: IdentificationData$1;
1204
+ }
1205
+ interface AppInstanceInstalledEnvelope {
1206
+ data: AppInstalled;
1207
+ metadata: BaseEventMetadata;
1208
+ }
1209
+ interface AppInstanceRemovedEnvelope {
1210
+ data: AppRemoved;
1211
+ metadata: BaseEventMetadata;
1212
+ }
1213
+ interface AppInstancePaidPlanPurchasedEnvelope {
1214
+ data: PaidPlanPurchased;
1215
+ metadata: BaseEventMetadata;
1216
+ }
1217
+ interface AppInstancePaidPlanChangedEnvelope {
1218
+ data: PaidPlanChanged;
1219
+ metadata: BaseEventMetadata;
1220
+ }
1221
+ interface AppInstancePaidPlanAutoRenewalCancelledEnvelope {
1222
+ data: PaidPlanAutoRenewalCancelled;
1223
+ metadata: BaseEventMetadata;
3048
1224
  }
3049
1225
 
3050
- declare const emptyObjectSymbol: unique symbol;
3051
-
3052
- /**
3053
- Represents a strictly empty plain object, the `{}` value.
3054
-
3055
- 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)).
3056
-
3057
- @example
3058
- ```
3059
- import type {EmptyObject} from 'type-fest';
3060
-
3061
- // The following illustrates the problem with `{}`.
3062
- const foo1: {} = {}; // Pass
3063
- const foo2: {} = []; // Pass
3064
- const foo3: {} = 42; // Pass
3065
- const foo4: {} = {a: 1}; // Pass
3066
-
3067
- // With `EmptyObject` only the first case is valid.
3068
- const bar1: EmptyObject = {}; // Pass
3069
- const bar2: EmptyObject = 42; // Fail
3070
- const bar3: EmptyObject = []; // Fail
3071
- const bar4: EmptyObject = {a: 1}; // Fail
3072
- ```
1226
+ declare function getAppInstance$1(httpClient: HttpClient): GetAppInstanceSignature;
1227
+ interface GetAppInstanceSignature {
1228
+ /**
1229
+ * Retrieves data about the instance of your app that's installed on a Wix site and data about the site itself.
1230
+ *
1231
+ * Call this function when you need information about a specific instance of your app and the site it’s installed on. For example, you may need to know whether the user has installed a free or paid version of your app, or to check what other Wix apps are installed on the site.
1232
+ *
1233
+ * You must authenticate as a [Wix App](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities#wix-apps). If you are calling this function from a [dashboard extension](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/dashboard-extensions/about-dashboard-extensions) in the [CLI](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-cli/about-the-wix-cli-for-apps), Wix App authentication is passed automatically. Otherwise, you need to call the function with [elevated permissions](https://dev.wix.com/docs/sdk/articles/working-with-the-sdk/about-elevated-permissions).
1234
+ *
1235
+ * If you want `site.ownerInfo` to be included in the response, you must have the __Read Site Owner Email__ permission scope in addition to __WIX_DEVELOPERS.MANAGE_APP_INSTANCE__.
1236
+ */
1237
+ (): Promise<GetAppInstanceResponse & GetAppInstanceResponseNonNullableFields>;
1238
+ }
1239
+ declare const onAppInstanceInstalled$1: EventDefinition<AppInstanceInstalledEnvelope, "AppInstalled">;
1240
+ declare const onAppInstanceRemoved$1: EventDefinition<AppInstanceRemovedEnvelope, "AppRemoved">;
1241
+ declare const onAppInstancePaidPlanPurchased$1: EventDefinition<AppInstancePaidPlanPurchasedEnvelope, "PaidPlanPurchased">;
1242
+ declare const onAppInstancePaidPlanChanged$1: EventDefinition<AppInstancePaidPlanChangedEnvelope, "PaidPlanChanged">;
1243
+ declare const onAppInstancePaidPlanAutoRenewalCancelled$1: EventDefinition<AppInstancePaidPlanAutoRenewalCancelledEnvelope, "PaidPlanAutoRenewalCancelled">;
3073
1244
 
3074
- 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}.
1245
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
3075
1246
 
3076
- @category Object
3077
- */
3078
- type EmptyObject = {[emptyObjectSymbol]?: never};
1247
+ declare const getAppInstance: MaybeContext<BuildRESTFunction<typeof getAppInstance$1> & typeof getAppInstance$1>;
3079
1248
 
1249
+ type _publicOnAppInstanceInstalledType = typeof onAppInstanceInstalled$1;
3080
1250
  /**
3081
- Returns a boolean for whether the two given types are equal.
3082
-
3083
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
3084
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
3085
-
3086
- Use-cases:
3087
- - If you want to make a conditional branch based on the result of a comparison of two types.
3088
-
3089
- @example
3090
- ```
3091
- import type {IsEqual} from 'type-fest';
3092
-
3093
- // This type returns a boolean for whether the given array includes the given item.
3094
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
3095
- type Includes<Value extends readonly any[], Item> =
3096
- Value extends readonly [Value[0], ...infer rest]
3097
- ? IsEqual<Value[0], Item> extends true
3098
- ? true
3099
- : Includes<rest, Item>
3100
- : false;
3101
- ```
3102
-
3103
- @category Type Guard
3104
- @category Utilities
3105
- */
3106
- type IsEqual<A, B> =
3107
- (<G>() => G extends A ? 1 : 2) extends
3108
- (<G>() => G extends B ? 1 : 2)
3109
- ? true
3110
- : false;
1251
+ * Triggered when an instance of your app is installed on a Wix site.
1252
+ */
1253
+ declare const onAppInstanceInstalled: ReturnType<typeof createEventModule<_publicOnAppInstanceInstalledType>>;
3111
1254
 
1255
+ type _publicOnAppInstanceRemovedType = typeof onAppInstanceRemoved$1;
3112
1256
  /**
3113
- Filter out keys from an object.
3114
-
3115
- Returns `never` if `Exclude` is strictly equal to `Key`.
3116
- Returns `never` if `Key` extends `Exclude`.
3117
- Returns `Key` otherwise.
3118
-
3119
- @example
3120
- ```
3121
- type Filtered = Filter<'foo', 'foo'>;
3122
- //=> never
3123
- ```
3124
-
3125
- @example
3126
- ```
3127
- type Filtered = Filter<'bar', string>;
3128
- //=> never
3129
- ```
3130
-
3131
- @example
3132
- ```
3133
- type Filtered = Filter<'bar', 'foo'>;
3134
- //=> 'bar'
3135
- ```
3136
-
3137
- @see {Except}
3138
- */
3139
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
3140
-
3141
- type ExceptOptions = {
3142
- /**
3143
- Disallow assigning non-specified properties.
3144
-
3145
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
3146
-
3147
- @default false
3148
- */
3149
- requireExactProps?: boolean;
3150
- };
1257
+ * Triggered when an instance of your app is uninstalled from a Wix site.
1258
+ */
1259
+ declare const onAppInstanceRemoved: ReturnType<typeof createEventModule<_publicOnAppInstanceRemovedType>>;
3151
1260
 
1261
+ type _publicOnAppInstancePaidPlanPurchasedType = typeof onAppInstancePaidPlanPurchased$1;
3152
1262
  /**
3153
- Create a type from an object type without certain keys.
3154
-
3155
- We recommend setting the `requireExactProps` option to `true`.
3156
-
3157
- 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.
3158
-
3159
- 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)).
3160
-
3161
- @example
3162
- ```
3163
- import type {Except} from 'type-fest';
3164
-
3165
- type Foo = {
3166
- a: number;
3167
- b: string;
3168
- };
3169
-
3170
- type FooWithoutA = Except<Foo, 'a'>;
3171
- //=> {b: string}
1263
+ * Triggered when a site owner purchases a paid plan for your app.
1264
+ */
1265
+ declare const onAppInstancePaidPlanPurchased: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanPurchasedType>>;
3172
1266
 
3173
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
3174
- //=> errors: 'a' does not exist in type '{ b: string; }'
1267
+ type _publicOnAppInstancePaidPlanChangedType = typeof onAppInstancePaidPlanChanged$1;
1268
+ /**
1269
+ * Triggered when a site owner upgrades or downgrades their plan for your app.
1270
+ */
1271
+ declare const onAppInstancePaidPlanChanged: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanChangedType>>;
3175
1272
 
3176
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
3177
- //=> {a: number} & Partial<Record<"b", never>>
1273
+ type _publicOnAppInstancePaidPlanAutoRenewalCancelledType = typeof onAppInstancePaidPlanAutoRenewalCancelled$1;
1274
+ /**
1275
+ * Triggered when a site owner cancels a paid plan for your app. The
1276
+ * site owner can continue to use your app until the end of the current billing
1277
+ * cycle.
1278
+ */
1279
+ declare const onAppInstancePaidPlanAutoRenewalCancelled: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanAutoRenewalCancelledType>>;
3178
1280
 
3179
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
3180
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
3181
- ```
1281
+ type index_d$3_AppInstalled = AppInstalled;
1282
+ type index_d$3_AppInstance = AppInstance;
1283
+ type index_d$3_AppInstanceInstalledEnvelope = AppInstanceInstalledEnvelope;
1284
+ type index_d$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope = AppInstancePaidPlanAutoRenewalCancelledEnvelope;
1285
+ type index_d$3_AppInstancePaidPlanChangedEnvelope = AppInstancePaidPlanChangedEnvelope;
1286
+ type index_d$3_AppInstancePaidPlanPurchasedEnvelope = AppInstancePaidPlanPurchasedEnvelope;
1287
+ type index_d$3_AppInstanceRemovedEnvelope = AppInstanceRemovedEnvelope;
1288
+ type index_d$3_AppRemoved = AppRemoved;
1289
+ type index_d$3_AvailablePlan = AvailablePlan;
1290
+ type index_d$3_BaseEventMetadata = BaseEventMetadata;
1291
+ type index_d$3_BillingInfo = BillingInfo;
1292
+ type index_d$3_FreeTrialInfo = FreeTrialInfo;
1293
+ type index_d$3_FreeTrialStatus = FreeTrialStatus;
1294
+ declare const index_d$3_FreeTrialStatus: typeof FreeTrialStatus;
1295
+ type index_d$3_GetAppInstanceByInstanceIdRequest = GetAppInstanceByInstanceIdRequest;
1296
+ type index_d$3_GetAppInstanceRequest = GetAppInstanceRequest;
1297
+ type index_d$3_GetAppInstanceResponse = GetAppInstanceResponse;
1298
+ type index_d$3_GetAppInstanceResponseNonNullableFields = GetAppInstanceResponseNonNullableFields;
1299
+ type index_d$3_Locale = Locale;
1300
+ type index_d$3_Multilingual = Multilingual;
1301
+ type index_d$3_OwnerInfo = OwnerInfo;
1302
+ type index_d$3_PaidPlanAutoRenewalCancelled = PaidPlanAutoRenewalCancelled;
1303
+ type index_d$3_PaidPlanChanged = PaidPlanChanged;
1304
+ type index_d$3_PaidPlanPurchased = PaidPlanPurchased;
1305
+ type index_d$3_ResolutionMethod = ResolutionMethod;
1306
+ declare const index_d$3_ResolutionMethod: typeof ResolutionMethod;
1307
+ type index_d$3_SiteInfo = SiteInfo;
1308
+ type index_d$3_SupportedLanguage = SupportedLanguage;
1309
+ type index_d$3__publicOnAppInstanceInstalledType = _publicOnAppInstanceInstalledType;
1310
+ type index_d$3__publicOnAppInstancePaidPlanAutoRenewalCancelledType = _publicOnAppInstancePaidPlanAutoRenewalCancelledType;
1311
+ type index_d$3__publicOnAppInstancePaidPlanChangedType = _publicOnAppInstancePaidPlanChangedType;
1312
+ type index_d$3__publicOnAppInstancePaidPlanPurchasedType = _publicOnAppInstancePaidPlanPurchasedType;
1313
+ type index_d$3__publicOnAppInstanceRemovedType = _publicOnAppInstanceRemovedType;
1314
+ declare const index_d$3_getAppInstance: typeof getAppInstance;
1315
+ declare const index_d$3_onAppInstanceInstalled: typeof onAppInstanceInstalled;
1316
+ declare const index_d$3_onAppInstancePaidPlanAutoRenewalCancelled: typeof onAppInstancePaidPlanAutoRenewalCancelled;
1317
+ declare const index_d$3_onAppInstancePaidPlanChanged: typeof onAppInstancePaidPlanChanged;
1318
+ declare const index_d$3_onAppInstancePaidPlanPurchased: typeof onAppInstancePaidPlanPurchased;
1319
+ declare const index_d$3_onAppInstanceRemoved: typeof onAppInstanceRemoved;
1320
+ declare namespace index_d$3 {
1321
+ export { type index_d$3_AppInstalled as AppInstalled, type index_d$3_AppInstance as AppInstance, type index_d$3_AppInstanceInstalledEnvelope as AppInstanceInstalledEnvelope, type index_d$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope as AppInstancePaidPlanAutoRenewalCancelledEnvelope, type index_d$3_AppInstancePaidPlanChangedEnvelope as AppInstancePaidPlanChangedEnvelope, type index_d$3_AppInstancePaidPlanPurchasedEnvelope as AppInstancePaidPlanPurchasedEnvelope, type index_d$3_AppInstanceRemovedEnvelope as AppInstanceRemovedEnvelope, type index_d$3_AppRemoved as AppRemoved, type index_d$3_AvailablePlan as AvailablePlan, type index_d$3_BaseEventMetadata as BaseEventMetadata, type index_d$3_BillingInfo as BillingInfo, type index_d$3_FreeTrialInfo as FreeTrialInfo, index_d$3_FreeTrialStatus as FreeTrialStatus, type index_d$3_GetAppInstanceByInstanceIdRequest as GetAppInstanceByInstanceIdRequest, type index_d$3_GetAppInstanceRequest as GetAppInstanceRequest, type index_d$3_GetAppInstanceResponse as GetAppInstanceResponse, type index_d$3_GetAppInstanceResponseNonNullableFields as GetAppInstanceResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type index_d$3_Locale as Locale, type MessageEnvelope$1 as MessageEnvelope, type index_d$3_Multilingual as Multilingual, type index_d$3_OwnerInfo as OwnerInfo, type index_d$3_PaidPlanAutoRenewalCancelled as PaidPlanAutoRenewalCancelled, type index_d$3_PaidPlanChanged as PaidPlanChanged, type index_d$3_PaidPlanPurchased as PaidPlanPurchased, PaymentCycle$1 as PaymentCycle, index_d$3_ResolutionMethod as ResolutionMethod, type index_d$3_SiteInfo as SiteInfo, type index_d$3_SupportedLanguage as SupportedLanguage, WebhookIdentityType$1 as WebhookIdentityType, type index_d$3__publicOnAppInstanceInstalledType as _publicOnAppInstanceInstalledType, type index_d$3__publicOnAppInstancePaidPlanAutoRenewalCancelledType as _publicOnAppInstancePaidPlanAutoRenewalCancelledType, type index_d$3__publicOnAppInstancePaidPlanChangedType as _publicOnAppInstancePaidPlanChangedType, type index_d$3__publicOnAppInstancePaidPlanPurchasedType as _publicOnAppInstancePaidPlanPurchasedType, type index_d$3__publicOnAppInstanceRemovedType as _publicOnAppInstanceRemovedType, index_d$3_getAppInstance as getAppInstance, index_d$3_onAppInstanceInstalled as onAppInstanceInstalled, index_d$3_onAppInstancePaidPlanAutoRenewalCancelled as onAppInstancePaidPlanAutoRenewalCancelled, index_d$3_onAppInstancePaidPlanChanged as onAppInstancePaidPlanChanged, index_d$3_onAppInstancePaidPlanPurchased as onAppInstancePaidPlanPurchased, index_d$3_onAppInstanceRemoved as onAppInstanceRemoved, onAppInstanceInstalled$1 as publicOnAppInstanceInstalled, onAppInstancePaidPlanAutoRenewalCancelled$1 as publicOnAppInstancePaidPlanAutoRenewalCancelled, onAppInstancePaidPlanChanged$1 as publicOnAppInstancePaidPlanChanged, onAppInstancePaidPlanPurchased$1 as publicOnAppInstancePaidPlanPurchased, onAppInstanceRemoved$1 as publicOnAppInstanceRemoved };
1322
+ }
3182
1323
 
3183
- @category Object
3184
- */
3185
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
3186
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
3187
- } & (Options['requireExactProps'] extends true
3188
- ? Partial<Record<KeysType, never>>
3189
- : {});
1324
+ interface SendBIEventResponse {
1325
+ }
1326
+ interface SendBIEventRequest {
1327
+ /**
1328
+ * Name of the event that's triggered in your app.
1329
+ *
1330
+ * + `"APP_DASHBOARD_LOADED"`: A site onwer or contributor loads your app's dashboard.
1331
+ * + `"APP_FINISHED_CONFIGURATION"`: The site owner completes all required configurations for your app in your app's dashboard.
1332
+ * + `"APP_UPGRADED"`: The site owner upgrades your app's paid plan. An upgrade means that they have finished the checkout flow on the app's side but not necessarily on Wix's side.
1333
+ * + `"PRIMARY_ACTION_PERFORMED"`: A site owner, contributor, or visitor triggers your app's primary action. For example, a site visitor writes a product review using your product review app.
1334
+ * + `"CHARGE"`: You charge money from the site owner. For example, when the site owner purchases or renews a subscription for your app. Make sure to also send `eventData` and a key of `sum`.
1335
+ * + `"FUNDS_RETURNED"`: Trigger this event when you send money back to a site owner (for example, refunds or chargebacks). Make sure to also send the charge amount inside `eventData`. For example, `{"eventData": {"sum": "5.99"}}`.
1336
+ * + `"CUSTOM"`: Any event that's not listed here. Make sure to also send `customEventName`.
1337
+ * + `"APP_DEPLOYED"`: Your app’s internal code implementation is changed and might affect user flows or cause a regression.
1338
+ * + `"APP_FINISH_BUSINESS_SETUP"`: __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead.
1339
+ * + `"APP_SETUP_FINISHED"`: The site owner completes your app's required business setup.
1340
+ */
1341
+ eventName?: EventName;
1342
+ /**
1343
+ * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
1344
+ *
1345
+ * Min: 2 characters
1346
+ */
1347
+ customEventName?: string | null;
1348
+ /**
1349
+ * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
1350
+ * You may also submit data with keys that aren't listed here.
1351
+ *
1352
+ * Additional data about your app's event.
1353
+ *
1354
+ * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
1355
+ * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1356
+ * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
1357
+ * + `"reason"`: Information about why the event was triggered in your app.
1358
+ * + `"app_plan_id"`: ID of the your app's plan as displayed in your app's dashboard. Note that it's the same value as `vendorProductId` in the [Paid Plan Purchased webhook](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/paid-plan-purchased).
1359
+ */
1360
+ eventData?: Record<string, string>;
1361
+ }
1362
+ declare enum EventName {
1363
+ UNKNOWN = "UNKNOWN",
1364
+ APP_DASHBOARD_LOADED = "APP_DASHBOARD_LOADED",
1365
+ APP_FINISHED_CONFIGURATION = "APP_FINISHED_CONFIGURATION",
1366
+ APP_UPGRADED = "APP_UPGRADED",
1367
+ PRIMARY_ACTION_PERFORMED = "PRIMARY_ACTION_PERFORMED",
1368
+ CUSTOM = "CUSTOM",
1369
+ CHARGE = "CHARGE",
1370
+ FUNDS_RETURNED = "FUNDS_RETURNED",
1371
+ APP_FINISH_BUSINESS_SETUP = "APP_FINISH_BUSINESS_SETUP",
1372
+ APP_DEPLOYED = "APP_DEPLOYED",
1373
+ APP_SETUP_FINISHED = "APP_SETUP_FINISHED"
1374
+ }
1375
+ interface SendBiEventOptions {
1376
+ /**
1377
+ * Name of the event that's triggered in your app.
1378
+ *
1379
+ * + `"APP_DASHBOARD_LOADED"`: A site onwer or contributor loads your app's dashboard.
1380
+ * + `"APP_FINISHED_CONFIGURATION"`: The site owner completes all required configurations for your app in your app's dashboard.
1381
+ * + `"APP_UPGRADED"`: The site owner upgrades your app's paid plan. An upgrade means that they have finished the checkout flow on the app's side but not necessarily on Wix's side.
1382
+ * + `"PRIMARY_ACTION_PERFORMED"`: A site owner, contributor, or visitor triggers your app's primary action. For example, a site visitor writes a product review using your product review app.
1383
+ * + `"CHARGE"`: You charge money from the site owner. For example, when the site owner purchases or renews a subscription for your app. Make sure to also send `eventData` and a key of `sum`.
1384
+ * + `"FUNDS_RETURNED"`: Trigger this event when you send money back to a site owner (for example, refunds or chargebacks). Make sure to also send the charge amount inside `eventData`. For example, `{"eventData": {"sum": "5.99"}}`.
1385
+ * + `"CUSTOM"`: Any event that's not listed here. Make sure to also send `customEventName`.
1386
+ * + `"APP_DEPLOYED"`: Your app’s internal code implementation is changed and might affect user flows or cause a regression.
1387
+ * + `"APP_FINISH_BUSINESS_SETUP"`: __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead.
1388
+ * + `"APP_SETUP_FINISHED"`: The site owner completes your app's required business setup.
1389
+ */
1390
+ eventName?: EventName;
1391
+ /**
1392
+ * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
1393
+ *
1394
+ * Min: 2 characters
1395
+ */
1396
+ customEventName?: string | null;
1397
+ /**
1398
+ * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
1399
+ * You may also submit data with keys that aren't listed here.
1400
+ *
1401
+ * Additional data about your app's event.
1402
+ *
1403
+ * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
1404
+ * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1405
+ * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
1406
+ * + `"reason"`: Information about why the event was triggered in your app.
1407
+ * + `"app_plan_id"`: ID of the your app's plan as displayed in your app's dashboard. Note that it's the same value as `vendorProductId` in the [Paid Plan Purchased webhook](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/paid-plan-purchased).
1408
+ */
1409
+ eventData?: Record<string, string>;
1410
+ }
3190
1411
 
3191
- /**
3192
- Extract the keys from a type where the value type of the key extends the given `Condition`.
1412
+ declare function sendBiEvent$1(httpClient: HttpClient): SendBiEventSignature;
1413
+ interface SendBiEventSignature {
1414
+ /**
1415
+ * Submit a BI event to Wix.
1416
+ */
1417
+ (options?: SendBiEventOptions | undefined): Promise<void>;
1418
+ }
3193
1419
 
3194
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1420
+ declare const sendBiEvent: MaybeContext<BuildRESTFunction<typeof sendBiEvent$1> & typeof sendBiEvent$1>;
3195
1421
 
3196
- @example
3197
- ```
3198
- import type {ConditionalKeys} from 'type-fest';
1422
+ type index_d$2_EventName = EventName;
1423
+ declare const index_d$2_EventName: typeof EventName;
1424
+ type index_d$2_SendBIEventRequest = SendBIEventRequest;
1425
+ type index_d$2_SendBIEventResponse = SendBIEventResponse;
1426
+ type index_d$2_SendBiEventOptions = SendBiEventOptions;
1427
+ declare const index_d$2_sendBiEvent: typeof sendBiEvent;
1428
+ declare namespace index_d$2 {
1429
+ export { index_d$2_EventName as EventName, type index_d$2_SendBIEventRequest as SendBIEventRequest, type index_d$2_SendBIEventResponse as SendBIEventResponse, type index_d$2_SendBiEventOptions as SendBiEventOptions, index_d$2_sendBiEvent as sendBiEvent };
1430
+ }
3199
1431
 
3200
- interface Example {
3201
- a: string;
3202
- b: string | number;
3203
- c?: string;
3204
- d: {};
1432
+ interface PurchasedItem {
1433
+ /** ID of your app's paid plan. */
1434
+ productId?: string;
1435
+ /** Price of your app's paid plan. For example, `9.95`. */
1436
+ price?: string;
1437
+ /**
1438
+ * 3-letter currency code in
1439
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1440
+ */
1441
+ currency?: string;
1442
+ /** Information about the billing cycle for your app's paid plan. */
1443
+ billingCycle?: PaymentCycle;
1444
+ /**
1445
+ * Date and time the site onwers have purchased your app's paid plan in
1446
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1447
+ */
1448
+ dateCreated?: Date | null;
1449
+ }
1450
+ declare enum PaymentCycle {
1451
+ NO_CYCLE = "NO_CYCLE",
1452
+ MONTHLY = "MONTHLY",
1453
+ YEARLY = "YEARLY",
1454
+ ONE_TIME = "ONE_TIME",
1455
+ TWO_YEARS = "TWO_YEARS",
1456
+ THREE_YEARS = "THREE_YEARS",
1457
+ FOUR_YEARS = "FOUR_YEARS",
1458
+ FIVE_YEARS = "FIVE_YEARS"
1459
+ }
1460
+ interface InvoiceStatusUpdate {
1461
+ /** Invoice payment status. */
1462
+ status?: InvoiceStatus;
1463
+ /** Wix Premium invoice ID. */
1464
+ invoiceId?: string;
1465
+ /** App instance ID - a unique ID assigned to each app in each site. */
1466
+ instanceId?: string | null;
1467
+ /** Whether the invoice is for a single payment or for multiple, recurring payments. */
1468
+ recurring?: boolean;
1469
+ }
1470
+ declare enum InvoiceStatus {
1471
+ UNKNOWN_INVOICE_STATUS = "UNKNOWN_INVOICE_STATUS",
1472
+ PAYMENT_FAILED = "PAYMENT_FAILED",
1473
+ PAID = "PAID",
1474
+ REFUNDED = "REFUNDED",
1475
+ VOIDED = "VOIDED",
1476
+ CHARGEDBACK = "CHARGEDBACK"
1477
+ }
1478
+ interface GetUrlRequest {
1479
+ /**
1480
+ * ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard
1481
+ * for a list of your app's supported product IDs.
1482
+ */
1483
+ productId: string;
1484
+ /**
1485
+ * URL for the Wix checkout page. Redirect site owners to this URL after
1486
+ * they've successfully purchased a paid plan for your app.
1487
+ */
1488
+ successUrl?: string | null;
1489
+ /**
1490
+ * Whether the checkout is for testing purposes only. Testing is mainly
1491
+ * relevant for in-app purchase flows. When `true`, Wix charges the site
1492
+ * owners an amount of `0.00`.
1493
+ */
1494
+ testCheckout?: boolean;
1495
+ /** Information about the paid plan's billing cycle. */
1496
+ billingCycle?: PaymentCycle;
1497
+ /**
1498
+ * 2-letter country code in
1499
+ * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
1500
+ * format.
1501
+ *
1502
+ * Default: `"US"`
1503
+ */
1504
+ countryCode?: string | null;
1505
+ /**
1506
+ * 2-letter language code in
1507
+ * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1508
+ *
1509
+ * Default: `"EN"`
1510
+ */
1511
+ languageCode?: string | null;
1512
+ /** Coupon code for the paid plan. Available only in case there is a discount. */
1513
+ couponCode?: string | null;
1514
+ }
1515
+ interface ChargeOverride {
1516
+ /**
1517
+ * Override price. In case you omit the override price, Wix charges site
1518
+ * owners the app's default price that's configured in the Pricing page of your app's dashboard.
1519
+ */
1520
+ price?: number;
1521
+ /**
1522
+ * Override 3-letter currency code in
1523
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1524
+ */
1525
+ currency?: string;
1526
+ }
1527
+ interface GetUrlResponse {
1528
+ /** URL for the Wix checkout page. */
1529
+ checkoutUrl?: string;
1530
+ /**
1531
+ * Token for the Wix checkout page. The token holds all data about the order
1532
+ * you're creating a checkout for. It is [signed](),
1533
+ * so you can verify that it comes from Wix.
1534
+ */
1535
+ token?: string | null;
1536
+ }
1537
+ interface GetPurchaseHistoryRequest {
1538
+ }
1539
+ interface GetPurchaseHistoryResponse {
1540
+ /** Retrieved purchases the site owners have completed for you app. */
1541
+ purchases?: PurchasedItem[];
1542
+ }
1543
+ interface GetSitePaymentMethodsStatusRequest {
1544
+ }
1545
+ interface GetSitePaymentMethodsStatusResponse {
1546
+ /**
1547
+ * Whether the site owners have enabled at least a single online payment method.
1548
+ * Online payment methods include Wix Payments, Stripe, PayPal, and credit
1549
+ * cards.
1550
+ */
1551
+ onlineProviderEnabled?: boolean;
1552
+ /** Whether the site owners accept offline payments. */
1553
+ offlineProviderEnabled?: boolean;
1554
+ /**
1555
+ * Whether the site owners have enabled the
1556
+ * [Wix Point of Sale](https://www.wix.com/pos).
1557
+ * This allows their customers to make electronic payments in person.
1558
+ */
1559
+ wixPosProviderEnabled?: boolean;
1560
+ /**
1561
+ * Whether the site owners have enabled at least one 3rd-party point-of-sale
1562
+ * provider. This allows their customers to make electronic payments in person.
1563
+ */
1564
+ thirdPartyPosProviderEnabled?: boolean;
1565
+ }
1566
+ interface GetMeteredBillingChargesRequest {
1567
+ /**
1568
+ * 3-letter currency code in
1569
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1570
+ */
1571
+ currency?: string | null;
1572
+ /**
1573
+ * Start of the period you want to retrieve the custom charges for in
1574
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1575
+ */
1576
+ startDate?: Date | null;
1577
+ /**
1578
+ * End of the period you want to retrieve the custom charges for in
1579
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1580
+ */
1581
+ endDate?: Date | null;
1582
+ }
1583
+ interface GetMeteredBillingChargesResponse {
1584
+ /** List of retrieved custom charges. */
1585
+ charges?: Charge[];
1586
+ }
1587
+ interface Charge {
1588
+ /** ID of the custom charge. The ID consists of 64 characters. */
1589
+ _id?: string | null;
1590
+ /** Description of the custom charge. */
1591
+ description?: string;
1592
+ /**
1593
+ * Charge amount.
1594
+ *
1595
+ * Min: `0.50`
1596
+ */
1597
+ amount?: string;
3205
1598
  }
3206
-
3207
- type StringKeysOnly = ConditionalKeys<Example, string>;
3208
- //=> 'a'
3209
- ```
3210
-
3211
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
3212
-
3213
- @example
3214
- ```
3215
- import type {ConditionalKeys} from 'type-fest';
3216
-
3217
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
3218
- //=> 'a' | 'c'
3219
- ```
3220
-
3221
- @category Object
3222
- */
3223
- type ConditionalKeys<Base, Condition> = NonNullable<
3224
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
3225
- {
3226
- // Map through all the keys of the given base type.
3227
- [Key in keyof Base]:
3228
- // Pick only keys with types extending the given `Condition` type.
3229
- Base[Key] extends Condition
3230
- // Retain this key since the condition passes.
3231
- ? Key
3232
- // Discard this key since the condition fails.
3233
- : never;
3234
-
3235
- // Convert the produced object into a union type of the keys which passed the conditional test.
3236
- }[keyof Base]
3237
- >;
3238
-
3239
- /**
3240
- Exclude keys from a shape that matches the given `Condition`.
3241
-
3242
- 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.
3243
-
3244
- @example
3245
- ```
3246
- import type {Primitive, ConditionalExcept} from 'type-fest';
3247
-
3248
- class Awesome {
3249
- name: string;
3250
- successes: number;
3251
- failures: bigint;
3252
-
3253
- run() {}
1599
+ interface MessageEnvelope {
1600
+ /** App instance ID. */
1601
+ instanceId?: string | null;
1602
+ /** Event type. */
1603
+ eventType?: string;
1604
+ /** The identification type and identity data. */
1605
+ identity?: IdentificationData;
1606
+ /** Stringify payload. */
1607
+ data?: string;
3254
1608
  }
3255
-
3256
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
3257
- //=> {run: () => void}
3258
- ```
3259
-
3260
- @example
3261
- ```
3262
- import type {ConditionalExcept} from 'type-fest';
3263
-
3264
- interface Example {
3265
- a: string;
3266
- b: string | number;
3267
- c: () => void;
3268
- d: {};
1609
+ interface IdentificationData extends IdentificationDataIdOneOf {
1610
+ /** ID of a site visitor that has not logged in to the site. */
1611
+ anonymousVisitorId?: string;
1612
+ /** ID of a site visitor that has logged in to the site. */
1613
+ memberId?: string;
1614
+ /** ID of a Wix user (site owner, contributor, etc.). */
1615
+ wixUserId?: string;
1616
+ /** ID of an app. */
1617
+ appId?: string;
1618
+ /** @readonly */
1619
+ identityType?: WebhookIdentityType;
1620
+ }
1621
+ /** @oneof */
1622
+ interface IdentificationDataIdOneOf {
1623
+ /** ID of a site visitor that has not logged in to the site. */
1624
+ anonymousVisitorId?: string;
1625
+ /** ID of a site visitor that has logged in to the site. */
1626
+ memberId?: string;
1627
+ /** ID of a Wix user (site owner, contributor, etc.). */
1628
+ wixUserId?: string;
1629
+ /** ID of an app. */
1630
+ appId?: string;
1631
+ }
1632
+ declare enum WebhookIdentityType {
1633
+ UNKNOWN = "UNKNOWN",
1634
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1635
+ MEMBER = "MEMBER",
1636
+ WIX_USER = "WIX_USER",
1637
+ APP = "APP"
1638
+ }
1639
+ interface GetUrlResponseNonNullableFields {
1640
+ checkoutUrl: string;
1641
+ }
1642
+ interface PurchasedItemNonNullableFields {
1643
+ productId: string;
1644
+ price: string;
1645
+ currency: string;
1646
+ billingCycle: PaymentCycle;
1647
+ }
1648
+ interface GetPurchaseHistoryResponseNonNullableFields {
1649
+ purchases: PurchasedItemNonNullableFields[];
1650
+ }
1651
+ interface GetUrlOptions {
1652
+ /**
1653
+ * URL for the Wix checkout page. Redirect site owners to this URL after
1654
+ * they've successfully purchased a paid plan for your app.
1655
+ */
1656
+ successUrl?: string | null;
1657
+ /**
1658
+ * Whether the checkout is for testing purposes only. Testing is mainly
1659
+ * relevant for in-app purchase flows. When `true`, Wix charges the site
1660
+ * owners an amount of `0.00`.
1661
+ */
1662
+ testCheckout?: boolean;
1663
+ /** Information about the paid plan's billing cycle. */
1664
+ billingCycle?: PaymentCycle;
1665
+ /**
1666
+ * 2-letter country code in
1667
+ * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
1668
+ * format.
1669
+ *
1670
+ * Default: `"US"`
1671
+ */
1672
+ countryCode?: string | null;
1673
+ /**
1674
+ * 2-letter language code in
1675
+ * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1676
+ *
1677
+ * Default: `"EN"`
1678
+ */
1679
+ languageCode?: string | null;
1680
+ /** Coupon code for the paid plan. Available only in case there is a discount. */
1681
+ couponCode?: string | null;
3269
1682
  }
3270
1683
 
3271
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
3272
- //=> {b: string | number; c: () => void; d: {}}
3273
- ```
3274
-
3275
- @category Object
3276
- */
3277
- type ConditionalExcept<Base, Condition> = Except<
3278
- Base,
3279
- ConditionalKeys<Base, Condition>
3280
- >;
1684
+ declare function getUrl$1(httpClient: HttpClient): GetUrlSignature;
1685
+ interface GetUrlSignature {
1686
+ /**
1687
+ * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.
1688
+ *
1689
+ *
1690
+ * This call succeeds only in case you have previously
1691
+ * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).
1692
+ *
1693
+ * The returned checkout URL is valid for 48 hours.
1694
+ *
1695
+ * This API allows your app to manage your pricing page outside of Wix while
1696
+ * still using the standard Wix checkout flow.
1697
+ * @param - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard
1698
+ * for a list of your app's supported product IDs.
1699
+ */
1700
+ (productId: string, options?: GetUrlOptions | undefined): Promise<GetUrlResponse & GetUrlResponseNonNullableFields>;
1701
+ }
1702
+ declare function getPurchaseHistory$1(httpClient: HttpClient): GetPurchaseHistorySignature;
1703
+ interface GetPurchaseHistorySignature {
1704
+ /**
1705
+ * Retrieves a list of the site owner's past purchases for your app.
1706
+ *
1707
+ *
1708
+ * You don't have to explicitly pass an identifier for the Wix site as part of
1709
+ * the request, since this information is taken automatically from the context.
1710
+ *
1711
+ * The response doesn't include any details about cancellations.
1712
+ */
1713
+ (): Promise<GetPurchaseHistoryResponse & GetPurchaseHistoryResponseNonNullableFields>;
1714
+ }
3281
1715
 
3282
- /**
3283
- * Descriptors are objects that describe the API of a module, and the module
3284
- * can either be a REST module or a host module.
3285
- * This type is recursive, so it can describe nested modules.
3286
- */
3287
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
3288
- [key: string]: Descriptors | PublicMetadata | any;
3289
- };
3290
- /**
3291
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
3292
- * and returns an object with the same structure, but with all descriptors replaced with their API.
3293
- * Any non-descriptor properties are removed from the returned object, including descriptors that
3294
- * do not match the given host (as they will not work with the given host).
3295
- */
3296
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
3297
- done: T;
3298
- recurse: T extends {
3299
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
3300
- } ? 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<{
3301
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
3302
- -1,
3303
- 0,
3304
- 1,
3305
- 2,
3306
- 3,
3307
- 4,
3308
- 5
3309
- ][Depth]> : never;
3310
- }, EmptyObject>;
3311
- }[Depth extends -1 ? 'done' : 'recurse'];
3312
- type PublicMetadata = {
3313
- PACKAGE_NAME?: string;
3314
- };
1716
+ declare const getUrl: MaybeContext<BuildRESTFunction<typeof getUrl$1> & typeof getUrl$1>;
1717
+ declare const getPurchaseHistory: MaybeContext<BuildRESTFunction<typeof getPurchaseHistory$1> & typeof getPurchaseHistory$1>;
3315
1718
 
3316
- declare global {
3317
- interface ContextualClient {
3318
- }
1719
+ type index_d$1_Charge = Charge;
1720
+ type index_d$1_ChargeOverride = ChargeOverride;
1721
+ type index_d$1_GetMeteredBillingChargesRequest = GetMeteredBillingChargesRequest;
1722
+ type index_d$1_GetMeteredBillingChargesResponse = GetMeteredBillingChargesResponse;
1723
+ type index_d$1_GetPurchaseHistoryRequest = GetPurchaseHistoryRequest;
1724
+ type index_d$1_GetPurchaseHistoryResponse = GetPurchaseHistoryResponse;
1725
+ type index_d$1_GetPurchaseHistoryResponseNonNullableFields = GetPurchaseHistoryResponseNonNullableFields;
1726
+ type index_d$1_GetSitePaymentMethodsStatusRequest = GetSitePaymentMethodsStatusRequest;
1727
+ type index_d$1_GetSitePaymentMethodsStatusResponse = GetSitePaymentMethodsStatusResponse;
1728
+ type index_d$1_GetUrlOptions = GetUrlOptions;
1729
+ type index_d$1_GetUrlRequest = GetUrlRequest;
1730
+ type index_d$1_GetUrlResponse = GetUrlResponse;
1731
+ type index_d$1_GetUrlResponseNonNullableFields = GetUrlResponseNonNullableFields;
1732
+ type index_d$1_IdentificationData = IdentificationData;
1733
+ type index_d$1_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
1734
+ type index_d$1_InvoiceStatus = InvoiceStatus;
1735
+ declare const index_d$1_InvoiceStatus: typeof InvoiceStatus;
1736
+ type index_d$1_InvoiceStatusUpdate = InvoiceStatusUpdate;
1737
+ type index_d$1_MessageEnvelope = MessageEnvelope;
1738
+ type index_d$1_PaymentCycle = PaymentCycle;
1739
+ declare const index_d$1_PaymentCycle: typeof PaymentCycle;
1740
+ type index_d$1_PurchasedItem = PurchasedItem;
1741
+ type index_d$1_WebhookIdentityType = WebhookIdentityType;
1742
+ declare const index_d$1_WebhookIdentityType: typeof WebhookIdentityType;
1743
+ declare const index_d$1_getPurchaseHistory: typeof getPurchaseHistory;
1744
+ declare const index_d$1_getUrl: typeof getUrl;
1745
+ declare namespace index_d$1 {
1746
+ export { type index_d$1_Charge as Charge, type index_d$1_ChargeOverride as ChargeOverride, type index_d$1_GetMeteredBillingChargesRequest as GetMeteredBillingChargesRequest, type index_d$1_GetMeteredBillingChargesResponse as GetMeteredBillingChargesResponse, type index_d$1_GetPurchaseHistoryRequest as GetPurchaseHistoryRequest, type index_d$1_GetPurchaseHistoryResponse as GetPurchaseHistoryResponse, type index_d$1_GetPurchaseHistoryResponseNonNullableFields as GetPurchaseHistoryResponseNonNullableFields, type index_d$1_GetSitePaymentMethodsStatusRequest as GetSitePaymentMethodsStatusRequest, type index_d$1_GetSitePaymentMethodsStatusResponse as GetSitePaymentMethodsStatusResponse, type index_d$1_GetUrlOptions as GetUrlOptions, type index_d$1_GetUrlRequest as GetUrlRequest, type index_d$1_GetUrlResponse as GetUrlResponse, type index_d$1_GetUrlResponseNonNullableFields as GetUrlResponseNonNullableFields, type index_d$1_IdentificationData as IdentificationData, type index_d$1_IdentificationDataIdOneOf as IdentificationDataIdOneOf, index_d$1_InvoiceStatus as InvoiceStatus, type index_d$1_InvoiceStatusUpdate as InvoiceStatusUpdate, type index_d$1_MessageEnvelope as MessageEnvelope, index_d$1_PaymentCycle as PaymentCycle, type index_d$1_PurchasedItem as PurchasedItem, index_d$1_WebhookIdentityType as WebhookIdentityType, index_d$1_getPurchaseHistory as getPurchaseHistory, index_d$1_getUrl as getUrl };
3319
1747
  }
3320
- /**
3321
- * A type used to create concerete types from SDK descriptors in
3322
- * case a contextual client is available.
3323
- */
3324
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
3325
- host: Host;
3326
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
3327
1748
 
3328
1749
  /** Embedded script data */
3329
1750
  interface ScriptProperties {