@wix/auto_sdk_app-management_custom-charges 1.0.11 → 1.0.13

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 (65) hide show
  1. package/build/cjs/index.d.ts +427 -2
  2. package/build/cjs/index.js +147 -16
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/{cjs/src/service-plugins-types.d.ts → es/index.d.mts} +105 -21
  5. package/build/es/index.mjs +122 -0
  6. package/build/es/index.mjs.map +1 -0
  7. package/build/internal/cjs/index.d.ts +427 -2
  8. package/build/internal/cjs/index.js +147 -16
  9. package/build/internal/cjs/index.js.map +1 -1
  10. package/build/{es/src/service-plugins-types.d.ts → internal/es/index.d.mts} +105 -21
  11. package/build/internal/es/index.mjs +122 -0
  12. package/build/internal/es/index.mjs.map +1 -0
  13. package/package.json +9 -8
  14. package/build/cjs/index.typings.d.ts +0 -59
  15. package/build/cjs/index.typings.js +0 -18
  16. package/build/cjs/index.typings.js.map +0 -1
  17. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
  18. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -9
  19. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
  20. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
  21. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -88
  22. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
  23. package/build/cjs/src/service-plugins-types.js +0 -30
  24. package/build/cjs/src/service-plugins-types.js.map +0 -1
  25. package/build/es/index.d.ts +0 -2
  26. package/build/es/index.js +0 -3
  27. package/build/es/index.js.map +0 -1
  28. package/build/es/index.typings.d.ts +0 -59
  29. package/build/es/index.typings.js +0 -2
  30. package/build/es/index.typings.js.map +0 -1
  31. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
  32. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -6
  33. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
  34. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
  35. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -85
  36. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
  37. package/build/es/src/service-plugins-types.js +0 -27
  38. package/build/es/src/service-plugins-types.js.map +0 -1
  39. package/build/internal/cjs/index.typings.d.ts +0 -59
  40. package/build/internal/cjs/index.typings.js +0 -18
  41. package/build/internal/cjs/index.typings.js.map +0 -1
  42. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
  43. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -9
  44. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
  45. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
  46. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -88
  47. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
  48. package/build/internal/cjs/src/service-plugins-types.d.ts +0 -343
  49. package/build/internal/cjs/src/service-plugins-types.js +0 -30
  50. package/build/internal/cjs/src/service-plugins-types.js.map +0 -1
  51. package/build/internal/es/index.d.ts +0 -2
  52. package/build/internal/es/index.js +0 -3
  53. package/build/internal/es/index.js.map +0 -1
  54. package/build/internal/es/index.typings.d.ts +0 -59
  55. package/build/internal/es/index.typings.js +0 -2
  56. package/build/internal/es/index.typings.js.map +0 -1
  57. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
  58. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -6
  59. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
  60. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
  61. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -85
  62. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
  63. package/build/internal/es/src/service-plugins-types.d.ts +0 -343
  64. package/build/internal/es/src/service-plugins-types.js +0 -27
  65. package/build/internal/es/src/service-plugins-types.js.map +0 -1
