@mushi-mushi/react-native 0.22.0 → 0.23.0

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.cts CHANGED
@@ -74,6 +74,42 @@ declare function getDeviceInfo(): DeviceInfo;
74
74
  /** The subset of the web `analytics` block that applies on native. */
75
75
  type RNAnalyticsConfig = Pick<MushiAnalyticsConfig, 'enabled' | 'consent' | 'flushIntervalMs' | 'propertyAllowlist'>;
76
76
 
77
+ /**
78
+ * FILE: theme.ts
79
+ * PURPOSE: Host-adaptive theme for the RN report sheet (`widget.theme`).
80
+ *
81
+ * OVERVIEW:
82
+ * - Defaults are neutral: the shared washi/sumi surfaces with an INK accent,
83
+ * so the sheet reads as part of the host app rather than a neon Mushi
84
+ * product. The neon palette is only used by `<MushiBanner variant="neon">`.
85
+ * - Hosts override any token. When a host sets `accent` but not `accentFg`,
86
+ * the text colour on the accent is picked for contrast (black or white).
87
+ *
88
+ * Plan 018 (docs/execplans/reporter-loop-v2.md §1.4).
89
+ */
90
+ interface MushiRNTheme {
91
+ /** Sheet background. */
92
+ bg: string;
93
+ /** Primary text. */
94
+ fg: string;
95
+ /** Secondary text. */
96
+ muted: string;
97
+ /** Cards, inputs, chips. */
98
+ surface: string;
99
+ /** Borders and separators. */
100
+ border: string;
101
+ /** Selected chip, primary button, links. */
102
+ accent: string;
103
+ /** Text on `accent`. */
104
+ accentFg: string;
105
+ success: string;
106
+ error: string;
107
+ /** Host font family; undefined keeps the platform font. */
108
+ fontFamily?: string;
109
+ /** Corner radius for cards, inputs and buttons. */
110
+ radius: number;
111
+ }
112
+
77
113
  interface MushiRNConfig {
78
114
  projectId: string;
79
115
  apiKey: string;
@@ -115,6 +151,13 @@ interface MushiRNConfig {
115
151
  };
116
152
  /** Poll interval (ms) for My Reports while the inbox tab is open. 0 = off (default). */
117
153
  inboxPollIntervalMs?: number;
154
+ /**
155
+ * Theme tokens for the report sheet (bg, fg, muted, surface, border,
156
+ * accent, accentFg, success, error, fontFamily, radius). Unset tokens
157
+ * use neutral system-style defaults with an ink accent; when only
158
+ * `accent` is set, the text on it is chosen for contrast.
159
+ */
160
+ theme?: Partial<MushiRNTheme>;
118
161
  };
119
162
  assistant?: {
120
163
  enabled?: boolean;
@@ -226,8 +269,12 @@ interface MushiRNInstance {
226
269
  }): void;
227
270
  /** List this device's reports ordered by most recent. Returns [] on failure. */
228
271
  listMyReports(): Promise<MushiReporterReport[]>;
229
- /** List admin + reporter comments on a specific report. */
272
+ /** List admin + reporter comments on a specific report. Returns [] on failure. */
230
273
  listMyComments(reportId: string): Promise<MushiReporterComment[]>;
274
+ /** Like `listMyComments`, but resolves `null` when the thread could not be loaded, so a UI can offer Retry. */
275
+ loadMyThread(reportId: string): Promise<MushiReporterComment[] | null>;
276
+ /** Mark this device's unread notifications for a report as read. Resolves the number marked (0 on failure). */
277
+ markReportRead(reportId: string): Promise<number>;
231
278
  /** Post a reporter reply on a report thread. Returns the new comment or null on failure. */
232
279
  replyToReport(reportId: string, body: string): Promise<MushiReporterComment | null>;
233
280
  /** Record a reporter feedback signal (e.g. `confirms`, `not_fixed`) on a report. Returns the outcome or null. */
