@wix/auto_sdk_app-management_custom-charges 1.0.3 → 1.0.4

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 (69) hide show
  1. package/build/{cjs/src/service-plugins-types.d.ts → index.d.mts} +106 -21
  2. package/build/{internal/cjs/src/service-plugins-types.d.ts → index.d.ts} +106 -21
  3. package/build/index.js +150 -0
  4. package/build/index.js.map +1 -0
  5. package/build/index.mjs +122 -0
  6. package/build/index.mjs.map +1 -0
  7. package/build/{es/src/service-plugins-types.d.ts → internal/index.d.mts} +106 -21
  8. package/build/internal/{es/src/service-plugins-types.d.ts → index.d.ts} +106 -21
  9. package/build/internal/index.js +150 -0
  10. package/build/internal/index.js.map +1 -0
  11. package/build/internal/index.mjs +122 -0
  12. package/build/internal/index.mjs.map +1 -0
  13. package/package.json +13 -12
  14. package/build/cjs/index.d.ts +0 -2
  15. package/build/cjs/index.js +0 -19
  16. package/build/cjs/index.js.map +0 -1
  17. package/build/cjs/index.typings.d.ts +0 -59
  18. package/build/cjs/index.typings.js +0 -18
  19. package/build/cjs/index.typings.js.map +0 -1
  20. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
  21. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -9
  22. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
  23. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
  24. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -88
  25. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
  26. package/build/cjs/src/service-plugins-types.js +0 -30
  27. package/build/cjs/src/service-plugins-types.js.map +0 -1
  28. package/build/es/index.d.ts +0 -2
  29. package/build/es/index.js +0 -3
  30. package/build/es/index.js.map +0 -1
  31. package/build/es/index.typings.d.ts +0 -59
  32. package/build/es/index.typings.js +0 -2
  33. package/build/es/index.typings.js.map +0 -1
  34. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
  35. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -6
  36. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
  37. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
  38. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -85
  39. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
  40. package/build/es/src/service-plugins-types.js +0 -27
  41. package/build/es/src/service-plugins-types.js.map +0 -1
  42. package/build/internal/cjs/index.d.ts +0 -2
  43. package/build/internal/cjs/index.js +0 -19
  44. package/build/internal/cjs/index.js.map +0 -1
  45. package/build/internal/cjs/index.typings.d.ts +0 -59
  46. package/build/internal/cjs/index.typings.js +0 -18
  47. package/build/internal/cjs/index.typings.js.map +0 -1
  48. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
  49. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -9
  50. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
  51. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
  52. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -88
  53. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
  54. package/build/internal/cjs/src/service-plugins-types.js +0 -30
  55. package/build/internal/cjs/src/service-plugins-types.js.map +0 -1
  56. package/build/internal/es/index.d.ts +0 -2
  57. package/build/internal/es/index.js +0 -3
  58. package/build/internal/es/index.js.map +0 -1
  59. package/build/internal/es/index.typings.d.ts +0 -59
  60. package/build/internal/es/index.typings.js +0 -2
  61. package/build/internal/es/index.typings.js.map +0 -1
  62. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
  63. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -6
  64. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
  65. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
  66. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -85
  67. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
  68. package/build/internal/es/src/service-plugins-types.js +0 -27
  69. package/build/internal/es/src/service-plugins-types.js.map +0 -1