@@ -1,2 +1,427 @@
1
- export * from './src/service-plugins-types.js';
2
- export * from './src/interfaces-premium-v1-custom-charges-provider.context.js';
1
+ import { ServicePluginDefinition, BuildServicePluginDefinition } from '@wix/sdk-types';
2
+
3
+ interface GetChargeLimitRequest {
4
+ /**
5
+ * ID of the subscription for which Wix retrieves the charge limit. Equals
6
+ * `null` in case Wix hasn't created the subscription when retrieving an
7
+ * initial charge limit. To track usage and billing for apps, we recommend to
8
+ * use `instanceId` instead of the `subscriptionId`.
9
+ * @format GUID
10
+ */
11
+ subscriptionId?: string | null;
12
+ /**
13
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
14
+ *
15
+ * 3-letter currency code in
16
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
17
+ * format of the charge limit. Wix may add supported currencies in the future.
18
+ * @format CURRENCY
19
+ */
20
+ currency?: string;
21
+ }
22
+ interface GetChargeLimitResponse {
23
+ /**
24
+ * Retrieved charge limit for the app instance. You can't update the
25
+ * charge limit after you've set an initial value. Site owners can increase the
26
+ * limit in their site's dashboard, currently they aren't allowed to decrease it.
27
+ * @format DECIMAL_VALUE
28
+ * @decimalValue options { gt:0.00 }
29
+ */
30
+ chargeLimit?: string | null;
31
+ }
32
+ interface ListChargesRequest {
33
+ /**
34
+ * ID of the subscription for which Wix retrieves your custom charges.
35
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
36
+ * of the `subscriptionId`.
37
+ * @format GUID
38
+ */
39
+ subscriptionId?: string;
40
+ /**
41
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
42
+ *
43
+ * 3-letter currency code in
44
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
45
+ * format of your charges to return. Wix may add supported currencies in the future.
46
+ * @format CURRENCY
47
+ */
48
+ currency?: string;
49
+ /**
50
+ * Begin of the period Wix retrieves the app instance's charges for in
51
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
52
+ */
53
+ periodStart?: Date | null;
54
+ /**
55
+ * End of the period Wix retrieves the app instance's charges for in
56
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
57
+ */
58
+ periodEnd?: Date | null;
59
+ /** Information about what Wix intends to do with the retrieved charges. */
60
+ intent?: Intent;
61
+ }
62
+ declare enum Intent {
63
+ /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
64
+ DISPLAY_ONLY = "DISPLAY_ONLY",
65
+ /** Create an invoice for the customer. */
66
+ CREATE_INVOICE = "CREATE_INVOICE"
67
+ }
68
+ interface ListChargesResponse {
69
+ /**
70
+ * Retrieved charges.
71
+ *
72
+ * Max: 5 charges
73
+ * @maxSize 5
74
+ */
75
+ charges?: ChargeLineItem[];
76
+ }
77
+ interface ChargeLineItem {
78
+ /**
79
+ * ID of the charge. Make sure to save the charge ID on your servers for future
80
+ * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.
81
+ *
82
+ * Max: 64 characters
83
+ * @maxLength 64
84
+ */
85
+ _id?: string | null;
86
+ /** Charge description. */
87
+ description?: string;
88
+ /**
89
+ * Charge amount in the currency that's specified in the request. Use a whole number
90
+ * or separate major and minor units with a dot. For example, `10` or `1.99`. If
91
+ * you return an amount with more minor units than supported according to
92
+ * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),
93
+ * Wix truncates the additional minor units.
94
+ *
95
+ * Min: `0.50`
96
+ * @format DECIMAL_VALUE
97
+ */
98
+ amount?: string;
99
+ }
100
+ interface ChargesRejectedRequest {
101
+ /**
102
+ * ID of the subscription for which Wix hasn't accepted your custom charges.
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
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
110
+ *
111
+ * 3-letter currency code in
112
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
113
+ * format of the charges. Wix may add supported currencies in the future.
114
+ * @format CURRENCY
115
+ */
116
+ currency?: string;
117
+ /**
118
+ * IDs of the rejected charges.
119
+ *
120
+ * Max: 5 charges
121
+ * @maxSize 5
122
+ */
123
+ chargeIds?: string[] | null;
124
+ /**
125
+ * Maximum amount that your app may charge the customer per billing cycle.
126
+ *
127
+ * Min: `0.50`
128
+ * @format DECIMAL_VALUE
129
+ * @decimalValue options { gt:0.00 }
130
+ */
131
+ chargeLimit?: string | null;
132
+ /**
133
+ * Information about why Wix has rejected your app's charges.
134
+ *
135
+ * Max: 20 reasons
136
+ * @maxSize 20
137
+ */
138
+ reasons?: ChargesRejectedReason[];
139
+ }
140
+ declare enum ChargesRejectedReason {
141
+ /** There is no information about why Wix has rejected the charges. */
142
+ UNKNOWN = "UNKNOWN",
143
+ /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
144
+ CHARGE_LIMIT_EXCEEDED = "CHARGE_LIMIT_EXCEEDED",
145
+ /** You can't provide more than 5 charges per invoice. */
146
+ TOO_MANY_CHARGES = "TOO_MANY_CHARGES",
147
+ /** 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. */
148
+ INVALID_FORMAT = "INVALID_FORMAT"
149
+ }
150
+ interface ChargesRejectedResponse {
151
+ }
152
+ interface InvoiceCreatedRequest {
153
+ /**
154
+ * ID of the subscription for which Wix has created an invoice that includes
155
+ * your custom charges. To track usage and billing for apps, we recommend to use
156
+ * `instanceId` instead of the `subscriptionId`.
157
+ * @format GUID
158
+ */
159
+ subscriptionId?: string;
160
+ /**
161
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
162
+ *
163
+ * 3-letter currency code in
164
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
165
+ * format of the charges. Wix may add supported currencies in the future.
166
+ * @format CURRENCY
167
+ */
168
+ currency?: string;
169
+ /** ID of the created invoice. */
170
+ invoiceId?: string;
171
+ /**
172
+ * Line items included in the invoice.
173
+ * @maxSize 5
174
+ */
175
+ lineItems?: InvoiceLineItem[];
176
+ }
177
+ interface InvoiceLineItem {
178
+ /**
179
+ * ID of the charge as returned in List Charges.
180
+ *
181
+ * Max: 64 characters
182
+ * @maxLength 64
183
+ */
184
+ chargeId?: string | null;
185
+ /**
186
+ * Charge amount.
187
+ * @format DECIMAL_VALUE
188
+ */
189
+ amount?: string;
190
+ /**
191
+ * ID of the line item in the invoice that Wix sends to the customer.
192
+ * @format GUID
193
+ */
194
+ _id?: string;
195
+ }
196
+ interface InvoiceCreatedResponse {
197
+ }
198
+ interface ChargeLimitUpdatedRequest {
199
+ /**
200
+ * ID of the subscription for which the charge limit has been updated.
201
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
202
+ * of the `subscriptionId`.
203
+ * @format GUID
204
+ */
205
+ subscriptionId?: string;
206
+ /**
207
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
208
+ *
209
+ * 3-letter currency code in
210
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
211
+ * format of the charges. Wix may add supported currencies in the future.
212
+ * @format CURRENCY
213
+ */
214
+ currency?: string;
215
+ /**
216
+ * Updated charge limit.
217
+ * @format DECIMAL_VALUE
218
+ */
219
+ chargeLimit?: string | null;
220
+ }
221
+ interface ChargeLimitUpdatedResponse {
222
+ }
223
+ interface CustomChargesConfig {
224
+ /**
225
+ * Base part of your integration's deployment URI for the Custom Charges SPI.
226
+ * For example `"https://provider.example.com"`, if Wix should call your
227
+ * integration at `https://provider.example.com/v1/charge-limit` for the
228
+ * Get Charge Limit method.
229
+ */
230
+ baseUri?: SpiBaseUri;
231
+ }
232
+ interface SpiBaseUri {
233
+ /**
234
+ * Base URI where the methods are called. Wix appends the path to the `baseUri`.
235
+ * 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/`.
236
+ * @minLength 6
237
+ * @maxLength 2048
238
+ */
239
+ baseUri?: string;
240
+ /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
241
+ alternativeUris?: AlternativeUri[];
242
+ }
243
+ interface AlternativeUri {
244
+ /**
245
+ * Name of the method to create a custom URI for.
246
+ *
247
+ * For `methodName`, use the name of the method in PascalCase.
248
+ * For example, for Get Shipping Rates use `GetShippingRates`.
249
+ * @minLength 3
250
+ * @maxLength 128
251
+ */
252
+ methodName?: string;
253
+ /**
254
+ * 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.
255
+ * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.
256
+ * @minLength 6
257
+ * @maxLength 2048
258
+ */
259
+ absoluteUri?: string;
260
+ }
261
+ /**
262
+ * this message is not directly used by any service,
263
+ * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.
264
+ * e.g. SPIs, event-handlers, etc..
265
+ * NOTE: this context object MUST be provided as the last argument in each Velo method signature.
266
+ *
267
+ * Example:
268
+ * ```typescript
269
+ * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {
270
+ * ...
271
+ * }
272
+ * ```
273
+ */
274
+ interface Context {
275
+ /** 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. */
276
+ requestId?: string | null;
277
+ /**
278
+ * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.
279
+ * @format CURRENCY
280
+ */
281
+ currency?: string | null;
282
+ /** An object that describes the identity that triggered this request. */
283
+ identity?: IdentificationData;
284
+ /** 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"`. */
285
+ languages?: string[];
286
+ /**
287
+ * The service provider app's instance ID.
288
+ * @format GUID
289
+ */
290
+ instanceId?: string | null;
291
+ }
292
+ declare enum IdentityType {
293
+ UNKNOWN = "UNKNOWN",
294
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
295
+ MEMBER = "MEMBER",
296
+ WIX_USER = "WIX_USER",
297
+ APP = "APP"
298
+ }
299
+ interface IdentificationData extends IdentificationDataIdOneOf {
300
+ /**
301
+ * ID of a site visitor that has not logged in to the site.
302
+ * @format GUID
303
+ */
304
+ anonymousVisitorId?: string;
305
+ /**
306
+ * ID of a site visitor that has logged in to the site.
307
+ * @format GUID
308
+ */
309
+ memberId?: string;
310
+ /**
311
+ * ID of a Wix user (site owner, contributor, etc.).
312
+ * @format GUID
313
+ */
314
+ wixUserId?: string;
315
+ /**
316
+ * ID of an app.
317
+ * @format GUID
318
+ */
319
+ appId?: string;
320
+ /** @readonly */
321
+ identityType?: IdentityType;
322
+ }
323
+ /** @oneof */
324
+ interface IdentificationDataIdOneOf {
325
+ /**
326
+ * ID of a site visitor that has not logged in to the site.
327
+ * @format GUID
328
+ */
329
+ anonymousVisitorId?: string;
330
+ /**
331
+ * ID of a site visitor that has logged in to the site.
332
+ * @format GUID
333
+ */
334
+ memberId?: string;
335
+ /**
336
+ * ID of a Wix user (site owner, contributor, etc.).
337
+ * @format GUID
338
+ */
339
+ wixUserId?: string;
340
+ /**
341
+ * ID of an app.
342
+ * @format GUID
343
+ */
344
+ appId?: string;
345
+ }
346
+
347
+ interface GetChargeLimitEnvelope {
348
+ request: GetChargeLimitRequest;
349
+ metadata: Context;
350
+ }
351
+ interface ListChargesEnvelope {
352
+ request: ListChargesRequest;
353
+ metadata: Context;
354
+ }
355
+ interface ChargesRejectedEventEnvelope {
356
+ request: ChargesRejectedRequest;
357
+ metadata: Context;
358
+ }
359
+ interface InvoiceCreatedEventEnvelope {
360
+ request: InvoiceCreatedRequest;
361
+ metadata: Context;
362
+ }
363
+ interface ChargeLimitUpdatedEventEnvelope {
364
+ request: ChargeLimitUpdatedRequest;
365
+ metadata: Context;
366
+ }
367
+ declare const provideHandlers$1: ServicePluginDefinition<{
368
+ /**
369
+ *
370
+ * Wix calls this method to retrieve the initial charge limit for a paid instance
371
+ * of your app. This happens every time a customer is upgrading to a paid version of
372
+ * your app.
373
+ *
374
+ * You can't update the charge limit after you've set an initial
375
+ * value. Customers can increase the limit in their site's dashboard, currently they
376
+ * aren't allowed to decrease it. */
377
+ getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
378
+ /**
379
+ *
380
+ * Wix calls this method to retrieve a list of charges for a paid instance
381
+ * of your app. This happens when Wix creates an invoice or in case the customer
382
+ * wants to preview how much your app would charge them at the moment.
383
+ *
384
+ * You must return the charges in the currency that's specified in the request,
385
+ * you aren't allowed to return more than 5 charges, and their sum must be lower
386
+ * than the charge limit.
387
+ *
388
+ * You may not bill customers for any usage that didn’t occur during the period
389
+ * Wix specifies when retrieving the charges. If Wix discovers that your app has
390
+ * charged customers for usage outside of an invoice's specified period, we may
391
+ * take action such as blocking your app from charging the customer, removing
392
+ * your app from the Wix App Market, revoking your access to the Wix developer
393
+ * program, or pursuing legal action to recover damages caused by overcharging.
394
+ * We understand that mistakes can happen and encourage you to contact
395
+ * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
396
+ * become aware of any overcharging issues so that we can work together to
397
+ * resolve the situation. */
398
+ listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
399
+ /**
400
+ *
401
+ * Triggered in case Wix doesn't accept the charges you've returned in the
402
+ * List Charges method.
403
+ *
404
+ *
405
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
406
+ * call List Charges in regular intervals until the sum of all charges is lower than the
407
+ * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */
408
+ chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
409
+ /**
410
+ *
411
+ * Triggered in case Wix creates an invoice that includes charges for an instance
412
+ * of your app. */
413
+ invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
414
+ /**
415
+ *
416
+ * Triggered in case the charge limit for an instance of your app is updated.
417
+ *
418
+ *
419
+ * You can't update the charge limit after you've set an initial
420
+ * value. Site owners can increase the limit in their site's dashboard,
421
+ * currently they aren't allowed to decrease it. */
422
+ chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
423
+ }>;
424
+
425
+ declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1>;
426
+
427
+ 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,19 +1,150 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
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;
15
17
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/service-plugins-types.js"), exports);
18
- __exportStar(require("./src/interfaces-premium-v1-custom-charges-provider.context.js"), exports);
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
+ });
19
150
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,iGAA+E"}
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> = createServicePluginModule(publicProvideHandlers);\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,uBAET,yDAA0B,eAAqB;","names":["provideHandlers","Intent","ChargesRejectedReason","IdentityType","provideHandlers"]}