@wix/auto_sdk_app-management_custom-charges 1.0.18 → 1.0.19

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.
Files changed (29) hide show
  1. package/build/cjs/index.d.ts +2 -2
  2. package/build/cjs/index.js +50 -0
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +23 -3
  5. package/build/cjs/index.typings.js +16 -2
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/{interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.d.ts → interfaces-premium-v1-custom-charges-provider.public-Cb68XI-I.d.ts} +158 -1
  8. package/build/es/index.d.mts +2 -2
  9. package/build/es/index.mjs +48 -0
  10. package/build/es/index.mjs.map +1 -1
  11. package/build/es/index.typings.d.mts +23 -3
  12. package/build/es/index.typings.mjs +13 -1
  13. package/build/es/index.typings.mjs.map +1 -1
  14. package/build/es/{interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.d.mts → interfaces-premium-v1-custom-charges-provider.public-Cb68XI-I.d.mts} +158 -1
  15. package/build/internal/cjs/index.d.ts +2 -2
  16. package/build/internal/cjs/index.js +50 -0
  17. package/build/internal/cjs/index.js.map +1 -1
  18. package/build/internal/cjs/index.typings.d.ts +23 -3
  19. package/build/internal/cjs/index.typings.js +16 -2
  20. package/build/internal/cjs/index.typings.js.map +1 -1
  21. package/build/internal/cjs/{interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.d.ts → interfaces-premium-v1-custom-charges-provider.public-Cb68XI-I.d.ts} +158 -1
  22. package/build/internal/es/index.d.mts +2 -2
  23. package/build/internal/es/index.mjs +48 -0
  24. package/build/internal/es/index.mjs.map +1 -1
  25. package/build/internal/es/index.typings.d.mts +23 -3
  26. package/build/internal/es/index.typings.mjs +13 -1
  27. package/build/internal/es/index.typings.mjs.map +1 -1
  28. package/build/internal/es/{interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.d.mts → interfaces-premium-v1-custom-charges-provider.public-Cb68XI-I.d.mts} +158 -1
  29. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.js';
2
- export { A as AlternativeUri, i as ChargeLimitUpdatedRequest, j as ChargeLimitUpdatedResponse, C as ChargeLineItem, d as ChargesRejectedReason, c as ChargesRejectedRequest, e as ChargesRejectedResponse, l as Context, k as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, n as IdentificationData, o as IdentificationDataIdOneOf, m as IdentityType, I as Intent, f as InvoiceCreatedRequest, h as InvoiceCreatedResponse, g as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, S as SpiBaseUri } from './interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.js';
1
+ import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-provider.public-Cb68XI-I.js';
2
+ export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, r as ChargeLimitUpdatedResponse, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, h as ChargesRejectedResponse, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, o as InvoiceCreatedResponse, n as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, c as ListUsagesRequest, d as ListUsagesRequestIntent, e as ListUsagesResponse, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest, l as UsagesRejectedResponse } from './interfaces-premium-v1-custom-charges-provider.public-Cb68XI-I.js';
3
3
  import { BuildServicePluginDefinition } from '@wix/sdk-types';
4
4
 
5
5
  declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
@@ -23,6 +23,8 @@ __export(index_exports, {
23
23
  ChargesRejectedReason: () => ChargesRejectedReason,
24
24
  IdentityType: () => IdentityType,
25
25
  Intent: () => Intent,
26
+ ListUsagesRequestIntent: () => ListUsagesRequestIntent,
27
+ UsagesRejectedReason: () => UsagesRejectedReason,
26
28
  provideHandlers: () => provideHandlers2,
27
29
  publicProvideHandlers: () => provideHandlers
28
30
  });
@@ -34,6 +36,11 @@ var Intent = /* @__PURE__ */ ((Intent2) => {
34
36
  Intent2["CREATE_INVOICE"] = "CREATE_INVOICE";
35
37
  return Intent2;
36
38
  })(Intent || {});
