@wix/app-management 1.0.20 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.22",
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.12",
23
+ "@wix/app-management_app-plans": "1.0.12",
24
+ "@wix/app-management_bi-events": "1.0.11",
25
+ "@wix/app-management_billing": "1.0.12",
26
+ "@wix/app-management_custom-charges": "1.0.6",
27
+ "@wix/app-management_embedded-scripts": "1.0.9"
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": "49dc28b408cb41bcde5e89d12716dbed38840dea218ac1fbff758e3f"
52
52
  }
@@ -132,6 +132,15 @@ interface Plan {
132
132
  */
133
133
  prices?: Price[];
134
134
  }
135
+ interface ListAppPlansByAppIdRequest {
136
+ /**
137
+ * List of app IDs to retrieve plans for.
138
+ *
139
+ * Min: 1 app ID
140
+ * Max: 100 app IDs
141
+ */
142
+ appIds: string[];
143
+ }
135
144
  interface ListAppPlansByAppIdResponse {
136
145
  /**
137
146
  * Tax settings. Wix calculates the tax settings based on the country code that
@@ -219,31 +228,42 @@ interface ListAppPlansByAppIdResponseNonNullableFields {
219
228
  }[];
220
229
  }
221
230
 
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>;
231
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
232
+ interface HttpClient {
233
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
234
+ fetchWithAuth: typeof fetch;
235
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
226
236
  }
227
- type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
228
- type HttpResponse$4<T = any> = {
237
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
238
+ type HttpResponse<T = any> = {
229
239
  data: T;
230
240
  status: number;
231
241
  statusText: string;
232
242
  headers: any;
233
243
  request?: any;
234
244
  };
235
- type RequestOptions$4<_TResponse = any, Data = any> = {
245
+ type RequestOptions<_TResponse = any, Data = any> = {
236
246
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
237
247
  url: string;
238
248
  data?: Data;
239
249
  params?: URLSearchParams;
240
- } & APIMetadata$4;
241
- type APIMetadata$4 = {
250
+ } & APIMetadata;
251
+ type APIMetadata = {
242
252
  methodFqn?: string;
243
253
  entityFqdn?: string;
244
254
  packageName?: string;
245
255
  };
246
- type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
256
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
257
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
258
+ __type: 'event-definition';
259
+ type: Type;
260
+ isDomainEvent?: boolean;
261
+ transformations?: (envelope: unknown) => Payload;
262
+ __payload: Payload;
263
+ };
264
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
265
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
266
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
247
267
 
248
268
  declare global {
249
269
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -252,13 +272,29 @@ declare global {
252
272
  }
253
273
  }
254
274
 
255
- declare function listAppPlansByAppId$1(httpClient: HttpClient$4): (appIds: string[]) => Promise<ListAppPlansByAppIdResponse & ListAppPlansByAppIdResponseNonNullableFields>;
275
+ declare function createRESTModule$4<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
256
276
 
257
- declare const listAppPlansByAppId: BuildRESTFunction$4<typeof listAppPlansByAppId$1>;
277
+ declare const listAppPlansByAppId: ReturnType<typeof createRESTModule$4<typeof publicListAppPlansByAppId>>;
258
278
 
279
+ type context$4_AppPlans = AppPlans;
280
+ type context$4_Cycle = Cycle;
281
+ type context$4_CycleType = CycleType;
282
+ declare const context$4_CycleType: typeof CycleType;
283
+ type context$4_Duration = Duration;
284
+ type context$4_DurationUnit = DurationUnit;
285
+ declare const context$4_DurationUnit: typeof DurationUnit;
286
+ type context$4_ListAppPlansByAppIdRequest = ListAppPlansByAppIdRequest;
287
+ type context$4_ListAppPlansByAppIdResponse = ListAppPlansByAppIdResponse;
288
+ type context$4_ListAppPlansByAppIdResponseNonNullableFields = ListAppPlansByAppIdResponseNonNullableFields;
289
+ type context$4_Plan = Plan;
290
+ type context$4_Price = Price;
291
+ type context$4_TaxSettings = TaxSettings;
292
+ type context$4_TaxType = TaxType;
293
+ declare const context$4_TaxType: typeof TaxType;
294
+ type context$4_UsageBasedDetails = UsageBasedDetails;
259
295
  declare const context$4_listAppPlansByAppId: typeof listAppPlansByAppId;
260
296
  declare namespace context$4 {
261
- export { context$4_listAppPlansByAppId as listAppPlansByAppId };
297
+ export { type context$4_AppPlans as AppPlans, type context$4_Cycle as Cycle, context$4_CycleType as CycleType, type context$4_Duration as Duration, context$4_DurationUnit as DurationUnit, type context$4_ListAppPlansByAppIdRequest as ListAppPlansByAppIdRequest, type context$4_ListAppPlansByAppIdResponse as ListAppPlansByAppIdResponse, type context$4_ListAppPlansByAppIdResponseNonNullableFields as ListAppPlansByAppIdResponseNonNullableFields, type context$4_Plan as Plan, type context$4_Price as Price, type context$4_TaxSettings as TaxSettings, context$4_TaxType as TaxType, type context$4_UsageBasedDetails as UsageBasedDetails, context$4_listAppPlansByAppId as listAppPlansByAppId };
262
298
  }
263
299
 
264
300
  /**
@@ -454,6 +490,8 @@ interface PaidPlanAutoRenewalCancelled {
454
490
  /** Cancellation type. */
455
491
  subscriptionCancellationType?: string | null;
456
492
  }
