@wix/pricing-plans 1.0.0

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 (55) hide show
  1. package/build/cjs/index.d.ts +2 -0
  2. package/build/cjs/index.js +25 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/pricing-plans-v2-order.http.d.ts +105 -0
  5. package/build/cjs/src/pricing-plans-v2-order.http.js +751 -0
  6. package/build/cjs/src/pricing-plans-v2-order.http.js.map +1 -0
  7. package/build/cjs/src/pricing-plans-v2-order.public.d.ts +17 -0
  8. package/build/cjs/src/pricing-plans-v2-order.public.js +95 -0
  9. package/build/cjs/src/pricing-plans-v2-order.public.js.map +1 -0
  10. package/build/cjs/src/pricing-plans-v2-order.types.d.ts +1071 -0
  11. package/build/cjs/src/pricing-plans-v2-order.types.js +133 -0
  12. package/build/cjs/src/pricing-plans-v2-order.types.js.map +1 -0
  13. package/build/cjs/src/pricing-plans-v2-order.universal.d.ts +1346 -0
  14. package/build/cjs/src/pricing-plans-v2-order.universal.js +962 -0
  15. package/build/cjs/src/pricing-plans-v2-order.universal.js.map +1 -0
  16. package/build/cjs/src/pricing-plans-v2-plan.http.d.ts +44 -0
  17. package/build/cjs/src/pricing-plans-v2-plan.http.js +453 -0
  18. package/build/cjs/src/pricing-plans-v2-plan.http.js.map +1 -0
  19. package/build/cjs/src/pricing-plans-v2-plan.public.d.ts +16 -0
  20. package/build/cjs/src/pricing-plans-v2-plan.public.js +82 -0
  21. package/build/cjs/src/pricing-plans-v2-plan.public.js.map +1 -0
  22. package/build/cjs/src/pricing-plans-v2-plan.types.d.ts +357 -0
  23. package/build/cjs/src/pricing-plans-v2-plan.types.js +35 -0
  24. package/build/cjs/src/pricing-plans-v2-plan.types.js.map +1 -0
  25. package/build/cjs/src/pricing-plans-v2-plan.universal.d.ts +554 -0
  26. package/build/cjs/src/pricing-plans-v2-plan.universal.js +728 -0
  27. package/build/cjs/src/pricing-plans-v2-plan.universal.js.map +1 -0
  28. package/build/es/index.d.ts +2 -0
  29. package/build/es/index.js +3 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/src/pricing-plans-v2-order.http.d.ts +105 -0
  32. package/build/es/src/pricing-plans-v2-order.http.js +735 -0
  33. package/build/es/src/pricing-plans-v2-order.http.js.map +1 -0
  34. package/build/es/src/pricing-plans-v2-order.public.d.ts +17 -0
  35. package/build/es/src/pricing-plans-v2-order.public.js +68 -0
  36. package/build/es/src/pricing-plans-v2-order.public.js.map +1 -0
  37. package/build/es/src/pricing-plans-v2-order.types.d.ts +1071 -0
  38. package/build/es/src/pricing-plans-v2-order.types.js +130 -0
  39. package/build/es/src/pricing-plans-v2-order.types.js.map +1 -0
  40. package/build/es/src/pricing-plans-v2-order.universal.d.ts +1346 -0
  41. package/build/es/src/pricing-plans-v2-order.universal.js +927 -0
  42. package/build/es/src/pricing-plans-v2-order.universal.js.map +1 -0
  43. package/build/es/src/pricing-plans-v2-plan.http.d.ts +44 -0
  44. package/build/es/src/pricing-plans-v2-plan.http.js +438 -0
  45. package/build/es/src/pricing-plans-v2-plan.http.js.map +1 -0
  46. package/build/es/src/pricing-plans-v2-plan.public.d.ts +16 -0
  47. package/build/es/src/pricing-plans-v2-plan.public.js +63 -0
  48. package/build/es/src/pricing-plans-v2-plan.public.js.map +1 -0
  49. package/build/es/src/pricing-plans-v2-plan.types.d.ts +357 -0
  50. package/build/es/src/pricing-plans-v2-plan.types.js +32 -0
  51. package/build/es/src/pricing-plans-v2-plan.types.js.map +1 -0
  52. package/build/es/src/pricing-plans-v2-plan.universal.d.ts +554 -0
  53. package/build/es/src/pricing-plans-v2-plan.universal.js +694 -0
  54. package/build/es/src/pricing-plans-v2-plan.universal.js.map +1 -0
  55. package/package.json +37 -0
