@mushi-mushi/web 0.5.1 → 0.8.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,11 +1,12 @@
1
- import { MushiConfig, MushiSDKInstance, MushiWidgetConfig, MushiReportCategory, MushiConsoleEntry, MushiNetworkEntry, MushiPerformanceMetrics, MushiSelectedElement } from '@mushi-mushi/core';
2
- export { MushiConfig, MushiConsoleEntry, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiWidgetConfig } from '@mushi-mushi/core';
1
+ import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiWidgetConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
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 {
5
5
  private constructor();
6
6
  static init(config: MushiConfig): MushiSDKInstance;
7
7
  static getInstance(): MushiSDKInstance | null;
8
8
  static destroy(): void;
9
+ static diagnose(): Promise<MushiDiagnosticsResult>;
9
10
  }
10
11
 
11
12
  /**
@@ -29,9 +30,14 @@ interface WidgetCallbacks {
29
30
  onOpen(): void;
30
31
  onClose(): void;
31
32
  onScreenshotRequest(): void;
33
+ onScreenshotRemove?(): void;
32
34
  onElementSelectorRequest?(): void;
35
+ onReporterReportsRequest?(): Promise<MushiReporterReport[]>;
36
+ onReporterCommentsRequest?(reportId: string): Promise<MushiReporterComment[]>;
37
+ onReporterReply?(reportId: string, body: string): Promise<void>;
33
38
  }
34
39
  declare class MushiWidget {
40
+ private readonly sdkVersion;
35
41
  private host;
36
42
  private shadow;
37
43
  private config;
@@ -42,8 +48,21 @@ declare class MushiWidget {
42
48
  private selectedCategory;
43
49
  private selectedIntent;
44
50
  private screenshotAttached;
51
+ private allowScreenshotRemove;
45
52
  private elementSelected;
46
53
  private submitting;
54
+ private triggerVisible;
55
+ private triggerShrunk;
56
+ private triggerHiddenByScroll;
57
+ private sdkFreshness;
58
+ private reporterReports;
59
+ private reporterComments;
60
+ private selectedReportId;
61
+ private reporterLoading;
62
+ private reporterError;
63
+ private attachedLaunchers;
64
+ private smartHideCleanup;
65
+ private smartHideTimer;
47
66
  /** Captured at the moment of submit so the success ledger metadata
48
67
  * ("REPORT · 14:23:07 JST") doesn't drift while the success step
49
68
  * is on screen. */
@@ -54,20 +73,42 @@ declare class MushiWidget {
54
73
  * root) for up to ~3.3s after destroy. */
55
74
  private successTimer;
56
75
  private autoCloseTimer;
57
- constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks);
76
+ constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks, sdkVersion?: string);
58
77
  mount(): void;
78
+ getIsMounted(): boolean;
59
79
  updateConfig(config?: MushiWidgetConfig): void;
60
80
  open(options?: {
61
81
  category?: MushiReportCategory;
62
82
  }): void;
63
83
  close(): void;
64
84
  getIsOpen(): boolean;
85
+ showTrigger(): void;
86
+ hideTrigger(): void;
87
+ setTrigger(trigger: NonNullable<MushiWidgetConfig['trigger']>): void;
88
+ attachTo(selectorOrElement: string | Element, options?: MushiWidgetConfig): () => void;
65
89
  setScreenshotAttached(attached: boolean): void;
90
+ setAllowScreenshotRemove(allow: boolean): void;
66
91
  setElementSelected(selected: boolean): void;
92
+ setSdkFreshness(info: {
93
+ latest: string | null;
94
+ current: string;
95
+ deprecated: boolean;
96
+ message?: string | null;
97
+ }): void;
67
98
  destroy(): void;
99
+ private syncAttachedLaunchers;
100
+ private syncSmartHide;
101
+ private shouldRenderTrigger;
102
+ private effectiveTrigger;
103
+ private isMobileSmartHidden;
104
+ private detectEnvironment;
105
+ private isRouteHidden;
68
106
  private getTheme;
69
107
  private render;
108
+ private applyInsetVars;
70
109
  private renderStep;
110
+ private renderOutdatedBanner;
111
+ private renderBrandFooter;
71
112
  /**
72
113
  * Editorial masthead. Always carries:
73
114
  * • the brand mark (虫 kanji on vermillion, "MUSHI" in mono above)
@@ -86,6 +127,8 @@ declare class MushiWidget {
86
127
  */
87
128
  private renderStepIndicator;
88
129
  private renderCategoryStep;
