@wix/app-management 1.0.19 → 1.0.21

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/app-management",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -19,12 +19,12 @@
19
19
  "service-plugins"
20
20
  ],
21
21
  "dependencies": {
22
- "@wix/app-management_app-instances": "1.0.10",
23
- "@wix/app-management_app-plans": "1.0.10",
24
- "@wix/app-management_bi-events": "1.0.9",
25
- "@wix/app-management_billing": "1.0.10",
26
- "@wix/app-management_custom-charges": "1.0.5",
27
- "@wix/app-management_embedded-scripts": "1.0.7"
22
+ "@wix/app-management_app-instances": "1.0.11",
23
+ "@wix/app-management_app-plans": "1.0.11",
24
+ "@wix/app-management_bi-events": "1.0.10",
25
+ "@wix/app-management_billing": "1.0.11",
26
+ "@wix/app-management_custom-charges": "1.0.6",
27
+ "@wix/app-management_embedded-scripts": "1.0.8"
28
28
  },
29
29
  "devDependencies": {
30
30
  "glob": "^10.4.1",
@@ -48,5 +48,5 @@
48
48
  "fqdn": ""
49
49
  }
50
50
  },
51
- "falconPackageHash": "e21d5d1a848dbeeb5ad5bc688ab353b7a68ee4f413a33c9c7ea9f9b4"
51
+ "falconPackageHash": "92d82785d051537964c94876233fcc6ab069b7f94e686627793308e0"
52
52
  }
