@wix/auto_sdk_ecom_discount-rules 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 (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.context.d.ts +25 -0
  11. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.context.js +36 -0
  12. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.context.js.map +1 -0
  13. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.http.d.ts +48 -0
  14. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.http.js +271 -0
  15. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.http.js.map +1 -0
  16. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.meta.d.ts +23 -0
  17. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.meta.js +123 -0
  18. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.meta.js.map +1 -0
  19. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.public.d.ts +80 -0
  20. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.public.js +98 -0
  21. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.public.js.map +1 -0
  22. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.types.d.ts +694 -0
  23. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.types.js +76 -0
  24. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.types.js.map +1 -0
  25. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.universal.d.ts +1053 -0
  26. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.universal.js +359 -0
  27. package/build/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.context.d.ts +25 -0
  39. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.context.js +25 -0
  40. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.context.js.map +1 -0
  41. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.http.d.ts +48 -0
  42. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.http.js +263 -0
  43. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.http.js.map +1 -0
  44. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.meta.d.ts +23 -0
  45. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.meta.js +92 -0
  46. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.meta.js.map +1 -0
  47. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.public.d.ts +80 -0
  48. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.public.js +82 -0
  49. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.public.js.map +1 -0
  50. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.types.d.ts +694 -0
  51. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.types.js +73 -0
  52. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.types.js.map +1 -0
  53. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.universal.d.ts +1053 -0
  54. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.universal.js +328 -0
  55. package/build/es/src/ecom-discounts-v1-discount-rule-discount-rules.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.context.d.ts +25 -0
  66. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.context.js +36 -0
  67. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.context.js.map +1 -0
  68. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.http.d.ts +48 -0
  69. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.http.js +271 -0
  70. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.http.js.map +1 -0
  71. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.meta.d.ts +23 -0
  72. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.meta.js +123 -0
  73. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.meta.js.map +1 -0
  74. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.public.d.ts +80 -0
  75. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.public.js +98 -0
  76. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.public.js.map +1 -0
  77. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.types.d.ts +713 -0
  78. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.types.js +76 -0
  79. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.types.js.map +1 -0
  80. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.universal.d.ts +1072 -0
  81. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.universal.js +359 -0
  82. package/build/internal/cjs/src/ecom-discounts-v1-discount-rule-discount-rules.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.context.d.ts +25 -0
  93. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.context.js +25 -0
  94. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.context.js.map +1 -0
  95. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.http.d.ts +48 -0
  96. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.http.js +263 -0
  97. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.http.js.map +1 -0
  98. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.meta.d.ts +23 -0
  99. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.meta.js +92 -0
  100. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.meta.js.map +1 -0
  101. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.public.d.ts +80 -0
  102. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.public.js +82 -0
  103. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.public.js.map +1 -0
  104. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.types.d.ts +713 -0
  105. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.types.js +73 -0
  106. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.types.js.map +1 -0
  107. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.universal.d.ts +1072 -0
  108. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.universal.js +328 -0
  109. package/build/internal/es/src/ecom-discounts-v1-discount-rule-discount-rules.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,1072 @@
1
+ export interface DiscountRule {
2
+ /**
3
+ * Discount rule ID.
4
+ * @readonly
5
+ */
6
+ _id?: string | null;
7
+ /**
8
+ * Revision number, which increments by 1 each time the discount rule is updated.
9
+ * To prevent conflicting changes, the current `revision` must be passed when updating the discount rule.
10
+ * @readonly
11
+ */
12
+ revision?: string | null;
13
+ /**
14
+ * Date and time the discount rule was created.
15
+ * @readonly
16
+ */
17
+ _createdDate?: Date | null;
18
+ /**
19
+ * Date and time the discount rule was last updated.
20
+ * @readonly
21
+ */
22
+ _updatedDate?: Date | null;
23
+ /**
24
+ * Whether the discount rule is active.
25
+ *
26
+ * Default: `true`
27
+ */
28
+ active?: boolean | null;
29
+ /** Discount rule name. */
30
+ name?: string | null;
31
+ /**
32
+ * Discount rule trigger.
33
+ * A set of conditions that must be met for the `discounts` to be applied.
34
+ * Not passing a trigger will cause the discount to always apply.
35
+ */
36
+ trigger?: DiscountTrigger;
37
+ /** Time frame in which the discount rule is active. */
38
+ activeTimeInfo?: ActiveTimeInfo;
39
+ /**
40
+ * List of discounts that are applied when one or more triggers are met.
41
+ *
42
+ * > **Notes:**
43
+ * >
44
+ * > + Currently, only 1 discount can be defined per discount rule.
45
+ * > + A discount rule can be applied on multiple items per cart.
46
+ * > + A discount rule can only be applied once per item.
47
+ */
48
+ discounts?: Discounts;
49
+ /**
50
+ * Discount rule status.
51
+ * Default: `UNDEFINED`
52
+ * @readonly
53
+ */
54
+ status?: Status;
55
+ /**
56
+ * Number of times the discount rule was used.
57
+ * @readonly
58
+ */
59
+ usageCount?: number;
60
+ }
61
+ /** DiscountTrigger - description of a set of conditions, that if met, will trigger the associated rule actions */
62
+ export interface DiscountTrigger extends DiscountTriggerTriggerOneOf {
63
+ /** Chain multiple triggers with the `and` operator. */
64
+ and?: And;
65
+ /** Chain multiple triggers with the `or` operator. */
66
+ or?: Or;
67
+ /** Custom trigger. */
68
+ customTrigger?: Custom;
69
+ /** Subtotal trigger range. */
70
+ subtotalRange?: SubtotalRange;
71
+ /** Item quantity trigger range. */
72
+ itemQuantityRange?: ItemQuantityRange;
73
+ /**
74
+ * Trigger type.
75
+ *
76
+ * + `"AND"`: Operator used for chaining multiple triggers. Currently 1 `"AND"` chain operator is supported.
77
+ * + `"SUBTOTAL_RANGE"`: Subtotal must be within the specified `subtotalRange` values.
78
+ * + `"ITEM_QUANTITY_RANGE"`: Quantity of items in scope must be within specified `itemQuantityRange` values.
79
+ * + `"CUSTOM"`: Custom trigger type defined in `customTrigger` object.
80
+ */
81
+ triggerType?: TriggerType;
82
+ }
83
+ /** @oneof */
84
+ export interface DiscountTriggerTriggerOneOf {
85
+ /** Chain multiple triggers with the `and` operator. */
86
+ and?: And;
87
+ /** Chain multiple triggers with the `or` operator. */
88
+ or?: Or;
89
+ /** Custom trigger. */
90
+ customTrigger?: Custom;
91
+ /** Subtotal trigger range. */
92
+ subtotalRange?: SubtotalRange;
93
+ /** Item quantity trigger range. */
94
+ itemQuantityRange?: ItemQuantityRange;
95
+ }
96
+ /**
97
+ * This object represents a scope of catalog items. Examples:
98
+ * 1. All catalog items of a specific app - type = CATALOG_ITEM, CatalogItemFilter with `catalog_app_id`
99
+ * 2. Specific catalog item - type = CATALOG_ITEM, CatalogItemFilter with `catalog_app_id` + `catalog_item_ids`
100
+ * 3. External catalog filter - type = CUSTOM_FILTER, CustomFilter with 'app_id' + 'params'
101
+ */
102
+ export interface Scope extends ScopeScopeItemsOneOf {
103
+ /** Catalog item filter. Must be passed with `type."CATALOG_ITEM"`. */
104
+ catalogItemFilter?: CatalogItemFilter;
105
+ /** Custom filter. Must be passed with `type."CATALOG_ITEM"`. */
106
+ customFilter?: CustomFilter;
107
+ /** Scope ID. */
108
+ _id?: string;
109
+ /** Scope type. */
110
+ type?: ScopeType;
111
+ }
112
+ /** @oneof */
113
+ export interface ScopeScopeItemsOneOf {
114
+ /** Catalog item filter. Must be passed with `type."CATALOG_ITEM"`. */
115
+ catalogItemFilter?: CatalogItemFilter;
116
+ /** Custom filter. Must be passed with `type."CATALOG_ITEM"`. */
117
+ customFilter?: CustomFilter;
118
+ }
119
+ export declare enum ScopeType {
120
+ UNDEFINED_SCOPE = "UNDEFINED_SCOPE",
121
+ /** Specific catalog items */
122
+ CATALOG_ITEM = "CATALOG_ITEM",
123
+ /** Specific items by custom filters */
124
+ CUSTOM_FILTER = "CUSTOM_FILTER"
125
+ }
126
+ export interface CatalogItemFilter {
127
+ /** Catalog App ID. For example, the Wix Stores, Wix Bookings, or 3rd-party `appId`. */
128
+ catalogAppId?: string;
129
+ /** ID of the item within its Wix or 3rd-party catalog. For example, `productId` for Wix Stores. */
130
+ catalogItemIds?: string[];
131
+ }
132
+ export interface CustomFilter {
133
+ /** Custom filter app ID, when relevant. */
134
+ appId?: string;
135
+ /**
136
+ * Custom filter in `{ "key": "value" }` form.
137
+ * For example, an array of `collectionIDs`:
138
+ * `{ ["collectionId": "12345"], ["collectionId": "67890"] }`.
139
+ */
140
+ params?: Record<string, any> | null;
141
+ }
142
+ export interface And {
143
+ /** List of triggers to have an "AND" operator between their results. */
144
+ triggers?: DiscountTrigger[];
145
+ }
146
+ export interface Or {
147
+ /** List of triggers to have an "OR" operator between their results. */
148
+ triggers?: DiscountTrigger[];
149
+ }
150
+ export interface Custom {
151
+ /** Trigger ID. */
152
+ _id?: string;
153
+ /** ID of the app that created the trigger. */
154
+ appId?: string;
155
+ }
156
+ export interface SubtotalRange {
157
+ /** Relevant scopes for `"SPECIFIC_ITEMS"` target type. */
158
+ scopes?: Scope[];
159
+ /** Minimum subtotal price (inclusive). */
160
+ from?: string | null;
161
+ /** Maximum subtotal price (inclusive). */
162
+ to?: string | null;
163
+ }
164
+ export interface ItemQuantityRange {
165
+ /** Relevant scopes for `"SPECIFIC_ITEMS"` target type. */
166
+ scopes?: Scope[];
167
+ /** Minimum item quantity (inclusive). */
168
+ from?: number | null;
169
+ /** Maximum item quantity (inclusive). */
170
+ to?: number | null;
171
+ }
172
+ export declare enum TriggerType {
173
+ UNDEFINED = "UNDEFINED",
174
+ /** Operator used for chaining multiple triggers. Currently 1 `AND` chain operator is supported. */
175
+ AND = "AND",
176
+ /** Subtotal must be within the specified `subtotalRange` values. */
177
+ SUBTOTAL_RANGE = "SUBTOTAL_RANGE",
178
+ /** Quantity of items in scope must be within specified `itemQuantityRange` values. */
179
+ ITEM_QUANTITY_RANGE = "ITEM_QUANTITY_RANGE",
180
+ /** Custom trigger type defined in `customTrigger` object. */
181
+ CUSTOM = "CUSTOM",
182
+ /** Chain multiple triggers with OR operator */
183
+ OR = "OR"
184
+ }
185
+ export interface ActiveTimeInfo {
186
+ /** Date and time the discount rule is active **from**, in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. */
187
+ start?: Date | null;
188
+ /** Date and time the discount rule is active **till**, in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. */
189
+ end?: Date | null;
190
+ }
191
+ export interface Discounts {
192
+ /** Discounts. */
193
+ values?: Discount[];
194
+ }
195
+ export interface Discount extends DiscountDiscountOneOf {
196
+ /** Percentage to discount from original price. */
197
+ percentage?: number;
198
+ /** Amount to discount from original price. */
199
+ fixedAmount?: string;
200
+ /** Fixed price. Line item will be fixed to this price. */
201
+ fixedPrice?: string;
202
+ /**
203
+ * Discount target.
204
+ *
205
+ * + `"SPECIFIC_ITEMS"`: Discount applies to a specific set of items.
206
+ */
207
+ targetType?: Type;
208
+ /** Data related to `"SPECIFIC_ITEMS"` target type. */
209
+ specificItemsInfo?: SpecificItemsInfo;
210
+ /**
211
+ * Discount type.
212
+ *
213
+ * + `"PERCENTAGE"`: Price is reduced by percentage value.
214
+ * + `"FIXED_AMOUNT"`: Price is reduced by fixed amount.
215
+ * + `"FIXED_PRICE"`: Price will be set to fixed amount.
216
+ */
217
+ discountType?: DiscountType;
218
+ }
219
+ /** @oneof */
220
+ export interface DiscountDiscountOneOf {
221
+ /** Percentage to discount from original price. */
222
+ percentage?: number;
223
+ /** Amount to discount from original price. */
224
+ fixedAmount?: string;
225
+ /** Fixed price. Line item will be fixed to this price. */
226
+ fixedPrice?: string;
227
+ }
228
+ export declare enum Type {
229
+ /** Target type is not defined */
230
+ UNDEFINED = "UNDEFINED",
231
+ /** Target type is a set of specific items */
232
+ SPECIFIC_ITEMS = "SPECIFIC_ITEMS"
233
+ }
234
+ export interface SpecificItemsInfo {
235
+ /** All associated scopes for `"SPECIFIC_ITEMS"` target type. */
236
+ scopes?: Scope[];
237
+ }
238
+ export declare enum DiscountType {
239
+ UNDEFINED = "UNDEFINED",
240
+ /** Price is reduced by percentage value. */
241
+ PERCENTAGE = "PERCENTAGE",
242
+ /** Price is reduced by fixed amount. */
243
+ FIXED_AMOUNT = "FIXED_AMOUNT",
244
+ /** Price will be set to fixed amount. */
245
+ FIXED_PRICE = "FIXED_PRICE"
246
+ }
247
+ export interface BuyXGetYInfo {
248
+ /** Information about which items must be in the cart (buy X) for the discount to apply (get Y). */
249
+ customerBuys?: CustomerBuy;
250
+ /** Information about which items will be discounted (get Y). */
251
+ customerGets?: CustomerGet;
252
+ /**
253
+ * The maximum number of times the 'buy X get Y' discount can be applied.
254
+ * For example, when the value of `limit` is `2`, with a "2+1" sale on all items, the following logic applies:
255
+ * + Buy 2 get 1, buy 3 get 1.
256
+ * + Buy 4 get 2, buy 6 get 2, buy 9 get 2, and so on.
257
+ */
258
+ limit?: number | null;
259
+ }
260
+ export interface CustomerBuy extends CustomerBuyConditionOneOf {
261
+ /** Minimum number of items the customer must add to the cart to be eligible for a discount. */
262
+ minimumQuantity?: number;
263
+ /** Minimum price the customer must add to the cart to be eligible for a discount. */
264
+ minimumSpend?: string | null;
265
+ /** Scopes of the items that must be added to the cart to enable the discount. */
266
+ scopes?: Scope[];
267
+ }
268
+ /** @oneof */
269
+ export interface CustomerBuyConditionOneOf {
270
+ /** Minimum number of items the customer must add to the cart to be eligible for a discount. */
271
+ minimumQuantity?: number;
272
+ /** Minimum price the customer must add to the cart to be eligible for a discount. */
273
+ minimumSpend?: string | null;
274
+ }
275
+ export interface CustomerGet {
276
+ /**
277
+ * Exact number of items in the cart that will be discounted.
278
+ * If the cart contains fewer items than the value of quantity, the discount will not apply.
279
+ */
280
+ quantity?: number;
281
+ /** Scopes of the items that will be discounted. */
282
+ scopes?: Scope[];
283
+ }
284
+ export declare enum Status {
285
+ /** Rule status is not defined. */
286
+ UNDEFINED = "UNDEFINED",
287
+ /** Rule status is live. */
288
+ LIVE = "LIVE",
289
+ /** Rule status is expired, it might have been live in the past. */
290
+ EXPIRED = "EXPIRED",
291
+ /** Rule status is pending, it might be live in the future. */
292
+ PENDING = "PENDING"
293
+ }
294
+ /** The discount settings */
295
+ export interface DiscountSettings {
296
+ /** Discount applies to either `ALL_ITEMS`, or to the `LOWEST_PRICED_ITEM`. */
297
+ appliesTo?: AppliedSubjectType;
298
+ /**
299
+ * Whether the discount will apply to subscriptions.
300
+ *
301
+ * Default: `false`
302
+ */
303
+ includeSubscription?: boolean | null;
304
+ /** Maximum total number of uses allowed for the discount rule. */
305
+ usageLimit?: number | null;
306
+ /**
307
+ * The usage limit per user per discount.
308
+ * When not provided, this setting will not apply.
309
+ */
310
+ usageLimitPerUser?: number | null;
311
+ }
312
+ /** TODO: check if can be removed */
313
+ export declare enum AppliedSubjectType {
314
+ UNDEFINED = "UNDEFINED",
315
+ /** Discount applies to all items at checkout. */
316
+ ALL_ITEMS = "ALL_ITEMS",
317
+ /** Discount applies to the lowest priced item at checkout. */
318
+ LOWEST_PRICED_ITEM = "LOWEST_PRICED_ITEM"
319
+ }
320
+ export interface ExtendedFields {
321
+ /**
322
+ * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
323
+ * The value of each key is structured according to the schema defined when the extended fields were configured.
324
+ *
325
+ * You can only access fields for which you have the appropriate permissions.
326
+ *
327
+ * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
328
+ */
329
+ namespaces?: Record<string, Record<string, any>>;
330
+ }
331
+ export interface CreateDiscountRuleRequest {
332
+ /** Discount rule info. */
333
+ discountRule: DiscountRule;
334
+ }
335
+ export interface CreateDiscountRuleResponse {
336
+ /** Discount rule. */
337
+ discountRule?: DiscountRule;
338
+ }
339
+ export interface GetDiscountRuleRequest {
340
+ /** ID of the discount rule to retrieve. */
341
+ discountRuleId: string;
342
+ }
343
+ export interface GetDiscountRuleResponse {
344
+ /** The requested discount rule. */
345
+ discountRule?: DiscountRule;
346
+ }
347
+ export interface UpdateDiscountRuleRequest {
348
+ /** Discount rule info. */
349
+ discountRule: DiscountRule;
350
+ }
351
+ export interface UpdateDiscountRuleResponse {
352
+ /** Updated discount rule. */
353
+ discountRule?: DiscountRule;
354
+ }
355
+ export interface DeleteDiscountRuleRequest {
356
+ /** ID of the discount rule to delete. */
357
+ discountRuleId: string;
358
+ }
359
+ export interface DeleteDiscountRuleResponse {
360
+ }
361
+ export interface QueryDiscountRulesRequest {
362
+ /** Query options. */
363
+ query?: PlatformQuery;
364
+ }
365
+ export interface PlatformQuery extends PlatformQueryPagingMethodOneOf {
366
+ /** Pointer to page of results using offset. Cannot be used together with `cursorPaging`. */
367
+ paging?: PlatformPaging;
368
+ /** Cursor pointing to page of results. Cannot be used together with `paging`. `cursorPaging.cursor` can not be used together with `filter` or `sort`. */
369
+ cursorPaging?: CursorPaging;
370
+ /** Filter object. */
371
+ filter?: Record<string, any> | null;
372
+ /** Sorting options. For example, `[{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]`. */
373
+ sort?: Sorting[];
374
+ }
375
+ /** @oneof */
376
+ export interface PlatformQueryPagingMethodOneOf {
377
+ /** Pointer to page of results using offset. Cannot be used together with `cursorPaging`. */
378
+ paging?: PlatformPaging;
379
+ /** Cursor pointing to page of results. Cannot be used together with `paging`. `cursorPaging.cursor` can not be used together with `filter` or `sort`. */
380
+ cursorPaging?: CursorPaging;
381
+ }
382
+ export interface Sorting {
383
+ /** Name of the field to sort by. */
384
+ fieldName?: string;
385
+ /** Sort order. */
386
+ order?: SortOrder;
387
+ }
388
+ export declare enum SortOrder {
389
+ ASC = "ASC",
390
+ DESC = "DESC"
391
+ }
392
+ export interface PlatformPaging {
393
+ /** Number of items to load. */
394
+ limit?: number | null;
395
+ /** Number of items to skip in the current sort order. */
396
+ offset?: number | null;
397
+ }
398
+ export interface CursorPaging {
399
+ /** Maximum number of items to return in the results. */
400
+ limit?: number | null;
401
+ /**
402
+ * Pointer to the next or previous page in the list of results.
403
+ *
404
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
405
+ * Not relevant for the first request.
406
+ */
407
+ cursor?: string | null;
408
+ }
409
+ export interface QueryDiscountRulesResponse {
410
+ /** List of discount rules. */
411
+ discountRules?: DiscountRule[];
412
+ /** Details on the paged set of results returned. */
413
+ pagingMetadata?: PlatformPagingMetadata;
414
+ }
415
+ export interface PlatformPagingMetadata {
416
+ /** The number of items returned in this response. */
417
+ count?: number | null;
418
+ /** The offset which was requested. Returned if offset paging was used. */
419
+ offset?: number | null;
420
+ /** The total number of items that match the query. Returned if offset paging was used. */
421
+ total?: number | null;
422
+ /** Cursors to navigate through result pages. Returned if cursor paging was used. */
423
+ cursors?: Cursors;
424
+ }
425
+ export interface Cursors {
426
+ /** Cursor string pointing to the next page in the list of results. */
427
+ next?: string | null;
428
+ /** Cursor pointing to the previous page in the list of results. */
429
+ prev?: string | null;
430
+ }
431
+ export interface GetAppliedDiscountsRequest {
432
+ /** Line items for which to check for discount rules. */
433
+ lineItems?: LineItem[];
434
+ /** Persistent ID that correlates between the various eCommerce elements: cart, checkout, and order. */
435
+ purchaseFlowId?: string | null;
436
+ }
437
+ export interface LineItem {
438
+ /** Line item ID. */
439
+ _id?: string;
440
+ /** Line item quantity. */
441
+ quantity?: number | null;
442
+ /** Catalog and item reference info. Learn more about [integrating Wix Stores products with Wix eCommerce](https://dev.wix.com/api/rest/wix-stores/catalog/ecommerce-integration). */
443
+ catalogReference?: CatalogReference;
444
+ /** Line item price. */
445
+ price?: string;
446
+ }
447
+ /** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */
448
+ export interface CatalogReference {
449
+ /** ID of the item within the catalog it belongs to. */
450
+ catalogItemId?: string;
451
+ /**
452
+ * ID of the app providing the catalog.
453
+ *
454
+ * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).
455
+ *
456
+ * For items from Wix catalogs, the following values always apply:
457
+ * + Wix Stores: `"215238eb-22a5-4c36-9e7b-e7c08025e04e"`
458
+ * + Wix Bookings: `"13d21c63-b5ec-5912-8397-c3a5ddb27a97"`
459
+ * + Wix Restaurants: `"9a5d83fd-8570-482e-81ab-cfa88942ee60"`
460
+ */
461
+ appId?: string;
462
+ /**
463
+ * Additional item details in key:value pairs. Use this optional field to provide more specificity with item selection. The `options` field values differ depending on which catalog is providing the items.
464
+ *
465
+ * For products and variants from a Wix Stores catalog, learn more about [eCommerce integration](https://dev.wix.com/docs/rest/business-solutions/stores/catalog/e-commerce-integration).
466
+ */
467
+ options?: Record<string, any> | null;
468
+ }
469
+ export interface GetAppliedDiscountsResponse {
470
+ /** All eligible discounts. */
471
+ appliedDiscounts?: AppliedDiscount[];
472
+ }
473
+ export interface AppliedDiscount {
474
+ /** Discount type. */
475
+ discountType?: Type;
476
+ /** IDs of line items the discount applies to, in GUID format. */
477
+ lineItemIds?: string[];
478
+ /** Applied discount rule. */
479
+ appliedDiscountRule?: AppliedDiscountRule;
480
+ }
481
+ export interface AppliedDiscountRule {
482
+ /** Applied discount rule ID. */
483
+ _id?: string;
484
+ /** Discount rule name. */
485
+ name?: DiscountRuleName;
486
+ /** Total amount reduced from all discounted line items. */
487
+ amount?: MultiCurrencyPrice;
488
+ /** Discount rule type. */
489
+ discountRuleType?: DiscountType;
490
+ }
491
+ export interface DiscountRuleName {
492
+ /** Original discount rule name (in site's default language). */
493
+ original?: string;
494
+ /**
495
+ * Translated discount rule name according to buyer language.
496
+ *
497
+ * Default: `original`
498
+ */
499
+ translated?: string | null;
500
+ }
501
+ export interface MultiCurrencyPrice {
502
+ /** Amount. */
503
+ amount?: string;
504
+ /**
505
+ * Converted amount.
506
+ * @readonly
507
+ */
508
+ convertedAmount?: string;
509
+ /**
510
+ * Amount formatted with currency symbol.
511
+ * @readonly
512
+ */
513
+ formattedAmount?: string;
514
+ /**
515
+ * Converted amount formatted with currency symbol.
516
+ * @readonly
517
+ */
518
+ formattedConvertedAmount?: string;
519
+ }
520
+ export interface DomainEvent extends DomainEventBodyOneOf {
521
+ createdEvent?: EntityCreatedEvent;
522
+ updatedEvent?: EntityUpdatedEvent;
523
+ deletedEvent?: EntityDeletedEvent;
524
+ actionEvent?: ActionEvent;
525
+ /**
526
+ * Unique event ID.
527
+ * Allows clients to ignore duplicate webhooks.
528
+ */
529
+ _id?: string;
530
+ /**
531
+ * Assumes actions are also always typed to an entity_type
532
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
533
+ */
534
+ entityFqdn?: string;
535
+ /**
536
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
537
+ * This is although the created/updated/deleted notion is duplication of the oneof types
538
+ * Example: created/updated/deleted/started/completed/email_opened
539
+ */
540
+ slug?: string;
541
+ /** ID of the entity associated with the event. */
542
+ entityId?: string;
543
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
544
+ eventTime?: Date | null;
545
+ /**
546
+ * Whether the event was triggered as a result of a privacy regulation application
547
+ * (for example, GDPR).
548
+ */
549
+ triggeredByAnonymizeRequest?: boolean | null;
550
+ /** If present, indicates the action that triggered the event. */
551
+ originatedFrom?: string | null;
552
+ /**
553
+ * A sequence number defining the order of updates to the underlying entity.
554
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
555
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
556
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
557
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
558
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
559
+ */
560
+ entityEventSequence?: string | null;
561
+ }
562
+ /** @oneof */
563
+ export interface DomainEventBodyOneOf {
564
+ createdEvent?: EntityCreatedEvent;
565
+ updatedEvent?: EntityUpdatedEvent;
566
+ deletedEvent?: EntityDeletedEvent;
567
+ actionEvent?: ActionEvent;
568
+ }
569
+ export interface EntityCreatedEvent {
570
+ entity?: string;
571
+ }
572
+ export interface RestoreInfo {
573
+ deletedDate?: Date | null;
574
+ }
575
+ export interface EntityUpdatedEvent {
576
+ /**
577
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
578
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
579
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
580
+ */
581
+ currentEntity?: string;
582
+ }
583
+ export interface EntityDeletedEvent {
584
+ /** Entity that was deleted */
585
+ deletedEntity?: string | null;
586
+ }
587
+ export interface ActionEvent {
588
+ body?: string;
589
+ }
590
+ export interface Empty {
591
+ }
592
+ export interface DiscountRuleUsageLimitReached {
593
+ /** Discount Rule */
594
+ rule?: DiscountRule;
595
+ }
596
+ export interface MessageEnvelope {
597
+ /** App instance ID. */
598
+ instanceId?: string | null;
599
+ /** Event type. */
600
+ eventType?: string;
601
+ /** The identification type and identity data. */
602
+ identity?: IdentificationData;
603
+ /** Stringify payload. */
604
+ data?: string;
605
+ }
606
+ export interface IdentificationData extends IdentificationDataIdOneOf {
607
+ /** ID of a site visitor that has not logged in to the site. */
608
+ anonymousVisitorId?: string;
609
+ /** ID of a site visitor that has logged in to the site. */
610
+ memberId?: string;
611
+ /** ID of a Wix user (site owner, contributor, etc.). */
612
+ wixUserId?: string;
613
+ /** ID of an app. */
614
+ appId?: string;
615
+ /** @readonly */
616
+ identityType?: WebhookIdentityType;
617
+ }
618
+ /** @oneof */
619
+ export interface IdentificationDataIdOneOf {
620
+ /** ID of a site visitor that has not logged in to the site. */
621
+ anonymousVisitorId?: string;
622
+ /** ID of a site visitor that has logged in to the site. */
623
+ memberId?: string;
624
+ /** ID of a Wix user (site owner, contributor, etc.). */
625
+ wixUserId?: string;
626
+ /** ID of an app. */
627
+ appId?: string;
628
+ }
629
+ export declare enum WebhookIdentityType {
630
+ UNKNOWN = "UNKNOWN",
631
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
632
+ MEMBER = "MEMBER",
633
+ WIX_USER = "WIX_USER",
634
+ APP = "APP"
635
+ }
636
+ interface AndNonNullableFields {
637
+ triggers: DiscountTriggerNonNullableFields[];
638
+ }
639
+ interface OrNonNullableFields {
640
+ triggers: DiscountTriggerNonNullableFields[];
641
+ }
642
+ interface CustomNonNullableFields {
643
+ _id: string;
644
+ appId: string;
645
+ }
646
+ interface CatalogItemFilterNonNullableFields {
647
+ catalogAppId: string;
648
+ catalogItemIds: string[];
649
+ }
650
+ interface CustomFilterNonNullableFields {
651
+ appId: string;
652
+ }
653
+ interface ScopeNonNullableFields {
654
+ catalogItemFilter?: CatalogItemFilterNonNullableFields;
655
+ customFilter?: CustomFilterNonNullableFields;
656
+ _id: string;
657
+ type: ScopeType;
658
+ }
659
+ interface SubtotalRangeNonNullableFields {
660
+ scopes: ScopeNonNullableFields[];
661
+ }
662
+ interface ItemQuantityRangeNonNullableFields {
663
+ scopes: ScopeNonNullableFields[];
664
+ }
665
+ interface DiscountTriggerNonNullableFields {
666
+ and?: AndNonNullableFields;
667
+ or?: OrNonNullableFields;
668
+ customTrigger?: CustomNonNullableFields;
669
+ subtotalRange?: SubtotalRangeNonNullableFields;
670
+ itemQuantityRange?: ItemQuantityRangeNonNullableFields;
671
+ triggerType: TriggerType;
672
+ }
673
+ interface SpecificItemsInfoNonNullableFields {
674
+ scopes: ScopeNonNullableFields[];
675
+ }
676
+ interface CustomerBuyNonNullableFields {
677
+ minimumQuantity: number;
678
+ scopes: ScopeNonNullableFields[];
679
+ }
680
+ interface CustomerGetNonNullableFields {
681
+ quantity: number;
682
+ scopes: ScopeNonNullableFields[];
683
+ }
684
+ interface BuyXGetYInfoNonNullableFields {
685
+ customerBuys?: CustomerBuyNonNullableFields;
686
+ customerGets?: CustomerGetNonNullableFields;
687
+ }
688
+ interface DiscountNonNullableFields {
689
+ percentage: number;
690
+ fixedAmount: string;
691
+ fixedPrice: string;
692
+ targetType: Type;
693
+ specificItemsInfo?: SpecificItemsInfoNonNullableFields;
694
+ discountType: DiscountType;
695
+ /** @internal */
696
+ buyXGetYInfo?: BuyXGetYInfoNonNullableFields;
697
+ }
698
+ interface DiscountsNonNullableFields {
699
+ values: DiscountNonNullableFields[];
700
+ }
701
+ interface DiscountSettingsNonNullableFields {
702
+ appliesTo: AppliedSubjectType;
703
+ }
704
+ export interface DiscountRuleNonNullableFields {
705
+ trigger?: DiscountTriggerNonNullableFields;
706
+ discounts?: DiscountsNonNullableFields;
707
+ status: Status;
708
+ usageCount: number;
709
+ /** @internal */
710
+ settings?: DiscountSettingsNonNullableFields;
711
+ }
712
+ export interface CreateDiscountRuleResponseNonNullableFields {
713
+ discountRule?: DiscountRuleNonNullableFields;
714
+ }
715
+ export interface GetDiscountRuleResponseNonNullableFields {
716
+ discountRule?: DiscountRuleNonNullableFields;
717
+ }
718
+ export interface UpdateDiscountRuleResponseNonNullableFields {
719
+ discountRule?: DiscountRuleNonNullableFields;
720
+ }
721
+ export interface QueryDiscountRulesResponseNonNullableFields {
722
+ discountRules: DiscountRuleNonNullableFields[];
723
+ }
724
+ export interface BaseEventMetadata {
725
+ /** App instance ID. */
726
+ instanceId?: string | null;
727
+ /** Event type. */
728
+ eventType?: string;
729
+ /** The identification type and identity data. */
730
+ identity?: IdentificationData;
731
+ }
732
+ export interface EventMetadata extends BaseEventMetadata {
733
+ /**
734
+ * Unique event ID.
735
+ * Allows clients to ignore duplicate webhooks.
736
+ */
737
+ _id?: string;
738
+ /**
739
+ * Assumes actions are also always typed to an entity_type
740
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
741
+ */
742
+ entityFqdn?: string;
743
+ /**
744
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
745
+ * This is although the created/updated/deleted notion is duplication of the oneof types
746
+ * Example: created/updated/deleted/started/completed/email_opened
747
+ */
748
+ slug?: string;
749
+ /** ID of the entity associated with the event. */
750
+ entityId?: string;
751
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
752
+ eventTime?: Date | null;
753
+ /**
754
+ * Whether the event was triggered as a result of a privacy regulation application
755
+ * (for example, GDPR).
756
+ */
757
+ triggeredByAnonymizeRequest?: boolean | null;
758
+ /** If present, indicates the action that triggered the event. */
759
+ originatedFrom?: string | null;
760
+ /**
761
+ * A sequence number defining the order of updates to the underlying entity.
762
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
763
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
764
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
765
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
766
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
767
+ */
768
+ entityEventSequence?: string | null;
769
+ }
770
+ export interface DiscountRuleCreatedEnvelope {
771
+ entity: DiscountRule;
772
+ metadata: EventMetadata;
773
+ }
774
+ /**
775
+ * Triggered when a discount rule is created.
776
+ * @permissionScope Manage Stores - all permissions
777
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
778
+ * @permissionScope Read eCommerce - all read permissions
779
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
780
+ * @permissionScope Read Stores - all read permissions
781
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
782
+ * @permissionScope Manage Restaurants - all permissions
783
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
784
+ * @permissionScope Manage eCommerce - all permissions
785
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
786
+ * @permissionId ECOM.DISCOUNT_RULES_READ
787
+ * @webhook
788
+ * @eventType wix.ecom.discounts.v1.discount_rule_created
789
+ */
790
+ export declare function onDiscountRuleCreated(handler: (event: DiscountRuleCreatedEnvelope) => void | Promise<void>): void;
791
+ export interface DiscountRuleDeletedEnvelope {
792
+ metadata: EventMetadata;
793
+ }
794
+ /**
795
+ * Triggered when a discount rule is deleted.
796
+ * @permissionScope Manage Stores - all permissions
797
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
798
+ * @permissionScope Read eCommerce - all read permissions
799
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
800
+ * @permissionScope Read Stores - all read permissions
801
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
802
+ * @permissionScope Manage Restaurants - all permissions
803
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
804
+ * @permissionScope Manage eCommerce - all permissions
805
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
806
+ * @permissionId ECOM.DISCOUNT_RULES_READ
807
+ * @webhook
808
+ * @eventType wix.ecom.discounts.v1.discount_rule_deleted
809
+ */
810
+ export declare function onDiscountRuleDeleted(handler: (event: DiscountRuleDeletedEnvelope) => void | Promise<void>): void;
811
+ export interface DiscountRuleUpdatedEnvelope {
812
+ entity: DiscountRule;
813
+ metadata: EventMetadata;
814
+ }
815
+ /**
816
+ * Triggered when a discount rule is updated.
817
+ * @permissionScope Manage Stores - all permissions
818
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
819
+ * @permissionScope Read eCommerce - all read permissions
820
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
821
+ * @permissionScope Read Stores - all read permissions
822
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
823
+ * @permissionScope Manage Restaurants - all permissions
824
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
825
+ * @permissionScope Manage eCommerce - all permissions
826
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
827
+ * @permissionId ECOM.DISCOUNT_RULES_READ
828
+ * @webhook
829
+ * @eventType wix.ecom.discounts.v1.discount_rule_updated
830
+ */
831
+ export declare function onDiscountRuleUpdated(handler: (event: DiscountRuleUpdatedEnvelope) => void | Promise<void>): void;
832
+ /**
833
+ * Creates a new discount rule.
834
+ *
835
+ *
836
+ * The `createDiscountRule()` function returns a Promise that resolves to the new discount rule when it's created.
837
+ * @param discountRule - Discount rule info.
838
+ * @public
839
+ * @requiredField discountRule
840
+ * @requiredField discountRule.discounts
841
+ * @requiredField discountRule.name
842
+ * @permissionId ECOM.DISCOUNT_RULES_CREATE
843
+ * @permissionScope Manage Stores - all permissions
844
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
845
+ * @permissionScope Manage Restaurants - all permissions
846
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
847
+ * @permissionScope Manage eCommerce - all permissions
848
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
849
+ * @applicableIdentity APP
850
+ * @returns Discount rule.
851
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.CreateDiscountRule
852
+ */
853
+ export declare function createDiscountRule(discountRule: DiscountRule): Promise<DiscountRule & DiscountRuleNonNullableFields>;
854
+ /**
855
+ * Retrieves a discount rule.
856
+ *
857
+ *
858
+ * The `getDiscountRule()` function returns a Promise that resolves when the specified discount rule is retrieved.
859
+ * @param discountRuleId - ID of the discount rule to retrieve.
860
+ * @public
861
+ * @requiredField discountRuleId
862
+ * @permissionId ECOM.DISCOUNT_RULES_READ
863
+ * @permissionScope Manage Stores - all permissions
864
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
865
+ * @permissionScope Read eCommerce - all read permissions
866
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
867
+ * @permissionScope Read Stores - all read permissions
868
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
869
+ * @permissionScope Manage Restaurants - all permissions
870
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
871
+ * @permissionScope Manage eCommerce - all permissions
872
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
873
+ * @applicableIdentity APP
874
+ * @returns The requested discount rule.
875
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.GetDiscountRule
876
+ */
877
+ export declare function getDiscountRule(discountRuleId: string): Promise<DiscountRule & DiscountRuleNonNullableFields>;
878
+ /**
879
+ * Updates a discount rule's properties.
880
+ *
881
+ *
882
+ * The `updateDiscountRule()` function returns a Promise that resolves when the specified discount rule's properties are updated.
883
+ *
884
+ * Each time the discount rule is updated, `revision` increments by 1. The existing `revision` must be included when updating the discount rule. This ensures you're working with the latest discount rule information, and it prevents unintended overwrites.
885
+ * @param _id - Discount rule ID.
886
+ * @public
887
+ * @requiredField _id
888
+ * @requiredField discountRule
889
+ * @requiredField discountRule.revision
890
+ * @param discountRule - Discount rule info.
891
+ * @param options - Discount rule info.
892
+ * @permissionId ECOM.DISCOUNT_RULES_UPDATE
893
+ * @permissionScope Manage Stores - all permissions
894
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
895
+ * @permissionScope Manage Restaurants - all permissions
896
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
897
+ * @permissionScope Manage eCommerce - all permissions
898
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
899
+ * @applicableIdentity APP
900
+ * @returns Updated discount rule.
901
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.UpdateDiscountRule
902
+ */
903
+ export declare function updateDiscountRule(_id: string | null, discountRule: UpdateDiscountRule): Promise<DiscountRule & DiscountRuleNonNullableFields>;
904
+ export interface UpdateDiscountRule {
905
+ /**
906
+ * Discount rule ID.
907
+ * @readonly
908
+ */
909
+ _id?: string | null;
910
+ /**
911
+ * Revision number, which increments by 1 each time the discount rule is updated.
912
+ * To prevent conflicting changes, the current `revision` must be passed when updating the discount rule.
913
+ * @readonly
914
+ */
915
+ revision?: string | null;
916
+ /**
917
+ * Date and time the discount rule was created.
918
+ * @readonly
919
+ */
920
+ _createdDate?: Date | null;
921
+ /**
922
+ * Date and time the discount rule was last updated.
923
+ * @readonly
924
+ */
925
+ _updatedDate?: Date | null;
926
+ /**
927
+ * Whether the discount rule is active.
928
+ *
929
+ * Default: `true`
930
+ */
931
+ active?: boolean | null;
932
+ /** Discount rule name. */
933
+ name?: string | null;
934
+ /**
935
+ * Discount rule trigger.
936
+ * A set of conditions that must be met for the `discounts` to be applied.
937
+ * Not passing a trigger will cause the discount to always apply.
938
+ */
939
+ trigger?: DiscountTrigger;
940
+ /** Time frame in which the discount rule is active. */
941
+ activeTimeInfo?: ActiveTimeInfo;
942
+ /**
943
+ * List of discounts that are applied when one or more triggers are met.
944
+ *
945
+ * > **Notes:**
946
+ * >
947
+ * > + Currently, only 1 discount can be defined per discount rule.
948
+ * > + A discount rule can be applied on multiple items per cart.
949
+ * > + A discount rule can only be applied once per item.
950
+ */
951
+ discounts?: Discounts;
952
+ /**
953
+ * Discount rule status.
954
+ * Default: `UNDEFINED`
955
+ * @readonly
956
+ */
957
+ status?: Status;
958
+ /**
959
+ * Number of times the discount rule was used.
960
+ * @readonly
961
+ */
962
+ usageCount?: number;
963
+ }
964
+ /**
965
+ * Deletes a discount rule.
966
+ *
967
+ *
968
+ * The `deleteDiscountRule()` function returns a Promise that resolves when the specified discount rule is deleted.
969
+ * @param discountRuleId - ID of the discount rule to delete.
970
+ * @public
971
+ * @requiredField discountRuleId
972
+ * @permissionId ECOM.DISCOUNT_RULES_DELETE
973
+ * @permissionScope Manage Stores - all permissions
974
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
975
+ * @permissionScope Manage Restaurants - all permissions
976
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
977
+ * @permissionScope Manage eCommerce - all permissions
978
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
979
+ * @applicableIdentity APP
980
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.DeleteDiscountRule
981
+ */
982
+ export declare function deleteDiscountRule(discountRuleId: string): Promise<void>;
983
+ /**
984
+ * Creates a query to retrieve a list of discount rules.
985
+ *
986
+ *
987
+ * The `queryDiscountRules()` function builds a query to retrieve a list of up to 100 discount rules, and returns a [`DiscountRulesQueryBuilder`](#discountrulesquerybuilder) object.
988
+ *
989
+ * The returned object contains the query definition which is typically used to run the query using the [`find()`](/discount-rules/discount-rules-query-builder/find) function.
990
+ *
991
+ * You can refine the query by chaining `DiscountRulesQueryBuilder` functions onto the query. `DiscountRulesQueryBuilder` functions enable you to sort, filter, and control the results queryDiscountRules() returns.
992
+ *
993
+ * By default, `queryDiscountRules()` sorts results by [`ascending("_id")`](/discount-rules/discount-rules-query-builder/ascending) by default. This can be overridden.
994
+ *
995
+ * To learn how to query posts, refer to the table below.
996
+ *
997
+ * The following `DiscountRulesQueryBuilder` functions are supported for the `queryDiscountRules()` function. For a full description of the discount rule object, see the object returned for the [`items`](/discount-rules/discount-rules-query-result/items) property in the `DiscountRulesQueryResult`.
998
+ * @public
999
+ * @permissionScope Manage Stores - all permissions
1000
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1001
+ * @permissionScope Read eCommerce - all read permissions
1002
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
1003
+ * @permissionScope Read Stores - all read permissions
1004
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
1005
+ * @permissionScope Manage Restaurants - all permissions
1006
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1007
+ * @permissionScope Manage eCommerce - all permissions
1008
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1009
+ * @permissionId ECOM.DISCOUNT_RULES_READ
1010
+ * @applicableIdentity APP
1011
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.QueryDiscountRules
1012
+ */
1013
+ export declare function queryDiscountRules(): DiscountRulesQueryBuilder;
1014
+ interface QueryCursorResult {
1015
+ cursors: Cursors;
1016
+ hasNext: () => boolean;
1017
+ hasPrev: () => boolean;
1018
+ length: number;
1019
+ pageSize: number;
1020
+ }
1021
+ export interface DiscountRulesQueryResult extends QueryCursorResult {
1022
+ items: DiscountRule[];
1023
+ query: DiscountRulesQueryBuilder;
1024
+ next: () => Promise<DiscountRulesQueryResult>;
1025
+ prev: () => Promise<DiscountRulesQueryResult>;
1026
+ }
1027
+ export interface DiscountRulesQueryBuilder {
1028
+ /** @param propertyName - Property whose value is compared with `value`.
1029
+ * @param value - Value to compare against.
1030
+ */
1031
+ eq: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1032
+ /** @param propertyName - Property whose value is compared with `value`.
1033
+ * @param value - Value to compare against.
1034
+ */
1035
+ ne: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1036
+ /** @param propertyName - Property whose value is compared with `value`.
1037
+ * @param value - Value to compare against.
1038
+ */
1039
+ ge: (propertyName: 'revision' | '_createdDate' | '_updatedDate' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1040
+ /** @param propertyName - Property whose value is compared with `value`.
1041
+ * @param value - Value to compare against.
1042
+ */
1043
+ gt: (propertyName: 'revision' | '_createdDate' | '_updatedDate' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1044
+ /** @param propertyName - Property whose value is compared with `value`.
1045
+ * @param value - Value to compare against.
1046
+ */
1047
+ le: (propertyName: 'revision' | '_createdDate' | '_updatedDate' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1048
+ /** @param propertyName - Property whose value is compared with `value`.
1049
+ * @param value - Value to compare against.
1050
+ */
1051
+ lt: (propertyName: 'revision' | '_createdDate' | '_updatedDate' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1052
+ /** @param propertyName - Property whose value is compared with `string`.
1053
+ * @param string - String to compare against. Case-insensitive.
1054
+ */
1055
+ startsWith: (propertyName: '_id' | 'name', value: string) => DiscountRulesQueryBuilder;
1056
+ /** @param propertyName - Property whose value is compared with `values`.
1057
+ * @param values - List of values to compare against.
1058
+ */
1059
+ hasSome: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any[]) => DiscountRulesQueryBuilder;
1060
+ in: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1061
+ exists: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: boolean) => DiscountRulesQueryBuilder;
1062
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
1063
+ ascending: (...propertyNames: Array<'_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end'>) => DiscountRulesQueryBuilder;
1064
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
1065
+ descending: (...propertyNames: Array<'_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end'>) => DiscountRulesQueryBuilder;
1066
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */
1067
+ limit: (limit: number) => DiscountRulesQueryBuilder;
1068
+ /** @param cursor - A pointer to specific record */
1069
+ skipTo: (cursor: string) => DiscountRulesQueryBuilder;
1070
+ find: () => Promise<DiscountRulesQueryResult>;
1071
+ }
1072
+ export {};