@la-main-verte/shared-types 1.0.80 → 1.0.81

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@la-main-verte/shared-types",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
4
4
  "description": "Shared TypeScript interfaces for frontend of la-main-verte app",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -1,55 +1,55 @@
1
- export interface FertilizerI {
2
- id: number
3
- name: string
4
- slug: string
5
- azotePercentage: number
6
- phosphorePercentage: number
7
- potassiumPercentage: number
8
- /**
9
- * The real azote percentage is the azote percentage multiplied by the azote efficiency.
10
- */
11
- realAzotePercentage: number
12
- /**
13
- * Nitrogen mineralization rate, between 0 and 1 (e.g. 0.9 for 90%).
14
- */
15
- nitrogenMineralizationRate: number | null
16
- imageLocation: string
17
- imageURL: string
18
- quantitySuggested: string
19
- /**
20
- * Blend composition when this fertilizer is a combination of two products.
21
- * Null for single fertilizers.
22
- * When populated, contains the IDs and ratios (as percentages) of the primary and secondary fertilizers.
23
- * The NPK values should be calculated by fetching each fertilizer and applying the weighted average.
24
- *
25
- * @example
26
- * // For a blend:
27
- * {
28
- * "primary_fertilizer_id": 1, // Acti-Sol (70%)
29
- * "primary_fertilizer_ratio": 70,
30
- * "secondary_fertilizer_id": 12, // Bionik (30%)
31
- * "secondary_fertilizer_ratio": 30
32
- * }
33
- *
34
- * // For a single fertilizer:
35
- * {}
36
- */
37
- combination_details: BlendCompositionI | null
38
- }
39
-
40
- interface BlendCompositionI {
41
- primary_fertilizer_id: number
42
- primary_fertilizer_ratio: number
43
- secondary_fertilizer_id: number
44
- secondary_fertilizer_ratio: number
45
- }
46
-
47
- export interface FertilizerSectionI {
48
- sectionTitle: string
49
- sectionSubtitle: string
50
- fertilizers: FertilizerI[]
51
- }
52
-
53
- export interface FertilizersInGridI {
54
- fertilizerSection: FertilizerSectionI[]
55
- }
1
+ export interface FertilizerI {
2
+ id: number
3
+ name: string
4
+ slug: string
5
+ azotePercentage: number
6
+ phosphorePercentage: number
7
+ potassiumPercentage: number
8
+ /**
9
+ * The real azote percentage is the azote percentage multiplied by the azote efficiency.
10
+ */
11
+ realAzotePercentage: number
12
+ /**
13
+ * Nitrogen mineralization rate, between 0 and 1 (e.g. 0.9 for 90%).
14
+ */
15
+ nitrogenMineralizationRate: number | null
16
+ imageLocation: string
17
+ imageURL: string
18
+ quantitySuggested: string
19
+ /**
20
+ * Blend composition when this fertilizer is a combination of two products.
21
+ * Null for single fertilizers.
22
+ * When populated, contains the IDs and ratios (as percentages) of the primary and secondary fertilizers.
23
+ * The NPK values should be calculated by fetching each fertilizer and applying the weighted average.
24
+ *
25
+ * @example
26
+ * // For a blend:
27
+ * {
28
+ * "primary_fertilizer_id": 1, // Acti-Sol (70%)
29
+ * "primary_fertilizer_ratio": 70,
30
+ * "secondary_fertilizer_id": 12, // Bionik (30%)
31
+ * "secondary_fertilizer_ratio": 30
32
+ * }
33
+ *
34
+ * // For a single fertilizer:
35
+ * {}
36
+ */
37
+ combination_details: BlendCompositionI | null
38
+ }
39
+
40
+ interface BlendCompositionI {
41
+ primary_fertilizer_id: number
42
+ primary_fertilizer_ratio: number
43
+ secondary_fertilizer_id: number
44
+ secondary_fertilizer_ratio: number
45
+ }
46
+
47
+ export interface FertilizerSectionI {
48
+ sectionTitle: string
49
+ sectionSubtitle: string
50
+ fertilizers: FertilizerI[]
51
+ }
52
+
53
+ export interface FertilizersInGridI {
54
+ fertilizerSection: FertilizerSectionI[]
55
+ }
package/src/plant.d.ts CHANGED
@@ -123,6 +123,33 @@ interface PlantInventoryI {
123
123
 
124
124
  export type AvailableGrowingConditionsI = Record<string, string[]>
125
125
 
126
+ /**
127
+ * For each attribute filter key (e.g. "fruit.color"), the list of values that
128
+ * still yield at least one match under the current search + active filters.
129
+ * Consumed by the frontend to mark filter tags as "unavailable".
130
+ */
131
+ export type AvailableAttributesI = Record<string, string[]>
132
+
133
+ /**
134
+ * Which filter surface the frontend should render for the current search.
135
+ * - `specific`: family-specific filters (e.g. tomate attributes)
136
+ * - `general`: global growing-conditions filters
137
+ *
138
+ * Mutually exclusive by design — the two sets never appear together.
139
+ */
140
+ export type PlantFiltersModeI = 'specific' | 'general'
141
+
142
+ /**
143
+ * Backend-driven description of the filter UI for a given search response.
144
+ * The frontend is a dumb renderer: it shows the filters listed here with the
145
+ * given mode and marks tags whose value is not in `availability` as unavailable.
146
+ */
147
+ export interface PlantFiltersUII {
148
+ mode: PlantFiltersModeI
149
+ filters: PlantFilterI[]
150
+ availability: Record<string, string[]>
151
+ }
152
+
126
153
  export interface GrowingConditionsConfigI {
127
154
  filters: PlantFilterI[]
128
155
  }
@@ -137,4 +164,5 @@ export interface PlantSearchResultI {
137
164
  selections: SelectionModelI[]
138
165
  total?: number
139
166
  familyName?: string
167
+ filtersUI?: PlantFiltersUII
140
168
  }