@sentry/feedback 10.58.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.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/build/npm/cjs/index.js +1836 -0
  4. package/build/npm/cjs/index.js.map +1 -0
  5. package/build/npm/esm/index.js +1830 -0
  6. package/build/npm/esm/index.js.map +1 -0
  7. package/build/npm/esm/package.json +1 -0
  8. package/build/npm/types/constants/index.d.ts +34 -0
  9. package/build/npm/types/constants/index.d.ts.map +1 -0
  10. package/build/npm/types/core/TestClient.d.ts +27 -0
  11. package/build/npm/types/core/TestClient.d.ts.map +1 -0
  12. package/build/npm/types/core/components/Actor.css.d.ts +5 -0
  13. package/build/npm/types/core/components/Actor.css.d.ts.map +1 -0
  14. package/build/npm/types/core/components/Actor.d.ts +18 -0
  15. package/build/npm/types/core/components/Actor.d.ts.map +1 -0
  16. package/build/npm/types/core/components/FeedbackIcon.d.ts +5 -0
  17. package/build/npm/types/core/components/FeedbackIcon.d.ts.map +1 -0
  18. package/build/npm/types/core/createMainStyles.d.ts +6 -0
  19. package/build/npm/types/core/createMainStyles.d.ts.map +1 -0
  20. package/build/npm/types/core/getFeedback.d.ts +8 -0
  21. package/build/npm/types/core/getFeedback.d.ts.map +1 -0
  22. package/build/npm/types/core/integration.d.ts +25 -0
  23. package/build/npm/types/core/integration.d.ts.map +1 -0
  24. package/build/npm/types/core/sendFeedback.d.ts +6 -0
  25. package/build/npm/types/core/sendFeedback.d.ts.map +1 -0
  26. package/build/npm/types/core/types.d.ts +17 -0
  27. package/build/npm/types/core/types.d.ts.map +1 -0
  28. package/build/npm/types/index.d.ts +6 -0
  29. package/build/npm/types/index.d.ts.map +1 -0
  30. package/build/npm/types/modal/components/Dialog.css.d.ts +5 -0
  31. package/build/npm/types/modal/components/Dialog.css.d.ts.map +1 -0
  32. package/build/npm/types/modal/components/Dialog.d.ts +12 -0
  33. package/build/npm/types/modal/components/Dialog.d.ts.map +1 -0
  34. package/build/npm/types/modal/components/DialogHeader.d.ts +7 -0
  35. package/build/npm/types/modal/components/DialogHeader.d.ts.map +1 -0
  36. package/build/npm/types/modal/components/Form.d.ts +14 -0
  37. package/build/npm/types/modal/components/Form.d.ts.map +1 -0
  38. package/build/npm/types/modal/components/SentryLogo.d.ts +5 -0
  39. package/build/npm/types/modal/components/SentryLogo.d.ts.map +1 -0
  40. package/build/npm/types/modal/components/SuccessIcon.d.ts +5 -0
  41. package/build/npm/types/modal/components/SuccessIcon.d.ts.map +1 -0
  42. package/build/npm/types/modal/integration.d.ts +3 -0
  43. package/build/npm/types/modal/integration.d.ts.map +1 -0
  44. package/build/npm/types/screenshot/components/IconClose.d.ts +7 -0
  45. package/build/npm/types/screenshot/components/IconClose.d.ts.map +1 -0
  46. package/build/npm/types/screenshot/components/ScreenshotEditor.d.ts +28 -0
  47. package/build/npm/types/screenshot/components/ScreenshotEditor.d.ts.map +1 -0
  48. package/build/npm/types/screenshot/components/ScreenshotInput.css.d.ts +5 -0
  49. package/build/npm/types/screenshot/components/ScreenshotInput.css.d.ts.map +1 -0
  50. package/build/npm/types/screenshot/components/Toolbar.d.ts +13 -0
  51. package/build/npm/types/screenshot/components/Toolbar.d.ts.map +1 -0
  52. package/build/npm/types/screenshot/components/useTakeScreenshot.d.ts +14 -0
  53. package/build/npm/types/screenshot/components/useTakeScreenshot.d.ts.map +1 -0
  54. package/build/npm/types/screenshot/integration.d.ts +3 -0
  55. package/build/npm/types/screenshot/integration.d.ts.map +1 -0
  56. package/build/npm/types/util/createFeedbackError.d.ts +4 -0
  57. package/build/npm/types/util/createFeedbackError.d.ts.map +1 -0
  58. package/build/npm/types/util/debug-build.d.ts +7 -0
  59. package/build/npm/types/util/debug-build.d.ts.map +1 -0
  60. package/build/npm/types/util/isScreenshotSupported.d.ts +15 -0
  61. package/build/npm/types/util/isScreenshotSupported.d.ts.map +1 -0
  62. package/build/npm/types/util/mergeOptions.d.ts +7 -0
  63. package/build/npm/types/util/mergeOptions.d.ts.map +1 -0
  64. package/build/npm/types/util/setAttributesNS.d.ts +5 -0
  65. package/build/npm/types/util/setAttributesNS.d.ts.map +1 -0
  66. package/build/npm/types/util/validate.d.ts +7 -0
  67. package/build/npm/types/util/validate.d.ts.map +1 -0
  68. package/build/npm/types-ts3.8/constants/index.d.ts +34 -0
  69. package/build/npm/types-ts3.8/core/TestClient.d.ts +27 -0
  70. package/build/npm/types-ts3.8/core/components/Actor.css.d.ts +5 -0
  71. package/build/npm/types-ts3.8/core/components/Actor.d.ts +18 -0
  72. package/build/npm/types-ts3.8/core/components/FeedbackIcon.d.ts +5 -0
  73. package/build/npm/types-ts3.8/core/createMainStyles.d.ts +6 -0
  74. package/build/npm/types-ts3.8/core/getFeedback.d.ts +8 -0
  75. package/build/npm/types-ts3.8/core/integration.d.ts +25 -0
  76. package/build/npm/types-ts3.8/core/sendFeedback.d.ts +6 -0
  77. package/build/npm/types-ts3.8/core/types.d.ts +17 -0
  78. package/build/npm/types-ts3.8/index.d.ts +6 -0
  79. package/build/npm/types-ts3.8/modal/components/Dialog.css.d.ts +5 -0
  80. package/build/npm/types-ts3.8/modal/components/Dialog.d.ts +13 -0
  81. package/build/npm/types-ts3.8/modal/components/DialogHeader.d.ts +8 -0
  82. package/build/npm/types-ts3.8/modal/components/Form.d.ts +15 -0
  83. package/build/npm/types-ts3.8/modal/components/SentryLogo.d.ts +5 -0
  84. package/build/npm/types-ts3.8/modal/components/SuccessIcon.d.ts +5 -0
  85. package/build/npm/types-ts3.8/modal/integration.d.ts +3 -0
  86. package/build/npm/types-ts3.8/screenshot/components/IconClose.d.ts +9 -0
  87. package/build/npm/types-ts3.8/screenshot/components/ScreenshotEditor.d.ts +30 -0
  88. package/build/npm/types-ts3.8/screenshot/components/ScreenshotInput.css.d.ts +5 -0
  89. package/build/npm/types-ts3.8/screenshot/components/Toolbar.d.ts +15 -0
  90. package/build/npm/types-ts3.8/screenshot/components/useTakeScreenshot.d.ts +14 -0
  91. package/build/npm/types-ts3.8/screenshot/integration.d.ts +3 -0
  92. package/build/npm/types-ts3.8/util/createFeedbackError.d.ts +4 -0
  93. package/build/npm/types-ts3.8/util/debug-build.d.ts +7 -0
  94. package/build/npm/types-ts3.8/util/isScreenshotSupported.d.ts +15 -0
  95. package/build/npm/types-ts3.8/util/mergeOptions.d.ts +7 -0
  96. package/build/npm/types-ts3.8/util/setAttributesNS.d.ts +5 -0
  97. package/build/npm/types-ts3.8/util/validate.d.ts +7 -0
  98. package/package.json +74 -0
