@wix/app-management 1.0.13 → 1.0.15

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.
@@ -0,0 +1 @@
1
+ export * as customCharges from '@wix/app-management_custom-charges/context';
@@ -0,0 +1,28 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.customCharges = void 0;
27
+ exports.customCharges = __importStar(require("@wix/app-management_custom-charges/context"));
28
+ //# sourceMappingURL=service-plugins-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plugins-context.js","sourceRoot":"","sources":["../../service-plugins-context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4FAA4E"}
@@ -0,0 +1 @@
1
+ export * as customCharges from '@wix/app-management_custom-charges';
@@ -0,0 +1,28 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.customCharges = void 0;
27
+ exports.customCharges = __importStar(require("@wix/app-management_custom-charges"));
28
+ //# sourceMappingURL=service-plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plugins.js","sourceRoot":"","sources":["../../service-plugins.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oFAAoE"}
@@ -0,0 +1 @@
1
+ export * as customCharges from '@wix/app-management_custom-charges/context';
@@ -0,0 +1,2 @@
1
+ export * as customCharges from '@wix/app-management_custom-charges/context';
2
+ //# sourceMappingURL=service-plugins-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plugins-context.js","sourceRoot":"","sources":["../../service-plugins-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,4CAA4C,CAAC"}
@@ -0,0 +1 @@
1
+ export * as customCharges from '@wix/app-management_custom-charges';
@@ -0,0 +1,2 @@
1
+ export * as customCharges from '@wix/app-management_custom-charges';
2
+ //# sourceMappingURL=service-plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plugins.js","sourceRoot":"","sources":["../../service-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/app-management",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -15,14 +15,16 @@
15
15
  "frontend/package.json",
16
16
  "meta",
17
17
  "context",
18
- "type-bundles"
18
+ "type-bundles",
19
+ "service-plugins"
19
20
  ],
20
21
  "dependencies": {
21
- "@wix/app-management_app-instances": "1.0.6",
22
- "@wix/app-management_app-plans": "1.0.6",
23
- "@wix/app-management_bi-events": "1.0.5",
24
- "@wix/app-management_billing": "1.0.6",
25
- "@wix/app-management_embedded-scripts": "1.0.3"
22
+ "@wix/app-management_app-instances": "1.0.8",
23
+ "@wix/app-management_app-plans": "1.0.8",
24
+ "@wix/app-management_bi-events": "1.0.7",
25
+ "@wix/app-management_billing": "1.0.8",
26
+ "@wix/app-management_custom-charges": "1.0.1",
27
+ "@wix/app-management_embedded-scripts": "1.0.5"
26
28
  },
27
29
  "devDependencies": {
28
30
  "@wix/sdk": "https://cdn.dev.wixpress.com/@wix/sdk/02e8069ab2fd783e0e6a080fc7d590e76cb26ab93c8389574286305b.tar.gz",
@@ -47,5 +49,5 @@
47
49
  "fqdn": ""
48
50
  }
49
51
  },
