@la-main-verte/shared-types 1.0.56 → 1.0.58

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.56",
3
+ "version": "1.0.58",
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,18 +1,33 @@
1
+ /**
2
+ * Available garden map categories across the platform
3
+ */
4
+ export type GardenMapCategory =
5
+ | 'community_garden'
6
+ | 'greenhouse'
7
+ | 'garden'
8
+ | 'recipe'
9
+ | 'favorites'
10
+ | 'indoor_garden'
11
+ | 'balcony'
12
+ | 'inventory'
13
+ | 'others'
14
+
1
15
  /**
2
16
  * A gardenMap is a collection of garden zones
3
17
  */
4
18
  export interface GardenMapI {
5
- id: number;
6
- name: string;
7
- icon_name: string;
8
- category?: string;
9
- default: boolean;
10
- width_in_units: number;
11
- height_in_units: number;
12
- createdAt: string;
13
- Selections: SelectionI[];
19
+ id: number
20
+ name: string
21
+ icon_name: string
22
+ category: GardenMapCategory
23
+ default: boolean
24
+ memberId: number
25
+ width_in_units: number
26
+ height_in_units: number
27
+ createdAt: string
28
+ Selections: SelectionI[]
14
29
  GardenZones: GardenZoneI[]
15
- imageUrl: string;
30
+ imageURL: string
16
31
  }
17
32
 
18
33
  export interface GardenZoneI {
package/src/home.api.d.ts CHANGED
@@ -23,7 +23,6 @@ export namespace HOME {
23
23
  date: string
24
24
  minTempC: number
25
25
  maxTempC: number
26
- chanceOfRainPercentage: number | null
27
26
  iconUrl: string | null
28
27
  condition?: string | null
29
28
  }
@@ -88,6 +87,7 @@ export namespace HOME {
88
87
  backgroundColor?: string | null
89
88
  backgroundImageUrl?: string | null
90
89
  ctaLabel?: string | null
90
+ ctaRoute?: string | null
91
91
  previewPlants?: PlantI[]
92
92
  selection?: SelectionI | null
93
93
  plant?: PlantI | null
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from './note'
13
13
  export * from './taggedItem'
14
14
  export * from './fertilizer'
15
15
  export * from './utmParams'
16
+ export * from './plantFilters'
16
17
  import * as PlantsAPI from './plants.api'
17
18
  import * as UsersAPI from './users.api'
18
19
  import * as SessionsAPI from './sessions.api'
package/src/plant.d.ts CHANGED
@@ -1,3 +1,17 @@
1
+ import type { TaxonFamilyI } from './taxonFamily'
2
+ /**
3
+ * Plant filter value types
4
+ * Represents the possible values for a single filter
5
+ */
6
+ export type PlantFilterValueI = string | string[] | number | boolean
7
+
8
+ /**
9
+ * Plant attributes for filtering
10
+ * Used in JSONB field and as query parameters
11
+ * Supports multiple value types for different filter types
12
+ */
13
+ export type PlantAttributesI = Record<string, PlantFilterValueI>
14
+
1
15
  export interface PlantI {
2
16
  id: number
3
17
  name: string
@@ -6,6 +20,7 @@ export interface PlantI {
6
20
  descriptionSource?: string
7
21
  female: boolean
8
22
  family?: string | null
23
+ taxonFamilyId?: number | null
9
24
  spaceBetweenSeedMin: number
10
25
  spaceBetweenSeedMax: number
11
26
  spaceBetweenAlleyMin: number
@@ -49,28 +64,19 @@ export interface PlantI {
49
64
  tasks?: TaskI[]
50
65
  Images?: ImageI[]
51
66
  notes?: NoteI[]
67
+ rotationGroup?: string
68
+ // @deprecate once v1.8.1 is fully adopted
52
69
  rotationFamily?: string
70
+ taxonFamily?: TaxonFamilyI
53
71
  }
54
72
 
55
73
  interface PlantTagI {
56
74
  name: string
57
75
  /**
58
- * Font color of the tag
59
- * Ex: #ffffff
76
+ * JSONB field containing plant-specific attributes for filtering
77
+ * Ex: { growth: { type: 'déterminée' }, fruit: { color: 'rouge' } }
60
78
  */
61
- fontColor: string
62
- /**
63
- * Background color of the tag
64
- * Ex: #1B76E6
65
- */
66
- backgroundColor: string
67
- /**
68
- * Font awesome Icon name
69
- * Ex: 'tomato'
70
- */
71
- iconName: string
72
- /** Selection slug related to the tag */
73
- slug: string
79
+ attributes?: PlantAttributesI
74
80
  }
75
81
 
76
82
  interface PlantInventoryI {
@@ -83,3 +89,10 @@ interface PlantInventoryI {
83
89
  description: string
84
90
  inStock: boolean
85
91
  }
92
+
93
+ export interface PlantSearchResultI {
94
+ plants: PlantModelI[]
95
+ selections: SelectionModelI[]
96
+ total?: number
97
+ familyName?: string
98
+ }
@@ -0,0 +1,19 @@
1
+ export interface PlantFiltersConfigI {
2
+ filters: PlantFilterI[]
3
+ helpText?: string
4
+ }
5
+
6
+ export interface PlantFilterI {
7
+ key: string // Path in the JSONB (ex: "growth.type")
8
+ label: string // Label to display
9
+ type: 'select' | 'multiselect' | 'boolean' | 'range'
10
+ isMain?: boolean // If true, displayed as button filter; if false/undefined, in modal
11
+ options?: FilterOptionI[] // For select/multiselect
12
+ min?: number // For range
13
+ max?: number // For range
14
+ }
15
+
16
+ export interface FilterOptionI {
17
+ value: string
18
+ label: string
19
+ }
@@ -23,11 +23,15 @@ export namespace PLANTS {
23
23
  headers?: {
24
24
  'x-session-token'?: string
25
25
  }
26
+ query?: {
27
+ gardenZoneId?: string | number
28
+ selectionSlug?: string
29
+ }
26
30
  }
27
- /**
28
- * Response containing recommended plants with their tags
29
- */
30
- export type Response = PlantExtendedDataI[]
31
+ export type RecommendedPlantI = PlantExtendedDataI & {
32
+ contextualSearchText?: string
33
+ }
34
+ export type Response = RecommendedPlantI[]
31
35
  }
32
36
  export namespace SEARCH {
33
37
  /**
@@ -52,6 +56,10 @@ export namespace PLANTS {
52
56
  * - Plant.contextualSearchText may be added to the results to provided additional contextual information to the search results (and therefore the member)
53
57
  */
54
58
  gardenZoneId?: string | number
59
+ /**
60
+ * Slug of the selection currently being edited. Used to contextualize rotation insights for search results.
61
+ */
62
+ selectionSlug?: string
55
63
  }
56
64
  }
57
65
  /**
@@ -0,0 +1,3 @@
1
+ export type RotationGroup = 'regenerative' | 'demanding' | 'moderately_demanding' | 'less_demanding'
2
+
3
+ export const ROTATION_GROUPS: RotationGroup[] = ['regenerative', 'demanding', 'moderately_demanding', 'less_demanding']