@open-tender/types 0.2.0 → 0.2.2

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.
@@ -1,4 +1,19 @@
1
1
  import { NutritionalInfo } from './menu';
2
+ import { OrderItemPoints } from './order';
3
+ export interface BaseItemGroup {
4
+ id: number;
5
+ name: string;
6
+ options: BaseItem[];
7
+ }
8
+ export declare type BaseItemGroups = BaseItemGroup[];
9
+ export interface BaseItem {
10
+ id: number;
11
+ name: string;
12
+ quantity: number;
13
+ price: string | number;
14
+ groups: BaseItemGroups;
15
+ }
16
+ export declare type BaseItems = BaseItem[];
2
17
  export interface CartItemOption {
3
18
  allergens: string[];
4
19
  cals: number | null;
@@ -25,6 +40,7 @@ export interface CartItemOption {
25
40
  totalPoints: number | null;
26
41
  totalPrice: number | null;
27
42
  }
43
+ export declare type CartItemOptions = CartItemOption[];
28
44
  export interface CartItemOptionWithIndex extends CartItemOption {
29
45
  index: number;
30
46
  }
@@ -38,7 +54,10 @@ export interface CartItem extends Omit<CartItemOption, 'isDefault'> {
38
54
  similarItems: number[];
39
55
  upsellItems: number[];
40
56
  }
41
- export declare type CartItemOptions = CartItemOption[];
57
+ export interface CartItemWithPoints extends Omit<CartItem, 'points'> {
58
+ points: OrderItemPoints | null;
59
+ }
60
+ export declare type CartWithPoints = CartItemWithPoints[];
42
61
  export interface CartItemGroup {
43
62
  description: string | null;
44
63
  id: number;
@@ -61,6 +80,17 @@ export declare type CartItemGroupLookupOptions = Omit<CartItemGroup, 'options'>
61
80
  options: CartItemOptionLookup;
62
81
  };
63
82
  export declare type CartItemGroupLookup = Record<string, CartItemGroupLookupOptions>;
83
+ export interface CartItemWithErrors extends CartItem {
84
+ missingGroups: CartItemGroupLookupOptions[];
85
+ invalidGroups: CartItemGroups;
86
+ missingOptions: CartItemOptions;
87
+ invalidOptions: CartItemOptions;
88
+ }
89
+ export declare type CartWithErrors = CartItemWithErrors[];
90
+ export interface CartErrors {
91
+ missingItems: Cart;
92
+ invalidItems: CartWithErrors;
93
+ }
64
94
  export interface PosCartItem extends CartItem {
65
95
  item_no: number;
66
96
  line_no: number;
@@ -21,8 +21,14 @@ export interface CreditCardData {
21
21
  is_default?: boolean;
22
22
  token?: string;
23
23
  }
24
+ export interface CreditCardErrors {
25
+ acct?: string;
26
+ exp?: string;
27
+ cvv?: string;
28
+ zip?: string;
29
+ }
24
30
  export interface CreditCardValidate {
25
31
  card: CreditCardData;
26
32
  cardType: CardType;
27
- errors: Partial<CreditCardData> | null;
33
+ errors: CreditCardErrors | null;
28
34
  }
@@ -1,4 +1,3 @@
1
- import { CustomerLoyalty } from './loyalty';
2
1
  export interface Auth {
3
2
  access_token: string;
4
3
  expires_in: number;
@@ -16,7 +15,6 @@ export interface Profile {
16
15
  is_verified: boolean;
17
16
  last_name: string;
18
17
  phone: string;
19
- program: CustomerLoyalty;
20
18
  }
21
19
  export interface LoginData {
22
20
  email: string;
@@ -37,6 +37,12 @@ export interface LoyaltyThreshold {
37
37
  points: number;
38
38
  description: string;
39
39
  }
40
+ export declare type LoyaltyThresholds = LoyaltyThreshold[];
41
+ export interface LoyaltyThresholdAugmented extends LoyaltyThreshold {
42
+ percentage: number;
43
+ isFilled: boolean;
44
+ }
45
+ export declare type LoyaltyThresholdsAugmented = LoyaltyThresholdAugmented[];
40
46
  export interface LoyaltyDiscount {
41
47
  amount: string;
42
48
  description: string;
@@ -54,6 +60,7 @@ export interface LoyaltyTier {
54
60
  points: any;
55
61
  value: any;
56
62
  }
63
+ export declare type LoyaltyTiers = LoyaltyTier[];
57
64
  export interface CustomerLoyalty {
58
65
  credit: LoyaltyCredit | null;
59
66
  description: string;
@@ -64,8 +71,8 @@ export interface CustomerLoyalty {
64
71
  remaining: string | null;
65
72
  spend: LoyaltySpend;
66
73
  status: LoyaltyStatus;
67
- thresholds: Array<LoyaltyThreshold>;
68
- tiers: Array<LoyaltyTier>;
74
+ thresholds: LoyaltyThresholds;
75
+ tiers: LoyaltyTiers;
69
76
  towards: string | null;
70
77
  }
71
- export declare type CustomerLoyalties = Array<CustomerLoyalty>;
78
+ export declare type CustomerLoyalties = CustomerLoyalty[];
@@ -1,5 +1,6 @@
1
1
  import { RequestedAt } from '../datetimes';
2
2
  import { Decimal, Money, ServiceType, TaxTypeInt, Temperature } from '../global';
3
+ import { Cart, CartErrors } from './cart';
3
4
  export interface NutritionalInfo {
4
5
  calories: number;
5
6
  cholesterol: number;
@@ -145,6 +146,10 @@ export interface MenuVars {
145
146
  serviceType: ServiceType;
146
147
  requestedAt: RequestedAt;
147
148
  }
149
+ export interface MenuCartErrors {
150
+ newCart: Cart;
151
+ errors: CartErrors | null;
152
+ }
148
153
  export interface DiscountedItem {
149
154
  id: number;
150
155
  category_id: number;
@@ -4,6 +4,13 @@ import { CreditCard } from './creditCards';
4
4
  import { Address } from './customer';
5
5
  import { PrepStatus } from './kds';
6
6
  import { NutritionalInfo } from './menu';
7
+ export interface OrderItemPoints {
8
+ applied: number;
9
+ available: number;
10
+ index?: number;
11
+ per: number;
12
+ total: number;
13
+ }
7
14
  export interface OrderItem {
8
15
  allergens: string[];
9
16
  description: string | null;
@@ -15,7 +22,7 @@ export interface OrderItem {
15
22
  name: string;
16
23
  notes?: string | null;
17
24
  nutritional_info: NutritionalInfo | null;
18
- points?: number | null;
25
+ points?: OrderItemPoints | null;
19
26
  price: Money;
20
27
  price_total: Money;
21
28
  quantity: number;
@@ -138,6 +145,13 @@ export interface OrderRating {
138
145
  comments: string | null;
139
146
  rating: number;
140
147
  }
148
+ export interface OrderRating {
149
+ comments: string | null;
150
+ rating: number;
151
+ }
152
+ export interface OrderRatingWithOrder extends OrderRating {
153
+ order_id: number;
154
+ }
141
155
  export interface OrderRevenueCenterAddress {
142
156
  city: string;
143
157
  lat: number;
@@ -7,7 +7,7 @@ export interface RevenueCenterParams {
7
7
  lng?: number;
8
8
  requestedAt?: string;
9
9
  }
10
- export declare type RevenueCenterType = 'POS' | 'OLO' | 'CATERING';
10
+ export declare type RevenueCenterType = 'OLO' | 'CATERING';
11
11
  export interface RevenueCenterAddress {
12
12
  city: string;
13
13
  cross_streets: string;
@@ -354,6 +354,7 @@ export interface ThemeLink extends Record<string, string> {
354
354
  color: string;
355
355
  hover: string;
356
356
  }
357
+ export declare type ThemeLinkType = 'customize' | 'dark' | 'light' | 'primary';
357
358
  export interface ThemeLinks extends Record<string, string | ThemeLink> {
358
359
  customize: ThemeLink;
359
360
  dark: ThemeLink;
@@ -15,7 +15,7 @@ export interface Input {
15
15
  autoComplete?: string;
16
16
  children?: JSX.Element;
17
17
  disabled?: boolean;
18
- error?: string;
18
+ error?: string | null;
19
19
  icon?: JSX.Element;
20
20
  label?: string;
21
21
  max?: number;
@@ -34,7 +34,7 @@ export interface Input {
34
34
  }
35
35
  export interface Select {
36
36
  disabled?: boolean;
37
- error: string;
37
+ error?: string | null;
38
38
  label: string;
39
39
  name: string;
40
40
  onChange?: React.ChangeEventHandler<HTMLSelectElement>;
@@ -59,7 +59,7 @@ export interface Switch {
59
59
  }
60
60
  export interface Textarea {
61
61
  disabled?: boolean;
62
- error?: string;
62
+ error?: string | null;
63
63
  icon?: JSX.Element;
64
64
  label: string;
65
65
  name: string;
@@ -1,4 +1,19 @@
1
1
  import { NutritionalInfo } from './menu';
2
+ import { OrderItemPoints } from './order';
3
+ export interface BaseItemGroup {
4
+ id: number;
5
+ name: string;
6
+ options: BaseItem[];
7
+ }
8
+ export declare type BaseItemGroups = BaseItemGroup[];
9
+ export interface BaseItem {
10
+ id: number;
11
+ name: string;
12
+ quantity: number;
13
+ price: string | number;
14
+ groups: BaseItemGroups;
15
+ }
16
+ export declare type BaseItems = BaseItem[];
2
17
  export interface CartItemOption {
3
18
  allergens: string[];
4
19
  cals: number | null;
@@ -25,6 +40,7 @@ export interface CartItemOption {
25
40
  totalPoints: number | null;
26
41
  totalPrice: number | null;
27
42
  }
43
+ export declare type CartItemOptions = CartItemOption[];
28
44
  export interface CartItemOptionWithIndex extends CartItemOption {
29
45
  index: number;
30
46
  }
@@ -38,7 +54,10 @@ export interface CartItem extends Omit<CartItemOption, 'isDefault'> {
38
54
  similarItems: number[];
39
55
  upsellItems: number[];
40
56
  }
41
- export declare type CartItemOptions = CartItemOption[];
57
+ export interface CartItemWithPoints extends Omit<CartItem, 'points'> {
58
+ points: OrderItemPoints | null;
59
+ }
60
+ export declare type CartWithPoints = CartItemWithPoints[];
42
61
  export interface CartItemGroup {
43
62
  description: string | null;
44
63
  id: number;
@@ -61,6 +80,17 @@ export declare type CartItemGroupLookupOptions = Omit<CartItemGroup, 'options'>
61
80
  options: CartItemOptionLookup;
62
81
  };
63
82
  export declare type CartItemGroupLookup = Record<string, CartItemGroupLookupOptions>;
83
+ export interface CartItemWithErrors extends CartItem {
84
+ missingGroups: CartItemGroupLookupOptions[];
85
+ invalidGroups: CartItemGroups;
86
+ missingOptions: CartItemOptions;
87
+ invalidOptions: CartItemOptions;
88
+ }
89
+ export declare type CartWithErrors = CartItemWithErrors[];
90
+ export interface CartErrors {
91
+ missingItems: Cart;
92
+ invalidItems: CartWithErrors;
93
+ }
64
94
  export interface PosCartItem extends CartItem {
65
95
  item_no: number;
66
96
  line_no: number;
@@ -21,8 +21,14 @@ export interface CreditCardData {
21
21
  is_default?: boolean;
22
22
  token?: string;
23
23
  }
24
+ export interface CreditCardErrors {
25
+ acct?: string;
26
+ exp?: string;
27
+ cvv?: string;
28
+ zip?: string;
29
+ }
24
30
  export interface CreditCardValidate {
25
31
  card: CreditCardData;
26
32
  cardType: CardType;
27
- errors: Partial<CreditCardData> | null;
33
+ errors: CreditCardErrors | null;
28
34
  }
@@ -1,4 +1,3 @@
1
- import { CustomerLoyalty } from './loyalty';
2
1
  export interface Auth {
3
2
  access_token: string;
4
3
  expires_in: number;
@@ -16,7 +15,6 @@ export interface Profile {
16
15
  is_verified: boolean;
17
16
  last_name: string;
18
17
  phone: string;
19
- program: CustomerLoyalty;
20
18
  }
21
19
  export interface LoginData {
22
20
  email: string;
@@ -37,6 +37,12 @@ export interface LoyaltyThreshold {
37
37
  points: number;
38
38
  description: string;
39
39
  }
40
+ export declare type LoyaltyThresholds = LoyaltyThreshold[];
41
+ export interface LoyaltyThresholdAugmented extends LoyaltyThreshold {
42
+ percentage: number;
43
+ isFilled: boolean;
44
+ }
45
+ export declare type LoyaltyThresholdsAugmented = LoyaltyThresholdAugmented[];
40
46
  export interface LoyaltyDiscount {
41
47
  amount: string;
42
48
  description: string;
@@ -54,6 +60,7 @@ export interface LoyaltyTier {
54
60
  points: any;
55
61
  value: any;
56
62
  }
63
+ export declare type LoyaltyTiers = LoyaltyTier[];
57
64
  export interface CustomerLoyalty {
58
65
  credit: LoyaltyCredit | null;
59
66
  description: string;
@@ -64,8 +71,8 @@ export interface CustomerLoyalty {
64
71
  remaining: string | null;
65
72
  spend: LoyaltySpend;
66
73
  status: LoyaltyStatus;
67
- thresholds: Array<LoyaltyThreshold>;
68
- tiers: Array<LoyaltyTier>;
74
+ thresholds: LoyaltyThresholds;
75
+ tiers: LoyaltyTiers;
69
76
  towards: string | null;
70
77
  }
71
- export declare type CustomerLoyalties = Array<CustomerLoyalty>;
78
+ export declare type CustomerLoyalties = CustomerLoyalty[];
@@ -1,5 +1,6 @@
1
1
  import { RequestedAt } from '../datetimes';
2
2
  import { Decimal, Money, ServiceType, TaxTypeInt, Temperature } from '../global';
3
+ import { Cart, CartErrors } from './cart';
3
4
  export interface NutritionalInfo {
4
5
  calories: number;
5
6
  cholesterol: number;
@@ -145,6 +146,10 @@ export interface MenuVars {
145
146
  serviceType: ServiceType;
146
147
  requestedAt: RequestedAt;
147
148
  }
149
+ export interface MenuCartErrors {
150
+ newCart: Cart;
151
+ errors: CartErrors | null;
152
+ }
148
153
  export interface DiscountedItem {
149
154
  id: number;
150
155
  category_id: number;
@@ -4,6 +4,13 @@ import { CreditCard } from './creditCards';
4
4
  import { Address } from './customer';
5
5
  import { PrepStatus } from './kds';
6
6
  import { NutritionalInfo } from './menu';
7
+ export interface OrderItemPoints {
8
+ applied: number;
9
+ available: number;
10
+ index?: number;
11
+ per: number;
12
+ total: number;
13
+ }
7
14
  export interface OrderItem {
8
15
  allergens: string[];
9
16
  description: string | null;
@@ -15,7 +22,7 @@ export interface OrderItem {
15
22
  name: string;
16
23
  notes?: string | null;
17
24
  nutritional_info: NutritionalInfo | null;
18
- points?: number | null;
25
+ points?: OrderItemPoints | null;
19
26
  price: Money;
20
27
  price_total: Money;
21
28
  quantity: number;
@@ -138,6 +145,13 @@ export interface OrderRating {
138
145
  comments: string | null;
139
146
  rating: number;
140
147
  }
148
+ export interface OrderRating {
149
+ comments: string | null;
150
+ rating: number;
151
+ }
152
+ export interface OrderRatingWithOrder extends OrderRating {
153
+ order_id: number;
154
+ }
141
155
  export interface OrderRevenueCenterAddress {
142
156
  city: string;
143
157
  lat: number;
@@ -7,7 +7,7 @@ export interface RevenueCenterParams {
7
7
  lng?: number;
8
8
  requestedAt?: string;
9
9
  }
10
- export declare type RevenueCenterType = 'POS' | 'OLO' | 'CATERING';
10
+ export declare type RevenueCenterType = 'OLO' | 'CATERING';
11
11
  export interface RevenueCenterAddress {
12
12
  city: string;
13
13
  cross_streets: string;
@@ -354,6 +354,7 @@ export interface ThemeLink extends Record<string, string> {
354
354
  color: string;
355
355
  hover: string;
356
356
  }
357
+ export declare type ThemeLinkType = 'customize' | 'dark' | 'light' | 'primary';
357
358
  export interface ThemeLinks extends Record<string, string | ThemeLink> {
358
359
  customize: ThemeLink;
359
360
  dark: ThemeLink;
@@ -15,7 +15,7 @@ export interface Input {
15
15
  autoComplete?: string;
16
16
  children?: JSX.Element;
17
17
  disabled?: boolean;
18
- error?: string;
18
+ error?: string | null;
19
19
  icon?: JSX.Element;
20
20
  label?: string;
21
21
  max?: number;
@@ -34,7 +34,7 @@ export interface Input {
34
34
  }
35
35
  export interface Select {
36
36
  disabled?: boolean;
37
- error: string;
37
+ error?: string | null;
38
38
  label: string;
39
39
  name: string;
40
40
  onChange?: React.ChangeEventHandler<HTMLSelectElement>;
@@ -59,7 +59,7 @@ export interface Switch {
59
59
  }
60
60
  export interface Textarea {
61
61
  disabled?: boolean;
62
- error?: string;
62
+ error?: string | null;
63
63
  icon?: JSX.Element;
64
64
  label: string;
65
65
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/types",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A library of types for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",