@@ -1,228 +1,8 @@
1
- /**
2
- * An `appPlans` object describes how you charge users for using your app.
3
- * You can set up multiple plans for a single app, with different plans giving access to
4
- * different tiers of functionality. For example, you can offer a free plan and
5
- * 3 paid plans with an increasing number of benefits. Learn more about
6
- * [setting up your app pricing](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-your-app-pricing).
7
- */
8
- interface AppPlans {
9
- /** App ID, as defined in the [Wix Dev Center](https://dev.wix.com/). */
10
- _id?: string;
11
- /**
12
- * List of the app's pricing plans.
13
- *
14
- * Min: `0` plans
15
- * Max: `50` plans
16
- */
17
- plans?: Plan[];
18
- }
19
- interface Cycle {
20
- /**
21
- * Type of the billing cycle.
22
- *
23
- * + `"UNKNOWN_UNIT"`: There is no information about the billing cycle.
24
- * + `"ONE_TIME"`: The customer pays for unlimited usage of the app with a single payment.
25
- * + `"RECURRING"`: The customer pays for a subscription to the app on a recurring schedule.
26
- */
27
- cycleType?: CycleType;
28
- /** Duration of the billing cycle. Available only for `{"cycleType": "RECURRING"}`. */
29
- cycleDuration?: Duration;
30
- }
31
- declare enum DurationUnit {
32
- /** unknown interval unit */
33
- UNKNOWN_UNIT = "UNKNOWN_UNIT",
34
- /** month */
35
- MONTH = "MONTH",
36
- /** year */
37
- YEAR = "YEAR"
38
- }
39
- declare enum CycleType {
40
- UNKNOWN_TYPE = "UNKNOWN_TYPE",
41
- ONE_TIME = "ONE_TIME",
42
- RECURRING = "RECURRING"
43
- }
44
- interface Duration {
45
- /** Unit of the billing cycle. */
46
- unit?: DurationUnit;
47
- /** Count of units that make up the billing cycle. */
48
- count?: number;
49
- }
50
- interface UsageBasedDetails {
51
- /**
52
- * Smallest possible amount that your app charges customers in usage-based
53
- * pricing. For example, the price of a single SMS message if your
54
- * app charges customers for sending text messages. Always in
55
- * [USD](https://en.wikipedia.org/wiki/United_States_dollar).
56
- *
57
- * Min: `0.00`
58
- * Max: 1024 characters
59
- */
60
- minimumChargeIncrement?: string | null;
61
- /**
62
- * Recurring, monthly base fee in usaged-based pricing that your app
63
- * charges customers regardless of how much they use your app.
64
- *
65
- * Min: `0.00`
66
- * Max: 1024 characters
67
- */
68
- monthlyBaseFee?: string | null;
69
- /**
70
- * Description of the usaged-based pricing plan, as defined in the
71
- * [Dev Center](https://dev.wix.com/).
72
- *
73
- * Max: 1024 characters
74
- */
75
- customChargeDescription?: string | null;
76
- }
77
- interface Price {
78
- /**
79
- * Price without taxes. For yearly plans, Wix calculates and returns the
80
- * average price per month. You can get thefull price by multiplying the
81
- * returned price with 12.
82
- *
83
- * Min: `0.00`
84
- * Max: 1024 characters
85
- */
86
- priceBeforeTax?: string;
87
- /**
88
- * Total price including taxes.
89
- *
90
- * Min: `0.00`
91
- * Max: 1024 characters
92
- */
93
- totalPrice?: string;
94
- /** Information about the plan's recurring billing cycle or single payment. */
95
- billingCycle?: Cycle;
96
- /**
97
- * Details about the plan's usage-based pricing.
98
- * Available only for plans with
99
- * [usage-based pricing](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/usage-based-pricing).
100
- */
101
- usageBaseOptions?: UsageBasedDetails;
102
- }
103
- interface Plan {
104
- /**
105
- * ID of the app plan.
106
- * @readonly
107
- */
108
- _id?: string;
109
- /**
110
- * ID of your app's pricing plan, as displayed in the [Dev Center](https://dev.wix.com/).
111
- * Identical to `vendorProductId` in the
112
- * [Paid Plan Purchased webhook](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/paid-plan-purchased).
113
- */
114
- vendorId?: string;
115
- /** Name of your app's pricing plan, as defined by you in the [Dev Center](https://dev.wix.com/). */
116
- name?: string;
117
- /**
118
- * List of your plan's benefits, as defined by you in the [Dev Center](https://dev.wix.com/).
119
- * Currently, the benefits are available only in English.
120
- *
121
- * Min: `0` benefits
122
- * Max: `4` benefits
123
- * Max per benefit: 1024 characters
124
- */
125
- benefits?: string[];
126
- /**
127
- * List of the plan's prices. Available only when the plan's prices are managed
128
- * by Wix and not externally.
129
- *
130
- * Min: `0` prices
131
- * Max: `10` prices
132
- */
133
- prices?: Price[];
134
- }
135
- interface ListAppPlansByAppIdResponse {
136
- /**
137
- * Tax settings. Wix calculates the tax settings based on the country code that
138
- * you pass in the call's header. If you don't pass a country code in the header,
139
- * Wix calculates the tax settings based on the caller's IP address. Note that the
140
- * tax settings may not resolve properly if you call through a VPN.
141
- */
142
- taxSettings?: TaxSettings;
143
- /**
144
- * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
145
- * format. Wix calculates the currency based on the country code that
146
- * you pass in the call's header. If you don't pass a country code in the header,
147
- * Wix calculates the currency based on the caller's IP address. Note that the
148
- * currency may not resolve properly if you call through a VPN.
149
- */
150
- currency?: string;
151
- /**
152
- * Currency symbol in decimal HTML entity format. For example, `$` for $
153
- * (United States Dollar). Wix calculates the currency symbol based on the
154
- * country code that you pass in the call's header. If you don't pass a country
155
- * code in the header, Wix calculates the tax settings based on the caller's IP
156
- * address. Note that the currency symbol may not resolve properly if you call
157
- * through a VPN.
158
- */
159
- currencySymbol?: string;
160
- /**
161
- * Retrieved app plans.
162
- *
163
- * Min: 0 plans
164
- * Max: 50 plans
165
- */
166
- appPlans?: AppPlans[];
167
- }
168
- interface TaxSettings {
169
- /**
170
- * Whether you must display the total price including taxes in the given
171
- * country.
172
- */
173
- showPriceWithTax?: boolean;
174
- /**
175
- * Tax rate for the given country as percentage. Returned as `0` when
176
- * `{"showPriceWithTax": false}`.
177
- */
178
- percentage?: string | null;
179
- /**
180
- * Type of tax required in the given country.
181
- *
182
- * + `"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.
183
- * + `"VAT"`: The given country requires that you display the total price including [value-added tax (VAT)](https://en.wikipedia.org/wiki/Value-added_tax).
184
- * + `"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).
185
- */
186
- taxType?: TaxType;
187
- }
188
- declare enum TaxType {
189
- NOT_APPLICABLE = "NOT_APPLICABLE",
190
- VAT = "VAT",
191
- GST = "GST"
192
- }
193
- interface ListAppPlansByAppIdResponseNonNullableFields {
194
- taxSettings?: {
195
- showPriceWithTax: boolean;
196
- taxType: TaxType;
197
- };
198
- currency: string;
199
- currencySymbol: string;
200
- appPlans: {
201
- _id: string;
202
- plans: {
203
- _id: string;
204
- vendorId: string;
205
- name: string;
206
- benefits: string[];
207
- prices: {
208
- priceBeforeTax: string;
209
- totalPrice: string;
210
- billingCycle?: {
211
- cycleType: CycleType;
212
- cycleDuration?: {
213
- unit: DurationUnit;
214
- count: number;
215
- };
216
- };
217
- }[];
218
- }[];
219
- }[];
220
- }
221
-
222
1
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
223
2
  interface HttpClient {
224
3
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
225
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
4
+ fetchWithAuth: typeof fetch;
5
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
226
6
  }
227
7
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
228
8
  type HttpResponse<T = any> = {
@@ -262,407 +42,25 @@ declare global {
262
42
  }
263
43
  }
264
44
 