130
+ private renderReportsStep;
131
+ private renderReportDetailStep;
89
132
  private renderIntentStep;
90
133
  private renderDetailsStep;
91
134
  /**
@@ -99,6 +142,10 @@ declare class MushiWidget {
99
142
  private renderSuccessStep;
100
143
  private attachHandlers;
101
144
  private trapFocus;
145
+ private unreadCount;
146
+ private loadReporterReports;
147
+ private loadReporterComments;
148
+ private submitReporterReply;
102
149
  }
103
150
 
104
151
  interface ConsoleCapture {
@@ -111,14 +158,23 @@ declare function createConsoleCapture(): ConsoleCapture;
111
158
  interface NetworkCapture {
112
159
  getEntries(): MushiNetworkEntry[];
113
160
  clear(): void;
161
+ updateOptions(options: NetworkCaptureOptions): void;
114
162
  destroy(): void;
115
163
  }
116
- declare function createNetworkCapture(): NetworkCapture;
164
+ interface NetworkCaptureOptions {
165
+ apiEndpoint?: string;
166
+ ignoreUrls?: MushiUrlMatcher[];
167
+ }
168
+ declare function createNetworkCapture(options?: NetworkCaptureOptions): NetworkCapture;
117
169
 
118
170
  interface ScreenshotCapture {
119
171
  take(): Promise<string | null>;
172
+ updateOptions(options: ScreenshotCaptureOptions): void;
120
173
  }
121
- declare function createScreenshotCapture(): ScreenshotCapture;
174
+ interface ScreenshotCaptureOptions {
175
+ privacy?: MushiPrivacyConfig;
176
+ }
177
+ declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
122
178
 
123
179
  interface PerformanceCapture {
124
180
  getMetrics(): MushiPerformanceMetrics;
@@ -133,6 +189,21 @@ interface ElementSelector {
133
189
  }
134
190
  declare function createElementSelector(): ElementSelector;
135
191
 
192
+ interface TimelineCapture {
193
+ setScreen(screen: {
194
+ name: string;
195
+ route?: string;
196
+ feature?: string;
197
+ }): void;
198
+ getEntries(input?: {
199
+ consoleLogs?: MushiConsoleEntry[] | null;
200
+ networkLogs?: MushiNetworkEntry[] | null;
201
+ }): MushiTimelineEntry[];
202
+ clear(): void;
203
+ destroy(): void;
204
+ }
205
+ declare function createTimelineCapture(): TimelineCapture;
206
+
136
207
  interface MushiLocale {
137
208
  widget: {
138
209
  trigger: string;
@@ -183,7 +254,8 @@ declare function createProactiveManager(config?: Partial<ProactiveConfig>): Proa
183
254
  interface ProactiveTriggerConfig {
184
255
  rageClick?: boolean;
185
256
  longTask?: boolean;
186
- apiCascade?: boolean;
257
+ apiCascade?: boolean | MushiApiCascadeConfig;
258
+ apiEndpoint?: string;
187
259
  errorBoundary?: boolean;
188
260
  }
189
261
  interface ProactiveTriggerCallbacks {
@@ -194,4 +266,4 @@ interface ProactiveTriggerCleanup {
194
266
  }
195
267
  declare function setupProactiveTriggers(callbacks: ProactiveTriggerCallbacks, config?: ProactiveTriggerConfig): ProactiveTriggerCleanup;
196
268
 
197
- export { type ConsoleCapture, type ElementSelector, Mushi, type MushiLocale, MushiWidget, type NetworkCapture, type PerformanceCapture, type ProactiveConfig, type ProactiveManager, type ProactiveTriggerCallbacks, type ProactiveTriggerCleanup, type ScreenshotCapture, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager, createScreenshotCapture, getAvailableLocales, getLocale, setupProactiveTriggers };
269
+ export { type ConsoleCapture, type ElementSelector, Mushi, type MushiLocale, MushiWidget, type NetworkCapture, type PerformanceCapture, type ProactiveConfig, type ProactiveManager, type ProactiveTriggerCallbacks, type ProactiveTriggerCleanup, type ScreenshotCapture, type TimelineCapture, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager, createScreenshotCapture, createTimelineCapture, getAvailableLocales, getLocale, setupProactiveTriggers };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { MushiConfig, MushiSDKInstance, MushiWidgetConfig, MushiReportCategory, MushiConsoleEntry, MushiNetworkEntry, MushiPerformanceMetrics, MushiSelectedElement } from '@mushi-mushi/core';
2
- export { MushiConfig, MushiConsoleEntry, MushiEnvironment, MushiEventHandler, MushiEventType, MushiNetworkEntry, MushiPerformanceMetrics, MushiReport, MushiReportCategory, MushiSDKInstance, MushiWidgetConfig } from '@mushi-mushi/core';
1
+ import { MushiConfig, MushiSDKInstance, MushiDiagnosticsResult, MushiWidgetConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiConsoleEntry, MushiNetworkEntry, MushiUrlMatcher, MushiPrivacyConfig, MushiPerformanceMetrics, MushiSelectedElement, MushiTimelineEntry, MushiApiCascadeConfig } from '@mushi-mushi/core';
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 {
5
5
  private constructor();
6
6
  static init(config: MushiConfig): MushiSDKInstance;
7
7
  static getInstance(): MushiSDKInstance | null;
8
8
  static destroy(): void;
9
+ static diagnose(): Promise<MushiDiagnosticsResult>;
9
10
  }
10
11
 
11
12
  /**
@@ -29,9 +30,14 @@ interface WidgetCallbacks {
29
30
  onOpen(): void;
30
31
  onClose(): void;
31
32
  onScreenshotRequest(): void;
33
+ onScreenshotRemove?(): void;
32
34
  onElementSelectorRequest?(): void;
35
+ onReporterReportsRequest?(): Promise<MushiReporterReport[]>;
36
+ onReporterCommentsRequest?(reportId: string): Promise<MushiReporterComment[]>;
37
+ onReporterReply?(reportId: string, body: string): Promise<void>;
33
38
  }
34
39
  declare class MushiWidget {
40
+ private readonly sdkVersion;
35
41
  private host;
36
42
  private shadow;
37
43
  private config;
@@ -42,8 +48,21 @@ declare class MushiWidget {
42
48
  private selectedCategory;
43
49
  private selectedIntent;
44
50
  private screenshotAttached;
51
+ private allowScreenshotRemove;
45
52
  private elementSelected;
46
53
  private submitting;
54
+ private triggerVisible;
55
+ private triggerShrunk;
56
+ private triggerHiddenByScroll;
57
+ private sdkFreshness;
58
+ private reporterReports;
59
+ private reporterComments;
60
+ private selectedReportId;
61
+ private reporterLoading;
62
+ private reporterError;
63
+ private attachedLaunchers;
64
+ private smartHideCleanup;
65
+ private smartHideTimer;
47
66
  /** Captured at the moment of submit so the success ledger metadata
48
67
  * ("REPORT · 14:23:07 JST") doesn't drift while the success step
49
68
  * is on screen. */
