@mushi-mushi/react-native 0.15.2 → 0.17.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/CHANGELOG.md +932 -0
- package/CONTRIBUTING.md +50 -9
- package/README.md +37 -2
- package/dist/index.cjs +461 -130
- package/dist/index.d.cts +59 -22
- package/dist/index.d.ts +59 -22
- package/dist/index.js +469 -134
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, FC, ReactElement } from 'react';
|
|
4
|
-
import { MushiRewardsConfig, MushiReporterReport, MushiReporterComment, MushiHallOfFameEntry, MushiTierResult, MushiReputationResult } from '@mushi-mushi/core';
|
|
4
|
+
import { MushiRewardsConfig, MushiPageContext, MushiBreadcrumb, MushiReporterReport, MushiReporterComment, MushiHallOfFameEntry, MushiTierResult, MushiReputationResult } from '@mushi-mushi/core';
|
|
5
5
|
export { MushiHallOfFameEntry, MushiReporterComment, MushiReporterReport } from '@mushi-mushi/core';
|
|
6
6
|
|
|
7
7
|
interface ConsoleEntry {
|
|
@@ -72,8 +72,19 @@ interface MushiRNConfig {
|
|
|
72
72
|
console?: boolean;
|
|
73
73
|
network?: boolean;
|
|
74
74
|
navigation?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Capture a screenshot of the current screen when the widget opens.
|
|
77
|
+
* Defaults to `true`. Requires the optional `react-native-view-shot`
|
|
78
|
+
* peer dependency — when it isn't installed, capture is skipped silently
|
|
79
|
+
* (the report is still sent without an image). The user always sees a
|
|
80
|
+
* thumbnail in the sheet and can remove it before submitting, so
|
|
81
|
+
* sensitive screens (balances, PII) are never sent without consent.
|
|
82
|
+
*/
|
|
83
|
+
screenshot?: boolean;
|
|
75
84
|
maxConsoleEntries?: number;
|
|
76
85
|
maxNetworkEntries?: number;
|
|
86
|
+
/** Hard cap on the breadcrumb / repro-timeline ring buffer. Default 50. */
|
|
87
|
+
maxBreadcrumbs?: number;
|
|
77
88
|
};
|
|
78
89
|
storage?: {
|
|
79
90
|
maxQueueSize?: number;
|
|
@@ -104,6 +115,27 @@ interface MushiRNInstance {
|
|
|
104
115
|
provider?: string;
|
|
105
116
|
[k: string]: unknown;
|
|
106
117
|
}): void;
|
|
118
|
+
/**
|
|
119
|
+
* Alias for {@link identify} matching the web SDK's `Mushi.setUser()`.
|
|
120
|
+
* Accepts an object so hosts can call `setUser({ id, email, name })`.
|
|
121
|
+
*/
|
|
122
|
+
setUser(user: {
|
|
123
|
+
id: string;
|
|
124
|
+
email?: string;
|
|
125
|
+
name?: string;
|
|
126
|
+
provider?: string;
|
|
127
|
+
}): void;
|
|
128
|
+
/**
|
|
129
|
+
* Identify the current end user with a signed Mushi identity JWT minted by
|
|
130
|
+
* the host server. Mirrors the web SDK; the backend verifies the signature
|
|
131
|
+
* before trusting any claim. Pass `null` on logout to go anonymous.
|
|
132
|
+
*/
|
|
133
|
+
identifyWithToken(token: string | null): void;
|
|
134
|
+
/**
|
|
135
|
+
* Publish the current screen's context so the assistant can answer
|
|
136
|
+
* page-aware questions. Pass `null` to clear.
|
|
137
|
+
*/
|
|
138
|
+
publishPageContext(context: MushiPageContext | null): void;
|
|
107
139
|
/** Attach arbitrary key/value metadata to subsequent reports. */
|
|
108
140
|
setMetadata(key: string, value: unknown): void;
|
|
109
141
|
/** Set the current screen context attached to subsequent reports. */
|
|
@@ -112,6 +144,10 @@ interface MushiRNInstance {
|
|
|
112
144
|
route?: string;
|
|
113
145
|
feature?: string;
|
|
114
146
|
}): void;
|
|
147
|
+
/** Append a breadcrumb to the repro timeline ring buffer. */
|
|
148
|
+
addBreadcrumb(crumb: Omit<MushiBreadcrumb, 'timestamp'> & {
|
|
149
|
+
timestamp?: number;
|
|
150
|
+
}): void;
|
|
115
151
|
/** List this device's reports ordered by most recent. Returns [] on failure. */
|
|
116
152
|
listMyReports(): Promise<MushiReporterReport[]>;
|
|
117
153
|
/** List admin + reporter comments on a specific report. */
|
|
@@ -131,8 +167,9 @@ interface MushiRNInstance {
|
|
|
131
167
|
/** Returns the current user's reputation + point totals. */
|
|
132
168
|
getReputation(): Promise<MushiReputationResult | null>;
|
|
133
169
|
}
|
|
134
|
-
declare function MushiProvider({ children,
|
|
170
|
+
declare function MushiProvider({ children, config: configProp, ...barePropConfig }: MushiRNConfig & {
|
|
135
171
|
children: ReactNode;
|
|
172
|
+
config?: Partial<MushiRNConfig>;
|
|
136
173
|
}): react_jsx_runtime.JSX.Element;
|
|
137
174
|
|
|
138
175
|
declare function useMushi(): MushiRNInstance | null;
|
|
@@ -188,29 +225,25 @@ interface MushiBottomSheetProps {
|
|
|
188
225
|
declare const MushiBottomSheet: FC<MushiBottomSheetProps>;
|
|
189
226
|
|
|
190
227
|
/**
|
|
191
|
-
*
|
|
192
|
-
* PURPOSE: Floating action button (FAB) that triggers the Mushi bug-report bottom sheet
|
|
193
|
-
*
|
|
194
|
-
* OVERVIEW:
|
|
195
|
-
* - Renders a persistent 🐛 button at bottom-right or bottom-left
|
|
196
|
-
* - Animated press-scale effect via Animated.spring
|
|
197
|
-
* - Position configurable through `buttonPosition` prop
|
|
228
|
+
* MushiFloatingButton — draggable, repositionable FAB for the Mushi SDK.
|
|
198
229
|
*
|
|
199
|
-
*
|
|
200
|
-
* -
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* -
|
|
204
|
-
* -
|
|
205
|
-
*
|
|
206
|
-
* TECHNICAL DETAILS:
|
|
207
|
-
* - Uses Animated.Value for scale, driven by onPressIn / onPressOut
|
|
208
|
-
* - Safe-area aware: extra bottom padding on iOS
|
|
209
|
-
*
|
|
210
|
-
* NOTES:
|
|
211
|
-
* - Keeps zIndex high (9999) so it floats above app content
|
|
230
|
+
* Supports:
|
|
231
|
+
* - PanResponder drag with tap-vs-drag threshold (6 px)
|
|
232
|
+
* - Clamp to screen bounds with safe-area respect
|
|
233
|
+
* - Optional edge-snap on release (`snapToEdge`)
|
|
234
|
+
* - Persist position to AsyncStorage (opt-in via `persist` config)
|
|
235
|
+
* - Press-in / press-out spring scale animation
|
|
236
|
+
* - Dark/light adaptive colours
|
|
212
237
|
*/
|
|
213
238
|
|
|
239
|
+
interface MushiFloatingButtonConfig {
|
|
240
|
+
/** Allow the FAB to be dragged. Default: false. */
|
|
241
|
+
draggable?: boolean;
|
|
242
|
+
/** Snap FAB to the nearest vertical edge on release. Default: true. */
|
|
243
|
+
snapToEdge?: boolean;
|
|
244
|
+
/** Persist FAB position across app restarts via AsyncStorage. Default: false. */
|
|
245
|
+
persist?: boolean;
|
|
246
|
+
}
|
|
214
247
|
interface MushiFloatingButtonProps {
|
|
215
248
|
onPress: () => void;
|
|
216
249
|
position?: 'bottom-right' | 'bottom-left';
|
|
@@ -219,6 +252,10 @@ interface MushiFloatingButtonProps {
|
|
|
219
252
|
left?: number;
|
|
220
253
|
right?: number;
|
|
221
254
|
};
|
|
255
|
+
/** Draggable + persist config */
|
|
256
|
+
config?: MushiFloatingButtonConfig;
|
|
257
|
+
/** Accent color (hex) — falls back to platform blue */
|
|
258
|
+
accent?: string;
|
|
222
259
|
}
|
|
223
260
|
declare const MushiFloatingButton: FC<MushiFloatingButtonProps>;
|
|
224
261
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, FC, ReactElement } from 'react';
|
|
4
|
-
import { MushiRewardsConfig, MushiReporterReport, MushiReporterComment, MushiHallOfFameEntry, MushiTierResult, MushiReputationResult } from '@mushi-mushi/core';
|
|
4
|
+
import { MushiRewardsConfig, MushiPageContext, MushiBreadcrumb, MushiReporterReport, MushiReporterComment, MushiHallOfFameEntry, MushiTierResult, MushiReputationResult } from '@mushi-mushi/core';
|
|
5
5
|
export { MushiHallOfFameEntry, MushiReporterComment, MushiReporterReport } from '@mushi-mushi/core';
|
|
6
6
|
|
|
7
7
|
interface ConsoleEntry {
|
|
@@ -72,8 +72,19 @@ interface MushiRNConfig {
|
|
|
72
72
|
console?: boolean;
|
|
73
73
|
network?: boolean;
|
|
74
74
|
navigation?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Capture a screenshot of the current screen when the widget opens.
|
|
77
|
+
* Defaults to `true`. Requires the optional `react-native-view-shot`
|
|
78
|
+
* peer dependency — when it isn't installed, capture is skipped silently
|
|
79
|
+
* (the report is still sent without an image). The user always sees a
|
|
80
|
+
* thumbnail in the sheet and can remove it before submitting, so
|
|
81
|
+
* sensitive screens (balances, PII) are never sent without consent.
|
|
82
|
+
*/
|
|
83
|
+
screenshot?: boolean;
|
|
75
84
|
maxConsoleEntries?: number;
|
|
76
85
|
maxNetworkEntries?: number;
|
|
86
|
+
/** Hard cap on the breadcrumb / repro-timeline ring buffer. Default 50. */
|
|
87
|
+
maxBreadcrumbs?: number;
|
|
77
88
|
};
|
|
78
89
|
storage?: {
|
|
79
90
|
maxQueueSize?: number;
|
|
@@ -104,6 +115,27 @@ interface MushiRNInstance {
|
|
|
104
115
|
provider?: string;
|
|
105
116
|
[k: string]: unknown;
|
|
106
117
|
}): void;
|
|
118
|
+
/**
|
|
119
|
+
* Alias for {@link identify} matching the web SDK's `Mushi.setUser()`.
|
|
120
|
+
* Accepts an object so hosts can call `setUser({ id, email, name })`.
|
|
121
|
+
*/
|
|
122
|
+
setUser(user: {
|
|
123
|
+
id: string;
|
|
124
|
+
email?: string;
|
|
125
|
+
name?: string;
|
|
126
|
+
provider?: string;
|
|
127
|
+
}): void;
|
|
128
|
+
/**
|
|
129
|
+
* Identify the current end user with a signed Mushi identity JWT minted by
|
|
130
|
+
* the host server. Mirrors the web SDK; the backend verifies the signature
|
|
131
|
+
* before trusting any claim. Pass `null` on logout to go anonymous.
|
|
132
|
+
*/
|
|
133
|
+
identifyWithToken(token: string | null): void;
|
|
134
|
+
/**
|
|
135
|
+
* Publish the current screen's context so the assistant can answer
|
|
136
|
+
* page-aware questions. Pass `null` to clear.
|
|
137
|
+
*/
|
|
138
|
+
publishPageContext(context: MushiPageContext | null): void;
|
|
107
139
|
/** Attach arbitrary key/value metadata to subsequent reports. */
|
|
108
140
|
setMetadata(key: string, value: unknown): void;
|
|
109
141
|
/** Set the current screen context attached to subsequent reports. */
|
|
@@ -112,6 +144,10 @@ interface MushiRNInstance {
|
|
|
112
144
|
route?: string;
|
|
113
145
|
feature?: string;
|
|
114
146
|
}): void;
|
|
147
|
+
/** Append a breadcrumb to the repro timeline ring buffer. */
|
|
148
|
+
addBreadcrumb(crumb: Omit<MushiBreadcrumb, 'timestamp'> & {
|
|
149
|
+
timestamp?: number;
|
|
150
|
+
}): void;
|
|
115
151
|
/** List this device's reports ordered by most recent. Returns [] on failure. */
|
|
116
152
|
listMyReports(): Promise<MushiReporterReport[]>;
|
|
117
153
|
/** List admin + reporter comments on a specific report. */
|
|
@@ -131,8 +167,9 @@ interface MushiRNInstance {
|
|
|
131
167
|
/** Returns the current user's reputation + point totals. */
|
|
132
168
|
getReputation(): Promise<MushiReputationResult | null>;
|
|
133
169
|
}
|
|
134
|
-
declare function MushiProvider({ children,
|
|
170
|
+
declare function MushiProvider({ children, config: configProp, ...barePropConfig }: MushiRNConfig & {
|
|
135
171
|
children: ReactNode;
|
|
172
|
+
config?: Partial<MushiRNConfig>;
|
|
136
173
|
}): react_jsx_runtime.JSX.Element;
|
|
137
174
|
|
|
138
175
|
declare function useMushi(): MushiRNInstance | null;
|
|
@@ -188,29 +225,25 @@ interface MushiBottomSheetProps {
|
|
|
188
225
|
declare const MushiBottomSheet: FC<MushiBottomSheetProps>;
|
|
189
226
|
|
|
190
227
|
/**
|
|
191
|
-
*
|
|
192
|
-
* PURPOSE: Floating action button (FAB) that triggers the Mushi bug-report bottom sheet
|
|
193
|
-
*
|
|
194
|
-
* OVERVIEW:
|
|
195
|
-
* - Renders a persistent 🐛 button at bottom-right or bottom-left
|
|
196
|
-
* - Animated press-scale effect via Animated.spring
|
|
197
|
-
* - Position configurable through `buttonPosition` prop
|
|
228
|
+
* MushiFloatingButton — draggable, repositionable FAB for the Mushi SDK.
|
|
198
229
|
*
|
|
199
|
-
*
|
|
200
|
-
* -
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* -
|
|
204
|
-
* -
|
|
205
|
-
*
|
|
206
|
-
* TECHNICAL DETAILS:
|
|
207
|
-
* - Uses Animated.Value for scale, driven by onPressIn / onPressOut
|
|
208
|
-
* - Safe-area aware: extra bottom padding on iOS
|
|
209
|
-
*
|
|
210
|
-
* NOTES:
|
|
211
|
-
* - Keeps zIndex high (9999) so it floats above app content
|
|
230
|
+
* Supports:
|
|
231
|
+
* - PanResponder drag with tap-vs-drag threshold (6 px)
|
|
232
|
+
* - Clamp to screen bounds with safe-area respect
|
|
233
|
+
* - Optional edge-snap on release (`snapToEdge`)
|
|
234
|
+
* - Persist position to AsyncStorage (opt-in via `persist` config)
|
|
235
|
+
* - Press-in / press-out spring scale animation
|
|
236
|
+
* - Dark/light adaptive colours
|
|
212
237
|
*/
|
|
213
238
|
|
|
239
|
+
interface MushiFloatingButtonConfig {
|
|
240
|
+
/** Allow the FAB to be dragged. Default: false. */
|
|
241
|
+
draggable?: boolean;
|
|
242
|
+
/** Snap FAB to the nearest vertical edge on release. Default: true. */
|
|
243
|
+
snapToEdge?: boolean;
|
|
244
|
+
/** Persist FAB position across app restarts via AsyncStorage. Default: false. */
|
|
245
|
+
persist?: boolean;
|
|
246
|
+
}
|
|
214
247
|
interface MushiFloatingButtonProps {
|
|
215
248
|
onPress: () => void;
|
|
216
249
|
position?: 'bottom-right' | 'bottom-left';
|
|
@@ -219,6 +252,10 @@ interface MushiFloatingButtonProps {
|
|
|
219
252
|
left?: number;
|
|
220
253
|
right?: number;
|
|
221
254
|
};
|
|
255
|
+
/** Draggable + persist config */
|
|
256
|
+
config?: MushiFloatingButtonConfig;
|
|
257
|
+
/** Accent color (hex) — falls back to platform blue */
|
|
258
|
+
accent?: string;
|
|
222
259
|
}
|
|
223
260
|
declare const MushiFloatingButton: FC<MushiFloatingButtonProps>;
|
|
224
261
|
|