@wix/stores 1.0.26 → 1.0.28

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 (39) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +2 -1
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/src/stores-catalog-v1-product-products.universal.d.ts +3 -0
  5. package/build/cjs/src/stores-catalog-v1-product-products.universal.js.map +1 -1
  6. package/build/cjs/src/stores-catalog-v1-product.types.d.ts +3 -0
  7. package/build/cjs/src/stores-catalog-v1-product.types.js.map +1 -1
  8. package/build/cjs/src/stores-v1-subscription-option.http.d.ts +49 -0
  9. package/build/cjs/src/stores-v1-subscription-option.http.js +414 -0
  10. package/build/cjs/src/stores-v1-subscription-option.http.js.map +1 -0
  11. package/build/cjs/src/stores-v1-subscription-option.public.d.ts +16 -0
  12. package/build/cjs/src/stores-v1-subscription-option.public.js +80 -0
  13. package/build/cjs/src/stores-v1-subscription-option.public.js.map +1 -0
  14. package/build/cjs/src/stores-v1-subscription-option.types.d.ts +296 -0
  15. package/build/cjs/src/stores-v1-subscription-option.types.js +20 -0
  16. package/build/cjs/src/stores-v1-subscription-option.types.js.map +1 -0
  17. package/build/cjs/src/stores-v1-subscription-option.universal.d.ts +447 -0
  18. package/build/cjs/src/stores-v1-subscription-option.universal.js +738 -0
  19. package/build/cjs/src/stores-v1-subscription-option.universal.js.map +1 -0
  20. package/build/es/index.d.ts +1 -0
  21. package/build/es/index.js +1 -0
  22. package/build/es/index.js.map +1 -1
  23. package/build/es/src/stores-catalog-v1-product-products.universal.d.ts +3 -0
  24. package/build/es/src/stores-catalog-v1-product-products.universal.js.map +1 -1
  25. package/build/es/src/stores-catalog-v1-product.types.d.ts +3 -0
  26. package/build/es/src/stores-catalog-v1-product.types.js.map +1 -1
  27. package/build/es/src/stores-v1-subscription-option.http.d.ts +49 -0
  28. package/build/es/src/stores-v1-subscription-option.http.js +399 -0
  29. package/build/es/src/stores-v1-subscription-option.http.js.map +1 -0
  30. package/build/es/src/stores-v1-subscription-option.public.d.ts +16 -0
  31. package/build/es/src/stores-v1-subscription-option.public.js +63 -0
  32. package/build/es/src/stores-v1-subscription-option.public.js.map +1 -0
  33. package/build/es/src/stores-v1-subscription-option.types.d.ts +296 -0
  34. package/build/es/src/stores-v1-subscription-option.types.js +17 -0
  35. package/build/es/src/stores-v1-subscription-option.types.js.map +1 -0
  36. package/build/es/src/stores-v1-subscription-option.universal.d.ts +447 -0
  37. package/build/es/src/stores-v1-subscription-option.universal.js +704 -0
  38. package/build/es/src/stores-v1-subscription-option.universal.js.map +1 -0
  39. package/package.json +2 -2
