@wix/auto_sdk_app-management_custom-charges 1.0.4 → 1.0.6

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/index.d.ts +2 -0
  2. package/build/cjs/index.js +19 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +59 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +5 -0
  8. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +9 -0
  9. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +1 -0
  10. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +79 -0
  11. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +88 -0
  12. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +1 -0
  13. package/build/{index.d.mts → cjs/src/service-plugins-types.d.ts} +21 -106
  14. package/build/cjs/src/service-plugins-types.js +30 -0
  15. package/build/cjs/src/service-plugins-types.js.map +1 -0
  16. package/build/es/index.d.ts +2 -0
  17. package/build/es/index.js +3 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/index.typings.d.ts +59 -0
  20. package/build/es/index.typings.js +2 -0
  21. package/build/es/index.typings.js.map +1 -0
  22. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +5 -0
  23. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js +6 -0
  24. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +1 -0
  25. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +79 -0
  26. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js +85 -0
  27. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +1 -0
  28. package/build/{index.d.ts → es/src/service-plugins-types.d.ts} +21 -106
  29. package/build/es/src/service-plugins-types.js +27 -0
  30. package/build/es/src/service-plugins-types.js.map +1 -0
  31. package/build/internal/cjs/index.d.ts +2 -0
  32. package/build/internal/cjs/index.js +19 -0
  33. package/build/internal/cjs/index.js.map +1 -0
  34. package/build/internal/cjs/index.typings.d.ts +59 -0
  35. package/build/internal/cjs/index.typings.js +18 -0
  36. package/build/internal/cjs/index.typings.js.map +1 -0
  37. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +5 -0
  38. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +9 -0
  39. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +1 -0
  40. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +79 -0
  41. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +88 -0
  42. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +1 -0
  43. package/build/internal/{index.d.mts → cjs/src/service-plugins-types.d.ts} +21 -106
  44. package/build/internal/cjs/src/service-plugins-types.js +30 -0
  45. package/build/internal/cjs/src/service-plugins-types.js.map +1 -0
  46. package/build/internal/es/index.d.ts +2 -0
  47. package/build/internal/es/index.js +3 -0
  48. package/build/internal/es/index.js.map +1 -0
  49. package/build/internal/es/index.typings.d.ts +59 -0
  50. package/build/internal/es/index.typings.js +2 -0
  51. package/build/internal/es/index.typings.js.map +1 -0
  52. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +5 -0
  53. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js +6 -0
  54. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +1 -0
  55. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +79 -0
  56. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js +85 -0
  57. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +1 -0
  58. package/build/internal/{index.d.ts → es/src/service-plugins-types.d.ts} +21 -106
  59. package/build/internal/es/src/service-plugins-types.js +27 -0
  60. package/build/internal/es/src/service-plugins-types.js.map +1 -0
  61. package/package.json +11 -12
  62. package/build/index.js +0 -150
  63. package/build/index.js.map +0 -1
  64. package/build/index.mjs +0 -122
  65. package/build/index.mjs.map +0 -1
  66. package/build/internal/index.js +0 -150
  67. package/build/internal/index.js.map +0 -1
  68. package/build/internal/index.mjs +0 -122
  69. package/build/internal/index.mjs.map +0 -1
