-
-
Notifications
You must be signed in to change notification settings - Fork 38
feat(#161): refactor string literals to typed enums #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 6 commits
60114ba
3d6fef1
2234bcf
d46f0af
8a5e8fc
4dd6a8b
686d425
42149d8
6a5af94
59caa47
a7e15e6
c46874f
17c871a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import { v4 as uuidv4 } from 'uuid'; | ||
|
||
import { deepRedactSensitiveInfo } from '@extension/shared'; | ||
import { deepRedactSensitiveInfo, RecordType } from '@extension/shared'; | ||
|
||
const restricted = ['https://api.briehq.com']; // 'extend.iife', 'kbmbnelnoppneadncmmkfikbcgmilbao' Note: it blocks the logs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see some differences between current changes in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naaa760, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naaa760, |
||
const invalidRecord = (entity: string) => restricted.some(word => entity.includes(word)); | ||
|
||
const tabRecordsMap = new Map<number, Map<string, any>>(); | ||
|
||
export type RecordType = 'events' | 'network' | 'console' | 'cookies'; | ||
|
||
export interface Record { | ||
recordType: RecordType; | ||
url?: string; | ||
|
@@ -50,7 +48,7 @@ export const addOrMergeRecords = async (tabId: number, record: Record | any): Pr | |
const uuid = uuidv4(); | ||
|
||
try { | ||
if (record.recordType !== 'network') { | ||
if (record.recordType !== RecordType.NETWORK) { | ||
recordsMap.set(uuid, { uuid, ...deepRedactSensitiveInfo(record, tabUrl) }); | ||
return; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,18 +52,19 @@ | |
}, | ||
"dependencies": { | ||
"html2canvas": "^1.4.1", | ||
"i18n": "^0.15.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this. Also, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naaa760, We have our own custom i18n package, see: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naaa760, |
||
"react": "19.1.0", | ||
"react-dom": "19.1.0" | ||
"react-dom": "19.1.0", | ||
"uuid": "^11.1.0" | ||
}, | ||
"devDependencies": { | ||
"prettier-plugin-tailwindcss": "^0.6.12", | ||
"@eslint/compat": "^1.2.5", | ||
"@eslint/eslintrc": "^3.2.0", | ||
"@eslint/js": "^9.20.0", | ||
"@types/chrome": "0.0.304", | ||
"@types/eslint-plugin-jsx-a11y": "^6.10.0", | ||
"@types/eslint__eslintrc": "^2.1.2", | ||
"@types/eslint__js": "^8.42.3", | ||
"@types/eslint-plugin-jsx-a11y": "^6.10.0", | ||
"@types/node": "^22.14.1", | ||
"@types/react": "^19.0.8", | ||
"@types/react-dom": "^19.0.3", | ||
|
@@ -92,6 +93,7 @@ | |
"postcss": "^8.5.2", | ||
"postcss-load-config": "^6.0.1", | ||
"prettier": "^3.3.3", | ||
"prettier-plugin-tailwindcss": "^0.6.12", | ||
"rimraf": "^6.0.1", | ||
"run-script-os": "^1.1.6", | ||
"tailwindcss": "^3.4.17", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export enum CaptureState { | ||
IDLE = 'idle', | ||
CAPTURING = 'capturing', | ||
UNSAVED = 'unsaved', | ||
} | ||
|
||
export enum CaptureType { | ||
AREA = 'area', | ||
FULL_PAGE = 'full-page', | ||
VIEWPORT = 'viewport', | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export enum InstallReason { | ||
INSTALL = 'install', | ||
UPDATE = 'update', | ||
} | ||
|
||
export enum ContextType { | ||
ALL = 'all', | ||
} | ||
|
||
export enum ContextMenuId { | ||
CAPTURE_PARENT = 'capture_parent', | ||
} | ||
|
||
export enum ResponseStatus { | ||
SUCCESS = 'success', | ||
ERROR = 'error', | ||
} | ||
|
||
export enum ImageFormat { | ||
JPEG = 'jpeg', | ||
PNG = 'png', | ||
} | ||
|
||
export enum RequestProperty { | ||
REQUEST_BODY = 'requestBody', | ||
REQUEST_HEADERS = 'requestHeaders', | ||
} |
Uh oh!
There was an error while loading. Please reload this page.