265
- declare function listAppPlansByAppId$1(httpClient: HttpClient): (appIds: string[]) => Promise<ListAppPlansByAppIdResponse & ListAppPlansByAppIdResponseNonNullableFields>;
45
+ declare function createRESTModule$4<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
266
46
 
267
- declare const listAppPlansByAppId: BuildRESTFunction<typeof listAppPlansByAppId$1>;
47
+ declare const listAppPlansByAppId: ReturnType<typeof createRESTModule$4<typeof publicListAppPlansByAppId>>;
268
48
 
269
49
  declare const context$4_listAppPlansByAppId: typeof listAppPlansByAppId;
270
50
  declare namespace context$4 {
271
51
  export { context$4_listAppPlansByAppId as listAppPlansByAppId };
272
52
  }
273
53
 
274
- /**
275
- * An app instance is a specific occurrence of your app on a particular Wix site.
276
- * When a site owner installs your app, a unique instance is generated for that
277
- * specific site. Use the `instanceId` to keep track of the individual data
278
- * associated with each app instance.
279
- */
280
- interface AppInstance {
281
- /**
282
- * ID of the app instance. You can use it to keep track of the individual
283
- * data that's associated with the specific occurence of your app that's
284
- * installed on a Wix site.
285
- */
286
- instanceId?: string;
287
- /**
288
- * App name, as set by you in the Wix Developers Center during the app creation
289
- * process.
290
- */
291
- appName?: string;
292
- /**
293
- * Version of your app that's installed on the Wix site, as set by you in the
294
- * Wix Developers Center during the app creation process.
295
- */
296
- appVersion?: string | null;
297
- /**
298
- * Whether the site owners have installed a free or paid version of your app
299
- * on their site.
300
- */
301
- isFree?: boolean;
302
- /**
303
- * Billing information for the app instance. Available only in case
304
- * `{"isFree": false}`.
305
- */
306
- billing?: BillingInfo;
307
- /**
308
- * List of [permissions](https://dev.wix.com/docs/build-apps/developer-tools/developers-center/example-app-walkthrough/build-an-app#4-add-permissions)
309
- * that the site owners have granted your app. You set the list of permissions that
310
- * your app requires from the site owners in the Wix Developers Center during the
311
- * app creation process.
312
- */
313
- permissions?: string[];
314
- /** Plans available to this app instance. */
315
- availablePlans?: AvailablePlan[];
316
- /**
317
- * ID of the Wix site from which the instance of your app has been cloned.
318
- * Available only in case `{"copiedFromTemplate": true}`.
319
- * All visual settings of the Wix site and app data are duplicated during the
320
- * cloning process. Wix also notifies you in case there is any additional
321
- * external functionality for the original site.
322
- */
323
- originInstanceId?: string | null;
324
- /**
325
- * __Deprecated__. This parameter will be removed on March 30, 2023. Use
326
- * `copiedFromTemplate` instead.
327
- * @deprecated
328
- */
329
- isOriginSiteTemplate?: boolean;
330
- /** Whether the app instance was created when another Wix site was cloned. */
331
- copiedFromTemplate?: boolean;
332
- /** Whether the app instance includes a free trial that hasn't started yet. */
333
- freeTrialAvailable?: boolean;
334
- }
335
- interface BillingInfo {
336
- /** Name of the package that the site owner has paid for. */
337
- packageName?: string;
338
- /**
339
- * Interval of the billing cycle. `"ONE_TIME"` means that site owners have
340
- * purchased unlimited access to the app with a single, upfront payment.
341
- */
342
- billingCycle?: PaymentCycle$1;
343
- /**
344
- * Date and time the site owners have purchased the app's paid plan in
345
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
346
- */
347
- timeStamp?: string;
348
- /**
349
- * Date and time the app's current billing cycle ends in
350
- * `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for yearly and
351
- * multi-yearly plans.
352
- */
353
- expirationDate?: string | null;
354
- /**
355
- * Whether the app's subscription automatically renews at the end of the
356
- * current billing cycle.
357
- */
358
- autoRenewing?: boolean | null;
359
- /** ID of the invoice for the current billing cycle. */
360
- invoiceId?: string | null;
361
- /**
362
- * Information about any discounts applied to the app instance's current billing cycle.
363
- * If the site owners applied a developer coupon or Wix Voucher
364
- * when installing the paid version of your app, this field holds the coupon's
365
- * name or `“Wix discount coupon”`. Site owners may receive a Wix Voucher when
366
- * upgrading their Wix subscription. If there is no discount for the
367
- * current billing cycle, the field is an empty string.
368
- */
369
- source?: string | null;
370
- /** Information about the free trial applied, if relevant. */
371
- freeTrialInfo?: FreeTrialInfo;
372
- }
373
- declare enum PaymentCycle$1 {
374
- NO_CYCLE = "NO_CYCLE",
375
- MONTHLY = "MONTHLY",
376
- YEARLY = "YEARLY",
377
- ONE_TIME = "ONE_TIME",
378
- TWO_YEARS = "TWO_YEARS",
379
- THREE_YEARS = "THREE_YEARS",
380
- FOUR_YEARS = "FOUR_YEARS",
381
- FIVE_YEARS = "FIVE_YEARS"
382
- }
383
- interface FreeTrialInfo {
384
- /**
385
- * Current free trial status.
386
- *
387
- * Supported values:
388
- *
389
- * - `IN_PROGRESS`: The free trial is currently in progress.
390
- * - `ENDED`: The free trial has ended.
391
- * - `NOT_AVAILABLE`: No free trial was applied, as none was available.
392
- * @readonly
393
- */
394
- status?: FreeTrialStatus;
395
- /**
396
- * When the free trial has ended. Populated only once the free trial is over.
397
- * @readonly
398
- */
399
- endDate?: Date;
400
- }
401
- declare enum FreeTrialStatus {
402
- UNKNOWN_STATUS = "UNKNOWN_STATUS",
403
- IN_PROGRESS = "IN_PROGRESS",
404
- ENDED = "ENDED",
405
- NOT_AVAILABLE = "NOT_AVAILABLE"
406
- }
407
- interface AvailablePlan {
408
- /** Package name of the available plan. */
409
- packageName?: string;
410
- /** Source of the available plan. Can be a bundle or 3rd-party app. */
411
- source?: string;
412
- }
413
- interface AppInstalled {
414
- /** Unique identifier of the app within the website. */
415
- appId?: string;
416
- /** 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)). */
417
- originInstanceId?: string | null;
418
- }
419
- interface AppRemoved {
420
- /** Unique identifier of the app within the website. */
421
- appId?: string;
422
- }
423
- interface PaidPlanPurchased {
424
- /** Date and time of purchase. */
425
- operationTimeStamp?: Date;
426
- /** Purchased app plan. */
427
- vendorProductId?: string;
428
- /** Selected payment cycle. */
429
- cycle?: PaymentCycle$1;
430
- /** Plan expiration date. */
431
- expiresOn?: Date;
432
- /** Coupon applied to purchase (if relevant). */
433
- couponName?: string | null;
434
- /** Invoice ID. */
435
- invoiceId?: string | null;
436
- }
437
- interface PaidPlanChanged {
438
- /** Date and time of change. */
439
- operationTimeStamp?: Date;
440
- /** Newly purchased app plan. */
441
- vendorProductId?: string;
442
- /** Newly selected payment cycle. */
443
- cycle?: PaymentCycle$1;
444
- /** Previous app plan. */
445
- previousVendorProductId?: string | null;
446
- /** Previous payment cycle. */
447
- previousCycle?: PaymentCycle$1;
448
- /** Coupon applied to purchase (if relevant). */
449
- couponName?: string | null;
450
- /** Invoice ID. */
451
- invoiceId?: string | null;
452
- }
453
- interface PaidPlanAutoRenewalCancelled {
454
- /** Date and time of auto-renewal cancellation. */
455
- operationTimeStamp?: Date;
456
- /** Current app plan. */
457
- vendorProductId?: string;
458
- /** Current payment cycle. */
459
- cycle?: PaymentCycle$1;
460
- /** Supported values: `UNKNOWN_CANCELLATION_TYPE_ERROR_STATE`, `USER_CANCEL`, `FAILED_PAYMENT`, `TRANSFER_CANCELLATION_REASON`. Reason provided by app for cancellation (if relevant). */
461
- cancelReason?: string | null;
462
- /** Reason provided by site owner for cancellation (if relevant). */
463
- userReason?: string | null;
464
- /** Cancellation type. */
465
- subscriptionCancellationType?: string | null;
466
- }
467
- interface GetAppInstanceResponse {
468
- /** Retrieved app instance. */
469
- instance?: AppInstance;
470
- /** Information about the corresponding Wix site. */
471
- site?: SiteInfo;
472
- }
473
- interface SiteInfo {
474
- /** Display name of the site. */
475
- siteDisplayName?: string | null;
476
- /**
477
- * 2-letter language code of the site's locale in
478
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
479
- */
480
- locale?: string;
481
- /**
482
- * 3-letter currency code for the site's billing in
483
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
484
- */
485
- paymentCurrency?: string;
486
- /** Information about the site's supported languages. */
487
- multilingual?: Multilingual;
488
- /** URL of the site. Available only in case the site has been published. */
489
- url?: string | null;
490
- /** Description of the site. */
491
- description?: string | null;
492
- /** Wix apps that are installed on the site. */
493
- installedWixApps?: string[];
494
- /**
495
- * > **Deprecation Notice:** This parameter will be removed on June 30, 2022. Use `ownerInfo` instead.
496
- * @deprecated
497
- */
498
- ownerEmail?: string | null;
499
- /**
500
- * Information about the site owner. Available only when calling
501
- * _Get App Instance_ with the __Read Site Owner Email__ permission scope.
502
- */
503
- ownerInfo?: OwnerInfo;
504
- /** Site ID. */
505
- siteId?: string;
506
- }
507
- interface Multilingual {
508
- /** Whether the site supports more than a single language. */
509
- isMultiLingual?: boolean;
510
- /** List of supported languages. Returned only when `{"isMultiLingual": true}`. */
511
- supportedLanguages?: SupportedLanguage[];
512
- }
513
- interface SupportedLanguage {
514
- /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
515
- languageCode?: string;
516
- /** Locale. */
517
- locale?: Locale;
518
- /** Whether the supported language is the primary language for the site. */
519
- isPrimary?: boolean;
520
- /** Language icon. */
521
- countryCode?: string;
522
- /** How the language will be resolved. For internal use. */
523
- resolutionMethod?: ResolutionMethod;
524
- }
525
- interface Locale {
526
- /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
527
- languageCode?: string;
528
- /** Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. */
529
- country?: string;
530
- }
531
- declare enum ResolutionMethod {
532
- QUERY_PARAM = "QUERY_PARAM",
533
- SUBDOMAIN = "SUBDOMAIN",
534
- SUBDIRECTORY = "SUBDIRECTORY"
535
- }
536
- interface OwnerInfo {
537
- /** Site owner's email address. Identical to the site owner's login email. */
538
- email?: string;
539
- /**
540
- * Supported values: `VERIFIED_OPT_IN`, `VERIFIED_OPT_OUT`,
541
- * `NOT_VERIFIED_OPT_IN`, `NOT_VERIFIED_OPT_OUT`.
542
- *
543
- * Whether the site owner has verified their email and whether they have chosen
544
- * to receive email notifications from Wix.
545
- */
546
- emailStatus?: string;
547
- }
548
- interface IdentificationData extends IdentificationDataIdOneOf {
549
- /** ID of a site visitor that has not logged in to the site. */
550
- anonymousVisitorId?: string;
551
- /** ID of a site visitor that has logged in to the site. */
552
- memberId?: string;
553
- /** ID of a Wix user (site owner, contributor, etc.). */
554
- wixUserId?: string;
555
- /** ID of an app. */
556
- appId?: string;
557
- /** @readonly */
558
- identityType?: WebhookIdentityType;
559
- }
560
- /** @oneof */
561
- interface IdentificationDataIdOneOf {
562
- /** ID of a site visitor that has not logged in to the site. */
563
- anonymousVisitorId?: string;
564
- /** ID of a site visitor that has logged in to the site. */
565
- memberId?: string;
566
- /** ID of a Wix user (site owner, contributor, etc.). */
567
- wixUserId?: string;
568
- /** ID of an app. */
569
- appId?: string;
570
- }
571
- declare enum WebhookIdentityType {
572
- UNKNOWN = "UNKNOWN",
573
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
574
- MEMBER = "MEMBER",
575
- WIX_USER = "WIX_USER",
576
- APP = "APP"
577
- }
578
- interface GetAppInstanceResponseNonNullableFields {
579
- instance?: {
580
- instanceId: string;
581
- appName: string;
582
- isFree: boolean;
583
- billing?: {
584
- packageName: string;
585
- billingCycle: PaymentCycle$1;
586
- timeStamp: string;
587
- freeTrialInfo?: {
588
- status: FreeTrialStatus;
589
- };
590
- };
591
- permissions: string[];
592
- availablePlans: {
593
- packageName: string;
594
- source: string;
595
- }[];
596
- isOriginSiteTemplate: boolean;
597
- copiedFromTemplate: boolean;
598
- freeTrialAvailable: boolean;
599
- };
600
- site?: {
601
- locale: string;
602
- paymentCurrency: string;
603
- multilingual?: {
604
- isMultiLingual: boolean;
605
- supportedLanguages: {
606
- languageCode: string;
607
- locale?: {
608
- languageCode: string;
609
- country: string;
610
- };
611
- isPrimary: boolean;
612
- countryCode: string;
613
- resolutionMethod: ResolutionMethod;
614
- }[];
615
- };
616
- installedWixApps: string[];
617
- ownerInfo?: {
618
- email: string;
619
- emailStatus: string;
620
- };
621
- siteId: string;
622
- };
623
- }
624
- interface BaseEventMetadata {
625
- /** App instance ID. */
626
- instanceId?: string | null;
627
- /** Event type. */
628
- eventType?: string;
629
- /** The identification type and identity data. */
630
- identity?: IdentificationData;
631
- }
632
- interface AppInstanceInstalledEnvelope {
633
- data: AppInstalled;
634
- metadata: BaseEventMetadata;
635
- }
636
- interface AppInstanceRemovedEnvelope {
637
- data: AppRemoved;
638
- metadata: BaseEventMetadata;
639
- }
640
- interface AppInstancePaidPlanPurchasedEnvelope {
641
- data: PaidPlanPurchased;
642
- metadata: BaseEventMetadata;
643
- }
644
- interface AppInstancePaidPlanChangedEnvelope {
645
- data: PaidPlanChanged;
646
- metadata: BaseEventMetadata;
647
- }
648
- interface AppInstancePaidPlanAutoRenewalCancelledEnvelope {
649
- data: PaidPlanAutoRenewalCancelled;
650
- metadata: BaseEventMetadata;
651
- }
54
+ declare function createRESTModule$3<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
652
55
 
