-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.d.ts
56 lines (49 loc) · 1.07 KB
/
globals.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
declare type CreatorType = 'brand' | 'author' | 'manufacturer'
declare type Product = {
id: string
name: string
desc: string
creatorId: string
creatorType: CreatorType
supplierId: string
categories: string[]
keywords: string[]
metadata?: Record<string, string | string[] | number>
price: number
}
declare type RuleType = 'increase' | 'discount' | 'link'
declare type LinkedProductAction =
| 'buy-1-get-1-free'
| 'buy-2-get-1-free'
| 'half-price-discount'
declare type RuleAction = {
type: RuleType
value?: number
linkedProductIds?: string[]
linkAction?: LinkedProductAction
}
declare type Criteria = Partial<
Record<
keyof Omit<Product, 'price' | 'metadata' | 'desc' | 'creatorType'>,
string[]
>
>
declare type ProductRule = {
id?: string
name: string
inclusions: Criteria
exclusions: Criteria
temporal?: {
start: number
end: number | 'onwards'
}
action: RuleAction
}
declare type OutcomeAction = RuleAction & {
active: boolean
ruleId: string
}
declare type Outcome = {
productId: string
actions: OutcomeAction[]
}