@mushi-mushi/web 1.12.1 → 1.14.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
@@ -1,4 +1,4 @@
1
- import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiWidgetConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
1
+ import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiWidgetConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
2
2
  export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
3
3
 
4
4
  declare class Mushi {
@@ -21,7 +21,7 @@ declare class Mushi {
21
21
  * user-facing ARIA / keyboard wiring.
22
22
  */
23
23
 
24
- type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap';
24
+ type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap' | 'account' | 'cross-app-reports';
25
25
  interface WidgetRewardsState {
26
26
  tier: {
27
27
  slug: string;
@@ -54,6 +54,8 @@ interface WidgetCallbacks {
54
54
  */
55
55
  onSubmit(data: {
56
56
  category: MushiReportCategory;
57
+ /** Set when the host configured `widget.categories` — the raw custom id chosen by the user. */
58
+ userCategory?: string;
57
59
  description: string;
58
60
  intent?: string;
59
61
  }): void | Promise<WidgetSubmitOutcome | void>;
@@ -75,6 +77,15 @@ interface WidgetCallbacks {
75
77
  action: string;
76
78
  }>;
77
79
  onLeaderboardOpen?(): void;
80
+ /** Request a magic-link sign-in for the in-widget Mushi community. */
81
+ onMushiSignIn?(email: string): Promise<{
82
+ ok: boolean;
83
+ error?: string;
84
+ }>;
85
+ /** Fetch the global public leaderboard for the in-widget Mushi community. */
86
+ onGlobalLeaderboardOpen?(): void;
87
+ /** Fetch cross-app reports for the signed-in tester. */
88
+ onCrossAppReportsOpen?(): void;
78
89
  }
79
90
  declare class MushiWidget {
80
91
  private readonly sdkVersion;
@@ -85,6 +96,11 @@ declare class MushiWidget {
85
96
  private locale;
86
97
  private isOpen;
87
98
  private step;
99
+ /**
100
+ * The selected category id. May be a built-in `MushiReportCategory` or a
101
+ * custom id from `config.categories`. Cast to `MushiReportCategory` only
102
+ * after resolving through `resolveBaseCategory()`.
103
+ */
88
104
  private selectedCategory;
89
105
  private selectedIntent;
90
106
  /**
@@ -147,12 +163,43 @@ declare class MushiWidget {
147
163
  private lastSubmitQueuedOffline;
148
164
  /** Whether the user has clicked ✕ on the header banner this session. */
149
165
  private bannerDismissed;
166
+ /** Persisted FAB position when draggable is enabled. */
167
+ private fabPos;
168
+ /** Cleanup fn for visualViewport keyboard listener. */
169
+ private vvCleanup;
170
+ /** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
171
+ private testerJwt;
172
+ /** Tester identity (public_handle, display_name). */
173
+ private testerInfo;
174
+ /** Cross-app reports for the signed-in tester. */
175
+ private crossAppReports;
176
+ private crossAppLoading;
177
+ /** Global leaderboard entries (from mushi_testers, not org-scoped). */
178
+ private globalLeaderboard;
179
+ private globalLeaderboardLoading;
180
+ /** Reputation for the signed-in tester. */
181
+ private testerReputation;
182
+ /** Whether an in-widget magic-link email was just sent. */
183
+ private magicLinkSent;
184
+ private magicLinkEmail;
185
+ private magicLinkError;
150
186
  constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks, sdkVersion?: string);
151
187
  mount(): void;
152
188
  getIsMounted(): boolean;
153
189
  updateConfig(config?: MushiWidgetConfig): void;
190
+ /** Find a custom category entry by id. Returns undefined for built-in ids. */
191
+ private resolveCustomCategory;
192
+ /**
193
+ * Map a (possibly custom) category id to the built-in `MushiReportCategory`
194
+ * used for the report wire format. Falls back to `'other'`.
195
+ */
196
+ private resolveBaseCategory;
197
+ /** Icon for the selected category — custom entry's icon or built-in emoji. */
198
+ private categoryIcon;
199
+ /** Label for the selected category — custom entry label or built-in i18n string. */
200
+ private categoryLabel;
154
201
  open(options?: {
155
- category?: MushiReportCategory;
202
+ category?: MushiReportCategory | string;
156
203
  featureRequest?: boolean;
157
204
  }): void;
158
205
  close(): void;
@@ -197,6 +244,14 @@ declare class MushiWidget {
197
244
  total_points: number;
198
245
  points_30d: number;
199
246
  }> | null, loading?: boolean): void;
247
+ setTesterSession(jwt: string | null, info: {
248
+ id: string;
249
+ public_handle: string | null;
250
+ display_name: string | null;
251
+ } | null): void;
252
+ setGlobalLeaderboard(entries: MushiLeaderboardEntry[] | null, loading?: boolean): void;
253
+ setCrossAppReports(reports: MushiCrossAppReport[] | null, loading?: boolean): void;
254
+ setTesterReputation(rep: MushiTesterReputation | null): void;
200
255
  destroy(): void;
201
256
  /**
202
257
  * Apply the SDK-owned pass-through layout to the host element so it is
@@ -253,6 +308,23 @@ declare class MushiWidget {
253
308
  */
254
309
  private computeAvoidTopPx;
255
310
  private applyInsetVars;
311
+ /** Storage key for the FAB position, scoped to projectId when available. */
312
+ private fabStorageKey;
313
+ /** Move the FAB to the given translated offset (relative to the inset origin),
314
+ * clamping inside viewport safe area, and optionally snap to nearest edge.
315
+ *
316
+ * The FAB's CSS anchor can be any corner (bottom-right, bottom-left, …) so we
317
+ * must derive the *base* position (CSS anchor with zero drag offset) to compute
318
+ * correct clamp bounds and snap targets. We do this by subtracting the
319
+ * already-applied drag offset from the live getBoundingClientRect() value. */
320
+ private moveFab;
321
+ /** Load previously persisted FAB position. */
322
+ private loadFabPos;
323
+ /** Attach Pointer Events-based drag to the trigger element. */
324
+ private attachDragHandlers;
325
+ /** Lift the panel above the software keyboard using visualViewport. */
326
+ private attachViewportHandlers;
327
+ private teardownViewportHandlers;
256
328
  private renderStep;
257
329
  private renderOutdatedBanner;
258
330
  private renderBrandFooter;
@@ -298,6 +370,8 @@ declare class MushiWidget {
298
370
  private renderReportsStep;
299
371
  private renderRoadmapStep;
300
372
  private renderLeaderboardStep;
373
+ private renderAccountStep;
374
+ private renderCrossAppReportsStep;
301
375
  private renderReportDetailStep;
302
376
  private renderIntentStep;
303
377
  private effectiveMinLength;
@@ -346,6 +420,7 @@ declare class MushiWidget {
346
420
  private loadReporterComments;
347
421
  private submitReporterFeedback;
348
422
  private submitReporterReply;
423
+ private handleMagicLinkSend;
349
424
  getRecorderStep(): WidgetStep;
350
425
  getRecorderTrigger(): Element | null;
351
426
  getRecorderCategoryButton(category: MushiReportCategory): Element | null;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiWidgetConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
1
+ import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiWidgetConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiLeaderboardEntry, MushiCrossAppReport, MushiTesterReputation, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiTracePropagationConfig, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
2
2
  export { MushiApiCascadeConfig, MushiConfig, MushiConsoleEntry, MushiDiagnosticsResult, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiTimelineEntry, MushiTimelineKind, MushiUrlMatcher, MushiWidgetConfig } from '@mushi-mushi/core';
3
3
 
4
4
  declare class Mushi {
@@ -21,7 +21,7 @@ declare class Mushi {
21
21
  * user-facing ARIA / keyboard wiring.
22
22
  */
23
23
 
24
- type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap';
24
+ type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail' | 'leaderboard' | 'roadmap' | 'account' | 'cross-app-reports';
25
25
  interface WidgetRewardsState {
26
26
  tier: {
27
27
  slug: string;
@@ -54,6 +54,8 @@ interface WidgetCallbacks {
54
54
  */
55
55
  onSubmit(data: {
56
56
  category: MushiReportCategory;
57
+ /** Set when the host configured `widget.categories` — the raw custom id chosen by the user. */
58
+ userCategory?: string;
57
59
  description: string;
58
60
  intent?: string;
59
61
  }): void | Promise<WidgetSubmitOutcome | void>;
@@ -75,6 +77,15 @@ interface WidgetCallbacks {
75
77
  action: string;
76
78
  }>;
77
79
  onLeaderboardOpen?(): void;
80
+ /** Request a magic-link sign-in for the in-widget Mushi community. */
81
+ onMushiSignIn?(email: string): Promise<{
82
+ ok: boolean;
83
+ error?: string;
84
+ }>;
85
+ /** Fetch the global public leaderboard for the in-widget Mushi community. */
86
+ onGlobalLeaderboardOpen?(): void;
87
+ /** Fetch cross-app reports for the signed-in tester. */
88
+ onCrossAppReportsOpen?(): void;
78
89
  }
79
90
  declare class MushiWidget {
80
91
  private readonly sdkVersion;
@@ -85,6 +96,11 @@ declare class MushiWidget {
85
96
  private locale;
86
97
  private isOpen;
87
98
  private step;
99
+ /**
100
+ * The selected category id. May be a built-in `MushiReportCategory` or a
101
+ * custom id from `config.categories`. Cast to `MushiReportCategory` only
102
+ * after resolving through `resolveBaseCategory()`.
103
+ */
88
104
  private selectedCategory;
89
105
  private selectedIntent;
90
106
  /**
@@ -147,12 +163,43 @@ declare class MushiWidget {
147
163
  private lastSubmitQueuedOffline;
148
164
  /** Whether the user has clicked ✕ on the header banner this session. */
149
165
  private bannerDismissed;
166
+ /** Persisted FAB position when draggable is enabled. */
167
+ private fabPos;
168
+ /** Cleanup fn for visualViewport keyboard listener. */
169
+ private vvCleanup;
170
+ /** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
171
+ private testerJwt;
172
+ /** Tester identity (public_handle, display_name). */
173
+ private testerInfo;
174
+ /** Cross-app reports for the signed-in tester. */
175
+ private crossAppReports;
176
+ private crossAppLoading;
177
+ /** Global leaderboard entries (from mushi_testers, not org-scoped). */
178
+ private globalLeaderboard;
179
+ private globalLeaderboardLoading;
180
+ /** Reputation for the signed-in tester. */
181
+ private testerReputation;
182
+ /** Whether an in-widget magic-link email was just sent. */
183
+ private magicLinkSent;
184
+ private magicLinkEmail;
185
+ private magicLinkError;
150
186
  constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks, sdkVersion?: string);
151
187
  mount(): void;
152
188
  getIsMounted(): boolean;
153
189
  updateConfig(config?: MushiWidgetConfig): void;
190
+ /** Find a custom category entry by id. Returns undefined for built-in ids. */
191
+ private resolveCustomCategory;
192
+ /**
193
+ * Map a (possibly custom) category id to the built-in `MushiReportCategory`
194
+ * used for the report wire format. Falls back to `'other'`.
195
+ */
196
+ private resolveBaseCategory;
197
+ /** Icon for the selected category — custom entry's icon or built-in emoji. */
198
+ private categoryIcon;
199
+ /** Label for the selected category — custom entry label or built-in i18n string. */
200
+ private categoryLabel;
154
201
  open(options?: {
155
- category?: MushiReportCategory;
202
+ category?: MushiReportCategory | string;
156
203
  featureRequest?: boolean;
157
204
  }): void;
158
205
  close(): void;
@@ -197,6 +244,14 @@ declare class MushiWidget {
197
244
  total_points: number;
198
245
  points_30d: number;
199
246
  }> | null, loading?: boolean): void;
247
+ setTesterSession(jwt: string | null, info: {
248
+ id: string;
249
+ public_handle: string | null;
250
+ display_name: string | null;
251
+ } | null): void;
252
+ setGlobalLeaderboard(entries: MushiLeaderboardEntry[] | null, loading?: boolean): void;
253
+ setCrossAppReports(reports: MushiCrossAppReport[] | null, loading?: boolean): void;
254
+ setTesterReputation(rep: MushiTesterReputation | null): void;
200
255
  destroy(): void;
201
256
  /**
202
257
  * Apply the SDK-owned pass-through layout to the host element so it is
@@ -253,6 +308,23 @@ declare class MushiWidget {
253
308
  */
254
309
  private computeAvoidTopPx;
255
310
  private applyInsetVars;
311
+ /** Storage key for the FAB position, scoped to projectId when available. */
312
+ private fabStorageKey;
313
+ /** Move the FAB to the given translated offset (relative to the inset origin),
314
+ * clamping inside viewport safe area, and optionally snap to nearest edge.
315
+ *
316
+ * The FAB's CSS anchor can be any corner (bottom-right, bottom-left, …) so we
317
+ * must derive the *base* position (CSS anchor with zero drag offset) to compute
318
+ * correct clamp bounds and snap targets. We do this by subtracting the
319
+ * already-applied drag offset from the live getBoundingClientRect() value. */
320
+ private moveFab;
321
+ /** Load previously persisted FAB position. */
322
+ private loadFabPos;
323
+ /** Attach Pointer Events-based drag to the trigger element. */
324
+ private attachDragHandlers;
325
+ /** Lift the panel above the software keyboard using visualViewport. */
326
+ private attachViewportHandlers;
327
+ private teardownViewportHandlers;
256
328
  private renderStep;
257
329
  private renderOutdatedBanner;
258
330
  private renderBrandFooter;
@@ -298,6 +370,8 @@ declare class MushiWidget {
298
370
  private renderReportsStep;
299
371
  private renderRoadmapStep;
300
372
  private renderLeaderboardStep;
373
+ private renderAccountStep;
374
+ private renderCrossAppReportsStep;
301
375
  private renderReportDetailStep;
302
376
  private renderIntentStep;
303
377
  private effectiveMinLength;
@@ -346,6 +420,7 @@ declare class MushiWidget {
346
420
  private loadReporterComments;
347
421
  private submitReporterFeedback;
348
422
  private submitReporterReply;
423
+ private handleMagicLinkSend;
349
424
  getRecorderStep(): WidgetStep;
350
425
  getRecorderTrigger(): Element | null;
351
426
  getRecorderCategoryButton(category: MushiReportCategory): Element | null;