import { ComponentOptionsMixin } from 'vue';
import { ComponentProvideOptions } from 'vue';
import { DefineComponent } from 'vue';
import { PublicProps } from 'vue';

declare const __VLS_component: DefineComponent<SelectionCommentProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<SelectionCommentProps> & Readonly<{}>, {
webhookUrl: string;
dev: boolean;
page: string;
locale: string;
source: string;
appName: string;
appKey: string;
merchant: string;
}, {}, {}, {}, string, ComponentProvideOptions, false, {
root: HTMLDivElement;
}, HTMLDivElement>;

declare function __VLS_template(): {
    attrs: Partial<{}>;
    slots: {
        default?(_: {}): any;
    };
    refs: {
        root: HTMLDivElement;
    };
    rootEl: HTMLDivElement;
};

declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;

declare type __VLS_WithTemplateSlots<T, S> = T & {
    new (): {
        $slots: S;
    };
};

export declare function buildFeedbackPayload(input: FeedbackInput, now?: Date): FeedbackPayload;

/** 未传入地址时写入的飞书多维表格。各项目仍可用 webhookUrl 覆盖。 */
export declare const DEFAULT_FEEDBACK_WEBHOOK = "https://bytedance.larkoffice.com/base/workflow/webhook/event/D9h2a3gAkwESDohg6xKcqhq7nZe";

/**
 * 问题反馈直达飞书多维表格，不经过业务后端。
 *
 * 表格里建一条「接收到 webhook 时」的自动化：下一步「新增记录」，把下面 JSON 字段映射到列。
 * 不要开 IP 白名单，也不要开 Bearer 校验——浏览器跨域预检过不了，带这些校验请求发不出去。
 * 地址由各项目通过 webhookUrl 传入，会出现在该项目的前端产物里，只能用来新增一行。
 *
 * 示例请求体（自动化「输出设置 → 手动设置」可直接粘贴）：
 * {"score":5,"scoreLabel":"很好","category":"experience","categoryLabel":"体验问题","content":"示例","contact":"","source":"控制台","kind":"反馈","quote":"","page":"/apps/profile","appName":"示例应用","appKey":"ak_example","merchant":"示例企业","locale":"zh-CN","submittedAt":"2026-10-27 14:29:00","userAgent":"Mozilla/5.0"}
 */
export declare type FeedbackCategory = 'experience' | 'suggestion' | 'other';

export declare class FeedbackChannelError extends Error {
    constructor();
}

export declare interface FeedbackInput {
    score: number;
    category: FeedbackCategory;
    content: string;
    contact: string;
    /** 提交来自哪个站点，固定中文，例如「控制台」「文档中心」 */
    source: string;
    page: string;
    appName: string;
    appKey: string;
    merchant: string;
    locale: string;
    /** 记录类型。右下角反馈为「反馈」，划线评论为「划线评论」。 */
    kind?: string;
    /** 划线选中的原文。普通反馈为空。 */
    quote?: string;
}

export declare interface FeedbackPayload {
    score: number;
    /** 固定中文，方便表格里直接分组，不随界面语言变化 */
    scoreLabel: string;
    category: FeedbackCategory;
    categoryLabel: string;
    content: string;
    contact: string;
    /** 固定中文，方便表格里直接筛选站点 */
    source: string;
    page: string;
    appName: string;
    appKey: string;
    merchant: string;
    locale: string;
    kind: string;
    quote: string;
    /** 北京时间，文本列可直接读 */
    submittedAt: string;
    userAgent: string;
}

export declare const FeedbackWidget: DefineComponent<FeedbackWidgetProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<FeedbackWidgetProps> & Readonly<{}>, {
webhookUrl: string;
dev: boolean;
page: string;
locale: string;
source: string;
appName: string;
appKey: string;
merchant: string;
}, {}, {}, {}, string, ComponentProvideOptions, false, {
root: HTMLDivElement;
entryRef: HTMLButtonElement;
}, any>;

export declare interface FeedbackWidgetProps {
    /** 飞书多维表格 webhook。只接受 https 的飞书 / Lark 域名。 */
    webhookUrl?: string;
    /** 为 true 时，即使还没配 webhook 也展示入口，方便本地看样式。 */
    dev?: boolean;
    /** 当前页面路径。不传则提交时使用浏览器地址。 */
    page?: string;
    /** `zh-CN` 或 `en` / `en-US`。其它值按中文显示。 */
    locale?: string;
    /** 站点来源，写入飞书。控制台传「控制台」，文档中心传「文档中心」。 */
    source?: string;
    appName?: string;
    appKey?: string;
    merchant?: string;
}

export declare function formatFeedbackTime(date: Date): string;

/** 只接受飞书 / Lark 的 https 地址，避免把企业名和页面路径发到任意域名。 */
export declare function isFeishuWebhook(url: string): boolean;

/**
 * text/plain 属于浏览器的简单请求，不会先发 OPTIONS。
 * 飞书不回 Access-Control-Allow-Origin，带 application/json 会被预检拦住。
 * no-cors 读不到响应体，请求发出即视为已提交。
 */
export declare function postFeedback(input: FeedbackInput, webhookUrl: string, now?: Date): Promise<void>;

export declare const SelectionComment: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;

export declare interface SelectionCommentProps {
    /** 飞书多维表格 webhook。只接受 https 的飞书 / Lark 域名。 */
    webhookUrl?: string;
    /** 为 true 时，即使还没配 webhook 也响应划线，方便本地看样式。 */
    dev?: boolean;
    /** 当前页面路径。不传则提交时使用浏览器地址。 */
    page?: string;
    /** `zh-CN` 或 `en` / `en-US`。其它值按中文显示。 */
    locale?: string;
    /** 站点来源，写入飞书。文档中心传「文档中心」。 */
    source?: string;
    appName?: string;
    appKey?: string;
    merchant?: string;
}

/** 本地始终展示入口，方便看样式；生产环境没配好地址就不出现，避免点了提交失败。 */
export declare function showFeedbackEntry(isDev: boolean, webhookUrl: string): boolean;

export { }
