@la-main-verte/shared-types 1.0.91 → 1.0.92

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/src/home.api.d.ts CHANGED
@@ -1,354 +1,354 @@
1
- import type { PlantI } from './plant'
2
- import type { SelectionI } from './selection'
3
- import type { TaskI } from './task'
4
-
5
- export namespace HOME {
6
- export type HeroCardMode = 'featuredSelection' | 'featuredPlant'
7
-
8
- export type SectionComponentType =
9
- | 'Header'
10
- | 'HeroCards'
11
- | 'PlantCarousel'
12
- | 'HeroCardsCarousel'
13
- | 'WideCardsCarousel'
14
- | 'Weather'
15
- | 'AdviceCarousel'
16
- | 'OnboardingCard'
17
- | 'MissionCard'
18
- | 'UpcomingTasks'
19
-
20
- export type CarouselComponentType = Extract<
21
- SectionComponentType,
22
- 'PlantCarousel' | 'HeroCardsCarousel' | 'WideCardsCarousel'
23
- >
24
-
25
- export interface WeatherDayI {
26
- /**
27
- * Forecast date anchored at noon UTC, e.g. `2026-06-10T12:00:00Z`.
28
- * Noon avoids clients parsing a bare `YYYY-MM-DD` as UTC midnight and
29
- * displaying the previous local day in negative-offset timezones.
30
- */
31
- date: string
32
- /**
33
- * Localized weekday label (e.g. "samedi" / "Saturday") pre-computed
34
- * server-side. Provided so clients can render the correct day without
35
- * reparsing `date`.
36
- */
37
- weekday: string
38
- minTempC: number
39
- maxTempC: number
40
- iconUrl: string | null
41
- condition?: string | null
42
- }
43
-
44
- export interface WeatherSectionI {
45
- componentType: 'Weather'
46
- title: string
47
- subtitle?: string
48
- locationName: string
49
- timezone: string
50
- days: WeatherDayI[]
51
- lastUpdatedAt: string
52
- dataSource: 'weatherapi'
53
- backgroundColor?: string
54
- }
55
-
56
- export interface HeaderSectionI {
57
- componentType: 'Header'
58
- title: string
59
- subtitle: string
60
- }
61
-
62
- export interface AdviceI {
63
- id?: string | number
64
- title: string
65
- markdownContent: string
66
- titleColor?: string
67
- backgroundColor?: string
68
- }
69
-
70
- export interface AdviceSectionI {
71
- componentType: 'AdviceCarousel'
72
- title?: string
73
- subtitle?: string
74
- advices: AdviceI[]
75
- }
76
-
77
- export interface WideCardAuthorI {
78
- name?: string | null
79
- imageURL?: string | null
80
- }
81
-
82
- export interface WideCardItemI {
83
- id?: string | number
84
- title?: string | null
85
- text: string
86
- badgeText?: string | null
87
- thumbnailImageURL: string
88
- author?: WideCardAuthorI | null
89
- link?: string | null
90
- metadata?: Record<string, unknown>
91
- }
92
-
93
- export interface WideCardsCarouselSectionI {
94
- componentType: 'WideCardsCarousel'
95
- title: string
96
- subtitle?: string
97
- cards: WideCardItemI[]
98
- }
99
-
100
- export interface HeroCardBlueprintI {
101
- mode: HeroCardMode
102
- title?: string | null
103
- description?: string | null
104
- backgroundColor?: string | null
105
- backgroundImageUrl?: string | null
106
- ctaLabel?: string | null
107
- ctaRoute?: string | null
108
- previewPlants?: PlantI[]
109
- selection?: SelectionI | null
110
- plant?: PlantI | null
111
- }
112
-
113
- export interface HeroCardsSectionI {
114
- componentType: 'HeroCards'
115
- title?: string | null
116
- subtitle?: string | null
117
- cards: HeroCardBlueprintI[]
118
- }
119
-
120
- export interface PlantCarouselSectionI {
121
- componentType: 'PlantCarousel'
122
- title: string
123
- subtitle?: string
124
- selection: SelectionI
125
- displayRanking?: boolean
126
- }
127
-
128
- export interface HeroCardsCarouselSectionI {
129
- componentType: 'HeroCardsCarousel'
130
- selections: SelectionI[]
131
- }
132
-
133
- export interface FamilyRecommendationI {
134
- family: string
135
- headline: string
136
- plants: PlantI[]
137
- }
138
-
139
- export interface FamilyExplorerSectionI {
140
- componentType: 'FamilyExplorer'
141
- title: string
142
- subtitle?: string
143
- families: FamilyRecommendationI[]
144
- }
145
-
146
- export interface OnboardingStepI {
147
- id: string
148
- title: string
149
- description: string
150
- isCompleted: boolean
151
- ctaLink: string
152
- }
153
-
154
- export interface OnboardingCardSectionI {
155
- componentType: 'OnboardingCard'
156
- title: string
157
- subtitle: string
158
- steps: OnboardingStepI[]
159
- completedStepsCount: number
160
- totalStepsCount: number
161
- }
162
-
163
- /**
164
- * Mission Engine
165
- * --------------
166
- * A mission is a reusable, data-driven collection of measurable steps that
167
- * guides a member toward an objective. Completing every step unlocks the
168
- * reward and (server-side) enrolls the member into the mission's Audience for
169
- * downstream automation. The frontend only renders the completion state the
170
- * backend computes — it never decides whether a step is done.
171
- *
172
- * Shipped under a NEW `componentType` ('MissionCard') so older app builds that
173
- * only know 'OnboardingCard' gracefully skip it instead of rendering the new
174
- * (incompatible) shape.
175
- */
176
- /** Visual identity of a mission — drives all color decisions on the card. */
177
- export interface MissionThemeI {
178
- /** Accent color: badge, progress bar, reward text, icon tints. */
179
- accentColor: string
180
- /** Background color: card header and reward section surface. */
181
- backgroundColor: string
182
- /** Text color for content rendered on the backgroundColor surface. */
183
- textColor: string
184
- }
185
-
186
- export interface MissionRewardI {
187
- /** Heading above the reward, e.g. "Ta récompense". */
188
- title: string
189
- /** Fine print, e.g. "À utiliser sur ta prochaine commande !". */
190
- description: string
191
- /** Short highlight, e.g. "-10%" or "5 $ de rabais". */
192
- badgeText: string
193
- /** Partner brand the reward belongs to, e.g. "Semences du Portage". Null for first-party rewards. */
194
- partnerName?: string | null
195
- partnerLogoURL?: string | null
196
- /** Coupon / discount code to redeem the reward. Revealed on completion. */
197
- discountCode?: string | null
198
- /** Outbound link to redeem (partner store, already UTM/discount-decorated). */
199
- ctaLink?: string | null
200
- }
201
-
202
- export interface MissionStepI {
203
- id: string
204
- title: string
205
- subtitle?: string
206
- /** FontAwesome icon name. Ignored when `imageURL` is set. */
207
- icon?: string | null
208
- /** Custom image shown instead of an icon. */
209
- imageURL?: string | null
210
- /** Completion is decided by the backend; the client just displays it. */
211
- isCompleted: boolean
212
- /** Deep link / route opened when the step is tapped (every step has a CTA). */
213
- ctaLink: string
214
- /**
215
- * When present, tapping this step activates the named onboarding flow on
216
- * the destination screen. Null means no tutorial is attached to this step.
217
- */
218
- onboardingFlowId?: string | null
219
- }
220
-
221
- export interface MissionCardSectionI {
222
- componentType: 'MissionCard'
223
- /** Stable mission identifier (slug) — also used as the section id. */
224
- id: string
225
- title: string
226
- subtitle: string
227
- description?: string
228
- /** Visual theme applied to the card and all its sub-elements. */
229
- theme: MissionThemeI
230
- /** Illustration aligned to the right of the card. */
231
- backgroundImageURL?: string
232
- steps: MissionStepI[]
233
- completedStepsCount: number
234
- totalStepsCount: number
235
- /** True once every step is complete (reward unlocked). */
236
- isCompleted: boolean
237
- reward: MissionRewardI
238
- /** Display order across missions (ascending). */
239
- sortOrder: number
240
- }
241
-
242
- /** Minimal plant info for preview display (e.g. parent plant in grouped tasks) */
243
- export interface TaskPlantPreviewI {
244
- name: string
245
- slug: string
246
- imageURL?: string | null
247
- }
248
-
249
- /** Plant info within a family group — includes the task ID specific to this plant */
250
- export interface TaskFamilyPlantPreviewI extends TaskPlantPreviewI {
251
- taskId: number
252
- }
253
-
254
- /** Family group info when multiple plants share the same task */
255
- export interface TaskFamilyGroupI {
256
- familyName: string
257
- plantsCount: number
258
- plants: TaskFamilyPlantPreviewI[]
259
- }
260
-
261
- export interface UpcomingTaskI {
262
- task: TaskI
263
- /** PlantSelection id used by task list views to group tasks per planted item. */
264
- plantSelectionId?: number
265
- plantName: string
266
- plantSlug: string
267
- plantImageURL?: string | null
268
- gardenName: string
269
- gardenCategory: string
270
- selectionSlug: string
271
- /** If this task is grouped by family */
272
- familyGroup?: TaskFamilyGroupI
273
- }
274
-
275
- export type TaskListView = 'current' | 'completed' | 'earlier'
276
-
277
- export interface UpcomingTaskAdviceI {
278
- /** @deprecated Since 1.9.10, this field is always `''`. */
279
- content: string
280
- taskName: string
281
- plantName: string
282
- plantSlug: string
283
- plantImageURL?: string | null
284
- gardenName: string
285
- gardenCategory: string
286
- selectionSlug: string
287
- task: TaskI
288
- /** If this task is grouped by family */
289
- familyGroup?: TaskFamilyGroupI
290
- }
291
-
292
- export interface UpcomingTasksSectionI {
293
- componentType: 'UpcomingTasks'
294
- title: string
295
- subtitle?: string
296
- advices: UpcomingTaskAdviceI[]
297
- }
298
-
299
- /** Preview plant for WhenToSeedWhat section */
300
- export interface WhenToSeedWhatPlantPreviewI {
301
- id: number
302
- name: string
303
- family?: string | null
304
- slug: string
305
- imageURL?: string | null
306
- }
307
-
308
- /** A generic link card section with title, subtitle, URL, and optional preview images */
309
- export interface LinkCardSectionI {
310
- componentType: 'LinkCard'
311
- title: string
312
- subtitle?: string
313
- url: string
314
- previewPlants?: WhenToSeedWhatPlantPreviewI[]
315
- backgroundColor?: string
316
- /** Show a red badge indicator (replaces the plant preview stack when true) */
317
- showBadge?: boolean
318
- /** Optional badge count to display */
319
- badgeCount?: number
320
- }
321
-
322
- export type SectionI =
323
- | HeaderSectionI
324
- | HeroCardsSectionI
325
- | PlantCarouselSectionI
326
- | HeroCardsCarouselSectionI
327
- | WideCardsCarouselSectionI
328
- | WeatherSectionI
329
- | AdviceSectionI
330
- | OnboardingCardSectionI
331
- | MissionCardSectionI
332
- | UpcomingTasksSectionI
333
- | LinkCardSectionI
334
-
335
- export interface Response {
336
- sections: SectionI[]
337
- weather?: WeatherSectionI
338
- advice?: AdviceSectionI
339
- }
340
-
341
- export interface HeroCardItemI {
342
- id?: string | null
343
- mode: HeroCardMode
344
- title?: string | null
345
- description?: string | null
346
- backgroundColor?: string | null
347
- backgroundImageUrl?: string | null
348
- previewPlants?: PlantI[]
349
- ctaLabel?: string | null
350
- selection?: SelectionI | null
351
- plant?: PlantI | null
352
- ctaRoute?: string | null
353
- }
354
- }
1
+ import type { PlantI } from './plant'
2
+ import type { SelectionI } from './selection'
3
+ import type { TaskI } from './task'
4
+
5
+ export namespace HOME {
6
+ export type HeroCardMode = 'featuredSelection' | 'featuredPlant'
7
+
8
+ export type SectionComponentType =
9
+ | 'Header'
10
+ | 'HeroCards'
11
+ | 'PlantCarousel'
12
+ | 'HeroCardsCarousel'
13
+ | 'WideCardsCarousel'
14
+ | 'Weather'
15
+ | 'AdviceCarousel'
16
+ | 'OnboardingCard'
17
+ | 'MissionCard'
18
+ | 'UpcomingTasks'
19
+
20
+ export type CarouselComponentType = Extract<
21
+ SectionComponentType,
22
+ 'PlantCarousel' | 'HeroCardsCarousel' | 'WideCardsCarousel'
23
+ >
24
+
25
+ export interface WeatherDayI {
26
+ /**
27
+ * Forecast date anchored at noon UTC, e.g. `2026-06-10T12:00:00Z`.
28
+ * Noon avoids clients parsing a bare `YYYY-MM-DD` as UTC midnight and
29
+ * displaying the previous local day in negative-offset timezones.
30
+ */
31
+ date: string
32
+ /**
33
+ * Localized weekday label (e.g. "samedi" / "Saturday") pre-computed
34
+ * server-side. Provided so clients can render the correct day without
35
+ * reparsing `date`.
36
+ */
37
+ weekday: string
38
+ minTempC: number
39
+ maxTempC: number
40
+ iconUrl: string | null
41
+ condition?: string | null
42
+ }
43
+
44
+ export interface WeatherSectionI {
45
+ componentType: 'Weather'
46
+ title: string
47
+ subtitle?: string
48
+ locationName: string
49
+ timezone: string
50
+ days: WeatherDayI[]
51
+ lastUpdatedAt: string
52
+ dataSource: 'weatherapi'
53
+ backgroundColor?: string
54
+ }
55
+
56
+ export interface HeaderSectionI {
57
+ componentType: 'Header'
58
+ title: string
59
+ subtitle: string
60
+ }
61
+
62
+ export interface AdviceI {
63
+ id?: string | number
64
+ title: string
65
+ markdownContent: string
66
+ titleColor?: string
67
+ backgroundColor?: string
68
+ }
69
+
70
+ export interface AdviceSectionI {
71
+ componentType: 'AdviceCarousel'
72
+ title?: string
73
+ subtitle?: string
74
+ advices: AdviceI[]
75
+ }
76
+
77
+ export interface WideCardAuthorI {
78
+ name?: string | null
79
+ imageURL?: string | null
80
+ }
81
+
82
+ export interface WideCardItemI {
83
+ id?: string | number
84
+ title?: string | null
85
+ text: string
86
+ badgeText?: string | null
87
+ thumbnailImageURL: string
88
+ author?: WideCardAuthorI | null
89
+ link?: string | null
90
+ metadata?: Record<string, unknown>
91
+ }
92
+
93
+ export interface WideCardsCarouselSectionI {
94
+ componentType: 'WideCardsCarousel'
95
+ title: string
96
+ subtitle?: string
97
+ cards: WideCardItemI[]
98
+ }
99
+
100
+ export interface HeroCardBlueprintI {
101
+ mode: HeroCardMode
102
+ title?: string | null
103
+ description?: string | null
104
+ backgroundColor?: string | null
105
+ backgroundImageUrl?: string | null
106
+ ctaLabel?: string | null
107
+ ctaRoute?: string | null
108
+ previewPlants?: PlantI[]
109
+ selection?: SelectionI | null
110
+ plant?: PlantI | null
111
+ }
112
+
113
+ export interface HeroCardsSectionI {
114
+ componentType: 'HeroCards'
115
+ title?: string | null
116
+ subtitle?: string | null
117
+ cards: HeroCardBlueprintI[]
118
+ }
119
+
120
+ export interface PlantCarouselSectionI {
121
+ componentType: 'PlantCarousel'
122
+ title: string
123
+ subtitle?: string
124
+ selection: SelectionI
125
+ displayRanking?: boolean
126
+ }
127
+
128
+ export interface HeroCardsCarouselSectionI {
129
+ componentType: 'HeroCardsCarousel'
130
+ selections: SelectionI[]
131
+ }
132
+
133
+ export interface FamilyRecommendationI {
134
+ family: string
135
+ headline: string
136
+ plants: PlantI[]
137
+ }
138
+
139
+ export interface FamilyExplorerSectionI {
140
+ componentType: 'FamilyExplorer'
141
+ title: string
142
+ subtitle?: string
143
+ families: FamilyRecommendationI[]
144
+ }
145
+
146
+ export interface OnboardingStepI {
147
+ id: string
148
+ title: string
149
+ description: string
150
+ isCompleted: boolean
151
+ ctaLink: string
152
+ }
153
+
154
+ export interface OnboardingCardSectionI {
155
+ componentType: 'OnboardingCard'
156
+ title: string
157
+ subtitle: string
158
+ steps: OnboardingStepI[]
159
+ completedStepsCount: number
160
+ totalStepsCount: number
161
+ }
162
+
163
+ /**
164
+ * Mission Engine
165
+ * --------------
166
+ * A mission is a reusable, data-driven collection of measurable steps that
167
+ * guides a member toward an objective. Completing every step unlocks the
168
+ * reward and (server-side) enrolls the member into the mission's Audience for
169
+ * downstream automation. The frontend only renders the completion state the
170
+ * backend computes — it never decides whether a step is done.
171
+ *
172
+ * Shipped under a NEW `componentType` ('MissionCard') so older app builds that
173
+ * only know 'OnboardingCard' gracefully skip it instead of rendering the new
174
+ * (incompatible) shape.
175
+ */
176
+ /** Visual identity of a mission — drives all color decisions on the card. */
177
+ export interface MissionThemeI {
178
+ /** Accent color: badge, progress bar, reward text, icon tints. */
179
+ accentColor: string
180
+ /** Background color: card header and reward section surface. */
181
+ backgroundColor: string
182
+ /** Text color for content rendered on the backgroundColor surface. */
183
+ textColor: string
184
+ }
185
+
186
+ export interface MissionRewardI {
187
+ /** Heading above the reward, e.g. "Ta récompense". */
188
+ title: string
189
+ /** Fine print, e.g. "À utiliser sur ta prochaine commande !". */
190
+ description: string
191
+ /** Short highlight, e.g. "-10%" or "5 $ de rabais". */
192
+ badgeText: string
193
+ /** Partner brand the reward belongs to, e.g. "Semences du Portage". Null for first-party rewards. */
194
+ partnerName?: string | null
195
+ partnerLogoURL?: string | null
196
+ /** Coupon / discount code to redeem the reward. Revealed on completion. */
197
+ discountCode?: string | null
198
+ /** Outbound link to redeem (partner store, already UTM/discount-decorated). */
199
+ ctaLink?: string | null
200
+ }
201
+
202
+ export interface MissionStepI {
203
+ id: string
204
+ title: string
205
+ subtitle?: string
206
+ /** FontAwesome icon name. Ignored when `imageURL` is set. */
207
+ icon?: string | null
208
+ /** Custom image shown instead of an icon. */
209
+ imageURL?: string | null
210
+ /** Completion is decided by the backend; the client just displays it. */
211
+ isCompleted: boolean
212
+ /** Deep link / route opened when the step is tapped (every step has a CTA). */
213
+ ctaLink: string
214
+ /**
215
+ * When present, tapping this step activates the named onboarding flow on
216
+ * the destination screen. Null means no tutorial is attached to this step.
217
+ */
218
+ onboardingFlowId?: string | null
219
+ }
220
+
221
+ export interface MissionCardSectionI {
222
+ componentType: 'MissionCard'
223
+ /** Stable mission identifier (slug) — also used as the section id. */
224
+ id: string
225
+ title: string
226
+ subtitle: string
227
+ description?: string
228
+ /** Visual theme applied to the card and all its sub-elements. */
229
+ theme: MissionThemeI
230
+ /** Illustration aligned to the right of the card. */
231
+ backgroundImageURL?: string
232
+ steps: MissionStepI[]
233
+ completedStepsCount: number
234
+ totalStepsCount: number
235
+ /** True once every step is complete (reward unlocked). */
236
+ isCompleted: boolean
237
+ reward?: MissionRewardI | null
238
+ /** Display order across missions (ascending). */
239
+ sortOrder: number
240
+ }
241
+
242
+ /** Minimal plant info for preview display (e.g. parent plant in grouped tasks) */
243
+ export interface TaskPlantPreviewI {
244
+ name: string
245
+ slug: string
246
+ imageURL?: string | null
247
+ }
248
+
249
+ /** Plant info within a family group — includes the task ID specific to this plant */
250
+ export interface TaskFamilyPlantPreviewI extends TaskPlantPreviewI {
251
+ taskId: number
252
+ }
253
+
254
+ /** Family group info when multiple plants share the same task */
255
+ export interface TaskFamilyGroupI {
256
+ familyName: string
257
+ plantsCount: number
258
+ plants: TaskFamilyPlantPreviewI[]
259
+ }
260
+
261
+ export interface UpcomingTaskI {
262
+ task: TaskI
263
+ /** PlantSelection id used by task list views to group tasks per planted item. */
264
+ plantSelectionId?: number
265
+ plantName: string
266
+ plantSlug: string
267
+ plantImageURL?: string | null
268
+ gardenName: string
269
+ gardenCategory: string
270
+ selectionSlug: string
271
+ /** If this task is grouped by family */
272
+ familyGroup?: TaskFamilyGroupI
273
+ }
274
+
275
+ export type TaskListView = 'current' | 'completed' | 'earlier'
276
+
277
+ export interface UpcomingTaskAdviceI {
278
+ /** @deprecated Since 1.9.10, this field is always `''`. */
279
+ content: string
280
+ taskName: string
281
+ plantName: string
282
+ plantSlug: string
283
+ plantImageURL?: string | null
284
+ gardenName: string
285
+ gardenCategory: string
286
+ selectionSlug: string
287
+ task: TaskI
288
+ /** If this task is grouped by family */
289
+ familyGroup?: TaskFamilyGroupI
290
+ }
291
+
292
+ export interface UpcomingTasksSectionI {
293
+ componentType: 'UpcomingTasks'
294
+ title: string
295
+ subtitle?: string
296
+ advices: UpcomingTaskAdviceI[]
297
+ }
298
+
299
+ /** Preview plant for WhenToSeedWhat section */
300
+ export interface WhenToSeedWhatPlantPreviewI {
301
+ id: number
302
+ name: string
303
+ family?: string | null
304
+ slug: string
305
+ imageURL?: string | null
306
+ }
307
+
308
+ /** A generic link card section with title, subtitle, URL, and optional preview images */
309
+ export interface LinkCardSectionI {
310
+ componentType: 'LinkCard'
311
+ title: string
312
+ subtitle?: string
313
+ url: string
314
+ previewPlants?: WhenToSeedWhatPlantPreviewI[]
315
+ backgroundColor?: string
316
+ /** Show a red badge indicator (replaces the plant preview stack when true) */
317
+ showBadge?: boolean
318
+ /** Optional badge count to display */
319
+ badgeCount?: number
320
+ }
321
+
322
+ export type SectionI =
323
+ | HeaderSectionI
324
+ | HeroCardsSectionI
325
+ | PlantCarouselSectionI
326
+ | HeroCardsCarouselSectionI
327
+ | WideCardsCarouselSectionI
328
+ | WeatherSectionI
329
+ | AdviceSectionI
330
+ | OnboardingCardSectionI
331
+ | MissionCardSectionI
332
+ | UpcomingTasksSectionI
333
+ | LinkCardSectionI
334
+
335
+ export interface Response {
336
+ sections: SectionI[]
337
+ weather?: WeatherSectionI
338
+ advice?: AdviceSectionI
339
+ }
340
+
341
+ export interface HeroCardItemI {
342
+ id?: string | null
343
+ mode: HeroCardMode
344
+ title?: string | null
345
+ description?: string | null
346
+ backgroundColor?: string | null
347
+ backgroundImageUrl?: string | null
348
+ previewPlants?: PlantI[]
349
+ ctaLabel?: string | null
350
+ selection?: SelectionI | null
351
+ plant?: PlantI | null
352
+ ctaRoute?: string | null
353
+ }
354
+ }