@wix/app-management 1.0.20 → 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.20",
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": "f0f955ac8e896531b8cea739edeb81cdb8b61a576443933a3de44add"
51
+ "falconPackageHash": "92d82785d051537964c94876233fcc6ab069b7f94e686627793308e0"
52
52
  }
@@ -1,670 +1,29 @@
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
- type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
223
- interface HttpClient$4 {
224
- request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
225
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
226
- }
227
- type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
228
- type HttpResponse$4<T = any> = {
229
- data: T;
230
- status: number;
231
- statusText: string;
232
- headers: any;
233
- request?: any;
234
- };
235
- type RequestOptions$4<_TResponse = any, Data = any> = {
236
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
237
- url: string;
238
- data?: Data;
239
- params?: URLSearchParams;
240
- } & APIMetadata$4;
241
- type APIMetadata$4 = {
242
- methodFqn?: string;
243
- entityFqdn?: string;
244
- packageName?: string;
245
- };
246
- type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
247
-
248
- declare global {
249
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
250
- interface SymbolConstructor {
251
- readonly observable: symbol;
252
- }
253
- }
254
-
255
- declare function listAppPlansByAppId$1(httpClient: HttpClient$4): (appIds: string[]) => Promise<ListAppPlansByAppIdResponse & ListAppPlansByAppIdResponseNonNullableFields>;
256
-
257
- declare const listAppPlansByAppId: BuildRESTFunction$4<typeof listAppPlansByAppId$1>;
258
-
259
- declare const context$4_listAppPlansByAppId: typeof listAppPlansByAppId;
260
- declare namespace context$4 {
261
- export { context$4_listAppPlansByAppId as listAppPlansByAppId };
262
- }
263
-
264
- /**
265
- * An app instance is a specific occurrence of your app on a particular Wix site.
266
- * When a site owner installs your app, a unique instance is generated for that
267
- * specific site. Use the `instanceId` to keep track of the individual data
268
- * associated with each app instance.
269
- */
270
- interface AppInstance {
271
- /**
272
- * ID of the app instance. You can use it to keep track of the individual
273
- * data that's associated with the specific occurence of your app that's
274
- * installed on a Wix site.
275
- */
276
- instanceId?: string;
277
- /**
278
- * App name, as set by you in the Wix Developers Center during the app creation
279
- * process.
280
- */
281
- appName?: string;
282
- /**
283
- * Version of your app that's installed on the Wix site, as set by you in the
284
- * Wix Developers Center during the app creation process.
285
- */
286
- appVersion?: string | null;
287
- /**
288
- * Whether the site owners have installed a free or paid version of your app
289
- * on their site.
290
- */
291
- isFree?: boolean;
292
- /**
293
- * Billing information for the app instance. Available only in case
294
- * `{"isFree": false}`.
295
- */
296
- billing?: BillingInfo;
297
- /**
298
- * List of [permissions](https://dev.wix.com/docs/build-apps/developer-tools/developers-center/example-app-walkthrough/build-an-app#4-add-permissions)
299
- * that the site owners have granted your app. You set the list of permissions that
300
- * your app requires from the site owners in the Wix Developers Center during the
301
- * app creation process.
302
- */
303
- permissions?: string[];
304
- /** Plans available to this app instance. */
305
- availablePlans?: AvailablePlan[];
306
- /**
307
- * ID of the Wix site from which the instance of your app has been cloned.
308
- * Available only in case `{"copiedFromTemplate": true}`.
309
- * All visual settings of the Wix site and app data are duplicated during the
310
- * cloning process. Wix also notifies you in case there is any additional
311
- * external functionality for the original site.
312
- */
313
- originInstanceId?: string | null;
314
- /**
315
- * __Deprecated__. This parameter will be removed on March 30, 2023. Use
316
- * `copiedFromTemplate` instead.
317
- * @deprecated
318
- */
319
- isOriginSiteTemplate?: boolean;
320
- /** Whether the app instance was created when another Wix site was cloned. */
321
- copiedFromTemplate?: boolean;
322
- /** Whether the app instance includes a free trial that hasn't started yet. */
323
- freeTrialAvailable?: boolean;
324
- }
325
- interface BillingInfo {
326
- /** Name of the package that the site owner has paid for. */
327
- packageName?: string;
328
- /**
329
- * Interval of the billing cycle. `"ONE_TIME"` means that site owners have
330
- * purchased unlimited access to the app with a single, upfront payment.
331
- */
332
- billingCycle?: PaymentCycle$1;
333
- /**
334
- * Date and time the site owners have purchased the app's paid plan in
335
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
336
- */
337
- timeStamp?: string;
338
- /**
339
- * Date and time the app's current billing cycle ends in
340
- * `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for yearly and
341
- * multi-yearly plans.
342
- */
343
- expirationDate?: string | null;
344
- /**
345
- * Whether the app's subscription automatically renews at the end of the
346
- * current billing cycle.
347
- */
348
- autoRenewing?: boolean | null;
349
- /** ID of the invoice for the current billing cycle. */
350
- invoiceId?: string | null;
351
- /**
352
- * Information about any discounts applied to the app instance's current billing cycle.
353
- * If the site owners applied a developer coupon or Wix Voucher
354
- * when installing the paid version of your app, this field holds the coupon's
355
- * name or `“Wix discount coupon”`. Site owners may receive a Wix Voucher when
356
- * upgrading their Wix subscription. If there is no discount for the
357
- * current billing cycle, the field is an empty string.
358
- */
359
- source?: string | null;
360
- /** Information about the free trial applied, if relevant. */
361
- freeTrialInfo?: FreeTrialInfo;
362
- }
363
- declare enum PaymentCycle$1 {
364
- NO_CYCLE = "NO_CYCLE",
365
- MONTHLY = "MONTHLY",
366
- YEARLY = "YEARLY",
367
- ONE_TIME = "ONE_TIME",
368
- TWO_YEARS = "TWO_YEARS",
369
- THREE_YEARS = "THREE_YEARS",
370
- FOUR_YEARS = "FOUR_YEARS",
371
- FIVE_YEARS = "FIVE_YEARS"
372
- }
373
- interface FreeTrialInfo {
374
- /**
375
- * Current free trial status.
376
- *
377
- * Supported values:
378
- *
379
- * - `IN_PROGRESS`: The free trial is currently in progress.
380
- * - `ENDED`: The free trial has ended.
381
- * - `NOT_AVAILABLE`: No free trial was applied, as none was available.
382
- * @readonly
383
- */
384
- status?: FreeTrialStatus;
385
- /**
386
- * When the free trial has ended. Populated only once the free trial is over.
387
- * @readonly
388
- */
389
- endDate?: Date;
390
- }
391
- declare enum FreeTrialStatus {
392
- UNKNOWN_STATUS = "UNKNOWN_STATUS",
393
- IN_PROGRESS = "IN_PROGRESS",
394
- ENDED = "ENDED",
395
- NOT_AVAILABLE = "NOT_AVAILABLE"
396
- }
397
- interface AvailablePlan {
398
- /** Package name of the available plan. */
399
- packageName?: string;
400
- /** Source of the available plan. Can be a bundle or 3rd-party app. */
401
- source?: string;
402
- }
403
- interface AppInstalled {
404
- /** Unique identifier of the app within the website. */
405
- appId?: string;
406
- /** 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)). */
407
- originInstanceId?: string | null;
408
- }
409
- interface AppRemoved {
410
- /** Unique identifier of the app within the website. */
411
- appId?: string;
412
- }
413
- interface PaidPlanPurchased {
414
- /** Date and time of purchase. */
415
- operationTimeStamp?: Date;
416
- /** Purchased app plan. */
417
- vendorProductId?: string;
418
- /** Selected payment cycle. */
419
- cycle?: PaymentCycle$1;
420
- /** Plan expiration date. */
421
- expiresOn?: Date;
422
- /** Coupon applied to purchase (if relevant). */
423
- couponName?: string | null;
424
- /** Invoice ID. */
425
- invoiceId?: string | null;
426
- }
427
- interface PaidPlanChanged {
428
- /** Date and time of change. */
429
- operationTimeStamp?: Date;
430
- /** Newly purchased app plan. */
431
- vendorProductId?: string;
432
- /** Newly selected payment cycle. */
433
- cycle?: PaymentCycle$1;
434
- /** Previous app plan. */
435
- previousVendorProductId?: string | null;
436
- /** Previous payment cycle. */
437
- previousCycle?: PaymentCycle$1;
438
- /** Coupon applied to purchase (if relevant). */
439
- couponName?: string | null;
440
- /** Invoice ID. */
441
- invoiceId?: string | null;
442
- }
443
- interface PaidPlanAutoRenewalCancelled {
444
- /** Date and time of auto-renewal cancellation. */
445
- operationTimeStamp?: Date;
446
- /** Current app plan. */
447
- vendorProductId?: string;
448
- /** Current payment cycle. */
449
- cycle?: PaymentCycle$1;
450
- /** Supported values: `UNKNOWN_CANCELLATION_TYPE_ERROR_STATE`, `USER_CANCEL`, `FAILED_PAYMENT`, `TRANSFER_CANCELLATION_REASON`. Reason provided by app for cancellation (if relevant). */
451
- cancelReason?: string | null;
452
- /** Reason provided by site owner for cancellation (if relevant). */
453
- userReason?: string | null;
454
- /** Cancellation type. */
455
- subscriptionCancellationType?: string | null;
456
- }
457
- interface GetAppInstanceResponse {
458
- /** Retrieved app instance. */
459
- instance?: AppInstance;
460
- /** Information about the corresponding Wix site. */
461
- site?: SiteInfo;
462
- }
463
- interface SiteInfo {
464
- /** Display name of the site. */
465
- siteDisplayName?: string | null;
466
- /**
467
- * 2-letter language code of the site's locale in
468
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
469
- */
470
- locale?: string;
471
- /**
472
- * 3-letter currency code for the site's billing in
473
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
474
- */
475
- paymentCurrency?: string;
476
- /** Information about the site's supported languages. */
477
- multilingual?: Multilingual;
478
- /** URL of the site. Available only in case the site has been published. */
479
- url?: string | null;
480
- /** Description of the site. */
481
- description?: string | null;
482
- /** Wix apps that are installed on the site. */
483
- installedWixApps?: string[];
484
- /**
485
- * > **Deprecation Notice:** This parameter will be removed on June 30, 2022. Use `ownerInfo` instead.
486
- * @deprecated
487
- */
488
- ownerEmail?: string | null;
489
- /**
490
- * Information about the site owner. Available only when calling
491
- * _Get App Instance_ with the __Read Site Owner Email__ permission scope.
492
- */
493
- ownerInfo?: OwnerInfo;
494
- /** Site ID. */
495
- siteId?: string;
496
- }
497
- interface Multilingual {
498
- /** Whether the site supports more than a single language. */
499
- isMultiLingual?: boolean;
500
- /** List of supported languages. Returned only when `{"isMultiLingual": true}`. */
501
- supportedLanguages?: SupportedLanguage[];
502
- }
503
- interface SupportedLanguage {
504
- /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
505
- languageCode?: string;
506
- /** Locale. */
507
- locale?: Locale;
508
- /** Whether the supported language is the primary language for the site. */
509
- isPrimary?: boolean;
510
- /** Language icon. */
511
- countryCode?: string;
512
- /** How the language will be resolved. For internal use. */
513
- resolutionMethod?: ResolutionMethod;
514
- }
515
- interface Locale {
516
- /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */
517
- languageCode?: string;
518
- /** Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. */
519
- country?: string;
520
- }
521
- declare enum ResolutionMethod {
522
- QUERY_PARAM = "QUERY_PARAM",
523
- SUBDOMAIN = "SUBDOMAIN",
524
- SUBDIRECTORY = "SUBDIRECTORY"
525
- }
526
- interface OwnerInfo {
527
- /** Site owner's email address. Identical to the site owner's login email. */
528
- email?: string;
529
- /**
530
- * Supported values: `VERIFIED_OPT_IN`, `VERIFIED_OPT_OUT`,
531
- * `NOT_VERIFIED_OPT_IN`, `NOT_VERIFIED_OPT_OUT`.
532
- *
533
- * Whether the site owner has verified their email and whether they have chosen
534
- * to receive email notifications from Wix.
535
- */
536
- emailStatus?: string;
537
- }
538
- interface IdentificationData extends IdentificationDataIdOneOf {
539
- /** ID of a site visitor that has not logged in to the site. */
540
- anonymousVisitorId?: string;
541
- /** ID of a site visitor that has logged in to the site. */
542
- memberId?: string;
543
- /** ID of a Wix user (site owner, contributor, etc.). */
544
- wixUserId?: string;
545
- /** ID of an app. */
546
- appId?: string;
547
- /** @readonly */
548
- identityType?: WebhookIdentityType;
549
- }
550
- /** @oneof */
551
- interface IdentificationDataIdOneOf {
552
- /** ID of a site visitor that has not logged in to the site. */
553
- anonymousVisitorId?: string;
554
- /** ID of a site visitor that has logged in to the site. */
555
- memberId?: string;
556
- /** ID of a Wix user (site owner, contributor, etc.). */
557
- wixUserId?: string;
558
- /** ID of an app. */
559
- appId?: string;
560
- }
561
- declare enum WebhookIdentityType {
562
- UNKNOWN = "UNKNOWN",
563
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
564
- MEMBER = "MEMBER",
565
- WIX_USER = "WIX_USER",
566
- APP = "APP"
567
- }
568
- interface GetAppInstanceResponseNonNullableFields {
569
- instance?: {
570
- instanceId: string;
571
- appName: string;
572
- isFree: boolean;
573
- billing?: {
574
- packageName: string;
575
- billingCycle: PaymentCycle$1;
576
- timeStamp: string;
577
- freeTrialInfo?: {
578
- status: FreeTrialStatus;
579
- };
580
- };
581
- permissions: string[];
582
- availablePlans: {
583
- packageName: string;
584
- source: string;
585
- }[];
586
- isOriginSiteTemplate: boolean;
587
- copiedFromTemplate: boolean;
588
- freeTrialAvailable: boolean;
589
- };
590
- site?: {
591
- locale: string;
592
- paymentCurrency: string;
593
- multilingual?: {
594
- isMultiLingual: boolean;
595
- supportedLanguages: {
596
- languageCode: string;
597
- locale?: {
598
- languageCode: string;
599
- country: string;
600
- };
601
- isPrimary: boolean;
602
- countryCode: string;
603
- resolutionMethod: ResolutionMethod;
604
- }[];
605
- };
606
- installedWixApps: string[];
607
- ownerInfo?: {
608
- email: string;
609
- emailStatus: string;
610
- };
611
- siteId: string;
612
- };
613
- }
614
- interface BaseEventMetadata {
615
- /** App instance ID. */
616
- instanceId?: string | null;
617
- /** Event type. */
618
- eventType?: string;
619
- /** The identification type and identity data. */
620
- identity?: IdentificationData;
621
- }
622
- interface AppInstanceInstalledEnvelope {
623
- data: AppInstalled;
624
- metadata: BaseEventMetadata;
625
- }
626
- interface AppInstanceRemovedEnvelope {
627
- data: AppRemoved;
628
- metadata: BaseEventMetadata;
629
- }
630
- interface AppInstancePaidPlanPurchasedEnvelope {
631
- data: PaidPlanPurchased;
632
- metadata: BaseEventMetadata;
633
- }
634
- interface AppInstancePaidPlanChangedEnvelope {
635
- data: PaidPlanChanged;
636
- metadata: BaseEventMetadata;
637
- }
638
- interface AppInstancePaidPlanAutoRenewalCancelledEnvelope {
639
- data: PaidPlanAutoRenewalCancelled;
640
- metadata: BaseEventMetadata;
641
- }
642
-
643
- type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
644
- interface HttpClient$3 {
645
- request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
646
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
1
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
2
+ interface HttpClient {
3
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
4
+ fetchWithAuth: typeof fetch;
5
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
647
6
  }
648
- type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
649
- type HttpResponse$3<T = any> = {
7
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
8
+ type HttpResponse<T = any> = {
650
9
  data: T;
651
10
  status: number;
652
11
  statusText: string;
653
12
  headers: any;
654
13
  request?: any;
655
14
  };
656
- type RequestOptions$3<_TResponse = any, Data = any> = {
15
+ type RequestOptions<_TResponse = any, Data = any> = {
657
16
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
658
17
  url: string;
659
18
  data?: Data;
660
19
  params?: URLSearchParams;
661
- } & APIMetadata$3;
662
- type APIMetadata$3 = {
20
+ } & APIMetadata;
21
+ type APIMetadata = {
663
22
  methodFqn?: string;
664
23
  entityFqdn?: string;
665
24
  packageName?: string;
666
25
  };
667
- type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
26
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
668
27
  type EventDefinition<Payload = unknown, Type extends string = string> = {
669
28
  __type: 'event-definition';
670
29
  type: Type;
@@ -683,19 +42,25 @@ declare global {
683
42
  }
684
43
  }
685
44
 
686
- declare function getAppInstance$1(httpClient: HttpClient$3): () => Promise<GetAppInstanceResponse & GetAppInstanceResponseNonNullableFields>;
687
- declare const onAppInstanceInstalled$1: EventDefinition<AppInstanceInstalledEnvelope, "AppInstalled">;
688
- declare const onAppInstanceRemoved$1: EventDefinition<AppInstanceRemovedEnvelope, "AppRemoved">;
689
- declare const onAppInstancePaidPlanPurchased$1: EventDefinition<AppInstancePaidPlanPurchasedEnvelope, "PaidPlanPurchased">;
690
- declare const onAppInstancePaidPlanChanged$1: EventDefinition<AppInstancePaidPlanChangedEnvelope, "PaidPlanChanged">;
691
- declare const onAppInstancePaidPlanAutoRenewalCancelled$1: EventDefinition<AppInstancePaidPlanAutoRenewalCancelledEnvelope, "PaidPlanAutoRenewalCancelled">;
45
+ declare function createRESTModule$4<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
46
+
47
+ declare const listAppPlansByAppId: ReturnType<typeof createRESTModule$4<typeof publicListAppPlansByAppId>>;
692
48
 
693
- declare const getAppInstance: BuildRESTFunction$3<typeof getAppInstance$1>;
694
- declare const onAppInstanceInstalled: BuildEventDefinition<typeof onAppInstanceInstalled$1>;
695
- declare const onAppInstanceRemoved: BuildEventDefinition<typeof onAppInstanceRemoved$1>;
696
- declare const onAppInstancePaidPlanPurchased: BuildEventDefinition<typeof onAppInstancePaidPlanPurchased$1>;
697
- declare const onAppInstancePaidPlanChanged: BuildEventDefinition<typeof onAppInstancePaidPlanChanged$1>;
698
- declare const onAppInstancePaidPlanAutoRenewalCancelled: BuildEventDefinition<typeof onAppInstancePaidPlanAutoRenewalCancelled$1>;
49
+ declare const context$4_listAppPlansByAppId: typeof listAppPlansByAppId;
50
+ declare namespace context$4 {
51
+ export { context$4_listAppPlansByAppId as listAppPlansByAppId };
52
+ }
53
+
54
+ declare function createRESTModule$3<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
55
+
56
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
57
+
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>>;
699
64
 
700
65
  declare const context$3_getAppInstance: typeof getAppInstance;
701
66
  declare const context$3_onAppInstanceInstalled: typeof onAppInstanceInstalled;
@@ -707,222 +72,19 @@ declare namespace context$3 {
707
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 };
708
73
  }
709
74
 
710
- type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
711
- interface HttpClient$2 {
712
- request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
713
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
714
- }
715
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
716
- type HttpResponse$2<T = any> = {
717
- data: T;
718
- status: number;
719
- statusText: string;
720
- headers: any;
721
- request?: any;
722
- };
723
- type RequestOptions$2<_TResponse = any, Data = any> = {
724
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
725
- url: string;
726
- data?: Data;
727
- params?: URLSearchParams;
728
- } & APIMetadata$2;
729
- type APIMetadata$2 = {
730
- methodFqn?: string;
731
- entityFqdn?: string;
732
- packageName?: string;
733
- };
734
- type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
735
-
736
- declare global {
737
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
738
- interface SymbolConstructor {
739
- readonly observable: symbol;
740
- }
741
- }
742
-
743
- declare enum EventName {
744
- UNKNOWN = "UNKNOWN",
745
- APP_DASHBOARD_LOADED = "APP_DASHBOARD_LOADED",
746
- APP_FINISHED_CONFIGURATION = "APP_FINISHED_CONFIGURATION",
747
- APP_UPGRADED = "APP_UPGRADED",
748
- PRIMARY_ACTION_PERFORMED = "PRIMARY_ACTION_PERFORMED",
749
- CUSTOM = "CUSTOM",
750
- CHARGE = "CHARGE",
751
- FUNDS_RETURNED = "FUNDS_RETURNED",
752
- APP_FINISH_BUSINESS_SETUP = "APP_FINISH_BUSINESS_SETUP",
753
- APP_DEPLOYED = "APP_DEPLOYED",
754
- APP_SETUP_FINISHED = "APP_SETUP_FINISHED"
755
- }
756
- interface SendBiEventOptions {
757
- /**
758
- * Name of the event that's triggered in your app.
759
- *
760
- * + `"APP_DASHBOARD_LOADED"`: A site onwer or contributor loads your app's dashboard.
761
- * + `"APP_FINISHED_CONFIGURATION"`: The site owner completes all required configurations for your app in the Wix Developers Center.
762
- * + `"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.
763
- * + `"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.
764
- * + `"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`.
765
- * + `"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"}}`.
766
- * + `"CUSTOM"`: Any event that's not listed here. Make sure to also send `customEventName`.
767
- * + `"APP_DEPLOYED"`: Your app’s internal code implementation is changed and might affect user flows or cause a regression.
768
- * + `"APP_FINISH_BUSINESS_SETUP"`: __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead.
769
- * + `"APP_SETUP_FINISHED"`: The site owner completes your app's required business setup.
770
- */
771
- eventName?: EventName;
772
- /**
773
- * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
774
- *
775
- * Min: 2 characters
776
- */
777
- customEventName?: string | null;
778
- /**
779
- * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
780
- * You may also submit data with keys that aren't listed here.
781
- *
782
- * Additional data about your app's event.
783
- *
784
- * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
785
- * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
786
- * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
787
- * + `"reason"`: Information about why the event was triggered in your app.
788
- * + `"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).
789
- */
790
- eventData?: Record<string, string>;
791
- }
792
-
793
- declare function sendBiEvent$1(httpClient: HttpClient$2): (options?: SendBiEventOptions) => Promise<void>;
75
+ declare function createRESTModule$2<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
794
76
 
795
- declare const sendBiEvent: BuildRESTFunction$2<typeof sendBiEvent$1>;
77
+ declare const sendBiEvent: ReturnType<typeof createRESTModule$2<typeof publicSendBiEvent>>;
796
78
 
797
79
  declare const context$2_sendBiEvent: typeof sendBiEvent;
798
80
  declare namespace context$2 {
799
81
  export { context$2_sendBiEvent as sendBiEvent };
800
82
  }
801
83
 
802
- interface PurchasedItem {
803
- /** ID of your app's paid plan. */
804
- productId?: string;
805
- /** Price of your app's paid plan. For example, `9.95`. */
806
- price?: string;
807
- /**
808
- * 3-letter currency code in
809
- * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
810
- */
811
- currency?: string;
812
- /** Information about the billing cycle for your app's paid plan. */
813
- billingCycle?: PaymentCycle;
814
- /**
815
- * Date and time the site onwers have purchased your app's paid plan in
816
- * `YYYY-MM-DDThh:mm:ss.sssZ` format.
817
- */
818
- dateCreated?: Date;
819
- }
820
- declare enum PaymentCycle {
821
- NO_CYCLE = "NO_CYCLE",
822
- MONTHLY = "MONTHLY",
823
- YEARLY = "YEARLY",
824
- ONE_TIME = "ONE_TIME",
825
- TWO_YEARS = "TWO_YEARS",
826
- THREE_YEARS = "THREE_YEARS",
827
- FOUR_YEARS = "FOUR_YEARS",
828
- FIVE_YEARS = "FIVE_YEARS"
829
- }
830
- interface GetUrlResponse {
831
- /** URL for the Wix checkout page. */
832
- checkoutUrl?: string;
833
- /**
834
- * Token for the Wix checkout page. The token holds all data about the order
835
- * you're creating a checkout for. It is [signed](),
836
- * so you can verify that it comes from Wix.
837
- */
838
- token?: string | null;
839
- }
840
- interface GetPurchaseHistoryResponse {
841
- /** Retrieved purchases the site owners have completed for you app. */
842
- purchases?: PurchasedItem[];
843
- }
844
- interface GetUrlResponseNonNullableFields {
845
- checkoutUrl: string;
846
- }
847
- interface GetPurchaseHistoryResponseNonNullableFields {
848
- purchases: {
849
- productId: string;
850
- price: string;
851
- currency: string;
852
- billingCycle: PaymentCycle;
853
- }[];
854
- }
855
- interface GetUrlOptions {
856
- /**
857
- * URL for the Wix checkout page. Redirect site owners to this URL after
858
- * they've successfully purchased a paid plan for your app.
859
- */
860
- successUrl?: string | null;
861
- /**
862
- * Whether the checkout is for testing purposes only. Testing is mainly
863
- * relevant for in-app purchase flows. When `true`, Wix charges the site
864
- * owners an amount of `0.00`.
865
- */
866
- testCheckout?: boolean;
867
- /** Information about the paid plan's billing cycle. */
868
- billingCycle?: PaymentCycle;
869
- /**
870
- * 2-letter country code in
871
- * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
872
- * format.
873
- *
874
- * Default: `"US"`
875
- */
876
- countryCode?: string | null;
877
- /**
878
- * 2-letter language code in
879
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
880
- *
881
- * Default: `"EN"`
882
- */
883
- languageCode?: string | null;
884
- /** Coupon code for the paid plan. Available only in case there is a discount. */
885
- couponCode?: string | null;
886
- }
84
+ declare function createRESTModule$1<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
887
85
 
888
- type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
889
- interface HttpClient$1 {
890
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
891
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
892
- }
893
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
894
- type HttpResponse$1<T = any> = {
895
- data: T;
896
- status: number;
897
- statusText: string;
898
- headers: any;
899
- request?: any;
900
- };
901
- type RequestOptions$1<_TResponse = any, Data = any> = {
902
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
903
- url: string;
904
- data?: Data;
905
- params?: URLSearchParams;
906
- } & APIMetadata$1;
907
- type APIMetadata$1 = {
908
- methodFqn?: string;
909
- entityFqdn?: string;
910
- packageName?: string;
911
- };
912
- type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
913
-
914
- declare global {
915
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
916
- interface SymbolConstructor {
917
- readonly observable: symbol;
918
- }
919
- }
920
-
921
- declare function getUrl$1(httpClient: HttpClient$1): (productId: string, options?: GetUrlOptions) => Promise<GetUrlResponse & GetUrlResponseNonNullableFields>;
922
- declare function getPurchaseHistory$1(httpClient: HttpClient$1): () => Promise<GetPurchaseHistoryResponse & GetPurchaseHistoryResponseNonNullableFields>;
923
-
924
- declare const getUrl: BuildRESTFunction$1<typeof getUrl$1>;
925
- declare const getPurchaseHistory: BuildRESTFunction$1<typeof getPurchaseHistory$1>;
86
+ declare const getUrl: ReturnType<typeof createRESTModule$1<typeof publicGetUrl>>;
87
+ declare const getPurchaseHistory: ReturnType<typeof createRESTModule$1<typeof publicGetPurchaseHistory>>;
926
88
 
927
89
  declare const context$1_getPurchaseHistory: typeof getPurchaseHistory;
928
90
  declare const context$1_getUrl: typeof getUrl;
@@ -930,71 +92,10 @@ declare namespace context$1 {
930
92
  export { context$1_getPurchaseHistory as getPurchaseHistory, context$1_getUrl as getUrl };
931
93
  }
932
94
 
933
- /** Embedded script data */
934
- interface ScriptProperties {
935
- /** Script parameters */
936
- parameters?: Record<string, string>;
937
- /** Whether script is disabled or not, defaults to false (not disabled) */
938
- disabled?: boolean;
939
- }
940
- interface EmbedScriptResponse {
941
- /** Details of the embedded script. */
942
- properties?: ScriptProperties;
943
- }
944
- interface EmbedScriptResponseNonNullableFields {
945
- properties?: {
946
- disabled: boolean;
947
- };
948
- }
949
- interface EmbedScriptOptions {
950
- /** ID of the corresponding embedded script component. */
951
- componentId?: string | null;
952
- }
953
- interface GetEmbeddedScriptOptions {
954
- /** Component ID of the embedded script to retrieve. */
955
- componentId?: string | null;
956
- }
957
-
958
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
959
- interface HttpClient {
960
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
961
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
962
- }
963
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
964
- type HttpResponse<T = any> = {
965
- data: T;
966
- status: number;
967
- statusText: string;
968
- headers: any;
969
- request?: any;
970
- };
971
- type RequestOptions<_TResponse = any, Data = any> = {
972
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
973
- url: string;
974
- data?: Data;
975
- params?: URLSearchParams;
976
- } & APIMetadata;
977
- type APIMetadata = {
978
- methodFqn?: string;
979
- entityFqdn?: string;
980
- packageName?: string;
981
- };
982
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
983
-
984
- declare global {
985
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
986
- interface SymbolConstructor {
987
- readonly observable: symbol;
988
- }
989
- }
990
-
991
- declare function embedScript$1(httpClient: HttpClient): (properties: ScriptProperties, options?: EmbedScriptOptions) => Promise<EmbedScriptResponse & EmbedScriptResponseNonNullableFields>;
992
- declare function getEmbeddedScript$1(httpClient: HttpClient): (options?: GetEmbeddedScriptOptions) => Promise<ScriptProperties & {
993
- disabled: boolean;
994
- }>;
95
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
995
96
 
996
- declare const embedScript: BuildRESTFunction<typeof embedScript$1>;
997
- 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>>;
998
99
 
999
100
  declare const context_embedScript: typeof embedScript;
1000
101
  declare const context_getEmbeddedScript: typeof getEmbeddedScript;
@@ -228,29 +228,38 @@ interface ListAppPlansByAppIdResponseNonNullableFields {
228
228
  }[];
229
229
  }
230
230
 
231
- interface HttpClient$4 {
232
- request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
233
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
231
+ interface HttpClient {
232
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
233
+ fetchWithAuth: typeof fetch;
234
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
234
235
  }
235
- type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
236
- type HttpResponse$4<T = any> = {
236
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
237
+ type HttpResponse<T = any> = {
237
238
  data: T;
238
239
  status: number;
239
240
  statusText: string;
240
241
  headers: any;
241
242
  request?: any;
242
243
  };
243
- type RequestOptions$4<_TResponse = any, Data = any> = {
244
+ type RequestOptions<_TResponse = any, Data = any> = {
244
245
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
245
246
  url: string;
246
247
  data?: Data;
247
248
  params?: URLSearchParams;
248
- } & APIMetadata$4;
249
- type APIMetadata$4 = {
249
+ } & APIMetadata;
250
+ type APIMetadata = {
250
251
  methodFqn?: string;
251
252
  entityFqdn?: string;
252
253
  packageName?: string;
253
254
  };
255
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
256
+ __type: 'event-definition';
257
+ type: Type;
258
+ isDomainEvent?: boolean;
259
+ transformations?: (envelope: unknown) => Payload;
260
+ __payload: Payload;
261
+ };
262
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
254
263
 
255
264
  declare global {
256
265
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -262,7 +271,7 @@ declare global {
262
271
  declare const __metadata$4: {
263
272
  PACKAGE_NAME: string;
264
273
  };
265
- declare function listAppPlansByAppId(httpClient: HttpClient$4): (appIds: string[]) => Promise<ListAppPlansByAppIdResponse & ListAppPlansByAppIdResponseNonNullableFields>;
274
+ declare function listAppPlansByAppId(httpClient: HttpClient): (appIds: string[]) => Promise<ListAppPlansByAppIdResponse & ListAppPlansByAppIdResponseNonNullableFields>;
266
275
 
267
276
  type index_d$4_AppPlans = AppPlans;
268
277
  type index_d$4_Cycle = Cycle;
@@ -680,49 +689,10 @@ interface AppInstancePaidPlanAutoRenewalCancelledEnvelope {
680
689
  metadata: BaseEventMetadata;
681
690
  }
682
691
 
683
- interface HttpClient$3 {
684
- request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
685
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
686
- }
687
- type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
688
- type HttpResponse$3<T = any> = {
689
- data: T;
690
- status: number;
691
- statusText: string;
692
- headers: any;
693
- request?: any;
694
- };
695
- type RequestOptions$3<_TResponse = any, Data = any> = {
696
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
697
- url: string;
698
- data?: Data;
699
- params?: URLSearchParams;
700
- } & APIMetadata$3;
701
- type APIMetadata$3 = {
702
- methodFqn?: string;
703
- entityFqdn?: string;
704
- packageName?: string;
705
- };
706
- type EventDefinition<Payload = unknown, Type extends string = string> = {
707
- __type: 'event-definition';
708
- type: Type;
709
- isDomainEvent?: boolean;
710
- transformations?: (envelope: unknown) => Payload;
711
- __payload: Payload;
712
- };
713
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
714
-
715
- declare global {
716
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
717
- interface SymbolConstructor {
718
- readonly observable: symbol;
719
- }
720
- }
721
-
722
692
  declare const __metadata$3: {
723
693
  PACKAGE_NAME: string;
724
694
  };
725
- declare function getAppInstance(httpClient: HttpClient$3): () => Promise<GetAppInstanceResponse & GetAppInstanceResponseNonNullableFields>;
695
+ declare function getAppInstance(httpClient: HttpClient): () => Promise<GetAppInstanceResponse & GetAppInstanceResponseNonNullableFields>;
726
696
  declare const onAppInstanceInstalled: EventDefinition<AppInstanceInstalledEnvelope, "AppInstalled">;
727
697
  declare const onAppInstanceRemoved: EventDefinition<AppInstanceRemovedEnvelope, "AppRemoved">;
728
698
  declare const onAppInstancePaidPlanPurchased: EventDefinition<AppInstancePaidPlanPurchasedEnvelope, "PaidPlanPurchased">;
@@ -767,37 +737,6 @@ declare namespace index_d$3 {
767
737
  export { type index_d$3_AppInstalled as AppInstalled, type index_d$3_AppInstance as AppInstance, type index_d$3_AppInstanceInstalledEnvelope as AppInstanceInstalledEnvelope, type index_d$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope as AppInstancePaidPlanAutoRenewalCancelledEnvelope, type index_d$3_AppInstancePaidPlanChangedEnvelope as AppInstancePaidPlanChangedEnvelope, type index_d$3_AppInstancePaidPlanPurchasedEnvelope as AppInstancePaidPlanPurchasedEnvelope, type index_d$3_AppInstanceRemovedEnvelope as AppInstanceRemovedEnvelope, type index_d$3_AppRemoved as AppRemoved, type index_d$3_AvailablePlan as AvailablePlan, type index_d$3_BaseEventMetadata as BaseEventMetadata, type index_d$3_BillingInfo as BillingInfo, type index_d$3_FreeTrialInfo as FreeTrialInfo, index_d$3_FreeTrialStatus as FreeTrialStatus, type index_d$3_GetAppInstanceByInstanceIdRequest as GetAppInstanceByInstanceIdRequest, type index_d$3_GetAppInstanceRequest as GetAppInstanceRequest, type index_d$3_GetAppInstanceResponse as GetAppInstanceResponse, type index_d$3_GetAppInstanceResponseNonNullableFields as GetAppInstanceResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type index_d$3_Locale as Locale, type MessageEnvelope$1 as MessageEnvelope, type index_d$3_Multilingual as Multilingual, type index_d$3_OwnerInfo as OwnerInfo, type index_d$3_PaidPlanAutoRenewalCancelled as PaidPlanAutoRenewalCancelled, type index_d$3_PaidPlanChanged as PaidPlanChanged, type index_d$3_PaidPlanPurchased as PaidPlanPurchased, PaymentCycle$1 as PaymentCycle, index_d$3_ResolutionMethod as ResolutionMethod, type index_d$3_SiteInfo as SiteInfo, type index_d$3_SupportedLanguage as SupportedLanguage, WebhookIdentityType$1 as WebhookIdentityType, __metadata$3 as __metadata, index_d$3_getAppInstance as getAppInstance, index_d$3_onAppInstanceInstalled as onAppInstanceInstalled, index_d$3_onAppInstancePaidPlanAutoRenewalCancelled as onAppInstancePaidPlanAutoRenewalCancelled, index_d$3_onAppInstancePaidPlanChanged as onAppInstancePaidPlanChanged, index_d$3_onAppInstancePaidPlanPurchased as onAppInstancePaidPlanPurchased, index_d$3_onAppInstanceRemoved as onAppInstanceRemoved };
768
738
  }
769
739
 
770
- interface HttpClient$2 {
771
- request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
772
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
773
- }
774
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
775
- type HttpResponse$2<T = any> = {
776
- data: T;
777
- status: number;
778
- statusText: string;
779
- headers: any;
780
- request?: any;
781
- };
782
- type RequestOptions$2<_TResponse = any, Data = any> = {
783
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
784
- url: string;
785
- data?: Data;
786
- params?: URLSearchParams;
787
- } & APIMetadata$2;
788
- type APIMetadata$2 = {
789
- methodFqn?: string;
790
- entityFqdn?: string;
791
- packageName?: string;
792
- };
793
-
794
- declare global {
795
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
796
- interface SymbolConstructor {
797
- readonly observable: symbol;
798
- }
799
- }
800
-
801
740
  interface SendBIEventResponse {
802
741
  }
803
742
  interface SendBIEventRequest {
@@ -889,7 +828,7 @@ interface SendBiEventOptions {
889
828
  declare const __metadata$2: {
890
829
  PACKAGE_NAME: string;
891
830
  };
892
- declare function sendBiEvent(httpClient: HttpClient$2): (options?: SendBiEventOptions) => Promise<void>;
831
+ declare function sendBiEvent(httpClient: HttpClient): (options?: SendBiEventOptions) => Promise<void>;
893
832
 
894
833
  type index_d$2_EventName = EventName;
895
834
  declare const index_d$2_EventName: typeof EventName;
@@ -1153,42 +1092,11 @@ interface GetUrlOptions {
1153
1092
  couponCode?: string | null;
1154
1093
  }
1155
1094
 
1156
- interface HttpClient$1 {
1157
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
1158
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
1159
- }
1160
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
1161
- type HttpResponse$1<T = any> = {
1162
- data: T;
1163
- status: number;
1164
- statusText: string;
1165
- headers: any;
1166
- request?: any;
1167
- };
1168
- type RequestOptions$1<_TResponse = any, Data = any> = {
1169
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1170
- url: string;
1171
- data?: Data;
1172
- params?: URLSearchParams;
1173
- } & APIMetadata$1;
1174
- type APIMetadata$1 = {
1175
- methodFqn?: string;
1176
- entityFqdn?: string;
1177
- packageName?: string;
1178
- };
1179
-
1180
- declare global {
1181
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1182
- interface SymbolConstructor {
1183
- readonly observable: symbol;
1184
- }
1185
- }
1186
-
1187
1095
  declare const __metadata$1: {
1188
1096
  PACKAGE_NAME: string;
1189
1097
  };
1190
- declare function getUrl(httpClient: HttpClient$1): (productId: string, options?: GetUrlOptions) => Promise<GetUrlResponse & GetUrlResponseNonNullableFields>;
1191
- declare function getPurchaseHistory(httpClient: HttpClient$1): () => Promise<GetPurchaseHistoryResponse & GetPurchaseHistoryResponseNonNullableFields>;
1098
+ declare function getUrl(httpClient: HttpClient): (productId: string, options?: GetUrlOptions) => Promise<GetUrlResponse & GetUrlResponseNonNullableFields>;
1099
+ declare function getPurchaseHistory(httpClient: HttpClient): () => Promise<GetPurchaseHistoryResponse & GetPurchaseHistoryResponseNonNullableFields>;
1192
1100
 
1193
1101
  type index_d$1_Charge = Charge;
1194
1102
  type index_d$1_ChargeOverride = ChargeOverride;
@@ -1274,37 +1182,6 @@ interface GetEmbeddedScriptOptions {
1274
1182
  componentId?: string | null;
1275
1183
  }
1276
1184
 
1277
- interface HttpClient {
1278
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
1279
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
1280
- }
1281
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
1282
- type HttpResponse<T = any> = {
1283
- data: T;
1284
- status: number;
1285
- statusText: string;
1286
- headers: any;
1287
- request?: any;
1288
- };
1289
- type RequestOptions<_TResponse = any, Data = any> = {
1290
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1291
- url: string;
1292
- data?: Data;
1293
- params?: URLSearchParams;
1294
- } & APIMetadata;
1295
- type APIMetadata = {
1296
- methodFqn?: string;
1297
- entityFqdn?: string;
1298
- packageName?: string;
1299
- };
1300
-
1301
- declare global {
1302
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1303
- interface SymbolConstructor {
1304
- readonly observable: symbol;
1305
- }
1306
- }
1307
-
1308
1185
  declare const __metadata: {
1309
1186
  PACKAGE_NAME: string;
1310
1187
  };
@@ -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;