@wix/auto_sdk_app-management_billing 1.0.37 → 1.0.39
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/build/cjs/index.d.ts +1 -1
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +9 -5
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +7 -5
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +1 -1
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +9 -5
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +7 -5
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +1 -1
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +9 -5
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +7 -5
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.d.mts +1 -1
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +9 -5
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +7 -5
- package/build/internal/es/meta.mjs.map +1 -1
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
|
|
2
2
|
import { GetUrlOptions, GetUrlResponse, GetPurchaseHistoryResponse, GetMeteredBillingChargesOptions, GetMeteredBillingChargesResponse, PurchasedItemInvoiceStatusUpdatedEnvelope } from './index.typings.js';
|
|
3
|
-
export {
|
|
3
|
+
export { AccountInfo, BaseEventMetadata, Charge, ChargeOverride, GetMeteredBillingChargesRequest, GetPurchaseHistoryRequest, GetSitePaymentMethodsStatusRequest, GetSitePaymentMethodsStatusResponse, GetUrlRequest, IdentificationData, IdentificationDataIdOneOf, InvoiceStatus, InvoiceStatusUpdated, InvoiceStatusWithLiterals, MessageEnvelope, PaymentCycle, PaymentCycleWithLiterals, PurchasedItem, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.js';
|
|
4
4
|
|
|
5
5
|
declare function getUrl$1(httpClient: HttpClient): GetUrlSignature;
|
|
6
6
|
interface GetUrlSignature {
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../src/devcenter-checkout-v1-purchased-item-billing.public.ts","../../src/devcenter-checkout-v1-purchased-item-billing.universal.ts","../../src/devcenter-checkout-v1-purchased-item-billing.http.ts","../../src/devcenter-checkout-v1-purchased-item-billing.context.ts"],"sourcesContent":["export * from './src/devcenter-checkout-v1-purchased-item-billing.context.js';\n","import { renameKeysFromRESTResponseToSDKResponse } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { EventDefinition, HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n GetMeteredBillingChargesOptions,\n GetMeteredBillingChargesResponse,\n GetPurchaseHistoryResponse,\n GetUrlOptions,\n GetUrlResponse,\n PurchasedItemInvoiceStatusUpdatedEnvelope,\n getMeteredBillingCharges as universalGetMeteredBillingCharges,\n getPurchaseHistory as universalGetPurchaseHistory,\n getUrl as universalGetUrl,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/app-management' };\n\nexport function getUrl(httpClient: HttpClient): GetUrlSignature {\n return (productId: string, options?: GetUrlOptions) =>\n universalGetUrl(\n productId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetUrlSignature {\n /**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n * @param - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n */\n (productId: string, options?: GetUrlOptions): Promise<\n NonNullablePaths<GetUrlResponse, `checkoutUrl`, 2>\n >;\n}\n\nexport function getPurchaseHistory(\n httpClient: HttpClient\n): GetPurchaseHistorySignature {\n return () =>\n universalGetPurchaseHistory(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetPurchaseHistorySignature {\n /**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n */\n (): Promise<\n NonNullablePaths<\n GetPurchaseHistoryResponse,\n | `purchases`\n | `purchases.${number}.productId`\n | `purchases.${number}.price`\n | `purchases.${number}.currency`\n | `purchases.${number}.billingCycle`,\n 4\n >\n >;\n}\n\nexport function getMeteredBillingCharges(\n httpClient: HttpClient\n): GetMeteredBillingChargesSignature {\n return (options?: GetMeteredBillingChargesOptions) =>\n universalGetMeteredBillingCharges(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetMeteredBillingChargesSignature {\n /**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\n (options?: GetMeteredBillingChargesOptions): Promise<\n NonNullablePaths<\n GetMeteredBillingChargesResponse,\n `charges` | `charges.${number}.description` | `charges.${number}.amount`,\n 4\n >\n >;\n}\n\nexport const onPurchasedItemInvoiceStatusUpdated = EventDefinition(\n 'InvoiceStatusUpdated',\n false,\n (event: PurchasedItemInvoiceStatusUpdatedEnvelope) =>\n renameKeysFromRESTResponseToSDKResponse(event)\n)<PurchasedItemInvoiceStatusUpdatedEnvelope>();\n\nexport {\n AccountDetails,\n BaseEventMetadata,\n Charge,\n ChargeOverride,\n GetMeteredBillingChargesOptions,\n GetMeteredBillingChargesRequest,\n GetMeteredBillingChargesResponse,\n GetPurchaseHistoryRequest,\n GetPurchaseHistoryResponse,\n GetSitePaymentMethodsStatusRequest,\n GetSitePaymentMethodsStatusResponse,\n GetUrlOptions,\n GetUrlRequest,\n GetUrlResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n InvoiceStatus,\n InvoiceStatusUpdated,\n MessageEnvelope,\n PaymentCycle,\n PurchasedItem,\n PurchasedItemInvoiceStatusUpdatedEnvelope,\n WebhookIdentityType,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixDevcenterCheckoutV1PurchasedItem from './devcenter-checkout-v1-purchased-item-billing.http.js';\n\nexport interface PurchasedItem {\n /** ID of your app's paid plan. */\n productId?: string;\n /** Price of your app's paid plan. For example, `9.95`. */\n price?: string;\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n */\n currency?: string;\n /** Information about the billing cycle for your app's paid plan. */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * Date and time the site purchased your app's paid plan in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n dateCreated?: Date | null;\n}\n\nexport enum PaymentCycle {\n NO_CYCLE = 'NO_CYCLE',\n MONTHLY = 'MONTHLY',\n YEARLY = 'YEARLY',\n ONE_TIME = 'ONE_TIME',\n TWO_YEARS = 'TWO_YEARS',\n THREE_YEARS = 'THREE_YEARS',\n FOUR_YEARS = 'FOUR_YEARS',\n FIVE_YEARS = 'FIVE_YEARS',\n}\n\n/** @enumType */\nexport type PaymentCycleWithLiterals =\n | PaymentCycle\n | 'NO_CYCLE'\n | 'MONTHLY'\n | 'YEARLY'\n | 'ONE_TIME'\n | 'TWO_YEARS'\n | 'THREE_YEARS'\n | 'FOUR_YEARS'\n | 'FIVE_YEARS';\n\nexport interface InvoiceStatusUpdated {\n /** Invoice payment status. */\n status?: InvoiceStatusWithLiterals;\n /**\n * Wix Premium invoice ID.\n * @maxLength 50\n */\n invoiceId?: string;\n /**\n * App instance ID - a unique ID assigned to each app in each site.\n * @format GUID\n */\n instanceId?: string | null;\n /** Whether the invoice is for a single payment or for multiple, recurring payments. */\n recurring?: boolean;\n}\n\nexport enum InvoiceStatus {\n UNKNOWN_INVOICE_STATUS = 'UNKNOWN_INVOICE_STATUS',\n PAYMENT_FAILED = 'PAYMENT_FAILED',\n PAID = 'PAID',\n REFUNDED = 'REFUNDED',\n VOIDED = 'VOIDED',\n CHARGEDBACK = 'CHARGEDBACK',\n}\n\n/** @enumType */\nexport type InvoiceStatusWithLiterals =\n | InvoiceStatus\n | 'UNKNOWN_INVOICE_STATUS'\n | 'PAYMENT_FAILED'\n | 'PAID'\n | 'REFUNDED'\n | 'VOIDED'\n | 'CHARGEDBACK';\n\nexport interface GetUrlRequest {\n /**\n * ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n */\n productId: string;\n /**\n * URL for the Wix checkout page. Redirect Wix users to this URL after\n * they've successfully purchased a paid plan for your app.\n * @format WEB_URL\n */\n successUrl?: string | null;\n /**\n * Whether the checkout is for testing purposes only. Testing is mainly\n * relevant for in-app purchase flows. When `true`, Wix charges the site\n * owners an amount of `0.00`.\n *\n * Not supported for usage-based plans.\n */\n testCheckout?: boolean;\n /**\n * Information about the paid plan's billing cycle.\n *\n * Set to `MONTHLY` for usage-based plans.\n */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * 2-letter country code in\n * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)\n * format.\n *\n * Default: `\"US\"`\n */\n countryCode?: string | null;\n /**\n * 2-letter language code in\n * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `\"EN\"`\n */\n languageCode?: string | null;\n /** Coupon code for the paid plan. Available only in case there is a discount. */\n couponCode?: string | null;\n}\n\nexport interface ChargeOverride {\n /**\n * Override price. If you omit the override price, the default price\n * configured in the **Pricing** page of your app's dashboard is used.\n */\n price?: number;\n /**\n * Override 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n */\n currency?: string;\n}\n\nexport interface GetUrlResponse {\n /**\n * URL for the Wix checkout page.\n * @format WEB_URL\n */\n checkoutUrl?: string;\n /**\n * Token for the Wix checkout page. The token holds all data about the order\n * you're creating a checkout for. It's [signed](https://dev.wix.com/docs/api-reference/articles),\n * so you can verify that it comes from Wix.\n */\n token?: string | null;\n}\n\nexport interface GetPurchaseHistoryRequest {}\n\nexport interface GetPurchaseHistoryResponse {\n /** Retrieved purchases the Wix user has completed for you app. */\n purchases?: PurchasedItem[];\n}\n\nexport interface GetSitePaymentMethodsStatusRequest {}\n\nexport interface GetSitePaymentMethodsStatusResponse {\n /**\n * Whether at least 1 online payment method is enabled for the site.\n * Online payment methods include Wix Payments, Stripe, PayPal, and credit\n * cards.\n */\n onlineProviderEnabled?: boolean;\n /** Whether the site accepts offline payments. */\n offlineProviderEnabled?: boolean;\n /**\n * Whether [Wix Point of Sale](https://www.wix.com/pos) is enabled for the site.\n * This allows electronic payments to be made in person.\n */\n wixPosProviderEnabled?: boolean;\n /**\n * Whether the site has enabled at least 1 3rd-party point-of-sale\n * provider. This allows electronic payments to be made in person.\n */\n thirdPartyPosProviderEnabled?: boolean;\n}\n\nexport interface GetMeteredBillingChargesRequest {\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string | null;\n /**\n * Start of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n startDate?: Date | null;\n /**\n * End of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n endDate?: Date | null;\n}\n\nexport interface GetMeteredBillingChargesResponse {\n /** List of retrieved custom charges. */\n charges?: Charge[];\n}\n\nexport interface Charge {\n /** ID of the custom charge. The ID consists of 64 characters. */\n _id?: string | null;\n /** Description of the custom charge. */\n description?: string;\n /**\n * Charge amount.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n amount?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n\nexport interface AccountDetails {\n /**\n * ID of the account.\n * @format GUID\n */\n accountId?: string | null;\n /**\n * ID of the parent account.\n * @format GUID\n */\n parentAccountId?: string | null;\n /**\n * ID of the site, if applicable.\n * @format GUID\n */\n siteId?: string | null;\n}\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n}\n\nexport interface PurchasedItemInvoiceStatusUpdatedEnvelope {\n data: InvoiceStatusUpdated;\n metadata: BaseEventMetadata;\n}\n\n/**\n * Triggered when there is an update to the payment status of an invoice.\n * Charges made using the [Custom Charges service plugin](https://dev.wix.com/docs/rest/app-management/app-billing/custom-charges-service-plugin/introduction) may be based on usage.\n * Learn more about [usage-based charges](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model).\n * @permissionScope Manage Your App\n * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP\n * @permissionScope Read site, business, and email details\n * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @webhook\n * @eventType InvoiceStatusUpdated\n * @serviceIdentifier com.wixpress.market.aim.api.Checkout\n * @slug invoice_status_updated\n */\nexport declare function onPurchasedItemInvoiceStatusUpdated(\n handler: (\n event: PurchasedItemInvoiceStatusUpdatedEnvelope\n ) => void | Promise<void>\n): void;\n\n/**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n * @param productId - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n * @public\n * @requiredField productId\n * @permissionId WIX_DEVELOPERS.CREATE_CHECKOUT\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetUrl\n */\nexport async function getUrl(\n productId: string,\n options?: GetUrlOptions\n): Promise<NonNullablePaths<GetUrlResponse, `checkoutUrl`, 2>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n productId: productId,\n successUrl: options?.successUrl,\n testCheckout: options?.testCheckout,\n billingCycle: options?.billingCycle,\n countryCode: options?.countryCode,\n languageCode: options?.languageCode,\n couponCode: options?.couponCode,\n });\n\n const reqOpts = ambassadorWixDevcenterCheckoutV1PurchasedItem.getUrl(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n productId: '$[0]',\n successUrl: '$[1].successUrl',\n testCheckout: '$[1].testCheckout',\n billingCycle: '$[1].billingCycle',\n countryCode: '$[1].countryCode',\n languageCode: '$[1].languageCode',\n couponCode: '$[1].couponCode',\n },\n singleArgumentUnchanged: false,\n },\n ['productId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetUrlOptions {\n /**\n * URL for the Wix checkout page. Redirect Wix users to this URL after\n * they've successfully purchased a paid plan for your app.\n * @format WEB_URL\n */\n successUrl?: string | null;\n /**\n * Whether the checkout is for testing purposes only. Testing is mainly\n * relevant for in-app purchase flows. When `true`, Wix charges the site\n * owners an amount of `0.00`.\n *\n * Not supported for usage-based plans.\n */\n testCheckout?: boolean;\n /**\n * Information about the paid plan's billing cycle.\n *\n * Set to `MONTHLY` for usage-based plans.\n */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * 2-letter country code in\n * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)\n * format.\n *\n * Default: `\"US\"`\n */\n countryCode?: string | null;\n /**\n * 2-letter language code in\n * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `\"EN\"`\n */\n languageCode?: string | null;\n /** Coupon code for the paid plan. Available only in case there is a discount. */\n couponCode?: string | null;\n}\n\n/**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n * @public\n * @permissionId WIX_DEVELOPERS.APP_PURCHASE_HISTORY\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetPurchaseHistory\n */\nexport async function getPurchaseHistory(): Promise<\n NonNullablePaths<\n GetPurchaseHistoryResponse,\n | `purchases`\n | `purchases.${number}.productId`\n | `purchases.${number}.price`\n | `purchases.${number}.currency`\n | `purchases.${number}.billingCycle`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixDevcenterCheckoutV1PurchasedItem.getPurchaseHistory(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_DEVELOPERS.METERED_BILLING_CHARGES_READ\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetMeteredBillingCharges\n */\nexport async function getMeteredBillingCharges(\n options?: GetMeteredBillingChargesOptions\n): Promise<\n NonNullablePaths<\n GetMeteredBillingChargesResponse,\n `charges` | `charges.${number}.description` | `charges.${number}.amount`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n currency: options?.currency,\n startDate: options?.startDate,\n endDate: options?.endDate,\n });\n\n const reqOpts =\n ambassadorWixDevcenterCheckoutV1PurchasedItem.getMeteredBillingCharges(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n currency: '$[0].currency',\n startDate: '$[0].startDate',\n endDate: '$[0].endDate',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetMeteredBillingChargesOptions {\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string | null;\n /**\n * Start of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n startDate?: Date | null;\n /**\n * End of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n endDate?: Date | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiCheckoutUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_billing';\n\n/**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n */\nexport function getUrl(payload: object): RequestOptionsFactory<any> {\n function __getUrl({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [{ path: 'chargeOverride.price' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.market.aim.api.Checkout.GetUrl',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/checkout',\n data: serializedData,\n host,\n }),\n data: serializedData,\n };\n\n return metadata;\n }\n\n return __getUrl;\n}\n\n/**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n */\nexport function getPurchaseHistory(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPurchaseHistory({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.market.aim.api.Checkout.GetPurchaseHistory',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/checkout/history',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'purchases.dateCreated' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getPurchaseHistory;\n}\n\n/**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\nexport function getMeteredBillingCharges(\n payload: object\n): RequestOptionsFactory<any> {\n function __getMeteredBillingCharges({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'startDate' }, { path: 'endDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'GET' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.Checkout.GetMeteredBillingCharges',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/metered-billing-charges',\n data: serializedData,\n host,\n }),\n params: toURLSearchParams(serializedData),\n };\n\n return metadata;\n }\n\n return __getMeteredBillingCharges;\n}\n","import {\n getUrl as publicGetUrl,\n getPurchaseHistory as publicGetPurchaseHistory,\n getMeteredBillingCharges as publicGetMeteredBillingCharges,\n} from './devcenter-checkout-v1-purchased-item-billing.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { createEventModule } from '@wix/sdk-runtime/event-definition-modules';\nimport {\n BuildRESTFunction,\n MaybeContext,\n BuildEventDefinition,\n} from '@wix/sdk-types';\nimport { onPurchasedItemInvoiceStatusUpdated as publicOnPurchasedItemInvoiceStatusUpdated } from './devcenter-checkout-v1-purchased-item-billing.public.js';\n\nexport const getUrl: MaybeContext<\n BuildRESTFunction<typeof publicGetUrl> & typeof publicGetUrl\n> = /*#__PURE__*/ createRESTModule(publicGetUrl);\nexport const getPurchaseHistory: MaybeContext<\n BuildRESTFunction<typeof publicGetPurchaseHistory> &\n typeof publicGetPurchaseHistory\n> = /*#__PURE__*/ createRESTModule(publicGetPurchaseHistory);\nexport const getMeteredBillingCharges: MaybeContext<\n BuildRESTFunction<typeof publicGetMeteredBillingCharges> &\n typeof publicGetMeteredBillingCharges\n> = /*#__PURE__*/ createRESTModule(publicGetMeteredBillingCharges);\n/**\n * Triggered when there is an update to the payment status of an invoice.\n * Charges made using the [Custom Charges service plugin](https://dev.wix.com/docs/rest/app-management/app-billing/custom-charges-service-plugin/introduction) may be based on usage.\n * Learn more about [usage-based charges](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model).\n */\nexport const onPurchasedItemInvoiceStatusUpdated: BuildEventDefinition<\n typeof publicOnPurchasedItemInvoiceStatusUpdated\n> &\n typeof publicOnPurchasedItemInvoiceStatusUpdated = createEventModule(\n publicOnPurchasedItemInvoiceStatusUpdated\n);\n\nexport {\n PaymentCycle,\n InvoiceStatus,\n WebhookIdentityType,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\nexport {\n PurchasedItem,\n InvoiceStatusUpdated,\n GetUrlRequest,\n ChargeOverride,\n GetUrlResponse,\n GetPurchaseHistoryRequest,\n GetPurchaseHistoryResponse,\n GetSitePaymentMethodsStatusRequest,\n GetSitePaymentMethodsStatusResponse,\n GetMeteredBillingChargesRequest,\n GetMeteredBillingChargesResponse,\n Charge,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n AccountDetails,\n BaseEventMetadata,\n PurchasedItemInvoiceStatusUpdatedEnvelope,\n GetUrlOptions,\n GetMeteredBillingChargesOptions,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\nexport {\n PaymentCycleWithLiterals,\n InvoiceStatusWithLiterals,\n WebhookIdentityTypeWithLiterals,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA,EAAA,0BAAAC;AAAA,EAAA,cAAAC;AAAA,EAAA,2CAAAC;AAAA;AAAA;;;ACAA,IAAAC,iCAAwD;AACxD,uBAA8D;;;ACD9D,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,mBAA6C;AAC7C,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,0CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,Q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A;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,UAAU;AAAA,UACV,WAAW;AAAA,UACX,SAAS;AAAA,QACX;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AD5kBO,SAASG,QAAO,YAAyC;AAC9D,SAAO,CAAC,WAAmB,YACzBA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAwBO,SAASC,oBACd,YAC6B;AAC7B,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;AAyBO,SAASC,0BACd,YACmC;AACnC,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAuBO,IAAM,0CAAsC;AAAA,EACjD;AAAA,EACA;AAAA,EACA,CAAC,cACC,wEAAwC,KAAK;AACjD,EAA6C;;;AGjH7C,IAAAC,uBAAiC;AACjC,sCAAkC;AAQ3B,IAAMC,UAEK,2DAAiBA,OAAY;AACxC,IAAMC,sBAGK,2DAAiBA,mBAAwB;AACpD,IAAMC,4BAGK,2DAAiBA,yBAA8B;AAM1D,IAAMC,2CAGwC;AAAA,EACnD;AACF;","names":["getMeteredBillingCharges","getPurchaseHistory","getUrl","onPurchasedItemInvoiceStatusUpdated","import_rename_all_nested_keys","import_timestamp","import_rest_modules","payload","PaymentCycle","InvoiceStatus","WebhookIdentityType","getUrl","sdkTransformError","getPurchaseHistory","getMeteredBillingCharges","getUrl","getPurchaseHistory","getMeteredBillingCharges","import_rest_modules","getUrl","getPurchaseHistory","getMeteredBillingCharges","onPurchasedItemInvoiceStatusUpdated"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/devcenter-checkout-v1-purchased-item-billing.public.ts","../../src/devcenter-checkout-v1-purchased-item-billing.universal.ts","../../src/devcenter-checkout-v1-purchased-item-billing.http.ts","../../src/devcenter-checkout-v1-purchased-item-billing.context.ts"],"sourcesContent":["export * from './src/devcenter-checkout-v1-purchased-item-billing.context.js';\n","import { renameKeysFromRESTResponseToSDKResponse } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { EventDefinition, HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n GetMeteredBillingChargesOptions,\n GetMeteredBillingChargesResponse,\n GetPurchaseHistoryResponse,\n GetUrlOptions,\n GetUrlResponse,\n PurchasedItemInvoiceStatusUpdatedEnvelope,\n getMeteredBillingCharges as universalGetMeteredBillingCharges,\n getPurchaseHistory as universalGetPurchaseHistory,\n getUrl as universalGetUrl,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/app-management' };\n\nexport function getUrl(httpClient: HttpClient): GetUrlSignature {\n return (productId: string, options?: GetUrlOptions) =>\n universalGetUrl(\n productId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetUrlSignature {\n /**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n * @param - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n */\n (productId: string, options?: GetUrlOptions): Promise<\n NonNullablePaths<GetUrlResponse, `checkoutUrl`, 2>\n >;\n}\n\nexport function getPurchaseHistory(\n httpClient: HttpClient\n): GetPurchaseHistorySignature {\n return () =>\n universalGetPurchaseHistory(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetPurchaseHistorySignature {\n /**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n */\n (): Promise<\n NonNullablePaths<\n GetPurchaseHistoryResponse,\n | `purchases`\n | `purchases.${number}.productId`\n | `purchases.${number}.price`\n | `purchases.${number}.currency`\n | `purchases.${number}.billingCycle`,\n 4\n >\n >;\n}\n\nexport function getMeteredBillingCharges(\n httpClient: HttpClient\n): GetMeteredBillingChargesSignature {\n return (options?: GetMeteredBillingChargesOptions) =>\n universalGetMeteredBillingCharges(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetMeteredBillingChargesSignature {\n /**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\n (options?: GetMeteredBillingChargesOptions): Promise<\n NonNullablePaths<\n GetMeteredBillingChargesResponse,\n `charges` | `charges.${number}.description` | `charges.${number}.amount`,\n 4\n >\n >;\n}\n\nexport const onPurchasedItemInvoiceStatusUpdated = EventDefinition(\n 'InvoiceStatusUpdated',\n false,\n (event: PurchasedItemInvoiceStatusUpdatedEnvelope) =>\n renameKeysFromRESTResponseToSDKResponse(event)\n)<PurchasedItemInvoiceStatusUpdatedEnvelope>();\n\nexport {\n AccountInfo,\n BaseEventMetadata,\n Charge,\n ChargeOverride,\n GetMeteredBillingChargesOptions,\n GetMeteredBillingChargesRequest,\n GetMeteredBillingChargesResponse,\n GetPurchaseHistoryRequest,\n GetPurchaseHistoryResponse,\n GetSitePaymentMethodsStatusRequest,\n GetSitePaymentMethodsStatusResponse,\n GetUrlOptions,\n GetUrlRequest,\n GetUrlResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n InvoiceStatus,\n InvoiceStatusUpdated,\n MessageEnvelope,\n PaymentCycle,\n PurchasedItem,\n PurchasedItemInvoiceStatusUpdatedEnvelope,\n WebhookIdentityType,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixDevcenterCheckoutV1PurchasedItem from './devcenter-checkout-v1-purchased-item-billing.http.js';\n\nexport interface PurchasedItem {\n /** ID of your app's paid plan. */\n productId?: string;\n /** Price of your app's paid plan. For example, `9.95`. */\n price?: string;\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n */\n currency?: string;\n /** Information about the billing cycle for your app's paid plan. */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * Date and time the site purchased your app's paid plan in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n dateCreated?: Date | null;\n}\n\nexport enum PaymentCycle {\n NO_CYCLE = 'NO_CYCLE',\n MONTHLY = 'MONTHLY',\n YEARLY = 'YEARLY',\n ONE_TIME = 'ONE_TIME',\n TWO_YEARS = 'TWO_YEARS',\n THREE_YEARS = 'THREE_YEARS',\n FOUR_YEARS = 'FOUR_YEARS',\n FIVE_YEARS = 'FIVE_YEARS',\n}\n\n/** @enumType */\nexport type PaymentCycleWithLiterals =\n | PaymentCycle\n | 'NO_CYCLE'\n | 'MONTHLY'\n | 'YEARLY'\n | 'ONE_TIME'\n | 'TWO_YEARS'\n | 'THREE_YEARS'\n | 'FOUR_YEARS'\n | 'FIVE_YEARS';\n\nexport interface InvoiceStatusUpdated {\n /** Invoice payment status. */\n status?: InvoiceStatusWithLiterals;\n /**\n * Wix Premium invoice ID.\n * @maxLength 50\n */\n invoiceId?: string;\n /**\n * App instance ID - a unique ID assigned to each app in each site.\n * @format GUID\n */\n instanceId?: string | null;\n /** Whether the invoice is for a single payment or for multiple, recurring payments. */\n recurring?: boolean;\n}\n\nexport enum InvoiceStatus {\n UNKNOWN_INVOICE_STATUS = 'UNKNOWN_INVOICE_STATUS',\n PAYMENT_FAILED = 'PAYMENT_FAILED',\n PAID = 'PAID',\n REFUNDED = 'REFUNDED',\n VOIDED = 'VOIDED',\n CHARGEDBACK = 'CHARGEDBACK',\n}\n\n/** @enumType */\nexport type InvoiceStatusWithLiterals =\n | InvoiceStatus\n | 'UNKNOWN_INVOICE_STATUS'\n | 'PAYMENT_FAILED'\n | 'PAID'\n | 'REFUNDED'\n | 'VOIDED'\n | 'CHARGEDBACK';\n\nexport interface GetUrlRequest {\n /**\n * ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n */\n productId: string;\n /**\n * URL for the Wix checkout page. Redirect Wix users to this URL after\n * they've successfully purchased a paid plan for your app.\n * @format WEB_URL\n */\n successUrl?: string | null;\n /**\n * Whether the checkout is for testing purposes only. Testing is mainly\n * relevant for in-app purchase flows. When `true`, Wix charges the site\n * owners an amount of `0.00`.\n *\n * Not supported for usage-based plans.\n */\n testCheckout?: boolean;\n /**\n * Information about the paid plan's billing cycle.\n *\n * Set to `MONTHLY` for usage-based plans.\n */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * 2-letter country code in\n * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)\n * format.\n *\n * Default: `\"US\"`\n */\n countryCode?: string | null;\n /**\n * 2-letter language code in\n * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `\"EN\"`\n */\n languageCode?: string | null;\n /** Coupon code for the paid plan. Available only in case there is a discount. */\n couponCode?: string | null;\n}\n\nexport interface ChargeOverride {\n /**\n * Override price. If you omit the override price, the default price\n * configured in the **Pricing** page of your app's dashboard is used.\n */\n price?: number;\n /**\n * Override 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n */\n currency?: string;\n}\n\nexport interface GetUrlResponse {\n /**\n * URL for the Wix checkout page.\n * @format WEB_URL\n */\n checkoutUrl?: string;\n /**\n * Token for the Wix checkout page. The token holds all data about the order\n * you're creating a checkout for. It's [signed](https://dev.wix.com/docs/api-reference/articles),\n * so you can verify that it comes from Wix.\n */\n token?: string | null;\n}\n\nexport interface GetPurchaseHistoryRequest {}\n\nexport interface GetPurchaseHistoryResponse {\n /** Retrieved purchases the Wix user has completed for you app. */\n purchases?: PurchasedItem[];\n}\n\nexport interface GetSitePaymentMethodsStatusRequest {}\n\nexport interface GetSitePaymentMethodsStatusResponse {\n /**\n * Whether at least 1 online payment method is enabled for the site.\n * Online payment methods include Wix Payments, Stripe, PayPal, and credit\n * cards.\n */\n onlineProviderEnabled?: boolean;\n /** Whether the site accepts offline payments. */\n offlineProviderEnabled?: boolean;\n /**\n * Whether [Wix Point of Sale](https://www.wix.com/pos) is enabled for the site.\n * This allows electronic payments to be made in person.\n */\n wixPosProviderEnabled?: boolean;\n /**\n * Whether the site has enabled at least 1 3rd-party point-of-sale\n * provider. This allows electronic payments to be made in person.\n */\n thirdPartyPosProviderEnabled?: boolean;\n}\n\nexport interface GetMeteredBillingChargesRequest {\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string | null;\n /**\n * Start of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n startDate?: Date | null;\n /**\n * End of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n endDate?: Date | null;\n}\n\nexport interface GetMeteredBillingChargesResponse {\n /** List of retrieved custom charges. */\n charges?: Charge[];\n}\n\nexport interface Charge {\n /** ID of the custom charge. The ID consists of 64 characters. */\n _id?: string | null;\n /** Description of the custom charge. */\n description?: string;\n /**\n * Charge amount.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n amount?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n /** Details related to the account */\n accountInfo?: AccountInfo;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n\nexport interface AccountInfo {\n /**\n * ID of the Wix account associated with the event.\n * @format GUID\n */\n accountId?: string | null;\n /**\n * ID of the parent Wix account. Only included when accountId belongs to a child account.\n * @format GUID\n */\n parentAccountId?: string | null;\n /**\n * ID of the Wix site associated with the event. Only included when the event is tied to a specific site.\n * @format GUID\n */\n siteId?: string | null;\n}\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Details related to the account */\n accountInfo?: AccountInfo;\n}\n\nexport interface PurchasedItemInvoiceStatusUpdatedEnvelope {\n data: InvoiceStatusUpdated;\n metadata: BaseEventMetadata;\n}\n\n/**\n * Triggered when there is an update to the payment status of an invoice.\n * Charges made using the [Custom Charges service plugin](https://dev.wix.com/docs/rest/app-management/app-billing/custom-charges-service-plugin/introduction) may be based on usage.\n * Learn more about [usage-based charges](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model).\n * @permissionScope Manage Your App\n * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP\n * @permissionScope Read site, business, and email details\n * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @webhook\n * @eventType InvoiceStatusUpdated\n * @serviceIdentifier com.wixpress.market.aim.api.Checkout\n * @slug invoice_status_updated\n */\nexport declare function onPurchasedItemInvoiceStatusUpdated(\n handler: (\n event: PurchasedItemInvoiceStatusUpdatedEnvelope\n ) => void | Promise<void>\n): void;\n\n/**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n * @param productId - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n * @public\n * @requiredField productId\n * @permissionId WIX_DEVELOPERS.CREATE_CHECKOUT\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetUrl\n */\nexport async function getUrl(\n productId: string,\n options?: GetUrlOptions\n): Promise<NonNullablePaths<GetUrlResponse, `checkoutUrl`, 2>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n productId: productId,\n successUrl: options?.successUrl,\n testCheckout: options?.testCheckout,\n billingCycle: options?.billingCycle,\n countryCode: options?.countryCode,\n languageCode: options?.languageCode,\n couponCode: options?.couponCode,\n });\n\n const reqOpts = ambassadorWixDevcenterCheckoutV1PurchasedItem.getUrl(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n productId: '$[0]',\n successUrl: '$[1].successUrl',\n testCheckout: '$[1].testCheckout',\n billingCycle: '$[1].billingCycle',\n countryCode: '$[1].countryCode',\n languageCode: '$[1].languageCode',\n couponCode: '$[1].couponCode',\n },\n singleArgumentUnchanged: false,\n },\n ['productId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetUrlOptions {\n /**\n * URL for the Wix checkout page. Redirect Wix users to this URL after\n * they've successfully purchased a paid plan for your app.\n * @format WEB_URL\n */\n successUrl?: string | null;\n /**\n * Whether the checkout is for testing purposes only. Testing is mainly\n * relevant for in-app purchase flows. When `true`, Wix charges the site\n * owners an amount of `0.00`.\n *\n * Not supported for usage-based plans.\n */\n testCheckout?: boolean;\n /**\n * Information about the paid plan's billing cycle.\n *\n * Set to `MONTHLY` for usage-based plans.\n */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * 2-letter country code in\n * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)\n * format.\n *\n * Default: `\"US\"`\n */\n countryCode?: string | null;\n /**\n * 2-letter language code in\n * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `\"EN\"`\n */\n languageCode?: string | null;\n /** Coupon code for the paid plan. Available only in case there is a discount. */\n couponCode?: string | null;\n}\n\n/**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n * @public\n * @permissionId WIX_DEVELOPERS.APP_PURCHASE_HISTORY\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetPurchaseHistory\n */\nexport async function getPurchaseHistory(): Promise<\n NonNullablePaths<\n GetPurchaseHistoryResponse,\n | `purchases`\n | `purchases.${number}.productId`\n | `purchases.${number}.price`\n | `purchases.${number}.currency`\n | `purchases.${number}.billingCycle`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixDevcenterCheckoutV1PurchasedItem.getPurchaseHistory(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_DEVELOPERS.METERED_BILLING_CHARGES_READ\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetMeteredBillingCharges\n */\nexport async function getMeteredBillingCharges(\n options?: GetMeteredBillingChargesOptions\n): Promise<\n NonNullablePaths<\n GetMeteredBillingChargesResponse,\n `charges` | `charges.${number}.description` | `charges.${number}.amount`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n currency: options?.currency,\n startDate: options?.startDate,\n endDate: options?.endDate,\n });\n\n const reqOpts =\n ambassadorWixDevcenterCheckoutV1PurchasedItem.getMeteredBillingCharges(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n currency: '$[0].currency',\n startDate: '$[0].startDate',\n endDate: '$[0].endDate',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetMeteredBillingChargesOptions {\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string | null;\n /**\n * Start of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n startDate?: Date | null;\n /**\n * End of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n endDate?: Date | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiCheckoutUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_billing';\n\n/**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n */\nexport function getUrl(payload: object): RequestOptionsFactory<any> {\n function __getUrl({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [{ path: 'chargeOverride.price' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.market.aim.api.Checkout.GetUrl',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/checkout',\n data: serializedData,\n host,\n }),\n data: serializedData,\n };\n\n return metadata;\n }\n\n return __getUrl;\n}\n\n/**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n */\nexport function getPurchaseHistory(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPurchaseHistory({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.market.aim.api.Checkout.GetPurchaseHistory',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/checkout/history',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'purchases.dateCreated' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getPurchaseHistory;\n}\n\n/**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\nexport function getMeteredBillingCharges(\n payload: object\n): RequestOptionsFactory<any> {\n function __getMeteredBillingCharges({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'startDate' }, { path: 'endDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'GET' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.Checkout.GetMeteredBillingCharges',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/metered-billing-charges',\n data: serializedData,\n host,\n }),\n params: toURLSearchParams(serializedData),\n };\n\n return metadata;\n }\n\n return __getMeteredBillingCharges;\n}\n","import {\n getUrl as publicGetUrl,\n getPurchaseHistory as publicGetPurchaseHistory,\n getMeteredBillingCharges as publicGetMeteredBillingCharges,\n} from './devcenter-checkout-v1-purchased-item-billing.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { createEventModule } from '@wix/sdk-runtime/event-definition-modules';\nimport {\n BuildRESTFunction,\n MaybeContext,\n BuildEventDefinition,\n} from '@wix/sdk-types';\nimport { onPurchasedItemInvoiceStatusUpdated as publicOnPurchasedItemInvoiceStatusUpdated } from './devcenter-checkout-v1-purchased-item-billing.public.js';\n\nexport const getUrl: MaybeContext<\n BuildRESTFunction<typeof publicGetUrl> & typeof publicGetUrl\n> = /*#__PURE__*/ createRESTModule(publicGetUrl);\nexport const getPurchaseHistory: MaybeContext<\n BuildRESTFunction<typeof publicGetPurchaseHistory> &\n typeof publicGetPurchaseHistory\n> = /*#__PURE__*/ createRESTModule(publicGetPurchaseHistory);\nexport const getMeteredBillingCharges: MaybeContext<\n BuildRESTFunction<typeof publicGetMeteredBillingCharges> &\n typeof publicGetMeteredBillingCharges\n> = /*#__PURE__*/ createRESTModule(publicGetMeteredBillingCharges);\n/**\n * Triggered when there is an update to the payment status of an invoice.\n * Charges made using the [Custom Charges service plugin](https://dev.wix.com/docs/rest/app-management/app-billing/custom-charges-service-plugin/introduction) may be based on usage.\n * Learn more about [usage-based charges](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model).\n */\nexport const onPurchasedItemInvoiceStatusUpdated: BuildEventDefinition<\n typeof publicOnPurchasedItemInvoiceStatusUpdated\n> &\n typeof publicOnPurchasedItemInvoiceStatusUpdated = createEventModule(\n publicOnPurchasedItemInvoiceStatusUpdated\n);\n\nexport {\n PaymentCycle,\n InvoiceStatus,\n WebhookIdentityType,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\nexport {\n PurchasedItem,\n InvoiceStatusUpdated,\n GetUrlRequest,\n ChargeOverride,\n GetUrlResponse,\n GetPurchaseHistoryRequest,\n GetPurchaseHistoryResponse,\n GetSitePaymentMethodsStatusRequest,\n GetSitePaymentMethodsStatusResponse,\n GetMeteredBillingChargesRequest,\n GetMeteredBillingChargesResponse,\n Charge,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n AccountInfo,\n BaseEventMetadata,\n PurchasedItemInvoiceStatusUpdatedEnvelope,\n GetUrlOptions,\n GetMeteredBillingChargesOptions,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\nexport {\n PaymentCycleWithLiterals,\n InvoiceStatusWithLiterals,\n WebhookIdentityTypeWithLiterals,\n} from './devcenter-checkout-v1-purchased-item-billing.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA,EAAA,0BAAAC;AAAA,EAAA,cAAAC;AAAA,EAAA,2CAAAC;AAAA;AAAA;;;ACAA,IAAAC,iCAAwD;AACxD,uBAA8D;;;ACD9D,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,mBAA6C;AAC7C,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,0CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAA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AC,WAAmB,YACzBA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAwBO,SAASC,oBACd,YAC6B;AAC7B,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;AAyBO,SAASC,0BACd,YACmC;AACnC,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAuBO,IAAM,0CAAsC;AAAA,EACjD;AAAA,EACA;AAAA,EACA,CAAC,cACC,wEAAwC,KAAK;AACjD,EAA6C;;;AGjH7C,IAAAC,uBAAiC;AACjC,sCAAkC;AAQ3B,IAAMC,UAEK,2DAAiBA,OAAY;AACxC,IAAMC,sBAGK,2DAAiBA,mBAAwB;AACpD,IAAMC,4BAGK,2DAAiBA,yBAA8B;AAM1D,IAAMC,2CAGwC;AAAA,EACnD;AACF;","names":["getMeteredBillingCharges","getPurchaseHistory","getUrl","onPurchasedItemInvoiceStatusUpdated","import_rename_all_nested_keys","import_timestamp","import_rest_modules","payload","PaymentCycle","InvoiceStatus","WebhookIdentityType","getUrl","sdkTransformError","getPurchaseHistory","getMeteredBillingCharges","getUrl","getPurchaseHistory","getMeteredBillingCharges","import_rest_modules","getUrl","getPurchaseHistory","getMeteredBillingCharges","onPurchasedItemInvoiceStatusUpdated"]}
|
|
@@ -204,6 +204,8 @@ interface MessageEnvelope {
|
|
|
204
204
|
identity?: IdentificationData;
|
|
205
205
|
/** Stringify payload. */
|
|
206
206
|
data?: string;
|
|
207
|
+
/** Details related to the account */
|
|
208
|
+
accountInfo?: AccountInfo;
|
|
207
209
|
}
|
|
208
210
|
interface IdentificationData extends IdentificationDataIdOneOf {
|
|
209
211
|
/**
|
|
@@ -261,19 +263,19 @@ declare enum WebhookIdentityType {
|
|
|
261
263
|
}
|
|
262
264
|
/** @enumType */
|
|
263
265
|
type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
|
|
264
|
-
interface
|
|
266
|
+
interface AccountInfo {
|
|
265
267
|
/**
|
|
266
|
-
* ID of the account.
|
|
268
|
+
* ID of the Wix account associated with the event.
|
|
267
269
|
* @format GUID
|
|
268
270
|
*/
|
|
269
271
|
accountId?: string | null;
|
|
270
272
|
/**
|
|
271
|
-
* ID of the parent account.
|
|
273
|
+
* ID of the parent Wix account. Only included when accountId belongs to a child account.
|
|
272
274
|
* @format GUID
|
|
273
275
|
*/
|
|
274
276
|
parentAccountId?: string | null;
|
|
275
277
|
/**
|
|
276
|
-
* ID of the site
|
|
278
|
+
* ID of the Wix site associated with the event. Only included when the event is tied to a specific site.
|
|
277
279
|
* @format GUID
|
|
278
280
|
*/
|
|
279
281
|
siteId?: string | null;
|
|
@@ -291,6 +293,8 @@ interface BaseEventMetadata {
|
|
|
291
293
|
eventType?: string;
|
|
292
294
|
/** The identification type and identity data. */
|
|
293
295
|
identity?: IdentificationData;
|
|
296
|
+
/** Details related to the account */
|
|
297
|
+
accountInfo?: AccountInfo;
|
|
294
298
|
}
|
|
295
299
|
interface PurchasedItemInvoiceStatusUpdatedEnvelope {
|
|
296
300
|
data: InvoiceStatusUpdated;
|
|
@@ -422,4 +426,4 @@ interface GetMeteredBillingChargesOptions {
|
|
|
422
426
|
endDate?: Date | null;
|
|
423
427
|
}
|
|
424
428
|
|
|
425
|
-
export { type
|
|
429
|
+
export { type AccountInfo, type BaseEventMetadata, type Charge, type ChargeOverride, type GetMeteredBillingChargesOptions, type GetMeteredBillingChargesRequest, type GetMeteredBillingChargesResponse, type GetPurchaseHistoryRequest, type GetPurchaseHistoryResponse, type GetSitePaymentMethodsStatusRequest, type GetSitePaymentMethodsStatusResponse, type GetUrlOptions, type GetUrlRequest, type GetUrlResponse, type IdentificationData, type IdentificationDataIdOneOf, InvoiceStatus, type InvoiceStatusUpdated, type InvoiceStatusWithLiterals, type MessageEnvelope, PaymentCycle, type PaymentCycleWithLiterals, type PurchasedItem, type PurchasedItemInvoiceStatusUpdatedEnvelope, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, getMeteredBillingCharges, getPurchaseHistory, getUrl, onPurchasedItemInvoiceStatusUpdated };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.typings.ts","../../src/devcenter-checkout-v1-purchased-item-billing.universal.ts","../../src/devcenter-checkout-v1-purchased-item-billing.http.ts"],"sourcesContent":["export * from './src/devcenter-checkout-v1-purchased-item-billing.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixDevcenterCheckoutV1PurchasedItem from './devcenter-checkout-v1-purchased-item-billing.http.js';\n\nexport interface PurchasedItem {\n /** ID of your app's paid plan. */\n productId?: string;\n /** Price of your app's paid plan. For example, `9.95`. */\n price?: string;\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n */\n currency?: string;\n /** Information about the billing cycle for your app's paid plan. */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * Date and time the site purchased your app's paid plan in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n dateCreated?: Date | null;\n}\n\nexport enum PaymentCycle {\n NO_CYCLE = 'NO_CYCLE',\n MONTHLY = 'MONTHLY',\n YEARLY = 'YEARLY',\n ONE_TIME = 'ONE_TIME',\n TWO_YEARS = 'TWO_YEARS',\n THREE_YEARS = 'THREE_YEARS',\n FOUR_YEARS = 'FOUR_YEARS',\n FIVE_YEARS = 'FIVE_YEARS',\n}\n\n/** @enumType */\nexport type PaymentCycleWithLiterals =\n | PaymentCycle\n | 'NO_CYCLE'\n | 'MONTHLY'\n | 'YEARLY'\n | 'ONE_TIME'\n | 'TWO_YEARS'\n | 'THREE_YEARS'\n | 'FOUR_YEARS'\n | 'FIVE_YEARS';\n\nexport interface InvoiceStatusUpdated {\n /** Invoice payment status. */\n status?: InvoiceStatusWithLiterals;\n /**\n * Wix Premium invoice ID.\n * @maxLength 50\n */\n invoiceId?: string;\n /**\n * App instance ID - a unique ID assigned to each app in each site.\n * @format GUID\n */\n instanceId?: string | null;\n /** Whether the invoice is for a single payment or for multiple, recurring payments. */\n recurring?: boolean;\n}\n\nexport enum InvoiceStatus {\n UNKNOWN_INVOICE_STATUS = 'UNKNOWN_INVOICE_STATUS',\n PAYMENT_FAILED = 'PAYMENT_FAILED',\n PAID = 'PAID',\n REFUNDED = 'REFUNDED',\n VOIDED = 'VOIDED',\n CHARGEDBACK = 'CHARGEDBACK',\n}\n\n/** @enumType */\nexport type InvoiceStatusWithLiterals =\n | InvoiceStatus\n | 'UNKNOWN_INVOICE_STATUS'\n | 'PAYMENT_FAILED'\n | 'PAID'\n | 'REFUNDED'\n | 'VOIDED'\n | 'CHARGEDBACK';\n\nexport interface GetUrlRequest {\n /**\n * ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n */\n productId: string;\n /**\n * URL for the Wix checkout page. Redirect Wix users to this URL after\n * they've successfully purchased a paid plan for your app.\n * @format WEB_URL\n */\n successUrl?: string | null;\n /**\n * Whether the checkout is for testing purposes only. Testing is mainly\n * relevant for in-app purchase flows. When `true`, Wix charges the site\n * owners an amount of `0.00`.\n *\n * Not supported for usage-based plans.\n */\n testCheckout?: boolean;\n /**\n * Information about the paid plan's billing cycle.\n *\n * Set to `MONTHLY` for usage-based plans.\n */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * 2-letter country code in\n * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)\n * format.\n *\n * Default: `\"US\"`\n */\n countryCode?: string | null;\n /**\n * 2-letter language code in\n * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `\"EN\"`\n */\n languageCode?: string | null;\n /** Coupon code for the paid plan. Available only in case there is a discount. */\n couponCode?: string | null;\n}\n\nexport interface ChargeOverride {\n /**\n * Override price. If you omit the override price, the default price\n * configured in the **Pricing** page of your app's dashboard is used.\n */\n price?: number;\n /**\n * Override 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n */\n currency?: string;\n}\n\nexport interface GetUrlResponse {\n /**\n * URL for the Wix checkout page.\n * @format WEB_URL\n */\n checkoutUrl?: string;\n /**\n * Token for the Wix checkout page. The token holds all data about the order\n * you're creating a checkout for. It's [signed](https://dev.wix.com/docs/api-reference/articles),\n * so you can verify that it comes from Wix.\n */\n token?: string | null;\n}\n\nexport interface GetPurchaseHistoryRequest {}\n\nexport interface GetPurchaseHistoryResponse {\n /** Retrieved purchases the Wix user has completed for you app. */\n purchases?: PurchasedItem[];\n}\n\nexport interface GetSitePaymentMethodsStatusRequest {}\n\nexport interface GetSitePaymentMethodsStatusResponse {\n /**\n * Whether at least 1 online payment method is enabled for the site.\n * Online payment methods include Wix Payments, Stripe, PayPal, and credit\n * cards.\n */\n onlineProviderEnabled?: boolean;\n /** Whether the site accepts offline payments. */\n offlineProviderEnabled?: boolean;\n /**\n * Whether [Wix Point of Sale](https://www.wix.com/pos) is enabled for the site.\n * This allows electronic payments to be made in person.\n */\n wixPosProviderEnabled?: boolean;\n /**\n * Whether the site has enabled at least 1 3rd-party point-of-sale\n * provider. This allows electronic payments to be made in person.\n */\n thirdPartyPosProviderEnabled?: boolean;\n}\n\nexport interface GetMeteredBillingChargesRequest {\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string | null;\n /**\n * Start of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n startDate?: Date | null;\n /**\n * End of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n endDate?: Date | null;\n}\n\nexport interface GetMeteredBillingChargesResponse {\n /** List of retrieved custom charges. */\n charges?: Charge[];\n}\n\nexport interface Charge {\n /** ID of the custom charge. The ID consists of 64 characters. */\n _id?: string | null;\n /** Description of the custom charge. */\n description?: string;\n /**\n * Charge amount.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n amount?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n\nexport interface AccountDetails {\n /**\n * ID of the account.\n * @format GUID\n */\n accountId?: string | null;\n /**\n * ID of the parent account.\n * @format GUID\n */\n parentAccountId?: string | null;\n /**\n * ID of the site, if applicable.\n * @format GUID\n */\n siteId?: string | null;\n}\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n}\n\nexport interface PurchasedItemInvoiceStatusUpdatedEnvelope {\n data: InvoiceStatusUpdated;\n metadata: BaseEventMetadata;\n}\n\n/**\n * Triggered when there is an update to the payment status of an invoice.\n * Charges made using the [Custom Charges service plugin](https://dev.wix.com/docs/rest/app-management/app-billing/custom-charges-service-plugin/introduction) may be based on usage.\n * Learn more about [usage-based charges](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model).\n * @permissionScope Manage Your App\n * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP\n * @permissionScope Read site, business, and email details\n * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @webhook\n * @eventType InvoiceStatusUpdated\n * @serviceIdentifier com.wixpress.market.aim.api.Checkout\n * @slug invoice_status_updated\n */\nexport declare function onPurchasedItemInvoiceStatusUpdated(\n handler: (\n event: PurchasedItemInvoiceStatusUpdatedEnvelope\n ) => void | Promise<void>\n): void;\n\n/**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n * @param productId - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n * @public\n * @requiredField productId\n * @permissionId WIX_DEVELOPERS.CREATE_CHECKOUT\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetUrl\n */\nexport async function getUrl(\n productId: string,\n options?: GetUrlOptions\n): Promise<NonNullablePaths<GetUrlResponse, `checkoutUrl`, 2>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n productId: productId,\n successUrl: options?.successUrl,\n testCheckout: options?.testCheckout,\n billingCycle: options?.billingCycle,\n countryCode: options?.countryCode,\n languageCode: options?.languageCode,\n couponCode: options?.couponCode,\n });\n\n const reqOpts = ambassadorWixDevcenterCheckoutV1PurchasedItem.getUrl(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n productId: '$[0]',\n successUrl: '$[1].successUrl',\n testCheckout: '$[1].testCheckout',\n billingCycle: '$[1].billingCycle',\n countryCode: '$[1].countryCode',\n languageCode: '$[1].languageCode',\n couponCode: '$[1].couponCode',\n },\n singleArgumentUnchanged: false,\n },\n ['productId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetUrlOptions {\n /**\n * URL for the Wix checkout page. Redirect Wix users to this URL after\n * they've successfully purchased a paid plan for your app.\n * @format WEB_URL\n */\n successUrl?: string | null;\n /**\n * Whether the checkout is for testing purposes only. Testing is mainly\n * relevant for in-app purchase flows. When `true`, Wix charges the site\n * owners an amount of `0.00`.\n *\n * Not supported for usage-based plans.\n */\n testCheckout?: boolean;\n /**\n * Information about the paid plan's billing cycle.\n *\n * Set to `MONTHLY` for usage-based plans.\n */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * 2-letter country code in\n * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)\n * format.\n *\n * Default: `\"US\"`\n */\n countryCode?: string | null;\n /**\n * 2-letter language code in\n * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `\"EN\"`\n */\n languageCode?: string | null;\n /** Coupon code for the paid plan. Available only in case there is a discount. */\n couponCode?: string | null;\n}\n\n/**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n * @public\n * @permissionId WIX_DEVELOPERS.APP_PURCHASE_HISTORY\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetPurchaseHistory\n */\nexport async function getPurchaseHistory(): Promise<\n NonNullablePaths<\n GetPurchaseHistoryResponse,\n | `purchases`\n | `purchases.${number}.productId`\n | `purchases.${number}.price`\n | `purchases.${number}.currency`\n | `purchases.${number}.billingCycle`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixDevcenterCheckoutV1PurchasedItem.getPurchaseHistory(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_DEVELOPERS.METERED_BILLING_CHARGES_READ\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetMeteredBillingCharges\n */\nexport async function getMeteredBillingCharges(\n options?: GetMeteredBillingChargesOptions\n): Promise<\n NonNullablePaths<\n GetMeteredBillingChargesResponse,\n `charges` | `charges.${number}.description` | `charges.${number}.amount`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n currency: options?.currency,\n startDate: options?.startDate,\n endDate: options?.endDate,\n });\n\n const reqOpts =\n ambassadorWixDevcenterCheckoutV1PurchasedItem.getMeteredBillingCharges(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n currency: '$[0].currency',\n startDate: '$[0].startDate',\n endDate: '$[0].endDate',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetMeteredBillingChargesOptions {\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string | null;\n /**\n * Start of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n startDate?: Date | null;\n /**\n * End of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n endDate?: Date | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiCheckoutUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_billing';\n\n/**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n */\nexport function getUrl(payload: object): RequestOptionsFactory<any> {\n function __getUrl({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [{ path: 'chargeOverride.price' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.market.aim.api.Checkout.GetUrl',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/checkout',\n data: serializedData,\n host,\n }),\n data: serializedData,\n };\n\n return metadata;\n }\n\n return __getUrl;\n}\n\n/**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n */\nexport function getPurchaseHistory(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPurchaseHistory({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.market.aim.api.Checkout.GetPurchaseHistory',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/checkout/history',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'purchases.dateCreated' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getPurchaseHistory;\n}\n\n/**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\nexport function getMeteredBillingCharges(\n payload: object\n): RequestOptionsFactory<any> {\n function __getMeteredBillingCharges({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'startDate' }, { path: 'endDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'GET' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.Checkout.GetMeteredBillingCharges',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/metered-billing-charges',\n data: serializedData,\n host,\n }),\n params: toURLSearchParams(serializedData),\n };\n\n return metadata;\n }\n\n return __getMeteredBillingCharges;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA,EAAA,0BAAAC;AAAA,EAAA,cAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,mBAA6C;AAC7C,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,0CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA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,QAAM,UAC0C;AAAA,IAC5C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAF;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,UAAU;AAAA,UACV,WAAW;AAAA,UACX,SAAS;AAAA,QACX;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["getMeteredBillingCharges","getPurchaseHistory","getUrl","import_timestamp","import_rest_modules","payload","PaymentCycle","InvoiceStatus","WebhookIdentityType","getUrl","sdkTransformError","getPurchaseHistory","getMeteredBillingCharges"]}
|
|
1
|
+
{"version":3,"sources":["../../index.typings.ts","../../src/devcenter-checkout-v1-purchased-item-billing.universal.ts","../../src/devcenter-checkout-v1-purchased-item-billing.http.ts"],"sourcesContent":["export * from './src/devcenter-checkout-v1-purchased-item-billing.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixDevcenterCheckoutV1PurchasedItem from './devcenter-checkout-v1-purchased-item-billing.http.js';\n\nexport interface PurchasedItem {\n /** ID of your app's paid plan. */\n productId?: string;\n /** Price of your app's paid plan. For example, `9.95`. */\n price?: string;\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n */\n currency?: string;\n /** Information about the billing cycle for your app's paid plan. */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * Date and time the site purchased your app's paid plan in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n dateCreated?: Date | null;\n}\n\nexport enum PaymentCycle {\n NO_CYCLE = 'NO_CYCLE',\n MONTHLY = 'MONTHLY',\n YEARLY = 'YEARLY',\n ONE_TIME = 'ONE_TIME',\n TWO_YEARS = 'TWO_YEARS',\n THREE_YEARS = 'THREE_YEARS',\n FOUR_YEARS = 'FOUR_YEARS',\n FIVE_YEARS = 'FIVE_YEARS',\n}\n\n/** @enumType */\nexport type PaymentCycleWithLiterals =\n | PaymentCycle\n | 'NO_CYCLE'\n | 'MONTHLY'\n | 'YEARLY'\n | 'ONE_TIME'\n | 'TWO_YEARS'\n | 'THREE_YEARS'\n | 'FOUR_YEARS'\n | 'FIVE_YEARS';\n\nexport interface InvoiceStatusUpdated {\n /** Invoice payment status. */\n status?: InvoiceStatusWithLiterals;\n /**\n * Wix Premium invoice ID.\n * @maxLength 50\n */\n invoiceId?: string;\n /**\n * App instance ID - a unique ID assigned to each app in each site.\n * @format GUID\n */\n instanceId?: string | null;\n /** Whether the invoice is for a single payment or for multiple, recurring payments. */\n recurring?: boolean;\n}\n\nexport enum InvoiceStatus {\n UNKNOWN_INVOICE_STATUS = 'UNKNOWN_INVOICE_STATUS',\n PAYMENT_FAILED = 'PAYMENT_FAILED',\n PAID = 'PAID',\n REFUNDED = 'REFUNDED',\n VOIDED = 'VOIDED',\n CHARGEDBACK = 'CHARGEDBACK',\n}\n\n/** @enumType */\nexport type InvoiceStatusWithLiterals =\n | InvoiceStatus\n | 'UNKNOWN_INVOICE_STATUS'\n | 'PAYMENT_FAILED'\n | 'PAID'\n | 'REFUNDED'\n | 'VOIDED'\n | 'CHARGEDBACK';\n\nexport interface GetUrlRequest {\n /**\n * ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n */\n productId: string;\n /**\n * URL for the Wix checkout page. Redirect Wix users to this URL after\n * they've successfully purchased a paid plan for your app.\n * @format WEB_URL\n */\n successUrl?: string | null;\n /**\n * Whether the checkout is for testing purposes only. Testing is mainly\n * relevant for in-app purchase flows. When `true`, Wix charges the site\n * owners an amount of `0.00`.\n *\n * Not supported for usage-based plans.\n */\n testCheckout?: boolean;\n /**\n * Information about the paid plan's billing cycle.\n *\n * Set to `MONTHLY` for usage-based plans.\n */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * 2-letter country code in\n * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)\n * format.\n *\n * Default: `\"US\"`\n */\n countryCode?: string | null;\n /**\n * 2-letter language code in\n * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `\"EN\"`\n */\n languageCode?: string | null;\n /** Coupon code for the paid plan. Available only in case there is a discount. */\n couponCode?: string | null;\n}\n\nexport interface ChargeOverride {\n /**\n * Override price. If you omit the override price, the default price\n * configured in the **Pricing** page of your app's dashboard is used.\n */\n price?: number;\n /**\n * Override 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n */\n currency?: string;\n}\n\nexport interface GetUrlResponse {\n /**\n * URL for the Wix checkout page.\n * @format WEB_URL\n */\n checkoutUrl?: string;\n /**\n * Token for the Wix checkout page. The token holds all data about the order\n * you're creating a checkout for. It's [signed](https://dev.wix.com/docs/api-reference/articles),\n * so you can verify that it comes from Wix.\n */\n token?: string | null;\n}\n\nexport interface GetPurchaseHistoryRequest {}\n\nexport interface GetPurchaseHistoryResponse {\n /** Retrieved purchases the Wix user has completed for you app. */\n purchases?: PurchasedItem[];\n}\n\nexport interface GetSitePaymentMethodsStatusRequest {}\n\nexport interface GetSitePaymentMethodsStatusResponse {\n /**\n * Whether at least 1 online payment method is enabled for the site.\n * Online payment methods include Wix Payments, Stripe, PayPal, and credit\n * cards.\n */\n onlineProviderEnabled?: boolean;\n /** Whether the site accepts offline payments. */\n offlineProviderEnabled?: boolean;\n /**\n * Whether [Wix Point of Sale](https://www.wix.com/pos) is enabled for the site.\n * This allows electronic payments to be made in person.\n */\n wixPosProviderEnabled?: boolean;\n /**\n * Whether the site has enabled at least 1 3rd-party point-of-sale\n * provider. This allows electronic payments to be made in person.\n */\n thirdPartyPosProviderEnabled?: boolean;\n}\n\nexport interface GetMeteredBillingChargesRequest {\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string | null;\n /**\n * Start of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n startDate?: Date | null;\n /**\n * End of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n endDate?: Date | null;\n}\n\nexport interface GetMeteredBillingChargesResponse {\n /** List of retrieved custom charges. */\n charges?: Charge[];\n}\n\nexport interface Charge {\n /** ID of the custom charge. The ID consists of 64 characters. */\n _id?: string | null;\n /** Description of the custom charge. */\n description?: string;\n /**\n * Charge amount.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n amount?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n /** Details related to the account */\n accountInfo?: AccountInfo;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n\nexport interface AccountInfo {\n /**\n * ID of the Wix account associated with the event.\n * @format GUID\n */\n accountId?: string | null;\n /**\n * ID of the parent Wix account. Only included when accountId belongs to a child account.\n * @format GUID\n */\n parentAccountId?: string | null;\n /**\n * ID of the Wix site associated with the event. Only included when the event is tied to a specific site.\n * @format GUID\n */\n siteId?: string | null;\n}\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Details related to the account */\n accountInfo?: AccountInfo;\n}\n\nexport interface PurchasedItemInvoiceStatusUpdatedEnvelope {\n data: InvoiceStatusUpdated;\n metadata: BaseEventMetadata;\n}\n\n/**\n * Triggered when there is an update to the payment status of an invoice.\n * Charges made using the [Custom Charges service plugin](https://dev.wix.com/docs/rest/app-management/app-billing/custom-charges-service-plugin/introduction) may be based on usage.\n * Learn more about [usage-based charges](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model).\n * @permissionScope Manage Your App\n * @permissionScopeId SCOPE.DC.MANAGE-YOUR-APP\n * @permissionScope Read site, business, and email details\n * @permissionScopeId SCOPE.DEV_CENTER.APP-INSTANCE-READ-BASIC-INFO\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @webhook\n * @eventType InvoiceStatusUpdated\n * @serviceIdentifier com.wixpress.market.aim.api.Checkout\n * @slug invoice_status_updated\n */\nexport declare function onPurchasedItemInvoiceStatusUpdated(\n handler: (\n event: PurchasedItemInvoiceStatusUpdatedEnvelope\n ) => void | Promise<void>\n): void;\n\n/**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n * @param productId - ID of your app's paid plan to retrieve the Wix checkout URL for. Check your app's dashboard\n * for a list of your app's supported product IDs.\n * @public\n * @requiredField productId\n * @permissionId WIX_DEVELOPERS.CREATE_CHECKOUT\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetUrl\n */\nexport async function getUrl(\n productId: string,\n options?: GetUrlOptions\n): Promise<NonNullablePaths<GetUrlResponse, `checkoutUrl`, 2>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n productId: productId,\n successUrl: options?.successUrl,\n testCheckout: options?.testCheckout,\n billingCycle: options?.billingCycle,\n countryCode: options?.countryCode,\n languageCode: options?.languageCode,\n couponCode: options?.couponCode,\n });\n\n const reqOpts = ambassadorWixDevcenterCheckoutV1PurchasedItem.getUrl(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n productId: '$[0]',\n successUrl: '$[1].successUrl',\n testCheckout: '$[1].testCheckout',\n billingCycle: '$[1].billingCycle',\n countryCode: '$[1].countryCode',\n languageCode: '$[1].languageCode',\n couponCode: '$[1].couponCode',\n },\n singleArgumentUnchanged: false,\n },\n ['productId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetUrlOptions {\n /**\n * URL for the Wix checkout page. Redirect Wix users to this URL after\n * they've successfully purchased a paid plan for your app.\n * @format WEB_URL\n */\n successUrl?: string | null;\n /**\n * Whether the checkout is for testing purposes only. Testing is mainly\n * relevant for in-app purchase flows. When `true`, Wix charges the site\n * owners an amount of `0.00`.\n *\n * Not supported for usage-based plans.\n */\n testCheckout?: boolean;\n /**\n * Information about the paid plan's billing cycle.\n *\n * Set to `MONTHLY` for usage-based plans.\n */\n billingCycle?: PaymentCycleWithLiterals;\n /**\n * 2-letter country code in\n * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)\n * format.\n *\n * Default: `\"US\"`\n */\n countryCode?: string | null;\n /**\n * 2-letter language code in\n * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `\"EN\"`\n */\n languageCode?: string | null;\n /** Coupon code for the paid plan. Available only in case there is a discount. */\n couponCode?: string | null;\n}\n\n/**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n * @public\n * @permissionId WIX_DEVELOPERS.APP_PURCHASE_HISTORY\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetPurchaseHistory\n */\nexport async function getPurchaseHistory(): Promise<\n NonNullablePaths<\n GetPurchaseHistoryResponse,\n | `purchases`\n | `purchases.${number}.productId`\n | `purchases.${number}.price`\n | `purchases.${number}.currency`\n | `purchases.${number}.billingCycle`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixDevcenterCheckoutV1PurchasedItem.getPurchaseHistory(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_DEVELOPERS.METERED_BILLING_CHARGES_READ\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.Checkout.GetMeteredBillingCharges\n */\nexport async function getMeteredBillingCharges(\n options?: GetMeteredBillingChargesOptions\n): Promise<\n NonNullablePaths<\n GetMeteredBillingChargesResponse,\n `charges` | `charges.${number}.description` | `charges.${number}.amount`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n currency: options?.currency,\n startDate: options?.startDate,\n endDate: options?.endDate,\n });\n\n const reqOpts =\n ambassadorWixDevcenterCheckoutV1PurchasedItem.getMeteredBillingCharges(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n currency: '$[0].currency',\n startDate: '$[0].startDate',\n endDate: '$[0].endDate',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetMeteredBillingChargesOptions {\n /**\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string | null;\n /**\n * Start of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n startDate?: Date | null;\n /**\n * End of the period you want to retrieve the custom charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n endDate?: Date | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiCheckoutUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_billing';\n\n/**\n * Retrieves the URL for a Wix checkout page for the specified paid plan of your app.\n *\n * Call this method when initiating the purchase flow from your pricing page.\n * The returned checkout URL redirects to Wix to complete payment.\n *\n * This call succeeds only if you have previously\n * [set up an external pricing page in your app's dashboard](https://dev.wix.com/docs/build-apps/build-your-app/pricing-plans/set-up-an-external-pricing-page).\n *\n * The returned checkout URL is valid for 48 hours.\n *\n * This API allows your app to manage your pricing page outside of Wix while\n * still using the standard Wix checkout flow.\n */\nexport function getUrl(payload: object): RequestOptionsFactory<any> {\n function __getUrl({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [{ path: 'chargeOverride.price' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'POST' as any,\n methodFqn: 'com.wixpress.market.aim.api.Checkout.GetUrl',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/checkout',\n data: serializedData,\n host,\n }),\n data: serializedData,\n };\n\n return metadata;\n }\n\n return __getUrl;\n}\n\n/**\n * Retrieves a list of past purchases for your app on this site.\n *\n *\n * You don't have to explicitly pass an identifier for the Wix site as part of\n * the request, since this information is taken automatically from the context.\n *\n * The response doesn't include any details about cancellations.\n */\nexport function getPurchaseHistory(\n payload: object\n): RequestOptionsFactory<any> {\n function __getPurchaseHistory({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.market.aim.api.Checkout.GetPurchaseHistory',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/checkout/history',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'purchases.dateCreated' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getPurchaseHistory;\n}\n\n/**\n * Retrieves a preview of charges for a site's [usage-based billing](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/set-up-a-usage-based-business-model#set-up-a-usage-based-business-model).\n *\n * When you call this method, Wix triggers your app's [List Custom Charges service plugin](https://dev.wix.com/docs/api-reference/app-management/app-billing/custom-charges-service-plugin/list-charges) and returns the charges you provide. Use this method to verify that your service plugin is working correctly and returning the expected charges.\n *\n * > **Important:**\n * > This method only retrieves charge information for testing purposes. It doesn't create an invoice or charge the customer. Wix creates actual invoices by calling your List Custom Charges service plugin directly.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\nexport function getMeteredBillingCharges(\n payload: object\n): RequestOptionsFactory<any> {\n function __getMeteredBillingCharges({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'startDate' }, { path: 'endDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.devcenter.checkout.v1.purchased_item',\n method: 'GET' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.Checkout.GetMeteredBillingCharges',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiCheckoutUrl({\n protoPath: '/v1/metered-billing-charges',\n data: serializedData,\n host,\n }),\n params: toURLSearchParams(serializedData),\n };\n\n return metadata;\n }\n\n return __getMeteredBillingCharges;\n}\n"],"mappings":";;;;;;;;;;;;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C1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAkBA,eAAsBE,0BACpB,SAOA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD,UAAU,SAAS;AAAA,IACnB,WAAW,SAAS;AAAA,IACpB,SAAS,SAAS;AAAA,EACpB,CAAC;AAED,QAAM,UAC0C;AAAA,IAC5C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAF;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,UAAU;AAAA,UACV,WAAW;AAAA,UACX,SAAS;AAAA,QACX;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["getMeteredBillingCharges","getPurchaseHistory","getUrl","import_timestamp","import_rest_modules","payload","PaymentCycle","InvoiceStatus","WebhookIdentityType","getUrl","sdkTransformError","getPurchaseHistory","getMeteredBillingCharges"]}
|
package/build/cjs/meta.d.ts
CHANGED
|
@@ -205,6 +205,8 @@ interface MessageEnvelope {
|
|
|
205
205
|
identity?: IdentificationData;
|
|
206
206
|
/** Stringify payload. */
|
|
207
207
|
data?: string;
|
|
208
|
+
/** Details related to the account */
|
|
209
|
+
accountInfo?: AccountInfo;
|
|
208
210
|
}
|
|
209
211
|
interface IdentificationData extends IdentificationDataIdOneOf {
|
|
210
212
|
/**
|
|
@@ -262,19 +264,19 @@ declare enum WebhookIdentityType {
|
|
|
262
264
|
}
|
|
263
265
|
/** @enumType */
|
|
264
266
|
type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
|
|
265
|
-
interface
|
|
267
|
+
interface AccountInfo {
|
|
266
268
|
/**
|
|
267
|
-
* ID of the account.
|
|
269
|
+
* ID of the Wix account associated with the event.
|
|
268
270
|
* @format GUID
|
|
269
271
|
*/
|
|
270
272
|
accountId?: string | null;
|
|
271
273
|
/**
|
|
272
|
-
* ID of the parent account.
|
|
274
|
+
* ID of the parent Wix account. Only included when accountId belongs to a child account.
|
|
273
275
|
* @format GUID
|
|
274
276
|
*/
|
|
275
277
|
parentAccountId?: string | null;
|
|
276
278
|
/**
|
|
277
|
-
* ID of the site
|
|
279
|
+
* ID of the Wix site associated with the event. Only included when the event is tied to a specific site.
|
|
278
280
|
* @format GUID
|
|
279
281
|
*/
|
|
280
282
|
siteId?: string | null;
|
|
@@ -294,4 +296,4 @@ declare function getUrl(): __PublicMethodMetaInfo<'POST', {}, GetUrlRequest$1, G
|
|
|
294
296
|
declare function getPurchaseHistory(): __PublicMethodMetaInfo<'GET', {}, GetPurchaseHistoryRequest$1, GetPurchaseHistoryRequest, GetPurchaseHistoryResponse$1, GetPurchaseHistoryResponse>;
|
|
295
297
|
declare function getMeteredBillingCharges(): __PublicMethodMetaInfo<'GET', {}, GetMeteredBillingChargesRequest$1, GetMeteredBillingChargesRequest, GetMeteredBillingChargesResponse$1, GetMeteredBillingChargesResponse>;
|
|
296
298
|
|
|
297
|
-
export { type
|
|
299
|
+
export { type AccountInfo as AccountInfoOriginal, type Charge as ChargeOriginal, type ChargeOverride as ChargeOverrideOriginal, type GetMeteredBillingChargesRequest as GetMeteredBillingChargesRequestOriginal, type GetMeteredBillingChargesResponse as GetMeteredBillingChargesResponseOriginal, type GetPurchaseHistoryRequest as GetPurchaseHistoryRequestOriginal, type GetPurchaseHistoryResponse as GetPurchaseHistoryResponseOriginal, type GetSitePaymentMethodsStatusRequest as GetSitePaymentMethodsStatusRequestOriginal, type GetSitePaymentMethodsStatusResponse as GetSitePaymentMethodsStatusResponseOriginal, type GetUrlRequest as GetUrlRequestOriginal, type GetUrlResponse as GetUrlResponseOriginal, type IdentificationDataIdOneOf as IdentificationDataIdOneOfOriginal, type IdentificationData as IdentificationDataOriginal, InvoiceStatus as InvoiceStatusOriginal, type InvoiceStatusUpdated as InvoiceStatusUpdatedOriginal, type InvoiceStatusWithLiterals as InvoiceStatusWithLiteralsOriginal, type MessageEnvelope as MessageEnvelopeOriginal, PaymentCycle as PaymentCycleOriginal, type PaymentCycleWithLiterals as PaymentCycleWithLiteralsOriginal, type PurchasedItem as PurchasedItemOriginal, WebhookIdentityType as WebhookIdentityTypeOriginal, type WebhookIdentityTypeWithLiterals as WebhookIdentityTypeWithLiteralsOriginal, type __PublicMethodMetaInfo, getMeteredBillingCharges, getPurchaseHistory, getUrl };
|