UNPKG

2.29 kBTypeScriptView Raw
1import type { Attachment } from '../attachment';
2import type { Integration } from '../integration';
3import type { FeedbackCallbacks, FeedbackGeneralConfiguration, FeedbackTextConfiguration, FeedbackThemeConfiguration } from './config';
4export type { FeedbackFormData } from './form';
5import type { FeedbackEvent, SendFeedback, SendFeedbackParams, UserFeedback } from './sendFeedback';
6export type { FeedbackEvent, UserFeedback, SendFeedback, SendFeedbackParams };
7/**
8 * The integration's internal `options` member where every value should be set
9 */
10export interface FeedbackInternalOptions extends FeedbackGeneralConfiguration, FeedbackThemeConfiguration, FeedbackTextConfiguration, FeedbackCallbacks {
11}
12type Hooks = unknown;
13type HTMLElement = unknown;
14type HType = unknown;
15type ShadowRoot = unknown;
16type VNode = unknown;
17type FeedbackDialog = {
18 /**
19 * The HTMLElement that is containing all the form content
20 */
21 el: HTMLElement;
22 /**
23 * Insert the Dialog into the Shadow DOM.
24 *
25 * The Dialog starts in the `closed` state where no inner HTML is rendered.
26 */
27 appendToDom: () => void;
28 /**
29 * Remove the dialog from the Shadow DOM
30 */
31 removeFromDom: () => void;
32 /**
33 * Open/Show the dialog & form inside it
34 */
35 open: () => void;
36 /**
37 * Close/Hide the dialog & form inside it
38 */
39 close: () => void;
40};
41interface FeedbackScreenshotInput {
42 /**
43 * The preact component
44 */
45 input: (props: {
46 onError: (error: Error) => void;
47 }) => VNode;
48 /**
49 * The image/screenshot bytes
50 */
51 value: () => Promise<Attachment | undefined>;
52}
53interface CreateDialogProps {
54 options: FeedbackInternalOptions;
55 screenshotIntegration: FeedbackScreenshotIntegration | undefined;
56 sendFeedback: SendFeedback;
57 shadow: ShadowRoot;
58}
59export interface FeedbackModalIntegration extends Integration {
60 createDialog: (props: CreateDialogProps) => FeedbackDialog;
61}
62interface CreateInputProps {
63 h: HType;
64 hooks: Hooks;
65 dialog: FeedbackDialog;
66 options: FeedbackInternalOptions;
67}
68export interface FeedbackScreenshotIntegration extends Integration {
69 createInput: (props: CreateInputProps) => FeedbackScreenshotInput;
70}
71//# sourceMappingURL=index.d.ts.map
\No newline at end of file