@bbearai/core 0.7.0 → 0.7.1
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.mts +21 -6
- package/dist/index.d.ts +21 -6
- package/dist/index.js +59 -9
- package/dist/index.mjs +59 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -301,8 +301,13 @@ interface MonitoringEvent {
|
|
|
301
301
|
/** Sentry breadcrumbs — populated by @bbearai/sentry adapter */
|
|
302
302
|
sentryBreadcrumbs?: unknown[];
|
|
303
303
|
}
|
|
304
|
-
/** Widget color scheme: 'dark'
|
|
304
|
+
/** Widget color scheme: 'dark', 'light', or 'auto' (follows system preference, default). */
|
|
305
305
|
type WidgetColorScheme = 'dark' | 'light' | 'auto';
|
|
306
|
+
/** Server-side widget configuration set by the project admin in the dashboard. */
|
|
307
|
+
interface WidgetConfig {
|
|
308
|
+
/** Admin-forced color scheme. When set, overrides the developer's config and user's OS preference. */
|
|
309
|
+
colorScheme?: WidgetColorScheme;
|
|
310
|
+
}
|
|
306
311
|
interface BugBearTheme {
|
|
307
312
|
/** Primary brand color */
|
|
308
313
|
primaryColor?: string;
|
|
@@ -312,7 +317,7 @@ interface BugBearTheme {
|
|
|
312
317
|
textColor?: string;
|
|
313
318
|
/** Border radius */
|
|
314
319
|
borderRadius?: number;
|
|
315
|
-
/** Color scheme for the widget. Defaults to '
|
|
320
|
+
/** Color scheme for the widget. Defaults to 'auto' (follows OS preference). */
|
|
316
321
|
colorScheme?: WidgetColorScheme;
|
|
317
322
|
}
|
|
318
323
|
type TestTemplate = 'steps' | 'checklist' | 'rubric' | 'freeform';
|
|
@@ -1284,18 +1289,28 @@ declare class BugBearClient {
|
|
|
1284
1289
|
* This is a master switch that admins can toggle in the dashboard
|
|
1285
1290
|
*/
|
|
1286
1291
|
isQAEnabled(): Promise<boolean>;
|
|
1292
|
+
/**
|
|
1293
|
+
* Fetch server-side widget config set by the project admin.
|
|
1294
|
+
* Returns settings like color scheme override. Returns empty config on error.
|
|
1295
|
+
*/
|
|
1296
|
+
getWidgetConfig(): Promise<WidgetConfig>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Check if feedback mode is enabled for this project.
|
|
1299
|
+
* This is a master switch that admins can toggle in the dashboard.
|
|
1300
|
+
*/
|
|
1301
|
+
isFeedbackEnabled(): Promise<boolean>;
|
|
1287
1302
|
/**
|
|
1288
1303
|
* Check if the widget should be visible.
|
|
1289
1304
|
* Behavior depends on the configured mode:
|
|
1290
1305
|
* - 'qa': QA enabled AND user is a registered tester
|
|
1291
|
-
* - 'feedback':
|
|
1292
|
-
* - 'auto':
|
|
1306
|
+
* - 'feedback': Feedback enabled AND user is authenticated
|
|
1307
|
+
* - 'auto': QA tester (if QA enabled) OR authenticated user (if feedback enabled)
|
|
1293
1308
|
*/
|
|
1294
1309
|
shouldShowWidget(): Promise<boolean>;
|
|
1295
1310
|
/**
|
|
1296
1311
|
* Resolve the effective widget mode for the current user.
|
|
1297
1312
|
* - 'qa' or 'feedback' config → returned as-is
|
|
1298
|
-
* - 'auto' →
|
|
1313
|
+
* - 'auto' → QA tester with QA enabled → 'qa', feedback enabled → 'feedback', else 'qa'
|
|
1299
1314
|
*/
|
|
1300
1315
|
getEffectiveMode(): Promise<'qa' | 'feedback'>;
|
|
1301
1316
|
/**
|
|
@@ -1543,4 +1558,4 @@ declare function captureError(error: Error, errorInfo?: {
|
|
|
1543
1558
|
componentStack?: string;
|
|
1544
1559
|
};
|
|
1545
1560
|
|
|
1546
|
-
export { type AddFindingOptions, type AppContext, BUG_CATEGORIES, BugBearClient, type BugBearConfig, type BugBearMode, type BugBearReport, type BugBearTheme, type BugCategory, type ChecklistItem, type ChecklistResult, type ConsoleLogEntry, type CoverageGap, type CoverageMatrixCell, type CoverageMatrixRow, DedupWindow, type DeployChecklist, type DeviceInfo, type EndSessionOptions, type EnhancedBugContext, ErrorMonitor, type FindingSeverity, type FindingType, type HostUserInfo, type IssueCategory, type IssueCounts, LocalStorageAdapter, type MessageSenderType, type MonitorDeps, type MonitoringConfig, type MonitoringEvent, type NetworkRequest, OfflineQueue, type OfflineQueueConfig, type PriorityFactors, type ProjectRole, type QAFinding, type QAHealthMetrics, type QAHealthScore, type QASession, type QASessionStatus, type QATrack, type QueueItem, type QueueItemType, RNApiFailureHandler, RNCrashHandler, RNRageClickHandler, RageClickDetector, type RageClickEvent, type RegressionEvent, type ReportSource, type ReportStatus, type ReportType, type RoutePriority, type RouteTestStats, type RubricMode, type RubricResult, type Severity, type SkipReason, type StartSessionOptions, type StorageAdapter, type SubmitFeedbackOptions, type TestAssignment, type TestFeedback, type TestGroup, type TestResult, type TestStep, type TestTemplate, type TesterInfo, type TesterIssue, type TesterMessage, type TesterProfileUpdate, type TesterThread, type ThreadPriority, type ThreadType, WebApiFailureHandler, WebCrashHandler, WebRageClickHandler, type WidgetColorScheme, captureError, contextCapture, createBugBear, generateFingerprint, isBugCategory, isNetworkError, scrubUrl };
|
|
1561
|
+
export { type AddFindingOptions, type AppContext, BUG_CATEGORIES, BugBearClient, type BugBearConfig, type BugBearMode, type BugBearReport, type BugBearTheme, type BugCategory, type ChecklistItem, type ChecklistResult, type ConsoleLogEntry, type CoverageGap, type CoverageMatrixCell, type CoverageMatrixRow, DedupWindow, type DeployChecklist, type DeviceInfo, type EndSessionOptions, type EnhancedBugContext, ErrorMonitor, type FindingSeverity, type FindingType, type HostUserInfo, type IssueCategory, type IssueCounts, LocalStorageAdapter, type MessageSenderType, type MonitorDeps, type MonitoringConfig, type MonitoringEvent, type NetworkRequest, OfflineQueue, type OfflineQueueConfig, type PriorityFactors, type ProjectRole, type QAFinding, type QAHealthMetrics, type QAHealthScore, type QASession, type QASessionStatus, type QATrack, type QueueItem, type QueueItemType, RNApiFailureHandler, RNCrashHandler, RNRageClickHandler, RageClickDetector, type RageClickEvent, type RegressionEvent, type ReportSource, type ReportStatus, type ReportType, type RoutePriority, type RouteTestStats, type RubricMode, type RubricResult, type Severity, type SkipReason, type StartSessionOptions, type StorageAdapter, type SubmitFeedbackOptions, type TestAssignment, type TestFeedback, type TestGroup, type TestResult, type TestStep, type TestTemplate, type TesterInfo, type TesterIssue, type TesterMessage, type TesterProfileUpdate, type TesterThread, type ThreadPriority, type ThreadType, WebApiFailureHandler, WebCrashHandler, WebRageClickHandler, type WidgetColorScheme, type WidgetConfig, captureError, contextCapture, createBugBear, generateFingerprint, isBugCategory, isNetworkError, scrubUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -301,8 +301,13 @@ interface MonitoringEvent {
|
|
|
301
301
|
/** Sentry breadcrumbs — populated by @bbearai/sentry adapter */
|
|
302
302
|
sentryBreadcrumbs?: unknown[];
|
|
303
303
|
}
|
|
304
|
-
/** Widget color scheme: 'dark'
|
|
304
|
+
/** Widget color scheme: 'dark', 'light', or 'auto' (follows system preference, default). */
|
|
305
305
|
type WidgetColorScheme = 'dark' | 'light' | 'auto';
|
|
306
|
+
/** Server-side widget configuration set by the project admin in the dashboard. */
|
|
307
|
+
interface WidgetConfig {
|
|
308
|
+
/** Admin-forced color scheme. When set, overrides the developer's config and user's OS preference. */
|
|
309
|
+
colorScheme?: WidgetColorScheme;
|
|
310
|
+
}
|
|
306
311
|
interface BugBearTheme {
|
|
307
312
|
/** Primary brand color */
|
|
308
313
|
primaryColor?: string;
|
|
@@ -312,7 +317,7 @@ interface BugBearTheme {
|
|
|
312
317
|
textColor?: string;
|
|
313
318
|
/** Border radius */
|
|
314
319
|
borderRadius?: number;
|
|
315
|
-
/** Color scheme for the widget. Defaults to '
|
|
320
|
+
/** Color scheme for the widget. Defaults to 'auto' (follows OS preference). */
|
|
316
321
|
colorScheme?: WidgetColorScheme;
|
|
317
322
|
}
|
|
318
323
|
type TestTemplate = 'steps' | 'checklist' | 'rubric' | 'freeform';
|
|
@@ -1284,18 +1289,28 @@ declare class BugBearClient {
|
|
|
1284
1289
|
* This is a master switch that admins can toggle in the dashboard
|
|
1285
1290
|
*/
|
|
1286
1291
|
isQAEnabled(): Promise<boolean>;
|
|
1292
|
+
/**
|
|
1293
|
+
* Fetch server-side widget config set by the project admin.
|
|
1294
|
+
* Returns settings like color scheme override. Returns empty config on error.
|
|
1295
|
+
*/
|
|
1296
|
+
getWidgetConfig(): Promise<WidgetConfig>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Check if feedback mode is enabled for this project.
|
|
1299
|
+
* This is a master switch that admins can toggle in the dashboard.
|
|
1300
|
+
*/
|
|
1301
|
+
isFeedbackEnabled(): Promise<boolean>;
|
|
1287
1302
|
/**
|
|
1288
1303
|
* Check if the widget should be visible.
|
|
1289
1304
|
* Behavior depends on the configured mode:
|
|
1290
1305
|
* - 'qa': QA enabled AND user is a registered tester
|
|
1291
|
-
* - 'feedback':
|
|
1292
|
-
* - 'auto':
|
|
1306
|
+
* - 'feedback': Feedback enabled AND user is authenticated
|
|
1307
|
+
* - 'auto': QA tester (if QA enabled) OR authenticated user (if feedback enabled)
|
|
1293
1308
|
*/
|
|
1294
1309
|
shouldShowWidget(): Promise<boolean>;
|
|
1295
1310
|
/**
|
|
1296
1311
|
* Resolve the effective widget mode for the current user.
|
|
1297
1312
|
* - 'qa' or 'feedback' config → returned as-is
|
|
1298
|
-
* - 'auto' →
|
|
1313
|
+
* - 'auto' → QA tester with QA enabled → 'qa', feedback enabled → 'feedback', else 'qa'
|
|
1299
1314
|
*/
|
|
1300
1315
|
getEffectiveMode(): Promise<'qa' | 'feedback'>;
|
|
1301
1316
|
/**
|
|
@@ -1543,4 +1558,4 @@ declare function captureError(error: Error, errorInfo?: {
|
|
|
1543
1558
|
componentStack?: string;
|
|
1544
1559
|
};
|
|
1545
1560
|
|
|
1546
|
-
export { type AddFindingOptions, type AppContext, BUG_CATEGORIES, BugBearClient, type BugBearConfig, type BugBearMode, type BugBearReport, type BugBearTheme, type BugCategory, type ChecklistItem, type ChecklistResult, type ConsoleLogEntry, type CoverageGap, type CoverageMatrixCell, type CoverageMatrixRow, DedupWindow, type DeployChecklist, type DeviceInfo, type EndSessionOptions, type EnhancedBugContext, ErrorMonitor, type FindingSeverity, type FindingType, type HostUserInfo, type IssueCategory, type IssueCounts, LocalStorageAdapter, type MessageSenderType, type MonitorDeps, type MonitoringConfig, type MonitoringEvent, type NetworkRequest, OfflineQueue, type OfflineQueueConfig, type PriorityFactors, type ProjectRole, type QAFinding, type QAHealthMetrics, type QAHealthScore, type QASession, type QASessionStatus, type QATrack, type QueueItem, type QueueItemType, RNApiFailureHandler, RNCrashHandler, RNRageClickHandler, RageClickDetector, type RageClickEvent, type RegressionEvent, type ReportSource, type ReportStatus, type ReportType, type RoutePriority, type RouteTestStats, type RubricMode, type RubricResult, type Severity, type SkipReason, type StartSessionOptions, type StorageAdapter, type SubmitFeedbackOptions, type TestAssignment, type TestFeedback, type TestGroup, type TestResult, type TestStep, type TestTemplate, type TesterInfo, type TesterIssue, type TesterMessage, type TesterProfileUpdate, type TesterThread, type ThreadPriority, type ThreadType, WebApiFailureHandler, WebCrashHandler, WebRageClickHandler, type WidgetColorScheme, captureError, contextCapture, createBugBear, generateFingerprint, isBugCategory, isNetworkError, scrubUrl };
|
|
1561
|
+
export { type AddFindingOptions, type AppContext, BUG_CATEGORIES, BugBearClient, type BugBearConfig, type BugBearMode, type BugBearReport, type BugBearTheme, type BugCategory, type ChecklistItem, type ChecklistResult, type ConsoleLogEntry, type CoverageGap, type CoverageMatrixCell, type CoverageMatrixRow, DedupWindow, type DeployChecklist, type DeviceInfo, type EndSessionOptions, type EnhancedBugContext, ErrorMonitor, type FindingSeverity, type FindingType, type HostUserInfo, type IssueCategory, type IssueCounts, LocalStorageAdapter, type MessageSenderType, type MonitorDeps, type MonitoringConfig, type MonitoringEvent, type NetworkRequest, OfflineQueue, type OfflineQueueConfig, type PriorityFactors, type ProjectRole, type QAFinding, type QAHealthMetrics, type QAHealthScore, type QASession, type QASessionStatus, type QATrack, type QueueItem, type QueueItemType, RNApiFailureHandler, RNCrashHandler, RNRageClickHandler, RageClickDetector, type RageClickEvent, type RegressionEvent, type ReportSource, type ReportStatus, type ReportType, type RoutePriority, type RouteTestStats, type RubricMode, type RubricResult, type Severity, type SkipReason, type StartSessionOptions, type StorageAdapter, type SubmitFeedbackOptions, type TestAssignment, type TestFeedback, type TestGroup, type TestResult, type TestStep, type TestTemplate, type TesterInfo, type TesterIssue, type TesterMessage, type TesterProfileUpdate, type TesterThread, type ThreadPriority, type ThreadType, WebApiFailureHandler, WebCrashHandler, WebRageClickHandler, type WidgetColorScheme, type WidgetConfig, captureError, contextCapture, createBugBear, generateFingerprint, isBugCategory, isNetworkError, scrubUrl };
|
package/dist/index.js
CHANGED
|
@@ -2102,12 +2102,56 @@ var BugBearClient = class {
|
|
|
2102
2102
|
return true;
|
|
2103
2103
|
}
|
|
2104
2104
|
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Fetch server-side widget config set by the project admin.
|
|
2107
|
+
* Returns settings like color scheme override. Returns empty config on error.
|
|
2108
|
+
*/
|
|
2109
|
+
async getWidgetConfig() {
|
|
2110
|
+
try {
|
|
2111
|
+
await this.ensureReady();
|
|
2112
|
+
const { data, error } = await this.supabase.rpc("get_widget_config", {
|
|
2113
|
+
p_project_id: this.config.projectId
|
|
2114
|
+
});
|
|
2115
|
+
if (error) {
|
|
2116
|
+
console.warn("BugBear: Could not fetch widget config", error.message || error.code || "Unknown error");
|
|
2117
|
+
return {};
|
|
2118
|
+
}
|
|
2119
|
+
return data ?? {};
|
|
2120
|
+
} catch (err) {
|
|
2121
|
+
const message = err instanceof Error ? err.message : "Unknown error fetching widget config";
|
|
2122
|
+
console.error("BugBear: Error fetching widget config", err);
|
|
2123
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), { projectId: this.config.projectId });
|
|
2124
|
+
return {};
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Check if feedback mode is enabled for this project.
|
|
2129
|
+
* This is a master switch that admins can toggle in the dashboard.
|
|
2130
|
+
*/
|
|
2131
|
+
async isFeedbackEnabled() {
|
|
2132
|
+
try {
|
|
2133
|
+
await this.ensureReady();
|
|
2134
|
+
const { data, error } = await this.supabase.rpc("check_feedback_enabled", {
|
|
2135
|
+
p_project_id: this.config.projectId
|
|
2136
|
+
});
|
|
2137
|
+
if (error) {
|
|
2138
|
+
console.warn("BugBear: Could not check feedback status", error.message || error.code || "Unknown error");
|
|
2139
|
+
return false;
|
|
2140
|
+
}
|
|
2141
|
+
return data ?? false;
|
|
2142
|
+
} catch (err) {
|
|
2143
|
+
const message = err instanceof Error ? err.message : "Unknown error checking feedback status";
|
|
2144
|
+
console.error("BugBear: Error checking feedback status", err);
|
|
2145
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), { projectId: this.config.projectId });
|
|
2146
|
+
return false;
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2105
2149
|
/**
|
|
2106
2150
|
* Check if the widget should be visible.
|
|
2107
2151
|
* Behavior depends on the configured mode:
|
|
2108
2152
|
* - 'qa': QA enabled AND user is a registered tester
|
|
2109
|
-
* - 'feedback':
|
|
2110
|
-
* - 'auto':
|
|
2153
|
+
* - 'feedback': Feedback enabled AND user is authenticated
|
|
2154
|
+
* - 'auto': QA tester (if QA enabled) OR authenticated user (if feedback enabled)
|
|
2111
2155
|
*/
|
|
2112
2156
|
async shouldShowWidget() {
|
|
2113
2157
|
const mode = this.config.mode || "qa";
|
|
@@ -2119,33 +2163,39 @@ var BugBearClient = class {
|
|
|
2119
2163
|
return qaEnabled2 && tester;
|
|
2120
2164
|
}
|
|
2121
2165
|
if (mode === "feedback") {
|
|
2122
|
-
const userInfo2 = await
|
|
2123
|
-
|
|
2166
|
+
const [feedbackEnabled2, userInfo2] = await Promise.all([
|
|
2167
|
+
this.isFeedbackEnabled(),
|
|
2168
|
+
this.getCurrentUserInfo()
|
|
2169
|
+
]);
|
|
2170
|
+
return feedbackEnabled2 && userInfo2 !== null;
|
|
2124
2171
|
}
|
|
2125
|
-
const [qaEnabled, testerInfo, userInfo] = await Promise.all([
|
|
2172
|
+
const [qaEnabled, feedbackEnabled, testerInfo, userInfo] = await Promise.all([
|
|
2126
2173
|
this.isQAEnabled(),
|
|
2174
|
+
this.isFeedbackEnabled(),
|
|
2127
2175
|
this.getTesterInfo(),
|
|
2128
2176
|
this.getCurrentUserInfo()
|
|
2129
2177
|
]);
|
|
2130
2178
|
if (qaEnabled && testerInfo && testerInfo.role !== "feedback") return true;
|
|
2131
|
-
if (userInfo) return true;
|
|
2179
|
+
if (feedbackEnabled && userInfo) return true;
|
|
2132
2180
|
return false;
|
|
2133
2181
|
}
|
|
2134
2182
|
/**
|
|
2135
2183
|
* Resolve the effective widget mode for the current user.
|
|
2136
2184
|
* - 'qa' or 'feedback' config → returned as-is
|
|
2137
|
-
* - 'auto' →
|
|
2185
|
+
* - 'auto' → QA tester with QA enabled → 'qa', feedback enabled → 'feedback', else 'qa'
|
|
2138
2186
|
*/
|
|
2139
2187
|
async getEffectiveMode() {
|
|
2140
2188
|
const mode = this.config.mode || "qa";
|
|
2141
2189
|
if (mode === "qa") return "qa";
|
|
2142
2190
|
if (mode === "feedback") return "feedback";
|
|
2143
|
-
const [qaEnabled, testerInfo] = await Promise.all([
|
|
2191
|
+
const [qaEnabled, feedbackEnabled, testerInfo] = await Promise.all([
|
|
2144
2192
|
this.isQAEnabled(),
|
|
2193
|
+
this.isFeedbackEnabled(),
|
|
2145
2194
|
this.getTesterInfo()
|
|
2146
2195
|
]);
|
|
2147
2196
|
if (qaEnabled && testerInfo && testerInfo.role !== "feedback") return "qa";
|
|
2148
|
-
return "feedback";
|
|
2197
|
+
if (feedbackEnabled) return "feedback";
|
|
2198
|
+
return "qa";
|
|
2149
2199
|
}
|
|
2150
2200
|
/**
|
|
2151
2201
|
* Auto-provision a feedback user record in the testers table.
|
package/dist/index.mjs
CHANGED
|
@@ -2057,12 +2057,56 @@ var BugBearClient = class {
|
|
|
2057
2057
|
return true;
|
|
2058
2058
|
}
|
|
2059
2059
|
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Fetch server-side widget config set by the project admin.
|
|
2062
|
+
* Returns settings like color scheme override. Returns empty config on error.
|
|
2063
|
+
*/
|
|
2064
|
+
async getWidgetConfig() {
|
|
2065
|
+
try {
|
|
2066
|
+
await this.ensureReady();
|
|
2067
|
+
const { data, error } = await this.supabase.rpc("get_widget_config", {
|
|
2068
|
+
p_project_id: this.config.projectId
|
|
2069
|
+
});
|
|
2070
|
+
if (error) {
|
|
2071
|
+
console.warn("BugBear: Could not fetch widget config", error.message || error.code || "Unknown error");
|
|
2072
|
+
return {};
|
|
2073
|
+
}
|
|
2074
|
+
return data ?? {};
|
|
2075
|
+
} catch (err) {
|
|
2076
|
+
const message = err instanceof Error ? err.message : "Unknown error fetching widget config";
|
|
2077
|
+
console.error("BugBear: Error fetching widget config", err);
|
|
2078
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), { projectId: this.config.projectId });
|
|
2079
|
+
return {};
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Check if feedback mode is enabled for this project.
|
|
2084
|
+
* This is a master switch that admins can toggle in the dashboard.
|
|
2085
|
+
*/
|
|
2086
|
+
async isFeedbackEnabled() {
|
|
2087
|
+
try {
|
|
2088
|
+
await this.ensureReady();
|
|
2089
|
+
const { data, error } = await this.supabase.rpc("check_feedback_enabled", {
|
|
2090
|
+
p_project_id: this.config.projectId
|
|
2091
|
+
});
|
|
2092
|
+
if (error) {
|
|
2093
|
+
console.warn("BugBear: Could not check feedback status", error.message || error.code || "Unknown error");
|
|
2094
|
+
return false;
|
|
2095
|
+
}
|
|
2096
|
+
return data ?? false;
|
|
2097
|
+
} catch (err) {
|
|
2098
|
+
const message = err instanceof Error ? err.message : "Unknown error checking feedback status";
|
|
2099
|
+
console.error("BugBear: Error checking feedback status", err);
|
|
2100
|
+
this.config.onError?.(err instanceof Error ? err : new Error(message), { projectId: this.config.projectId });
|
|
2101
|
+
return false;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2060
2104
|
/**
|
|
2061
2105
|
* Check if the widget should be visible.
|
|
2062
2106
|
* Behavior depends on the configured mode:
|
|
2063
2107
|
* - 'qa': QA enabled AND user is a registered tester
|
|
2064
|
-
* - 'feedback':
|
|
2065
|
-
* - 'auto':
|
|
2108
|
+
* - 'feedback': Feedback enabled AND user is authenticated
|
|
2109
|
+
* - 'auto': QA tester (if QA enabled) OR authenticated user (if feedback enabled)
|
|
2066
2110
|
*/
|
|
2067
2111
|
async shouldShowWidget() {
|
|
2068
2112
|
const mode = this.config.mode || "qa";
|
|
@@ -2074,33 +2118,39 @@ var BugBearClient = class {
|
|
|
2074
2118
|
return qaEnabled2 && tester;
|
|
2075
2119
|
}
|
|
2076
2120
|
if (mode === "feedback") {
|
|
2077
|
-
const userInfo2 = await
|
|
2078
|
-
|
|
2121
|
+
const [feedbackEnabled2, userInfo2] = await Promise.all([
|
|
2122
|
+
this.isFeedbackEnabled(),
|
|
2123
|
+
this.getCurrentUserInfo()
|
|
2124
|
+
]);
|
|
2125
|
+
return feedbackEnabled2 && userInfo2 !== null;
|
|
2079
2126
|
}
|
|
2080
|
-
const [qaEnabled, testerInfo, userInfo] = await Promise.all([
|
|
2127
|
+
const [qaEnabled, feedbackEnabled, testerInfo, userInfo] = await Promise.all([
|
|
2081
2128
|
this.isQAEnabled(),
|
|
2129
|
+
this.isFeedbackEnabled(),
|
|
2082
2130
|
this.getTesterInfo(),
|
|
2083
2131
|
this.getCurrentUserInfo()
|
|
2084
2132
|
]);
|
|
2085
2133
|
if (qaEnabled && testerInfo && testerInfo.role !== "feedback") return true;
|
|
2086
|
-
if (userInfo) return true;
|
|
2134
|
+
if (feedbackEnabled && userInfo) return true;
|
|
2087
2135
|
return false;
|
|
2088
2136
|
}
|
|
2089
2137
|
/**
|
|
2090
2138
|
* Resolve the effective widget mode for the current user.
|
|
2091
2139
|
* - 'qa' or 'feedback' config → returned as-is
|
|
2092
|
-
* - 'auto' →
|
|
2140
|
+
* - 'auto' → QA tester with QA enabled → 'qa', feedback enabled → 'feedback', else 'qa'
|
|
2093
2141
|
*/
|
|
2094
2142
|
async getEffectiveMode() {
|
|
2095
2143
|
const mode = this.config.mode || "qa";
|
|
2096
2144
|
if (mode === "qa") return "qa";
|
|
2097
2145
|
if (mode === "feedback") return "feedback";
|
|
2098
|
-
const [qaEnabled, testerInfo] = await Promise.all([
|
|
2146
|
+
const [qaEnabled, feedbackEnabled, testerInfo] = await Promise.all([
|
|
2099
2147
|
this.isQAEnabled(),
|
|
2148
|
+
this.isFeedbackEnabled(),
|
|
2100
2149
|
this.getTesterInfo()
|
|
2101
2150
|
]);
|
|
2102
2151
|
if (qaEnabled && testerInfo && testerInfo.role !== "feedback") return "qa";
|
|
2103
|
-
return "feedback";
|
|
2152
|
+
if (feedbackEnabled) return "feedback";
|
|
2153
|
+
return "qa";
|
|
2104
2154
|
}
|
|
2105
2155
|
/**
|
|
2106
2156
|
* Auto-provision a feedback user record in the testers table.
|