@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,1053 @@
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 DiscountNonNullableFields {
677
+ percentage: number;
678
+ fixedAmount: string;
679
+ fixedPrice: string;
680
+ targetType: Type;
681
+ specificItemsInfo?: SpecificItemsInfoNonNullableFields;
682
+ discountType: DiscountType;
683
+ }
684
+ interface DiscountsNonNullableFields {
685
+ values: DiscountNonNullableFields[];
686
+ }
687
+ export interface DiscountRuleNonNullableFields {
688
+ trigger?: DiscountTriggerNonNullableFields;
689
+ discounts?: DiscountsNonNullableFields;
690
+ status: Status;
691
+ usageCount: number;
692
+ }
693
+ export interface CreateDiscountRuleResponseNonNullableFields {
694
+ discountRule?: DiscountRuleNonNullableFields;
695
+ }
696
+ export interface GetDiscountRuleResponseNonNullableFields {
697
+ discountRule?: DiscountRuleNonNullableFields;
698
+ }
699
+ export interface UpdateDiscountRuleResponseNonNullableFields {
700
+ discountRule?: DiscountRuleNonNullableFields;
701
+ }
702
+ export interface QueryDiscountRulesResponseNonNullableFields {
703
+ discountRules: DiscountRuleNonNullableFields[];
704
+ }
705
+ export interface BaseEventMetadata {
706
+ /** App instance ID. */
707
+ instanceId?: string | null;
708
+ /** Event type. */
709
+ eventType?: string;
710
+ /** The identification type and identity data. */
711
+ identity?: IdentificationData;
712
+ }
713
+ export interface EventMetadata extends BaseEventMetadata {
714
+ /**
715
+ * Unique event ID.
716
+ * Allows clients to ignore duplicate webhooks.
717
+ */
718
+ _id?: string;
719
+ /**
720
+ * Assumes actions are also always typed to an entity_type
721
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
722
+ */
723
+ entityFqdn?: string;
724
+ /**
725
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
726
+ * This is although the created/updated/deleted notion is duplication of the oneof types
727
+ * Example: created/updated/deleted/started/completed/email_opened
728
+ */
729
+ slug?: string;
730
+ /** ID of the entity associated with the event. */
731
+ entityId?: string;
732
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
733
+ eventTime?: Date | null;
734
+ /**
735
+ * Whether the event was triggered as a result of a privacy regulation application
736
+ * (for example, GDPR).
737
+ */
738
+ triggeredByAnonymizeRequest?: boolean | null;
739
+ /** If present, indicates the action that triggered the event. */
740
+ originatedFrom?: string | null;
741
+ /**
742
+ * A sequence number defining the order of updates to the underlying entity.
743
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
744
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
745
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
746
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
747
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
748
+ */
749
+ entityEventSequence?: string | null;
750
+ }
751
+ export interface DiscountRuleCreatedEnvelope {
752
+ entity: DiscountRule;
753
+ metadata: EventMetadata;
754
+ }
755
+ /**
756
+ * Triggered when a discount rule is created.
757
+ * @permissionScope Manage Stores - all permissions
758
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
759
+ * @permissionScope Read eCommerce - all read permissions
760
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
761
+ * @permissionScope Read Stores - all read permissions
762
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
763
+ * @permissionScope Manage Restaurants - all permissions
764
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
765
+ * @permissionScope Manage eCommerce - all permissions
766
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
767
+ * @permissionId ECOM.DISCOUNT_RULES_READ
768
+ * @webhook
769
+ * @eventType wix.ecom.discounts.v1.discount_rule_created
770
+ */
771
+ export declare function onDiscountRuleCreated(handler: (event: DiscountRuleCreatedEnvelope) => void | Promise<void>): void;
772
+ export interface DiscountRuleDeletedEnvelope {
773
+ metadata: EventMetadata;
774
+ }
775
+ /**
776
+ * Triggered when a discount rule is deleted.
777
+ * @permissionScope Manage Stores - all permissions
778
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
779
+ * @permissionScope Read eCommerce - all read permissions
780
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
781
+ * @permissionScope Read Stores - all read permissions
782
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
783
+ * @permissionScope Manage Restaurants - all permissions
784
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
785
+ * @permissionScope Manage eCommerce - all permissions
786
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
787
+ * @permissionId ECOM.DISCOUNT_RULES_READ
788
+ * @webhook
789
+ * @eventType wix.ecom.discounts.v1.discount_rule_deleted
790
+ */
791
+ export declare function onDiscountRuleDeleted(handler: (event: DiscountRuleDeletedEnvelope) => void | Promise<void>): void;
792
+ export interface DiscountRuleUpdatedEnvelope {
793
+ entity: DiscountRule;
794
+ metadata: EventMetadata;
795
+ }
796
+ /**
797
+ * Triggered when a discount rule is updated.
798
+ * @permissionScope Manage Stores - all permissions
799
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
800
+ * @permissionScope Read eCommerce - all read permissions
801
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
802
+ * @permissionScope Read Stores - all read permissions
803
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
804
+ * @permissionScope Manage Restaurants - all permissions
805
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
806
+ * @permissionScope Manage eCommerce - all permissions
807
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
808
+ * @permissionId ECOM.DISCOUNT_RULES_READ
809
+ * @webhook
810
+ * @eventType wix.ecom.discounts.v1.discount_rule_updated
811
+ */
812
+ export declare function onDiscountRuleUpdated(handler: (event: DiscountRuleUpdatedEnvelope) => void | Promise<void>): void;
813
+ /**
814
+ * Creates a new discount rule.
815
+ *
816
+ *
817
+ * The `createDiscountRule()` function returns a Promise that resolves to the new discount rule when it's created.
818
+ * @param discountRule - Discount rule info.
819
+ * @public
820
+ * @requiredField discountRule
821
+ * @requiredField discountRule.discounts
822
+ * @requiredField discountRule.name
823
+ * @permissionId ECOM.DISCOUNT_RULES_CREATE
824
+ * @permissionScope Manage Stores - all permissions
825
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
826
+ * @permissionScope Manage Restaurants - all permissions
827
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
828
+ * @permissionScope Manage eCommerce - all permissions
829
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
830
+ * @applicableIdentity APP
831
+ * @returns Discount rule.
832
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.CreateDiscountRule
833
+ */
834
+ export declare function createDiscountRule(discountRule: DiscountRule): Promise<DiscountRule & DiscountRuleNonNullableFields>;
835
+ /**
836
+ * Retrieves a discount rule.
837
+ *
838
+ *
839
+ * The `getDiscountRule()` function returns a Promise that resolves when the specified discount rule is retrieved.
840
+ * @param discountRuleId - ID of the discount rule to retrieve.
841
+ * @public
842
+ * @requiredField discountRuleId
843
+ * @permissionId ECOM.DISCOUNT_RULES_READ
844
+ * @permissionScope Manage Stores - all permissions
845
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
846
+ * @permissionScope Read eCommerce - all read permissions
847
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
848
+ * @permissionScope Read Stores - all read permissions
849
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
850
+ * @permissionScope Manage Restaurants - all permissions
851
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
852
+ * @permissionScope Manage eCommerce - all permissions
853
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
854
+ * @applicableIdentity APP
855
+ * @returns The requested discount rule.
856
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.GetDiscountRule
857
+ */
858
+ export declare function getDiscountRule(discountRuleId: string): Promise<DiscountRule & DiscountRuleNonNullableFields>;
859
+ /**
860
+ * Updates a discount rule's properties.
861
+ *
862
+ *
863
+ * The `updateDiscountRule()` function returns a Promise that resolves when the specified discount rule's properties are updated.
864
+ *
865
+ * 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.
866
+ * @param _id - Discount rule ID.
867
+ * @public
868
+ * @requiredField _id
869
+ * @requiredField discountRule
870
+ * @requiredField discountRule.revision
871
+ * @param discountRule - Discount rule info.
872
+ * @param options - Discount rule info.
873
+ * @permissionId ECOM.DISCOUNT_RULES_UPDATE
874
+ * @permissionScope Manage Stores - all permissions
875
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
876
+ * @permissionScope Manage Restaurants - all permissions
877
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
878
+ * @permissionScope Manage eCommerce - all permissions
879
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
880
+ * @applicableIdentity APP
881
+ * @returns Updated discount rule.
882
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.UpdateDiscountRule
883
+ */
884
+ export declare function updateDiscountRule(_id: string | null, discountRule: UpdateDiscountRule): Promise<DiscountRule & DiscountRuleNonNullableFields>;
885
+ export interface UpdateDiscountRule {
886
+ /**
887
+ * Discount rule ID.
888
+ * @readonly
889
+ */
890
+ _id?: string | null;
891
+ /**
892
+ * Revision number, which increments by 1 each time the discount rule is updated.
893
+ * To prevent conflicting changes, the current `revision` must be passed when updating the discount rule.
894
+ * @readonly
895
+ */
896
+ revision?: string | null;
897
+ /**
898
+ * Date and time the discount rule was created.
899
+ * @readonly
900
+ */
901
+ _createdDate?: Date | null;
902
+ /**
903
+ * Date and time the discount rule was last updated.
904
+ * @readonly
905
+ */
906
+ _updatedDate?: Date | null;
907
+ /**
908
+ * Whether the discount rule is active.
909
+ *
910
+ * Default: `true`
911
+ */
912
+ active?: boolean | null;
913
+ /** Discount rule name. */
914
+ name?: string | null;
915
+ /**
916
+ * Discount rule trigger.
917
+ * A set of conditions that must be met for the `discounts` to be applied.
918
+ * Not passing a trigger will cause the discount to always apply.
919
+ */
920
+ trigger?: DiscountTrigger;
921
+ /** Time frame in which the discount rule is active. */
922
+ activeTimeInfo?: ActiveTimeInfo;
923
+ /**
924
+ * List of discounts that are applied when one or more triggers are met.
925
+ *
926
+ * > **Notes:**
927
+ * >
928
+ * > + Currently, only 1 discount can be defined per discount rule.
929
+ * > + A discount rule can be applied on multiple items per cart.
930
+ * > + A discount rule can only be applied once per item.
931
+ */
932
+ discounts?: Discounts;
933
+ /**
934
+ * Discount rule status.
935
+ * Default: `UNDEFINED`
936
+ * @readonly
937
+ */
938
+ status?: Status;
939
+ /**
940
+ * Number of times the discount rule was used.
941
+ * @readonly
942
+ */
943
+ usageCount?: number;
944
+ }
945
+ /**
946
+ * Deletes a discount rule.
947
+ *
948
+ *
949
+ * The `deleteDiscountRule()` function returns a Promise that resolves when the specified discount rule is deleted.
950
+ * @param discountRuleId - ID of the discount rule to delete.
951
+ * @public
952
+ * @requiredField discountRuleId
953
+ * @permissionId ECOM.DISCOUNT_RULES_DELETE
954
+ * @permissionScope Manage Stores - all permissions
955
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
956
+ * @permissionScope Manage Restaurants - all permissions
957
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
958
+ * @permissionScope Manage eCommerce - all permissions
959
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
960
+ * @applicableIdentity APP
961
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.DeleteDiscountRule
962
+ */
963
+ export declare function deleteDiscountRule(discountRuleId: string): Promise<void>;
964
+ /**
965
+ * Creates a query to retrieve a list of discount rules.
966
+ *
967
+ *
968
+ * The `queryDiscountRules()` function builds a query to retrieve a list of up to 100 discount rules, and returns a [`DiscountRulesQueryBuilder`](#discountrulesquerybuilder) object.
969
+ *
970
+ * 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.
971
+ *
972
+ * 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.
973
+ *
974
+ * By default, `queryDiscountRules()` sorts results by [`ascending("_id")`](/discount-rules/discount-rules-query-builder/ascending) by default. This can be overridden.
975
+ *
976
+ * To learn how to query posts, refer to the table below.
977
+ *
978
+ * 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`.
979
+ * @public
980
+ * @permissionScope Manage Stores - all permissions
981
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
982
+ * @permissionScope Read eCommerce - all read permissions
983
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
984
+ * @permissionScope Read Stores - all read permissions
985
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
986
+ * @permissionScope Manage Restaurants - all permissions
987
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
988
+ * @permissionScope Manage eCommerce - all permissions
989
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
990
+ * @permissionId ECOM.DISCOUNT_RULES_READ
991
+ * @applicableIdentity APP
992
+ * @fqn com.wix.ecom.discounts.DiscountRuleService.QueryDiscountRules
993
+ */
994
+ export declare function queryDiscountRules(): DiscountRulesQueryBuilder;
995
+ interface QueryCursorResult {
996
+ cursors: Cursors;
997
+ hasNext: () => boolean;
998
+ hasPrev: () => boolean;
999
+ length: number;
1000
+ pageSize: number;
1001
+ }
1002
+ export interface DiscountRulesQueryResult extends QueryCursorResult {
1003
+ items: DiscountRule[];
1004
+ query: DiscountRulesQueryBuilder;
1005
+ next: () => Promise<DiscountRulesQueryResult>;
1006
+ prev: () => Promise<DiscountRulesQueryResult>;
1007
+ }
1008
+ export interface DiscountRulesQueryBuilder {
1009
+ /** @param propertyName - Property whose value is compared with `value`.
1010
+ * @param value - Value to compare against.
1011
+ */
1012
+ eq: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1013
+ /** @param propertyName - Property whose value is compared with `value`.
1014
+ * @param value - Value to compare against.
1015
+ */
1016
+ ne: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1017
+ /** @param propertyName - Property whose value is compared with `value`.
1018
+ * @param value - Value to compare against.
1019
+ */
1020
+ ge: (propertyName: 'revision' | '_createdDate' | '_updatedDate' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1021
+ /** @param propertyName - Property whose value is compared with `value`.
1022
+ * @param value - Value to compare against.
1023
+ */
1024
+ gt: (propertyName: 'revision' | '_createdDate' | '_updatedDate' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1025
+ /** @param propertyName - Property whose value is compared with `value`.
1026
+ * @param value - Value to compare against.
1027
+ */
1028
+ le: (propertyName: 'revision' | '_createdDate' | '_updatedDate' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1029
+ /** @param propertyName - Property whose value is compared with `value`.
1030
+ * @param value - Value to compare against.
1031
+ */
1032
+ lt: (propertyName: 'revision' | '_createdDate' | '_updatedDate' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1033
+ /** @param propertyName - Property whose value is compared with `string`.
1034
+ * @param string - String to compare against. Case-insensitive.
1035
+ */
1036
+ startsWith: (propertyName: '_id' | 'name', value: string) => DiscountRulesQueryBuilder;
1037
+ /** @param propertyName - Property whose value is compared with `values`.
1038
+ * @param values - List of values to compare against.
1039
+ */
1040
+ hasSome: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any[]) => DiscountRulesQueryBuilder;
1041
+ in: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: any) => DiscountRulesQueryBuilder;
1042
+ exists: (propertyName: '_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end', value: boolean) => DiscountRulesQueryBuilder;
1043
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
1044
+ ascending: (...propertyNames: Array<'_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end'>) => DiscountRulesQueryBuilder;
1045
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
1046
+ descending: (...propertyNames: Array<'_id' | 'revision' | '_createdDate' | '_updatedDate' | 'active' | 'name' | 'activeTimeInfo.start' | 'activeTimeInfo.end'>) => DiscountRulesQueryBuilder;
1047
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */
1048
+ limit: (limit: number) => DiscountRulesQueryBuilder;
1049
+ /** @param cursor - A pointer to specific record */
1050
+ skipTo: (cursor: string) => DiscountRulesQueryBuilder;
1051
+ find: () => Promise<DiscountRulesQueryResult>;
1052
+ }
1053
+ export {};