653
- declare function getAppInstance$1(httpClient: HttpClient): () => Promise<GetAppInstanceResponse & GetAppInstanceResponseNonNullableFields>;
654
- declare const onAppInstanceInstalled$1: EventDefinition<AppInstanceInstalledEnvelope, "AppInstalled">;
655
- declare const onAppInstanceRemoved$1: EventDefinition<AppInstanceRemovedEnvelope, "AppRemoved">;
656
- declare const onAppInstancePaidPlanPurchased$1: EventDefinition<AppInstancePaidPlanPurchasedEnvelope, "PaidPlanPurchased">;
657
- declare const onAppInstancePaidPlanChanged$1: EventDefinition<AppInstancePaidPlanChangedEnvelope, "PaidPlanChanged">;
658
- declare const onAppInstancePaidPlanAutoRenewalCancelled$1: EventDefinition<AppInstancePaidPlanAutoRenewalCancelledEnvelope, "PaidPlanAutoRenewalCancelled">;
56
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
659
57
 
660
- declare const getAppInstance: BuildRESTFunction<typeof getAppInstance$1>;
661
- declare const onAppInstanceInstalled: BuildEventDefinition<typeof onAppInstanceInstalled$1>;
662
- declare const onAppInstanceRemoved: BuildEventDefinition<typeof onAppInstanceRemoved$1>;
663
- declare const onAppInstancePaidPlanPurchased: BuildEventDefinition<typeof onAppInstancePaidPlanPurchased$1>;
664
- declare const onAppInstancePaidPlanChanged: BuildEventDefinition<typeof onAppInstancePaidPlanChanged$1>;
665
- declare const onAppInstancePaidPlanAutoRenewalCancelled: BuildEventDefinition<typeof onAppInstancePaidPlanAutoRenewalCancelled$1>;
58
+ declare const getAppInstance: ReturnType<typeof createRESTModule$3<typeof publicGetAppInstance>>;
59
+ declare const onAppInstanceInstalled: ReturnType<typeof createEventModule<typeof publicOnAppInstanceInstalled>>;
60
+ declare const onAppInstanceRemoved: ReturnType<typeof createEventModule<typeof publicOnAppInstanceRemoved>>;
61
+ declare const onAppInstancePaidPlanPurchased: ReturnType<typeof createEventModule<typeof publicOnAppInstancePaidPlanPurchased>>;
62
+ declare const onAppInstancePaidPlanChanged: ReturnType<typeof createEventModule<typeof publicOnAppInstancePaidPlanChanged>>;
63
+ declare const onAppInstancePaidPlanAutoRenewalCancelled: ReturnType<typeof createEventModule<typeof publicOnAppInstancePaidPlanAutoRenewalCancelled>>;
666
64
 
