@wasto/cms-components 1.5.11 → 1.5.14

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/dist/index.d.mts CHANGED
@@ -90,12 +90,71 @@ type MapLocation = {
90
90
  badges?: string[];
91
91
  };
92
92
 
93
+ type AppHeaderSlot = "left" | "center" | "right";
94
+ type AppHeaderLogoElement = {
95
+ id: string;
96
+ type: "logo";
97
+ slot: AppHeaderSlot;
98
+ sourceType: "url" | "media";
99
+ url?: string;
100
+ mediaId?: string;
101
+ };
102
+ type AppHeaderTitleElement = {
103
+ id: string;
104
+ type: "title";
105
+ slot: AppHeaderSlot;
106
+ useScreenTitle?: boolean;
107
+ text?: string;
108
+ };
109
+ type AppHeaderActionElement = {
110
+ id: string;
111
+ type: "action";
112
+ slot: AppHeaderSlot;
113
+ icon: string;
114
+ label?: string;
115
+ action: "navigate" | "back";
116
+ href?: string;
117
+ };
118
+ type AppHeaderElement = AppHeaderLogoElement | AppHeaderTitleElement | AppHeaderActionElement;
119
+ type AppHeaderConfig = {
120
+ elements: AppHeaderElement[];
121
+ };
122
+ /** Actions standard (notifications + profil) pour navbar sans titre. */
123
+ declare const DEFAULT_HEADER_ACTIONS: readonly AppHeaderActionElement[];
124
+ type HeaderProps = {
125
+ readonly options: {
126
+ title?: string;
127
+ headerBackVisible?: boolean;
128
+ };
129
+ readonly route: {
130
+ name: string;
131
+ };
132
+ readonly navigation: {
133
+ canGoBack: () => boolean;
134
+ goBack: () => void;
135
+ };
136
+ /** Flotte au-dessus du contenu (ex. carte) : fond transparent. */
137
+ readonly overlay?: boolean;
138
+ /**
139
+ * Config layout (`header.elements`) — logo / actions.
140
+ * Si fournie (même vide), le fallback titre d’écran ne s’applique pas.
141
+ */
142
+ readonly headerConfig?: AppHeaderConfig | null;
143
+ };
144
+ declare function Header({ options, route, navigation, overlay, headerConfig, }: HeaderProps): ReactNode;
145
+
93
146
  type LocationsMapProps = {
94
147
  fullScreen?: boolean;
95
148
  showFilters?: boolean;
96
- /** Header flottant au-dessus de la carte (titre + cloche + profil). */
149
+ /** Header flottant au-dessus de la carte (même navbar que le layout, sans titre). */
97
150
  overlayHeader?: boolean;
151
+ /**
152
+ * @deprecated Ignoré — la navbar n’affiche plus de titre d’écran.
153
+ * Conservé pour compatibilité des configs CMS existantes.
154
+ */
98
155
  overlayTitle?: string;
156
+ /** Override optionnel ; sinon config du layout via `HeaderConfigProvider`. */
157
+ headerConfig?: AppHeaderConfig | null;
99
158
  };
100
159
 
101
160
  /**
@@ -126,7 +185,8 @@ type PageProps = PropsWithChildren & {
126
185
  pullToRefresh?: boolean;
127
186
  };
128
187
  /**
129
- * Page shell: top safe area + optional vertical scroll.
188
+ * Page shell: optional vertical scroll.
189
+ * Top safe area only when no navigation header (avoids a double inset band).
130
190
  * No global horizontal padding — each block uses ContentInset or is full-bleed
131
191
  * (map, calendar grid). Bottom inset is handled by BottomTab when using tabs.
132
192
  */
@@ -174,54 +234,6 @@ type SearchProps = {
174
234
  };
175
235
  declare function Search({ searchType, placeholder, }: SearchProps): ReactNode;
176
236
 