@@ -283,7 +330,9 @@ declare function useMushiWidget(): {
283
330
  * - Slide-up modal built entirely on RN built-ins (Modal, Animated, PanResponder)
284
331
  * - Conversational flow: category → description → submit → confirmation
285
332
  * - Drag-to-dismiss via PanResponder on the handle area
286
- * - Dark/light theme via useColorScheme
333
+ * - Host-adaptive theme (`widget.theme`, see ../theme.ts) over light/dark
334
+ * - "Your reports": statuses come from the shared core table
335
+ * (`@mushi-mushi/core/reporter-ui`), so web and RN say the same thing
287
336
  *
288
337
  * DEPENDENCIES:
289
338
  * - React Native built-in APIs only (no third-party libs)
@@ -297,10 +346,14 @@ declare function useMushiWidget(): {
297
346
  * - PanResponder threshold: 80 px downward drag dismisses
298
347
  * - Animated.spring for slide-up, Animated.timing for backdrop
299
348
  * - Success confirmation auto-closes after 1.4 s
349
+ * - Thread loads show a skeleton, then Retry on failure; a failed reply keeps
350
+ * its text and offers Retry. Opening a thread marks it read.
300
351
  *
301
352
  * NOTES:
302
353
  * - KeyboardAvoidingView wraps the sheet so the text input stays visible
303
354
  * - Categories match the web SDK: bug, slow, visual, confusing, other
355
+ * - accessibilityViewIsModal is iOS-only; RN's Modal is its own window on
356
+ * Android, which keeps TalkBack focus inside the sheet there.
304
357
  */
305
358
 
306
359
  interface MushiBottomSheetProps {
@@ -324,6 +377,8 @@ interface MushiBottomSheetProps {
324
377
  assistantSuggestions?: string[];
325
378
  /** Poll My Reports while inbox tab is open. 0 disables polling. */
326
379
  inboxPollIntervalMs?: number;
380
+ /** Theme tokens (`widget.theme`); unset tokens use the neutral defaults. */
381
+ theme?: Partial<MushiRNTheme>;
327
382
  }
328
383
  declare const MushiBottomSheet: FC<MushiBottomSheetProps>;
329
384
 
package/dist/index.d.ts CHANGED
@@ -74,6 +74,42 @@ declare function getDeviceInfo(): DeviceInfo;
74
74
  /** The subset of the web `analytics` block that applies on native. */
75
75
  type RNAnalyticsConfig = Pick<MushiAnalyticsConfig, 'enabled' | 'consent' | 'flushIntervalMs' | 'propertyAllowlist'>;
76
76
 
77
+ /**
78
+ * FILE: theme.ts
79
+ * PURPOSE: Host-adaptive theme for the RN report sheet (`widget.theme`).
80
+ *
81
+ * OVERVIEW:
82
+ * - Defaults are neutral: the shared washi/sumi surfaces with an INK accent,
83
+ * so the sheet reads as part of the host app rather than a neon Mushi
84
+ * product. The neon palette is only used by `<MushiBanner variant="neon">`.
85
+ * - Hosts override any token. When a host sets `accent` but not `accentFg`,
86
+ * the text colour on the accent is picked for contrast (black or white).
87
+ *
88
+ * Plan 018 (docs/execplans/reporter-loop-v2.md §1.4).
89
+ */
90
+ interface MushiRNTheme {
91
+ /** Sheet background. */
92
+ bg: string;
93
+ /** Primary text. */
94
+ fg: string;
95
+ /** Secondary text. */
96
+ muted: string;
97
+ /** Cards, inputs, chips. */
98
+ surface: string;
99
+ /** Borders and separators. */
100
+ border: string;
101
+ /** Selected chip, primary button, links. */
102
+ accent: string;
103
+ /** Text on `accent`. */
104
+ accentFg: string;
105
+ success: string;
106
+ error: string;
107
+ /** Host font family; undefined keeps the platform font. */
108
+ fontFamily?: string;
109
+ /** Corner radius for cards, inputs and buttons. */
110
+ radius: number;
111
+ }
112
+
77
113
  interface MushiRNConfig {
78
114
  projectId: string;
79
115
  apiKey: string;
@@ -115,6 +151,13 @@ interface MushiRNConfig {
115
151
  };
116
152
  /** Poll interval (ms) for My Reports while the inbox tab is open. 0 = off (default). */
117
153
  inboxPollIntervalMs?: number;
154
+ /**
155
+ * Theme tokens for the report sheet (bg, fg, muted, surface, border,
156
+ * accent, accentFg, success, error, fontFamily, radius). Unset tokens
157
+ * use neutral system-style defaults with an ink accent; when only
158
+ * `accent` is set, the text on it is chosen for contrast.
159
+ */
160
+ theme?: Partial<MushiRNTheme>;
118
161
  };
119
162
  assistant?: {
120
163
  enabled?: boolean;
@@ -226,8 +269,12 @@ interface MushiRNInstance {
226
269
  }): void;
227
270
  /** List this device's reports ordered by most recent. Returns [] on failure. */
228
271
  listMyReports(): Promise<MushiReporterReport[]>;
229
- /** List admin + reporter comments on a specific report. */
272
+ /** List admin + reporter comments on a specific report. Returns [] on failure. */
230
273
  listMyComments(reportId: string): Promise<MushiReporterComment[]>;
274
+ /** Like `listMyComments`, but resolves `null` when the thread could not be loaded, so a UI can offer Retry. */
275
+ loadMyThread(reportId: string): Promise<MushiReporterComment[] | null>;
276
+ /** Mark this device's unread notifications for a report as read. Resolves the number marked (0 on failure). */
277
+ markReportRead(reportId: string): Promise<number>;
231
278
  /** Post a reporter reply on a report thread. Returns the new comment or null on failure. */
232
279
  replyToReport(reportId: string, body: string): Promise<MushiReporterComment | null>;
233
280
  /** Record a reporter feedback signal (e.g. `confirms`, `not_fixed`) on a report. Returns the outcome or null. */
@@ -283,7 +330,9 @@ declare function useMushiWidget(): {
283
330
  * - Slide-up modal built entirely on RN built-ins (Modal, Animated, PanResponder)
284
331
  * - Conversational flow: category → description → submit → confirmation
285
332
  * - Drag-to-dismiss via PanResponder on the handle area
286
- * - Dark/light theme via useColorScheme
333
+ * - Host-adaptive theme (`widget.theme`, see ../theme.ts) over light/dark
334
+ * - "Your reports": statuses come from the shared core table
335
+ * (`@mushi-mushi/core/reporter-ui`), so web and RN say the same thing
287
336
  *
288
337
  * DEPENDENCIES:
289
338
  * - React Native built-in APIs only (no third-party libs)
@@ -297,10 +346,14 @@ declare function useMushiWidget(): {
297
346
  * - PanResponder threshold: 80 px downward drag dismisses
298
347
  * - Animated.spring for slide-up, Animated.timing for backdrop
299
348
  * - Success confirmation auto-closes after 1.4 s
349
+ * - Thread loads show a skeleton, then Retry on failure; a failed reply keeps
350
+ * its text and offers Retry. Opening a thread marks it read.
300
351
  *
301
352
  * NOTES:
302
353
  * - KeyboardAvoidingView wraps the sheet so the text input stays visible
303
354
  * - Categories match the web SDK: bug, slow, visual, confusing, other
355
+ * - accessibilityViewIsModal is iOS-only; RN's Modal is its own window on
356
+ * Android, which keeps TalkBack focus inside the sheet there.
304
357
  */
305
358
 
306
359
  interface MushiBottomSheetProps {
@@ -324,6 +377,8 @@ interface MushiBottomSheetProps {
324
377
  assistantSuggestions?: string[];
325
378
  /** Poll My Reports while inbox tab is open. 0 disables polling. */
326
379
  inboxPollIntervalMs?: number;
380
+ /** Theme tokens (`widget.theme`); unset tokens use the neutral defaults. */
381
+ theme?: Partial<MushiRNTheme>;
327
382
  }
328
383
  declare const MushiBottomSheet: FC<MushiBottomSheetProps>;
329
384