667
65
  declare const context$3_getAppInstance: typeof getAppInstance;
668
66
  declare const context$3_onAppInstanceInstalled: typeof onAppInstanceInstalled;
@@ -674,156 +72,19 @@ declare namespace context$3 {
674
72
  export { 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 };
675
73
  }
676
74
 
677
- declare enum EventName {
678
- UNKNOWN = "UNKNOWN",
679
- APP_DASHBOARD_LOADED = "APP_DASHBOARD_LOADED",
680
- APP_FINISHED_CONFIGURATION = "APP_FINISHED_CONFIGURATION",
681
- APP_UPGRADED = "APP_UPGRADED",
682
- PRIMARY_ACTION_PERFORMED = "PRIMARY_ACTION_PERFORMED",
683
- CUSTOM = "CUSTOM",
684
- CHARGE = "CHARGE",
685
- FUNDS_RETURNED = "FUNDS_RETURNED",
686
- APP_FINISH_BUSINESS_SETUP = "APP_FINISH_BUSINESS_SETUP",
687
- APP_DEPLOYED = "APP_DEPLOYED",
688
- APP_SETUP_FINISHED = "APP_SETUP_FINISHED"
689
- }
690
- interface SendBiEventOptions {
691
- /**
692
- * Name of the event that's triggered in your app.
693
- *
694
- * + `"APP_DASHBOARD_LOADED"`: A site onwer or contributor loads your app's dashboard.
695
- * + `"APP_FINISHED_CONFIGURATION"`: The site owner completes all required configurations for your app in the Wix Developers Center.
696
- * + `"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.
697
- * + `"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.
698
- * + `"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`.
699
- * + `"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"}}`.
700
- * + `"CUSTOM"`: Any event that's not listed here. Make sure to also send `customEventName`.
701
- * + `"APP_DEPLOYED"`: Your app’s internal code implementation is changed and might affect user flows or cause a regression.
702
- * + `"APP_FINISH_BUSINESS_SETUP"`: __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead.
703
- * + `"APP_SETUP_FINISHED"`: The site owner completes your app's required business setup.
704
- */
705
- eventName?: EventName;
706
- /**
707
- * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
708
- *
709
- * Min: 2 characters
710
- */
711
- customEventName?: string | null;
712
- /**
713
- * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
714
- * You may also submit data with keys that aren't listed here.
715
- *
716
- * Additional data about your app's event.
717
- *
718
- * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
719
- * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
720
- * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
721
- * + `"reason"`: Information about why the event was triggered in your app.
722
- * + `"app_plan_id"`: ID of the your app's plan as displayed in the Developers Center. 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).
723
- */
724
- eventData?: Record<string, string>;
725
- }
726
-
727
- declare function sendBiEvent$1(httpClient: HttpClient): (options?: SendBiEventOptions) => Promise<void>;
75
+ declare function createRESTModule$2<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
728
76
 