@@ -0,0 +1,447 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ export interface SubscriptionOption {
8
+ /** Subscription option ID (auto-generated upon subscription option creation). */
9
+ _id?: string | null;
10
+ /** Subscription option title. */
11
+ title?: string | null;
12
+ /** Subscription option description (optional). */
13
+ description?: string | null;
14
+ /** Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months. */
15
+ subscriptionSettings?: SubscriptionSettings;
16
+ /**
17
+ * Discount info (optional).
18
+ * For example, a $20 discount would be `value: 20`, `type: AMOUNT`.
19
+ */
20
+ discount?: Discount;
21
+ }
22
+ export interface SubscriptionSettings {
23
+ /** Frequency of recurring payment. */
24
+ frequency?: SubscriptionFrequency;
25
+ /** Whether subscription is renewed automatically at the end of each period. */
26
+ autoRenewal?: boolean;
27
+ /** Number of billing cycles before subscription ends. Ignored if `autoRenewal: true`. */
28
+ billingCycles?: number | null;
29
+ }
30
+ /** Frequency unit of recurring payment */
31
+ export declare enum SubscriptionFrequency {
32
+ UNDEFINED = "UNDEFINED",
33
+ DAY = "DAY",
34
+ WEEK = "WEEK",
35
+ MONTH = "MONTH",
36
+ YEAR = "YEAR"
37
+ }
38
+ export interface Discount {
39
+ /** Discount type. */
40
+ type?: DiscountType;
41
+ /** Discount value. */
42
+ value?: number;
43
+ }
44
+ export declare enum DiscountType {
45
+ UNDEFINED = "UNDEFINED",
46
+ /** No discount */
47
+ AMOUNT = "AMOUNT",
48
+ PERCENT = "PERCENT"
49
+ }
50
+ export interface SubscriptionOptionCreated {
51
+ /** Newly created subscription option. */
52
+ subscriptionOption?: SubscriptionOption;
53
+ }
54
+ export interface SubscriptionOptionChanged {
55
+ /** Changed subscription option. */
56
+ subscriptionOption?: SubscriptionOption;
57
+ }
58
+ export interface SubscriptionOptionDeleted {
59
+ /** Deleted subscription option's ID. */
60
+ _id?: string;
61
+ }
62
+ export interface SubscriptionOptionsAssignmentChangedForProduct {
63
+ /** Product ID. */
64
+ productId?: string;
65
+ /** Subscription options assigned to the product. */
66
+ assignedSubscriptionOptions?: SubscriptionOptionWithVisibility[];
67
+ }
68
+ export interface SubscriptionOptionWithVisibility {
69
+ /** Subscription option ID. */
70
+ _id?: string;
71
+ /** Whether the subscription option is hidden for the product (the default is false). */
72
+ hidden?: boolean;
73
+ }
74
+ export interface OneTimePurchasesChanged {
75
+ /** Product ID. */
76
+ productId?: string;
77
+ /** Whether the product is available for one-time purchase. */
78
+ allowed?: boolean;
79
+ }
80
+ export interface CreateSubscriptionOptionRequest {
81
+ /** Subscription option info. */
82
+ subscriptionOption: SubscriptionOption;
83
+ }
84
+ export interface CreateSubscriptionOptionResponse {
85
+ /** Newly created subscription option. */
86
+ subscriptionOption?: SubscriptionOption;
87
+ }
88
+ export interface UpdateSubscriptionOptionRequest {
89
+ /** Subscription option info. Only the passed parameters will be updated. */
90
+ subscriptionOption: SubscriptionOption;
91
+ }
92
+ export interface UpdateSubscriptionOptionResponse {
93
+ /** Updated subscription option. */
94
+ subscriptionOption?: SubscriptionOption;
95
+ }
96
+ export interface DeleteSubscriptionOptionRequest {
97
+ /** ID of the subscription option to delete. */
98
+ _id: string;
99
+ }
100
+ export interface DeleteSubscriptionOptionResponse {
101
+ }
102
+ export interface BulkCreateSubscriptionOptionsRequest {
103
+ /** Subscription options info. */
104
+ subscriptionOptions: SubscriptionOption[];
105
+ }
106
+ export interface BulkCreateSubscriptionOptionsResponse {
107
+ /** Newly created subscription options. */
108
+ subscriptionOptions?: SubscriptionOption[];
109
+ }
110
+ export interface BulkUpdateSubscriptionOptionsRequest {
111
+ /** Subscription options info. Only the passed parameters in each subscription option will be updated. */
112
+ subscriptionOptions: SubscriptionOption[];
113
+ }
114
+ export interface BulkUpdateSubscriptionOptionsResponse {
115
+ /** Updated subscription options. */
116
+ subscriptionOptions?: SubscriptionOption[];
117
+ }
118
+ export interface BulkDeleteSubscriptionOptionsRequest {
119
+ /** IDs of the subscription options to delete. */
120
+ ids: string[];
121
+ }
122
+ export interface BulkDeleteSubscriptionOptionsResponse {
123
+ }
124
+ export interface AssignSubscriptionOptionsToProductRequest {
125
+ /** Product ID. */
126
+ productId: string;
127
+ /** Ordered array of subscription options that will be assigned to the product. Pass an empty array to remove all subscription options from the product. */
128
+ assignedSubscriptionOptions?: SubscriptionOptionInProduct[];
129
+ }
130
+ export interface SubscriptionOptionInProduct {
131
+ /** Subscription option ID. */
132
+ _id?: string;
133
+ /** Whether the subscription option is hidden for the product (the default is false). */
134
+ hidden?: boolean;
135
+ /**
136
+ * Subscription option title.
137
+ * @readonly
138
+ */
139
+ title?: string | null;
140
+ /**
141
+ * Subscription option description (optional).
142
+ * @readonly
143
+ */
144
+ description?: string | null;
145
+ /**
146
+ * Subscription payment settings. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months.
147
+ * @readonly
148
+ */
149
+ subscriptionSettings?: SubscriptionSettings;
150
+ /**
151
+ * Discount info (optional).
152
+ * @readonly
153
+ */
154
+ discount?: Discount;
155
+ }
156
+ export interface AssignSubscriptionOptionsToProductResponse {
157
+ }
158
+ export interface AllowOneTimePurchasesRequest {
159
+ /** Product ID. */
160
+ productId: string;
161
+ /** Pass `true` to offer product by subscription and as one-time purchase. Pass `false` to offer product as subscription only. */
162
+ allowed: boolean | null;
163
+ }
164
+ export interface AllowOneTimePurchasesResponse {
165
+ }
166
+ export interface GetSubscriptionOptionRequest {
167
+ /** Subscription option ID. */
168
+ _id: string;
169
+ }
170
+ export interface GetSubscriptionOptionResponse {
171
+ /** Subscription option. */
172
+ subscriptionOption?: SubscriptionOption;
173
+ }
174
+ export interface GetSubscriptionOptionsForProductRequest {
175
+ /** Product ID. */
176
+ productId: string;
177
+ /** Whether to include hidden subscription options in the results. */
178
+ includeHiddenSubscriptionOptions?: boolean;
179
+ }
180
+ export interface GetSubscriptionOptionsForProductResponse {
181
+ /** Subscription options. */
182
+ subscriptionOptions?: SubscriptionOptionInProduct[];
183
+ }
184
+ export interface ListSubscriptionOptionsRequest {
185
+ /** Subscription option IDs. */
186
+ ids?: string[];
187
+ }
188
+ export interface ListSubscriptionOptionsResponse {
189
+ /** Subscription options. */
190
+ subscriptionOptions?: SubscriptionOption[];
191
+ }
192
+ export interface CalculatePricesRequest {
193
+ /** original price to which subscription options discount will be applied */
194
+ price?: number;
195
+ /** ids of subscription options which will be applied to original price */
196
+ ids?: string[];
197
+ }
198
+ export interface CalculatePricesResponse {
199
+ /** array of calculated prices */
200
+ prices?: SubscriptionOptionPrices[];
201
+ /** price to which subscription options discount applied */
202
+ originalPrice?: number;
203
+ }
204
+ export interface SubscriptionOptionPrices {
205
+ /** Subscription option id */
206
+ _id?: string;
207
+ /** Price data calculated for subscription option */
208
+ priceData?: SubscriptionOptionPriceData;
209
+ /** Price data calculated for subscription option, converted to the currency requested in request header */
210
+ convertedPriceData?: SubscriptionOptionPriceData;
211
+ }
212
+ export interface SubscriptionOptionPriceData {
213
+ /** Subscription option price currency */
214
+ currency?: string;
215
+ /** Price calculated after subscription option discount applied */
216
+ discountedPrice?: number;
217
+ /** Price calculated after subscription option discount applied, formatted with the currency */
218
+ formattedDiscountedPrice?: string;
219
+ }
220
+ export interface BulkCalculatePricesRequest {
221
+ /**
222
+ * Original prices to which subscription options discount will be applied.
223
+ * Key is identifier unique per price that can be used to match calculated prices with original price
224
+ */
225
+ prices?: Record<string, number>;
226
+ /** ids of subscription options which will be applied to original price */
227
+ ids?: string[];
228
+ }
229
+ export interface BulkCalculatePricesResponse {
230
+ /**
231
+ * Key is identifier unique per price that can be used to match calculated prices with original price
232
+ * Value is response with calculated prices for each subscription option
233
+ */
234
+ calculatedPrices?: Record<string, CalculatePricesResponse>;
235
+ }
236
+ export interface BulkCalculatePricesRequestV2 {
237
+ /** Original prices to be calculated for each corresponding product id with related subscription plan ids */
238
+ items?: BulkCalculatePricesRequestItem[];
239
+ }
240
+ export interface BulkCalculatePricesRequestItem {
241
+ /** Calculation id (product id) */
242
+ _id?: string;
243
+ /**
244
+ * Original prices to which subscription options discount will be applied.
245
+ * Key is identifier unique per price that can be used to match calculated prices with original price
246
+ */
247
+ prices?: Record<string, number>;
248
+ /** ids of subscription options which will be applied to original price. */
249
+ subscriptionOptionIds?: string[];
250
+ }
251
+ export interface BulkCalculatePricesResponseV2 {
252
+ /**
253
+ * Key is identifier unique per price that can be used to match calculated prices with original price
254
+ * Value is response with calculated prices for each subscription option for each product
255
+ */
256
+ calculatedPricesPerProduct?: BulkCalculatePricesResponseItem[];
257
+ }
258
+ export interface BulkCalculatePricesResponseItem {
259
+ /** Calculation id (product id) */
260
+ _id?: string;
261
+ /**
262
+ * Key is identifier unique per price that can be used to match calculated prices with original price
263
+ * Value is response with calculated prices for each subscription option
264
+ */
265
+ calculatedPrices?: Record<string, CalculatePricesResponse>;
266
+ }
267
+ export interface GetProductIdsForSubscriptionOptionRequest {
268
+ /** Subscription option ID. */
269
+ _id: string;
270
+ /** Whether to include hidden products in the returned results. */
271
+ includeHiddenProducts?: boolean;
272
+ /** Optional pagination parameters */
273
+ paging?: Paging;
274
+ }
275
+ export interface Paging {
276
+ /** Amount of items to load per page. */
277
+ limit?: number | null;
278
+ /** Number of items to skip in the display (relevant for all pages after the first). */
279
+ offset?: number | null;
280
+ }
281
+ export interface GetProductIdsForSubscriptionOptionResponse {
282
+ /** IDs of products associated with the specified subscription option. */
283
+ productIds?: string[];
284
+ /** Paging metadata. */
285
+ metadata?: PagingMetadata;
286
+ /** Number of total results. */
287
+ totalResults?: number;
288
+ }
289
+ export interface PagingMetadata {
290
+ /** Amount of items to load per page. */
291
+ items?: number;
292
+ /** Number of items to skip in the display (relevant for all pages after the first). */
293
+ offset?: number;
294
+ }
295
+ export interface GetOneTimePurchasesStatusRequest {
296
+ /** Product ID. */
297
+ productId: string;
298
+ }
299
+ export interface GetOneTimePurchasesStatusResponse {
300
+ /** Whether the specified product is available for one-time purchase */
301
+ allowed?: boolean;
302
+ }
303
+ /**
304
+ * Creates a subscription option.
305
+ * To assign to a product, call [Assign Subscription Options to Product](https://dev.wix.com/api/rest/wix-stores/subscription-options/assign-subscription-options-to-product).
306
+ * Subscription options that are not assigned to a product will not be visible in the Wix business manager.
307
+ * @param subscriptionOption - Subscription option info.
308
+ * @public
309
+ * @documentationMaturity preview
310
+ * @requiredField subscriptionOption
311
+ * @requiredField subscriptionOption.subscriptionSettings
312
+ * @requiredField subscriptionOption.title
313
+ * @returns Newly created subscription option.
314
+ */
315
+ export declare function createSubscriptionOption(subscriptionOption: SubscriptionOption): Promise<SubscriptionOption>;
316
+ /**
317
+ * Updates a subscription option.
318
+ * Only parameters passed will be updated.
319
+ * @param _id - Subscription option ID (auto-generated upon subscription option creation).
320
+ * @public
321
+ * @documentationMaturity preview
322
+ * @requiredField _id
323
+ * @requiredField subscriptionOption
324
+ * @returns Updated subscription option.
325
+ */
326
+ export declare function updateSubscriptionOption(_id: string | null, subscriptionOption: UpdateSubscriptionOption): Promise<SubscriptionOption>;
327
+ export interface UpdateSubscriptionOption {
328
+ /** Subscription option ID (auto-generated upon subscription option creation). */
329
+ _id?: string | null;
330
+ /** Subscription option title. */
331
+ title?: string | null;
332
+ /** Subscription option description (optional). */
333
+ description?: string | null;
334
+ /** Subscription charge times. For example, if `frequency: MONTH` and `billingCycles: 6`; payment will be made monthly for 6 months. */
335
+ subscriptionSettings?: SubscriptionSettings;
336
+ /**
337
+ * Discount info (optional).
338
+ * For example, a $20 discount would be `value: 20`, `type: AMOUNT`.
339
+ */
340
+ discount?: Discount;
341
+ }
342
+ /**
343
+ * Deletes a subscription option.
344
+ * @param _id - ID of the subscription option to delete.
345
+ * @public
346
+ * @documentationMaturity preview
347
+ * @requiredField _id
348
+ */
349
+ export declare function deleteSubscriptionOption(_id: string): Promise<void>;
350
+ /**
351
+ * Creates multiple subscription options (up to 100).
352
+ * To assign to a product, call [Assign Subscription Options to Product](https://dev.wix.com/api/rest/wix-stores/subscription-options/assign-subscription-options-to-product).
353
+ * Subscription options that are not assigned to a product will not be visible in the Wix business manager.
354
+ * @param subscriptionOptions - Subscription options info.
355
+ * @public
356
+ * @documentationMaturity preview
357
+ * @requiredField subscriptionOptions
358
+ * @requiredField subscriptionOptions.subscriptionSettings
359
+ * @requiredField subscriptionOptions.title
360
+ */
361
+ export declare function bulkCreateSubscriptionOptions(subscriptionOptions: SubscriptionOption[]): Promise<BulkCreateSubscriptionOptionsResponse>;
362
+ /**
363
+ * Updates multiple subscription options.
364
+ * Only parameters passed will be updated.
365
+ * @param subscriptionOptions - Subscription options info. Only the passed parameters in each subscription option will be updated.
366
+ * @public
367
+ * @documentationMaturity preview
368
+ * @requiredField subscriptionOptions
369
+ * @requiredField subscriptionOptions._id
370
+ */
371
+ export declare function bulkUpdateSubscriptionOptions(subscriptionOptions: SubscriptionOption[]): Promise<BulkUpdateSubscriptionOptionsResponse>;
372
+ /**
373
+ * Deletes multiple subscription options.
374
+ * @param ids - IDs of the subscription options to delete.
375
+ * @public
376
+ * @documentationMaturity preview
377
+ * @requiredField ids
378
+ */
379
+ export declare function bulkDeleteSubscriptionOptions(ids: string[]): Promise<void>;
380
+ /**
381
+ * Assign up to 6 subscription options to a specified product.
382
+ * Pass an empty array to remove all subscription options assigned to a product.
383
+ * @param productId - Product ID.
384
+ * @public
385
+ * @documentationMaturity preview
386
+ * @requiredField productId
387
+ */
388
+ export declare function assignSubscriptionOptionsToProduct(productId: string, options?: AssignSubscriptionOptionsToProductOptions): Promise<void>;
389
+ export interface AssignSubscriptionOptionsToProductOptions {
390
+ /** Ordered array of subscription options that will be assigned to the product. Pass an empty array to remove all subscription options from the product. */
391
+ assignedSubscriptionOptions?: SubscriptionOptionInProduct[];
392
+ }
393
+ /**
394
+ * Allow for one-time purchase of a product.
395
+ * By default, product can be sold only as part of a subscription, not as a one-time purchase.
396
+ * @param productId - Product ID.
397
+ * @param allowed - Pass `true` to offer product by subscription and as one-time purchase. Pass `false` to offer product as subscription only.
398
+ * @public
399
+ * @documentationMaturity preview
400
+ * @requiredField allowed
401
+ * @requiredField productId
402
+ */
403
+ export declare function allowOneTimePurchases(productId: string, allowed: boolean | null): Promise<void>;
404
+ /**
405
+ * Retrieves a subscription option by ID.
406
+ * @param _id - Subscription option ID.
407
+ * @public
408
+ * @documentationMaturity preview
409
+ * @requiredField _id
410
+ * @returns Subscription option.
411
+ */
412
+ export declare function getSubscriptionOption(_id: string): Promise<SubscriptionOption>;
413
+ /**
414
+ * Retrieves all subscription options assigned to a specified product.
415
+ * By default, hidden subscription options are not returned. To retrieve all subscription options you must pass `includeHiddenSubscriptionOptions = true`.
416
+ * @param productId - Product ID.
417
+ * @public
418
+ * @documentationMaturity preview
419
+ * @requiredField productId
420
+ */
421
+ export declare function getSubscriptionOptionsForProduct(productId: string, options?: GetSubscriptionOptionsForProductOptions): Promise<GetSubscriptionOptionsForProductResponse>;
422
+ export interface GetSubscriptionOptionsForProductOptions {
423
+ /** Whether to include hidden subscription options in the results. */
424
+ includeHiddenSubscriptionOptions?: boolean;
425
+ }
426
+ /**
427
+ * Retrieves the IDs of products associated with a specified subscription option.
428
+ * @param _id - Subscription option ID.
429
+ * @public
430
+ * @documentationMaturity preview
431
+ * @requiredField _id
432
+ */
433
+ export declare function getProductIdsForSubscriptionOption(_id: string, options?: GetProductIdsForSubscriptionOptionOptions): Promise<GetProductIdsForSubscriptionOptionResponse>;
434
+ export interface GetProductIdsForSubscriptionOptionOptions {
435
+ /** Whether to include hidden products in the returned results. */
436
+ includeHiddenProducts?: boolean;
437
+ /** Optional pagination parameters */
438
+ paging?: Paging;
439
+ }
440
+ /**
441
+ * Checks whether a specified product (associated with subscription options) is available for one-time purchase.
442
+ * @param productId - Product ID.
443
+ * @public
444
+ * @documentationMaturity preview
445
+ * @requiredField productId
446
+ */
447
+ export declare function getOneTimePurchasesStatus(productId: string): Promise<GetOneTimePurchasesStatusResponse>;