@@ -54,20 +73,42 @@ declare class MushiWidget {
54
73
  * root) for up to ~3.3s after destroy. */
55
74
  private successTimer;
56
75
  private autoCloseTimer;
57
- constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks);
76
+ constructor(config: MushiWidgetConfig | undefined, callbacks: WidgetCallbacks, sdkVersion?: string);
58
77
  mount(): void;
78
+ getIsMounted(): boolean;
59
79
  updateConfig(config?: MushiWidgetConfig): void;
60
80
  open(options?: {
61
81
  category?: MushiReportCategory;
62
82
  }): void;
63
83
  close(): void;
64
84
  getIsOpen(): boolean;
85
+ showTrigger(): void;
86
+ hideTrigger(): void;
87
+ setTrigger(trigger: NonNullable<MushiWidgetConfig['trigger']>): void;
88
+ attachTo(selectorOrElement: string | Element, options?: MushiWidgetConfig): () => void;
65
89
  setScreenshotAttached(attached: boolean): void;
90
+ setAllowScreenshotRemove(allow: boolean): void;
66
91
  setElementSelected(selected: boolean): void;
92
+ setSdkFreshness(info: {
93
+ latest: string | null;
94
+ current: string;
95
+ deprecated: boolean;
96
+ message?: string | null;
97
+ }): void;
67
98
  destroy(): void;
99
+ private syncAttachedLaunchers;
100
+ private syncSmartHide;
101
+ private shouldRenderTrigger;
102
+ private effectiveTrigger;
103
+ private isMobileSmartHidden;
104
+ private detectEnvironment;
105
+ private isRouteHidden;
68
106
  private getTheme;
69
107
  private render;
108
+ private applyInsetVars;
70
109
  private renderStep;
110
+ private renderOutdatedBanner;
111
+ private renderBrandFooter;
71
112
  /**
72
113
  * Editorial masthead. Always carries:
73
114
  * • the brand mark (虫 kanji on vermillion, "MUSHI" in mono above)
@@ -86,6 +127,8 @@ declare class MushiWidget {
86
127
  */