@@ -0,0 +1,357 @@
1
+ /** Information about the pricing plan. */
2
+ export interface Plan {
3
+ /**
4
+ * Plan ID.
5
+ * @readonly
6
+ */
7
+ id?: string;
8
+ /** Plan name. */
9
+ name?: string | null;
10
+ /** Plan description. */
11
+ description?: string | null;
12
+ /** What is included with this plan (e.g., 1 weekly entrance to a specific class). */
13
+ perks?: StringList;
14
+ /** Plan price, payment schedule, and expiration. */
15
+ pricing?: Pricing;
16
+ /** Whether the plan is public (visible to site visitors and members). */
17
+ public?: boolean | null;
18
+ /**
19
+ * Whether the plan is archived. Archived plans are not visible and can't be purchased anymore, but existing purchases remain in effect.
20
+ * @readonly
21
+ */
22
+ archived?: boolean;
23
+ /**
24
+ * Whether the plan is marked as primary.
25
+ * @readonly
26
+ */
27
+ primary?: boolean;
28
+ /**
29
+ * Whether the plan has any orders (including pending and unpaid orders).
30
+ * @readonly
31
+ */
32
+ hasOrders?: boolean;
33
+ /**
34
+ * Date plan was created.
35
+ * @readonly
36
+ */
37
+ createdDate?: Date;
38
+ /**
39
+ * Date plan was last updated.
40
+ * @readonly
41
+ */
42
+ updatedDate?: Date;
43
+ /**
44
+ * URL-friendly version of plan name. Unique across all plans in the same site.
45
+ * @readonly
46
+ */
47
+ slug?: string | null;
48
+ /**
49
+ * Number of times the same buyer can purchase the plan. Currently limited to support:
50
+ * - Empty value or a value of `0`, meaning no limitation.
51
+ * - Value of `1`, meaning limited to one purchase per buyer.
52
+ */
53
+ maxPurchasesPerBuyer?: number | null;
54
+ /** Whether the buyer can start the plan at a later date. Defaults to false. */
55
+ allowFutureStartDate?: boolean | null;
56
+ /** Whether the buyer is allowed to cancel their plan. Defaults to false. */
57
+ buyerCanCancel?: boolean | null;
58
+ /** Any terms and conditions that apply to the plan. This information will be displayed during checkout. */
59
+ termsAndConditions?: string | null;
60
+ clientData?: Record<string, string>;
61
+ /** Reference to a form which is shown in checkout to gather additional data */
62
+ formId?: string | null;
63
+ }
64
+ /** This wrapper type exist in order to distinguish an empty string list from no list at all in update requests. */
65
+ export interface StringList {
66
+ /** List of strings */
67
+ values?: string[];
68
+ }
69
+ /** Plan pricing information. Includes the price of the plan and payment details. */
70
+ export interface Pricing extends PricingPricingModelOneOf {
71
+ /** Amount for a single payment (or the whole subscription if it's not a recurring plan) */
72
+ price?: Money;
73
+ /** Free trial period for the plan in days. It’s available only for recurring plans. Set to 0 to remove free trial. */
74
+ freeTrialDays?: number | null;
75
+ /** Plan has recurring payments. */
76
+ subscription?: Recurrence;
77
+ /** One time payment, plan is valid for the specified duration. */
78
+ singlePaymentForDuration?: Duration;
79
+ /** One time payment, plan is valid until it is canceled. */
80
+ singlePaymentUnlimited?: boolean | null;
81
+ }
82
+ /** @oneof */
83
+ export interface PricingPricingModelOneOf {
84
+ /** Plan has recurring payments. */
85
+ subscription?: Recurrence;
86
+ /** One time payment, plan is valid for the specified duration. */
87
+ singlePaymentForDuration?: Duration;
88
+ /** One time payment, plan is valid until it is canceled. */
89
+ singlePaymentUnlimited?: boolean | null;
90
+ }
91
+ /** An object specifying how often and for how long payments recur (may be forever). */
92
+ export interface Recurrence {
93
+ /** Length of one payment cycle. */
94
+ cycleDuration?: Duration;
95
+ /**
96
+ * Amount of payment cycles this subscription is valid for.
97
+ *
98
+ * `0` for unlimited or until-canceled.
99
+ */
100
+ cycleCount?: number | null;
101
+ }
102
+ /** A duration expressed in number of time units. */
103
+ export interface Duration {
104
+ /**
105
+ * The amount of a duration `unit` in a single payment cycle.
106
+ *
107
+ * Currently limited to support only `1`.
108
+ */
109
+ count?: number | null;
110
+ /** Unit of time for the cycle duration. */
111
+ unit?: PeriodUnit;
112
+ }
113
+ export declare enum PeriodUnit {
114
+ UNDEFINED = "UNDEFINED",
115
+ DAY = "DAY",
116
+ WEEK = "WEEK",
117
+ MONTH = "MONTH",
118
+ YEAR = "YEAR"
119
+ }
120
+ export interface Money {
121
+ /** Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). */
122
+ value?: string;
123
+ /** Currency code. Must be valid ISO 4217 currency code (e.g., USD). */
124
+ currency?: string;
125
+ }
126
+ export interface BuyerCanCancelUpdated {
127
+ plan?: Plan;
128
+ }
129
+ export interface ListPublicPlansRequest {
130
+ /** Number of items to list. Defaults to 75. See [Pagination](https://dev.wix.com/api/rest/getting-started/pagination). */
131
+ limit?: number | null;
132
+ /** Number of items to skip. Defaults to 0. See [Pagination](https://dev.wix.com/api/rest/getting-started/pagination). */
133
+ offset?: number | null;
134
+ /** IDs of plans to list. Non-existent IDs will be ignored and won't cause errors. You can pass a maximum of 100 IDs. */
135
+ planIds?: string[];
136
+ }
137
+ export interface ListPublicPlansResponse {
138
+ /** List of public pricing plans. */
139
+ plans?: PublicPlan[];
140
+ /** Object containing paging-related data (number of plans returned, offset). */
141
+ pagingMetadata?: PagingMetadataV2;
142
+ }
143
+ /** Public plan entity containing information about the pricing plan. Can be read by any site member or visitor. */
144
+ export interface PublicPlan {
145
+ /** Plan ID. */
146
+ id?: string;
147
+ /** Plan name. */
148
+ name?: string | null;
149
+ /** Plan description. */
150
+ description?: string | null;
151
+ /** What is included with this plan (e.g., 1 weekly entrance to a specific class). */
152
+ perks?: StringList;
153
+ /** Plan price, payment schedule, and expiration. */
154
+ pricing?: Pricing;
155
+ /** Whether the plan is marked as primary. */
156
+ primary?: boolean;
157
+ /** Date plan was created. */
158
+ createdDate?: Date;
159
+ /** Date plan was last updated. */
160
+ updatedDate?: Date;
161
+ /** URL-friendly version of plan name. Unique across all plans in the same site. */
162
+ slug?: string | null;
163
+ /** Number of times the same buyer can purchase the plan. An empty value or a value of zero means no limitation. */
164
+ maxPurchasesPerBuyer?: number | null;
165
+ /** Whether the buyer can start the plan at a later date. Defaults to false. */
166
+ allowFutureStartDate?: boolean | null;
167
+ /** Whether the buyer is allowed to cancel their plan. Defaults to false. */
168
+ buyerCanCancel?: boolean | null;
169
+ /** Any terms and conditions that apply to the plan. This information will be displayed during checkout. */
170
+ termsAndConditions?: string | null;
171
+ clientData?: Record<string, string>;
172
+ /** Reference to a form which is shown in checkout to gather additional data */
173
+ formId?: string | null;
174
+ }
175
+ export interface PagingMetadataV2 {
176
+ /** Number of items returned in the response. */
177
+ count?: number | null;
178
+ /** Offset that was requested. */
179
+ offset?: number | null;
180
+ /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
181
+ total?: number | null;
182
+ /** Flag that indicates the server failed to calculate the `total` field. */
183
+ tooManyToCount?: boolean | null;
184
+ /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
185
+ cursors?: Cursors;
186
+ }
187
+ export interface Cursors {
188
+ /** Cursor pointing to next page in the list of results. */
189
+ next?: string | null;
190
+ /** Cursor pointing to previous page in the list of results. */
191
+ prev?: string | null;
192
+ }
193
+ export interface QueryPublicPlansRequest {
194
+ query?: QueryV2;
195
+ }
196
+ export interface QueryV2 {
197
+ /** A filter object. See [supported fields and operators](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans/filter-and-sort#wix-pricing-plans_pricing-plans_plans_filter-and-sort_query-public-plans) */
198
+ filter?: Record<string, any> | null;
199
+ /** Sort object in the form [{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}] */
200
+ sort?: Sorting[];
201
+ /** Pointer to page of results using offset. Can not be used together with 'cursorPaging' */
202
+ paging?: Paging;
203
+ }
204
+ export interface Sorting {
205
+ /** Name of the field to sort by. */
206
+ fieldName?: string;
207
+ /** Sort order. */
208
+ order?: SortOrder;
209
+ }
210
+ export declare enum SortOrder {
211
+ ASC = "ASC",
212
+ DESC = "DESC"
213
+ }
214
+ export interface Paging {
215
+ /** Number of items to load. */
216
+ limit?: number | null;
217
+ /** Number of items to skip in the current sort order. */
218
+ offset?: number | null;
219
+ }
220
+ export interface QueryPublicPlansResponse {
221
+ /** List of public pricing plans that match the specified query. */
222
+ plans?: PublicPlan[];
223
+ /** Object containing paging-related data (number of plans returned, offset). */
224
+ pagingMetadata?: PagingMetadataV2;
225
+ }
226
+ export interface GetPlanRequest {
227
+ /** Plan ID. */
228
+ id: string;
229
+ }
230
+ export interface GetPlanResponse {
231
+ /** Pricing plan. */
232
+ plan?: Plan;
233
+ }
234
+ export interface ListPlansRequest {
235
+ /** Archived filter. Defaults to ACTIVE (not archived) only. */
236
+ archived?: ArchivedFilter;
237
+ /** Visibility filter. Defaults to PUBLIC_AND_HIDDEN (meaning, both are listed). */
238
+ public?: PublicFilter;
239
+ /** Number of pricing plans to list. Defaults to 75. */
240
+ limit?: number | null;
241
+ /** Number of pricing plans to skip. Defaults to 0. */
242
+ offset?: number | null;
243
+ /** Plan ID filter. Non-existent IDs are ignored, and won't cause errors. You can pass a maximum of 100 IDs. */
244
+ planIds?: string[];
245
+ }
246
+ export declare enum ArchivedFilter {
247
+ /** Returns all plans that are active. */
248
+ ACTIVE = "ACTIVE",
249
+ /** Returns all plans that are archived. */
250
+ ARCHIVED = "ARCHIVED",
251
+ /** Returns all plans that are active and archived. */
252
+ ARCHIVED_AND_ACTIVE = "ARCHIVED_AND_ACTIVE"
253
+ }
254
+ export declare enum PublicFilter {
255
+ /** Returns all public and hidden plans. */
256
+ PUBLIC_AND_HIDDEN = "PUBLIC_AND_HIDDEN",
257
+ /** Returns only public plans. */
258
+ PUBLIC = "PUBLIC",
259
+ /** Returns only hidden plans. */
260
+ HIDDEN = "HIDDEN"
261
+ }
262
+ export interface ListPlansResponse {
263
+ /** List of all public and hidden pricing plans. */
264
+ plans?: Plan[];
265
+ /** Object containing paging-related data (number of plans returned, offset). */
266
+ pagingMetadata?: PagingMetadataV2;
267
+ }
268
+ export interface GetPlanStatsRequest {
269
+ }
270
+ export interface GetPlanStatsResponse {
271
+ /** Total number of plans created, including active plans (both public and hidden) and archived plans. */
272
+ totalPlans?: number;
273
+ }
274
+ export interface CreatePlanRequest {
275
+ plan: Plan;
276
+ }
277
+ export interface CreatePlanResponse {
278
+ plan?: Plan;
279
+ }
280
+ export interface UpdatePlanRequest {
281
+ plan?: Plan;
282
+ fieldMask?: string[];
283
+ }
284
+ export interface UpdatePlanResponse {
285
+ plan?: Plan;
286
+ }
287
+ export interface SetPlanVisibilityRequest {
288
+ id: string;
289
+ visible?: boolean;
290
+ }
291
+ export interface SetPlanVisibilityResponse {
292
+ plan?: Plan;
293
+ }
294
+ export interface MakePlanPrimaryRequest {
295
+ id: string;
296
+ }
297
+ export interface MakePlanPrimaryResponse {
298
+ plan?: Plan;
299
+ }
300
+ export interface ClearPrimaryRequest {
301
+ }
302
+ export interface ClearPrimaryResponse {
303
+ }
304
+ export interface ArchivePlanRequest {
305
+ id: string;
306
+ }
307
+ export interface ArchivePlanResponse {
308
+ plan?: Plan;
309
+ }
310
+ export interface PlanArchived {
311
+ plan?: Plan;
312
+ }
313
+ export interface BulkArchivePlanRequest {
314
+ /** List of Plan IDs. */
315
+ ids?: string[];
316
+ /** Set to true to return Plan entity in response. */
317
+ returnFullEntity?: boolean;
318
+ }
319
+ export interface BulkArchivePlanResponse {
320
+ results?: BulkPlanResult[];
321
+ bulkActionMetadata?: BulkActionMetadata;
322
+ }
323
+ export interface BulkPlanResult {
324
+ itemMetadata?: ItemMetadata;
325
+ plan?: Plan;
326
+ }
327
+ export interface ItemMetadata {
328
+ /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */
329
+ id?: string | null;
330
+ /** Index of the item within the request array. Allows for correlation between request and response items. */
331
+ originalIndex?: number;
332
+ /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
333
+ success?: boolean;
334
+ /** Details about the error in case of failure. */
335
+ error?: ApplicationError;
336
+ }
337
+ export interface ApplicationError {
338
+ /** Error code. */
339
+ code?: string;
340
+ /** Description of the error. */
341
+ description?: string;
342
+ /** Data related to the error. */
343
+ data?: Record<string, any> | null;
344
+ }
345
+ export interface BulkActionMetadata {
346
+ /** Number of items that were successfully processed. */
347
+ totalSuccesses?: number;
348
+ /** Number of items that couldn't be processed. */
349
+ totalFailures?: number;
350
+ /** Number of failures without details because detailed failure threshold was exceeded. */
351
+ undetailedFailures?: number;
352
+ }
353
+ export interface ArrangePlansRequest {
354
+ ids?: string[];
355
+ }
356
+ export interface ArrangePlansResponse {
357
+ }
@@ -0,0 +1,32 @@
1
+ export var PeriodUnit;
2
+ (function (PeriodUnit) {
3
+ PeriodUnit["UNDEFINED"] = "UNDEFINED";
4
+ PeriodUnit["DAY"] = "DAY";
5
+ PeriodUnit["WEEK"] = "WEEK";
6
+ PeriodUnit["MONTH"] = "MONTH";
7
+ PeriodUnit["YEAR"] = "YEAR";
8
+ })(PeriodUnit || (PeriodUnit = {}));
9
+ export var SortOrder;
10
+ (function (SortOrder) {
11
+ SortOrder["ASC"] = "ASC";
12
+ SortOrder["DESC"] = "DESC";
13
+ })(SortOrder || (SortOrder = {}));
14
+ export var ArchivedFilter;
15
+ (function (ArchivedFilter) {
16
+ /** Returns all plans that are active. */
17
+ ArchivedFilter["ACTIVE"] = "ACTIVE";
18
+ /** Returns all plans that are archived. */
19
+ ArchivedFilter["ARCHIVED"] = "ARCHIVED";
20
+ /** Returns all plans that are active and archived. */
21
+ ArchivedFilter["ARCHIVED_AND_ACTIVE"] = "ARCHIVED_AND_ACTIVE";
22
+ })(ArchivedFilter || (ArchivedFilter = {}));
23
+ export var PublicFilter;
24
+ (function (PublicFilter) {
25
+ /** Returns all public and hidden plans. */
26
+ PublicFilter["PUBLIC_AND_HIDDEN"] = "PUBLIC_AND_HIDDEN";
27
+ /** Returns only public plans. */
28
+ PublicFilter["PUBLIC"] = "PUBLIC";
29
+ /** Returns only hidden plans. */
30
+ PublicFilter["HIDDEN"] = "HIDDEN";
31
+ })(PublicFilter || (PublicFilter = {}));
32
+ //# sourceMappingURL=pricing-plans-v2-plan.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing-plans-v2-plan.types.js","sourceRoot":"","sources":["../../../src/pricing-plans-v2-plan.types.ts"],"names":[],"mappings":"AAsHA,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,qCAAuB,CAAA;IACvB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,2BAAa,CAAA;AACf,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAsGD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAuCD,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,yCAAyC;IACzC,mCAAiB,CAAA;IACjB,2CAA2C;IAC3C,uCAAqB,CAAA;IACrB,sDAAsD;IACtD,6DAA2C,CAAA;AAC7C,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,2CAA2C;IAC3C,uDAAuC,CAAA;IACvC,iCAAiC;IACjC,iCAAiB,CAAA;IACjB,iCAAiC;IACjC,iCAAiB,CAAA;AACnB,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB"}