50
- "falconPackageHash": "7ccf67864eb13476786a2ece3c8bb4192864c473ddb460fad178d350"
52
+ "falconPackageHash": "afa124f5948e5b757b71b070fcf7da521190ce418a0e2ed2f548c579"
51
53
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../../build/es/service-plugins-context.js",
4
+ "main": "../../build/cjs/service-plugins-context.js",
5
+ "typings": "../../build/cjs/service-plugins-context.d.ts",
6
+ "typesBundle": "../../type-bundles/service-plugins-context.bundle.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../build/es/service-plugins.js",
4
+ "main": "../build/cjs/service-plugins.js",
5
+ "typings": "../build/cjs/service-plugins.d.ts",
6
+ "typesBundle": "../type-bundles/service-plugins.bundle.d.ts"
7
+ }
@@ -0,0 +1,356 @@
1
+ interface GetChargeLimitRequest {
2
+ /**
3
+ * ID of the subscription for which Wix retrieves the charge limit. Equals
4
+ * `null` in case Wix hasn't created the subscription when retrieving an
5
+ * initial charge limit. To track usage and billing for apps, we recommend to
6
+ * use `instanceId` instead of the `subscriptionId`.
7
+ */
8
+ subscriptionId?: string | null;
9
+ /**
10
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
11
+ *
12
+ * 3-letter currency code in
13
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
14
+ * format of the charge limit. Wix may add supported currencies in the future.
15
+ */
16
+ currency?: string;
17
+ }
18
+ interface GetChargeLimitResponse {
19
+ /**
20
+ * Retrieved charge limit for the app instance. You can't update the
21
+ * charge limit after you've set an initial value. Site owners can increase the
22
+ * limit in their site's dashboard, currently they aren't allowed to decrease it.
23
+ */
24
+ chargeLimit?: string | null;
25
+ }
26
+ interface ListChargesRequest {
27
+ /**
28
+ * ID of the subscription for which Wix retrieves your custom charges.
29
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
30
+ * of the `subscriptionId`.
31
+ */
32
+ subscriptionId?: string;
33
+ /**
34
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
35
+ *
36
+ * 3-letter currency code in
37
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
38
+ * format of your charges to return. Wix may add supported currencies in the future.
39
+ */
40
+ currency?: string;
41
+ /**
42
+ * Begin of the period Wix retrieves the app instance's charges for in
43
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
44
+ */
45
+ periodStart?: Date;
46
+ /**
47
+ * End of the period Wix retrieves the app instance's charges for in
48
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
49
+ */
50
+ periodEnd?: Date;
51
+ /**
52
+ * Information about what Wix intends to do with the retrieved charges.
53
+ *
54
+ * + `"DISPLAY_ONLY"`: Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice.
55
+ * + `"CREATE_INVOICE"`: Create an invoice for the customer.
56
+ */
57
+ intent?: Intent;
58
+ }
59
+ declare enum Intent {
60
+ /** retrieving the current charges for display purposes only */
61
+ DISPLAY_ONLY = "DISPLAY_ONLY",
62
+ /** retrieving the current charges with the intention of creating an invoice and billing the user */
63
+ CREATE_INVOICE = "CREATE_INVOICE"
64
+ }
65
+ interface ListChargesResponse {
66
+ /**
67
+ * Retrieved charges.
68
+ *
69
+ * Max: 5 charges
70
+ */
71
+ charges?: ChargeLineItem[];
72
+ }
73
+ interface ChargeLineItem {
74
+ /**
75
+ * ID of the charge. Make sure to save the charge ID on your servers for future
76
+ * reference. Identical to `lineItem.chargeId` in the
77
+ * [Invoice Created Event](https://dev.wix.com/docs/rest/api-reference/app-management/apps/custom-charges-spi/custom-charges-provider-v1/invoice-created-event).
78
+ *
79
+ * Max: 64 characters
80
+ */
81
+ _id?: string | null;
82
+ /** Charge description. */
83
+ description?: string;
84
+ /**
85
+ * Charge amount in the currency that's specified in the request. Use a whole number
86
+ * or separate major and minor units with a dot. For example, `10` or `1.99`. If
87
+ * you return an amount with more minor units than supported according to
88
+ * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),
89
+ * Wix truncates the additional minor units.
90
+ *
91
+ * Min: `0.50`
92
+ */
93
+ amount?: string;
94
+ }
95
+ interface ChargesRejectedRequest {
96
+ /**
97
+ * ID of the subscription for which Wix hasn't accepted your custom charges.
98
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
99
+ * of the `subscriptionId`.
100
+ */
101
+ subscriptionId?: string;
102
+ /**
103
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
104
+ *
105
+ * 3-letter currency code in
106
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
107
+ * format of the charges. Wix may add supported currencies in the future.
108
+ */
109
+ currency?: string;
110
+ /**
111
+ * IDs of the rejected charges.
112
+ *
113
+ * Max: 5 charges
114
+ */
115
+ chargeIds?: string[] | null;
116
+ /**
117
+ * Maximum amount that your app may charge the customer per billing cycle.
118
+ *
119
+ * Min: `0.50`
120
+ */
121
+ chargeLimit?: string | null;
122
+ /**
123
+ * Information about why Wix has rejected your app's charges.
124
+ *
125
+ * + `"UNKNOWN_REASON"`: There is no information about why Wix has rejected the charges.
126
+ * + `"CHARGE_LIMIT_EXCEEDED"`: The sum of the charges is higher than the limit that you may charge the customer per billing cycle.
127
+ * + `"TOO_MANY_CHARGES"`: You can't provide more than 5 charges per invoice.
128
+ * + `"INVALID_FORMAT"`: 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.
129
+ *
130
+ * Max: 20 reasons
131
+ */
132
+ reasons?: ChargesRejectedReason[];
133
+ }
134
+ declare enum ChargesRejectedReason {
135
+ UNKNOWN = "UNKNOWN",
136
+ CHARGE_LIMIT_EXCEEDED = "CHARGE_LIMIT_EXCEEDED",
137
+ TOO_MANY_CHARGES = "TOO_MANY_CHARGES",
138
+ INVALID_FORMAT = "INVALID_FORMAT"
139
+ }
140
+ interface ChargesRejectedResponse {
141
+ }
142
+ interface InvoiceCreatedRequest {
143
+ /**
144
+ * ID of the subscription for which Wix has created an invoice that includes
145
+ * your custom charges. To track usage and billing for apps, we recommend to use
146
+ * `instanceId` instead of the `subscriptionId`.
147
+ */
148
+ subscriptionId?: string;
149
+ /**
150
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
151
+ *
152
+ * 3-letter currency code in
153
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
154
+ * format of the charges. Wix may add supported currencies in the future.
155
+ */
156
+ currency?: string;
157
+ /** ID of the created invoice. */
158
+ invoiceId?: string;
159
+ /** Line items included in the invoice. */
160
+ lineItems?: InvoiceLineItem[];
161
+ }
162
+ interface InvoiceLineItem {
163
+ /**
164
+ * ID of the charge as returned in
165
+ * [List Charges](https://dev.wix.com/docs/rest/api-reference/app-management/apps/custom-charges-spi/custom-charges-provider-v1/list-charges).
166
+ *
167
+ * Max: 64 characters
168
+ */
169
+ chargeId?: string | null;
170
+ /** Charge amount. */
171
+ amount?: string;
172
+ /** ID of the line item in the invoice that Wix sends to the customer. */
173
+ _id?: string;
174
+ }
175
+ interface InvoiceCreatedResponse {
176
+ }
177
+ interface ChargeLimitUpdatedRequest {
178
+ /**
179
+ * ID of the subscription for which the charge limit has been updated.
180
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
181
+ * of the `subscriptionId`.
182
+ */
183
+ subscriptionId?: string;
184
+ /**
185
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
186
+ *
187
+ * 3-letter currency code in
188
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
189
+ * format of the charges. Wix may add supported currencies in the future.
190
+ */
191
+ currency?: string;
192
+ /** Updated charge limit. */
193
+ chargeLimit?: string | null;
194
+ }
195
+ interface ChargeLimitUpdatedResponse {
196
+ }
197
+ interface CustomChargesConfig {
198
+ /**
199
+ * Base part of your integration's deployment URI for the Custom Charges SPI.
200
+ * For example `"https://provider.example.com"`, if Wix should call your
201
+ * integration at `https://provider.example.com/v1/charge-limit` for the
202
+ * [Get Charge Limit]https://dev.wix.com/docs/rest/api-reference/app-management/apps/custom-charges-spi/custom-charges-provider-v1/get-charge-limit)
203
+ * endpoint.
204
+ */
205
+ baseUri?: SpiBaseUri;
206
+ }
207
+ interface SpiBaseUri {
208
+ /** URI that will be used by the host to call the implementer. The path-suffix defined on the method will be appended to it */
209
+ baseUri?: string;
210
+ /** override method mappings per method */
211
+ alternativeUris?: AlternativeUri[];
212
+ }
213
+ interface AlternativeUri {
214
+ /** name of the method as it appears in the proto */
215
+ methodName?: string;
216
+ /** absolute uri that will be used by the host to call that method. The path-suffix mapped from the method http option will NOT be appended to this URI. For TPAs. it must be https */
217
+ absoluteUri?: string;
218
+ }
219
+ /**
220
+ * this message is not directly used by any service,
221
+ * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.
222
+ * e.g. SPIs, event-handlers, etc..
223
+ * NOTE: this context object MUST be provided as the last argument in each Velo method signature.
224
+ *
225
+ * Example:
226
+ * ```typescript
227
+ * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {
228
+ * ...
229
+ * }
230
+ * ```
231
+ */
232
+ interface Context {
233
+ /** A unique identifier for each request. Can be used for logging / troubleshooting */
234
+ requestId?: string | null;
235
+ /** 3 capital letters string representing a currency according to ISO-4217 */
236
+ currency?: string | null;
237
+ /** The identification type and identity data */
238
+ identity?: IdentificationData;
239
+ /** 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 */
240
+ languages?: string[];
241
+ /** App instance ID of SPI in context */
242
+ instanceId?: string | null;
243
+ }
244
+ declare enum IdentityType {
245
+ UNKNOWN = "UNKNOWN",
246
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
247
+ MEMBER = "MEMBER",
248
+ WIX_USER = "WIX_USER",
249
+ APP = "APP"
250
+ }
251
+ interface IdentificationData extends IdentificationDataIdOneOf {
252
+ /** ID of a site visitor that has not logged in to the site. */
253
+ anonymousVisitorId?: string;
254
+ /** ID of a site visitor that has logged in to the site. */
255
+ memberId?: string;
256
+ /** ID of a Wix user (site owner, contributor, etc.). */
257
+ wixUserId?: string;
258
+ /** ID of an app. */
259
+ appId?: string;
260
+ /** @readonly */
261
+ identityType?: IdentityType;
262
+ }
263
+ /** @oneof */
264
+ interface IdentificationDataIdOneOf {
265
+ /** ID of a site visitor that has not logged in to the site. */
266
+ anonymousVisitorId?: string;
267
+ /** ID of a site visitor that has logged in to the site. */
268
+ memberId?: string;
269
+ /** ID of a Wix user (site owner, contributor, etc.). */
270
+ wixUserId?: string;
271
+ /** ID of an app. */
272
+ appId?: string;
273
+ }
274
+
275
+ type ServicePluginMethodInput = {
276
+ request: any;
277
+ metadata: any;
278
+ };
279
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
280
+ type ServicePluginMethodMetadata = {
281
+ name: string;
282
+ primaryHttpMappingPath: string;
283
+ transformations: {
284
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
285
+ toREST: (...args: unknown[]) => unknown;
286
+ };
287
+ };
288
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
289
+ __type: 'service-plugin-definition';
290
+ componentType: string;
291
+ methods: ServicePluginMethodMetadata[];
292
+ __contract: Contract;
293
+ };
294
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
295
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
296
+
297
+ interface GetChargeLimitEnvelope {
298
+ request: GetChargeLimitRequest;
299
+ metadata: Context;
300
+ }
301
+ interface ListChargesEnvelope {
302
+ request: ListChargesRequest;
303
+ metadata: Context;
304
+ }
305
+ interface ChargesRejectedEventEnvelope {
306
+ request: ChargesRejectedRequest;
307
+ metadata: Context;
308
+ }
309
+ interface InvoiceCreatedEventEnvelope {
310
+ request: InvoiceCreatedRequest;
311
+ metadata: Context;
312
+ }
313
+ interface ChargeLimitUpdatedEventEnvelope {
314
+ request: ChargeLimitUpdatedRequest;
315
+ metadata: Context;
316
+ }
317
+ declare const provideHandlers$1: ServicePluginDefinition<{
318
+ getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
319
+ listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
320
+ chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
321
+ invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
322
+ chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
323
+ }>;
324
+
325
+ declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1>;
326
+
327
+ type context_AlternativeUri = AlternativeUri;
328
+ type context_ChargeLimitUpdatedRequest = ChargeLimitUpdatedRequest;
329
+ type context_ChargeLimitUpdatedResponse = ChargeLimitUpdatedResponse;
330
+ type context_ChargeLineItem = ChargeLineItem;
331
+ type context_ChargesRejectedReason = ChargesRejectedReason;
332
+ declare const context_ChargesRejectedReason: typeof ChargesRejectedReason;
333
+ type context_ChargesRejectedRequest = ChargesRejectedRequest;
334
+ type context_ChargesRejectedResponse = ChargesRejectedResponse;
335
+ type context_Context = Context;
336
+ type context_CustomChargesConfig = CustomChargesConfig;
337
+ type context_GetChargeLimitRequest = GetChargeLimitRequest;
338
+ type context_GetChargeLimitResponse = GetChargeLimitResponse;
339
+ type context_IdentificationData = IdentificationData;
340
+ type context_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
341
+ type context_IdentityType = IdentityType;
342
+ declare const context_IdentityType: typeof IdentityType;
343
+ type context_Intent = Intent;
344
+ declare const context_Intent: typeof Intent;
345
+ type context_InvoiceCreatedRequest = InvoiceCreatedRequest;
346
+ type context_InvoiceCreatedResponse = InvoiceCreatedResponse;
347
+ type context_InvoiceLineItem = InvoiceLineItem;
348
+ type context_ListChargesRequest = ListChargesRequest;
349
+ type context_ListChargesResponse = ListChargesResponse;
350
+ type context_SpiBaseUri = SpiBaseUri;
351
+ declare const context_provideHandlers: typeof provideHandlers;
352
+ declare namespace context {
353
+ export { type context_AlternativeUri as AlternativeUri, type context_ChargeLimitUpdatedRequest as ChargeLimitUpdatedRequest, type context_ChargeLimitUpdatedResponse as ChargeLimitUpdatedResponse, type context_ChargeLineItem as ChargeLineItem, context_ChargesRejectedReason as ChargesRejectedReason, type context_ChargesRejectedRequest as ChargesRejectedRequest, type context_ChargesRejectedResponse as ChargesRejectedResponse, type context_Context as Context, type context_CustomChargesConfig as CustomChargesConfig, type context_GetChargeLimitRequest as GetChargeLimitRequest, type context_GetChargeLimitResponse as GetChargeLimitResponse, type context_IdentificationData as IdentificationData, type context_IdentificationDataIdOneOf as IdentificationDataIdOneOf, context_IdentityType as IdentityType, context_Intent as Intent, type context_InvoiceCreatedRequest as InvoiceCreatedRequest, type context_InvoiceCreatedResponse as InvoiceCreatedResponse, type context_InvoiceLineItem as InvoiceLineItem, type context_ListChargesRequest as ListChargesRequest, type context_ListChargesResponse as ListChargesResponse, type context_SpiBaseUri as SpiBaseUri, context_provideHandlers as provideHandlers };
354
+ }
355
+
356
+ export { context as customCharges };
@@ -0,0 +1,358 @@
1
+ interface GetChargeLimitRequest {
2
+ /**
3
+ * ID of the subscription for which Wix retrieves the charge limit. Equals
4
+ * `null` in case Wix hasn't created the subscription when retrieving an
5
+ * initial charge limit. To track usage and billing for apps, we recommend to
6
+ * use `instanceId` instead of the `subscriptionId`.
7
+ */
8
+ subscriptionId?: string | null;
9
+ /**
10
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
11
+ *
12
+ * 3-letter currency code in
13
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
14
+ * format of the charge limit. Wix may add supported currencies in the future.
15
+ */
16
+ currency?: string;
17
+ }
18
+ interface GetChargeLimitResponse {
19
+ /**
20
+ * Retrieved charge limit for the app instance. You can't update the
21
+ * charge limit after you've set an initial value. Site owners can increase the
22
+ * limit in their site's dashboard, currently they aren't allowed to decrease it.
23
+ */
24
+ chargeLimit?: string | null;
25
+ }
26
+ interface ListChargesRequest {
27
+ /**
28
+ * ID of the subscription for which Wix retrieves your custom charges.
29
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
30
+ * of the `subscriptionId`.
31
+ */
32
+ subscriptionId?: string;
33
+ /**
34
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
35
+ *
36
+ * 3-letter currency code in
37
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
38
+ * format of your charges to return. Wix may add supported currencies in the future.
39
+ */
40
+ currency?: string;
41
+ /**
42
+ * Begin of the period Wix retrieves the app instance's charges for in
43
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
44
+ */
45
+ periodStart?: Date;
46
+ /**
47
+ * End of the period Wix retrieves the app instance's charges for in
48
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
49
+ */
50
+ periodEnd?: Date;
51
+ /**
52
+ * Information about what Wix intends to do with the retrieved charges.
53
+ *
54
+ * + `"DISPLAY_ONLY"`: Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice.
55
+ * + `"CREATE_INVOICE"`: Create an invoice for the customer.
56
+ */
57
+ intent?: Intent;
58
+ }
59
+ declare enum Intent {
60
+ /** retrieving the current charges for display purposes only */
61
+ DISPLAY_ONLY = "DISPLAY_ONLY",
62
+ /** retrieving the current charges with the intention of creating an invoice and billing the user */
63
+ CREATE_INVOICE = "CREATE_INVOICE"
64
+ }
65
+ interface ListChargesResponse {
66
+ /**
67
+ * Retrieved charges.
68
+ *
69
+ * Max: 5 charges
70
+ */
71
+ charges?: ChargeLineItem[];
72
+ }
73
+ interface ChargeLineItem {
74
+ /**
75
+ * ID of the charge. Make sure to save the charge ID on your servers for future
76
+ * reference. Identical to `lineItem.chargeId` in the
77
+ * [Invoice Created Event](https://dev.wix.com/docs/rest/api-reference/app-management/apps/custom-charges-spi/custom-charges-provider-v1/invoice-created-event).
78
+ *
79
+ * Max: 64 characters
80
+ */
81
+ _id?: string | null;
82
+ /** Charge description. */
83
+ description?: string;
84
+ /**
85
+ * Charge amount in the currency that's specified in the request. Use a whole number
86
+ * or separate major and minor units with a dot. For example, `10` or `1.99`. If
87
+ * you return an amount with more minor units than supported according to
88
+ * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),
89
+ * Wix truncates the additional minor units.
90
+ *
91
+ * Min: `0.50`
92
+ */
93
+ amount?: string;
94
+ }
95
+ interface ChargesRejectedRequest {
96
+ /**
97
+ * ID of the subscription for which Wix hasn't accepted your custom charges.
98
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
99
+ * of the `subscriptionId`.
100
+ */
101
+ subscriptionId?: string;
102
+ /**
103
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
104
+ *
105
+ * 3-letter currency code in
106
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
107
+ * format of the charges. Wix may add supported currencies in the future.
108
+ */
109
+ currency?: string;
110
+ /**
111
+ * IDs of the rejected charges.
112
+ *
113
+ * Max: 5 charges
114
+ */
115
+ chargeIds?: string[] | null;
116
+ /**
117
+ * Maximum amount that your app may charge the customer per billing cycle.
118
+ *
119
+ * Min: `0.50`
120
+ */
121
+ chargeLimit?: string | null;
122
+ /**
123
+ * Information about why Wix has rejected your app's charges.
124
+ *
125
+ * + `"UNKNOWN_REASON"`: There is no information about why Wix has rejected the charges.
126
+ * + `"CHARGE_LIMIT_EXCEEDED"`: The sum of the charges is higher than the limit that you may charge the customer per billing cycle.
127
+ * + `"TOO_MANY_CHARGES"`: You can't provide more than 5 charges per invoice.
128
+ * + `"INVALID_FORMAT"`: 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.
129
+ *
130
+ * Max: 20 reasons
131
+ */
132
+ reasons?: ChargesRejectedReason[];
133
+ }
134
+ declare enum ChargesRejectedReason {
135
+ UNKNOWN = "UNKNOWN",
136
+ CHARGE_LIMIT_EXCEEDED = "CHARGE_LIMIT_EXCEEDED",
137
+ TOO_MANY_CHARGES = "TOO_MANY_CHARGES",
138
+ INVALID_FORMAT = "INVALID_FORMAT"
139
+ }
140
+ interface ChargesRejectedResponse {
141
+ }
142
+ interface InvoiceCreatedRequest {
143
+ /**
144
+ * ID of the subscription for which Wix has created an invoice that includes
145
+ * your custom charges. To track usage and billing for apps, we recommend to use
146
+ * `instanceId` instead of the `subscriptionId`.
147
+ */
148
+ subscriptionId?: string;
149
+ /**
150
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
151
+ *
152
+ * 3-letter currency code in
153
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
154
+ * format of the charges. Wix may add supported currencies in the future.
155
+ */
156
+ currency?: string;
157
+ /** ID of the created invoice. */
158
+ invoiceId?: string;
159
+ /** Line items included in the invoice. */
160
+ lineItems?: InvoiceLineItem[];
161
+ }
162
+ interface InvoiceLineItem {
163
+ /**
164
+ * ID of the charge as returned in
165
+ * [List Charges](https://dev.wix.com/docs/rest/api-reference/app-management/apps/custom-charges-spi/custom-charges-provider-v1/list-charges).
166
+ *
167
+ * Max: 64 characters
168
+ */
169
+ chargeId?: string | null;
170
+ /** Charge amount. */
171
+ amount?: string;
172
+ /** ID of the line item in the invoice that Wix sends to the customer. */
173
+ _id?: string;
174
+ }
175
+ interface InvoiceCreatedResponse {
176
+ }
177
+ interface ChargeLimitUpdatedRequest {
178
+ /**
179
+ * ID of the subscription for which the charge limit has been updated.
180
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
181
+ * of the `subscriptionId`.
182
+ */
183
+ subscriptionId?: string;
184
+ /**
185
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
186
+ *
187
+ * 3-letter currency code in
188
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
189
+ * format of the charges. Wix may add supported currencies in the future.
190
+ */
191
+ currency?: string;
192
+ /** Updated charge limit. */
193
+ chargeLimit?: string | null;
194
+ }
195
+ interface ChargeLimitUpdatedResponse {
196
+ }
197
+ interface CustomChargesConfig {
198
+ /**
199
+ * Base part of your integration's deployment URI for the Custom Charges SPI.
200
+ * For example `"https://provider.example.com"`, if Wix should call your
201
+ * integration at `https://provider.example.com/v1/charge-limit` for the
202
+ * [Get Charge Limit]https://dev.wix.com/docs/rest/api-reference/app-management/apps/custom-charges-spi/custom-charges-provider-v1/get-charge-limit)
203
+ * endpoint.
204
+ */
205
+ baseUri?: SpiBaseUri;
206
+ }
207
+ interface SpiBaseUri {
208
+ /** URI that will be used by the host to call the implementer. The path-suffix defined on the method will be appended to it */
209
+ baseUri?: string;
210
+ /** override method mappings per method */
211
+ alternativeUris?: AlternativeUri[];
212
+ }
213
+ interface AlternativeUri {
214
+ /** name of the method as it appears in the proto */
215
+ methodName?: string;
216
+ /** absolute uri that will be used by the host to call that method. The path-suffix mapped from the method http option will NOT be appended to this URI. For TPAs. it must be https */
217
+ absoluteUri?: string;
218
+ }
219
+ /**
220
+ * this message is not directly used by any service,
221
+ * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.
222
+ * e.g. SPIs, event-handlers, etc..
223
+ * NOTE: this context object MUST be provided as the last argument in each Velo method signature.
224
+ *
225
+ * Example:
226
+ * ```typescript
227
+ * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {
228
+ * ...
229
+ * }
230
+ * ```
231
+ */
232
+ interface Context {
233
+ /** A unique identifier for each request. Can be used for logging / troubleshooting */
234
+ requestId?: string | null;
235
+ /** 3 capital letters string representing a currency according to ISO-4217 */
236
+ currency?: string | null;
237
+ /** The identification type and identity data */
238
+ identity?: IdentificationData;
239
+ /** 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 */
240
+ languages?: string[];
241
+ /** App instance ID of SPI in context */
242
+ instanceId?: string | null;
243
+ }
244
+ declare enum IdentityType {
245
+ UNKNOWN = "UNKNOWN",
246
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
247
+ MEMBER = "MEMBER",
248
+ WIX_USER = "WIX_USER",
249
+ APP = "APP"
250
+ }
251
+ interface IdentificationData extends IdentificationDataIdOneOf {
252
+ /** ID of a site visitor that has not logged in to the site. */
253
+ anonymousVisitorId?: string;
254
+ /** ID of a site visitor that has logged in to the site. */
255
+ memberId?: string;
256
+ /** ID of a Wix user (site owner, contributor, etc.). */
257
+ wixUserId?: string;
258
+ /** ID of an app. */
259
+ appId?: string;
260
+ /** @readonly */
261
+ identityType?: IdentityType;
262
+ }
263
+ /** @oneof */
264
+ interface IdentificationDataIdOneOf {
265
+ /** ID of a site visitor that has not logged in to the site. */
266
+ anonymousVisitorId?: string;
267
+ /** ID of a site visitor that has logged in to the site. */
268
+ memberId?: string;
269
+ /** ID of a Wix user (site owner, contributor, etc.). */
270
+ wixUserId?: string;
271
+ /** ID of an app. */
272
+ appId?: string;
273
+ }
274
+
275
+ type ServicePluginMethodInput = {
276
+ request: any;
277
+ metadata: any;
278
+ };
279
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
280
+ type ServicePluginMethodMetadata = {
281
+ name: string;
282
+ primaryHttpMappingPath: string;
283
+ transformations: {
284
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
285
+ toREST: (...args: unknown[]) => unknown;
286
+ };
287
+ };
288
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
289
+ __type: 'service-plugin-definition';
290
+ componentType: string;
291
+ methods: ServicePluginMethodMetadata[];
292
+ __contract: Contract;
293
+ };
294
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
295
+
296
+ interface GetChargeLimitEnvelope {
297
+ request: GetChargeLimitRequest;
298
+ metadata: Context;
299
+ }
300
+ interface ListChargesEnvelope {
301
+ request: ListChargesRequest;
302
+ metadata: Context;
303
+ }
304
+ interface ChargesRejectedEventEnvelope {
305
+ request: ChargesRejectedRequest;
306
+ metadata: Context;
307
+ }
308
+ interface InvoiceCreatedEventEnvelope {
309
+ request: InvoiceCreatedRequest;
310
+ metadata: Context;
311
+ }
312
+ interface ChargeLimitUpdatedEventEnvelope {
313
+ request: ChargeLimitUpdatedRequest;
314
+ metadata: Context;
315
+ }
316
+ declare const provideHandlers: ServicePluginDefinition<{
317
+ getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
318
+ listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
319
+ chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
320
+ invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
321
+ chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
322
+ }>;
323
+
324
+ type index_d_AlternativeUri = AlternativeUri;
325
+ type index_d_ChargeLimitUpdatedEventEnvelope = ChargeLimitUpdatedEventEnvelope;
326
+ type index_d_ChargeLimitUpdatedRequest = ChargeLimitUpdatedRequest;
327
+ type index_d_ChargeLimitUpdatedResponse = ChargeLimitUpdatedResponse;
328
+ type index_d_ChargeLineItem = ChargeLineItem;
329
+ type index_d_ChargesRejectedEventEnvelope = ChargesRejectedEventEnvelope;
330
+ type index_d_ChargesRejectedReason = ChargesRejectedReason;
331
+ declare const index_d_ChargesRejectedReason: typeof ChargesRejectedReason;
332
+ type index_d_ChargesRejectedRequest = ChargesRejectedRequest;
333
+ type index_d_ChargesRejectedResponse = ChargesRejectedResponse;
334
+ type index_d_Context = Context;
335
+ type index_d_CustomChargesConfig = CustomChargesConfig;
336
+ type index_d_GetChargeLimitEnvelope = GetChargeLimitEnvelope;
337
+ type index_d_GetChargeLimitRequest = GetChargeLimitRequest;
338
+ type index_d_GetChargeLimitResponse = GetChargeLimitResponse;
339
+ type index_d_IdentificationData = IdentificationData;
340
+ type index_d_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
341
+ type index_d_IdentityType = IdentityType;
342
+ declare const index_d_IdentityType: typeof IdentityType;
343
+ type index_d_Intent = Intent;
344
+ declare const index_d_Intent: typeof Intent;
345
+ type index_d_InvoiceCreatedEventEnvelope = InvoiceCreatedEventEnvelope;
346
+ type index_d_InvoiceCreatedRequest = InvoiceCreatedRequest;
347
+ type index_d_InvoiceCreatedResponse = InvoiceCreatedResponse;
348
+ type index_d_InvoiceLineItem = InvoiceLineItem;
349
+ type index_d_ListChargesEnvelope = ListChargesEnvelope;
350
+ type index_d_ListChargesRequest = ListChargesRequest;
351
+ type index_d_ListChargesResponse = ListChargesResponse;
352
+ type index_d_SpiBaseUri = SpiBaseUri;
353
+ declare const index_d_provideHandlers: typeof provideHandlers;
354
+ declare namespace index_d {
355
+ export { type index_d_AlternativeUri as AlternativeUri, type index_d_ChargeLimitUpdatedEventEnvelope as ChargeLimitUpdatedEventEnvelope, type index_d_ChargeLimitUpdatedRequest as ChargeLimitUpdatedRequest, type index_d_ChargeLimitUpdatedResponse as ChargeLimitUpdatedResponse, type index_d_ChargeLineItem as ChargeLineItem, type index_d_ChargesRejectedEventEnvelope as ChargesRejectedEventEnvelope, index_d_ChargesRejectedReason as ChargesRejectedReason, type index_d_ChargesRejectedRequest as ChargesRejectedRequest, type index_d_ChargesRejectedResponse as ChargesRejectedResponse, type index_d_Context as Context, type index_d_CustomChargesConfig as CustomChargesConfig, type index_d_GetChargeLimitEnvelope as GetChargeLimitEnvelope, type index_d_GetChargeLimitRequest as GetChargeLimitRequest, type index_d_GetChargeLimitResponse as GetChargeLimitResponse, type index_d_IdentificationData as IdentificationData, type index_d_IdentificationDataIdOneOf as IdentificationDataIdOneOf, index_d_IdentityType as IdentityType, index_d_Intent as Intent, type index_d_InvoiceCreatedEventEnvelope as InvoiceCreatedEventEnvelope, type index_d_InvoiceCreatedRequest as InvoiceCreatedRequest, type index_d_InvoiceCreatedResponse as InvoiceCreatedResponse, type index_d_InvoiceLineItem as InvoiceLineItem, type index_d_ListChargesEnvelope as ListChargesEnvelope, type index_d_ListChargesRequest as ListChargesRequest, type index_d_ListChargesResponse as ListChargesResponse, type index_d_SpiBaseUri as SpiBaseUri, index_d_provideHandlers as provideHandlers };
356
+ }
357
+
358
+ export { index_d as customCharges };