39
+ var ListUsagesRequestIntent = /* @__PURE__ */ ((ListUsagesRequestIntent2) => {
40
+ ListUsagesRequestIntent2["DISPLAY_ONLY"] = "DISPLAY_ONLY";
41
+ ListUsagesRequestIntent2["CREATE_INVOICE"] = "CREATE_INVOICE";
42
+ return ListUsagesRequestIntent2;
43
+ })(ListUsagesRequestIntent || {});
37
44
  var ChargesRejectedReason = /* @__PURE__ */ ((ChargesRejectedReason2) => {
38
45
  ChargesRejectedReason2["UNKNOWN"] = "UNKNOWN";
39
46
  ChargesRejectedReason2["CHARGE_LIMIT_EXCEEDED"] = "CHARGE_LIMIT_EXCEEDED";
@@ -41,6 +48,11 @@ var ChargesRejectedReason = /* @__PURE__ */ ((ChargesRejectedReason2) => {
41
48
  ChargesRejectedReason2["INVALID_FORMAT"] = "INVALID_FORMAT";
42
49
  return ChargesRejectedReason2;
43
50
  })(ChargesRejectedReason || {});
51
+ var UsagesRejectedReason = /* @__PURE__ */ ((UsagesRejectedReason2) => {
52
+ UsagesRejectedReason2["UNKNOWN"] = "UNKNOWN";
53
+ UsagesRejectedReason2["CHARGE_LIMIT_EXCEEDED"] = "CHARGE_LIMIT_EXCEEDED";
54
+ return UsagesRejectedReason2;
55
+ })(UsagesRejectedReason || {});
44
56
  var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
45
57
  IdentityType2["UNKNOWN"] = "UNKNOWN";
46
58
  IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
@@ -92,6 +104,28 @@ var provideHandlers = (0, import_sdk_types.ServicePluginDefinition)("PREMIUM_CUS
92
104
  }
93
105
  }
94
106
  },
107
+ {
108
+ name: "listUsages",
109
+ primaryHttpMappingPath: "/v1/usages",
110
+ transformations: {
111
+ toREST: (payload) => {
112
+ const toRestResponse = payload;
113
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
114
+ },
115
+ fromREST: (payload) => {
116
+ const fromRestRequest = (0, import_transform_paths.transformPaths)(payload, [
117
+ {
118
+ transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
119
+ paths: [
120
+ { path: "request.periodStart" },
121
+ { path: "request.periodEnd" }
122
+ ]
123
+ }
124
+ ]);
125
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
126
+ }
127
+ }
128
+ },
95
129
  {
96
130
  name: "chargesRejectedEvent",
97
131
  primaryHttpMappingPath: "/v1/charges-rejected",
@@ -106,6 +140,20 @@ var provideHandlers = (0, import_sdk_types.ServicePluginDefinition)("PREMIUM_CUS
106
140
  }
107
141
  }
108
142
  },
