@mushi-mushi/web 1.13.0 → 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;
@@ -77,6 +77,15 @@ interface WidgetCallbacks {
77
77
  action: string;
78
78
  }>;
79
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;
80
89
  }
81
90
  declare class MushiWidget {
82
91
  private readonly sdkVersion;
@@ -154,6 +163,26 @@ declare class MushiWidget {
154
163
  private lastSubmitQueuedOffline;
155
164
  /** Whether the user has clicked ✕ on the header banner this session. */
156
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;
157
186
  constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks, sdkVersion?: string);
158
187
  mount(): void;
159
188
  getIsMounted(): boolean;
@@ -215,6 +244,14 @@ declare class MushiWidget {
215
244
  total_points: number;
216
245
  points_30d: number;
217
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;
218
255
  destroy(): void;
219
256
  /**
220
257
  * Apply the SDK-owned pass-through layout to the host element so it is
@@ -271,6 +308,23 @@ declare class MushiWidget {
271
308
  */
272
309
  private computeAvoidTopPx;
273
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;
274
328
  private renderStep;
275
329
  private renderOutdatedBanner;
276
330
  private renderBrandFooter;
@@ -316,6 +370,8 @@ declare class MushiWidget {
316
370
  private renderReportsStep;
317
371
  private renderRoadmapStep;
318
372
  private renderLeaderboardStep;
373
+ private renderAccountStep;
374
+ private renderCrossAppReportsStep;
319
375
  private renderReportDetailStep;
320
376
  private renderIntentStep;
321
377
  private effectiveMinLength;
@@ -364,6 +420,7 @@ declare class MushiWidget {
364
420
  private loadReporterComments;
365
421
  private submitReporterFeedback;
366
422
  private submitReporterReply;
423
+ private handleMagicLinkSend;
367
424
  getRecorderStep(): WidgetStep;
368
425
  getRecorderTrigger(): Element | null;
369
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;
@@ -77,6 +77,15 @@ interface WidgetCallbacks {
77
77
  action: string;
78
78
  }>;
79
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;
80
89
  }
81
90
  declare class MushiWidget {
82
91
  private readonly sdkVersion;
@@ -154,6 +163,26 @@ declare class MushiWidget {
154
163
  private lastSubmitQueuedOffline;
155
164
  /** Whether the user has clicked ✕ on the header banner this session. */
156
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;
157
186
  constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks, sdkVersion?: string);
158
187
  mount(): void;
159
188
  getIsMounted(): boolean;
@@ -215,6 +244,14 @@ declare class MushiWidget {
215
244
  total_points: number;
216
245
  points_30d: number;
217
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;
218
255
  destroy(): void;
219
256
  /**
220
257
  * Apply the SDK-owned pass-through layout to the host element so it is
@@ -271,6 +308,23 @@ declare class MushiWidget {
271
308
  */
272
309
  private computeAvoidTopPx;
273
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;
274
328
  private renderStep;
275
329
  private renderOutdatedBanner;
276
330
  private renderBrandFooter;
@@ -316,6 +370,8 @@ declare class MushiWidget {
316
370
  private renderReportsStep;
317
371
  private renderRoadmapStep;
318
372
  private renderLeaderboardStep;
373
+ private renderAccountStep;
374
+ private renderCrossAppReportsStep;
319
375
  private renderReportDetailStep;
320
376
  private renderIntentStep;
321
377
  private effectiveMinLength;
@@ -364,6 +420,7 @@ declare class MushiWidget {
364
420
  private loadReporterComments;
365
421
  private submitReporterFeedback;
366
422
  private submitReporterReply;
423
+ private handleMagicLinkSend;
367
424
  getRecorderStep(): WidgetStep;
368
425
  getRecorderTrigger(): Element | null;
369
426
  getRecorderCategoryButton(category: MushiReportCategory): Element | null;