@@ -1,4 +1,7 @@
1
- export interface GetChargeLimitRequest {
1
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
2
+ import { ServicePluginDefinition } from '@wix/sdk-types';
3
+
4
+ interface GetChargeLimitRequest {
2
5
  /**
3
6
  * ID of the subscription for which Wix retrieves the charge limit. Equals
4
7
  * `null` in case Wix hasn't created the subscription when retrieving an
@@ -17,7 +20,7 @@ export interface GetChargeLimitRequest {
17
20
  */
18
21
  currency?: string;
19
22
  }
20
- export interface GetChargeLimitResponse {
23
+ interface GetChargeLimitResponse {
21
24
  /**
22
25
  * Retrieved charge limit for the app instance. You can't update the
23
26
  * charge limit after you've set an initial value. Site owners can increase the
@@ -27,7 +30,7 @@ export interface GetChargeLimitResponse {
27
30
  */
28
31
  chargeLimit?: string | null;
29
32
  }
30
- export interface ListChargesRequest {
33
+ interface ListChargesRequest {
31
34
  /**
32
35
  * ID of the subscription for which Wix retrieves your custom charges.
33
36
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -57,13 +60,13 @@ export interface ListChargesRequest {
57
60
  /** Information about what Wix intends to do with the retrieved charges. */
58
61
  intent?: Intent;
59
62
  }
60
- export declare enum Intent {
63
+ declare enum Intent {
61
64
  /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
62
65
  DISPLAY_ONLY = "DISPLAY_ONLY",
63
66
  /** Create an invoice for the customer. */
64
67
  CREATE_INVOICE = "CREATE_INVOICE"
65
68
  }
66
- export interface ListChargesResponse {
69
+ interface ListChargesResponse {
67
70
  /**
68
71
  * Retrieved charges.
69
72
  *
@@ -72,7 +75,7 @@ export interface ListChargesResponse {
72
75
  */
73
76
  charges?: ChargeLineItem[];
74
77
  }
75
- export interface ChargeLineItem {
78
+ interface ChargeLineItem {
76
79
  /**
77
80
  * ID of the charge. Make sure to save the charge ID on your servers for future
78
81
  * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.
@@ -95,7 +98,7 @@ export interface ChargeLineItem {
95
98
  */
96
99
  amount?: string;
97
100
  }
98
- export interface ChargesRejectedRequest {
101
+ interface ChargesRejectedRequest {
99
102
  /**
100
103
  * ID of the subscription for which Wix hasn't accepted your custom charges.
101
104
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -135,7 +138,7 @@ export interface ChargesRejectedRequest {
135
138
  */
136
139
  reasons?: ChargesRejectedReason[];
137
140
  }
138
- export declare enum ChargesRejectedReason {
141
+ declare enum ChargesRejectedReason {
139
142
  /** There is no information about why Wix has rejected the charges. */
140
143
  UNKNOWN = "UNKNOWN",
141
144
  /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
@@ -145,9 +148,9 @@ export declare enum ChargesRejectedReason {
145
148
  /** 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. */
146
149
  INVALID_FORMAT = "INVALID_FORMAT"
147
150
  }
148
- export interface ChargesRejectedResponse {
151
+ interface ChargesRejectedResponse {
149
152
  }
150
- export interface InvoiceCreatedRequest {
153
+ interface InvoiceCreatedRequest {
151
154
  /**
152
155
  * ID of the subscription for which Wix has created an invoice that includes
153
156
  * your custom charges. To track usage and billing for apps, we recommend to use
@@ -172,7 +175,7 @@ export interface InvoiceCreatedRequest {
172
175
  */
173
176
  lineItems?: InvoiceLineItem[];
174
177
  }
175
- export interface InvoiceLineItem {
178
+ interface InvoiceLineItem {
176
179
  /**
177
180
  * ID of the charge as returned in List Charges.
178
181
  *
@@ -191,9 +194,9 @@ export interface InvoiceLineItem {
191
194
  */
192
195
  _id?: string;
193
196
  }
194
- export interface InvoiceCreatedResponse {
197
+ interface InvoiceCreatedResponse {
195
198
  }
196
- export interface ChargeLimitUpdatedRequest {
199
+ interface ChargeLimitUpdatedRequest {
197
200
  /**
198
201
  * ID of the subscription for which the charge limit has been updated.
199
202
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -216,9 +219,9 @@ export interface ChargeLimitUpdatedRequest {
216
219
  */
217
220
  chargeLimit?: string | null;
218
221
  }
219
- export interface ChargeLimitUpdatedResponse {
222
+ interface ChargeLimitUpdatedResponse {
220
223
  }
221
- export interface CustomChargesConfig {
224
+ interface CustomChargesConfig {
222
225
  /**
223
226
  * Base part of your integration's deployment URI for the Custom Charges SPI.
224
227
  * For example `"https://provider.example.com"`, if Wix should call your
@@ -227,7 +230,7 @@ export interface CustomChargesConfig {
227
230
  */
228
231
  baseUri?: SpiBaseUri;
229
232
  }
230
- export interface SpiBaseUri {
233
+ interface SpiBaseUri {
231
234
  /**
232
235
  * Base URI where the methods are called. Wix appends the path to the `baseUri`.
233
236
  * 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/`.
@@ -238,7 +241,7 @@ export interface SpiBaseUri {
238
241
  /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
239
242
  alternativeUris?: AlternativeUri[];
240
243
  }
241
- export interface AlternativeUri {
244
+ interface AlternativeUri {
242
245
  /**
243
246
  * Name of the method to create a custom URI for.
244
247
  *
@@ -269,7 +272,7 @@ export interface AlternativeUri {
269
272
  * }
270
273
  * ```
271
274
  */
272
- export interface Context {
275
+ interface Context {
273
276
  /** 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. */
274
277
  requestId?: string | null;
275
278
  /**
@@ -287,14 +290,14 @@ export interface Context {
287
290
  */
288
291
  instanceId?: string | null;
289
292
  }
290
- export declare enum IdentityType {
293
+ declare enum IdentityType {
291
294
  UNKNOWN = "UNKNOWN",
292
295
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
293
296
  MEMBER = "MEMBER",
294
297
  WIX_USER = "WIX_USER",
295
298
  APP = "APP"
296
299
  }
297
- export interface IdentificationData extends IdentificationDataIdOneOf {
300
+ interface IdentificationData extends IdentificationDataIdOneOf {
298
301
  /**
299
302
  * ID of a site visitor that has not logged in to the site.
300
303
  * @format GUID
@@ -319,7 +322,7 @@ export interface IdentificationData extends IdentificationDataIdOneOf {
319
322
  identityType?: IdentityType;
320
323
  }
321
324
  /** @oneof */
322
- export interface IdentificationDataIdOneOf {
325
+ interface IdentificationDataIdOneOf {
323
326
  /**
324
327
  * ID of a site visitor that has not logged in to the site.
325
328
  * @format GUID
@@ -341,3 +344,85 @@ export interface IdentificationDataIdOneOf {
341
344
  */
342
345
  appId?: string;
343
346
  }
347
+
348
+ interface GetChargeLimitEnvelope {
349
+ request: GetChargeLimitRequest;
350
+ metadata: Context;
351
+ }
352
+ interface ListChargesEnvelope {
353
+ request: ListChargesRequest;
354
+ metadata: Context;
355
+ }
356
+ interface ChargesRejectedEventEnvelope {
357
+ request: ChargesRejectedRequest;
358
+ metadata: Context;
359
+ }
360
+ interface InvoiceCreatedEventEnvelope {
361
+ request: InvoiceCreatedRequest;
362
+ metadata: Context;
363
+ }
364
+ interface ChargeLimitUpdatedEventEnvelope {
365
+ request: ChargeLimitUpdatedRequest;
366
+ metadata: Context;
367
+ }
368
+ declare const provideHandlers$1: ServicePluginDefinition<{
369
+ /**
370
+ *
371
+ * Wix calls this method to retrieve the initial charge limit for a paid instance
372
+ * of your app. This happens every time a customer is upgrading to a paid version of
373
+ * your app.
374
+ *
375
+ * You can't update the charge limit after you've set an initial
376
+ * value. Customers can increase the limit in their site's dashboard, currently they
377
+ * aren't allowed to decrease it. */
378
+ getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
379
+ /**
380
+ *
381
+ * Wix calls this method to retrieve a list of charges for a paid instance
382
+ * of your app. This happens when Wix creates an invoice or in case the customer
383
+ * wants to preview how much your app would charge them at the moment.
384
+ *
385
+ * You must return the charges in the currency that's specified in the request,
386
+ * you aren't allowed to return more than 5 charges, and their sum must be lower
387
+ * than the charge limit.
388
+ *
389
+ * You may not bill customers for any usage that didn’t occur during the period
390
+ * Wix specifies when retrieving the charges. If Wix discovers that your app has
391
+ * charged customers for usage outside of an invoice's specified period, we may
392
+ * take action such as blocking your app from charging the customer, removing
393
+ * your app from the Wix App Market, revoking your access to the Wix developer
394
+ * program, or pursuing legal action to recover damages caused by overcharging.
395
+ * We understand that mistakes can happen and encourage you to contact
396
+ * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
397
+ * become aware of any overcharging issues so that we can work together to
398
+ * resolve the situation. */
399
+ listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
400
+ /**
401
+ *
402
+ * Triggered in case Wix doesn't accept the charges you've returned in the
403
+ * List Charges method.
404
+ *
405
+ *
406
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
407
+ * call List Charges in regular intervals until the sum of all charges is lower than the
408
+ * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */
409
+ chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
410
+ /**
411
+ *
412
+ * Triggered in case Wix creates an invoice that includes charges for an instance
413
+ * of your app. */
414
+ invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
415
+ /**
416
+ *
417
+ * Triggered in case the charge limit for an instance of your app is updated.
418
+ *
419
+ *
420
+ * You can't update the charge limit after you've set an initial
421
+ * value. Site owners can increase the limit in their site's dashboard,
422
+ * currently they aren't allowed to decrease it. */
423
+ chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
424
+ }>;
425
+
426
+ declare const provideHandlers: ReturnType<typeof createServicePluginModule<typeof publicProvideHandlers>>;
427
+
428
+ export { type AlternativeUri, type ChargeLimitUpdatedRequest, type ChargeLimitUpdatedResponse, type ChargeLineItem, ChargesRejectedReason, type ChargesRejectedRequest, type ChargesRejectedResponse, type Context, type CustomChargesConfig, type GetChargeLimitRequest, type GetChargeLimitResponse, type IdentificationData, type IdentificationDataIdOneOf, IdentityType, Intent, type InvoiceCreatedRequest, type InvoiceCreatedResponse, type InvoiceLineItem, type ListChargesRequest, type ListChargesResponse, type SpiBaseUri, provideHandlers, provideHandlers$1 as publicProvideHandlers };
@@ -1,4 +1,7 @@
1
- export interface GetChargeLimitRequest {
1
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
2
+ import { ServicePluginDefinition } from '@wix/sdk-types';
3
+
4
+ interface GetChargeLimitRequest {
2
5
  /**
3
6
  * ID of the subscription for which Wix retrieves the charge limit. Equals
4
7
  * `null` in case Wix hasn't created the subscription when retrieving an
@@ -17,7 +20,7 @@ export interface GetChargeLimitRequest {
17
20
  */
18
21
  currency?: string;
19
22
  }
20
- export interface GetChargeLimitResponse {
23
+ interface GetChargeLimitResponse {
21
24
  /**
22
25
  * Retrieved charge limit for the app instance. You can't update the
23
26
  * charge limit after you've set an initial value. Site owners can increase the
@@ -27,7 +30,7 @@ export interface GetChargeLimitResponse {
27
30
  */
28
31
  chargeLimit?: string | null;
29
32
  }
30
- export interface ListChargesRequest {
33
+ interface ListChargesRequest {
31
34
  /**
32
35
  * ID of the subscription for which Wix retrieves your custom charges.
33
36
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -57,13 +60,13 @@ export interface ListChargesRequest {
57
60
  /** Information about what Wix intends to do with the retrieved charges. */
58
61
  intent?: Intent;
59
62
  }
60
- export declare enum Intent {
63
+ declare enum Intent {
61
64
  /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
62
65
  DISPLAY_ONLY = "DISPLAY_ONLY",
63
66
  /** Create an invoice for the customer. */
64
67
  CREATE_INVOICE = "CREATE_INVOICE"
65
68
  }
66
- export interface ListChargesResponse {
69
+ interface ListChargesResponse {
67
70
  /**
68
71
  * Retrieved charges.
69
72
  *
@@ -72,7 +75,7 @@ export interface ListChargesResponse {
72
75
  */
73
76
  charges?: ChargeLineItem[];
74
77
  }
75
- export interface ChargeLineItem {
78
+ interface ChargeLineItem {
76
79
  /**
77
80
  * ID of the charge. Make sure to save the charge ID on your servers for future
78
81
  * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.
@@ -95,7 +98,7 @@ export interface ChargeLineItem {
95
98
  */
96
99
  amount?: string;
97
100
  }
98
- export interface ChargesRejectedRequest {
101
+ interface ChargesRejectedRequest {
99
102
  /**
100
103
  * ID of the subscription for which Wix hasn't accepted your custom charges.
101
104
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -135,7 +138,7 @@ export interface ChargesRejectedRequest {
135
138
  */
136
139
  reasons?: ChargesRejectedReason[];
137
140
  }
138
- export declare enum ChargesRejectedReason {
141
+ declare enum ChargesRejectedReason {
139
142
  /** There is no information about why Wix has rejected the charges. */
140
143
  UNKNOWN = "UNKNOWN",
141
144
  /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
@@ -145,9 +148,9 @@ export declare enum ChargesRejectedReason {
145
148
  /** 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. */
146
149
  INVALID_FORMAT = "INVALID_FORMAT"
147
150
  }
148
- export interface ChargesRejectedResponse {
151
+ interface ChargesRejectedResponse {
149
152
  }
150
- export interface InvoiceCreatedRequest {
153
+ interface InvoiceCreatedRequest {
151
154
  /**
152
155
  * ID of the subscription for which Wix has created an invoice that includes
153
156
  * your custom charges. To track usage and billing for apps, we recommend to use
@@ -172,7 +175,7 @@ export interface InvoiceCreatedRequest {
172
175
  */
173
176
  lineItems?: InvoiceLineItem[];
174
177
  }
175
- export interface InvoiceLineItem {
178
+ interface InvoiceLineItem {
176
179
  /**
177
180
  * ID of the charge as returned in List Charges.
178
181
  *
@@ -191,9 +194,9 @@ export interface InvoiceLineItem {
191
194
  */
192
195
  _id?: string;
193
196
  }
194
- export interface InvoiceCreatedResponse {
197
+ interface InvoiceCreatedResponse {
195
198
  }
196
- export interface ChargeLimitUpdatedRequest {
199
+ interface ChargeLimitUpdatedRequest {
197
200
  /**
198
201
  * ID of the subscription for which the charge limit has been updated.
199
202
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -216,9 +219,9 @@ export interface ChargeLimitUpdatedRequest {
216
219
  */
217
220
  chargeLimit?: string | null;
218
221
  }
219
- export interface ChargeLimitUpdatedResponse {
222
+ interface ChargeLimitUpdatedResponse {
220
223
  }
221
- export interface CustomChargesConfig {
224
+ interface CustomChargesConfig {
222
225
  /**
223
226
  * Base part of your integration's deployment URI for the Custom Charges SPI.
224
227
  * For example `"https://provider.example.com"`, if Wix should call your
@@ -227,7 +230,7 @@ export interface CustomChargesConfig {
227
230
  */
228
231
  baseUri?: SpiBaseUri;
229
232
  }
230
- export interface SpiBaseUri {
233
+ interface SpiBaseUri {
231
234
  /**
232
235
  * Base URI where the methods are called. Wix appends the path to the `baseUri`.
233
236
  * 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/`.
@@ -238,7 +241,7 @@ export interface SpiBaseUri {
238
241
  /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
239
242
  alternativeUris?: AlternativeUri[];
240
243
  }
241
- export interface AlternativeUri {
244
+ interface AlternativeUri {
242
245
  /**
243
246
  * Name of the method to create a custom URI for.
244
247
  *
@@ -269,7 +272,7 @@ export interface AlternativeUri {
269
272
  * }
270
273
  * ```
271
274
  */
272
- export interface Context {
275
+ interface Context {
273
276
  /** 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. */
274
277
  requestId?: string | null;
275
278
  /**
@@ -287,14 +290,14 @@ export interface Context {
287
290
  */
288
291
  instanceId?: string | null;
289
292
  }
290
- export declare enum IdentityType {
293
+ declare enum IdentityType {
291
294
  UNKNOWN = "UNKNOWN",
292
295
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
293
296
  MEMBER = "MEMBER",
294
297
  WIX_USER = "WIX_USER",
295
298
  APP = "APP"
296
299
  }
297
- export interface IdentificationData extends IdentificationDataIdOneOf {
300
+ interface IdentificationData extends IdentificationDataIdOneOf {
298
301
  /**
299
302
  * ID of a site visitor that has not logged in to the site.
300
303
  * @format GUID
@@ -319,7 +322,7 @@ export interface IdentificationData extends IdentificationDataIdOneOf {
319
322
  identityType?: IdentityType;
320
323
  }
321
324
  /** @oneof */
322
- export interface IdentificationDataIdOneOf {
325
+ interface IdentificationDataIdOneOf {
323
326
  /**
324
327
  * ID of a site visitor that has not logged in to the site.
325
328
  * @format GUID
@@ -341,3 +344,85 @@ export interface IdentificationDataIdOneOf {
341
344
  */
342
345
  appId?: string;
343
346
  }
347
+
348
+ interface GetChargeLimitEnvelope {
349
+ request: GetChargeLimitRequest;
350
+ metadata: Context;
351
+ }
352
+ interface ListChargesEnvelope {
353
+ request: ListChargesRequest;
354
+ metadata: Context;
355
+ }
356
+ interface ChargesRejectedEventEnvelope {
357
+ request: ChargesRejectedRequest;
358
+ metadata: Context;
359
+ }
360
+ interface InvoiceCreatedEventEnvelope {
361
+ request: InvoiceCreatedRequest;
362
+ metadata: Context;
363
+ }
364
+ interface ChargeLimitUpdatedEventEnvelope {
365
+ request: ChargeLimitUpdatedRequest;
366
+ metadata: Context;
367
+ }
368
+ declare const provideHandlers$1: ServicePluginDefinition<{
369
+ /**
370
+ *
371
+ * Wix calls this method to retrieve the initial charge limit for a paid instance
372
+ * of your app. This happens every time a customer is upgrading to a paid version of
373
+ * your app.
374
+ *
375
+ * You can't update the charge limit after you've set an initial
376
+ * value. Customers can increase the limit in their site's dashboard, currently they
377
+ * aren't allowed to decrease it. */
378
+ getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
379
+ /**
380
+ *
381
+ * Wix calls this method to retrieve a list of charges for a paid instance
382
+ * of your app. This happens when Wix creates an invoice or in case the customer
383
+ * wants to preview how much your app would charge them at the moment.
384
+ *
385
+ * You must return the charges in the currency that's specified in the request,
386
+ * you aren't allowed to return more than 5 charges, and their sum must be lower
387
+ * than the charge limit.
388
+ *
389
+ * You may not bill customers for any usage that didn’t occur during the period
390
+ * Wix specifies when retrieving the charges. If Wix discovers that your app has
391
+ * charged customers for usage outside of an invoice's specified period, we may
392
+ * take action such as blocking your app from charging the customer, removing
393
+ * your app from the Wix App Market, revoking your access to the Wix developer
394
+ * program, or pursuing legal action to recover damages caused by overcharging.
395
+ * We understand that mistakes can happen and encourage you to contact
396
+ * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
397
+ * become aware of any overcharging issues so that we can work together to
398
+ * resolve the situation. */
399
+ listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
400
+ /**
401
+ *
402
+ * Triggered in case Wix doesn't accept the charges you've returned in the
403
+ * List Charges method.
404
+ *
405
+ *
406
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
407
+ * call List Charges in regular intervals until the sum of all charges is lower than the
408
+ * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */
409
+ chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
410
+ /**
411
+ *
412
+ * Triggered in case Wix creates an invoice that includes charges for an instance
413
+ * of your app. */
414
+ invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
415
+ /**
416
+ *
417
+ * Triggered in case the charge limit for an instance of your app is updated.
418
+ *
419
+ *
420
+ * You can't update the charge limit after you've set an initial
421
+ * value. Site owners can increase the limit in their site's dashboard,
422
+ * currently they aren't allowed to decrease it. */
423
+ chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
424
+ }>;
425
+
426
+ declare const provideHandlers: ReturnType<typeof createServicePluginModule<typeof publicProvideHandlers>>;
427
+
428
+ export { type AlternativeUri, type ChargeLimitUpdatedRequest, type ChargeLimitUpdatedResponse, type ChargeLineItem, ChargesRejectedReason, type ChargesRejectedRequest, type ChargesRejectedResponse, type Context, type CustomChargesConfig, type GetChargeLimitRequest, type GetChargeLimitResponse, type IdentificationData, type IdentificationDataIdOneOf, IdentityType, Intent, type InvoiceCreatedRequest, type InvoiceCreatedResponse, type InvoiceLineItem, type ListChargesRequest, type ListChargesResponse, type SpiBaseUri, provideHandlers, provideHandlers$1 as publicProvideHandlers };
package/build/index.js ADDED
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ChargesRejectedReason: () => ChargesRejectedReason,
24
+ IdentityType: () => IdentityType,
25
+ Intent: () => Intent,
26
+ provideHandlers: () => provideHandlers2,
27
+ publicProvideHandlers: () => provideHandlers
28
+ });
29
+ module.exports = __toCommonJS(index_exports);
30
+
31
+ // src/service-plugins-types.ts
32
+ var Intent = /* @__PURE__ */ ((Intent2) => {
33
+ Intent2["DISPLAY_ONLY"] = "DISPLAY_ONLY";
34
+ Intent2["CREATE_INVOICE"] = "CREATE_INVOICE";
35
+ return Intent2;
36
+ })(Intent || {});
37
+ var ChargesRejectedReason = /* @__PURE__ */ ((ChargesRejectedReason2) => {
38
+ ChargesRejectedReason2["UNKNOWN"] = "UNKNOWN";
39
+ ChargesRejectedReason2["CHARGE_LIMIT_EXCEEDED"] = "CHARGE_LIMIT_EXCEEDED";
40
+ ChargesRejectedReason2["TOO_MANY_CHARGES"] = "TOO_MANY_CHARGES";
41
+ ChargesRejectedReason2["INVALID_FORMAT"] = "INVALID_FORMAT";
42
+ return ChargesRejectedReason2;
43
+ })(ChargesRejectedReason || {});
44
+ var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
45
+ IdentityType2["UNKNOWN"] = "UNKNOWN";
46
+ IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
47
+ IdentityType2["MEMBER"] = "MEMBER";
48
+ IdentityType2["WIX_USER"] = "WIX_USER";
49
+ IdentityType2["APP"] = "APP";
50
+ return IdentityType2;
51
+ })(IdentityType || {});
52
+
53
+ // src/interfaces-premium-v1-custom-charges-provider.public.ts
54
+ var import_sdk_types = require("@wix/sdk-types");
55
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
56
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
57
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
58
+ var provideHandlers = (0, import_sdk_types.ServicePluginDefinition)("PREMIUM_CUSTOM_CHARGES", [
59
+ {
60
+ name: "getChargeLimit",
61
+ primaryHttpMappingPath: "/v1/charge-limit",
62
+ transformations: {
63
+ toREST: (payload) => {
64
+ const toRestResponse = payload;
65
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
66
+ },
67
+ fromREST: (payload) => {
68
+ const fromRestRequest = payload;
69
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
70
+ }
71
+ }
72
+ },
73
+ {
74
+ name: "listCharges",
75
+ primaryHttpMappingPath: "/v1/charges",
76
+ transformations: {
77
+ toREST: (payload) => {
78
+ const toRestResponse = payload;
79
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
80
+ },
81
+ fromREST: (payload) => {
82
+ const fromRestRequest = (0, import_transform_paths.transformPaths)(payload, [
83
+ {
84
+ transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
85
+ paths: [
86
+ { path: "request.periodStart" },
87
+ { path: "request.periodEnd" }
88
+ ]
89
+ }
90
+ ]);
91
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
92
+ }
93
+ }
94
+ },
95
+ {
96
+ name: "chargesRejectedEvent",
97
+ primaryHttpMappingPath: "/v1/charges-rejected",
98
+ transformations: {
99
+ toREST: (payload) => {
100
+ const toRestResponse = payload;
101
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
102
+ },
103
+ fromREST: (payload) => {
104
+ const fromRestRequest = payload;
105
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
106
+ }
107
+ }
108
+ },
109
+ {
110
+ name: "invoiceCreatedEvent",
111
+ primaryHttpMappingPath: "/v1/invoice-created",
112
+ transformations: {
113
+ toREST: (payload) => {
114
+ const toRestResponse = payload;
115
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
116
+ },
117
+ fromREST: (payload) => {
118
+ const fromRestRequest = payload;
119
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
120
+ }
121
+ }
122
+ },
123
+ {
124
+ name: "chargeLimitUpdatedEvent",
125
+ primaryHttpMappingPath: "/v1/limit-updated",
126
+ transformations: {
127
+ toREST: (payload) => {
128
+ const toRestResponse = payload;
129
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
130
+ },
131
+ fromREST: (payload) => {
132
+ const fromRestRequest = payload;
133
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
134
+ }
135
+ }
136
+ }
137
+ ]);
138
+
139
+ // src/interfaces-premium-v1-custom-charges-provider.context.ts
140
+ var import_service_plugin_modules = require("@wix/sdk-runtime/service-plugin-modules");
141
+ var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModule)(provideHandlers);
142
+ // Annotate the CommonJS export names for ESM import in node:
143
+ 0 && (module.exports = {
144
+ ChargesRejectedReason,
145
+ IdentityType,
146
+ Intent,
147
+ provideHandlers,
148
+ publicProvideHandlers
149
+ });
150
+ //# sourceMappingURL=index.js.map