143
+ {
144
+ name: "usagesRejectedEvent",
145
+ primaryHttpMappingPath: "/v1/usages-rejected",
146
+ transformations: {
147
+ toREST: (payload) => {
148
+ const toRestResponse = payload;
149
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
150
+ },
151
+ fromREST: (payload) => {
152
+ const fromRestRequest = payload;
153
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
154
+ }
155
+ }
156
+ },
109
157
  {
110
158
  name: "invoiceCreatedEvent",
111
159
  primaryHttpMappingPath: "/v1/invoice-created",
@@ -146,6 +194,8 @@ var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModu
146
194
  ChargesRejectedReason,
147
195
  IdentityType,
148
196
  Intent,
197
+ ListUsagesRequestIntent,
198
+ UsagesRejectedReason,
149
199
  provideHandlers,
150
200
  publicProvideHandlers
151
201
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-premium-v1-custom-charges-provider.public.ts","../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-premium-v1-custom-charges-provider.context.js';\n","export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** You must submit charges as whole numbers or use a dot to separate major and minor units. For example, `10` or `1.50`. Currently, Wix doesn't validate whether the submitted number of decimals for the minor unit is supported for the given currency. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 5\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\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?: IdentityType;\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","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n GetChargeLimitRequest,\n GetChargeLimitResponse,\n ListChargesRequest,\n ListChargesResponse,\n ChargesRejectedRequest,\n ChargesRejectedResponse,\n InvoiceCreatedRequest,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedRequest,\n ChargeLimitUpdatedResponse,\n} from './service-plugins-types.js';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface GetChargeLimitEnvelope {\n request: GetChargeLimitRequest;\n metadata: Context;\n}\n\nexport interface ListChargesEnvelope {\n request: ListChargesRequest;\n metadata: Context;\n}\n\nexport interface ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\n metadata: Context;\n}\n\nexport interface InvoiceCreatedEventEnvelope {\n request: InvoiceCreatedRequest;\n metadata: Context;\n}\n\nexport interface ChargeLimitUpdatedEventEnvelope {\n request: ChargeLimitUpdatedRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it. */\n getChargeLimit(\n payload: GetChargeLimitEnvelope\n ): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n\n /**\n *\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation. */\n listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */\n chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n ): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app. */\n invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n ): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n\n /**\n *\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it. */\n chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n ): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n}>('PREMIUM_CUSTOM_CHARGES', [\n {\n name: 'getChargeLimit',\n primaryHttpMappingPath: '/v1/charge-limit',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listCharges',\n primaryHttpMappingPath: '/v1/charges',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargesRejectedEvent',\n primaryHttpMappingPath: '/v1/charges-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'invoiceCreatedEvent',\n primaryHttpMappingPath: '/v1/invoice-created',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargeLimitUpdatedEvent',\n primaryHttpMappingPath: '/v1/limit-updated',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-premium-v1-custom-charges-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKC,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;AChTZ,uBAAwC;AAcxC,uBAAqD;AACrD,6BAA+B;AAC/B,oCAGO;AA2BA,IAAM,sBAAkB,0CAsE5B,0BAA0B;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,sBAAkB,uCAAe,SAAS;AAAA,UAC9C;AAAA,YACE,aAAa;AAAA,YACb,OAAO;AAAA,cACL,EAAE,MAAM,sBAAsB;AAAA,cAC9B,EAAE,MAAM,oBAAoB;AAAA,YAC9B;AAAA,UACF;AAAA,QACF,CAAC;AAED,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AChND,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;","names":["provideHandlers","Intent","ChargesRejectedReason","IdentityType","provideHandlers"]}
1
+ {"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-premium-v1-custom-charges-provider.public.ts","../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-premium-v1-custom-charges-provider.context.js';\n","export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** You must submit charges as whole numbers or use a dot to separate major and minor units. For example, `10` or `1.50`. Currently, Wix doesn't validate whether the submitted number of decimals for the minor unit is supported for the given currency. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 5\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\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?: IdentityType;\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","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n GetChargeLimitRequest,\n GetChargeLimitResponse,\n ListChargesRequest,\n ListChargesResponse,\n ListUsagesRequest,\n ListUsagesResponse,\n ChargesRejectedRequest,\n ChargesRejectedResponse,\n UsagesRejectedRequest,\n UsagesRejectedResponse,\n InvoiceCreatedRequest,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedRequest,\n ChargeLimitUpdatedResponse,\n} from './service-plugins-types.js';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface GetChargeLimitEnvelope {\n request: GetChargeLimitRequest;\n metadata: Context;\n}\n\nexport interface ListChargesEnvelope {\n request: ListChargesRequest;\n metadata: Context;\n}\n\nexport interface ListUsagesEnvelope {\n request: ListUsagesRequest;\n metadata: Context;\n}\n\nexport interface ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\n metadata: Context;\n}\n\nexport interface UsagesRejectedEventEnvelope {\n request: UsagesRejectedRequest;\n metadata: Context;\n}\n\nexport interface InvoiceCreatedEventEnvelope {\n request: InvoiceCreatedRequest;\n metadata: Context;\n}\n\nexport interface ChargeLimitUpdatedEventEnvelope {\n request: ChargeLimitUpdatedRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it. */\n getChargeLimit(\n payload: GetChargeLimitEnvelope\n ): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n\n /**\n *\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation. */\n listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\n\n /**\n *\n * Wix calls this method to retrieve counter usage quantities for a paid instance\n * of your app. This happens when Wix needs to understand how much of each counter\n * a customer has used during a specific period.\n *\n * You must return the usage quantities in integer units for the requested\n * counter IDs. The usage should only reflect consumption that occurred during\n * the period Wix specifies when retrieving the usages. */\n listUsages(\n payload: ListUsagesEnvelope\n ): ListUsagesResponse | Promise<ListUsagesResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */\n chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n ): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the usage-based charges calculated from\n * the usages you've returned in the List Usages method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * calculates charges from your usage data and validates them against the limit.\n * Wix doesn't create an invoice in case the usage-based charges aren't accepted. */\n usagesRejectedEvent(\n payload: UsagesRejectedEventEnvelope\n ): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app. */\n invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n ): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n\n /**\n *\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it. */\n chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n ): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n}>('PREMIUM_CUSTOM_CHARGES', [\n {\n name: 'getChargeLimit',\n primaryHttpMappingPath: '/v1/charge-limit',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listCharges',\n primaryHttpMappingPath: '/v1/charges',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listUsages',\n primaryHttpMappingPath: '/v1/usages',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargesRejectedEvent',\n primaryHttpMappingPath: '/v1/charges-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'usagesRejectedEvent',\n primaryHttpMappingPath: '/v1/usages-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'invoiceCreatedEvent',\n primaryHttpMappingPath: '/v1/invoice-created',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargeLimitUpdatedEvent',\n primaryHttpMappingPath: '/v1/limit-updated',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-premium-v1-custom-charges-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKC,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAsEL,IAAK,0BAAL,kBAAKC,6BAAL;AAEL,EAAAA,yBAAA,kBAAe;AAEf,EAAAA,yBAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAwEL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AA8EL,IAAK,uBAAL,kBAAKC,0BAAL;AAEL,EAAAA,sBAAA,aAAU;AAEV,EAAAA,sBAAA,2BAAwB;AAJd,SAAAA;AAAA,GAAA;AA8JL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxbZ,uBAAwC;AAkBxC,uBAAqD;AACrD,6BAA+B;AAC/B,oCAGO;AAqCA,IAAM,sBAAkB,0CAgG5B,0BAA0B;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,sBAAkB,uCAAe,SAAS;AAAA,UAC9C;AAAA,YACE,aAAa;AAAA,YACb,OAAO;AAAA,cACL,EAAE,MAAM,sBAAsB;AAAA,cAC9B,EAAE,MAAM,oBAAoB;AAAA,YAC9B;AAAA,UACF;AAAA,QACF,CAAC;AAED,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,sBAAkB,uCAAe,SAAS;AAAA,UAC9C;AAAA,YACE,aAAa;AAAA,YACb,OAAO;AAAA,cACL,EAAE,MAAM,sBAAsB;AAAA,cAC9B,EAAE,MAAM,oBAAoB;AAAA,YAC9B;AAAA,UACF;AAAA,QACF,CAAC;AAED,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AClSD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;","names":["provideHandlers","Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType","provideHandlers"]}
@@ -1,5 +1,5 @@
1
- import { q as GetChargeLimitEnvelope, a as GetChargeLimitResponse, r as ListChargesEnvelope, b as ListChargesResponse, s as ChargesRejectedEventEnvelope, e as ChargesRejectedResponse, t as InvoiceCreatedEventEnvelope, h as InvoiceCreatedResponse, u as ChargeLimitUpdatedEventEnvelope, j as ChargeLimitUpdatedResponse } from './interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.js';
2
- export { A as AlternativeUri, i as ChargeLimitUpdatedRequest, C as ChargeLineItem, d as ChargesRejectedReason, c as ChargesRejectedRequest, l as Context, k as CustomChargesConfig, G as GetChargeLimitRequest, n as IdentificationData, o as IdentificationDataIdOneOf, m as IdentityType, I as Intent, f as InvoiceCreatedRequest, g as InvoiceLineItem, L as ListChargesRequest, S as SpiBaseUri } from './interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.js';
1
+ import { x as GetChargeLimitEnvelope, a as GetChargeLimitResponse, y as ListChargesEnvelope, b as ListChargesResponse, z as ListUsagesEnvelope, e as ListUsagesResponse, B as ChargesRejectedEventEnvelope, h as ChargesRejectedResponse, D as UsagesRejectedEventEnvelope, l as UsagesRejectedResponse, E as InvoiceCreatedEventEnvelope, o as InvoiceCreatedResponse, F as ChargeLimitUpdatedEventEnvelope, r as ChargeLimitUpdatedResponse } from './interfaces-premium-v1-custom-charges-provider.public-Cb68XI-I.js';
2
+ export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, n as InvoiceLineItem, L as ListChargesRequest, c as ListUsagesRequest, d as ListUsagesRequestIntent, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest } from './interfaces-premium-v1-custom-charges-provider.public-Cb68XI-I.js';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
@@ -33,6 +33,16 @@ declare function getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimit
33
33
  * resolve the situation.
34
34
  */
35
35
  declare function listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
36
+ /**
37
+ * Wix calls this method to retrieve counter usage quantities for a paid instance
38
+ * of your app. This happens when Wix needs to understand how much of each counter
39
+ * a customer has used during a specific period.
40
+ *
41
+ * You must return the usage quantities in integer units for the requested
42
+ * counter IDs. The usage should only reflect consumption that occurred during
43
+ * the period Wix specifies when retrieving the usages.
44
+ */
45
+ declare function listUsages(payload: ListUsagesEnvelope): ListUsagesResponse | Promise<ListUsagesResponse>;
36
46
  /**
37
47
  * Triggered in case Wix doesn't accept the charges you've returned in the
38
48
  * List Charges method.
@@ -43,6 +53,16 @@ declare function listCharges(payload: ListChargesEnvelope): ListChargesResponse
43
53
  * charge limit. Wix doesn't create an invoice in case the charges aren't accepted.
44
54
  */
45
55
  declare function chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
56
+ /**
57
+ * Triggered in case Wix doesn't accept the usage-based charges calculated from
58
+ * the usages you've returned in the List Usages method.
59
+ *
60
+ *
61
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
62
+ * calculates charges from your usage data and validates them against the limit.
63
+ * Wix doesn't create an invoice in case the usage-based charges aren't accepted.
64
+ */
65
+ declare function usagesRejectedEvent(payload: UsagesRejectedEventEnvelope): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;
46
66
  /**
47
67
  * Triggered in case Wix creates an invoice that includes charges for an instance
48
68
  * of your app.
@@ -58,4 +78,4 @@ declare function invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): Invo
58
78
  */
59
79
  declare function chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
60
80
 
61
- export { ChargeLimitUpdatedEventEnvelope, ChargeLimitUpdatedResponse, ChargesRejectedEventEnvelope, ChargesRejectedResponse, GetChargeLimitEnvelope, GetChargeLimitResponse, InvoiceCreatedEventEnvelope, InvoiceCreatedResponse, ListChargesEnvelope, ListChargesResponse, chargeLimitUpdatedEvent, chargesRejectedEvent, getChargeLimit, invoiceCreatedEvent, listCharges };
81
+ export { ChargeLimitUpdatedEventEnvelope, ChargeLimitUpdatedResponse, ChargesRejectedEventEnvelope, ChargesRejectedResponse, GetChargeLimitEnvelope, GetChargeLimitResponse, InvoiceCreatedEventEnvelope, InvoiceCreatedResponse, ListChargesEnvelope, ListChargesResponse, ListUsagesEnvelope, ListUsagesResponse, UsagesRejectedEventEnvelope, UsagesRejectedResponse, chargeLimitUpdatedEvent, chargesRejectedEvent, getChargeLimit, invoiceCreatedEvent, listCharges, listUsages, usagesRejectedEvent };
@@ -22,7 +22,9 @@ var index_typings_exports = {};
22
22
  __export(index_typings_exports, {
23
23
  ChargesRejectedReason: () => ChargesRejectedReason,
24
24
  IdentityType: () => IdentityType,
25
- Intent: () => Intent
25
+ Intent: () => Intent,
26
+ ListUsagesRequestIntent: () => ListUsagesRequestIntent,
27
+ UsagesRejectedReason: () => UsagesRejectedReason
26
28
  });
27
29
  module.exports = __toCommonJS(index_typings_exports);
28
30
 
@@ -32,6 +34,11 @@ var Intent = /* @__PURE__ */ ((Intent2) => {
32
34
  Intent2["CREATE_INVOICE"] = "CREATE_INVOICE";
33
35
  return Intent2;
34
36
  })(Intent || {});
37
+ var ListUsagesRequestIntent = /* @__PURE__ */ ((ListUsagesRequestIntent2) => {
38
+ ListUsagesRequestIntent2["DISPLAY_ONLY"] = "DISPLAY_ONLY";
39
+ ListUsagesRequestIntent2["CREATE_INVOICE"] = "CREATE_INVOICE";
40
+ return ListUsagesRequestIntent2;
41
+ })(ListUsagesRequestIntent || {});
35
42
  var ChargesRejectedReason = /* @__PURE__ */ ((ChargesRejectedReason2) => {
36
43
  ChargesRejectedReason2["UNKNOWN"] = "UNKNOWN";
37
44
  ChargesRejectedReason2["CHARGE_LIMIT_EXCEEDED"] = "CHARGE_LIMIT_EXCEEDED";
@@ -39,6 +46,11 @@ var ChargesRejectedReason = /* @__PURE__ */ ((ChargesRejectedReason2) => {
39
46
  ChargesRejectedReason2["INVALID_FORMAT"] = "INVALID_FORMAT";
40
47
  return ChargesRejectedReason2;
41
48
  })(ChargesRejectedReason || {});
49
+ var UsagesRejectedReason = /* @__PURE__ */ ((UsagesRejectedReason2) => {
50
+ UsagesRejectedReason2["UNKNOWN"] = "UNKNOWN";
51
+ UsagesRejectedReason2["CHARGE_LIMIT_EXCEEDED"] = "CHARGE_LIMIT_EXCEEDED";
52
+ return UsagesRejectedReason2;
53
+ })(UsagesRejectedReason || {});
42
54
  var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
43
55
  IdentityType2["UNKNOWN"] = "UNKNOWN";
44
56
  IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
@@ -51,6 +63,8 @@ var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
51
63
  0 && (module.exports = {
52
64
  ChargesRejectedReason,
53
65
  IdentityType,
54
- Intent
66
+ Intent,
67
+ ListUsagesRequestIntent,
68
+ UsagesRejectedReason
55
69
  });
56
70
  //# sourceMappingURL=index.typings.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import {\n GetChargeLimitResponse,\n ListChargesResponse,\n ChargesRejectedResponse,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedResponse,\n} from './src/service-plugins-types.js';\nimport {\n GetChargeLimitEnvelope,\n ListChargesEnvelope,\n ChargesRejectedEventEnvelope,\n InvoiceCreatedEventEnvelope,\n ChargeLimitUpdatedEventEnvelope,\n} from './src/interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport * from './src/service-plugins-types';\nexport {\n GetChargeLimitEnvelope,\n ListChargesEnvelope,\n ChargesRejectedEventEnvelope,\n InvoiceCreatedEventEnvelope,\n ChargeLimitUpdatedEventEnvelope,\n};\n\n/**\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it.\n */\nexport declare function getChargeLimit(\n payload: GetChargeLimitEnvelope\n): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n/**\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation.\n */\nexport declare function listCharges(\n payload: ListChargesEnvelope\n): ListChargesResponse | Promise<ListChargesResponse>;\n/**\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted.\n */\nexport declare function chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n/**\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app.\n */\nexport declare function invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n/**\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it.\n */\nexport declare function chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n","export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** You must submit charges as whole numbers or use a dot to separate major and minor units. For example, `10` or `1.50`. Currently, Wix doesn't validate whether the submitted number of decimals for the minor unit is supported for the given currency. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 5\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\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?: IdentityType;\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["Intent","ChargesRejectedReason","IdentityType"]}
1
+ {"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import {\n GetChargeLimitResponse,\n ListChargesResponse,\n ListUsagesResponse,\n ChargesRejectedResponse,\n UsagesRejectedResponse,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedResponse,\n} from './src/service-plugins-types.js';\nimport {\n GetChargeLimitEnvelope,\n ListChargesEnvelope,\n ListUsagesEnvelope,\n ChargesRejectedEventEnvelope,\n UsagesRejectedEventEnvelope,\n InvoiceCreatedEventEnvelope,\n ChargeLimitUpdatedEventEnvelope,\n} from './src/interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport * from './src/service-plugins-types';\nexport {\n GetChargeLimitEnvelope,\n ListChargesEnvelope,\n ListUsagesEnvelope,\n ChargesRejectedEventEnvelope,\n UsagesRejectedEventEnvelope,\n InvoiceCreatedEventEnvelope,\n ChargeLimitUpdatedEventEnvelope,\n};\n\n/**\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it.\n */\nexport declare function getChargeLimit(\n payload: GetChargeLimitEnvelope\n): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n/**\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation.\n */\nexport declare function listCharges(\n payload: ListChargesEnvelope\n): ListChargesResponse | Promise<ListChargesResponse>;\n/**\n * Wix calls this method to retrieve counter usage quantities for a paid instance\n * of your app. This happens when Wix needs to understand how much of each counter\n * a customer has used during a specific period.\n *\n * You must return the usage quantities in integer units for the requested\n * counter IDs. The usage should only reflect consumption that occurred during\n * the period Wix specifies when retrieving the usages.\n */\nexport declare function listUsages(\n payload: ListUsagesEnvelope\n): ListUsagesResponse | Promise<ListUsagesResponse>;\n/**\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted.\n */\nexport declare function chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n/**\n * Triggered in case Wix doesn't accept the usage-based charges calculated from\n * the usages you've returned in the List Usages method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * calculates charges from your usage data and validates them against the limit.\n * Wix doesn't create an invoice in case the usage-based charges aren't accepted.\n */\nexport declare function usagesRejectedEvent(\n payload: UsagesRejectedEventEnvelope\n): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;\n/**\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app.\n */\nexport declare function invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n/**\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it.\n */\nexport declare function chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n","export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** You must submit charges as whole numbers or use a dot to separate major and minor units. For example, `10` or `1.50`. Currently, Wix doesn't validate whether the submitted number of decimals for the minor unit is supported for the given currency. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 5\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\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?: IdentityType;\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAsEL,IAAK,0BAAL,kBAAKC,6BAAL;AAEL,EAAAA,yBAAA,kBAAe;AAEf,EAAAA,yBAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAwEL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AA8EL,IAAK,uBAAL,kBAAKC,0BAAL;AAEL,EAAAA,sBAAA,aAAU;AAEV,EAAAA,sBAAA,2BAAwB;AAJd,SAAAA;AAAA,GAAA;AA8JL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType"]}
@@ -97,6 +97,62 @@ interface ChargeLineItem {
97
97
  */
98
98
  amount?: string;
99
99
  }
100
+ interface ListUsagesRequest {
101
+ /**
102
+ * ID of the subscription for which Wix retrieves feature usages.
103
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
104
+ * of the `subscriptionId`.
105
+ * @format GUID
106
+ */
107
+ subscriptionId?: string;
108
+ /**
109
+ * List of counter IDs to get usage quantities for.
110
+ * @maxSize 5
111
+ * @minLength 1
112
+ * @maxLength 100
113
+ */
114
+ counterIds?: string[];
115
+ /**
116
+ * Begin of the period Wix retrieves the app instance's feature usages for in
117
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
118
+ */
119
+ periodStart?: Date | null;
120
+ /**
121
+ * End of the period Wix retrieves the app instance's feature usages for in
122
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
123
+ */
124
+ periodEnd?: Date | null;
125
+ /** Information about what Wix intends to do with the retrieved usages. */
126
+ intent?: ListUsagesRequestIntent;
127
+ }
128
+ declare enum ListUsagesRequestIntent {
129
+ /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
130
+ DISPLAY_ONLY = "DISPLAY_ONLY",
131
+ /** Create an invoice for the customer. */
132
+ CREATE_INVOICE = "CREATE_INVOICE"
133
+ }
134
+ interface ListUsagesResponse {
135
+ /**
136
+ * Retrieved feature usages.
137
+ * @maxSize 5
138
+ */
139
+ usages?: Usage[];
140
+ }
141
+ interface Usage {
142
+ /**
143
+ * ID of the counter for which usage is reported.
144
+ * @minLength 1
145
+ * @maxLength 100
146
+ */
147
+ counterId?: string;
148
+ /** Usage quantity for this feature in integer units. */
149
+ quantity?: number;
150
+ /**
151
+ * Description of the usage.
152
+ * @maxLength 256
153
+ */
154
+ description?: string;
155
+ }
100
156
  interface ChargesRejectedRequest {
101
157
  /**
102
158
  * ID of the subscription for which Wix hasn't accepted your custom charges.
@@ -149,6 +205,77 @@ declare enum ChargesRejectedReason {
149
205
  }
150
206
  interface ChargesRejectedResponse {
151
207
  }
208
+ interface UsagesRejectedRequest {
209
+ /**
210
+ * ID of the subscription for which Wix hasn't accepted your usage-based charges.
211
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
212
+ * of the `subscriptionId`.
213
+ * @format GUID
214
+ */
215
+ subscriptionId?: string;
216
+ /**
217
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
218
+ *
219
+ * 3-letter currency code in
220
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
221
+ * format of the calculated charges. Wix may add supported currencies in the future.
222
+ * @format CURRENCY
223
+ */
224
+ currency?: string;
225
+ /**
226
+ * Usage line items that include the counter ID, quantity, unit price, and
227
+ * calculated amount.
228
+ * Max: 5 counter IDs
229
+ * @maxSize 5
230
+ */
231
+ usageLineItems?: UsageLineItem[];
232
+ /**
233
+ * Maximum amount that your app may charge the customer per billing cycle.
234
+ *
235
+ * Min: `0.50`
236
+ * @format DECIMAL_VALUE
237
+ * @decimalValue options { gt:0.00, maxScale:2 }
238
+ */
239
+ chargeLimit?: string | null;
240
+ /**
241
+ * Information about why Wix has rejected your app's usage-based charges.
242
+ *
243
+ * Max: 20 reasons
244
+ * @maxSize 20
245
+ */
246
+ reasons?: UsagesRejectedReason[];
247
+ }
248
+ /** Details about the usage line items. */
249
+ interface UsageLineItem {
250
+ /**
251
+ * ID of the counter for which usage is reported.
252
+ * @maxLength 100
253
+ * @minLength 1
254
+ */
255
+ counterId?: string;
256
+ /** Usage quantity for this counter in integer units. */
257
+ quantity?: number;
258
+ /**
259
+ * Price per unit that is linked to the counterId on the related product of the subscription.
260
+ * @format DECIMAL_VALUE
261
+ * @decimalValue options { gte:0.00, maxScale:2 }
262
+ */
263
+ unitPrice?: string;
264
+ /**
265
+ * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.
266
+ * @format DECIMAL_VALUE
267
+ * @decimalValue options { gte:0.00, maxScale:2 }
268
+ */
269
+ amount?: string;
270
+ }
271
+ declare enum UsagesRejectedReason {
272
+ /** There is no information about why Wix has rejected the usage-based charges. */
273
+ UNKNOWN = "UNKNOWN",
274
+ /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */
275
+ CHARGE_LIMIT_EXCEEDED = "CHARGE_LIMIT_EXCEEDED"
276
+ }
277
+ interface UsagesRejectedResponse {
278
+ }
152
279
  interface InvoiceCreatedRequest {
153
280
  /**
154
281
  * ID of the subscription for which Wix has created an invoice that includes
@@ -228,6 +355,8 @@ interface CustomChargesConfig {
228
355
  * Get Charge Limit method.
229
356
  */
230
357
  baseUri?: SpiBaseUri;
358
+ /** Flag that indicates if charges by usages are enabled */
359
+ listUsagesEnabled?: boolean;
231
360
  }
232
361
  interface SpiBaseUri {
233
362
  /**
@@ -352,10 +481,18 @@ interface ListChargesEnvelope {
352
481
  request: ListChargesRequest;
353
482
  metadata: Context;
354
483
  }
484
+ interface ListUsagesEnvelope {
485
+ request: ListUsagesRequest;
486
+ metadata: Context;
487
+ }
355
488
  interface ChargesRejectedEventEnvelope {
356
489
  request: ChargesRejectedRequest;
357
490
  metadata: Context;
358
491
  }
492
+ interface UsagesRejectedEventEnvelope {
493
+ request: UsagesRejectedRequest;
494
+ metadata: Context;
495
+ }
359
496
  interface InvoiceCreatedEventEnvelope {
360
497
  request: InvoiceCreatedRequest;
361
498
  metadata: Context;
@@ -396,6 +533,16 @@ declare const provideHandlers: ServicePluginDefinition<{
396
533
  * become aware of any overcharging issues so that we can work together to
397
534
  * resolve the situation. */
398
535
  listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
536
+ /**
537
+ *
538
+ * Wix calls this method to retrieve counter usage quantities for a paid instance
539
+ * of your app. This happens when Wix needs to understand how much of each counter
540
+ * a customer has used during a specific period.
541
+ *
542
+ * You must return the usage quantities in integer units for the requested
543
+ * counter IDs. The usage should only reflect consumption that occurred during
544
+ * the period Wix specifies when retrieving the usages. */
545
+ listUsages(payload: ListUsagesEnvelope): ListUsagesResponse | Promise<ListUsagesResponse>;
399
546
  /**
400
547
  *
401
548
  * Triggered in case Wix doesn't accept the charges you've returned in the
@@ -406,6 +553,16 @@ declare const provideHandlers: ServicePluginDefinition<{
406
553
  * call List Charges in regular intervals until the sum of all charges is lower than the
407
554
  * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */
408
555
  chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
556
+ /**
557
+ *
558
+ * Triggered in case Wix doesn't accept the usage-based charges calculated from
559
+ * the usages you've returned in the List Usages method.
560
+ *
561
+ *
562
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
563
+ * calculates charges from your usage data and validates them against the limit.
564
+ * Wix doesn't create an invoice in case the usage-based charges aren't accepted. */
565
+ usagesRejectedEvent(payload: UsagesRejectedEventEnvelope): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;
409
566
  /**
410
567
  *
411
568
  * Triggered in case Wix creates an invoice that includes charges for an instance
@@ -422,4 +579,4 @@ declare const provideHandlers: ServicePluginDefinition<{
422
579
  chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
423
580
  }>;
424
581
 
425
- export { type AlternativeUri as A, type ChargeLineItem as C, type GetChargeLimitRequest as G, Intent as I, type ListChargesRequest as L, type SpiBaseUri as S, type GetChargeLimitResponse as a, type ListChargesResponse as b, type ChargesRejectedRequest as c, ChargesRejectedReason as d, type ChargesRejectedResponse as e, type InvoiceCreatedRequest as f, type InvoiceLineItem as g, type InvoiceCreatedResponse as h, type ChargeLimitUpdatedRequest as i, type ChargeLimitUpdatedResponse as j, type CustomChargesConfig as k, type Context as l, IdentityType as m, type IdentificationData as n, type IdentificationDataIdOneOf as o, provideHandlers as p, type GetChargeLimitEnvelope as q, type ListChargesEnvelope as r, type ChargesRejectedEventEnvelope as s, type InvoiceCreatedEventEnvelope as t, type ChargeLimitUpdatedEventEnvelope as u };
582
+ export { type AlternativeUri as A, type ChargesRejectedEventEnvelope as B, type ChargeLineItem as C, type UsagesRejectedEventEnvelope as D, type InvoiceCreatedEventEnvelope as E, type ChargeLimitUpdatedEventEnvelope as F, type GetChargeLimitRequest as G, Intent as I, type ListChargesRequest as L, type SpiBaseUri as S, type Usage as U, type GetChargeLimitResponse as a, type ListChargesResponse as b, type ListUsagesRequest as c, ListUsagesRequestIntent as d, type ListUsagesResponse as e, type ChargesRejectedRequest as f, ChargesRejectedReason as g, type ChargesRejectedResponse as h, type UsagesRejectedRequest as i, type UsageLineItem as j, UsagesRejectedReason as k, type UsagesRejectedResponse as l, type InvoiceCreatedRequest as m, type InvoiceLineItem as n, type InvoiceCreatedResponse as o, provideHandlers as p, type ChargeLimitUpdatedRequest as q, type ChargeLimitUpdatedResponse as r, type CustomChargesConfig as s, type Context as t, IdentityType as u, type IdentificationData as v, type IdentificationDataIdOneOf as w, type GetChargeLimitEnvelope as x, type ListChargesEnvelope as y, type ListUsagesEnvelope as z };