177
- type AppHeaderSlot = "left" | "center" | "right";
178
- type AppHeaderLogoElement = {
179
- id: string;
180
- type: "logo";
181
- slot: AppHeaderSlot;
182
- sourceType: "url" | "media";
183
- url?: string;
184
- mediaId?: string;
185
- };
186
- type AppHeaderTitleElement = {
187
- id: string;
188
- type: "title";
189
- slot: AppHeaderSlot;
190
- useScreenTitle?: boolean;
191
- text?: string;
192
- };
193
- type AppHeaderActionElement = {
194
- id: string;
195
- type: "action";
196
- slot: AppHeaderSlot;
197
- icon: string;
198
- label?: string;
199
- action: "navigate" | "back";
200
- href?: string;
201
- };
202
- type AppHeaderElement = AppHeaderLogoElement | AppHeaderTitleElement | AppHeaderActionElement;
203
- type AppHeaderConfig = {
204
- elements: AppHeaderElement[];
205
- };
206
- type HeaderProps = {
207
- readonly options: {
208
- title?: string;
209
- headerBackVisible?: boolean;
210
- };
211
- readonly route: {
212
- name: string;
213
- };
214
- readonly navigation: {
215
- canGoBack: () => boolean;
216
- goBack: () => void;
217
- };
218
- /** Flotte au-dessus du contenu (ex. carte) : fond transparent. */
219
- readonly overlay?: boolean;
220
- /** Config layout (`header.elements`) — logo / titre / actions. */
221
- readonly headerConfig?: AppHeaderConfig | null;
222
- };
223
- declare function Header({ options, route, navigation, overlay, headerConfig, }: HeaderProps): ReactNode;
224
-
225
237
  type BottomTabProps = BottomTabBarProps;
226
238
  declare function BottomTab({ state, descriptors, navigation, }: BottomTabProps): ReactNode;
227
239
 
