@commercelayer/app-elements 5.4.2 → 5.5.1

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 (45) hide show
  1. package/dist/CodeEditorComponent-ioY-kydb.js +739 -0
  2. package/dist/{InputDateComponent-BB1cA4uH.js → InputDateComponent-BuVP44xp.js} +1174 -1301
  3. package/dist/RuleEngineComponent-CGOH-VpI.js +1376 -0
  4. package/dist/fetchCoreResourcesSuggestions-CZkDwjO2.js +126 -0
  5. package/dist/helpers/giftCards.d.ts +1 -0
  6. package/dist/helpers/giftCards.test.d.ts +1 -0
  7. package/dist/{main-DvygJyZL.js → main-Dncz1fnB.js} +8819 -8151
  8. package/dist/main.d.ts +3 -0
  9. package/dist/main.js +137 -133
  10. package/dist/parseISO-DFqToJvK.js +120 -0
  11. package/dist/style.css +1 -1
  12. package/dist/tailwind.config.js +5 -5
  13. package/dist/ui/atoms/Icon/icons.d.ts +5 -0
  14. package/dist/ui/composite/ListItem.d.ts +3 -1
  15. package/dist/ui/composite/Timeline.d.ts +1 -0
  16. package/dist/ui/composite/Toast.d.ts +8 -0
  17. package/dist/ui/forms/CodeEditor/CodeEditor.d.ts +2 -1
  18. package/dist/ui/forms/CodeEditor/CodeEditorComponent.d.ts +10 -1
  19. package/dist/ui/forms/CodeEditor/fetchCoreResourcesSuggestions.d.ts +34 -18
  20. package/dist/ui/forms/RuleEngine/Action/ActionListItem.d.ts +6 -0
  21. package/dist/ui/forms/RuleEngine/Action/ActionValue.d.ts +5 -0
  22. package/dist/ui/forms/RuleEngine/Action/index.d.ts +4 -0
  23. package/dist/ui/forms/RuleEngine/Condition/ConditionListItem.d.ts +8 -0
  24. package/dist/ui/forms/RuleEngine/Condition/ConditionMatcher.d.ts +6 -0
  25. package/dist/ui/forms/RuleEngine/Condition/ConditionValue.d.ts +12 -0
  26. package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputArrayMatch.d.ts +6 -0
  27. package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputNumberRange.d.ts +6 -0
  28. package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputTextRange.d.ts +6 -0
  29. package/dist/ui/forms/RuleEngine/Condition/hooks.d.ts +5 -0
  30. package/dist/ui/forms/RuleEngine/Condition/index.d.ts +8 -0
  31. package/dist/ui/forms/RuleEngine/Condition/utils.d.ts +3 -0
  32. package/dist/ui/forms/RuleEngine/RuleEngine.d.ts +3 -0
  33. package/dist/ui/forms/RuleEngine/RuleEngineComponent.d.ts +22 -0
  34. package/dist/ui/forms/RuleEngine/RuleEngineContext.d.ts +18 -0
  35. package/dist/ui/forms/RuleEngine/RuleName.d.ts +1 -0
  36. package/dist/ui/forms/RuleEngine/index.d.ts +2 -0
  37. package/dist/ui/forms/RuleEngine/schema.order_rules.d.ts +335 -0
  38. package/dist/ui/forms/RuleEngine/schema.price_rules.d.ts +286 -0
  39. package/dist/ui/forms/RuleEngine/utils.d.ts +24 -0
  40. package/dist/ui/internals/Overlay.d.ts +13 -0
  41. package/dist/ui/resources/ResourceLineItems/ResourceLineItems.mocks.d.ts +17 -0
  42. package/dist/ui/resources/ResourceListItem/ResourceListItem.mocks.d.ts +24 -0
  43. package/dist/vendor.css +1 -1
  44. package/package.json +6 -2
  45. package/dist/CodeEditorComponent-CZdWLH8G.js +0 -794
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { ItemWithValue } from '../../utils';
3
+ export declare function InputTextRange({ value, onChange }: {
4
+ value: ItemWithValue['value'];
5
+ onChange: (value: [string | null, string | null]) => void;
6
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { atPath } from '../../CodeEditor/fetchCoreResourcesSuggestions';
2
+ import { SchemaConditionItem } from '../utils';
3
+ export declare function useResourcePathInfos(item: SchemaConditionItem | null): {
4
+ infos: Awaited<ReturnType<typeof atPath>> | undefined;
5
+ };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { SchemaCondition } from '../utils';
3
+ export declare function Condition({ item, children, nestingLevel, pathPrefix }: {
4
+ item?: SchemaCondition;
5
+ nestingLevel?: number;
6
+ children?: React.JSX.Element;
7
+ pathPrefix: string;
8
+ }): React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { atPath } from '../../CodeEditor/fetchCoreResourcesSuggestions';
2
+ import { ItemWithValue } from '../utils';
3
+ export declare function guessFieldType(value: ItemWithValue['value'] | undefined): NonNullable<Awaited<ReturnType<typeof atPath>>['field']>['type'];
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { RuleEngineProps } from './RuleEngineComponent';
3
+ export declare const RuleEngine: React.FC<RuleEngineProps>;
@@ -0,0 +1,22 @@
1
+ import { CodeEditorProps } from '../CodeEditor';
2
+ import { InputWrapperBaseProps } from '../../internals/InputWrapper';
3
+ import { default as React } from 'react';
4
+ import { SetOptional, SetRequired } from 'type-fest';
5
+ import { RulesForOrderContext } from './schema.order_rules';
6
+ type Schema = SetRequired<RulesForOrderContext, 'rules'>;
7
+ export interface RuleEngineProps extends Omit<InputWrapperBaseProps, 'label' | 'inline'>, SetOptional<Pick<HTMLInputElement, 'id' | 'name'>, 'id' | 'name'>, Pick<CodeEditorProps, 'defaultValue' | 'value'> {
8
+ /**
9
+ * Default value for the CodeEditor visibility.
10
+ * If not provided, the CodeEditor will be hidden by default.
11
+ * @default false
12
+ */
13
+ defaultCodeEditorVisible?: boolean;
14
+ /**
15
+ * Triggered when the editor value changes.
16
+ * @param value The new editor value.
17
+ * @returns
18
+ */
19
+ onChange?: (value: Schema) => void;
20
+ }
21
+ export declare function RuleEngine(props: RuleEngineProps): React.JSX.Element;
22
+ export {};
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ import { Schema } from './utils';
3
+ interface State {
4
+ value: Schema;
5
+ selectedRuleIndex: number;
6
+ }
7
+ interface RuleEngineContextType {
8
+ state: State;
9
+ setPath: (path: string, value: unknown) => void;
10
+ setSelectedRuleIndex: (index: number) => void;
11
+ setValue: (value: Schema) => void;
12
+ }
13
+ export declare function RuleEngineProvider({ children, initialValue }: {
14
+ children: React.ReactNode;
15
+ initialValue: Schema;
16
+ }): React.JSX.Element;
17
+ export declare function useRuleEngine(): RuleEngineContextType;
18
+ export {};
@@ -0,0 +1 @@
1
+ export declare function RuleName(): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { RuleEngine } from './RuleEngine';
2
+ export type { RuleEngineProps } from './RuleEngineComponent';
@@ -0,0 +1,335 @@
1
+ /**
2
+ * This file was automatically generated by json-schema-to-typescript.
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
+ * and run json-schema-to-typescript to regenerate this file.
5
+ */
6
+ /**
7
+ * The logic to determine an overall match of the conditions.
8
+ */
9
+ export type ConditionsLogic = "and" | "or";
10
+ /**
11
+ * Policy to determine if a condition is a match. If value is any (default), it will match as long as one fact it's a match, if value is all, it will match if all facts are a match.
12
+ */
13
+ export type Scope = "any" | "all";
14
+ /**
15
+ * Identifier of the group to assign the matches of the condition invoked.
16
+ */
17
+ export type Group = string;
18
+ /**
19
+ * An array who contains all conditions to be evaluated by the engine within the rule.
20
+ */
21
+ export type Conditions = ({
22
+ /**
23
+ * Field to apply the condition.
24
+ */
25
+ field: string;
26
+ /**
27
+ * Matcher to be used against the field and value.
28
+ */
29
+ matcher: "start_with" | "not_start_with" | "end_with" | "not_end_with" | "does_not_match" | "matches" | "multiple" | "eq" | "not_eq" | "lt" | "lteq" | "gt" | "gteq" | "gt_lt" | "gteq_lt" | "gt_lteq" | "gteq_lteq" | "is_in" | "is_not_in" | "array_match";
30
+ scope?: Scope;
31
+ group?: Group;
32
+ value: number | string | boolean | (string | number)[] | {
33
+ /**
34
+ * Items that are in to match in AND logic.
35
+ */
36
+ in_and?: (string | number)[];
37
+ /**
38
+ * Items that are in to match in OR logic.
39
+ */
40
+ in_or?: (string | number)[];
41
+ /**
42
+ * Items that are not in to match in AND logic.
43
+ */
44
+ not_in_and?: (string | number)[];
45
+ /**
46
+ * Items that are not to match in OR logic.
47
+ */
48
+ not_in_or?: (string | number)[];
49
+ };
50
+ /**
51
+ * Aggregation conditions to execute within the result of the existing condition.
52
+ */
53
+ aggregations?: Aggregation[];
54
+ /**
55
+ * Nested conditions to be evaluated within the context of the main condition.
56
+ */
57
+ nested?: {
58
+ conditions_logic?: ConditionsLogic;
59
+ conditions?: Conditions;
60
+ [k: string]: unknown;
61
+ };
62
+ } | {
63
+ /**
64
+ * Field to apply the condition.
65
+ */
66
+ field: string;
67
+ /**
68
+ * Matcher to be used against the field.
69
+ */
70
+ matcher: "blank" | "present" | "null" | "not_null";
71
+ scope?: Scope;
72
+ group?: Group;
73
+ /**
74
+ * Aggregation conditions to execute within the result of the existing condition.
75
+ */
76
+ aggregations?: Aggregation[];
77
+ /**
78
+ * Nested conditions to be evaluated within the context of the main condition.
79
+ */
80
+ nested?: {
81
+ conditions_logic?: ConditionsLogic;
82
+ conditions?: Conditions;
83
+ [k: string]: unknown;
84
+ };
85
+ })[];
86
+ /**
87
+ * The resource on which to apply the action (expressed in dot notation). Can be an attribute if you set also the identifier key.
88
+ */
89
+ export type Selector = string;
90
+ /**
91
+ * An identifier value to address one or more specific instances based on the attribute defined in the selector key (if any). Cannot be used if the selector is a resource.
92
+ */
93
+ export type Identifier = string;
94
+ /**
95
+ * The groups on which to apply the action (must be one or more among the ones defined when grouping the matches of the related conditions).
96
+ */
97
+ export type Groups = string[];
98
+ /**
99
+ * If provided, applies the action to a specific attribute instead of the default one.
100
+ */
101
+ export type ApplyOn = string;
102
+ /**
103
+ * Creates bundles based on the groups provided.
104
+ */
105
+ export type Bundle = {
106
+ /**
107
+ * The criteria to be used to select the matches and create the bundles across groups.
108
+ */
109
+ type?: "balanced";
110
+ sort: Sort;
111
+ } | {
112
+ /**
113
+ * The criteria to be used to select the matches and create the bundles across groups.
114
+ */
115
+ type?: "every";
116
+ sort: Sort;
117
+ /**
118
+ * Value to be used to do the bundle every calculation.
119
+ */
120
+ value: number;
121
+ };
122
+ /**
123
+ * Rules payload within order context for the rules engine of Commerce Layer.
124
+ */
125
+ export interface RulesForOrderContext {
126
+ /**
127
+ * Main container with all rules.
128
+ */
129
+ rules?: {
130
+ /**
131
+ * Identifier of the rule, recommended to use UUID.
132
+ */
133
+ id?: string;
134
+ /**
135
+ * Name of the rule
136
+ */
137
+ name: string;
138
+ /**
139
+ * The priority order of the rule evaluation.
140
+ */
141
+ priority?: number;
142
+ conditions_logic?: ConditionsLogic;
143
+ conditions: Conditions;
144
+ /**
145
+ * Array of actions that will be executed if the rule it's a match.
146
+ */
147
+ actions: ({
148
+ /**
149
+ * The type of action you want to apply.
150
+ */
151
+ type: "percentage";
152
+ selector: Selector;
153
+ identifier?: Identifier;
154
+ groups: Groups;
155
+ aggregation?: Aggregation;
156
+ /**
157
+ * Percentage to be discounted,
158
+ */
159
+ value: number;
160
+ apply_on?: ApplyOn;
161
+ bundle?: Bundle;
162
+ } | {
163
+ /**
164
+ * The type of action you want to apply.
165
+ */
166
+ type: "percentage";
167
+ selector: Selector;
168
+ identifier?: Identifier;
169
+ groups?: Groups;
170
+ aggregation?: Aggregation;
171
+ /**
172
+ * Percentage to be discounted,
173
+ */
174
+ value: number;
175
+ apply_on?: ApplyOn;
176
+ limit?: Limit;
177
+ } | {
178
+ /**
179
+ * The type of action you want to apply.
180
+ */
181
+ type: "fixed_amount";
182
+ selector: Selector;
183
+ identifier?: Identifier;
184
+ groups: Groups;
185
+ aggregation?: Aggregation;
186
+ /**
187
+ * The discount fixed amount to be applied.
188
+ */
189
+ value: number;
190
+ bundle?: Bundle;
191
+ apply_on?: ApplyOn;
192
+ /**
193
+ * The type of distribution of the discount over the items.
194
+ */
195
+ discount_mode?: "distributed" | "default";
196
+ } | {
197
+ /**
198
+ * The type of action you want to apply.
199
+ */
200
+ type: "fixed_amount";
201
+ selector: Selector;
202
+ identifier?: Identifier;
203
+ groups?: Groups;
204
+ aggregation?: Aggregation;
205
+ /**
206
+ * The discount fixed amount to be applied.
207
+ */
208
+ value: number;
209
+ apply_on?: ApplyOn;
210
+ limit?: Limit;
211
+ /**
212
+ * The type of distribution of the discount over the items.
213
+ */
214
+ discount_mode?: "distributed" | "default";
215
+ } | {
216
+ /**
217
+ * The type of action you want to apply.
218
+ */
219
+ type: "fixed_price";
220
+ selector: Selector;
221
+ identifier?: Identifier;
222
+ groups: Groups;
223
+ aggregation?: Aggregation;
224
+ /**
225
+ * The price fixed amount to be applied.
226
+ */
227
+ value: number;
228
+ bundle?: Bundle;
229
+ apply_on?: ApplyOn;
230
+ } | {
231
+ /**
232
+ * The type of action you want to apply.
233
+ */
234
+ type: "fixed_price";
235
+ selector: Selector;
236
+ identifier?: Identifier;
237
+ groups?: Groups;
238
+ aggregation?: Aggregation;
239
+ /**
240
+ * The price fixed amount to be applied.
241
+ */
242
+ value: number;
243
+ apply_on?: ApplyOn;
244
+ limit?: Limit;
245
+ } | {
246
+ /**
247
+ * The type of action you want to apply.
248
+ */
249
+ type: "buy_x_pay_y";
250
+ selector?: Selector;
251
+ identifier?: Identifier;
252
+ groups?: Groups;
253
+ aggregation?: Aggregation;
254
+ value: {
255
+ /**
256
+ * The buy X part of the action
257
+ */
258
+ x: number;
259
+ /**
260
+ * The pay Y part of the action.
261
+ */
262
+ y: number;
263
+ /**
264
+ * Max number of items to consider for the calculation.
265
+ */
266
+ result_item_limit?: number;
267
+ [k: string]: unknown;
268
+ };
269
+ } | {
270
+ /**
271
+ * The type of action you want to apply.
272
+ */
273
+ type: "every_x_discount_y";
274
+ selector: Selector;
275
+ identifier?: Identifier;
276
+ groups?: Groups;
277
+ aggregation?: Aggregation;
278
+ value: {
279
+ /**
280
+ * Amount to discount every.
281
+ */
282
+ x: number;
283
+ /**
284
+ * Amount to be discounted to each interval.
285
+ */
286
+ y: number;
287
+ /**
288
+ * Uses the field to do the calculation for the action.
289
+ */
290
+ attribute: string;
291
+ [k: string]: unknown;
292
+ };
293
+ })[];
294
+ }[];
295
+ [k: string]: unknown;
296
+ }
297
+ export interface Aggregation {
298
+ /**
299
+ * Field to apply the condition.
300
+ */
301
+ field: string;
302
+ /**
303
+ * Matcher to be used against the field and value.
304
+ */
305
+ matcher: "multiple" | "eq" | "not_eq" | "lt" | "lteq" | "gt" | "gteq";
306
+ value: number;
307
+ /**
308
+ * Operator to aggregate over previous results.
309
+ */
310
+ operator: "sum" | "min" | "max" | "count" | "count_uniq";
311
+ }
312
+ /**
313
+ * Sorting configuration for the given function
314
+ */
315
+ export interface Sort {
316
+ /**
317
+ * The field to apply the sorting.
318
+ */
319
+ attribute: string;
320
+ /**
321
+ * The sort criteria to be used.
322
+ */
323
+ direction: "asc" | "desc";
324
+ [k: string]: unknown;
325
+ }
326
+ /**
327
+ * Restriction on how many resources will be affected by the action.
328
+ */
329
+ export interface Limit {
330
+ /**
331
+ * The number of items to return based on the limit type.
332
+ */
333
+ value: number;
334
+ sort: Sort;
335
+ }
@@ -0,0 +1,286 @@
1
+ /**
2
+ * This file was automatically generated by json-schema-to-typescript.
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
+ * and run json-schema-to-typescript to regenerate this file.
5
+ */
6
+ /**
7
+ * The logic to determine an overall match of the conditions.
8
+ */
9
+ export type ConditionsLogic = "and" | "or";
10
+ /**
11
+ * Policy to determine if a condition is a match. If value is any (default), it will match as long as one fact it's a match, if value is all, it will match if all facts are a match.
12
+ */
13
+ export type Scope = "any" | "all";
14
+ /**
15
+ * Identifier of the group to assign the matches of the condition invoked.
16
+ */
17
+ export type Group = string;
18
+ /**
19
+ * An array who contains all conditions to be evaluated by the engine within the rule.
20
+ */
21
+ export type Conditions = ({
22
+ /**
23
+ * Field to apply the condition.
24
+ */
25
+ field: string;
26
+ /**
27
+ * Matcher to be used against the field and value.
28
+ */
29
+ matcher: "start_with" | "not_start_with" | "end_with" | "not_end_with" | "does_not_match" | "matches" | "multiple" | "eq" | "not_eq" | "lt" | "lteq" | "gt" | "gteq" | "gt_lt" | "gteq_lt" | "gt_lteq" | "gteq_lteq" | "is_in" | "is_not_in" | "array_match";
30
+ scope?: Scope;
31
+ group?: Group;
32
+ value: number | string | boolean | (string | number)[] | {
33
+ /**
34
+ * Items that are in to match in AND logic.
35
+ */
36
+ in_and?: (string | number)[];
37
+ /**
38
+ * Items that are in to match in OR logic.
39
+ */
40
+ in_or?: (string | number)[];
41
+ /**
42
+ * Items that are not in to match in AND logic.
43
+ */
44
+ not_in_and?: (string | number)[];
45
+ /**
46
+ * Items that are not to match in OR logic.
47
+ */
48
+ not_in_or?: (string | number)[];
49
+ };
50
+ /**
51
+ * Aggregation conditions to execute within the result of the existing condition.
52
+ */
53
+ aggregations?: Aggregation[];
54
+ /**
55
+ * Nested conditions to be evaluated within the context of the main condition.
56
+ */
57
+ nested?: {
58
+ conditions_logic?: ConditionsLogic;
59
+ conditions?: Conditions;
60
+ [k: string]: unknown;
61
+ };
62
+ } | {
63
+ /**
64
+ * Field to apply the condition.
65
+ */
66
+ field: string;
67
+ /**
68
+ * Matcher to be used against the field.
69
+ */
70
+ matcher: "blank" | "present" | "null" | "not_null";
71
+ scope?: Scope;
72
+ group?: Group;
73
+ /**
74
+ * Aggregation conditions to execute within the result of the existing condition.
75
+ */
76
+ aggregations?: Aggregation[];
77
+ /**
78
+ * Nested conditions to be evaluated within the context of the main condition.
79
+ */
80
+ nested?: {
81
+ conditions_logic?: ConditionsLogic;
82
+ conditions?: Conditions;
83
+ [k: string]: unknown;
84
+ };
85
+ })[];
86
+ /**
87
+ * The resource on which to apply the action (expressed in dot notation). Can be an attribute if you set also the identifier key.
88
+ */
89
+ export type Selector = string;
90
+ /**
91
+ * An identifier value to address one or more specific instances based on the attribute defined in the selector key (if any). Cannot be used if the selector is a resource.
92
+ */
93
+ export type Identifier = string;
94
+ /**
95
+ * The groups on which to apply the action (must be one or more among the ones defined when grouping the matches of the related conditions).
96
+ */
97
+ export type Groups = string[];
98
+ /**
99
+ * If provided, applies the action to a specific attribute instead of the default one.
100
+ */
101
+ export type ApplyOn = string;
102
+ /**
103
+ * Creates bundles based on the groups provided.
104
+ */
105
+ export type Bundle = {
106
+ /**
107
+ * The criteria to be used to select the matches and create the bundles across groups.
108
+ */
109
+ type?: "balanced";
110
+ sort: Sort;
111
+ } | {
112
+ /**
113
+ * The criteria to be used to select the matches and create the bundles across groups.
114
+ */
115
+ type?: "every";
116
+ sort: Sort;
117
+ /**
118
+ * Value to be used to do the bundle every calculation.
119
+ */
120
+ value: number;
121
+ };
122
+ /**
123
+ * Rules payload within price context for the rules engine of Commerce Layer.
124
+ */
125
+ export interface RulesForPriceContext {
126
+ /**
127
+ * Main container with all rules.
128
+ */
129
+ rules?: {
130
+ /**
131
+ * Identifier of the rule, recommended to use UUID.
132
+ */
133
+ id?: string;
134
+ name: {
135
+ [k: string]: unknown;
136
+ };
137
+ /**
138
+ * The priority order of the rule evaluation.
139
+ */
140
+ priority?: number;
141
+ conditions_logic?: ConditionsLogic;
142
+ conditions: Conditions;
143
+ /**
144
+ * Array of actions that will be executed if the rule it's a match.
145
+ */
146
+ actions: ({
147
+ /**
148
+ * The type of action you want to apply.
149
+ */
150
+ type: "percentage";
151
+ selector: Selector;
152
+ identifier?: Identifier;
153
+ groups: Groups;
154
+ aggregation?: Aggregation;
155
+ /**
156
+ * Percentage to be discounted,
157
+ */
158
+ value: number;
159
+ apply_on?: ApplyOn;
160
+ bundle?: Bundle;
161
+ } | {
162
+ /**
163
+ * The type of action you want to apply.
164
+ */
165
+ type: "percentage";
166
+ selector: Selector;
167
+ identifier?: Identifier;
168
+ groups?: Groups;
169
+ aggregation?: Aggregation;
170
+ /**
171
+ * Percentage to be discounted,
172
+ */
173
+ value: number;
174
+ apply_on?: ApplyOn;
175
+ limit?: Limit;
176
+ } | {
177
+ /**
178
+ * The type of action you want to apply.
179
+ */
180
+ type: "fixed_amount";
181
+ selector: Selector;
182
+ identifier?: Identifier;
183
+ groups: Groups;
184
+ aggregation?: Aggregation;
185
+ /**
186
+ * The discount fixed amount to be applied.
187
+ */
188
+ value: number;
189
+ bundle?: Bundle;
190
+ apply_on?: ApplyOn;
191
+ /**
192
+ * The type of distribution of the discount over the items.
193
+ */
194
+ discount_mode?: ["distributed", "default"];
195
+ } | {
196
+ /**
197
+ * The type of action you want to apply.
198
+ */
199
+ type: "fixed_amount";
200
+ selector: Selector;
201
+ identifier?: Identifier;
202
+ groups?: Groups;
203
+ aggregation?: Aggregation;
204
+ /**
205
+ * The discount fixed amount to be applied.
206
+ */
207
+ value: number;
208
+ apply_on?: ApplyOn;
209
+ limit?: Limit;
210
+ /**
211
+ * The type of distribution of the discount over the items.
212
+ */
213
+ discount_mode?: ["distributed", "default"];
214
+ } | {
215
+ /**
216
+ * The type of action you want to apply.
217
+ */
218
+ type: "fixed_price";
219
+ selector: Selector;
220
+ identifier?: Identifier;
221
+ groups: Groups;
222
+ aggregation?: Aggregation;
223
+ /**
224
+ * The price fixed amount to be applied.
225
+ */
226
+ value: number;
227
+ bundle?: Bundle;
228
+ apply_on?: ApplyOn;
229
+ } | {
230
+ /**
231
+ * The type of action you want to apply.
232
+ */
233
+ type: "fixed_price";
234
+ selector: Selector;
235
+ identifier?: Identifier;
236
+ groups?: Groups;
237
+ aggregation?: Aggregation;
238
+ /**
239
+ * The price fixed amount to be applied.
240
+ */
241
+ value: number;
242
+ apply_on?: ApplyOn;
243
+ limit?: Limit;
244
+ })[];
245
+ }[];
246
+ [k: string]: unknown;
247
+ }
248
+ export interface Aggregation {
249
+ /**
250
+ * Field to apply the condition.
251
+ */
252
+ field: string;
253
+ /**
254
+ * Matcher to be used against the field and value.
255
+ */
256
+ matcher: "multiple" | "eq" | "not_eq" | "lt" | "lteq" | "gt" | "gteq";
257
+ value: number;
258
+ /**
259
+ * Operator to aggregate over previous results.
260
+ */
261
+ operator: "sum" | "min" | "max" | "count" | "count_uniq";
262
+ }
263
+ /**
264
+ * Sorting configuration for the given function
265
+ */
266
+ export interface Sort {
267
+ /**
268
+ * The field to apply the sorting.
269
+ */
270
+ attribute: string;
271
+ /**
272
+ * The sort criteria to be used.
273
+ */
274
+ direction: "asc" | "desc";
275
+ [k: string]: unknown;
276
+ }
277
+ /**
278
+ * Restriction on how many resources will be affected by the action.
279
+ */
280
+ export interface Limit {
281
+ /**
282
+ * The number of items to return based on the limit type.
283
+ */
284
+ value: number;
285
+ sort: Sort;
286
+ }