Skip to content

Commit

Permalink
feat: collect user feedback (#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
subzero10 authored Jan 14, 2023
1 parent 7d20076 commit 0842f0a
Show file tree
Hide file tree
Showing 34 changed files with 4,651 additions and 197 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"error",
"always"
],
"@typescript-eslint/no-this-alias": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/ban-ts-comment": 0,
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/cdn-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ jobs:
steps:
- name: Git Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: master

- name: Setup Node
uses: actions/setup-node@v3
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
Notice,
Noticeable,
HoneybadgerStore,
BacktraceFrame, Transport, NoticeTransportPayload
BacktraceFrame, Transport, NoticeTransportPayload, UserFeedbackFormOptions
} from './types'
import { GlobalStore } from './store';

Expand Down Expand Up @@ -87,6 +87,8 @@ export abstract class Client {

protected abstract checkIn(id: string): Promise<void>

protected abstract showUserFeedbackForm(options: UserFeedbackFormOptions): Promise<void>

getVersion(): string {
return notifier.version
}
Expand Down
19 changes: 19 additions & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface Notice {
}

export interface BrowserConfig extends Config {
userFeedbackEndpoint: string,
async: boolean
maxErrors: number
}
Expand Down Expand Up @@ -187,3 +188,21 @@ export type StoreContents = {
context: Record<string, unknown>,
breadcrumbs: BreadcrumbRecord[]
}

export type UserFeedbackFormOptions = {
onLoad?: () => void;
messages?: {
heading?: string;
explanation?: string;
thanks?: string;
}
buttons?: {
submit?: string;
cancel?: string;
};
labels?: {
name?: string;
email?: string;
comment?: string;
};
}
8 changes: 6 additions & 2 deletions packages/core/test/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Client as BaseClient } from '../src/client'
import { Config, Logger, Notice, Noticeable, Transport, TransportOptions, NoticeTransportPayload } from '../src/types'
import { runAfterNotifyHandlers } from '../src/util';
import { Config, Logger, Notice, Noticeable, Transport, TransportOptions, NoticeTransportPayload, UserFeedbackFormOptions } from '../src/types'
import { runAfterNotifyHandlers } from '../src/util'

export function nullLogger(): Logger {
return {
Expand All @@ -27,6 +27,10 @@ export class TestClient extends BaseClient {
throw new Error('Method not implemented.');
}

protected showUserFeedbackForm(_options: UserFeedbackFormOptions): Promise<void> {
throw new Error('Method not implemented.');
}

constructor(opts: Partial<Config>, transport: Transport) {
super(opts, transport);
}
Expand Down
Loading

0 comments on commit 0842f0a

Please sign in to comment.