@wix/app-management 1.0.48 → 1.0.50

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,1872 +0,0 @@
1
- type HostModule<T, H extends Host> = {
2
- __type: 'host';
3
- create(host: H): T;
4
- };
5
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
- type Host<Environment = unknown> = {
7
- channel: {
8
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
- disconnect: () => void;
10
- } | Promise<{
11
- disconnect: () => void;
12
- }>;
13
- };
14
- environment?: Environment;
15
- /**
16
- * Optional name of the environment, use for logging
17
- */
18
- name?: string;
19
- /**
20
- * Optional bast url to use for API requests, for example `www.wixapis.com`
21
- */
22
- apiBaseUrl?: string;
23
- /**
24
- * Possible data to be provided by every host, for cross cutting concerns
25
- * like internationalization, billing, etc.
26
- */
27
- essentials?: {
28
- /**
29
- * The language of the currently viewed session
30
- */
31
- language?: string;
32
- /**
33
- * The locale of the currently viewed session
34
- */
35
- locale?: string;
36
- /**
37
- * Any headers that should be passed through to the API requests
38
- */
39
- passThroughHeaders?: Record<string, string>;
40
- };
41
- };
42
-
43
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
44
- interface HttpClient {
45
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
46
- fetchWithAuth: typeof fetch;
47
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
- getActiveToken?: () => string | undefined;
49
- }
50
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
- type HttpResponse<T = any> = {
52
- data: T;
53
- status: number;
54
- statusText: string;
55
- headers: any;
56
- request?: any;
57
- };
58
- type RequestOptions<_TResponse = any, Data = any> = {
59
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
60
- url: string;
61
- data?: Data;
62
- params?: URLSearchParams;
63
- } & APIMetadata;
64
- type APIMetadata = {
65
- methodFqn?: string;
66
- entityFqdn?: string;
67
- packageName?: string;
68
- };
69
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
- type EventDefinition<Payload = unknown, Type extends string = string> = {
71
- __type: 'event-definition';
72
- type: Type;
73
- isDomainEvent?: boolean;
74
- transformations?: (envelope: unknown) => Payload;
75
- __payload: Payload;
76
- };
77
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
78
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
79
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
80
-
81
- type ServicePluginMethodInput = {
82
- request: any;
83
- metadata: any;
84
- };
85
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
- type ServicePluginMethodMetadata = {
87
- name: string;
88
- primaryHttpMappingPath: string;
89
- transformations: {
90
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
91
- toREST: (...args: unknown[]) => unknown;
92
- };
93
- };
94
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
95
- __type: 'service-plugin-definition';
96
- componentType: string;
97
- methods: ServicePluginMethodMetadata[];
98
- __contract: Contract;
99
- };
100
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
101
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
102
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
103
-
104
- type RequestContext = {
105
- isSSR: boolean;
106
- host: string;
107
- protocol?: string;
108
- };
109
- type ResponseTransformer = (data: any, headers?: any) => any;
110
- /**
111
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
- */
115
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
- type AmbassadorRequestOptions<T = any> = {
117
- _?: T;
118
- url?: string;
119
- method?: Method;
120
- params?: any;
121
- data?: any;
122
- transformResponse?: ResponseTransformer | ResponseTransformer[];
123
- };
124
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
125
- __isAmbassador: boolean;
126
- };
127
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
128
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
129
-
130
- declare global {
131
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
132
- interface SymbolConstructor {
133
- readonly observable: symbol;
134
- }
135
- }
136
-
137
- declare const emptyObjectSymbol: unique symbol;
138
-
139
- /**
140
- Represents a strictly empty plain object, the `{}` value.
141
-
142
- When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
143
-
144
- @example
145
- ```
146
- import type {EmptyObject} from 'type-fest';
147
-
148
- // The following illustrates the problem with `{}`.
149
- const foo1: {} = {}; // Pass
150
- const foo2: {} = []; // Pass
151
- const foo3: {} = 42; // Pass
152
- const foo4: {} = {a: 1}; // Pass
153
-
154
- // With `EmptyObject` only the first case is valid.
155
- const bar1: EmptyObject = {}; // Pass
156
- const bar2: EmptyObject = 42; // Fail
157
- const bar3: EmptyObject = []; // Fail
158
- const bar4: EmptyObject = {a: 1}; // Fail
159
- ```
160
-
161
- Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
162
-
163
- @category Object
164
- */
165
- type EmptyObject = {[emptyObjectSymbol]?: never};
166
-
167
- /**
168
- Returns a boolean for whether the two given types are equal.
169
-
170
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
171
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
172
-
173
- Use-cases:
174
- - If you want to make a conditional branch based on the result of a comparison of two types.
175
-
176
- @example
177
- ```
178
- import type {IsEqual} from 'type-fest';
179
-
180
- // This type returns a boolean for whether the given array includes the given item.
181
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
182
- type Includes<Value extends readonly any[], Item> =
183
- Value extends readonly [Value[0], ...infer rest]
184
- ? IsEqual<Value[0], Item> extends true
185
- ? true
186
- : Includes<rest, Item>
187
- : false;
188
- ```
189
-
190
- @category Type Guard
191
- @category Utilities
192
- */
193
- type IsEqual<A, B> =
194
- (<G>() => G extends A ? 1 : 2) extends
195
- (<G>() => G extends B ? 1 : 2)
196
- ? true
197
- : false;
198
-
199
- /**
200
- Filter out keys from an object.
201
-
202
- Returns `never` if `Exclude` is strictly equal to `Key`.
203
- Returns `never` if `Key` extends `Exclude`.
204
- Returns `Key` otherwise.
205
-
206
- @example
207
- ```
208
- type Filtered = Filter<'foo', 'foo'>;
209
- //=> never
210
- ```
211
-
212
- @example
213
- ```
214
- type Filtered = Filter<'bar', string>;
215
- //=> never
216
- ```
217
-
218
- @example
219
- ```
220
- type Filtered = Filter<'bar', 'foo'>;
221
- //=> 'bar'
222
- ```
223
-
224
- @see {Except}
225
- */
226
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
-
228
- type ExceptOptions = {
229
- /**
230
- Disallow assigning non-specified properties.
231
-
232
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
233
-
234
- @default false
235
- */
236
- requireExactProps?: boolean;
237
- };
238
-
239
- /**
240
- Create a type from an object type without certain keys.
241
-
242
- We recommend setting the `requireExactProps` option to `true`.
243
-
244
- This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
245
-
246
- This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
247
-
248
- @example
249
- ```
250
- import type {Except} from 'type-fest';
251
-
252
- type Foo = {
253
- a: number;
254
- b: string;
255
- };
256
-
257
- type FooWithoutA = Except<Foo, 'a'>;
258
- //=> {b: string}
259
-
260
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
261
- //=> errors: 'a' does not exist in type '{ b: string; }'
262
-
263
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
264
- //=> {a: number} & Partial<Record<"b", never>>
265
-
266
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
267
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
268
- ```
269
-
270
- @category Object
271
- */
272
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
274
- } & (Options['requireExactProps'] extends true
275
- ? Partial<Record<KeysType, never>>
276
- : {});
277
-
278
- /**
279
- Returns a boolean for whether the given type is `never`.
280
-
281
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
- @link https://stackoverflow.com/a/53984913/10292952
283
- @link https://www.zhenghao.io/posts/ts-never
284
-
285
- Useful in type utilities, such as checking if something does not occur.
286
-
287
- @example
288
- ```
289
- import type {IsNever, And} from 'type-fest';
290
-
291
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
- type AreStringsEqual<A extends string, B extends string> =
293
- And<
294
- IsNever<Exclude<A, B>> extends true ? true : false,
295
- IsNever<Exclude<B, A>> extends true ? true : false
296
- >;
297
-
298
- type EndIfEqual<I extends string, O extends string> =
299
- AreStringsEqual<I, O> extends true
300
- ? never
301
- : void;
302
-
303
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
- if (input === output) {
305
- process.exit(0);
306
- }
307
- }
308
-
309
- endIfEqual('abc', 'abc');
310
- //=> never
311
-
312
- endIfEqual('abc', '123');
313
- //=> void
314
- ```
315
-
316
- @category Type Guard
317
- @category Utilities
318
- */
319
- type IsNever<T> = [T] extends [never] ? true : false;
320
-
321
- /**
322
- An if-else-like type that resolves depending on whether the given type is `never`.
323
-
324
- @see {@link IsNever}
325
-
326
- @example
327
- ```
328
- import type {IfNever} from 'type-fest';
329
-
330
- type ShouldBeTrue = IfNever<never>;
331
- //=> true
332
-
333
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
- //=> 'bar'
335
- ```
336
-
337
- @category Type Guard
338
- @category Utilities
339
- */
340
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
- IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
- );
343
-
344
- /**
345
- Extract the keys from a type where the value type of the key extends the given `Condition`.
346
-
347
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
348
-
349
- @example
350
- ```
351
- import type {ConditionalKeys} from 'type-fest';
352
-
353
- interface Example {
354
- a: string;
355
- b: string | number;
356
- c?: string;
357
- d: {};
358
- }
359
-
360
- type StringKeysOnly = ConditionalKeys<Example, string>;
361
- //=> 'a'
362
- ```
363
-
364
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
365
-
366
- @example
367
- ```
368
- import type {ConditionalKeys} from 'type-fest';
369
-
370
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
371
- //=> 'a' | 'c'
372
- ```
373
-
374
- @category Object
375
- */
376
- type ConditionalKeys<Base, Condition> =
377
- {
378
- // Map through all the keys of the given base type.
379
- [Key in keyof Base]-?:
380
- // Pick only keys with types extending the given `Condition` type.
381
- Base[Key] extends Condition
382
- // Retain this key
383
- // If the value for the key extends never, only include it if `Condition` also extends never
384
- ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
385
- // Discard this key since the condition fails.
386
- : never;
387
- // Convert the produced object into a union type of the keys which passed the conditional test.
388
- }[keyof Base];
389
-
390
- /**
391
- Exclude keys from a shape that matches the given `Condition`.
392
-
393
- This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
394
-
395
- @example
396
- ```
397
- import type {Primitive, ConditionalExcept} from 'type-fest';
398
-
399
- class Awesome {
400
- name: string;
401
- successes: number;
402
- failures: bigint;
403
-
404
- run() {}
405
- }
406
-
407
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
408
- //=> {run: () => void}
409
- ```
410
-
411
- @example
412
- ```
413
- import type {ConditionalExcept} from 'type-fest';
414
-
415
- interface Example {
416
- a: string;
417
- b: string | number;
418
- c: () => void;
419
- d: {};
420
- }
421
-
422
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
423
- //=> {b: string | number; c: () => void; d: {}}
424
- ```
425
-
426
- @category Object
427
- */
428
- type ConditionalExcept<Base, Condition> = Except<
429
- Base,
430
- ConditionalKeys<Base, Condition>
431
- >;
432
-
433
- /**
434
- * Descriptors are objects that describe the API of a module, and the module
435
- * can either be a REST module or a host module.
436
- * This type is recursive, so it can describe nested modules.
437
- */
438
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
- [key: string]: Descriptors | PublicMetadata | any;
440
- };
441
- /**
442
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
443
- * and returns an object with the same structure, but with all descriptors replaced with their API.
444
- * Any non-descriptor properties are removed from the returned object, including descriptors that
445
- * do not match the given host (as they will not work with the given host).
446
- */
447
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
448
- done: T;
449
- recurse: T extends {
450
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
451
- } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
452
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
453
- -1,
454
- 0,
455
- 1,
456
- 2,
457
- 3,
458
- 4,
459
- 5
460
- ][Depth]> : never;
461
- }, EmptyObject>;
462
- }[Depth extends -1 ? 'done' : 'recurse'];
463
- type PublicMetadata = {
464
- PACKAGE_NAME?: string;
465
- };
466
-
467
- declare global {
468
- interface ContextualClient {
469
- }
470
- }
471
- /**
472
- * A type used to create concerete types from SDK descriptors in
473
- * case a contextual client is available.
474
- */
475
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
- host: Host;
477
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
478
-
479
- interface AppPlans {
480
- /** App ID, as defined in the [app dashboard](https://dev.wix.com/apps/my-apps?viewId=active-apps-view). */
481
- _id?: string;
482
- /**
483
- * List of the app's pricing plans.
484
- *
485
- * Min: `0` plans
486
- * Max: `50` plans
487
- */
488
- plans?: Plan[];
489
- }
490
- declare enum SaleType {
491
- /** Default value, can be used when no specific sale is associated. */
492
- SALE_TYPE_UNSPECIFIED = "SALE_TYPE_UNSPECIFIED",
493
- CYBER_MONDAY = "CYBER_MONDAY",
494
- NOVEMBER_SALE = "NOVEMBER_SALE",
495
- BLACK_FRIDAY = "BLACK_FRIDAY",
496
- DEVELOPER_SALE = "DEVELOPER_SALE"
497
- }
498
- declare enum DiscountType {
499
- DISCOUNT_TYPE_UNSPECIFIED = "DISCOUNT_TYPE_UNSPECIFIED",
500
- /** Discount is a fixed amount in USD. */
501
- FIXED_AMOUNT = "FIXED_AMOUNT",
502
- /** Discount is a percentage of the total price. */
503
- PERCENTAGE = "PERCENTAGE"
504
- }
505
- declare enum SourceType {
506
- /** Default value, can be used when no specific source is associated. */
507
- SOURCE_TYPE_UNSPECIFIED = "SOURCE_TYPE_UNSPECIFIED",
508
- /** Discount is due to Wix/Developer Sale */
509
- SALE = "SALE",
510
- /** Discount is due to App Benefit */
511
- APP_BENEFIT = "APP_BENEFIT"
512
- }
513
- interface SaleSource {
514
- saleId?: string | null;
515
- saleType?: SaleType;
516
- }
517
- interface Cycle {
518
- /**
519
- * Type of the billing cycle.
520
- *
521
- * + `"UNKNOWN_UNIT"`: There is no information about the billing cycle.
522
- * + `"ONE_TIME"`: The customer pays for unlimited usage of the app with a single payment.
523
- * + `"RECURRING"`: The customer pays for a subscription to the app on a recurring schedule.
524
- */
525
- cycleType?: CycleType;
526
- /** Duration of the billing cycle. Available only for `{"cycleType": "RECURRING"}`. */
527
- cycleDuration?: Duration;
528
- }
529
- declare enum DurationUnit {
530
- /** unknown interval unit */
531
- UNKNOWN_UNIT = "UNKNOWN_UNIT",
532
- /** month */
533
- MONTH = "MONTH",
534
- /** year */
535
- YEAR = "YEAR"
536
- }
537
- declare enum CycleType {
538
- UNKNOWN_TYPE = "UNKNOWN_TYPE",
539
- ONE_TIME = "ONE_TIME",
540
- RECURRING = "RECURRING"
541
- }
542
- interface Duration {
543
- /** Unit of the billing cycle. */
544
- unit?: DurationUnit;
545
- /** Count of units that make up the billing cycle. */
546
- count?: number;
547
- }
548
- interface UsageBasedDetails {
549
- /**
550
- * Smallest possible amount that your app charges customers in usage-based
551
- * pricing. For example, the price of a single SMS message if your
552
- * app charges customers for sending text messages. Always in
553
- * [USD](https://en.wikipedia.org/wiki/United_States_dollar).
554
- *
555
- * Min: `0.00`
556
- * Max: 1024 characters
557
- */
558
- minimumChargeIncrement?: string | null;
559
- /**
560
- * Recurring, monthly base fee in usage-based pricing that your app
561
- * charges customers regardless of how much they use your app.
562
- *
563
- * Min: `0.00`
564
- * Max: 1024 characters
565
- */
566
- monthlyBaseFee?: string | null;
567
- /**
568
- * Description of the usage-based pricing plan, as defined in the [app dashboard](https://dev.wix.com/apps/my-apps?viewId=active-apps-view).
569
- *
570
- * Max: 1024 characters
571
- */
572
- customChargeDescription?: string | null;
573
- }
574
- interface Discount extends DiscountSourceDataOneOf {
575
- /** Sale type */
576
- saleOptions?: SaleSource;
577
- type?: DiscountType;
578
- /** Discount amount */
579
- amount?: string;
580
- /**
581
- * if a discount is applied to a specific sale
582
- * @deprecated if a discount is applied to a specific sale
583
- * @targetRemovalDate 2025-01-14
584
- */
585
- saleId?: string | null;
586
- /**
587
- * Price without taxes. For yearly plans, Wix calculates and returns the
588
- * average price per month. You can get the full price by multiplying the
589
- * returned price with 12.
590
- * Min: `0.00`
591
- * Max: 1024 characters
592
- */
593
- priceBeforeTax?: string;
594
- /**
595
- * Total price including taxes.
596
- * Min: `0.00`
597
- * Max: 1024 characters
598
- */
599
- totalPrice?: string;
600
- /**
601
- * @deprecated
602
- * @targetRemovalDate 2025-01-14
603
- */
604
- saleType?: SaleType;
605
- sourceType?: SourceType;
606
- }
607
- /** @oneof */
608
- interface DiscountSourceDataOneOf {
609
- /** Sale type */
610
- saleOptions?: SaleSource;
611
- }
612
- declare enum BillingSource {
613
- UNKNOWN = "UNKNOWN",
614
- /** plan billing and charges is managed by Wix */
615
- WIX = "WIX",
616
- /** plan billing and charges is managed by the app */
617
- EXTERNAL = "EXTERNAL"
618
- }
619
- interface Price {
620
- /**
621
- * Price without taxes. For yearly plans, Wix calculates and returns the
622
- * average price per month. You can get the full price by multiplying the
623
- * returned price by 12.
624
- *
625
- * Min: `0.00`
626
- * Max: 1024 characters
627
- */
628
- priceBeforeTax?: string;
629
- /**
630
- * Total price including taxes.
631
- *
632
- * Min: `0.00`
633
- * Max: 1024 characters
634
- */
635
- totalPrice?: string;
636
- /** Information about the plan's recurring billing cycle or single payment. */
637
- billingCycle?: Cycle;
638
- /**
639
- * Details about the plan's usage-based pricing.
640
- * Available only for plans with
641
- * [usage-based pricing](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/usage-based-pricing).
642
- */
643
- usageBaseOptions?: UsageBasedDetails;
644
- discount?: Discount;
645
- billingSource?: BillingSource;
646
- /** Can be shown instead of plan price - used for dynamic plans */
647
- customPaymentTitle?: string | null;
648
- }
649
- interface Plan {
650
- /**
651
- * ID of the app plan.
652
- * @readonly
653
- */
654
- _id?: string;
655
- /**
656
- * ID of your app's pricing plan, as displayed in the [app dashboard](https://dev.wix.com/apps/my-apps?viewId=active-apps-view).
657
- * Identical to `vendorProductId` in the
658
- * [Paid Plan Purchased webhook](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/paid-plan-purchased).
659
- */
660
- vendorId?: string;
661
- /** Name of your app's pricing plan, as defined by you in the [app dashboard](https://dev.wix.com/apps/my-apps?viewId=active-apps-view). */
662
- name?: string;
663
- /**
664
- * List of your plan's benefits, as defined by you in the [app dashboard](https://dev.wix.com/apps/my-apps?viewId=active-apps-view).
665
- * Currently, the benefits are available only in English.
666
- *
667
- * Min: `0` benefits
668
- * Max: `4` benefits
669
- * Max per benefit: 1024 characters
670
- */
671
- benefits?: string[];
672
- /**
673
- * List of the plan's prices. Available only when the plan's prices are managed
674
- * by Wix and not externally.
675
- *
676
- * Min: `0` prices
677
- * Max: `10` prices
678
- */
679
- prices?: Price[];
680
- }
681
- interface ListAppPlansByAppIdRequest {
682
- /**
683
- * List of app IDs to retrieve plans for.
684
- *
685
- * Min: 1 app ID
686
- * Max: 100 app IDs
687
- */
688
- appIds: string[];
689
- }
690
- interface ListAppPlansByAppIdResponse {
691
- /**
692
- * Tax settings. Wix calculates the tax settings based on the country code that
693
- * you pass in the call's header. If you don't pass a country code in the header,
694
- * Wix calculates the tax settings based on the caller's IP address. Note that the
695
- * tax settings may not resolve properly if you call through a VPN.
696
- */
697
- taxSettings?: TaxSettings;
698
- /**
699
- * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
700
- * format. Wix calculates the currency based on the country code that
701
- * you pass in the call's header. If you don't pass a country code in the header,
702
- * Wix calculates the currency based on the caller's IP address. Note that the
703
- * currency may not resolve properly if you call through a VPN.
704
- */
705
- currency?: string;
706
- /**
707
- * Currency symbol in decimal HTML entity format. For example, `&#36;` for $
708
- * (United States Dollar). Wix calculates the currency symbol based on the
709
- * country code that you pass in the call's header. If you don't pass a country
710
- * code in the header, Wix calculates the tax settings based on the caller's IP
711
- * address. Note that the currency symbol may not resolve properly if you call
712
- * through a VPN.
713
- */
714
- currencySymbol?: string;
715
- /**
716
- * Retrieved app plans.
717
- *
718
- * Min: 0 plans
719
- * Max: 50 plans
720
- */
721
- appPlans?: AppPlans[];
722
- }
723
- interface TaxSettings {
724
- /**
725
- * Whether you must display the total price including taxes in the given
726
- * country.
727
- */
728
- showPriceWithTax?: boolean;
729
- /**
730
- * Tax rate for the given country as percentage. Returned as `0` when
731
- * `{"showPriceWithTax": false}`.
732
- */
733
- percentage?: string | null;
734
- /**
735
- * Type of tax required in the given country.
736
- *
737
- * + `"NOT_APPLICABLE"`: The country doesn't require that you display the total price including taxes, or Wix failed to calculate the country based on the call's IP address.
738
- * + `"VAT"`: The given country requires that you display the total price including [value-added tax (VAT)](https://en.wikipedia.org/wiki/Value-added_tax).
739
- * + `"GST"`: The given country requires that you display the total price including [generation-skipping transfer tax (GST)](https://en.wikipedia.org/wiki/Generation-skipping_transfer_tax).
740
- */
741
- taxType?: TaxType;
742
- }
743
- declare enum TaxType {
744
- NOT_APPLICABLE = "NOT_APPLICABLE",
745
- VAT = "VAT",
746
- GST = "GST"
747
- }
748
- interface TaxSettingsNonNullableFields {
749
- showPriceWithTax: boolean;
750
- taxType: TaxType;
751
- }
752
- interface DurationNonNullableFields {
753
- unit: DurationUnit;
754
- count: number;
755
- }
756
- interface CycleNonNullableFields {
757
- cycleType: CycleType;
758
- cycleDuration?: DurationNonNullableFields;
759
- }
760
- interface SaleSourceNonNullableFields {
761
- saleType: SaleType;
762
- }
763
- interface DiscountNonNullableFields {
764
- saleOptions?: SaleSourceNonNullableFields;
765
- type: DiscountType;
766
- amount: string;
767
- priceBeforeTax: string;
768
- totalPrice: string;
769
- saleType: SaleType;
770
- sourceType: SourceType;
771
- }
772
- interface PriceNonNullableFields {
773
- priceBeforeTax: string;
774
- totalPrice: string;
775
- billingCycle?: CycleNonNullableFields;
776
- discount?: DiscountNonNullableFields;
777
- billingSource: BillingSource;
778
- }
779
- interface PlanNonNullableFields {
780
- _id: string;
781
- vendorId: string;
782
- name: string;
783
- benefits: string[];
784
- prices: PriceNonNullableFields[];
785
- }
786
- interface AppPlansNonNullableFields {
787
- _id: string;
788
- plans: PlanNonNullableFields[];
789
- }
790
- interface ListAppPlansByAppIdResponseNonNullableFields {
791
- taxSettings?: TaxSettingsNonNullableFields;
792
- currency: string;
793
- currencySymbol: string;
794
- appPlans: AppPlansNonNullableFields[];
795
- }
796
-
797
- declare function listAppPlansByAppId$1(httpClient: HttpClient): ListAppPlansByAppIdSignature;
798
- interface ListAppPlansByAppIdSignature {
799
- /**
800
- * Retrieves plans for the given apps.
801
- *
802
- *
803
- * Also returns tax settings and currency details. Wix calculates this information
804
- * based on the 2-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
805
- * format that you pass in the call's header. If you don't pass a country code in
806
- * the header, Wix calculates the tax settings and currency details based on the
807
- * call's IP address. Note that the tax settings and currency details may not resolve
808
- * properly if you call through a VPN.
809
- *
810
- * Prices for plans that are managed outside of Wix aren't returned.
811
- *
812
- * Consumers must pay for yearly and multi-yearly plans of your app every month.
813
- * For these plans this endpoint returns the price that the consumer must pay every
814
- * month and not the total price for the entire year.
815
- *
816
- * <blockquote class="important">
817
- *
818
- * __Important:__
819
- * The App Plans API doesn't follow any tenancy model. You don't need any
820
- * permissions to call `List App Plans by App ID`.
821
- *
822
- * </blockquote>
823
- * @param - List of app IDs to retrieve plans for.
824
- *
825
- * Min: 1 app ID
826
- * Max: 100 app IDs
827
- */
828
- (appIds: string[]): Promise<ListAppPlansByAppIdResponse & ListAppPlansByAppIdResponseNonNullableFields>;
829
- }
830
-
831
- declare const listAppPlansByAppId: MaybeContext<BuildRESTFunction<typeof listAppPlansByAppId$1> & typeof listAppPlansByAppId$1>;
832
-
833
- type context$4_AppPlans = AppPlans;
834
- type context$4_BillingSource = BillingSource;
835
- declare const context$4_BillingSource: typeof BillingSource;
836
- type context$4_Cycle = Cycle;
837
- type context$4_CycleType = CycleType;
838
- declare const context$4_CycleType: typeof CycleType;
839
- type context$4_Discount = Discount;
840
- type context$4_DiscountSourceDataOneOf = DiscountSourceDataOneOf;
841
- type context$4_DiscountType = DiscountType;
842
- declare const context$4_DiscountType: typeof DiscountType;
843
- type context$4_Duration = Duration;
844
- type context$4_DurationUnit = DurationUnit;
845
- declare const context$4_DurationUnit: typeof DurationUnit;
846
- type context$4_ListAppPlansByAppIdRequest = ListAppPlansByAppIdRequest;
847
- type context$4_ListAppPlansByAppIdResponse = ListAppPlansByAppIdResponse;
848
- type context$4_ListAppPlansByAppIdResponseNonNullableFields = ListAppPlansByAppIdResponseNonNullableFields;
849
- type context$4_Plan = Plan;
850
- type context$4_Price = Price;
851
- type context$4_SaleSource = SaleSource;
852
- type context$4_SaleType = SaleType;
853
- declare const context$4_SaleType: typeof SaleType;
854
- type context$4_SourceType = SourceType;
855
- declare const context$4_SourceType: typeof SourceType;
856
- type context$4_TaxSettings = TaxSettings;
857
- type context$4_TaxType = TaxType;
858
- declare const context$4_TaxType: typeof TaxType;
859
- type context$4_UsageBasedDetails = UsageBasedDetails;
860
- declare const context$4_listAppPlansByAppId: typeof listAppPlansByAppId;
861
- declare namespace context$4 {
862
- export { type context$4_AppPlans as AppPlans, context$4_BillingSource as BillingSource, type context$4_Cycle as Cycle, context$4_CycleType as CycleType, type context$4_Discount as Discount, type context$4_DiscountSourceDataOneOf as DiscountSourceDataOneOf, context$4_DiscountType as DiscountType, type context$4_Duration as Duration, context$4_DurationUnit as DurationUnit, type context$4_ListAppPlansByAppIdRequest as ListAppPlansByAppIdRequest, type context$4_ListAppPlansByAppIdResponse as ListAppPlansByAppIdResponse, type context$4_ListAppPlansByAppIdResponseNonNullableFields as ListAppPlansByAppIdResponseNonNullableFields, type context$4_Plan as Plan, type context$4_Price as Price, type context$4_SaleSource as SaleSource, context$4_SaleType as SaleType, context$4_SourceType as SourceType, type context$4_TaxSettings as TaxSettings, context$4_TaxType as TaxType, type context$4_UsageBasedDetails as UsageBasedDetails, context$4_listAppPlansByAppId as listAppPlansByAppId };
863
- }
864
-
865
- /**
866
- * An app instance is a specific occurrence of your app on a particular Wix site.
867
- * When a site owner installs your app, a unique instance is generated for that
868
- * specific site. Use the `instanceId` to keep track of the individual data
869
- * associated with each app instance.
870
- */
871
- interface AppInstance {
872
- /**
873
- * ID of the app instance. You can use it to keep track of the individual
874
- * data that's associated with the specific occurence of your app that's
875
- * installed on a Wix site.
876
- */
877
- instanceId?: string;
878
- /**
879
- * App name, as set by you in the Customs Apps page during the app creation
880
- * process.
881
- */
882
- appName?: string;
883
- /** Version of your app that's installed on the Wix site, as set by you during the app creation process. */
884
- appVersion?: string | null;
885
- /**
886
- * Whether the site owners have installed a free or paid version of your app
887
- * on their site.
888
- */
889
- isFree?: boolean;
890
- /**
891
- * Billing information for the app instance. Available only in case
892
- * `{"isFree": false}`.
893
- */
894
- billing?: BillingInfo;
895
- /**
896
- * List of [permissions](https://dev.wix.com/docs/build-apps/developer-tools/developers-center/example-app-walkthrough/build-an-app#4-add-permissions)
897
- * that the site owners have granted your app. You set the list of permissions that
898
- * your app requires from the site owners in your app's Permissions page during the
899
- * app creation process.
900
- */
901
- permissions?: string[];
902
- /** Plans available to this app instance. */
903
- availablePlans?: AvailablePlan[];
904
- /**
905
- * ID of the Wix site from which the instance of your app has been cloned.
906
- * Available only in case `{"copiedFromTemplate": true}`.
907
- * All visual settings of the Wix site and app data are duplicated during the
908
- * cloning process. Wix also notifies you in case there is any additional
909
- * external functionality for the original site.
910
- */
911
- originInstanceId?: string | null;
912
- /**
913
- * __Deprecated__. This parameter will be removed on March 30, 2023. Use
914
- * `copiedFromTemplate` instead.
915
- * @deprecated
916
- */
917
- isOriginSiteTemplate?: boolean;
918
- /** Whether the app instance was created when another Wix site was cloned. */
919
- copiedFromTemplate?: boolean;
920
- /** Whether the app instance includes a free trial that hasn't started yet. */
921
- freeTrialAvailable?: boolean;
922
- }
923
- interface BillingInfo {
924
- /** Name of the package that the site owner has paid for. */
925
- packageName?: string;
926
- /**
927
- * Interval of the billing cycle. `"ONE_TIME"` means that site owners have
928
- * purchased unlimited access to the app with a single, upfront payment.
929
- */
930
- billingCycle?: PaymentCycle$1;
931
- /**
932
- * Date and time the site owners have purchased the app's paid plan in
933
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
934
- */
935
- timeStamp?: string;
936
- /**
937
- * Date and time the app's current billing cycle ends in
938
- * `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for yearly and
939
- * multi-yearly plans.
940
- */
941
- expirationDate?: string | null;
942
- /**
943
- * Whether the app's subscription automatically renews at the end of the
944
- * current billing cycle.
945
- */
946
- autoRenewing?: boolean | null;
947
- /** ID of the invoice for the current billing cycle. */
948
- invoiceId?: string | null;
949
- /**
950
- * Information about any discounts applied to the app instance's current billing cycle.
951
- * If the site owners applied a developer coupon or Wix Voucher
952
- * when installing the paid version of your app, this field holds the coupon's
953
- * name or `“Wix discount coupon”`. Site owners may receive a Wix Voucher when
954
- * upgrading their Wix subscription. If there is no discount for the
955
- * current billing cycle, the field is an empty string.
956
- */
957
- source?: string | null;
958
- /** Information about the free trial applied, if relevant. */
959
- freeTrialInfo?: FreeTrialInfo;
960
- }
961
- declare enum PaymentCycle$1 {
962
- NO_CYCLE = "NO_CYCLE",
963
- MONTHLY = "MONTHLY",
964
- YEARLY = "YEARLY",
965
- ONE_TIME = "ONE_TIME",
966
- TWO_YEARS = "TWO_YEARS",
967
- THREE_YEARS = "THREE_YEARS",
968
- FOUR_YEARS = "FOUR_YEARS",
969
- FIVE_YEARS = "FIVE_YEARS"
970
- }
971
- interface FreeTrialInfo {
972
- /**
973
- * Current free trial status.
974
- * @readonly
975
- */
976
- status?: FreeTrialStatus;
977
- /**
978
- * When the free trial has ended. Populated only once the free trial is over.
979
- * @readonly
980
- */
981
- endDate?: Date | null;
982
- }
983
- declare enum FreeTrialStatus {
984
- /** Unknown trial status. */
985
- UNKNOWN_STATUS = "UNKNOWN_STATUS",
986
- /** The free trial is currently in progress. */
987
- IN_PROGRESS = "IN_PROGRESS",
988
- /** The free trial has ended. */
989
- ENDED = "ENDED",
990
- /** No free trial was applied, as none was available. */
991
- NOT_AVAILABLE = "NOT_AVAILABLE"
992
- }
993
- interface AvailablePlan {
994
- /** Package name of the available plan. */
995
- packageName?: string;
996
- /** Source of the available plan. Can be a bundle or 3rd-party app. */
997
- source?: string;
998
- }
999
- interface AppInstalled {
1000
- /** Unique identifier of the app within the website. */
1001
- appId?: string;
1002
- /** 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)). */
1003
- originInstanceId?: string | null;
1004
- }
1005
- interface AppRemoved {
1006
- /** Unique identifier of the app within the website. */
1007
- appId?: string;
1008
- }
1009
- interface PaidPlanPurchased {
1010
- /** Date and time of purchase. */
1011
- operationTimeStamp?: Date | null;
1012
- /** Purchased app plan. */
1013
- vendorProductId?: string;
1014
- /** Selected payment cycle. */
1015
- cycle?: PaymentCycle$1;
1016
- /** Plan expiration date. */
1017
- expiresOn?: Date | null;
1018
- /** Coupon applied to purchase (if relevant). */
1019
- couponName?: string | null;
1020
- /** Invoice ID. */
1021
- invoiceId?: string | null;
1022
- }
1023
- interface PaidPlanChanged {
1024
- /** Date and time of change. */
1025
- operationTimeStamp?: Date | null;
1026
- /** Newly purchased app plan. */
1027
- vendorProductId?: string;
1028
- /** Newly selected payment cycle. */
1029
- cycle?: PaymentCycle$1;
1030
- /** Previous app plan. */
1031
- previousVendorProductId?: string | null;
1032
- /** Previous payment cycle. */
1033
- previousCycle?: PaymentCycle$1;
1034
- /** Coupon applied to purchase (if relevant). */
1035
- couponName?: string | null;
1036
- /** Invoice ID. */
1037
- invoiceId?: string | null;
1038
- }
1039
- interface PaidPlanAutoRenewalCancelled {
1040
- /** Date and time of auto-renewal cancellation. */
1041
- operationTimeStamp?: Date | null;
1042
- /** Current app plan. */
1043
- vendorProductId?: string;
1044
- /** Current payment cycle. */
1045
- cycle?: PaymentCycle$1;
1046
- /** Supported values: `UNKNOWN_CANCELLATION_TYPE_ERROR_STATE`, `USER_CANCEL`, `FAILED_PAYMENT`, `TRANSFER_CANCELLATION_REASON`. Reason provided by app for cancellation (if relevant). */
1047
- cancelReason?: string | null;
1048
- /** Reason provided by site owner for cancellation (if relevant). */
1049
- userReason?: string | null;
1050
- /** Cancellation type. */
1051
- subscriptionCancellationType?: string | null;
1052
- }
1053
- interface GetAppInstanceRequest {
1054
- }
1055
- interface GetAppInstanceResponse {
1056
- /** Retrieved app instance. */
1057
- instance?: AppInstance;
1058
- /** Information about the corresponding Wix site. */
1059
- site?: SiteInfo;
1060
- }
1061
- interface SiteInfo {
1062
- /** Display name of the site. */
1063
- siteDisplayName?: string | null;
1064
- /**
1065
- * 2-letter language code of the site's locale in
1066
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1067
- */
1068
- locale?: string;
1069
- /**
1070
- * 3-letter currency code for the site's billing in
1071
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1072
- */
1073
- paymentCurrency?: string;
1074
- /** Information about the site's supported languages. */
1075
- multilingual?: Multilingual;
1076
- /** URL of the site. Available only in case the site has been published. */
1077
- url?: string | null;
1078
- /** Description of the site. */
1079
- description?: string | null;
1080
- /** Wix apps that are installed on the site. */
1081
- installedWixApps?: string[];
1082
- /**
1083
- * > **Deprecation Notice:** This parameter will be removed on June 30, 2022. Use `ownerInfo` instead.
1084
- * @deprecated
1085
- */
1086
- ownerEmail?: string | null;
1087
- /**
1088
- * Information about the site owner. Available only when calling
1089
- * _Get App Instance_ with the __Read Site Owner Email__ permission scope.
1090
- */
1091
- ownerInfo?: OwnerInfo;
1092
- /** Site ID. */
1093
- siteId?: string;
1094
- }
1095
- interface Multilingual {
1096
- /** Whether the site supports more than a single language. */
1097
- isMultiLingual?: boolean;
1098
- /** List of supported languages. Returned only when `{"isMultiLingual": true}`. */
1099
- supportedLanguages?: SupportedLanguage[];
1100
- }
1101
- interface SupportedLanguage {
1102
- /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
1103
- languageCode?: string;
1104
- /** Locale. */
1105
- locale?: Locale;
1106
- /** Whether the supported language is the primary language for the site. */
1107
- isPrimary?: boolean;
1108
- /** Language icon. */
1109
- countryCode?: string;
1110
- /** How the language will be resolved. For internal use. */
1111
- resolutionMethod?: ResolutionMethod;
1112
- }
1113
- interface Locale {
1114
- /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
1115
- languageCode?: string;
1116
- /** Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. */
1117
- country?: string;
1118
- }
1119
- declare enum ResolutionMethod {
1120
- QUERY_PARAM = "QUERY_PARAM",
1121
- SUBDOMAIN = "SUBDOMAIN",
1122
- SUBDIRECTORY = "SUBDIRECTORY"
1123
- }
1124
- interface OwnerInfo {
1125
- /** Site owner's email address. Identical to the site owner's login email. */
1126
- email?: string;
1127
- /**
1128
- * Supported values: `VERIFIED_OPT_IN`, `VERIFIED_OPT_OUT`,
1129
- * `NOT_VERIFIED_OPT_IN`, `NOT_VERIFIED_OPT_OUT`.
1130
- *
1131
- * Whether the site owner has verified their email and whether they have chosen
1132
- * to receive email notifications from Wix.
1133
- */
1134
- emailStatus?: string;
1135
- }
1136
- interface GetAppInstanceByInstanceIdRequest {
1137
- /** ID of the app instance to retrieve. */
1138
- instanceId?: string;
1139
- }
1140
- interface MessageEnvelope$1 {
1141
- /** App instance ID. */
1142
- instanceId?: string | null;
1143
- /** Event type. */
1144
- eventType?: string;
1145
- /** The identification type and identity data. */
1146
- identity?: IdentificationData$1;
1147
- /** Stringify payload. */
1148
- data?: string;
1149
- }
1150
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
1151
- /** ID of a site visitor that has not logged in to the site. */
1152
- anonymousVisitorId?: string;
1153
- /** ID of a site visitor that has logged in to the site. */
1154
- memberId?: string;
1155
- /** ID of a Wix user (site owner, contributor, etc.). */
1156
- wixUserId?: string;
1157
- /** ID of an app. */
1158
- appId?: string;
1159
- /** @readonly */
1160
- identityType?: WebhookIdentityType$1;
1161
- }
1162
- /** @oneof */
1163
- interface IdentificationDataIdOneOf$1 {
1164
- /** ID of a site visitor that has not logged in to the site. */
1165
- anonymousVisitorId?: string;
1166
- /** ID of a site visitor that has logged in to the site. */
1167
- memberId?: string;
1168
- /** ID of a Wix user (site owner, contributor, etc.). */
1169
- wixUserId?: string;
1170
- /** ID of an app. */
1171
- appId?: string;
1172
- }
1173
- declare enum WebhookIdentityType$1 {
1174
- UNKNOWN = "UNKNOWN",
1175
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1176
- MEMBER = "MEMBER",
1177
- WIX_USER = "WIX_USER",
1178
- APP = "APP"
1179
- }
1180
- interface FreeTrialInfoNonNullableFields {
1181
- status: FreeTrialStatus;
1182
- }
1183
- interface BillingInfoNonNullableFields {
1184
- packageName: string;
1185
- billingCycle: PaymentCycle$1;
1186
- timeStamp: string;
1187
- freeTrialInfo?: FreeTrialInfoNonNullableFields;
1188
- }
1189
- interface AvailablePlanNonNullableFields {
1190
- packageName: string;
1191
- source: string;
1192
- }
1193
- interface AppInstanceNonNullableFields {
1194
- instanceId: string;
1195
- appName: string;
1196
- isFree: boolean;
1197
- billing?: BillingInfoNonNullableFields;
1198
- permissions: string[];
1199
- availablePlans: AvailablePlanNonNullableFields[];
1200
- isOriginSiteTemplate: boolean;
1201
- copiedFromTemplate: boolean;
1202
- freeTrialAvailable: boolean;
1203
- }
1204
- interface LocaleNonNullableFields {
1205
- languageCode: string;
1206
- country: string;
1207
- }
1208
- interface SupportedLanguageNonNullableFields {
1209
- languageCode: string;
1210
- locale?: LocaleNonNullableFields;
1211
- isPrimary: boolean;
1212
- countryCode: string;
1213
- resolutionMethod: ResolutionMethod;
1214
- }
1215
- interface MultilingualNonNullableFields {
1216
- isMultiLingual: boolean;
1217
- supportedLanguages: SupportedLanguageNonNullableFields[];
1218
- }
1219
- interface OwnerInfoNonNullableFields {
1220
- email: string;
1221
- emailStatus: string;
1222
- }
1223
- interface SiteInfoNonNullableFields {
1224
- locale: string;
1225
- paymentCurrency: string;
1226
- multilingual?: MultilingualNonNullableFields;
1227
- installedWixApps: string[];
1228
- ownerInfo?: OwnerInfoNonNullableFields;
1229
- siteId: string;
1230
- }
1231
- interface GetAppInstanceResponseNonNullableFields {
1232
- instance?: AppInstanceNonNullableFields;
1233
- site?: SiteInfoNonNullableFields;
1234
- }
1235
- interface BaseEventMetadata {
1236
- /** App instance ID. */
1237
- instanceId?: string | null;
1238
- /** Event type. */
1239
- eventType?: string;
1240
- /** The identification type and identity data. */
1241
- identity?: IdentificationData$1;
1242
- }
1243
- interface AppInstanceInstalledEnvelope {
1244
- data: AppInstalled;
1245
- metadata: BaseEventMetadata;
1246
- }
1247
- interface AppInstanceRemovedEnvelope {
1248
- data: AppRemoved;
1249
- metadata: BaseEventMetadata;
1250
- }
1251
- interface AppInstancePaidPlanAutoRenewalCancelledEnvelope {
1252
- data: PaidPlanAutoRenewalCancelled;
1253
- metadata: BaseEventMetadata;
1254
- }
1255
- interface AppInstancePaidPlanChangedEnvelope {
1256
- data: PaidPlanChanged;
1257
- metadata: BaseEventMetadata;
1258
- }
1259
- interface AppInstancePaidPlanPurchasedEnvelope {
1260
- data: PaidPlanPurchased;
1261
- metadata: BaseEventMetadata;
1262
- }
1263
-
1264
- declare function getAppInstance$1(httpClient: HttpClient): GetAppInstanceSignature;
1265
- interface GetAppInstanceSignature {
1266
- /**
1267
- * Retrieves data about the instance of your app that's installed on a Wix site and data about the site itself.
1268
- *
1269
- * 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.
1270
- *
1271
- * 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).
1272
- *
1273
- * 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__.
1274
- */
1275
- (): Promise<GetAppInstanceResponse & GetAppInstanceResponseNonNullableFields>;
1276
- }
1277
- declare const onAppInstanceInstalled$1: EventDefinition<AppInstanceInstalledEnvelope, "AppInstalled">;
1278
- declare const onAppInstanceRemoved$1: EventDefinition<AppInstanceRemovedEnvelope, "AppRemoved">;
1279
- declare const onAppInstancePaidPlanAutoRenewalCancelled$1: EventDefinition<AppInstancePaidPlanAutoRenewalCancelledEnvelope, "PaidPlanAutoRenewalCancelled">;
1280
- declare const onAppInstancePaidPlanChanged$1: EventDefinition<AppInstancePaidPlanChangedEnvelope, "PaidPlanChanged">;
1281
- declare const onAppInstancePaidPlanPurchased$1: EventDefinition<AppInstancePaidPlanPurchasedEnvelope, "PaidPlanPurchased">;
1282
-
1283
- declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
1284
-
1285
- declare const getAppInstance: MaybeContext<BuildRESTFunction<typeof getAppInstance$1> & typeof getAppInstance$1>;
1286
-
1287
- type _publicOnAppInstanceInstalledType = typeof onAppInstanceInstalled$1;
1288
- /**
1289
- * Triggered when an instance of your app is installed on a Wix site.
1290
- */
1291
- declare const onAppInstanceInstalled: ReturnType<typeof createEventModule<_publicOnAppInstanceInstalledType>>;
1292
-
1293
- type _publicOnAppInstanceRemovedType = typeof onAppInstanceRemoved$1;
1294
- /**
1295
- * Triggered when an instance of your app is uninstalled from a Wix site.
1296
- */
1297
- declare const onAppInstanceRemoved: ReturnType<typeof createEventModule<_publicOnAppInstanceRemovedType>>;
1298
-
1299
- type _publicOnAppInstancePaidPlanAutoRenewalCancelledType = typeof onAppInstancePaidPlanAutoRenewalCancelled$1;
1300
- /**
1301
- * Triggered when a site owner cancels a paid plan for your app. The
1302
- * site owner can continue to use your app until the end of the current billing
1303
- * cycle.
1304
- */
1305
- declare const onAppInstancePaidPlanAutoRenewalCancelled: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanAutoRenewalCancelledType>>;
1306
-
1307
- type _publicOnAppInstancePaidPlanChangedType = typeof onAppInstancePaidPlanChanged$1;
1308
- /**
1309
- * Triggered when a site owner upgrades or downgrades their plan for your app.
1310
- */
1311
- declare const onAppInstancePaidPlanChanged: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanChangedType>>;
1312
-
1313
- type _publicOnAppInstancePaidPlanPurchasedType = typeof onAppInstancePaidPlanPurchased$1;
1314
- /**
1315
- * Triggered when a site owner purchases a paid plan for your app.
1316
- */
1317
- declare const onAppInstancePaidPlanPurchased: ReturnType<typeof createEventModule<_publicOnAppInstancePaidPlanPurchasedType>>;
1318
-
1319
- type context$3_AppInstalled = AppInstalled;
1320
- type context$3_AppInstance = AppInstance;
1321
- type context$3_AppInstanceInstalledEnvelope = AppInstanceInstalledEnvelope;
1322
- type context$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope = AppInstancePaidPlanAutoRenewalCancelledEnvelope;
1323
- type context$3_AppInstancePaidPlanChangedEnvelope = AppInstancePaidPlanChangedEnvelope;
1324
- type context$3_AppInstancePaidPlanPurchasedEnvelope = AppInstancePaidPlanPurchasedEnvelope;
1325
- type context$3_AppInstanceRemovedEnvelope = AppInstanceRemovedEnvelope;
1326
- type context$3_AppRemoved = AppRemoved;
1327
- type context$3_AvailablePlan = AvailablePlan;
1328
- type context$3_BaseEventMetadata = BaseEventMetadata;
1329
- type context$3_BillingInfo = BillingInfo;
1330
- type context$3_FreeTrialInfo = FreeTrialInfo;
1331
- type context$3_FreeTrialStatus = FreeTrialStatus;
1332
- declare const context$3_FreeTrialStatus: typeof FreeTrialStatus;
1333
- type context$3_GetAppInstanceByInstanceIdRequest = GetAppInstanceByInstanceIdRequest;
1334
- type context$3_GetAppInstanceRequest = GetAppInstanceRequest;
1335
- type context$3_GetAppInstanceResponse = GetAppInstanceResponse;
1336
- type context$3_GetAppInstanceResponseNonNullableFields = GetAppInstanceResponseNonNullableFields;
1337
- type context$3_Locale = Locale;
1338
- type context$3_Multilingual = Multilingual;
1339
- type context$3_OwnerInfo = OwnerInfo;
1340
- type context$3_PaidPlanAutoRenewalCancelled = PaidPlanAutoRenewalCancelled;
1341
- type context$3_PaidPlanChanged = PaidPlanChanged;
1342
- type context$3_PaidPlanPurchased = PaidPlanPurchased;
1343
- type context$3_ResolutionMethod = ResolutionMethod;
1344
- declare const context$3_ResolutionMethod: typeof ResolutionMethod;
1345
- type context$3_SiteInfo = SiteInfo;
1346
- type context$3_SupportedLanguage = SupportedLanguage;
1347
- type context$3__publicOnAppInstanceInstalledType = _publicOnAppInstanceInstalledType;
1348
- type context$3__publicOnAppInstancePaidPlanAutoRenewalCancelledType = _publicOnAppInstancePaidPlanAutoRenewalCancelledType;
1349
- type context$3__publicOnAppInstancePaidPlanChangedType = _publicOnAppInstancePaidPlanChangedType;
1350
- type context$3__publicOnAppInstancePaidPlanPurchasedType = _publicOnAppInstancePaidPlanPurchasedType;
1351
- type context$3__publicOnAppInstanceRemovedType = _publicOnAppInstanceRemovedType;
1352
- declare const context$3_getAppInstance: typeof getAppInstance;
1353
- declare const context$3_onAppInstanceInstalled: typeof onAppInstanceInstalled;
1354
- declare const context$3_onAppInstancePaidPlanAutoRenewalCancelled: typeof onAppInstancePaidPlanAutoRenewalCancelled;
1355
- declare const context$3_onAppInstancePaidPlanChanged: typeof onAppInstancePaidPlanChanged;
1356
- declare const context$3_onAppInstancePaidPlanPurchased: typeof onAppInstancePaidPlanPurchased;
1357
- declare const context$3_onAppInstanceRemoved: typeof onAppInstanceRemoved;
1358
- declare namespace context$3 {
1359
- export { type context$3_AppInstalled as AppInstalled, type context$3_AppInstance as AppInstance, type context$3_AppInstanceInstalledEnvelope as AppInstanceInstalledEnvelope, type context$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope as AppInstancePaidPlanAutoRenewalCancelledEnvelope, type context$3_AppInstancePaidPlanChangedEnvelope as AppInstancePaidPlanChangedEnvelope, type context$3_AppInstancePaidPlanPurchasedEnvelope as AppInstancePaidPlanPurchasedEnvelope, type context$3_AppInstanceRemovedEnvelope as AppInstanceRemovedEnvelope, type context$3_AppRemoved as AppRemoved, type context$3_AvailablePlan as AvailablePlan, type context$3_BaseEventMetadata as BaseEventMetadata, type context$3_BillingInfo as BillingInfo, type context$3_FreeTrialInfo as FreeTrialInfo, context$3_FreeTrialStatus as FreeTrialStatus, type context$3_GetAppInstanceByInstanceIdRequest as GetAppInstanceByInstanceIdRequest, type context$3_GetAppInstanceRequest as GetAppInstanceRequest, type context$3_GetAppInstanceResponse as GetAppInstanceResponse, type context$3_GetAppInstanceResponseNonNullableFields as GetAppInstanceResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type context$3_Locale as Locale, type MessageEnvelope$1 as MessageEnvelope, type context$3_Multilingual as Multilingual, type context$3_OwnerInfo as OwnerInfo, type context$3_PaidPlanAutoRenewalCancelled as PaidPlanAutoRenewalCancelled, type context$3_PaidPlanChanged as PaidPlanChanged, type context$3_PaidPlanPurchased as PaidPlanPurchased, PaymentCycle$1 as PaymentCycle, context$3_ResolutionMethod as ResolutionMethod, type context$3_SiteInfo as SiteInfo, type context$3_SupportedLanguage as SupportedLanguage, WebhookIdentityType$1 as WebhookIdentityType, type context$3__publicOnAppInstanceInstalledType as _publicOnAppInstanceInstalledType, type context$3__publicOnAppInstancePaidPlanAutoRenewalCancelledType as _publicOnAppInstancePaidPlanAutoRenewalCancelledType, type context$3__publicOnAppInstancePaidPlanChangedType as _publicOnAppInstancePaidPlanChangedType, type context$3__publicOnAppInstancePaidPlanPurchasedType as _publicOnAppInstancePaidPlanPurchasedType, type context$3__publicOnAppInstanceRemovedType as _publicOnAppInstanceRemovedType, context$3_getAppInstance as getAppInstance, context$3_onAppInstanceInstalled as onAppInstanceInstalled, context$3_onAppInstancePaidPlanAutoRenewalCancelled as onAppInstancePaidPlanAutoRenewalCancelled, context$3_onAppInstancePaidPlanChanged as onAppInstancePaidPlanChanged, context$3_onAppInstancePaidPlanPurchased as onAppInstancePaidPlanPurchased, context$3_onAppInstanceRemoved as onAppInstanceRemoved, onAppInstanceInstalled$1 as publicOnAppInstanceInstalled, onAppInstancePaidPlanAutoRenewalCancelled$1 as publicOnAppInstancePaidPlanAutoRenewalCancelled, onAppInstancePaidPlanChanged$1 as publicOnAppInstancePaidPlanChanged, onAppInstancePaidPlanPurchased$1 as publicOnAppInstancePaidPlanPurchased, onAppInstanceRemoved$1 as publicOnAppInstanceRemoved };
1360
- }
1361
-
1362
- interface SendBIEventResponse {
1363
- }
1364
- interface SendBIEventRequest {
1365
- /** Name of the event that's triggered in your app. */
1366
- eventName?: EventName;
1367
- /**
1368
- * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
1369
- *
1370
- * Min: 2 characters
1371
- */
1372
- customEventName?: string | null;
1373
- /**
1374
- * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
1375
- * You may also submit data with keys that aren't listed here.
1376
- *
1377
- * Additional data about your app's event.
1378
- *
1379
- * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
1380
- * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1381
- * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
1382
- * + `"reason"`: Information about why the event was triggered in your app.
1383
- * + `"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).
1384
- */
1385
- eventData?: Record<string, string>;
1386
- }
1387
- declare enum EventName {
1388
- /** Unknown event name. */
1389
- UNKNOWN = "UNKNOWN",
1390
- /** A site owner or contributor loads your app's dashboard. */
1391
- APP_DASHBOARD_LOADED = "APP_DASHBOARD_LOADED",
1392
- /** The site owner completes all required configurations for your app in your app's dashboard. */
1393
- APP_FINISHED_CONFIGURATION = "APP_FINISHED_CONFIGURATION",
1394
- /** 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. */
1395
- APP_UPGRADED = "APP_UPGRADED",
1396
- /** 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. */
1397
- PRIMARY_ACTION_PERFORMED = "PRIMARY_ACTION_PERFORMED",
1398
- /** Any event that's not listed here. Make sure to also send `customEventName`. */
1399
- CUSTOM = "CUSTOM",
1400
- /** 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`. */
1401
- CHARGE = "CHARGE",
1402
- /** 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"}}`. */
1403
- FUNDS_RETURNED = "FUNDS_RETURNED",
1404
- /** __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead. */
1405
- APP_FINISH_BUSINESS_SETUP = "APP_FINISH_BUSINESS_SETUP",
1406
- /** Your app’s internal code implementation is changed and might affect user flows or cause a regression. */
1407
- APP_DEPLOYED = "APP_DEPLOYED",
1408
- /** The site owner completes your app's required business setup. */
1409
- APP_SETUP_FINISHED = "APP_SETUP_FINISHED"
1410
- }
1411
- interface SendBiEventOptions {
1412
- /** Name of the event that's triggered in your app. */
1413
- eventName?: EventName;
1414
- /**
1415
- * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
1416
- *
1417
- * Min: 2 characters
1418
- */
1419
- customEventName?: string | null;
1420
- /**
1421
- * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
1422
- * You may also submit data with keys that aren't listed here.
1423
- *
1424
- * Additional data about your app's event.
1425
- *
1426
- * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
1427
- * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1428
- * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
1429
- * + `"reason"`: Information about why the event was triggered in your app.
1430
- * + `"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).
1431
- */
1432
- eventData?: Record<string, string>;
1433
- }
1434
-
1435
- declare function sendBiEvent$1(httpClient: HttpClient): SendBiEventSignature;
1436
- interface SendBiEventSignature {
1437
- /**
1438
- * Submit a BI event to Wix.
1439
- */
1440
- (options?: SendBiEventOptions | undefined): Promise<void>;
1441
- }
1442
-
1443
- declare const sendBiEvent: MaybeContext<BuildRESTFunction<typeof sendBiEvent$1> & typeof sendBiEvent$1>;
1444
-
1445
- type context$2_EventName = EventName;
1446
- declare const context$2_EventName: typeof EventName;
1447
- type context$2_SendBIEventRequest = SendBIEventRequest;
1448
- type context$2_SendBIEventResponse = SendBIEventResponse;
1449
- type context$2_SendBiEventOptions = SendBiEventOptions;
1450
- declare const context$2_sendBiEvent: typeof sendBiEvent;
1451
- declare namespace context$2 {
1452
- export { context$2_EventName as EventName, type context$2_SendBIEventRequest as SendBIEventRequest, type context$2_SendBIEventResponse as SendBIEventResponse, type context$2_SendBiEventOptions as SendBiEventOptions, context$2_sendBiEvent as sendBiEvent };
1453
- }
1454
-
1455
- interface PurchasedItem {
1456
- /** ID of your app's paid plan. */
1457
- productId?: string;
1458
- /** Price of your app's paid plan. For example, `9.95`. */
1459
- price?: string;
1460
- /**
1461
- * 3-letter currency code in
1462
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1463
- */
1464
- currency?: string;
1465
- /** Information about the billing cycle for your app's paid plan. */
1466
- billingCycle?: PaymentCycle;
1467
- /**
1468
- * Date and time the site onwers have purchased your app's paid plan in
1469
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1470
- */
1471
- dateCreated?: Date | null;
1472
- }
1473
- declare enum PaymentCycle {
1474
- NO_CYCLE = "NO_CYCLE",
1475
- MONTHLY = "MONTHLY",
1476
- YEARLY = "YEARLY",
1477
- ONE_TIME = "ONE_TIME",
1478
- TWO_YEARS = "TWO_YEARS",
1479
- THREE_YEARS = "THREE_YEARS",
1480
- FOUR_YEARS = "FOUR_YEARS",
1481
- FIVE_YEARS = "FIVE_YEARS"
1482
- }
1483
- interface InvoiceStatusUpdate {
1484
- /** Invoice payment status. */
1485
- status?: InvoiceStatus;
1486
- /** Wix Premium invoice ID. */
1487
- invoiceId?: string;
1488
- /** App instance ID - a unique ID assigned to each app in each site. */
1489
- instanceId?: string | null;
1490
- /** Whether the invoice is for a single payment or for multiple, recurring payments. */
1491
- recurring?: boolean;
1492
- }
1493
- declare enum InvoiceStatus {
1494
- UNKNOWN_INVOICE_STATUS = "UNKNOWN_INVOICE_STATUS",
1495
- PAYMENT_FAILED = "PAYMENT_FAILED",
1496
- PAID = "PAID",
1497
- REFUNDED = "REFUNDED",
1498
- VOIDED = "VOIDED",
1499
- CHARGEDBACK = "CHARGEDBACK"
1500
- }
1501
- interface GetUrlRequest {
1502
- /**
1503
- * ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard
1504
- * for a list of your app's supported product IDs.
1505
- */
1506
- productId: string;
1507
- /**
1508
- * URL for the Wix checkout page. Redirect site owners to this URL after
1509
- * they've successfully purchased a paid plan for your app.
1510
- */
1511
- successUrl?: string | null;
1512
- /**
1513
- * Whether the checkout is for testing purposes only. Testing is mainly
1514
- * relevant for in-app purchase flows. When `true`, Wix charges the site
1515
- * owners an amount of `0.00`.
1516
- */
1517
- testCheckout?: boolean;
1518
- /** Information about the paid plan's billing cycle. */
1519
- billingCycle?: PaymentCycle;
1520
- /**
1521
- * 2-letter country code in
1522
- * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
1523
- * format.
1524
- *
1525
- * Default: `"US"`
1526
- */
1527
- countryCode?: string | null;
1528
- /**
1529
- * 2-letter language code in
1530
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1531
- *
1532
- * Default: `"EN"`
1533
- */
1534
- languageCode?: string | null;
1535
- /** Coupon code for the paid plan. Available only in case there is a discount. */
1536
- couponCode?: string | null;
1537
- }
1538
- interface ChargeOverride {
1539
- /**
1540
- * Override price. In case you omit the override price, Wix charges site
1541
- * owners the app's default price that's configured in the Pricing page of your app's dashboard.
1542
- */
1543
- price?: number;
1544
- /**
1545
- * Override 3-letter currency code in
1546
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1547
- */
1548
- currency?: string;
1549
- }
1550
- interface GetUrlResponse {
1551
- /** URL for the Wix checkout page. */
1552
- checkoutUrl?: string;
1553
- /**
1554
- * Token for the Wix checkout page. The token holds all data about the order
1555
- * you're creating a checkout for. It is [signed](),
1556
- * so you can verify that it comes from Wix.
1557
- */
1558
- token?: string | null;
1559
- }
1560
- interface GetPurchaseHistoryRequest {
1561
- }
1562
- interface GetPurchaseHistoryResponse {
1563
- /** Retrieved purchases the site owners have completed for you app. */
1564
- purchases?: PurchasedItem[];
1565
- }
1566
- interface GetSitePaymentMethodsStatusRequest {
1567
- }
1568
- interface GetSitePaymentMethodsStatusResponse {
1569
- /**
1570
- * Whether the site owners have enabled at least a single online payment method.
1571
- * Online payment methods include Wix Payments, Stripe, PayPal, and credit
1572
- * cards.
1573
- */
1574
- onlineProviderEnabled?: boolean;
1575
- /** Whether the site owners accept offline payments. */
1576
- offlineProviderEnabled?: boolean;
1577
- /**
1578
- * Whether the site owners have enabled the
1579
- * [Wix Point of Sale](https://www.wix.com/pos).
1580
- * This allows their customers to make electronic payments in person.
1581
- */
1582
- wixPosProviderEnabled?: boolean;
1583
- /**
1584
- * Whether the site owners have enabled at least one 3rd-party point-of-sale
1585
- * provider. This allows their customers to make electronic payments in person.
1586
- */
1587
- thirdPartyPosProviderEnabled?: boolean;
1588
- }
1589
- interface GetMeteredBillingChargesRequest {
1590
- /**
1591
- * 3-letter currency code in
1592
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
1593
- */
1594
- currency?: string | null;
1595
- /**
1596
- * Start of the period you want to retrieve the custom charges for in
1597
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1598
- */
1599
- startDate?: Date | null;
1600
- /**
1601
- * End of the period you want to retrieve the custom charges for in
1602
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
1603
- */
1604
- endDate?: Date | null;
1605
- }
1606
- interface GetMeteredBillingChargesResponse {
1607
- /** List of retrieved custom charges. */
1608
- charges?: Charge[];
1609
- }
1610
- interface Charge {
1611
- /** ID of the custom charge. The ID consists of 64 characters. */
1612
- _id?: string | null;
1613
- /** Description of the custom charge. */
1614
- description?: string;
1615
- /**
1616
- * Charge amount.
1617
- *
1618
- * Min: `0.50`
1619
- */
1620
- amount?: string;
1621
- }
1622
- interface MessageEnvelope {
1623
- /** App instance ID. */
1624
- instanceId?: string | null;
1625
- /** Event type. */
1626
- eventType?: string;
1627
- /** The identification type and identity data. */
1628
- identity?: IdentificationData;
1629
- /** Stringify payload. */
1630
- data?: string;
1631
- }
1632
- interface IdentificationData extends IdentificationDataIdOneOf {
1633
- /** ID of a site visitor that has not logged in to the site. */
1634
- anonymousVisitorId?: string;
1635
- /** ID of a site visitor that has logged in to the site. */
1636
- memberId?: string;
1637
- /** ID of a Wix user (site owner, contributor, etc.). */
1638
- wixUserId?: string;
1639
- /** ID of an app. */
1640
- appId?: string;
1641
- /** @readonly */
1642
- identityType?: WebhookIdentityType;
1643
- }
1644
- /** @oneof */
1645
- interface IdentificationDataIdOneOf {
1646
- /** ID of a site visitor that has not logged in to the site. */
1647
- anonymousVisitorId?: string;
1648
- /** ID of a site visitor that has logged in to the site. */
1649
- memberId?: string;
1650
- /** ID of a Wix user (site owner, contributor, etc.). */
1651
- wixUserId?: string;
1652
- /** ID of an app. */
1653
- appId?: string;
1654
- }
1655
- declare enum WebhookIdentityType {
1656
- UNKNOWN = "UNKNOWN",
1657
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1658
- MEMBER = "MEMBER",
1659
- WIX_USER = "WIX_USER",
1660
- APP = "APP"
1661
- }
1662
- interface GetUrlResponseNonNullableFields {
1663
- checkoutUrl: string;
1664
- }
1665
- interface PurchasedItemNonNullableFields {
1666
- productId: string;
1667
- price: string;
1668
- currency: string;
1669
- billingCycle: PaymentCycle;
1670
- }
1671
- interface GetPurchaseHistoryResponseNonNullableFields {
1672
- purchases: PurchasedItemNonNullableFields[];
1673
- }
1674
- interface GetUrlOptions {
1675
- /**
1676
- * URL for the Wix checkout page. Redirect site owners to this URL after
1677
- * they've successfully purchased a paid plan for your app.
1678
- */
1679
- successUrl?: string | null;
1680
- /**
1681
- * Whether the checkout is for testing purposes only. Testing is mainly
1682
- * relevant for in-app purchase flows. When `true`, Wix charges the site
1683
- * owners an amount of `0.00`.
1684
- */
1685
- testCheckout?: boolean;
1686
- /** Information about the paid plan's billing cycle. */
1687
- billingCycle?: PaymentCycle;
1688
- /**
1689
- * 2-letter country code in
1690
- * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
1691
- * format.
1692
- *
1693
- * Default: `"US"`
1694
- */
1695
- countryCode?: string | null;
1696
- /**
1697
- * 2-letter language code in
1698
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1699
- *
1700
- * Default: `"EN"`
1701
- */
1702
- languageCode?: string | null;
1703
- /** Coupon code for the paid plan. Available only in case there is a discount. */
1704
- couponCode?: string | null;
1705
- }
1706
-
1707
- declare function getUrl$1(httpClient: HttpClient): GetUrlSignature;
1708
- interface GetUrlSignature {
1709
- /**
1710
- * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.
1711
- *
1712
- *
1713
- * This call succeeds only in case you have previously
1714
- * [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).
1715
- *
1716
- * The returned checkout URL is valid for 48 hours.
1717
- *
1718
- * This API allows your app to manage your pricing page outside of Wix while
1719
- * still using the standard Wix checkout flow.
1720
- * @param - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard
1721
- * for a list of your app's supported product IDs.
1722
- */
1723
- (productId: string, options?: GetUrlOptions | undefined): Promise<GetUrlResponse & GetUrlResponseNonNullableFields>;
1724
- }
1725
- declare function getPurchaseHistory$1(httpClient: HttpClient): GetPurchaseHistorySignature;
1726
- interface GetPurchaseHistorySignature {
1727
- /**
1728
- * Retrieves a list of the site owner's past purchases for your app.
1729
- *
1730
- *
1731
- * You don't have to explicitly pass an identifier for the Wix site as part of
1732
- * the request, since this information is taken automatically from the context.
1733
- *
1734
- * The response doesn't include any details about cancellations.
1735
- */
1736
- (): Promise<GetPurchaseHistoryResponse & GetPurchaseHistoryResponseNonNullableFields>;
1737
- }
1738
-
1739
- declare const getUrl: MaybeContext<BuildRESTFunction<typeof getUrl$1> & typeof getUrl$1>;
1740
- declare const getPurchaseHistory: MaybeContext<BuildRESTFunction<typeof getPurchaseHistory$1> & typeof getPurchaseHistory$1>;
1741
-
1742
- type context$1_Charge = Charge;
1743
- type context$1_ChargeOverride = ChargeOverride;
1744
- type context$1_GetMeteredBillingChargesRequest = GetMeteredBillingChargesRequest;
1745
- type context$1_GetMeteredBillingChargesResponse = GetMeteredBillingChargesResponse;
1746
- type context$1_GetPurchaseHistoryRequest = GetPurchaseHistoryRequest;
1747
- type context$1_GetPurchaseHistoryResponse = GetPurchaseHistoryResponse;
1748
- type context$1_GetPurchaseHistoryResponseNonNullableFields = GetPurchaseHistoryResponseNonNullableFields;
1749
- type context$1_GetSitePaymentMethodsStatusRequest = GetSitePaymentMethodsStatusRequest;
1750
- type context$1_GetSitePaymentMethodsStatusResponse = GetSitePaymentMethodsStatusResponse;
1751
- type context$1_GetUrlOptions = GetUrlOptions;
1752
- type context$1_GetUrlRequest = GetUrlRequest;
1753
- type context$1_GetUrlResponse = GetUrlResponse;
1754
- type context$1_GetUrlResponseNonNullableFields = GetUrlResponseNonNullableFields;
1755
- type context$1_IdentificationData = IdentificationData;
1756
- type context$1_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
1757
- type context$1_InvoiceStatus = InvoiceStatus;
1758
- declare const context$1_InvoiceStatus: typeof InvoiceStatus;
1759
- type context$1_InvoiceStatusUpdate = InvoiceStatusUpdate;
1760
- type context$1_MessageEnvelope = MessageEnvelope;
1761
- type context$1_PaymentCycle = PaymentCycle;
1762
- declare const context$1_PaymentCycle: typeof PaymentCycle;
1763
- type context$1_PurchasedItem = PurchasedItem;
1764
- type context$1_WebhookIdentityType = WebhookIdentityType;
1765
- declare const context$1_WebhookIdentityType: typeof WebhookIdentityType;
1766
- declare const context$1_getPurchaseHistory: typeof getPurchaseHistory;
1767
- declare const context$1_getUrl: typeof getUrl;
1768
- declare namespace context$1 {
1769
- export { type context$1_Charge as Charge, type context$1_ChargeOverride as ChargeOverride, type context$1_GetMeteredBillingChargesRequest as GetMeteredBillingChargesRequest, type context$1_GetMeteredBillingChargesResponse as GetMeteredBillingChargesResponse, type context$1_GetPurchaseHistoryRequest as GetPurchaseHistoryRequest, type context$1_GetPurchaseHistoryResponse as GetPurchaseHistoryResponse, type context$1_GetPurchaseHistoryResponseNonNullableFields as GetPurchaseHistoryResponseNonNullableFields, type context$1_GetSitePaymentMethodsStatusRequest as GetSitePaymentMethodsStatusRequest, type context$1_GetSitePaymentMethodsStatusResponse as GetSitePaymentMethodsStatusResponse, type context$1_GetUrlOptions as GetUrlOptions, type context$1_GetUrlRequest as GetUrlRequest, type context$1_GetUrlResponse as GetUrlResponse, type context$1_GetUrlResponseNonNullableFields as GetUrlResponseNonNullableFields, type context$1_IdentificationData as IdentificationData, type context$1_IdentificationDataIdOneOf as IdentificationDataIdOneOf, context$1_InvoiceStatus as InvoiceStatus, type context$1_InvoiceStatusUpdate as InvoiceStatusUpdate, type context$1_MessageEnvelope as MessageEnvelope, context$1_PaymentCycle as PaymentCycle, type context$1_PurchasedItem as PurchasedItem, context$1_WebhookIdentityType as WebhookIdentityType, context$1_getPurchaseHistory as getPurchaseHistory, context$1_getUrl as getUrl };
1770
- }
1771
-
1772
- /** Embedded script data */
1773
- interface ScriptProperties {
1774
- /** Script parameters */
1775
- parameters?: Record<string, string>;
1776
- /** Whether script is disabled or not, defaults to false (not disabled) */
1777
- disabled?: boolean;
1778
- }
1779
- interface EmbedScriptRequest {
1780
- /** Details of the script to embed. */
1781
- properties: ScriptProperties;
1782
- /** ID of the corresponding embedded script component. */
1783
- componentId?: string | null;
1784
- }
1785
- interface EmbedScriptResponse {
1786
- /** Details of the embedded script. */
1787
- properties?: ScriptProperties;
1788
- }
1789
- interface GetEmbeddedScriptRequest {
1790
- /** Component ID of the embedded script to retrieve. */
1791
- componentId?: string | null;
1792
- }
1793
- interface GetEmbeddedScriptResponse {
1794
- /** Details of the retrieved embedded script. */
1795
- properties?: ScriptProperties;
1796
- }
1797
- interface EmbedScriptByInstanceIdRequest {
1798
- instanceId?: string;
1799
- /** Parameters to embed */
1800
- properties?: ScriptProperties;
1801
- componentId?: string | null;
1802
- }
1803
- interface GetEmbeddedScriptByInstanceIdRequest {
1804
- instanceId?: string;
1805
- componentId?: string | null;
1806
- }
1807
- interface ScriptPropertiesNonNullableFields {
1808
- disabled: boolean;
1809
- }
1810
- interface EmbedScriptResponseNonNullableFields {
1811
- properties?: ScriptPropertiesNonNullableFields;
1812
- }
1813
- interface GetEmbeddedScriptResponseNonNullableFields {
1814
- properties?: ScriptPropertiesNonNullableFields;
1815
- }
1816
- interface EmbedScriptOptions {
1817
- /** ID of the corresponding embedded script component. */
1818
- componentId?: string | null;
1819
- }
1820
- interface GetEmbeddedScriptOptions {
1821
- /** Component ID of the embedded script to retrieve. */
1822
- componentId?: string | null;
1823
- }
1824
-
1825
- declare function embedScript$1(httpClient: HttpClient): EmbedScriptSignature;
1826
- interface EmbedScriptSignature {
1827
- /**
1828
- * Inserts custom script tags into a site.
1829
- *
1830
- *
1831
- * Your app must have an existing
1832
- * [embedded script component](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/embedded-scripts/about-embedded-scripts),
1833
- * with exactly matching parameter names.
1834
- * @param - Details of the script to embed.
1835
- */
1836
- (properties: ScriptProperties, options?: EmbedScriptOptions | undefined): Promise<EmbedScriptResponse & EmbedScriptResponseNonNullableFields>;
1837
- }
1838
- declare function getEmbeddedScript$1(httpClient: HttpClient): GetEmbeddedScriptSignature;
1839
- interface GetEmbeddedScriptSignature {
1840
- /**
1841
- * Retrieves information about your app's existing embedded script.
1842
- *
1843
- *
1844
- * The call fails with `404` error in case your app doesn't include an
1845
- * embedded script on the site.
1846
- * @returns Details of the retrieved embedded script.
1847
- */
1848
- (options?: GetEmbeddedScriptOptions | undefined): Promise<ScriptProperties & ScriptPropertiesNonNullableFields>;
1849
- }
1850
-
1851
- declare const embedScript: MaybeContext<BuildRESTFunction<typeof embedScript$1> & typeof embedScript$1>;
1852
- declare const getEmbeddedScript: MaybeContext<BuildRESTFunction<typeof getEmbeddedScript$1> & typeof getEmbeddedScript$1>;
1853
-
1854
- type context_EmbedScriptByInstanceIdRequest = EmbedScriptByInstanceIdRequest;
1855
- type context_EmbedScriptOptions = EmbedScriptOptions;
1856
- type context_EmbedScriptRequest = EmbedScriptRequest;
1857
- type context_EmbedScriptResponse = EmbedScriptResponse;
1858
- type context_EmbedScriptResponseNonNullableFields = EmbedScriptResponseNonNullableFields;
1859
- type context_GetEmbeddedScriptByInstanceIdRequest = GetEmbeddedScriptByInstanceIdRequest;
1860
- type context_GetEmbeddedScriptOptions = GetEmbeddedScriptOptions;
1861
- type context_GetEmbeddedScriptRequest = GetEmbeddedScriptRequest;
1862
- type context_GetEmbeddedScriptResponse = GetEmbeddedScriptResponse;
1863
- type context_GetEmbeddedScriptResponseNonNullableFields = GetEmbeddedScriptResponseNonNullableFields;
1864
- type context_ScriptProperties = ScriptProperties;
1865
- type context_ScriptPropertiesNonNullableFields = ScriptPropertiesNonNullableFields;
1866
- declare const context_embedScript: typeof embedScript;
1867
- declare const context_getEmbeddedScript: typeof getEmbeddedScript;
1868
- declare namespace context {
1869
- export { type context_EmbedScriptByInstanceIdRequest as EmbedScriptByInstanceIdRequest, type context_EmbedScriptOptions as EmbedScriptOptions, type context_EmbedScriptRequest as EmbedScriptRequest, type context_EmbedScriptResponse as EmbedScriptResponse, type context_EmbedScriptResponseNonNullableFields as EmbedScriptResponseNonNullableFields, type context_GetEmbeddedScriptByInstanceIdRequest as GetEmbeddedScriptByInstanceIdRequest, type context_GetEmbeddedScriptOptions as GetEmbeddedScriptOptions, type context_GetEmbeddedScriptRequest as GetEmbeddedScriptRequest, type context_GetEmbeddedScriptResponse as GetEmbeddedScriptResponse, type context_GetEmbeddedScriptResponseNonNullableFields as GetEmbeddedScriptResponseNonNullableFields, type context_ScriptProperties as ScriptProperties, type context_ScriptPropertiesNonNullableFields as ScriptPropertiesNonNullableFields, context_embedScript as embedScript, context_getEmbeddedScript as getEmbeddedScript };
1870
- }
1871
-
1872
- export { context$3 as appInstances, context$4 as appPlans, context$2 as biEvents, context$1 as billing, context as embeddedScripts };