87
128
  private renderStepIndicator;
88
129
  private renderCategoryStep;
130
+ private renderReportsStep;
131
+ private renderReportDetailStep;
89
132
  private renderIntentStep;
90
133
  private renderDetailsStep;
91
134
  /**
@@ -99,6 +142,10 @@ declare class MushiWidget {
99
142
  private renderSuccessStep;
100
143
  private attachHandlers;
101
144
  private trapFocus;
145
+ private unreadCount;
146
+ private loadReporterReports;
147
+ private loadReporterComments;
148
+ private submitReporterReply;
102
149
  }
103
150
 
104
151
  interface ConsoleCapture {
@@ -111,14 +158,23 @@ declare function createConsoleCapture(): ConsoleCapture;
111
158
  interface NetworkCapture {
112
159
  getEntries(): MushiNetworkEntry[];
113
160
  clear(): void;
161
+ updateOptions(options: NetworkCaptureOptions): void;
114
162
  destroy(): void;
115
163
  }
116
- declare function createNetworkCapture(): NetworkCapture;
164
+ interface NetworkCaptureOptions {
165
+ apiEndpoint?: string;
166
+ ignoreUrls?: MushiUrlMatcher[];
167
+ }
168
+ declare function createNetworkCapture(options?: NetworkCaptureOptions): NetworkCapture;
117
169
 
118
170
  interface ScreenshotCapture {
119
171
  take(): Promise<string | null>;
172
+ updateOptions(options: ScreenshotCaptureOptions): void;
120
173
  }
121
- declare function createScreenshotCapture(): ScreenshotCapture;
174
+ interface ScreenshotCaptureOptions {
175
+ privacy?: MushiPrivacyConfig;
176
+ }
177
+ declare function createScreenshotCapture(options?: ScreenshotCaptureOptions): ScreenshotCapture;
122
178
 
123
179
  interface PerformanceCapture {
124
180
  getMetrics(): MushiPerformanceMetrics;
@@ -133,6 +189,21 @@ interface ElementSelector {
133
189
  }
134
190
  declare function createElementSelector(): ElementSelector;
135
191
 
192
+ interface TimelineCapture {
193
+ setScreen(screen: {
194
+ name: string;
195
+ route?: string;
196
+ feature?: string;
197
+ }): void;
198
+ getEntries(input?: {
199
+ consoleLogs?: MushiConsoleEntry[] | null;
200
+ networkLogs?: MushiNetworkEntry[] | null;
201
+ }): MushiTimelineEntry[];
202
+ clear(): void;
203
+ destroy(): void;
204
+ }
205
+ declare function createTimelineCapture(): TimelineCapture;
206
+
136
207
  interface MushiLocale {
137
208
  widget: {
138
209
  trigger: string;
@@ -183,7 +254,8 @@ declare function createProactiveManager(config?: Partial<ProactiveConfig>): Proa
183
254
  interface ProactiveTriggerConfig {
184
255
  rageClick?: boolean;
185
256
  longTask?: boolean;
186
- apiCascade?: boolean;
257
+ apiCascade?: boolean | MushiApiCascadeConfig;
258
+ apiEndpoint?: string;
187
259
  errorBoundary?: boolean;
188
260
  }
189
261
  interface ProactiveTriggerCallbacks {
@@ -194,4 +266,4 @@ interface ProactiveTriggerCleanup {
194
266
  }
195
267
  declare function setupProactiveTriggers(callbacks: ProactiveTriggerCallbacks, config?: ProactiveTriggerConfig): ProactiveTriggerCleanup;
196
268
 
197
- export { type ConsoleCapture, type ElementSelector, Mushi, type MushiLocale, MushiWidget, type NetworkCapture, type PerformanceCapture, type ProactiveConfig, type ProactiveManager, type ProactiveTriggerCallbacks, type ProactiveTriggerCleanup, type ScreenshotCapture, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager, createScreenshotCapture, getAvailableLocales, getLocale, setupProactiveTriggers };
269
+ export { type ConsoleCapture, type ElementSelector, Mushi, type MushiLocale, MushiWidget, type NetworkCapture, type PerformanceCapture, type ProactiveConfig, type ProactiveManager, type ProactiveTriggerCallbacks, type ProactiveTriggerCleanup, type ScreenshotCapture, type TimelineCapture, createConsoleCapture, createElementSelector, createNetworkCapture, createPerformanceCapture, createProactiveManager, createScreenshotCapture, createTimelineCapture, getAvailableLocales, getLocale, setupProactiveTriggers };