493
+ interface GetAppInstanceRequest {
494
+ }
457
495
  interface GetAppInstanceResponse {
458
496
  /** Retrieved app instance. */
459
497
  instance?: AppInstance;
@@ -535,7 +573,21 @@ interface OwnerInfo {
535
573
  */
536
574
  emailStatus?: string;
537
575
  }
538
- interface IdentificationData extends IdentificationDataIdOneOf {
576
+ interface GetAppInstanceByInstanceIdRequest {
577
+ /** ID of the app instance to retrieve. */
578
+ instanceId?: string;
579
+ }
580
+ interface MessageEnvelope$1 {
581
+ /** App instance ID. */
582
+ instanceId?: string | null;
583
+ /** Event type. */
584
+ eventType?: string;
585
+ /** The identification type and identity data. */
586
+ identity?: IdentificationData$1;
587
+ /** Stringify payload. */
588
+ data?: string;
589
+ }
590
+ interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
539
591
  /** ID of a site visitor that has not logged in to the site. */
540
592
  anonymousVisitorId?: string;
541
593
  /** ID of a site visitor that has logged in to the site. */
@@ -545,10 +597,10 @@ interface IdentificationData extends IdentificationDataIdOneOf {
545
597
  /** ID of an app. */
546
598
  appId?: string;
547
599
  /** @readonly */
548
- identityType?: WebhookIdentityType;
600
+ identityType?: WebhookIdentityType$1;
549
601
  }
550
602
  /** @oneof */
551
- interface IdentificationDataIdOneOf {
603
+ interface IdentificationDataIdOneOf$1 {
552
604
  /** ID of a site visitor that has not logged in to the site. */
553
605
  anonymousVisitorId?: string;
554
606
  /** ID of a site visitor that has logged in to the site. */
@@ -558,7 +610,7 @@ interface IdentificationDataIdOneOf {
558
610
  /** ID of an app. */
559
611
  appId?: string;
560
612
  }
561
- declare enum WebhookIdentityType {
613
+ declare enum WebhookIdentityType$1 {
562
614
  UNKNOWN = "UNKNOWN",
563
615
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
564
616
  MEMBER = "MEMBER",
@@ -617,7 +669,7 @@ interface BaseEventMetadata {
617
669
  /** Event type. */
618
670
  eventType?: string;
619
671
  /** The identification type and identity data. */
620
- identity?: IdentificationData;
672
+ identity?: IdentificationData$1;
621
673
  }
622
674
  interface AppInstanceInstalledEnvelope {
623
675
  data: AppInstalled;
@@ -640,63 +692,45 @@ interface AppInstancePaidPlanAutoRenewalCancelledEnvelope {
640
692
  metadata: BaseEventMetadata;
641
693
  }
642
694
 
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>;
647
- }
648
- type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
649
- type HttpResponse$3<T = any> = {
650
- data: T;
651
- status: number;
652
- statusText: string;
653
- headers: any;
654
- request?: any;
655
- };
656
- type RequestOptions$3<_TResponse = any, Data = any> = {
657
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
658
- url: string;
659
- data?: Data;
660
- params?: URLSearchParams;
661
- } & APIMetadata$3;
662
- type APIMetadata$3 = {
663
- methodFqn?: string;
664
- entityFqdn?: string;
665
- packageName?: string;
666
- };
667
- type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
668
- type EventDefinition<Payload = unknown, Type extends string = string> = {
669
- __type: 'event-definition';
670
- type: Type;
671
- isDomainEvent?: boolean;
672
- transformations?: (envelope: unknown) => Payload;
673
- __payload: Payload;
674
- };
675
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
676
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
677
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
678
-
679
- declare global {
680
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
681
- interface SymbolConstructor {
682
- readonly observable: symbol;
683
- }
684
- }
695
+ declare function createRESTModule$3<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
685
696
 
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">;
697
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
692
698
 
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>;
699
+ declare const getAppInstance: ReturnType<typeof createRESTModule$3<typeof publicGetAppInstance>>;
700
+ declare const onAppInstanceInstalled: ReturnType<typeof createEventModule<typeof publicOnAppInstanceInstalled>>;
701
+ declare const onAppInstanceRemoved: ReturnType<typeof createEventModule<typeof publicOnAppInstanceRemoved>>;
702
+ declare const onAppInstancePaidPlanPurchased: ReturnType<typeof createEventModule<typeof publicOnAppInstancePaidPlanPurchased>>;
703
+ declare const onAppInstancePaidPlanChanged: ReturnType<typeof createEventModule<typeof publicOnAppInstancePaidPlanChanged>>;
704
+ declare const onAppInstancePaidPlanAutoRenewalCancelled: ReturnType<typeof createEventModule<typeof publicOnAppInstancePaidPlanAutoRenewalCancelled>>;
699
705
 
706
+ type context$3_AppInstalled = AppInstalled;
707
+ type context$3_AppInstance = AppInstance;
708
+ type context$3_AppInstanceInstalledEnvelope = AppInstanceInstalledEnvelope;
709
+ type context$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope = AppInstancePaidPlanAutoRenewalCancelledEnvelope;
710
+ type context$3_AppInstancePaidPlanChangedEnvelope = AppInstancePaidPlanChangedEnvelope;
711
+ type context$3_AppInstancePaidPlanPurchasedEnvelope = AppInstancePaidPlanPurchasedEnvelope;
712
+ type context$3_AppInstanceRemovedEnvelope = AppInstanceRemovedEnvelope;
713
+ type context$3_AppRemoved = AppRemoved;
714
+ type context$3_AvailablePlan = AvailablePlan;
715
+ type context$3_BaseEventMetadata = BaseEventMetadata;
716
+ type context$3_BillingInfo = BillingInfo;
717
+ type context$3_FreeTrialInfo = FreeTrialInfo;
718
+ type context$3_FreeTrialStatus = FreeTrialStatus;
719
+ declare const context$3_FreeTrialStatus: typeof FreeTrialStatus;
720
+ type context$3_GetAppInstanceByInstanceIdRequest = GetAppInstanceByInstanceIdRequest;
721
+ type context$3_GetAppInstanceRequest = GetAppInstanceRequest;
722
+ type context$3_GetAppInstanceResponse = GetAppInstanceResponse;
723
+ type context$3_GetAppInstanceResponseNonNullableFields = GetAppInstanceResponseNonNullableFields;
724
+ type context$3_Locale = Locale;
725
+ type context$3_Multilingual = Multilingual;
726
+ type context$3_OwnerInfo = OwnerInfo;
727
+ type context$3_PaidPlanAutoRenewalCancelled = PaidPlanAutoRenewalCancelled;
728
+ type context$3_PaidPlanChanged = PaidPlanChanged;
729
+ type context$3_PaidPlanPurchased = PaidPlanPurchased;
730
+ type context$3_ResolutionMethod = ResolutionMethod;
731
+ declare const context$3_ResolutionMethod: typeof ResolutionMethod;
732
+ type context$3_SiteInfo = SiteInfo;
733
+ type context$3_SupportedLanguage = SupportedLanguage;
700
734
  declare const context$3_getAppInstance: typeof getAppInstance;
701
735
  declare const context$3_onAppInstanceInstalled: typeof onAppInstanceInstalled;
702
736
  declare const context$3_onAppInstancePaidPlanAutoRenewalCancelled: typeof onAppInstancePaidPlanAutoRenewalCancelled;
@@ -704,42 +738,47 @@ declare const context$3_onAppInstancePaidPlanChanged: typeof onAppInstancePaidPl
704
738
  declare const context$3_onAppInstancePaidPlanPurchased: typeof onAppInstancePaidPlanPurchased;
705
739
  declare const context$3_onAppInstanceRemoved: typeof onAppInstanceRemoved;
706
740
  declare namespace context$3 {
707
- 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 };
741
+ export { type context$3_AppInstalled as AppInstalled, type context$3_AppInstance as AppInstance, type context$3_AppInstanceInstalledEnvelope as AppInstanceInstalledEnvelope, type context$3_AppInstancePaidPlanAutoRenewalCancelledEnvelope as AppInstancePaidPlanAutoRenewalCancelledEnvelope, type context$3_AppInstancePaidPlanChangedEnvelope as AppInstancePaidPlanChangedEnvelope, type context$3_AppInstancePaidPlanPurchasedEnvelope as AppInstancePaidPlanPurchasedEnvelope, type context$3_AppInstanceRemovedEnvelope as AppInstanceRemovedEnvelope, type context$3_AppRemoved as AppRemoved, type context$3_AvailablePlan as AvailablePlan, type context$3_BaseEventMetadata as BaseEventMetadata, type context$3_BillingInfo as BillingInfo, type context$3_FreeTrialInfo as FreeTrialInfo, context$3_FreeTrialStatus as FreeTrialStatus, type context$3_GetAppInstanceByInstanceIdRequest as GetAppInstanceByInstanceIdRequest, type context$3_GetAppInstanceRequest as GetAppInstanceRequest, type context$3_GetAppInstanceResponse as GetAppInstanceResponse, type context$3_GetAppInstanceResponseNonNullableFields as GetAppInstanceResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type context$3_Locale as Locale, type MessageEnvelope$1 as MessageEnvelope, type context$3_Multilingual as Multilingual, type context$3_OwnerInfo as OwnerInfo, type context$3_PaidPlanAutoRenewalCancelled as PaidPlanAutoRenewalCancelled, type context$3_PaidPlanChanged as PaidPlanChanged, type context$3_PaidPlanPurchased as PaidPlanPurchased, PaymentCycle$1 as PaymentCycle, context$3_ResolutionMethod as ResolutionMethod, type context$3_SiteInfo as SiteInfo, type context$3_SupportedLanguage as SupportedLanguage, WebhookIdentityType$1 as WebhookIdentityType, 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
742
  }
709
743
 
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>;
744
+ interface SendBIEventResponse {
714
745
  }
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
- }
746
+ interface SendBIEventRequest {
747
+ /**
748
+ * Name of the event that's triggered in your app.
749
+ *
750
+ * + `"APP_DASHBOARD_LOADED"`: A site onwer or contributor loads your app's dashboard.
751
+ * + `"APP_FINISHED_CONFIGURATION"`: The site owner completes all required configurations for your app in the Wix Developers Center.
752
+ * + `"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.
753
+ * + `"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.
754
+ * + `"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`.
755
+ * + `"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"}}`.
756
+ * + `"CUSTOM"`: Any event that's not listed here. Make sure to also send `customEventName`.
757
+ * + `"APP_DEPLOYED"`: Your app’s internal code implementation is changed and might affect user flows or cause a regression.
758
+ * + `"APP_FINISH_BUSINESS_SETUP"`: __Deprecation Notice:__ This enum value will be removed on March 30, 2023. Use `"APP_SETUP_FINISHED"` instead.
759
+ * + `"APP_SETUP_FINISHED"`: The site owner completes your app's required business setup.
760
+ */
761
+ eventName?: EventName;
762
+ /**
763
+ * Name of your app's custom event that was triggered. Required when `{"eventName": "CUSTOM"}`.
764
+ *
765
+ * Min: 2 characters
766
+ */
767
+ customEventName?: string | null;
768
+ /**
769
+ * Supported values include: `"cycle_name"`, `"currency"`, `"sum"`, `"reason"`, `"app_plan_id"`.
770
+ * You may also submit data with keys that aren't listed here.
771
+ *
772
+ * Additional data about your app's event.
773
+ *
774
+ * + `"cycle_name"`: Supported values: `"monthly"`, `"yearly"`, `"2 years"`, `"one time"`.
775
+ * + `"currency"`: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
776
+ * + `"sum"`: Amount of money. Required for `{"eventName": "CHARGE"}` and `{"eventName": "FUNDS_RETURNED"}`.
777
+ * + `"reason"`: Information about why the event was triggered in your app.
778
+ * + `"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).
779
+ */
780
+ eventData?: Record<string, string>;
741
781
  }
742
-
743
782
  declare enum EventName {
744
783
  UNKNOWN = "UNKNOWN",
745
784
  APP_DASHBOARD_LOADED = "APP_DASHBOARD_LOADED",
@@ -790,13 +829,18 @@ interface SendBiEventOptions {
790
829
  eventData?: Record<string, string>;
791
830
  }
792
831
 
793
- declare function sendBiEvent$1(httpClient: HttpClient$2): (options?: SendBiEventOptions) => Promise<void>;
832
+ declare function createRESTModule$2<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
794
833
 
795
- declare const sendBiEvent: BuildRESTFunction$2<typeof sendBiEvent$1>;
834
+ declare const sendBiEvent: ReturnType<typeof createRESTModule$2<typeof publicSendBiEvent>>;
796
835
 
836
+ type context$2_EventName = EventName;
837
+ declare const context$2_EventName: typeof EventName;
838
+ type context$2_SendBIEventRequest = SendBIEventRequest;
839
+ type context$2_SendBIEventResponse = SendBIEventResponse;
840
+ type context$2_SendBiEventOptions = SendBiEventOptions;
797
841
  declare const context$2_sendBiEvent: typeof sendBiEvent;
798
842
  declare namespace context$2 {
799
- export { context$2_sendBiEvent as sendBiEvent };
843
+ export { context$2_EventName as EventName, type context$2_SendBIEventRequest as SendBIEventRequest, type context$2_SendBIEventResponse as SendBIEventResponse, type context$2_SendBiEventOptions as SendBiEventOptions, context$2_sendBiEvent as sendBiEvent };
800
844
  }
801
845
 
802
846
  interface PurchasedItem {
@@ -827,6 +871,74 @@ declare enum PaymentCycle {
827
871
  FOUR_YEARS = "FOUR_YEARS",
828
872
  FIVE_YEARS = "FIVE_YEARS"
829
873
  }
874
+ interface InvoiceStatusUpdate {
875
+ /** Invoice payment status. */
876
+ status?: InvoiceStatus;
877
+ /** Wix Premium invoice ID. */
878
+ invoiceId?: string;
879
+ /** App instance ID - a unique ID assigned to each app in each site. */
880
+ instanceId?: string | null;
881
+ /** Whether the invoice is for a single payment or for multiple, recurring payments. */
882
+ recurring?: boolean;
883
+ }
884
+ declare enum InvoiceStatus {
885
+ UNKNOWN_INVOICE_STATUS = "UNKNOWN_INVOICE_STATUS",
886
+ PAYMENT_FAILED = "PAYMENT_FAILED",
887
+ PAID = "PAID",
888
+ REFUNDED = "REFUNDED",
889
+ VOIDED = "VOIDED",
890
+ CHARGEDBACK = "CHARGEDBACK"
891
+ }
892
+ interface GetUrlRequest {
893
+ /**
894
+ * ID of your app's paid plan to retrieve the Wix checkout URL for. Check the
895
+ * Wix Developers Center for a list of your app's supported product IDs.
896
+ */
897
+ productId: string;
898
+ /**
899
+ * URL for the Wix checkout page. Redirect site owners to this URL after
900
+ * they've successfully purchased a paid plan for your app.
901
+ */
902
+ successUrl?: string | null;
903
+ /**
904
+ * Whether the checkout is for testing purposes only. Testing is mainly
905
+ * relevant for in-app purchase flows. When `true`, Wix charges the site
906
+ * owners an amount of `0.00`.
907
+ */
908
+ testCheckout?: boolean;
909
+ /** Information about the paid plan's billing cycle. */
910
+ billingCycle?: PaymentCycle;
911
+ /**
912
+ * 2-letter country code in
913
+ * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
914
+ * format.
915
+ *
916
+ * Default: `"US"`
917
+ */
918
+ countryCode?: string | null;
919
+ /**
920
+ * 2-letter language code in
921
+ * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
922
+ *
923
+ * Default: `"EN"`
924
+ */
925
+ languageCode?: string | null;
926
+ /** Coupon code for the paid plan. Available only in case there is a discount. */
927
+ couponCode?: string | null;
928
+ }
929
+ interface ChargeOverride {
930
+ /**
931
+ * Override price. In case you omit the override price, Wix charges site
932
+ * owners the app's default price that's configured in the Wix Developers
933
+ * Center.
934
+ */
935
+ price?: number;
936
+ /**
937
+ * Override 3-letter currency code in
938
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
939
+ */
940
+ currency?: string;
941
+ }
830
942
  interface GetUrlResponse {
831
943
  /** URL for the Wix checkout page. */
832
944
  checkoutUrl?: string;
@@ -837,10 +949,108 @@ interface GetUrlResponse {
837
949
  */
838
950
  token?: string | null;
839
951
  }
952
+ interface GetPurchaseHistoryRequest {
953
+ }
840
954
  interface GetPurchaseHistoryResponse {
841
955
  /** Retrieved purchases the site owners have completed for you app. */
842
956
  purchases?: PurchasedItem[];
843
957
  }
958
+ interface GetSitePaymentMethodsStatusRequest {
959
+ }
960
+ interface GetSitePaymentMethodsStatusResponse {
961
+ /**
962
+ * Whether the site owners have enabled at least a single online payment method.
963
+ * Online payment methods include Wix Payments, Stripe, PayPal, and credit
964
+ * cards.
965
+ */
966
+ onlineProviderEnabled?: boolean;
967
+ /** Whether the site owners accept offline payments. */
968
+ offlineProviderEnabled?: boolean;
969
+ /**
970
+ * Whether the site owners have enabled the
971
+ * [Wix Point of Sale](https://www.wix.com/pos).
972
+ * This allows their customers to make electronic payments in person.
973
+ */
974
+ wixPosProviderEnabled?: boolean;
975
+ /**
976
+ * Whether the site owners have enabled at least one 3rd-party point-of-sale
977
+ * provider. This allows their customers to make electronic payments in person.
978
+ */
979
+ thirdPartyPosProviderEnabled?: boolean;
980
+ }
981
+ interface GetMeteredBillingChargesRequest {
982
+ /**
983
+ * 3-letter currency code in
984
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
985
+ */
986
+ currency?: string | null;
987
+ /**
988
+ * Start of the period you want to retrieve the custom charges for in
989
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
990
+ */
991
+ startDate?: Date;
992
+ /**
993
+ * End of the period you want to retrieve the custom charges for in
994
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
995
+ */
996
+ endDate?: Date;
997
+ }
998
+ interface GetMeteredBillingChargesResponse {
999
+ /** List of retrieved custom charges. */
1000
+ charges?: Charge[];
1001
+ }
1002
+ interface Charge {
1003
+ /** ID of the custom charge. The ID consists of 64 characters. */
1004
+ _id?: string | null;
1005
+ /** Description of the custom charge. */
1006
+ description?: string;
1007
+ /**
1008
+ * Charge amount.
1009
+ *
1010
+ * Min: `0.50`
1011
+ */
1012
+ amount?: string;
1013
+ }
1014
+ interface MessageEnvelope {
1015
+ /** App instance ID. */
1016
+ instanceId?: string | null;
1017
+ /** Event type. */
1018
+ eventType?: string;
1019
+ /** The identification type and identity data. */
1020
+ identity?: IdentificationData;
1021
+ /** Stringify payload. */
1022
+ data?: string;
1023
+ }
1024
+ interface IdentificationData extends IdentificationDataIdOneOf {
1025
+ /** ID of a site visitor that has not logged in to the site. */
1026
+ anonymousVisitorId?: string;
1027
+ /** ID of a site visitor that has logged in to the site. */
1028
+ memberId?: string;
1029
+ /** ID of a Wix user (site owner, contributor, etc.). */
1030
+ wixUserId?: string;
1031
+ /** ID of an app. */
1032
+ appId?: string;
1033
+ /** @readonly */
1034
+ identityType?: WebhookIdentityType;
1035
+ }
1036
+ /** @oneof */
1037
+ interface IdentificationDataIdOneOf {
1038
+ /** ID of a site visitor that has not logged in to the site. */
1039
+ anonymousVisitorId?: string;
1040
+ /** ID of a site visitor that has logged in to the site. */
1041
+ memberId?: string;
1042
+ /** ID of a Wix user (site owner, contributor, etc.). */
1043
+ wixUserId?: string;
1044
+ /** ID of an app. */
1045
+ appId?: string;
1046
+ }
1047
+ declare enum WebhookIdentityType {
1048
+ UNKNOWN = "UNKNOWN",
1049
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1050
+ MEMBER = "MEMBER",
1051
+ WIX_USER = "WIX_USER",
1052
+ APP = "APP"
1053
+ }
844
1054
  interface GetUrlResponseNonNullableFields {
845
1055
  checkoutUrl: string;
846
1056
  }
@@ -885,49 +1095,39 @@ interface GetUrlOptions {
885
1095
  couponCode?: string | null;
886
1096
  }
887
1097
 
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>;
1098
+ declare function createRESTModule$1<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
923
1099
 
924
- declare const getUrl: BuildRESTFunction$1<typeof getUrl$1>;
925
- declare const getPurchaseHistory: BuildRESTFunction$1<typeof getPurchaseHistory$1>;
1100
+ declare const getUrl: ReturnType<typeof createRESTModule$1<typeof publicGetUrl>>;
1101
+ declare const getPurchaseHistory: ReturnType<typeof createRESTModule$1<typeof publicGetPurchaseHistory>>;
926
1102
 
1103
+ type context$1_Charge = Charge;
1104
+ type context$1_ChargeOverride = ChargeOverride;
1105
+ type context$1_GetMeteredBillingChargesRequest = GetMeteredBillingChargesRequest;
1106
+ type context$1_GetMeteredBillingChargesResponse = GetMeteredBillingChargesResponse;
1107
+ type context$1_GetPurchaseHistoryRequest = GetPurchaseHistoryRequest;
1108
+ type context$1_GetPurchaseHistoryResponse = GetPurchaseHistoryResponse;
1109
+ type context$1_GetPurchaseHistoryResponseNonNullableFields = GetPurchaseHistoryResponseNonNullableFields;
1110
+ type context$1_GetSitePaymentMethodsStatusRequest = GetSitePaymentMethodsStatusRequest;
1111
+ type context$1_GetSitePaymentMethodsStatusResponse = GetSitePaymentMethodsStatusResponse;
1112
+ type context$1_GetUrlOptions = GetUrlOptions;
1113
+ type context$1_GetUrlRequest = GetUrlRequest;
1114
+ type context$1_GetUrlResponse = GetUrlResponse;
1115
+ type context$1_GetUrlResponseNonNullableFields = GetUrlResponseNonNullableFields;
1116
+ type context$1_IdentificationData = IdentificationData;
1117
+ type context$1_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
1118
+ type context$1_InvoiceStatus = InvoiceStatus;
1119
+ declare const context$1_InvoiceStatus: typeof InvoiceStatus;
1120
+ type context$1_InvoiceStatusUpdate = InvoiceStatusUpdate;
1121
+ type context$1_MessageEnvelope = MessageEnvelope;
1122
+ type context$1_PaymentCycle = PaymentCycle;
1123
+ declare const context$1_PaymentCycle: typeof PaymentCycle;
1124
+ type context$1_PurchasedItem = PurchasedItem;
1125
+ type context$1_WebhookIdentityType = WebhookIdentityType;
1126
+ declare const context$1_WebhookIdentityType: typeof WebhookIdentityType;
927
1127
  declare const context$1_getPurchaseHistory: typeof getPurchaseHistory;
928
1128
  declare const context$1_getUrl: typeof getUrl;
929
1129
  declare namespace context$1 {
930
- export { context$1_getPurchaseHistory as getPurchaseHistory, context$1_getUrl as getUrl };
1130
+ export { type context$1_Charge as Charge, type context$1_ChargeOverride as ChargeOverride, type context$1_GetMeteredBillingChargesRequest as GetMeteredBillingChargesRequest, type context$1_GetMeteredBillingChargesResponse as GetMeteredBillingChargesResponse, type context$1_GetPurchaseHistoryRequest as GetPurchaseHistoryRequest, type context$1_GetPurchaseHistoryResponse as GetPurchaseHistoryResponse, type context$1_GetPurchaseHistoryResponseNonNullableFields as GetPurchaseHistoryResponseNonNullableFields, type context$1_GetSitePaymentMethodsStatusRequest as GetSitePaymentMethodsStatusRequest, type context$1_GetSitePaymentMethodsStatusResponse as GetSitePaymentMethodsStatusResponse, type context$1_GetUrlOptions as GetUrlOptions, type context$1_GetUrlRequest as GetUrlRequest, type context$1_GetUrlResponse as GetUrlResponse, type context$1_GetUrlResponseNonNullableFields as GetUrlResponseNonNullableFields, type context$1_IdentificationData as IdentificationData, type context$1_IdentificationDataIdOneOf as IdentificationDataIdOneOf, context$1_InvoiceStatus as InvoiceStatus, type context$1_InvoiceStatusUpdate as InvoiceStatusUpdate, type context$1_MessageEnvelope as MessageEnvelope, context$1_PaymentCycle as PaymentCycle, type context$1_PurchasedItem as PurchasedItem, context$1_WebhookIdentityType as WebhookIdentityType, context$1_getPurchaseHistory as getPurchaseHistory, context$1_getUrl as getUrl };
931
1131
  }
932
1132
 
933
1133
  /** Embedded script data */
@@ -937,15 +1137,44 @@ interface ScriptProperties {
937
1137
  /** Whether script is disabled or not, defaults to false (not disabled) */
938
1138
  disabled?: boolean;
939
1139
  }
1140
+ interface EmbedScriptRequest {
1141
+ /** Details of the script to embed. */
1142
+ properties: ScriptProperties;
1143
+ /** ID of the corresponding embedded script component. */
1144
+ componentId?: string | null;
1145
+ }
940
1146
  interface EmbedScriptResponse {
941
1147
  /** Details of the embedded script. */
942
1148
  properties?: ScriptProperties;
943
1149
  }
1150
+ interface GetEmbeddedScriptRequest {
1151
+ /** Component ID of the embedded script to retrieve. */
1152
+ componentId?: string | null;
1153
+ }
1154
+ interface GetEmbeddedScriptResponse {
1155
+ /** Details of the retrieved embedded script. */
1156
+ properties?: ScriptProperties;
1157
+ }
1158
+ interface EmbedScriptByInstanceIdRequest {
1159
+ instanceId?: string;
1160
+ /** Parameters to embed */
1161
+ properties?: ScriptProperties;
1162
+ componentId?: string | null;
1163
+ }
1164
+ interface GetEmbeddedScriptByInstanceIdRequest {
1165
+ instanceId?: string;
1166
+ componentId?: string | null;
1167
+ }
944
1168
  interface EmbedScriptResponseNonNullableFields {
945
1169
  properties?: {
946
1170
  disabled: boolean;
947
1171
  };
948
1172
  }
1173
+ interface GetEmbeddedScriptResponseNonNullableFields {
1174
+ properties?: {
1175
+ disabled: boolean;
1176
+ };
1177
+ }
949
1178
  interface EmbedScriptOptions {
950
1179
  /** ID of the corresponding embedded script component. */
951
1180
  componentId?: string | null;
@@ -955,51 +1184,26 @@ interface GetEmbeddedScriptOptions {
955
1184
  componentId?: string | null;
956
1185
  }
957
1186
 
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
- }>;
1187
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
995
1188
 
996
- declare const embedScript: BuildRESTFunction<typeof embedScript$1>;
997
- declare const getEmbeddedScript: BuildRESTFunction<typeof getEmbeddedScript$1>;
1189
+ declare const embedScript: ReturnType<typeof createRESTModule<typeof publicEmbedScript>>;
1190
+ declare const getEmbeddedScript: ReturnType<typeof createRESTModule<typeof publicGetEmbeddedScript>>;
998
1191
 
1192
+ type context_EmbedScriptByInstanceIdRequest = EmbedScriptByInstanceIdRequest;
1193
+ type context_EmbedScriptOptions = EmbedScriptOptions;
1194
+ type context_EmbedScriptRequest = EmbedScriptRequest;
1195
+ type context_EmbedScriptResponse = EmbedScriptResponse;
1196
+ type context_EmbedScriptResponseNonNullableFields = EmbedScriptResponseNonNullableFields;
1197
+ type context_GetEmbeddedScriptByInstanceIdRequest = GetEmbeddedScriptByInstanceIdRequest;
1198
+ type context_GetEmbeddedScriptOptions = GetEmbeddedScriptOptions;
1199
+ type context_GetEmbeddedScriptRequest = GetEmbeddedScriptRequest;
1200
+ type context_GetEmbeddedScriptResponse = GetEmbeddedScriptResponse;
1201
+ type context_GetEmbeddedScriptResponseNonNullableFields = GetEmbeddedScriptResponseNonNullableFields;
1202
+ type context_ScriptProperties = ScriptProperties;
999
1203
  declare const context_embedScript: typeof embedScript;
1000
1204
  declare const context_getEmbeddedScript: typeof getEmbeddedScript;
1001
1205
  declare namespace context {
1002
- export { context_embedScript as embedScript, context_getEmbeddedScript as getEmbeddedScript };
1206
+ export { type context_EmbedScriptByInstanceIdRequest as EmbedScriptByInstanceIdRequest, type context_EmbedScriptOptions as EmbedScriptOptions, type context_EmbedScriptRequest as EmbedScriptRequest, type context_EmbedScriptResponse as EmbedScriptResponse, type context_EmbedScriptResponseNonNullableFields as EmbedScriptResponseNonNullableFields, type context_GetEmbeddedScriptByInstanceIdRequest as GetEmbeddedScriptByInstanceIdRequest, type context_GetEmbeddedScriptOptions as GetEmbeddedScriptOptions, type context_GetEmbeddedScriptRequest as GetEmbeddedScriptRequest, type context_GetEmbeddedScriptResponse as GetEmbeddedScriptResponse, type context_GetEmbeddedScriptResponseNonNullableFields as GetEmbeddedScriptResponseNonNullableFields, type context_ScriptProperties as ScriptProperties, context_embedScript as embedScript, context_getEmbeddedScript as getEmbeddedScript };
1003
1207
  }
1004
1208
 
1005
1209
  export { context$3 as appInstances, context$4 as appPlans, context$2 as biEvents, context$1 as billing, context as embeddedScripts };
@@ -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;