@la-main-verte/shared-types 1.0.79 → 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.79",
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
@@ -59,6 +59,26 @@ export interface PlantI {
59
59
  isHardy: boolean | null
60
60
  quantityForFiveInJardinVivrier?: number | null
61
61
  imageURL: string
62
+ /**
63
+ * Filename of the plant's 3D mesh asset stored on S3.
64
+ * - Ideally a `.webp` file (e.g. `ail.webp`).
65
+ * - Stored in S3 under the `images/meshes/` folder.
66
+ * - By default named after the `Plant.slug` (e.g. `ail.webp` for the garlic plant).
67
+ * - Only the filename is persisted; the public URL is exposed through the
68
+ * virtual `meshURL` field.
69
+ */
70
+ meshFilename: string | null
71
+ /**
72
+ * Public ImageKit URL to the plant's 3D mesh asset.
73
+ * Virtual field computed from `meshFilename`. The underlying file is
74
+ * stored on S3 at `images/meshes/{meshFilename}` and rewritten to
75
+ * ImageKit for CDN delivery and transformations.
76
+ *
77
+ * Falls back to `imageURL` when `meshFilename` is not set.
78
+ *
79
+ * Example: `https://ik.imagekit.io/lamainverte/meshes/ail.webp`
80
+ */
81
+ meshURL: string
62
82
  totalWeeksToMaturity: number
63
83
  hasNoInformation: boolean
64
84
  createdAt: Date
@@ -103,6 +123,33 @@ interface PlantInventoryI {
103
123
 
104
124
  export type AvailableGrowingConditionsI = Record<string, string[]>
105
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
+
106
153
  export interface GrowingConditionsConfigI {
107
154
  filters: PlantFilterI[]
108
155
  }
@@ -117,4 +164,5 @@ export interface PlantSearchResultI {
117
164
  selections: SelectionModelI[]
118
165
  total?: number
119
166
  familyName?: string
167
+ filtersUI?: PlantFiltersUII
120
168
  }