@@ -0,0 +1,30 @@
1
+ type ComponentType<T> = any;
2
+ declare const hType: any;
3
+ import { FeedbackInternalOptions, FeedbackModalIntegration } from '@sentry/core';
4
+ // replaced import from preact
5
+ import * as Hooks from 'preact/hooks';
6
+ interface FactoryParams {
7
+ h: typeof hType;
8
+ hooks: typeof Hooks;
9
+ /**
10
+ * A ref to a Canvas Element that serves as our "value" or image output.
11
+ */
12
+ outputBuffer: HTMLCanvasElement;
13
+ /**
14
+ * A reference to the whole dialog (the parent of this component) so that we
15
+ * can show/hide it and take a clean screenshot of the webpage.
16
+ */
17
+ dialog: ReturnType<FeedbackModalIntegration['createDialog']>;
18
+ /**
19
+ * The whole options object.
20
+ *
21
+ * Needed to set nonce and id values for editor specific styles
22
+ */
23
+ options: FeedbackInternalOptions;
24
+ }
25
+ interface Props {
26
+ onError: (error: Error) => void;
27
+ }
28
+ export declare function ScreenshotEditorFactory({ h, hooks, outputBuffer, dialog, options, }: FactoryParams): ComponentType<Props>;
29
+ export {};
30
+ //# sourceMappingURL=ScreenshotEditor.d.ts.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Creates <style> element for widget dialog
3
+ */
4
+ export declare function createScreenshotInputStyles(styleNonce?: string): HTMLStyleElement;
5
+ //# sourceMappingURL=ScreenshotInput.css.d.ts.map
@@ -0,0 +1,15 @@
1
+ declare const hType: any;
2
+ type VNode = any;
3
+ import { FeedbackInternalOptions } from '@sentry/core';
4
+ // replaced import from preact
5
+ import * as Hooks from 'preact/hooks';
6
+ interface FactoryParams {
7
+ h: typeof hType;
8
+ }
9
+ export default function ToolbarFactory({ h, }: FactoryParams): ({ action, setAction, options, }: {
10
+ action: "highlight" | "hide" | "";
11
+ setAction: Hooks.StateUpdater<"highlight" | "hide" | "">;
12
+ options: FeedbackInternalOptions;
13
+ }) => VNode;
14
+ export {};
15
+ //# sourceMappingURL=Toolbar.d.ts.map
@@ -0,0 +1,14 @@
1
+ import * as Hooks from 'preact/hooks';
2
+ interface FactoryParams {
3
+ hooks: typeof Hooks;
4
+ }
5
+ interface Props {
6
+ onBeforeScreenshot: () => void;
7
+ onScreenshot: (imageSource: HTMLVideoElement, dpi: number) => void;
8
+ onAfterScreenshot: () => void;
9
+ onError: (error: Error) => void;
10
+ }
11
+ type UseTakeScreenshot = ({ onBeforeScreenshot, onScreenshot, onAfterScreenshot, onError }: Props) => void;
12
+ export declare function useTakeScreenshotFactory({ hooks }: FactoryParams): UseTakeScreenshot;
13
+ export {};
14
+ //# sourceMappingURL=useTakeScreenshot.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { FeedbackScreenshotIntegration } from '@sentry/core';
2
+ export declare const feedbackScreenshotIntegration: () => FeedbackScreenshotIntegration;
3
+ //# sourceMappingURL=integration.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { FeedbackErrorCode, FeedbackErrorMessages } from '@sentry/core';
2
+ export declare function resolveFeedbackErrorMessage(code: FeedbackErrorCode, messages?: FeedbackErrorMessages): string;
3
+ export declare function createFeedbackError(code: FeedbackErrorCode, messages?: FeedbackErrorMessages): Error;
4
+ //# sourceMappingURL=createFeedbackError.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
3
+ *
4
+ * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
5
+ */
6
+ export declare const DEBUG_BUILD: boolean;
7
+ //# sourceMappingURL=debug-build.d.ts.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Mobile browsers do not support `mediaDevices.getDisplayMedia` even though they have the api implemented
3
+ * Instead they return things like `NotAllowedError` when called.
4
+ *
5
+ * It's simpler for us to browser sniff first, and avoid loading the integration if we can.
6
+ *
7
+ * https://stackoverflow.com/a/58879212
8
+ * https://stackoverflow.com/a/3540295
9
+ *
10
+ * `mediaDevices.getDisplayMedia` is also only supported in secure contexts, and return a `mediaDevices is not supported` error, so we should also avoid loading the integration if we can.
11
+ *
12
+ * https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia
13
+ */
14
+ export declare function isScreenshotSupported(): boolean;
15
+ //# sourceMappingURL=isScreenshotSupported.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { FeedbackInternalOptions } from '@sentry/core';
2
+ import { OptionalFeedbackConfiguration } from '../core/types';
3
+ /**
4
+ * Quick and dirty deep merge for the Feedback integration options
5
+ */
6
+ export declare function mergeOptions(defaultOptions: FeedbackInternalOptions, optionOverrides: OptionalFeedbackConfiguration): FeedbackInternalOptions;
7
+ //# sourceMappingURL=mergeOptions.d.ts.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Helper function to set a dict of attributes on element (w/ specified namespace)
3
+ */
4
+ export declare function setAttributesNS<T extends SVGElement>(el: T, attributes: Record<string, string>): T;
5
+ //# sourceMappingURL=setAttributesNS.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { FeedbackFormData, FeedbackInternalOptions } from '@sentry/core';
2
+ export type Props = Pick<FeedbackInternalOptions, 'emailLabel' | 'isEmailRequired' | 'isNameRequired' | 'messageLabel' | 'nameLabel'>;
3
+ /**
4
+ * Validate that a given feedback submission has the required fields
5
+ */
6
+ export declare function getMissingFields(feedback: FeedbackFormData, props: Props): string[];
7
+ //# sourceMappingURL=validate.d.ts.map
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@sentry/feedback",
3
+ "version": "10.58.0",
4
+ "description": "Sentry SDK integration for user feedback",
5
+ "repository": "git://github.com/getsentry/sentry-javascript.git",
6
+ "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/feedback",
7
+ "author": "Sentry",
8
+ "license": "MIT",
9
+ "engines": {
10
+ "node": ">=18"
11
+ },
12
+ "files": [
13
+ "/build/npm"
14
+ ],
15
+ "main": "build/npm/cjs/index.js",
16
+ "module": "build/npm/esm/index.js",
17
+ "types": "build/npm/types/index.d.ts",
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ ".": {
21
+ "react-native": "./build/npm/esm/index.js",
22
+ "import": {
23
+ "types": "./build/npm/types/index.d.ts",
24
+ "default": "./build/npm/esm/index.js"
25
+ },
26
+ "require": {
27
+ "types": "./build/npm/types/index.d.ts",
28
+ "default": "./build/npm/cjs/index.js"
29
+ }
30
+ }
31
+ },
32
+ "typesVersions": {
33
+ "<5.0": {
34
+ "build/npm/types/index.d.ts": [
35
+ "build/npm/types-ts3.8/index.d.ts"
36
+ ]
37
+ }
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "dependencies": {
43
+ "@sentry/core": "10.58.0"
44
+ },
45
+ "devDependencies": {
46
+ "preact": "^10.19.4"
47
+ },
48
+ "scripts": {
49
+ "build": "run-p build:transpile build:types build:bundle",
50
+ "build:transpile": "rollup -c rollup.npm.config.mjs",
51
+ "build:bundle": "rollup -c rollup.bundle.config.mjs",
52
+ "build:dev": "run-p build:transpile build:types",
53
+ "build:types": "run-s build:types:core build:types:downlevel",
54
+ "build:types:core": "tsc -p tsconfig.types.json",
55
+ "build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8 && yarn node ./scripts/shim-preact-export.js",
56
+ "build:watch": "run-p build:transpile:watch build:bundle:watch",
57
+ "build:dev:watch": "run-p build:transpile:watch",
58
+ "build:transpile:watch": "yarn build:transpile --watch",
59
+ "build:bundle:watch": "yarn build:bundle --watch",
60
+ "build:tarball": "npm pack",
61
+ "circularDepCheck": "madge --circular src/index.ts",
62
+ "clean": "rimraf build sentry-feedback-*.tgz",
63
+ "lint:fix": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --fix --type-aware",
64
+ "lint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --type-aware",
65
+ "lint:es-compatibility": "es-check es2020 ./build/{bundles,npm/cjs}/*.js && es-check es2020 ./build/npm/esm/*.js --module",
66
+ "test": "vitest run",
67
+ "test:watch": "vitest --watch",
68
+ "yalc:publish": "yalc publish --push --sig"
69
+ },
70
+ "volta": {
71
+ "extends": "../../package.json"
72
+ },
73
+ "sideEffects": false
74
+ }