@@ -0,0 +1,2 @@
1
+ export * from './src/service-plugins-types.js';
2
+ export * from './src/interfaces-premium-v1-custom-charges-provider.context.js';
@@ -0,0 +1,19 @@
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);
15
+ };
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);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,iGAA+E"}
@@ -0,0 +1,59 @@
1
+ import { GetChargeLimitResponse, ListChargesResponse, ChargesRejectedResponse, InvoiceCreatedResponse, ChargeLimitUpdatedResponse } from './src/service-plugins-types.js';
2
+ import { GetChargeLimitEnvelope, ListChargesEnvelope, ChargesRejectedEventEnvelope, InvoiceCreatedEventEnvelope, ChargeLimitUpdatedEventEnvelope } from './src/interfaces-premium-v1-custom-charges-provider.public.js';
3
+ export * from './src/service-plugins-types';
4
+ export { GetChargeLimitEnvelope, ListChargesEnvelope, ChargesRejectedEventEnvelope, InvoiceCreatedEventEnvelope, ChargeLimitUpdatedEventEnvelope, };
5
+ /**
6
+ * Wix calls this method to retrieve the initial charge limit for a paid instance
7
+ * of your app. This happens every time a customer is upgrading to a paid version of
8
+ * your app.
9
+ *
10
+ * You can't update the charge limit after you've set an initial
11
+ * value. Customers can increase the limit in their site's dashboard, currently they
12
+ * aren't allowed to decrease it.
13
+ */
14
+ export declare function getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
15
+ /**
16
+ * Wix calls this method to retrieve a list of charges for a paid instance
17
+ * of your app. This happens when Wix creates an invoice or in case the customer
18
+ * wants to preview how much your app would charge them at the moment.
19
+ *
20
+ * You must return the charges in the currency that's specified in the request,
21
+ * you aren't allowed to return more than 5 charges, and their sum must be lower
22
+ * than the charge limit.
23
+ *
24
+ * You may not bill customers for any usage that didn’t occur during the period
25
+ * Wix specifies when retrieving the charges. If Wix discovers that your app has
26
+ * charged customers for usage outside of an invoice's specified period, we may
27
+ * take action such as blocking your app from charging the customer, removing
28
+ * your app from the Wix App Market, revoking your access to the Wix developer
29
+ * program, or pursuing legal action to recover damages caused by overcharging.
30
+ * We understand that mistakes can happen and encourage you to contact
31
+ * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
32
+ * become aware of any overcharging issues so that we can work together to
33
+ * resolve the situation.
34
+ */
35
+ export declare function listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
36
+ /**
37
+ * Triggered in case Wix doesn't accept the charges you've returned in the
38
+ * List Charges method.
39
+ *
40
+ *
41
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
42
+ * call List Charges in regular intervals until the sum of all charges is lower than the
43
+ * charge limit. Wix doesn't create an invoice in case the charges aren't accepted.
44
+ */
45
+ export declare function chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
46
+ /**
47
+ * Triggered in case Wix creates an invoice that includes charges for an instance
48
+ * of your app.
49
+ */
50
+ export declare function invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
51
+ /**
52
+ * Triggered in case the charge limit for an instance of your app is updated.
53
+ *
54
+ *
55
+ * You can't update the charge limit after you've set an initial
56
+ * value. Site owners can increase the limit in their site's dashboard,
57
+ * currently they aren't allowed to decrease it.
58
+ */
59
+ export declare function chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
@@ -0,0 +1,18 @@
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);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/service-plugins-types"), exports);
18
+ //# sourceMappingURL=index.typings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../index.typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAeA,8DAA4C"}
@@ -0,0 +1,5 @@
1
+ import './interfaces-premium-v1-custom-charges-provider.public.js';
2
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
3
+ import { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';
4
+ export { publicProvideHandlers };
5
+ export declare const provideHandlers: ReturnType<typeof createServicePluginModule<typeof publicProvideHandlers>>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provideHandlers = exports.publicProvideHandlers = void 0;
4
+ require("./interfaces-premium-v1-custom-charges-provider.public.js");
5
+ const service_plugin_modules_1 = require("@wix/sdk-runtime/service-plugin-modules");
6
+ const interfaces_premium_v1_custom_charges_provider_public_js_1 = require("./interfaces-premium-v1-custom-charges-provider.public.js");
7
+ Object.defineProperty(exports, "publicProvideHandlers", { enumerable: true, get: function () { return interfaces_premium_v1_custom_charges_provider_public_js_1.provideHandlers; } });
8
+ exports.provideHandlers = (0, service_plugin_modules_1.createServicePluginModule)(interfaces_premium_v1_custom_charges_provider_public_js_1.provideHandlers);
9
+ //# sourceMappingURL=interfaces-premium-v1-custom-charges-provider.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-premium-v1-custom-charges-provider.context.js","sourceRoot":"","sources":["../../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"names":[],"mappings":";;;AAAA,qEAAmE;AACnE,oFAAoF;AACpF,uIAAqH;AAE5G,sGAFmB,yEAAqB,OAEnB;AAEjB,QAAA,eAAe,GAExB,IAAA,kDAAyB,EAAC,yEAAqB,CAAC,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { ServicePluginDefinition } from '@wix/sdk-types';
2
+ import { Context, GetChargeLimitRequest, GetChargeLimitResponse, ListChargesRequest, ListChargesResponse, ChargesRejectedRequest, ChargesRejectedResponse, InvoiceCreatedRequest, InvoiceCreatedResponse, ChargeLimitUpdatedRequest, ChargeLimitUpdatedResponse } from './service-plugins-types.js';
3
+ export interface GetChargeLimitEnvelope {
4
+ request: GetChargeLimitRequest;
5
+ metadata: Context;
6
+ }
7
+ export interface ListChargesEnvelope {
8
+ request: ListChargesRequest;
9
+ metadata: Context;
10
+ }
11
+ export interface ChargesRejectedEventEnvelope {
12
+ request: ChargesRejectedRequest;
13
+ metadata: Context;
14
+ }
15
+ export interface InvoiceCreatedEventEnvelope {
16
+ request: InvoiceCreatedRequest;
17
+ metadata: Context;
18
+ }
19
+ export interface ChargeLimitUpdatedEventEnvelope {
20
+ request: ChargeLimitUpdatedRequest;
21
+ metadata: Context;
22
+ }
23
+ export declare const provideHandlers: ServicePluginDefinition<{
24
+ /**
25
+ *
26
+ * Wix calls this method to retrieve the initial charge limit for a paid instance
27
+ * of your app. This happens every time a customer is upgrading to a paid version of
28
+ * your app.
29
+ *
30
+ * You can't update the charge limit after you've set an initial
31
+ * value. Customers can increase the limit in their site's dashboard, currently they
32
+ * aren't allowed to decrease it. */
33
+ getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
34
+ /**
35
+ *
36
+ * Wix calls this method to retrieve a list of charges for a paid instance
37
+ * of your app. This happens when Wix creates an invoice or in case the customer
38
+ * wants to preview how much your app would charge them at the moment.
39
+ *
40
+ * You must return the charges in the currency that's specified in the request,
41
+ * you aren't allowed to return more than 5 charges, and their sum must be lower
42
+ * than the charge limit.
43
+ *
44
+ * You may not bill customers for any usage that didn’t occur during the period
45
+ * Wix specifies when retrieving the charges. If Wix discovers that your app has
46
+ * charged customers for usage outside of an invoice's specified period, we may
47
+ * take action such as blocking your app from charging the customer, removing
48
+ * your app from the Wix App Market, revoking your access to the Wix developer
49
+ * program, or pursuing legal action to recover damages caused by overcharging.
50
+ * We understand that mistakes can happen and encourage you to contact
51
+ * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
52
+ * become aware of any overcharging issues so that we can work together to
53
+ * resolve the situation. */
54
+ listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
55
+ /**
56
+ *
57
+ * Triggered in case Wix doesn't accept the charges you've returned in the
58
+ * List Charges method.
59
+ *
60
+ *
61
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
62
+ * call List Charges in regular intervals until the sum of all charges is lower than the
63
+ * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */
64
+ chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
65
+ /**
66
+ *
67
+ * Triggered in case Wix creates an invoice that includes charges for an instance
68
+ * of your app. */
69
+ invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
70
+ /**
71
+ *
72
+ * Triggered in case the charge limit for an instance of your app is updated.
73
+ *
74
+ *
75
+ * You can't update the charge limit after you've set an initial
76
+ * value. Site owners can increase the limit in their site's dashboard,
77
+ * currently they aren't allowed to decrease it. */
78
+ chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
79
+ }>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provideHandlers = void 0;
4
+ const sdk_types_1 = require("@wix/sdk-types");
5
+ const timestamp_1 = require("@wix/sdk-runtime/transformations/timestamp");
6
+ const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
7
+ const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
8
+ exports.provideHandlers = (0, sdk_types_1.ServicePluginDefinition)('PREMIUM_CUSTOM_CHARGES', [
9
+ {
10
+ name: 'getChargeLimit',
11
+ primaryHttpMappingPath: '/v1/charge-limit',
12
+ transformations: {
13
+ toREST: (payload) => {
14
+ const toRestResponse = payload;
15
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
16
+ },
17
+ fromREST: (payload) => {
18
+ const fromRestRequest = payload;
19
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
20
+ },
21
+ },
22
+ },
23
+ {
24
+ name: 'listCharges',
25
+ primaryHttpMappingPath: '/v1/charges',
26
+ transformations: {
27
+ toREST: (payload) => {
28
+ const toRestResponse = payload;
29
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
30
+ },
31
+ fromREST: (payload) => {
32
+ const fromRestRequest = (0, transform_paths_1.transformPaths)(payload, [
33
+ {
34
+ transformFn: timestamp_1.transformRESTTimestampToSDKTimestamp,
35
+ paths: [
36
+ { path: 'request.periodStart' },
37
+ { path: 'request.periodEnd' },
38
+ ],
39
+ },
40
+ ]);
41
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
42
+ },
43
+ },
44
+ },
45
+ {
46
+ name: 'chargesRejectedEvent',
47
+ primaryHttpMappingPath: '/v1/charges-rejected',
48
+ transformations: {
49
+ toREST: (payload) => {
50
+ const toRestResponse = payload;
51
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
52
+ },
53
+ fromREST: (payload) => {
54
+ const fromRestRequest = payload;
55
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
56
+ },
57
+ },
58
+ },
59
+ {
60
+ name: 'invoiceCreatedEvent',
61
+ primaryHttpMappingPath: '/v1/invoice-created',
62
+ transformations: {
63
+ toREST: (payload) => {
64
+ const toRestResponse = payload;
65
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
66
+ },
67
+ fromREST: (payload) => {
68
+ const fromRestRequest = payload;
69
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
70
+ },
71
+ },
72
+ },
73
+ {
74
+ name: 'chargeLimitUpdatedEvent',
75
+ primaryHttpMappingPath: '/v1/limit-updated',
76
+ transformations: {
77
+ toREST: (payload) => {
78
+ const toRestResponse = payload;
79
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
80
+ },
81
+ fromREST: (payload) => {
82
+ const fromRestRequest = payload;
83
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
84
+ },
85
+ },
86
+ },
87
+ ]);
88
+ //# sourceMappingURL=interfaces-premium-v1-custom-charges-provider.public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-premium-v1-custom-charges-provider.public.js","sourceRoot":"","sources":["../../../src/interfaces-premium-v1-custom-charges-provider.public.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AAczD,0EAAkG;AAClG,sFAAkF;AAClF,oFAGiD;AA2BpC,QAAA,eAAe,GAAG,IAAA,mCAAuB,EAsEnD,wBAAwB,EAAE;IAC3B;QACE,IAAI,EAAE,gBAAgB;QACtB,sBAAsB,EAAE,kBAAkB;QAC1C,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,OAAO,CAAC;gBAEhC,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;IAED;QACE,IAAI,EAAE,aAAa;QACnB,sBAAsB,EAAE,aAAa;QACrC,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,IAAA,gCAAc,EAAC,OAAO,EAAE;oBAC9C;wBACE,WAAW,EAAE,gDAAoC;wBACjD,KAAK,EAAE;4BACL,EAAE,IAAI,EAAE,qBAAqB,EAAE;4BAC/B,EAAE,IAAI,EAAE,mBAAmB,EAAE;yBAC9B;qBACF;iBACF,CAAC,CAAC;gBAEH,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;IAED;QACE,IAAI,EAAE,sBAAsB;QAC5B,sBAAsB,EAAE,sBAAsB;QAC9C,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,OAAO,CAAC;gBAEhC,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;IAED;QACE,IAAI,EAAE,qBAAqB;QAC3B,sBAAsB,EAAE,qBAAqB;QAC7C,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,OAAO,CAAC;gBAEhC,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;IAED;QACE,IAAI,EAAE,yBAAyB;QAC/B,sBAAsB,EAAE,mBAAmB;QAC3C,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,OAAO,CAAC;gBAEhC,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;CACF,CAAC,CAAC"}
@@ -1,7 +1,4 @@
1
- import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
2
- import { ServicePluginDefinition } from '@wix/sdk-types';
3
-
4
- interface GetChargeLimitRequest {
1
+ export interface GetChargeLimitRequest {
5
2
  /**
6
3
  * ID of the subscription for which Wix retrieves the charge limit. Equals
7
4
  * `null` in case Wix hasn't created the subscription when retrieving an
@@ -20,7 +17,7 @@ interface GetChargeLimitRequest {
20
17
  */
21
18
  currency?: string;
22
19
  }
23
- interface GetChargeLimitResponse {
20
+ export interface GetChargeLimitResponse {
24
21
  /**
25
22
  * Retrieved charge limit for the app instance. You can't update the
26
23
  * charge limit after you've set an initial value. Site owners can increase the
@@ -30,7 +27,7 @@ interface GetChargeLimitResponse {
30
27
  */
31
28
  chargeLimit?: string | null;
32
29
  }
33
- interface ListChargesRequest {
30
+ export interface ListChargesRequest {
34
31
  /**
35
32
  * ID of the subscription for which Wix retrieves your custom charges.
36
33
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -60,13 +57,13 @@ interface ListChargesRequest {
60
57
  /** Information about what Wix intends to do with the retrieved charges. */
61
58
  intent?: Intent;
62
59
  }
63
- declare enum Intent {
60
+ export declare enum Intent {
64
61
  /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
65
62
  DISPLAY_ONLY = "DISPLAY_ONLY",
66
63
  /** Create an invoice for the customer. */
67
64
  CREATE_INVOICE = "CREATE_INVOICE"
68
65
  }
69
- interface ListChargesResponse {
66
+ export interface ListChargesResponse {
70
67
  /**
71
68
  * Retrieved charges.
72
69
  *
@@ -75,7 +72,7 @@ interface ListChargesResponse {
75
72
  */
76
73
  charges?: ChargeLineItem[];
77
74
  }
78
- interface ChargeLineItem {
75
+ export interface ChargeLineItem {
79
76
  /**
80
77
  * ID of the charge. Make sure to save the charge ID on your servers for future
81
78
  * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.
@@ -98,7 +95,7 @@ interface ChargeLineItem {
98
95
  */
99
96
  amount?: string;
100
97
  }
101
- interface ChargesRejectedRequest {
98
+ export interface ChargesRejectedRequest {
102
99
  /**
103
100
  * ID of the subscription for which Wix hasn't accepted your custom charges.
104
101
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -138,7 +135,7 @@ interface ChargesRejectedRequest {
138
135
  */
139
136
  reasons?: ChargesRejectedReason[];
140
137
  }
141
- declare enum ChargesRejectedReason {
138
+ export declare enum ChargesRejectedReason {
142
139
  /** There is no information about why Wix has rejected the charges. */
143
140
  UNKNOWN = "UNKNOWN",
144
141
  /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
@@ -148,9 +145,9 @@ declare enum ChargesRejectedReason {
148
145
  /** 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. */
149
146
  INVALID_FORMAT = "INVALID_FORMAT"
150
147
  }
151
- interface ChargesRejectedResponse {
148
+ export interface ChargesRejectedResponse {
152
149
  }
153
- interface InvoiceCreatedRequest {
150
+ export interface InvoiceCreatedRequest {
154
151
  /**
155
152
  * ID of the subscription for which Wix has created an invoice that includes
156
153
  * your custom charges. To track usage and billing for apps, we recommend to use
@@ -175,7 +172,7 @@ interface InvoiceCreatedRequest {
175
172
  */
176
173
  lineItems?: InvoiceLineItem[];
177
174
  }
178
- interface InvoiceLineItem {
175
+ export interface InvoiceLineItem {
179
176
  /**
180
177
  * ID of the charge as returned in List Charges.
181
178
  *
@@ -194,9 +191,9 @@ interface InvoiceLineItem {
194
191
  */
195
192
  _id?: string;
196
193
  }
197
- interface InvoiceCreatedResponse {
194
+ export interface InvoiceCreatedResponse {
198
195
  }
199
- interface ChargeLimitUpdatedRequest {
196
+ export interface ChargeLimitUpdatedRequest {
200
197
  /**
201
198
  * ID of the subscription for which the charge limit has been updated.
202
199
  * To track usage and billing for apps, we recommend to use `instanceId` instead
@@ -219,9 +216,9 @@ interface ChargeLimitUpdatedRequest {
219
216
  */
220
217
  chargeLimit?: string | null;
221
218
  }
222
- interface ChargeLimitUpdatedResponse {
219
+ export interface ChargeLimitUpdatedResponse {
223
220
  }
224
- interface CustomChargesConfig {
221
+ export interface CustomChargesConfig {
225
222
  /**
226
223
  * Base part of your integration's deployment URI for the Custom Charges SPI.
227
224
  * For example `"https://provider.example.com"`, if Wix should call your
@@ -230,7 +227,7 @@ interface CustomChargesConfig {
230
227
  */
231
228
  baseUri?: SpiBaseUri;
232
229
  }
233
- interface SpiBaseUri {
230
+ export interface SpiBaseUri {
234
231
  /**
235
232
  * Base URI where the methods are called. Wix appends the path to the `baseUri`.
236
233
  * 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/`.
@@ -241,7 +238,7 @@ interface SpiBaseUri {
241
238
  /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
242
239
  alternativeUris?: AlternativeUri[];
243
240
  }
244
- interface AlternativeUri {
241
+ export interface AlternativeUri {
245
242
  /**
246
243
  * Name of the method to create a custom URI for.
247
244
  *
@@ -272,7 +269,7 @@ interface AlternativeUri {
272
269
  * }
273
270
  * ```
274
271
  */
275
- interface Context {
272
+ export interface Context {
276
273
  /** 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. */
277
274
  requestId?: string | null;
278
275
  /**
@@ -290,14 +287,14 @@ interface Context {
290
287
  */
291
288
  instanceId?: string | null;
292
289
  }
293
- declare enum IdentityType {
290
+ export declare enum IdentityType {
294
291
  UNKNOWN = "UNKNOWN",
295
292
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
296
293
  MEMBER = "MEMBER",
297
294
  WIX_USER = "WIX_USER",
298
295
  APP = "APP"
299
296
  }
300
- interface IdentificationData extends IdentificationDataIdOneOf {
297
+ export interface IdentificationData extends IdentificationDataIdOneOf {
301
298
  /**
302
299
  * ID of a site visitor that has not logged in to the site.
303
300
  * @format GUID
@@ -322,7 +319,7 @@ interface IdentificationData extends IdentificationDataIdOneOf {
322
319
  identityType?: IdentityType;
323
320
  }
324
321
  /** @oneof */
325
- interface IdentificationDataIdOneOf {
322
+ export interface IdentificationDataIdOneOf {
326
323
  /**
327
324
  * ID of a site visitor that has not logged in to the site.
328
325
  * @format GUID
@@ -344,85 +341,3 @@ interface IdentificationDataIdOneOf {
344
341
  */
345
342
  appId?: string;
346
343
  }
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 };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IdentityType = exports.ChargesRejectedReason = exports.Intent = void 0;
4
+ var Intent;
5
+ (function (Intent) {
6
+ /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
7
+ Intent["DISPLAY_ONLY"] = "DISPLAY_ONLY";
8
+ /** Create an invoice for the customer. */
9
+ Intent["CREATE_INVOICE"] = "CREATE_INVOICE";
10
+ })(Intent || (exports.Intent = Intent = {}));
11
+ var ChargesRejectedReason;
12
+ (function (ChargesRejectedReason) {
13
+ /** There is no information about why Wix has rejected the charges. */
14
+ ChargesRejectedReason["UNKNOWN"] = "UNKNOWN";
15
+ /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
16
+ ChargesRejectedReason["CHARGE_LIMIT_EXCEEDED"] = "CHARGE_LIMIT_EXCEEDED";
17
+ /** You can't provide more than 5 charges per invoice. */
18
+ ChargesRejectedReason["TOO_MANY_CHARGES"] = "TOO_MANY_CHARGES";
19
+ /** 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. */
20
+ ChargesRejectedReason["INVALID_FORMAT"] = "INVALID_FORMAT";
21
+ })(ChargesRejectedReason || (exports.ChargesRejectedReason = ChargesRejectedReason = {}));
22
+ var IdentityType;
23
+ (function (IdentityType) {
24
+ IdentityType["UNKNOWN"] = "UNKNOWN";
25
+ IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
26
+ IdentityType["MEMBER"] = "MEMBER";
27
+ IdentityType["WIX_USER"] = "WIX_USER";
28
+ IdentityType["APP"] = "APP";
29
+ })(IdentityType || (exports.IdentityType = IdentityType = {}));
30
+ //# sourceMappingURL=service-plugins-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plugins-types.js","sourceRoot":"","sources":["../../../src/service-plugins-types.ts"],"names":[],"mappings":";;;AA8DA,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,kHAAkH;IAClH,uCAA6B,CAAA;IAC7B,0CAA0C;IAC1C,2CAAiC,CAAA;AACnC,CAAC,EALW,MAAM,sBAAN,MAAM,QAKjB;AA6ED,IAAY,qBASX;AATD,WAAY,qBAAqB;IAC/B,sEAAsE;IACtE,4CAAmB,CAAA;IACnB,0GAA0G;IAC1G,wEAA+C,CAAA;IAC/C,yDAAyD;IACzD,8DAAqC,CAAA;IACrC,6PAA6P;IAC7P,0DAAiC,CAAA;AACnC,CAAC,EATW,qBAAqB,qCAArB,qBAAqB,QAShC;AAuJD,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,uDAAuC,CAAA;IACvC,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,2BAAW,CAAA;AACb,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB"}
@@ -0,0 +1,2 @@
1
+ export * from './src/service-plugins-types.js';
2
+ export * from './src/interfaces-premium-v1-custom-charges-provider.context.js';
@@ -0,0 +1,3 @@
1
+ export * from './src/service-plugins-types.js';
2
+ export * from './src/interfaces-premium-v1-custom-charges-provider.context.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gEAAgE,CAAC"}