729
- declare const sendBiEvent: BuildRESTFunction<typeof sendBiEvent$1>;
77
+ declare const sendBiEvent: ReturnType<typeof createRESTModule$2<typeof publicSendBiEvent>>;
730
78
 
731
79
  declare const context$2_sendBiEvent: typeof sendBiEvent;
732
80
  declare namespace context$2 {
733
81
  export { context$2_sendBiEvent as sendBiEvent };
734
82
  }
735
83
 
736
- interface PurchasedItem {
737
- /** ID of your app's paid plan. */
738
- productId?: string;
739
- /** Price of your app's paid plan. For example, `9.95`. */
740
- price?: string;
741
- /**
742
- * 3-letter currency code in
743
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
744
- */
745
- currency?: string;
746
- /** Information about the billing cycle for your app's paid plan. */
747
- billingCycle?: PaymentCycle;
748
- /**
749
- * Date and time the site onwers have purchased your app's paid plan in
750
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
751
- */
752
- dateCreated?: Date;
753
- }
754
- declare enum PaymentCycle {
755
- NO_CYCLE = "NO_CYCLE",
756
- MONTHLY = "MONTHLY",
757
- YEARLY = "YEARLY",
758
- ONE_TIME = "ONE_TIME",
759
- TWO_YEARS = "TWO_YEARS",
760
- THREE_YEARS = "THREE_YEARS",
761
- FOUR_YEARS = "FOUR_YEARS",
762
- FIVE_YEARS = "FIVE_YEARS"
763
- }
764
- interface GetUrlResponse {
765
- /** URL for the Wix checkout page. */
766
- checkoutUrl?: string;
767
- /**
768
- * Token for the Wix checkout page. The token holds all data about the order
769
- * you're creating a checkout for. It is [signed](),
770
- * so you can verify that it comes from Wix.
771
- */
772
- token?: string | null;
773
- }
774
- interface GetPurchaseHistoryResponse {
775
- /** Retrieved purchases the site owners have completed for you app. */
776
- purchases?: PurchasedItem[];
777
- }
778
- interface GetUrlResponseNonNullableFields {
779
- checkoutUrl: string;
780
- }
781
- interface GetPurchaseHistoryResponseNonNullableFields {
782
- purchases: {
783
- productId: string;
784
- price: string;
785
- currency: string;
786
- billingCycle: PaymentCycle;
787
- }[];
788
- }
789
- interface GetUrlOptions {
790
- /**
791
- * URL for the Wix checkout page. Redirect site owners to this URL after
792
- * they've successfully purchased a paid plan for your app.
793
- */
794
- successUrl?: string | null;
795
- /**
796
- * Whether the checkout is for testing purposes only. Testing is mainly
797
- * relevant for in-app purchase flows. When `true`, Wix charges the site
798
- * owners an amount of `0.00`.
799
- */
800
- testCheckout?: boolean;
801
- /** Information about the paid plan's billing cycle. */
802
- billingCycle?: PaymentCycle;
803
- /**
804
- * 2-letter country code in
805
- * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
806
- * format.
807
- *
808
- * Default: `"US"`
809
- */
810
- countryCode?: string | null;
811
- /**
812
- * 2-letter language code in
813
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
814
- *
815
- * Default: `"EN"`
816
- */
817
- languageCode?: string | null;
818
- /** Coupon code for the paid plan. Available only in case there is a discount. */
819
- couponCode?: string | null;
820
- }
84
+ declare function createRESTModule$1<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
821
85
 
