@la-main-verte/shared-types 1.0.77 → 1.0.78

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.77",
3
+ "version": "1.0.78",
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,214 +1,214 @@
1
- import type { FertilizerI } from './fertilizer'
2
- import type { PlantSelectionI } from './plantSelection'
3
-
4
- /**
5
- * Viewport corners with x/y coordinates
6
- * Used by front-end to describe the visible area of the map
7
- */
8
- export interface ViewportCornersI {
9
- topLeft: { x: number; y: number } | null
10
- topRight: { x: number; y: number } | null
11
- bottomLeft: { x: number; y: number } | null
12
- bottomRight: { x: number; y: number } | null
13
- }
14
-
15
- /**
16
- * Viewport as min/max boundaries
17
- * Used by back-end placement logic for collision detection
18
- */
19
- export interface ViewportBoundariesI {
20
- minX: number
21
- minY: number
22
- maxX: number
23
- maxY: number
24
- }
25
-
26
- /**
27
- * Available garden map categories across the platform
28
- */
29
- export type GardenMapCategory =
30
- | 'community_garden'
31
- | 'greenhouse'
32
- | 'garden'
33
- | 'recipe'
34
- | 'favorites'
35
- | 'indoor_garden'
36
- | 'balcony'
37
- | 'inventory'
38
- | 'others'
39
-
40
- /**
41
- * A gardenMap is a collection of garden zones
42
- */
43
- export interface GardenMapI {
44
- id: number
45
- name: string
46
- icon_name: string
47
- category: GardenMapCategory
48
- default: boolean
49
- memberId: number
50
- width_in_units: number
51
- height_in_units: number
52
- createdAt: string
53
- Selections: SelectionI[]
54
- GardenZones: GardenZoneI[]
55
- imageURL: string
56
- }
57
-
58
- /**
59
- * Legacy shape values accepted by the v1 route
60
- * (`POST /selections/:slug/gardenMap/gardenZone`).
61
- * This legacy param must remain rectangle/circle only.
62
- */
63
- export type GardenZoneLegacyShape = 'rectangle' | 'circle'
64
-
65
- /**
66
- * Visual shape identifier stored in `geometry.properties.shape`.
67
- */
68
- export type GardenZoneShape = 'rectangle' | 'circle' | 'polygon'
69
-
70
- export type GardenZoneCategory = 'cultural' | 'decorative'
71
-
72
- /**
73
- * Inner GeoJSON Polygon geometry (coordinates ring).
74
- */
75
- export interface GeoJSONPolygon {
76
- type: 'Polygon'
77
- coordinates: number[][][]
78
- }
79
-
80
- /**
81
- * Properties stored alongside the GeoJSON Feature.
82
- * `shape` is the canonical shape identifier.
83
- * Shape-specific fields (center, radius, radiusX, radiusY) describe the parametric definition.
84
- * `rotation` (degrees, clockwise) and `cornerRadius` (cm) follow GeoJSON/MapBox conventions.
85
- * `svgPath` holds the editable SVG path string for Bézier polygon rendering.
86
- */
87
- export interface GeoJSONFeatureProperties {
88
- shape: GardenZoneShape
89
- /** Rotation in degrees, clockwise. GeoJSON convention name. */
90
- rotation?: number
91
- /** Corner radius in cm. MapBox convention name. */
92
- cornerRadius?: number
93
- /** SVG path string with Bézier curves for polygon rendering. */
94
- svgPath?: string
95
- /** Center point [x, y] in cm for circle/ellipse shapes. */
96
- center?: [number, number]
97
- /** Radius in cm for circle shapes. */
98
- radius?: number
99
- /** Horizontal radius in cm for ellipse shapes. */
100
- radiusX?: number
101
- /** Vertical radius in cm for ellipse shapes. */
102
- radiusY?: number
103
- }
104
-
105
- /**
106
- * GeoJSON Feature wrapping a Polygon geometry with shape properties.
107
- * This is the canonical storage format for all garden zone geometries.
108
- *
109
- * - `properties` holds the parametric definition (shape, rotation, radii, svgPath)
110
- * - `geometry` holds the computed polygon coordinates for calculations
111
- *
112
- * GeoJSON is the truth (for logic), SVG is the projection (for display and editing).
113
- */
114
- export interface GeoJSONFeature {
115
- type: 'Feature'
116
- properties: GeoJSONFeatureProperties
117
- geometry: GeoJSONPolygon
118
- }
119
-
120
- export interface GardenZoneI {
121
- id: number
122
- name: string | null
123
- gardenMapId: number
124
- widthInMeters: number
125
- heightInMeters: number
126
- diameterInMeters: number
127
- shape: GardenZoneShape
128
- /**
129
- * Virtual field — the actual visual shape derived from geometry.properties.shape,
130
- * falling back to the DB shape column for legacy zones.
131
- */
132
- geometryShape: GardenZoneShape
133
- geometry?: GeoJSONFeature | null
134
- category: GardenZoneCategory
135
- backgroundImage: string | null
136
- xPosition: number
137
- yPosition: number
138
- zIndex: number
139
- order: number
140
- /**
141
- * When set, the zone is shown only for that year.
142
- * Null means the zone is timeless (visible for every year).
143
- */
144
- yearOfCulture: number | null
145
- totalSurfaceInSquareMeters: number
146
- totalSurfaceInSquareFeet: number
147
- backgroundColor: string
148
- createdAt: Date
149
- updatedAt: Date
150
- /**
151
- * When set, the garden zone is a subdivision of another garden zone
152
- * Parent zones are meant to be as eternal as possible.
153
- * Subdivisions are meant to be created and destroyed on a yearly basis.
154
- */
155
- parent_garden_zone_id: number
156
- /**
157
- * Virtual field to check if the garden zone is a subdivision
158
- * It is a renamed field from parent_garden_zone_id
159
- */
160
- is_subdivision: boolean
161
- has_subdivisions: boolean
162
- timeless: boolean
163
- /**
164
- * Orientation virtual field ONLY USE FOR RECTANGLES
165
- * --------------------------------
166
- * Disregard if the shape is a circle or square. It will return 'vertical'
167
- */
168
- orientation: 'horizontal' | 'vertical'
169
- /**
170
- * NOT USED BY THE FRONTEND YET - Use GardenZoneCulture instead
171
- */
172
- GardenZoneCultures?: GardenZoneCultureI[]
173
- /**
174
- * The culture on the GardenZone
175
- */
176
- GardenZoneCulture?: GardenZoneCultureI
177
- rotationSuggestion?: string
178
- category?: 'cultural' | 'decorative' | null
179
- }
180
-
181
- export interface GardenZoneCultureI {
182
- id: number
183
- gardenZoneId: number
184
- plantSelectionId: number
185
- seedQuantity: number
186
- densityMode: 'dense' | 'sparse' | 'custom'
187
- fertilizerId: number
188
- /**
189
- * The year of the culture - do not use it yet.
190
- * @deprecated Potentially a mistake to have this field here
191
- */
192
- yearOfCulture: number
193
- PlantSelection?: PlantSelectionI
194
- /**
195
- * The number of alleys
196
- * --------------------------------
197
- * Value is computed by the backend and NOT coming from the DB.
198
- */
199
- numberOfAlleys?: number
200
- /**
201
- * The number of seeds per alley
202
- * --------------------------------
203
- * Value is computed by the backend and NOT coming from the DB.
204
- */
205
- numberOfSeedsPerAlley?: number
206
- Fertilizer?: FertilizerI
207
- custom_space_between_seeds_in_cm?: number
208
- custom_space_between_alley_in_cm?: number
209
- }
210
-
211
- export type UpdateGardenZonePayload = Partial<GardenZoneI> &
212
- Partial<GardenZoneCultureI> & {
213
- targetNumberOfPlants?: number
214
- }
1
+ import type { FertilizerI } from './fertilizer'
2
+ import type { PlantSelectionI } from './plantSelection'
3
+
4
+ /**
5
+ * Viewport corners with x/y coordinates
6
+ * Used by front-end to describe the visible area of the map
7
+ */
8
+ export interface ViewportCornersI {
9
+ topLeft: { x: number; y: number } | null
10
+ topRight: { x: number; y: number } | null
11
+ bottomLeft: { x: number; y: number } | null
12
+ bottomRight: { x: number; y: number } | null
13
+ }
14
+
15
+ /**
16
+ * Viewport as min/max boundaries
17
+ * Used by back-end placement logic for collision detection
18
+ */
19
+ export interface ViewportBoundariesI {
20
+ minX: number
21
+ minY: number
22
+ maxX: number
23
+ maxY: number
24
+ }
25
+
26
+ /**
27
+ * Available garden map categories across the platform
28
+ */
29
+ export type GardenMapCategory =
30
+ | 'community_garden'
31
+ | 'greenhouse'
32
+ | 'garden'
33
+ | 'recipe'
34
+ | 'favorites'
35
+ | 'indoor_garden'
36
+ | 'balcony'
37
+ | 'inventory'
38
+ | 'others'
39
+
40
+ /**
41
+ * A gardenMap is a collection of garden zones
42
+ */
43
+ export interface GardenMapI {
44
+ id: number
45
+ name: string
46
+ icon_name: string
47
+ category: GardenMapCategory
48
+ default: boolean
49
+ memberId: number
50
+ width_in_units: number
51
+ height_in_units: number
52
+ createdAt: string
53
+ Selections: SelectionI[]
54
+ GardenZones: GardenZoneI[]
55
+ imageURL: string
56
+ }
57
+
58
+ /**
59
+ * Legacy shape values accepted by the v1 route
60
+ * (`POST /selections/:slug/gardenMap/gardenZone`).
61
+ * This legacy param must remain rectangle/circle only.
62
+ */
63
+ export type GardenZoneLegacyShape = 'rectangle' | 'circle'
64
+
65
+ /**
66
+ * Visual shape identifier stored in `geometry.properties.shape`.
67
+ */
68
+ export type GardenZoneShape = 'rectangle' | 'circle' | 'polygon'
69
+
70
+ export type GardenZoneCategory = 'cultural' | 'decorative'
71
+
72
+ /**
73
+ * Inner GeoJSON Polygon geometry (coordinates ring).
74
+ */
75
+ export interface GeoJSONPolygon {
76
+ type: 'Polygon'
77
+ coordinates: number[][][]
78
+ }
79
+
80
+ /**
81
+ * Properties stored alongside the GeoJSON Feature.
82
+ * `shape` is the canonical shape identifier.
83
+ * Shape-specific fields (center, radius, radiusX, radiusY) describe the parametric definition.
84
+ * `rotation` (degrees, clockwise) and `cornerRadius` (cm) follow GeoJSON/MapBox conventions.
85
+ * `svgPath` holds the editable SVG path string for Bézier polygon rendering.
86
+ */
87
+ export interface GeoJSONFeatureProperties {
88
+ shape: GardenZoneShape
89
+ /** Rotation in degrees, clockwise. GeoJSON convention name. */
90
+ rotation?: number
91
+ /** Corner radius in cm. MapBox convention name. */
92
+ cornerRadius?: number
93
+ /** SVG path string with Bézier curves for polygon rendering. */
94
+ svgPath?: string
95
+ /** Center point [x, y] in cm for circle/ellipse shapes. */
96
+ center?: [number, number]
97
+ /** Radius in cm for circle shapes. */
98
+ radius?: number
99
+ /** Horizontal radius in cm for ellipse shapes. */
100
+ radiusX?: number
101
+ /** Vertical radius in cm for ellipse shapes. */
102
+ radiusY?: number
103
+ }
104
+
105
+ /**
106
+ * GeoJSON Feature wrapping a Polygon geometry with shape properties.
107
+ * This is the canonical storage format for all garden zone geometries.
108
+ *
109
+ * - `properties` holds the parametric definition (shape, rotation, radii, svgPath)
110
+ * - `geometry` holds the computed polygon coordinates for calculations
111
+ *
112
+ * GeoJSON is the truth (for logic), SVG is the projection (for display and editing).
113
+ */
114
+ export interface GeoJSONFeature {
115
+ type: 'Feature'
116
+ properties: GeoJSONFeatureProperties
117
+ geometry: GeoJSONPolygon
118
+ }
119
+
120
+ export interface GardenZoneI {
121
+ id: number
122
+ name: string | null
123
+ gardenMapId: number
124
+ widthInMeters: number
125
+ heightInMeters: number
126
+ diameterInMeters: number
127
+ shape: GardenZoneShape
128
+ /**
129
+ * Virtual field — the actual visual shape derived from geometry.properties.shape,
130
+ * falling back to the DB shape column for legacy zones.
131
+ */
132
+ geometryShape: GardenZoneShape
133
+ geometry?: GeoJSONFeature | null
134
+ category: GardenZoneCategory
135
+ backgroundImage: string | null
136
+ xPosition: number
137
+ yPosition: number
138
+ zIndex: number
139
+ order: number
140
+ /**
141
+ * When set, the zone is shown only for that year.
142
+ * Null means the zone is timeless (visible for every year).
143
+ */
144
+ yearOfCulture: number | null
145
+ totalSurfaceInSquareMeters: number
146
+ totalSurfaceInSquareFeet: number
147
+ backgroundColor: string
148
+ createdAt: Date
149
+ updatedAt: Date
150
+ /**
151
+ * When set, the garden zone is a subdivision of another garden zone
152
+ * Parent zones are meant to be as eternal as possible.
153
+ * Subdivisions are meant to be created and destroyed on a yearly basis.
154
+ */
155
+ parent_garden_zone_id: number
156
+ /**
157
+ * Virtual field to check if the garden zone is a subdivision
158
+ * It is a renamed field from parent_garden_zone_id
159
+ */
160
+ is_subdivision: boolean
161
+ has_subdivisions: boolean
162
+ timeless: boolean
163
+ /**
164
+ * Orientation virtual field ONLY USE FOR RECTANGLES
165
+ * --------------------------------
166
+ * Disregard if the shape is a circle or square. It will return 'vertical'
167
+ */
168
+ orientation: 'horizontal' | 'vertical'
169
+ /**
170
+ * NOT USED BY THE FRONTEND YET - Use GardenZoneCulture instead
171
+ */
172
+ GardenZoneCultures?: GardenZoneCultureI[]
173
+ /**
174
+ * The culture on the GardenZone
175
+ */
176
+ GardenZoneCulture?: GardenZoneCultureI
177
+ rotationSuggestion?: string
178
+ category?: 'cultural' | 'decorative' | null
179
+ }
180
+
181
+ export interface GardenZoneCultureI {
182
+ id: number
183
+ gardenZoneId: number
184
+ plantSelectionId: number
185
+ seedQuantity: number
186
+ densityMode: 'dense' | 'sparse' | 'custom'
187
+ fertilizerId: number
188
+ /**
189
+ * The year of the culture - do not use it yet.
190
+ * @deprecated Potentially a mistake to have this field here
191
+ */
192
+ yearOfCulture: number
193
+ PlantSelection?: PlantSelectionI
194
+ /**
195
+ * The number of alleys
196
+ * --------------------------------
197
+ * Value is computed by the backend and NOT coming from the DB.
198
+ */
199
+ numberOfAlleys?: number
200
+ /**
201
+ * The number of seeds per alley
202
+ * --------------------------------
203
+ * Value is computed by the backend and NOT coming from the DB.
204
+ */
205
+ numberOfSeedsPerAlley?: number
206
+ Fertilizer?: FertilizerI
207
+ custom_space_between_seeds_in_cm?: number
208
+ custom_space_between_alley_in_cm?: number
209
+ }
210
+
211
+ export type UpdateGardenZonePayload = Partial<GardenZoneI> &
212
+ Partial<GardenZoneCultureI> & {
213
+ targetNumberOfPlants?: number
214
+ }
@@ -1,87 +1,87 @@
1
- /**
2
- * Garden Overview Types
3
- * Represents the detailed overview of a garden selection
4
- */
5
- import { PlantI } from './plant'
6
-
7
- export interface GardenOverviewI {
8
- id: number
9
- title: string
10
- iconName: string
11
- yearOfCulture: number
12
- statistics: GardenOverviewStatsI
13
- }
14
-
15
- export interface GardenOverviewStatsI {
16
- totalSeeds: number
17
- totalSurface: string
18
- totalSurfaceWithoutCulture: string
19
- surfaceComparisonMessage: string | null
20
- familyDistribution: FamilyStatsI[]
21
- jardinVivrierComparison: GardenOverviewJardinVivrierFamilyStatsI[]
22
- fertilization: FertilizationStatsI
23
- zones: GardenOverviewZoneStatsI[]
24
- }
25
-
26
- export interface FertilizationStatsI {
27
- totalWeightInKg: number
28
- weightComparisonMessage: string | null
29
- fertilizerDetails: FertilizerStatsI[]
30
- }
31
-
32
- export interface FertilizerStatsI {
33
- fertilizerName: string
34
- fertilizerQuantity: string
35
- imageURL: string
36
- }
37
-
38
- export interface FamilyStatsI {
39
- family: string
40
- hexColor: string
41
- totalSeeds: number
42
- totalSurface: string
43
- percentage: number
44
- plants: GardenOverviewPlantStatsI[]
45
- }
46
-
47
- export interface GardenOverviewJardinVivrierFamilyStatsI {
48
- family: string
49
- parentImageURL: string | null
50
- cultivatedQuantity: number
51
- suggestedQuantityForFiveInJardinVivrier: number | null
52
- }
53
-
54
- /**
55
- * Extended PlantI with overview-specific statistics
56
- * Contains the full plant data plus surface, seedQuantity, and position
57
- */
58
- export interface GardenOverviewPlantStatsI extends PlantI {
59
- seedQuantity: number
60
- surface: string
61
- position: number
62
- densityMode: string
63
- fertilizerName: string
64
- fertilizerQuantity: string
65
- }
66
-
67
- export interface GardenOverviewZonePlantStatsI {
68
- id: number
69
- name: string
70
- imageURL: string | null
71
- }
72
-
73
- export interface GardenOverviewZoneFertilizerStatsI {
74
- name: string
75
- quantity: string
76
- }
77
-
78
- export interface GardenOverviewZoneStatsI {
79
- id: number
80
- name: string
81
- totalSeeds: number
82
- surface: string
83
- fertilizerQuantity: string
84
- thumbnailURL: string
85
- plants: GardenOverviewZonePlantStatsI[]
86
- fertilizers: GardenOverviewZoneFertilizerStatsI[]
87
- }
1
+ /**
2
+ * Garden Overview Types
3
+ * Represents the detailed overview of a garden selection
4
+ */
5
+ import { PlantI } from './plant'
6
+
7
+ export interface GardenOverviewI {
8
+ id: number
9
+ title: string
10
+ iconName: string
11
+ yearOfCulture: number
12
+ statistics: GardenOverviewStatsI
13
+ }
14
+
15
+ export interface GardenOverviewStatsI {
16
+ totalSeeds: number
17
+ totalSurface: string
18
+ totalSurfaceWithoutCulture: string
19
+ surfaceComparisonMessage: string | null
20
+ familyDistribution: FamilyStatsI[]
21
+ jardinVivrierComparison: GardenOverviewJardinVivrierFamilyStatsI[]
22
+ fertilization: FertilizationStatsI
23
+ zones: GardenOverviewZoneStatsI[]
24
+ }
25
+
26
+ export interface FertilizationStatsI {
27
+ totalWeightInKg: number
28
+ weightComparisonMessage: string | null
29
+ fertilizerDetails: FertilizerStatsI[]
30
+ }
31
+
32
+ export interface FertilizerStatsI {
33
+ fertilizerName: string
34
+ fertilizerQuantity: string
35
+ imageURL: string
36
+ }
37
+
38
+ export interface FamilyStatsI {
39
+ family: string
40
+ hexColor: string
41
+ totalSeeds: number
42
+ totalSurface: string
43
+ percentage: number
44
+ plants: GardenOverviewPlantStatsI[]
45
+ }
46
+
47
+ export interface GardenOverviewJardinVivrierFamilyStatsI {
48
+ family: string
49
+ parentImageURL: string | null
50
+ cultivatedQuantity: number
51
+ suggestedQuantityForFiveInJardinVivrier: number | null
52
+ }
53
+
54
+ /**
55
+ * Extended PlantI with overview-specific statistics
56
+ * Contains the full plant data plus surface, seedQuantity, and position
57
+ */
58
+ export interface GardenOverviewPlantStatsI extends PlantI {
59
+ seedQuantity: number
60
+ surface: string
61
+ position: number
62
+ densityMode: string
63
+ fertilizerName: string
64
+ fertilizerQuantity: string
65
+ }
66
+
67
+ export interface GardenOverviewZonePlantStatsI {
68
+ id: number
69
+ name: string
70
+ imageURL: string | null
71
+ }
72
+
73
+ export interface GardenOverviewZoneFertilizerStatsI {
74
+ name: string
75
+ quantity: string
76
+ }
77
+
78
+ export interface GardenOverviewZoneStatsI {
79
+ id: number
80
+ name: string
81
+ totalSeeds: number
82
+ surface: string
83
+ fertilizerQuantity: string
84
+ thumbnailURL: string
85
+ plants: GardenOverviewZonePlantStatsI[]
86
+ fertilizers: GardenOverviewZoneFertilizerStatsI[]
87
+ }
package/src/plant.d.ts CHANGED
@@ -59,6 +59,7 @@ export interface PlantI {
59
59
  isHardy: boolean | null
60
60
  quantityForFiveInJardinVivrier?: number | null
61
61
  imageURL: string
62
+ plantMeshURL: string | null
62
63
  totalWeeksToMaturity: number
63
64
  hasNoInformation: boolean
64
65
  createdAt: Date
@@ -1,136 +1,136 @@
1
- import type { DeviceDataI } from './device.d'
2
- import type { MemberI as MemberDataI } from './member.d'
3
- import type { SelectionI } from './selection.d'
4
- import type { PlantI } from './plant.d'
5
-
6
- interface RequestHeaders {
7
- 'x-session-token': string
8
- 'x-native-app-version'?: string
9
- 'x-application-type'?: 'react-native' | 'web'
10
- }
11
-
12
- export namespace USERS {
13
- export namespace GET {
14
- export interface Request {
15
- headers: RequestHeaders
16
- params: {
17
- scopes: ('unreadNotificationsCount' | 'coordinates')[]
18
- }
19
- }
20
- export type Response = MemberDataI & {
21
- unreadAlertsCount?: number
22
- }
23
- }
24
- export namespace DEVICES {
25
- export interface Request {
26
- headers: RequestHeaders
27
- body: {
28
- /** @see DeviceDataI */
29
- userAgent?: DeviceDataI['userAgent']
30
- platform?: DeviceDataI['platform']
31
- version?: DeviceDataI['version']
32
- model?: DeviceDataI['model']
33
- name?: DeviceDataI['name']
34
- appVersion?: DeviceDataI['appVersion']
35
- pushKey?: DeviceDataI['pushKey']
36
- apnsToken?: DeviceDataI['apnsToken']
37
- fcmToken?: DeviceDataI['fcmToken']
38
- webPushEndpoint?: DeviceDataI['webPushEndpoint']
39
- webPushP256dh?: DeviceDataI['webPushP256dh']
40
- webPushAuth?: DeviceDataI['webPushAuth']
41
- webPushSubscription?: DeviceDataI['webPushSubscription']
42
- }
43
- }
44
- export type Response = DeviceDataI
45
- }
46
- export namespace RECOMMENDATIONS {
47
- export type ComponentType = 'PlantCarousel' | 'SelectionCarousel' | 'HeroCardsCarousel' | 'YourSelection'
48
-
49
- interface BaseRecommendation {
50
- id: string
51
- componentType: ComponentType
52
- title?: string
53
- subtitle?: string
54
- cardsVisible?: number
55
- }
56
-
57
- export interface PlantCarouselRecommendation extends BaseRecommendation {
58
- componentType: 'PlantCarousel'
59
- selection: SelectionI & { Plants?: PlantI[] }
60
- displayRanking?: boolean
61
- }
62
-
63
- export interface SelectionCarouselRecommendation extends BaseRecommendation {
64
- componentType: 'SelectionCarousel'
65
- selections: SelectionI[]
66
- displayRanking?: boolean
67
- }
68
-
69
- export interface HeroCardsCarouselRecommendation extends BaseRecommendation {
70
- componentType: 'HeroCardsCarousel'
71
- selections: SelectionI[]
72
- }
73
-
74
- export interface YourSelectionRecommendation extends BaseRecommendation {
75
- componentType: 'YourSelection'
76
- }
77
-
78
- export interface ThemedRecommendationI {
79
- id: string
80
- label: string
81
- icon: string
82
- title?: string
83
- subtitle?: string
84
- selections: SelectionI[]
85
- cardsVisible?: number
86
- displayRanking?: boolean
87
- }
88
-
89
- export type RecommendationI =
90
- | PlantCarouselRecommendation
91
- | SelectionCarouselRecommendation
92
- | HeroCardsCarouselRecommendation
93
- | YourSelectionRecommendation
94
-
95
- export interface Request {
96
- headers: RequestHeaders
97
- }
98
-
99
- export interface Response {
100
- recommendations: RecommendationI[]
101
- themedRecommendations: ThemedRecommendationI[]
102
- }
103
- }
104
- export namespace UPDATE {
105
- export interface Request {
106
- headers: RequestHeaders
107
- body: {
108
- city?: string
109
- lastFreezingDate?: string | Date
110
- firstFreezingDate?: string | Date
111
- moveDatesRequested?: boolean
112
- lastFertilizerIdChosen?: number
113
- lastOrganicMatterPercentage?: number
114
- unitSystem?: 'imperial' | 'metric'
115
- gardenZoneTimelessPreference?: boolean
116
- }
117
- }
118
- export type Response = MemberDataI
119
- }
120
- export namespace GIFT_CARDS {
121
- export namespace REDEEM {
122
- export interface Request {
123
- headers: RequestHeaders
124
- body: {
125
- code: string
126
- }
127
- }
128
- export interface Response {
129
- success: boolean
130
- message?: string
131
- error?: string
132
- error_message?: string
133
- }
134
- }
135
- }
136
- }
1
+ import type { DeviceDataI } from './device.d'
2
+ import type { MemberI as MemberDataI } from './member.d'
3
+ import type { SelectionI } from './selection.d'
4
+ import type { PlantI } from './plant.d'
5
+
6
+ interface RequestHeaders {
7
+ 'x-session-token': string
8
+ 'x-native-app-version'?: string
9
+ 'x-application-type'?: 'react-native' | 'web'
10
+ }
11
+
12
+ export namespace USERS {
13
+ export namespace GET {
14
+ export interface Request {
15
+ headers: RequestHeaders
16
+ params: {
17
+ scopes: ('unreadNotificationsCount' | 'coordinates')[]
18
+ }
19
+ }
20
+ export type Response = MemberDataI & {
21
+ unreadAlertsCount?: number
22
+ }
23
+ }
24
+ export namespace DEVICES {
25
+ export interface Request {
26
+ headers: RequestHeaders
27
+ body: {
28
+ /** @see DeviceDataI */
29
+ userAgent?: DeviceDataI['userAgent']
30
+ platform?: DeviceDataI['platform']
31
+ version?: DeviceDataI['version']
32
+ model?: DeviceDataI['model']
33
+ name?: DeviceDataI['name']
34
+ appVersion?: DeviceDataI['appVersion']
35
+ pushKey?: DeviceDataI['pushKey']
36
+ apnsToken?: DeviceDataI['apnsToken']
37
+ fcmToken?: DeviceDataI['fcmToken']
38
+ webPushEndpoint?: DeviceDataI['webPushEndpoint']
39
+ webPushP256dh?: DeviceDataI['webPushP256dh']
40
+ webPushAuth?: DeviceDataI['webPushAuth']
41
+ webPushSubscription?: DeviceDataI['webPushSubscription']
42
+ }
43
+ }
44
+ export type Response = DeviceDataI
45
+ }
46
+ export namespace RECOMMENDATIONS {
47
+ export type ComponentType = 'PlantCarousel' | 'SelectionCarousel' | 'HeroCardsCarousel' | 'YourSelection'
48
+
49
+ interface BaseRecommendation {
50
+ id: string
51
+ componentType: ComponentType
52
+ title?: string
53
+ subtitle?: string
54
+ cardsVisible?: number
55
+ }
56
+
57
+ export interface PlantCarouselRecommendation extends BaseRecommendation {
58
+ componentType: 'PlantCarousel'
59
+ selection: SelectionI & { Plants?: PlantI[] }
60
+ displayRanking?: boolean
61
+ }
62
+
63
+ export interface SelectionCarouselRecommendation extends BaseRecommendation {
64
+ componentType: 'SelectionCarousel'
65
+ selections: SelectionI[]
66
+ displayRanking?: boolean
67
+ }
68
+
69
+ export interface HeroCardsCarouselRecommendation extends BaseRecommendation {
70
+ componentType: 'HeroCardsCarousel'
71
+ selections: SelectionI[]
72
+ }
73
+
74
+ export interface YourSelectionRecommendation extends BaseRecommendation {
75
+ componentType: 'YourSelection'
76
+ }
77
+
78
+ export interface ThemedRecommendationI {
79
+ id: string
80
+ label: string
81
+ icon: string
82
+ title?: string
83
+ subtitle?: string
84
+ selections: SelectionI[]
85
+ cardsVisible?: number
86
+ displayRanking?: boolean
87
+ }
88
+
89
+ export type RecommendationI =
90
+ | PlantCarouselRecommendation
91
+ | SelectionCarouselRecommendation
92
+ | HeroCardsCarouselRecommendation
93
+ | YourSelectionRecommendation
94
+
95
+ export interface Request {
96
+ headers: RequestHeaders
97
+ }
98
+
99
+ export interface Response {
100
+ recommendations: RecommendationI[]
101
+ themedRecommendations: ThemedRecommendationI[]
102
+ }
103
+ }
104
+ export namespace UPDATE {
105
+ export interface Request {
106
+ headers: RequestHeaders
107
+ body: {
108
+ city?: string
109
+ lastFreezingDate?: string | Date
110
+ firstFreezingDate?: string | Date
111
+ moveDatesRequested?: boolean
112
+ lastFertilizerIdChosen?: number
113
+ lastOrganicMatterPercentage?: number
114
+ unitSystem?: 'imperial' | 'metric'
115
+ gardenZoneTimelessPreference?: boolean
116
+ }
117
+ }
118
+ export type Response = MemberDataI
119
+ }
120
+ export namespace GIFT_CARDS {
121
+ export namespace REDEEM {
122
+ export interface Request {
123
+ headers: RequestHeaders
124
+ body: {
125
+ code: string
126
+ }
127
+ }
128
+ export interface Response {
129
+ success: boolean
130
+ message?: string
131
+ error?: string
132
+ error_message?: string
133
+ }
134
+ }
135
+ }
136
+ }