@@ -390,6 +402,14 @@ type WastoProviderProps = PropsWithChildren & {
390
402
  declare function WastoProvider(props: WastoProviderProps): ReactNode;
391
403
  declare function useWasto(): WastoContextType;
392
404
 
405
+ type HeaderConfigProviderProps = {
406
+ readonly value: AppHeaderConfig | null;
407
+ readonly children: ReactNode;
408
+ };
409
+ declare function HeaderConfigProvider({ value, children, }: HeaderConfigProviderProps): ReactNode;
410
+ /** Config header du layout parent (`null` si hors provider / non défini). */
411
+ declare function useHeaderConfig(): AppHeaderConfig | null;
412
+
393
413
  type City = {
394
414
  id: string;
395
415
  name: string;
@@ -411,7 +431,7 @@ type WasteCollectionPlace = {
411
431
  /** Ex: "Lundi", "Mardi", ... (mapping lundi=0 … dimanche=6) */
412
432
  name: string;
413
433
  wasteTypeId: string;
414
- biweekly?: boolean;
434
+ everyWeeks?: number;
415
435
  startDate?: string;
416
436
  }>;
417
437
  /** Périodes d’exception (pas de collecte) */
@@ -461,6 +481,16 @@ declare function useAppData(): AppDataContextType;
461
481
  /** Safe variant for hooks that may run outside (preview / tests). */
462
482
  declare function useOptionalAppData(): AppDataContextType | null;
463
483
 
484
+ type RegisterExpoPushTokenOptions = {
485
+ deviceId: string;
486
+ registerPushToken: (deviceId: string, token: string) => Promise<unknown>;
487
+ };
488
+ /**
489
+ * Request OS permission, fetch Expo push token, register it on the API.
490
+ * No-op on web, preview, missing peer, missing EAS projectId, or denied permission.
491
+ */
492
+ declare function registerExpoPushToken(options: RegisterExpoPushTokenOptions): Promise<string | null>;
493
+
464
494
  /** Shared Wasto HTTP client wired with optional API error reporting. */
465
495
  declare function useWastoClient(): WastoClient;
466
496
 
@@ -563,4 +593,4 @@ declare function useAppNavigation(): NavigationApi;
563
593
  /** Soft read — returns null when no provider (e.g. isolated component tests). */
564
594
  declare function useOptionalAppNavigation(): NavigationApi | null;
565
595
 
566
- export { type AppDataContextType, type AppHeaderActionElement, type AppHeaderConfig, type AppHeaderElement, type AppHeaderLogoElement, type AppHeaderSlot, type AppHeaderTitleElement, Article, type ArticleDisplayMode, type ArticleProps, BottomTab, type BottomTabProps, Challenge, type ChallengeProps, ChallengeVignette, type ChallengeVignetteProps, Chat, type ChatProps, CollectionCalendar, type CollectionCalendarProps, Columns, type ColumnsColumnCount, type ColumnsProps, ContentInset, type ContentInsetProps, Header, type HeaderProps, Image, type ImageProps, LocationsMap, type LocationsMapProps, MAQUETTE_COLORS, MAQUETTE_RADII, NEXT_EVENTS_DAY_RADIUS, type NavigationApi, NavigationProvider, type NavigationProviderProps, NextCollection, type NextCollectionProps, NotificationsScreen, Page, type PageProps, Paragraph, type PararaphProps, ProfileScreen, RecyclingInfo, type RecyclingInfoProps, type ResolvedTheme, SPACE, SYSTEM_ROUTES, Search, type SearchProps, type SystemRouteKey, type Theme, type ThemeShadowStyle, Title, type TitleLevel, type TitleProps, Vision, type VisionActionCardProps, type VisionCaptureResult, type VisionProps, type VisionSuggestion, type WastoContextType, type WastoErrorContext, WastoProvider, type WastoProviderProps, type WastoSentryConfig, cardStyle, coloredShadow, createMaquetteTheme, groupedSectionStyle, initWastoSentry, isWastoSentryActive, reportError, resolveTheme, softCardStyle, useAppData, useAppNavigation, useOptionalAppData, useOptionalAppNavigation, useWasto, useWastoClient, wrapWithSentry };
596
+ export { type AppDataContextType, type AppHeaderActionElement, type AppHeaderConfig, type AppHeaderElement, type AppHeaderLogoElement, type AppHeaderSlot, type AppHeaderTitleElement, Article, type ArticleDisplayMode, type ArticleProps, BottomTab, type BottomTabProps, Challenge, type ChallengeProps, ChallengeVignette, type ChallengeVignetteProps, Chat, type ChatProps, CollectionCalendar, type CollectionCalendarProps, Columns, type ColumnsColumnCount, type ColumnsProps, ContentInset, type ContentInsetProps, DEFAULT_HEADER_ACTIONS, Header, HeaderConfigProvider, type HeaderConfigProviderProps, type HeaderProps, Image, type ImageProps, LocationsMap, type LocationsMapProps, MAQUETTE_COLORS, MAQUETTE_RADII, NEXT_EVENTS_DAY_RADIUS, type NavigationApi, NavigationProvider, type NavigationProviderProps, NextCollection, type NextCollectionProps, NotificationsScreen, Page, type PageProps, Paragraph, type PararaphProps, ProfileScreen, RecyclingInfo, type RecyclingInfoProps, type RegisterExpoPushTokenOptions, type ResolvedTheme, SPACE, SYSTEM_ROUTES, Search, type SearchProps, type SystemRouteKey, type Theme, type ThemeShadowStyle, Title, type TitleLevel, type TitleProps, Vision, type VisionActionCardProps, type VisionCaptureResult, type VisionProps, type VisionSuggestion, type WastoContextType, type WastoErrorContext, WastoProvider, type WastoProviderProps, type WastoSentryConfig, cardStyle, coloredShadow, createMaquetteTheme, groupedSectionStyle, initWastoSentry, isWastoSentryActive, registerExpoPushToken, reportError, resolveTheme, softCardStyle, useAppData, useAppNavigation, useHeaderConfig, useOptionalAppData, useOptionalAppNavigation, useWasto, useWastoClient, wrapWithSentry };
package/dist/index.d.ts CHANGED
@@ -90,12 +90,71 @@ type MapLocation = {
90
90
  badges?: string[];
91
91
  };
92
92
 
93
+ type AppHeaderSlot = "left" | "center" | "right";
94
+ type AppHeaderLogoElement = {
95
+ id: string;
96
+ type: "logo";
97
+ slot: AppHeaderSlot;
98
+ sourceType: "url" | "media";
99
+ url?: string;
100
+ mediaId?: string;
101
+ };
102
+ type AppHeaderTitleElement = {
103
+ id: string;
104
+ type: "title";
105
+ slot: AppHeaderSlot;
106
+ useScreenTitle?: boolean;
107
+ text?: string;
108
+ };
109
+ type AppHeaderActionElement = {
110
+ id: string;
111
+ type: "action";
112
+ slot: AppHeaderSlot;
113
+ icon: string;
114
+ label?: string;
115
+ action: "navigate" | "back";
116
+ href?: string;
117
+ };
118
+ type AppHeaderElement = AppHeaderLogoElement | AppHeaderTitleElement | AppHeaderActionElement;
119
+ type AppHeaderConfig = {
120
+ elements: AppHeaderElement[];
121
+ };
122
+ /** Actions standard (notifications + profil) pour navbar sans titre. */
123
+ declare const DEFAULT_HEADER_ACTIONS: readonly AppHeaderActionElement[];
124
+ type HeaderProps = {
125
+ readonly options: {
126
+ title?: string;
127
+ headerBackVisible?: boolean;
128
+ };
129
+ readonly route: {
130
+ name: string;
131
+ };
132
+ readonly navigation: {
133
+ canGoBack: () => boolean;
134
+ goBack: () => void;
135
+ };
136
+ /** Flotte au-dessus du contenu (ex. carte) : fond transparent. */
137
+ readonly overlay?: boolean;
138
+ /**
139
+ * Config layout (`header.elements`) — logo / actions.
140
+ * Si fournie (même vide), le fallback titre d’écran ne s’applique pas.
141
+ */
142
+ readonly headerConfig?: AppHeaderConfig | null;
143
+ };
144
+ declare function Header({ options, route, navigation, overlay, headerConfig, }: HeaderProps): ReactNode;
145
+
93
146
  type LocationsMapProps = {
94
147
  fullScreen?: boolean;
95
148
  showFilters?: boolean;
96
- /** Header flottant au-dessus de la carte (titre + cloche + profil). */
149
+ /** Header flottant au-dessus de la carte (même navbar que le layout, sans titre). */
97
150
  overlayHeader?: boolean;
151
+ /**
152
+ * @deprecated Ignoré — la navbar n’affiche plus de titre d’écran.
153
+ * Conservé pour compatibilité des configs CMS existantes.
154
+ */
98
155
  overlayTitle?: string;
156
+ /** Override optionnel ; sinon config du layout via `HeaderConfigProvider`. */
157
+ headerConfig?: AppHeaderConfig | null;
99
158
  };
100
159
 
101
160
  /**
@@ -126,7 +185,8 @@ type PageProps = PropsWithChildren & {
126
185
  pullToRefresh?: boolean;
127
186
  };
128
187
  /**
129
- * Page shell: top safe area + optional vertical scroll.
188
+ * Page shell: optional vertical scroll.
189
+ * Top safe area only when no navigation header (avoids a double inset band).
130
190
  * No global horizontal padding — each block uses ContentInset or is full-bleed
131
191
  * (map, calendar grid). Bottom inset is handled by BottomTab when using tabs.
132
192
  */
@@ -174,54 +234,6 @@ type SearchProps = {
174
234
  };
175
235
  declare function Search({ searchType, placeholder, }: SearchProps): ReactNode;
176
236
 
177
- type AppHeaderSlot = "left" | "center" | "right";
178
- type AppHeaderLogoElement = {
179
- id: string;
180
- type: "logo";
181
- slot: AppHeaderSlot;
182
- sourceType: "url" | "media";
183
- url?: string;
184
- mediaId?: string;
185
- };
186
- type AppHeaderTitleElement = {
187
- id: string;
188
- type: "title";
189
- slot: AppHeaderSlot;
190
- useScreenTitle?: boolean;
191
- text?: string;
192
- };
193
- type AppHeaderActionElement = {
194
- id: string;
195
- type: "action";
196
- slot: AppHeaderSlot;
197
- icon: string;
198
- label?: string;
199
- action: "navigate" | "back";
200
- href?: string;
201
- };
202
- type AppHeaderElement = AppHeaderLogoElement | AppHeaderTitleElement | AppHeaderActionElement;
203
- type AppHeaderConfig = {
204
- elements: AppHeaderElement[];
205
- };
206
- type HeaderProps = {
207
- readonly options: {
208
- title?: string;
209
- headerBackVisible?: boolean;
210
- };
211
- readonly route: {
212
- name: string;
213
- };
214
- readonly navigation: {
215
- canGoBack: () => boolean;
216
- goBack: () => void;
217
- };
218
- /** Flotte au-dessus du contenu (ex. carte) : fond transparent. */
219
- readonly overlay?: boolean;
220
- /** Config layout (`header.elements`) — logo / titre / actions. */
221
- readonly headerConfig?: AppHeaderConfig | null;
222
- };
223
- declare function Header({ options, route, navigation, overlay, headerConfig, }: HeaderProps): ReactNode;
224
-
225
237
  type BottomTabProps = BottomTabBarProps;
226
238
  declare function BottomTab({ state, descriptors, navigation, }: BottomTabProps): ReactNode;
227
239
 
@@ -390,6 +402,14 @@ type WastoProviderProps = PropsWithChildren & {
390
402
  declare function WastoProvider(props: WastoProviderProps): ReactNode;
391
403
  declare function useWasto(): WastoContextType;
392
404
 
405
+ type HeaderConfigProviderProps = {
406
+ readonly value: AppHeaderConfig | null;
407
+ readonly children: ReactNode;
408
+ };
409
+ declare function HeaderConfigProvider({ value, children, }: HeaderConfigProviderProps): ReactNode;
410
+ /** Config header du layout parent (`null` si hors provider / non défini). */
411
+ declare function useHeaderConfig(): AppHeaderConfig | null;
412
+
393
413
  type City = {
394
414
  id: string;
395
415
  name: string;
@@ -411,7 +431,7 @@ type WasteCollectionPlace = {
411
431
  /** Ex: "Lundi", "Mardi", ... (mapping lundi=0 … dimanche=6) */
412
432
  name: string;
413
433
  wasteTypeId: string;
414
- biweekly?: boolean;
434
+ everyWeeks?: number;
415
435
  startDate?: string;
416
436
  }>;
417
437
  /** Périodes d’exception (pas de collecte) */
@@ -461,6 +481,16 @@ declare function useAppData(): AppDataContextType;
461
481
  /** Safe variant for hooks that may run outside (preview / tests). */
462
482
  declare function useOptionalAppData(): AppDataContextType | null;
463
483
 
484
+ type RegisterExpoPushTokenOptions = {
485
+ deviceId: string;
486
+ registerPushToken: (deviceId: string, token: string) => Promise<unknown>;
487
+ };
488
+ /**
489
+ * Request OS permission, fetch Expo push token, register it on the API.
490
+ * No-op on web, preview, missing peer, missing EAS projectId, or denied permission.
491
+ */
492
+ declare function registerExpoPushToken(options: RegisterExpoPushTokenOptions): Promise<string | null>;
493
+
464
494
  /** Shared Wasto HTTP client wired with optional API error reporting. */
465
495
  declare function useWastoClient(): WastoClient;
466
496
 
@@ -563,4 +593,4 @@ declare function useAppNavigation(): NavigationApi;
563
593
  /** Soft read — returns null when no provider (e.g. isolated component tests). */
564
594
  declare function useOptionalAppNavigation(): NavigationApi | null;
565
595
 
566
- export { type AppDataContextType, type AppHeaderActionElement, type AppHeaderConfig, type AppHeaderElement, type AppHeaderLogoElement, type AppHeaderSlot, type AppHeaderTitleElement, Article, type ArticleDisplayMode, type ArticleProps, BottomTab, type BottomTabProps, Challenge, type ChallengeProps, ChallengeVignette, type ChallengeVignetteProps, Chat, type ChatProps, CollectionCalendar, type CollectionCalendarProps, Columns, type ColumnsColumnCount, type ColumnsProps, ContentInset, type ContentInsetProps, Header, type HeaderProps, Image, type ImageProps, LocationsMap, type LocationsMapProps, MAQUETTE_COLORS, MAQUETTE_RADII, NEXT_EVENTS_DAY_RADIUS, type NavigationApi, NavigationProvider, type NavigationProviderProps, NextCollection, type NextCollectionProps, NotificationsScreen, Page, type PageProps, Paragraph, type PararaphProps, ProfileScreen, RecyclingInfo, type RecyclingInfoProps, type ResolvedTheme, SPACE, SYSTEM_ROUTES, Search, type SearchProps, type SystemRouteKey, type Theme, type ThemeShadowStyle, Title, type TitleLevel, type TitleProps, Vision, type VisionActionCardProps, type VisionCaptureResult, type VisionProps, type VisionSuggestion, type WastoContextType, type WastoErrorContext, WastoProvider, type WastoProviderProps, type WastoSentryConfig, cardStyle, coloredShadow, createMaquetteTheme, groupedSectionStyle, initWastoSentry, isWastoSentryActive, reportError, resolveTheme, softCardStyle, useAppData, useAppNavigation, useOptionalAppData, useOptionalAppNavigation, useWasto, useWastoClient, wrapWithSentry };
596
+ export { type AppDataContextType, type AppHeaderActionElement, type AppHeaderConfig, type AppHeaderElement, type AppHeaderLogoElement, type AppHeaderSlot, type AppHeaderTitleElement, Article, type ArticleDisplayMode, type ArticleProps, BottomTab, type BottomTabProps, Challenge, type ChallengeProps, ChallengeVignette, type ChallengeVignetteProps, Chat, type ChatProps, CollectionCalendar, type CollectionCalendarProps, Columns, type ColumnsColumnCount, type ColumnsProps, ContentInset, type ContentInsetProps, DEFAULT_HEADER_ACTIONS, Header, HeaderConfigProvider, type HeaderConfigProviderProps, type HeaderProps, Image, type ImageProps, LocationsMap, type LocationsMapProps, MAQUETTE_COLORS, MAQUETTE_RADII, NEXT_EVENTS_DAY_RADIUS, type NavigationApi, NavigationProvider, type NavigationProviderProps, NextCollection, type NextCollectionProps, NotificationsScreen, Page, type PageProps, Paragraph, type PararaphProps, ProfileScreen, RecyclingInfo, type RecyclingInfoProps, type RegisterExpoPushTokenOptions, type ResolvedTheme, SPACE, SYSTEM_ROUTES, Search, type SearchProps, type SystemRouteKey, type Theme, type ThemeShadowStyle, Title, type TitleLevel, type TitleProps, Vision, type VisionActionCardProps, type VisionCaptureResult, type VisionProps, type VisionSuggestion, type WastoContextType, type WastoErrorContext, WastoProvider, type WastoProviderProps, type WastoSentryConfig, cardStyle, coloredShadow, createMaquetteTheme, groupedSectionStyle, initWastoSentry, isWastoSentryActive, registerExpoPushToken, reportError, resolveTheme, softCardStyle, useAppData, useAppNavigation, useHeaderConfig, useOptionalAppData, useOptionalAppNavigation, useWasto, useWastoClient, wrapWithSentry };