822
- declare function getUrl$1(httpClient: HttpClient): (productId: string, options?: GetUrlOptions) => Promise<GetUrlResponse & GetUrlResponseNonNullableFields>;
823
- declare function getPurchaseHistory$1(httpClient: HttpClient): () => Promise<GetPurchaseHistoryResponse & GetPurchaseHistoryResponseNonNullableFields>;
824
-
825
- declare const getUrl: BuildRESTFunction<typeof getUrl$1>;
826
- declare const getPurchaseHistory: BuildRESTFunction<typeof getPurchaseHistory$1>;
86
+ declare const getUrl: ReturnType<typeof createRESTModule$1<typeof publicGetUrl>>;
87
+ declare const getPurchaseHistory: ReturnType<typeof createRESTModule$1<typeof publicGetPurchaseHistory>>;
827
88
 
828
89
  declare const context$1_getPurchaseHistory: typeof getPurchaseHistory;
829
90
  declare const context$1_getUrl: typeof getUrl;
@@ -831,38 +92,10 @@ declare namespace context$1 {
831
92
  export { context$1_getPurchaseHistory as getPurchaseHistory, context$1_getUrl as getUrl };
832
93
  }
833
94
 
834
- /** Embedded script data */
835
- interface ScriptProperties {
836
- /** Script parameters */
837
- parameters?: Record<string, string>;
838
- /** Whether script is disabled or not, defaults to false (not disabled) */
839
- disabled?: boolean;
840
- }
841
- interface EmbedScriptResponse {
842
- /** Details of the embedded script. */
843
- properties?: ScriptProperties;
844
- }
845
- interface EmbedScriptResponseNonNullableFields {
846
- properties?: {
847
- disabled: boolean;
848
- };
849
- }
850
- interface EmbedScriptOptions {
851
- /** ID of the corresponding embedded script component. */
852
- componentId?: string | null;
853
- }
854
- interface GetEmbeddedScriptOptions {
855
- /** Component ID of the embedded script to retrieve. */
856
- componentId?: string | null;
857
- }
858
-
859
- declare function embedScript$1(httpClient: HttpClient): (properties: ScriptProperties, options?: EmbedScriptOptions) => Promise<EmbedScriptResponse & EmbedScriptResponseNonNullableFields>;
860
- declare function getEmbeddedScript$1(httpClient: HttpClient): (options?: GetEmbeddedScriptOptions) => Promise<ScriptProperties & {
861
- disabled: boolean;
862
- }>;
95
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
863
96
 
