import { NonNullablePaths } from '@wix/sdk-types'; /** * An app instance is a specific occurrence of an app on a Wix site. * When a Wix user installs an app, a unique instance is generated for that * specific site. Use the `instanceId` to keep track of the individual data * associated with each app instance. */ interface AppInstance { /** * App instance ID. Useful to keep track of the * data that's associated with the specific instance of your app * installed on a Wix site. */ instanceId?: string; /** App name, as you entered it in the App Dashboard. */ appName?: string; /** Version of your app that's installed on the Wix site. */ appVersion?: string | null; /** * Whether the Wix user has installed a free or paid version of your app * on their site. */ isFree?: boolean; /** * Billing information for the app instance. Available only in case * `{"isFree": false}`. */ billing?: BillingInfo; /** * List of [permissions](https://dev.wix.com/docs/build-apps/developer-tools/developers-center/example-app-walkthrough/build-an-app#4-add-permissions) * that the Wix user has granted your app. You set the list of permissions that * your app requires from the Wix user in your app's Permissions page. */ permissions?: string[]; /** Plans available to this app instance. */ availablePlans?: AvailablePlan[]; /** * ID of the Wix site from which the instance of your app has been cloned. * * All visual settings of the Wix site and app data are duplicated during the * cloning process. Wix also notifies you in case there is any additional * external functionality for the original site. */ originInstanceId?: string | null; /** * __Deprecated__. This parameter will be removed on March 30, 2023. Use * `copiedFromTemplate` instead. * @deprecated */ isOriginSiteTemplate?: boolean; /** Whether this app instance was created when another Wix site was cloned. */ copiedFromTemplate?: boolean; /** Whether this app instance includes a free trial that hasn't started yet. */ freeTrialAvailable?: boolean; } interface BillingInfo { /** Name of the package that the site owner has paid for. */ packageName?: string; /** * Interval of the billing cycle. `ONE_TIME` indicates that the Wix user has * made a single upfront payment without any automatic subscription renewal. * This is primarily for usage credits (for example, 5 SMS) but may occasionally apply * to a one-time setup for the app. */ billingCycle?: PaymentCycleWithLiterals; /** * Date and time the Wix user purchased the app's paid plan or began their free trial. In * `YYYY-MM-DDThh:mm:ss.sssZ` format. */ timeStamp?: string; /** * Date and time the app's current billing cycle ends in * `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for yearly and * multi-yearly plans. */ expirationDate?: string | null; /** * Whether the app's subscription automatically renews at the end of the * current billing cycle. */ autoRenewing?: boolean | null; /** ID of the invoice for the current billing cycle. */ invoiceId?: string | null; /** * Information about any discounts applied to the app instance's current billing cycle. * If the site owners applied a developer coupon or Wix Voucher * when installing the paid version of your app, this field holds the coupon's * name or `“Wix discount coupon”`. Site owners may receive a Wix Voucher when * upgrading their Wix subscription. If there is no discount for the * current billing cycle, the field is an empty string. */ source?: string | null; /** Information about the free trial applied, if relevant. */ freeTrialInfo?: FreeTrialInfo; } declare enum PaymentCycle { NO_CYCLE = "NO_CYCLE", MONTHLY = "MONTHLY", YEARLY = "YEARLY", ONE_TIME = "ONE_TIME", TWO_YEARS = "TWO_YEARS", THREE_YEARS = "THREE_YEARS", FOUR_YEARS = "FOUR_YEARS", FIVE_YEARS = "FIVE_YEARS" } /** @enumType */ type PaymentCycleWithLiterals = PaymentCycle | 'NO_CYCLE' | 'MONTHLY' | 'YEARLY' | 'ONE_TIME' | 'TWO_YEARS' | 'THREE_YEARS' | 'FOUR_YEARS' | 'FIVE_YEARS'; interface FreeTrialInfo { /** * Current free trial status. * @readonly */ status?: FreeTrialStatusWithLiterals; /** * When the free trial has ended. Populated only once the free trial is over. * @readonly */ endDate?: Date | null; } declare enum FreeTrialStatus { /** The free trial is currently in progress. */ IN_PROGRESS = "IN_PROGRESS", /** The free trial has ended. */ ENDED = "ENDED", /** No free trial was applied, as none was available. */ NOT_AVAILABLE = "NOT_AVAILABLE" } /** @enumType */ type FreeTrialStatusWithLiterals = FreeTrialStatus | 'IN_PROGRESS' | 'ENDED' | 'NOT_AVAILABLE'; interface AvailablePlan { /** Package name of the available plan. */ packageName?: string; /** Source of the available plan. Can be a bundle or 3rd-party app. */ source?: string; } interface AppInstalled { /** * Unique identifier of the app within the website. * @format GUID */ appId?: string; /** * 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)). * @format GUID */ originInstanceId?: string | null; } interface AppRemoved { /** * Unique identifier of the app within the website. * @format GUID */ appId?: string; } interface PaidPlanPurchased { /** Date and time of purchase. */ operationTimeStamp?: Date | null; /** * Purchased app plan. * @maxLength 100 */ vendorProductId?: string; /** Selected payment cycle. */ cycle?: PaymentCycleWithLiterals; /** Plan expiration date. */ expiresOn?: Date | null; /** * Coupon applied to purchase (if relevant). * @maxLength 150 */ couponName?: string | null; /** * Invoice ID. * @maxLength 50 */ invoiceId?: string | null; } interface PaidPlanChanged { /** Date and time of change. */ operationTimeStamp?: Date | null; /** * Newly purchased app plan. * @maxLength 100 */ vendorProductId?: string; /** Newly selected payment cycle. */ cycle?: PaymentCycleWithLiterals; /** * Previous app plan. * @maxLength 100 */ previousVendorProductId?: string | null; /** Previous payment cycle. */ previousCycle?: PaymentCycleWithLiterals; /** * Coupon applied to purchase (if relevant). * @maxLength 150 */ couponName?: string | null; /** * Invoice ID. * @maxLength 50 */ invoiceId?: string | null; } interface PaidPlanAutoRenewalCancelled { /** Date and time of auto-renewal cancellation. */ operationTimeStamp?: Date | null; /** * Current app plan. * @maxLength 100 */ vendorProductId?: string; /** Current payment cycle. */ cycle?: PaymentCycleWithLiterals; /** * Supported values: `UNKNOWN_CANCELLATION_TYPE_ERROR_STATE`, `USER_CANCEL`, `FAILED_PAYMENT`, `TRANSFER_CANCELLATION_REASON`. Reason provided by app for cancellation (if relevant). * @maxLength 100 */ cancelReason?: string | null; /** * Reason provided by site owner for cancellation (if relevant). * @maxLength 150 */ userReason?: string | null; /** * Cancellation type. * @maxLength 100 */ subscriptionCancellationType?: string | null; /** Whether the cancellation occurred during a free trial. */ cancelledDuringFreeTrial?: FreeTrialPeriodWithLiterals; } declare enum FreeTrialPeriod { /** During a free trial period. */ DURING_FREE_TRIAL = "DURING_FREE_TRIAL", /** Not during a free trial period. */ NOT_DURING_FREE_TRIAL = "NOT_DURING_FREE_TRIAL" } /** @enumType */ type FreeTrialPeriodWithLiterals = FreeTrialPeriod | 'DURING_FREE_TRIAL' | 'NOT_DURING_FREE_TRIAL'; interface PlanTransferred { /** Date and time of transfer. */ operationTimeStamp?: Date | null; /** * Current app plan. * @maxLength 100 */ vendorProductId?: string; /** Selected payment cycle. */ cycle?: PaymentCycleWithLiterals; /** * Invoice ID. * @maxLength 50 */ invoiceId?: string | null; } interface PlanReactivated { /** Date and time of reactivation. */ operationTimeStamp?: Date | null; /** * Current app plan. * @maxLength 100 */ vendorProductId?: string; /** Selected payment cycle. */ cycle?: PaymentCycleWithLiterals; /** Plan expiration date. */ expiresOn?: Date | null; /** * Invoice ID. * @maxLength 50 */ invoiceId?: string | null; /** Reason for reactivation. */ reason?: ReactivationReasonWithLiterals; } declare enum ReactivationReason { /** Reactivation reason unknown. */ REACTIVATION_REASON_UNKNOWN = "REACTIVATION_REASON_UNKNOWN", /** The subscription's auto-renewal is turned on. */ AUTO_RENEW_TURNED_ON = "AUTO_RENEW_TURNED_ON" } /** @enumType */ type ReactivationReasonWithLiterals = ReactivationReason | 'REACTIVATION_REASON_UNKNOWN' | 'AUTO_RENEW_TURNED_ON'; interface PlanConvertedToPaid { /** Date and time of conversion to paid subscription (free-trial ended). */ operationTimeStamp?: Date | null; /** * Current app plan. * @maxLength 100 */ vendorProductId?: string; /** Selected payment cycle. */ cycle?: PaymentCycleWithLiterals; /** Plan expiration date. */ expiresOn?: Date | null; } interface GetAppInstanceRequest { } interface GetAppInstanceResponse { /** Retrieved app instance. */ instance?: AppInstance; /** Information about the site. */ site?: SiteInfo; } interface SiteInfo { /** Display name of the site. */ siteDisplayName?: string | null; /** * 2-letter language code of the site's locale in * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */ locale?: string; /** * 3-letter currency code for the site's billing in * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. */ paymentCurrency?: string; /** Information about the site's supported languages. */ multilingual?: Multilingual; /** URL of the site. Available only when the site has been published. */ url?: string | null; /** Description of the site. */ description?: string | null; /** Apps made by Wix that are installed on the site. */ installedWixApps?: string[]; /** * > **Deprecation Notice:** This parameter will be removed on June 30, 2022. Use `ownerInfo` instead. * @format EMAIL * @deprecated */ ownerEmail?: string | null; /** * Information about the site's Wix user. Available only when calling * _Get App Instance_ with the __Read Site Owner Email__ permission scope. */ ownerInfo?: OwnerInfo; /** Site ID. */ siteId?: string; /** * Type of Wix user who owns the site. * Available only when calling _Get App Instance_ with the __Read Site User Type__ permission scope. * Supported values: `"Channel DIY"`, `"Channel DIFM"`, `"Enterprise"`. */ siteUserType?: string | null; } interface Multilingual { /** Whether the site supports more than a single language. */ isMultiLingual?: boolean; /** List of supported languages. Returned only when `{"isMultiLingual": true}`. */ supportedLanguages?: SupportedLanguage[]; } interface SupportedLanguage { /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */ languageCode?: string; /** Locale. */ locale?: Locale; /** Whether the supported language is the primary language for the site. */ isPrimary?: boolean; /** Language icon. */ countryCode?: string; /** How the language will be resolved. For internal use. */ resolutionMethod?: ResolutionMethodWithLiterals; /** Whether the supported language is the primary language for site visitors. */ isVisitorPrimary?: boolean | null; } interface Locale { /** Two-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */ languageCode?: string; /** Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. */ country?: string; } declare enum ResolutionMethod { QUERY_PARAM = "QUERY_PARAM", SUBDOMAIN = "SUBDOMAIN", SUBDIRECTORY = "SUBDIRECTORY" } /** @enumType */ type ResolutionMethodWithLiterals = ResolutionMethod | 'QUERY_PARAM' | 'SUBDOMAIN' | 'SUBDIRECTORY'; interface OwnerInfo { /** * Wix user's email address. Identical to the their login email. * @format EMAIL */ email?: string; /** * Supported values: `VERIFIED_OPT_IN`, `VERIFIED_OPT_OUT`, * `NOT_VERIFIED_OPT_IN`, `NOT_VERIFIED_OPT_OUT`. * * Whether the Wix user has verified their email and whether they have chosen * to receive email notifications from Wix. */ emailStatus?: string; } interface GetAppInstanceByInstanceIdRequest { /** * ID of the app instance to retrieve. * @format GUID */ instanceId?: string; } interface MessageEnvelope { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; /** Details related to the account */ accountInfo?: AccountInfo; } interface IdentificationData extends IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; /** @readonly */ identityType?: WebhookIdentityTypeWithLiterals; } /** @oneof */ interface IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; } declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } /** @enumType */ type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP'; interface AccountInfo { /** * ID of the Wix account associated with the event. * @format GUID */ accountId?: string | null; /** * ID of the parent Wix account. Only included when accountId belongs to a child account. * @format GUID */ parentAccountId?: string | null; /** * ID of the Wix site associated with the event. Only included when the event is tied to a specific site. * @format GUID */ siteId?: string | null; } interface BaseEventMetadata { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Details related to the account */ accountInfo?: AccountInfo; } interface AppInstanceInstalledEnvelope { data: AppInstalled; metadata: BaseEventMetadata; } /** * Triggered when an instance of your app is installed on a Wix site. * @permissionScope Manage Your App * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP * @permissionScope Read site, business, and email details * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @webhook * @eventType AppInstalled * @serviceIdentifier com.wixpress.market.aim.api.AppInstanceService * @slug installed */ declare function onAppInstanceInstalled(handler: (event: AppInstanceInstalledEnvelope) => void | Promise): void; interface AppInstanceRemovedEnvelope { data: AppRemoved; metadata: BaseEventMetadata; } /** * Triggered when an instance of your app is uninstalled from a Wix site. * @permissionScope Manage Your App * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP * @permissionScope Read site, business, and email details * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @webhook * @eventType AppRemoved * @serviceIdentifier com.wixpress.market.aim.api.AppInstanceService * @slug removed */ declare function onAppInstanceRemoved(handler: (event: AppInstanceRemovedEnvelope) => void | Promise): void; interface AppInstancePaidPlanAutoRenewalCancelledEnvelope { data: PaidPlanAutoRenewalCancelled; metadata: BaseEventMetadata; } /** * Triggered when a Wix user either cancels a paid plan for your app, or cancels the plan's auto-renewal. The * Wix user can continue to use your app until the end of the current billing * cycle. * @permissionScope Manage Your App * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP * @permissionScope Read site, business, and email details * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @webhook * @eventType PaidPlanAutoRenewalCancelled * @serviceIdentifier com.wixpress.market.aim.api.AppInstanceService * @slug paid_plan_auto_renewal_cancelled */ declare function onAppInstancePaidPlanAutoRenewalCancelled(handler: (event: AppInstancePaidPlanAutoRenewalCancelledEnvelope) => void | Promise): void; interface AppInstancePaidPlanChangedEnvelope { data: PaidPlanChanged; metadata: BaseEventMetadata; } /** * Triggered when a Wix user upgrades or downgrades their plan for your app. * @permissionScope Manage Your App * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP * @permissionScope Read site, business, and email details * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @webhook * @eventType PaidPlanChanged * @serviceIdentifier com.wixpress.market.aim.api.AppInstanceService * @slug paid_plan_changed */ declare function onAppInstancePaidPlanChanged(handler: (event: AppInstancePaidPlanChangedEnvelope) => void | Promise): void; interface AppInstancePaidPlanPurchasedEnvelope { data: PaidPlanPurchased; metadata: BaseEventMetadata; } /** * Triggered when a Wix user purchases a paid plan for your app. * @permissionScope Manage Your App * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP * @permissionScope Read site, business, and email details * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @webhook * @eventType PaidPlanPurchased * @serviceIdentifier com.wixpress.market.aim.api.AppInstanceService * @slug paid_plan_purchased */ declare function onAppInstancePaidPlanPurchased(handler: (event: AppInstancePaidPlanPurchasedEnvelope) => void | Promise): void; interface AppInstancePlanConvertedToPaidEnvelope { data: PlanConvertedToPaid; metadata: BaseEventMetadata; } /** * Triggered when a Wix user reaches the end of a free-trial period and is charged successfully. * @permissionScope Manage Your App * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP * @permissionScope Read site, business, and email details * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @webhook * @eventType PlanConvertedToPaid * @serviceIdentifier com.wixpress.market.aim.api.AppInstanceService * @slug plan_converted_to_paid */ declare function onAppInstancePlanConvertedToPaid(handler: (event: AppInstancePlanConvertedToPaidEnvelope) => void | Promise): void; interface AppInstancePlanReactivatedEnvelope { data: PlanReactivated; metadata: BaseEventMetadata; } /** * Triggered when auto-renewal is turned on for a paid plan. * @permissionScope Manage Your App * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP * @permissionScope Read site, business, and email details * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @webhook * @eventType PlanReactivated * @serviceIdentifier com.wixpress.market.aim.api.AppInstanceService * @slug plan_reactivated */ declare function onAppInstancePlanReactivated(handler: (event: AppInstancePlanReactivatedEnvelope) => void | Promise): void; interface AppInstancePlanTransferredEnvelope { data: PlanTransferred; metadata: BaseEventMetadata; } /** * Triggered when a paid plan for your app is transferred to a different Wix account. * @permissionScope Manage Your App * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP * @permissionScope Read site, business, and email details * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @webhook * @eventType PlanTransferred * @serviceIdentifier com.wixpress.market.aim.api.AppInstanceService * @slug plan_transferred */ declare function onAppInstancePlanTransferred(handler: (event: AppInstancePlanTransferredEnvelope) => void | Promise): void; /** * Retrieves data about the instance of your app that's installed on a Wix * site and data about the site itself. For example, to check whether the Wix user has installed a free or paid version of your app, * or to check which apps made by Wix are installed on the site. * * You must authenticate this method [as a Wix app](https://dev.wix.com/docs/build-apps/develop-your-app/access/authentication/authenticate-using-oauth#step-2--make-an-authenticated-api-request). * * To retrieve `site.ownerInfo` in the response, you must * have the __READ SITE OWNER EMAIL__ permission scope in addition to * __MANAGE YOUR APP__. * @public * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE * @applicableIdentity APP * @fqn com.wixpress.market.aim.api.AppInstanceService.GetAppInstance */ declare function getAppInstance(): Promise>; export { type AccountInfo, type AppInstalled, type AppInstance, type AppInstanceInstalledEnvelope, type AppInstancePaidPlanAutoRenewalCancelledEnvelope, type AppInstancePaidPlanChangedEnvelope, type AppInstancePaidPlanPurchasedEnvelope, type AppInstancePlanConvertedToPaidEnvelope, type AppInstancePlanReactivatedEnvelope, type AppInstancePlanTransferredEnvelope, type AppInstanceRemovedEnvelope, type AppRemoved, type AvailablePlan, type BaseEventMetadata, type BillingInfo, type FreeTrialInfo, FreeTrialPeriod, type FreeTrialPeriodWithLiterals, FreeTrialStatus, type FreeTrialStatusWithLiterals, type GetAppInstanceByInstanceIdRequest, type GetAppInstanceRequest, type GetAppInstanceResponse, type IdentificationData, type IdentificationDataIdOneOf, type Locale, type MessageEnvelope, type Multilingual, type OwnerInfo, type PaidPlanAutoRenewalCancelled, type PaidPlanChanged, type PaidPlanPurchased, PaymentCycle, type PaymentCycleWithLiterals, type PlanConvertedToPaid, type PlanReactivated, type PlanTransferred, ReactivationReason, type ReactivationReasonWithLiterals, ResolutionMethod, type ResolutionMethodWithLiterals, type SiteInfo, type SupportedLanguage, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, getAppInstance, onAppInstanceInstalled, onAppInstancePaidPlanAutoRenewalCancelled, onAppInstancePaidPlanChanged, onAppInstancePaidPlanPurchased, onAppInstancePlanConvertedToPaid, onAppInstancePlanReactivated, onAppInstancePlanTransferred, onAppInstanceRemoved };