864
- declare const embedScript: BuildRESTFunction<typeof embedScript$1>;
865
- declare const getEmbeddedScript: BuildRESTFunction<typeof getEmbeddedScript$1>;
97
+ declare const embedScript: ReturnType<typeof createRESTModule<typeof publicEmbedScript>>;
98
+ declare const getEmbeddedScript: ReturnType<typeof createRESTModule<typeof publicGetEmbeddedScript>>;
866
99
 
867
100
  declare const context_embedScript: typeof embedScript;
868
101
  declare const context_getEmbeddedScript: typeof getEmbeddedScript;
@@ -230,7 +230,8 @@ interface ListAppPlansByAppIdResponseNonNullableFields {
230
230
 
231
231
  interface HttpClient {
232
232
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
233
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
233
+ fetchWithAuth: typeof fetch;
234
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
234
235
  }
235
236
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
236
237
  type HttpResponse<T = any> = {
@@ -298,35 +298,9 @@ declare global {
298
298
  }
299
299
  }
300
300
 
301
- interface GetChargeLimitEnvelope {
302
- request: GetChargeLimitRequest;
303
- metadata: Context;
304
- }
305
- interface ListChargesEnvelope {
306
- request: ListChargesRequest;
307
- metadata: Context;
308
- }
309
- interface ChargesRejectedEventEnvelope {
310
- request: ChargesRejectedRequest;
311
- metadata: Context;
312
- }
313
- interface InvoiceCreatedEventEnvelope {
314
- request: InvoiceCreatedRequest;
315
- metadata: Context;
316
- }
317
- interface ChargeLimitUpdatedEventEnvelope {
318
- request: ChargeLimitUpdatedRequest;
319
- metadata: Context;
320
- }
321
- declare const provideHandlers$1: ServicePluginDefinition<{
322
- getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
323
- listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
324
- chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
325
- invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
326
- chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
327
- }>;
301
+ declare function createServicePluginModule<T extends ServicePluginDefinition<any>>(servicePluginDefinition: T): BuildServicePluginDefinition<T> & T;
328
302
 
329
- declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1>;
303
+ declare const provideHandlers: ReturnType<typeof createServicePluginModule<typeof publicProvideHandlers>>;
330
304
 
331
305
  type context_AlternativeUri = AlternativeUri;
332
306
  type context_ChargeLimitUpdatedRequest = ChargeLimitUpdatedRequest;