合并:新增聊天快捷回复与买家备注
This commit is contained in:
commit
9de1e024fc
49 files changed
+2349
-122
No files matched your search
@@ -2371,6 +2371,126 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
"/api/v1/chat/quick-replies":
|
||||
get:
|
||||
operationId: getApiV1ChatQuickReplies
|
||||
summary: getApiV1ChatQuickReplies
|
||||
security: [{cookieAuth: []}]
|
||||
parameters:
|
||||
- name: account_id
|
||||
in: query
|
||||
required: true
|
||||
schema: {type: string}
|
||||
responses:
|
||||
'200':
|
||||
description: 成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatQuickReplyList'
|
||||
'400': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'401': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'403': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'500': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
post:
|
||||
operationId: postApiV1ChatQuickReplies
|
||||
summary: postApiV1ChatQuickReplies
|
||||
security: [{cookieAuth: []}]
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatQuickReplyCreateRequest'
|
||||
responses:
|
||||
'201':
|
||||
description: 成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatQuickReply'
|
||||
'400': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'401': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'403': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'409': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'500': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
"/api/v1/chat/quick-replies/{quick_reply_id}":
|
||||
delete:
|
||||
operationId: deleteApiV1ChatQuickRepliesByquick_reply_id
|
||||
summary: deleteApiV1ChatQuickRepliesByquick_reply_id
|
||||
security: [{cookieAuth: []}]
|
||||
parameters:
|
||||
- name: quick_reply_id
|
||||
in: path
|
||||
required: true
|
||||
schema: {type: integer}
|
||||
- name: account_id
|
||||
in: query
|
||||
required: true
|
||||
schema: {type: string}
|
||||
responses:
|
||||
'200':
|
||||
description: 成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OperationResponse'
|
||||
'400': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'401': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'403': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'404': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'500': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
"/api/v1/chat/buyer-notes/{buyer_id}":
|
||||
get:
|
||||
operationId: getApiV1ChatBuyerNotesBybuyer_id
|
||||
summary: getApiV1ChatBuyerNotesBybuyer_id
|
||||
security: [{cookieAuth: []}]
|
||||
parameters:
|
||||
- name: buyer_id
|
||||
in: path
|
||||
required: true
|
||||
schema: {type: string}
|
||||
- name: account_id
|
||||
in: query
|
||||
required: true
|
||||
schema: {type: string}
|
||||
responses:
|
||||
'200':
|
||||
description: 成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatBuyerNote'
|
||||
'400': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'401': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'403': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'500': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
put:
|
||||
operationId: putApiV1ChatBuyerNotesBybuyer_id
|
||||
summary: putApiV1ChatBuyerNotesBybuyer_id
|
||||
security: [{cookieAuth: []}]
|
||||
parameters:
|
||||
- name: buyer_id
|
||||
in: path
|
||||
required: true
|
||||
schema: {type: string}
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatBuyerNoteSaveRequest'
|
||||
responses:
|
||||
'200':
|
||||
description: 成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChatBuyerNote'
|
||||
'400': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'401': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'403': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
'500': {description: 统一错误响应, content: {application/json: {schema: {$ref: '#/components/schemas/ErrorResponse'}}}}
|
||||
"/api/v1/chat/messages":
|
||||
get:
|
||||
operationId: getApiV1ChatMessages
|
||||
@@ -7734,6 +7854,39 @@ components:
|
||||
account_id: {type: string}
|
||||
chat_id: {type: string}
|
||||
message_ids: {type: array, items: {type: object, additionalProperties: {oneOf: [{type: string}, {type: number}]}}}
|
||||
ChatQuickReply:
|
||||
type: object
|
||||
required: [id, account_id, content, created_at]
|
||||
properties:
|
||||
id: {type: integer}
|
||||
account_id: {type: string}
|
||||
content: {type: string, minLength: 1, maxLength: 2000}
|
||||
created_at: {type: integer}
|
||||
ChatQuickReplyList:
|
||||
type: object
|
||||
required: [quick_replies]
|
||||
properties:
|
||||
quick_replies: {type: array, items: {$ref: '#/components/schemas/ChatQuickReply'}}
|
||||
ChatQuickReplyCreateRequest:
|
||||
type: object
|
||||
required: [account_id, content]
|
||||
properties:
|
||||
account_id: {type: string}
|
||||
content: {type: string, minLength: 1, maxLength: 2000}
|
||||
ChatBuyerNote:
|
||||
type: object
|
||||
required: [account_id, buyer_id, content, updated_at]
|
||||
properties:
|
||||
account_id: {type: string}
|
||||
buyer_id: {type: string}
|
||||
content: {type: string, maxLength: 2000}
|
||||
updated_at: {type: integer}
|
||||
ChatBuyerNoteSaveRequest:
|
||||
type: object
|
||||
required: [account_id, content]
|
||||
properties:
|
||||
account_id: {type: string}
|
||||
content: {type: string, maxLength: 2000}
|
||||
OrderDTO:
|
||||
type: object
|
||||
required: [order_id, item_id, item_title, item_image, buyer_id, quantity, amount, order_status, status, cookie_id, created_at]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import {
|
||||
AccountDetail,
|
||||
ChatBuyerNote,
|
||||
ChatMessage,
|
||||
ChatQuickReply,
|
||||
ChatSession,
|
||||
OperationResponse
|
||||
} from './models';
|
||||
@@ -72,6 +74,59 @@ export const getChatMessagePage = async (accountId: string, chatId: string, curs
|
||||
export const getChatMessages = async (accountId: string, chatId: string, beforeId?: number, options?: RequestControlOptions): Promise<ChatMessage[]> =>
|
||||
(await getChatMessagePage(accountId, chatId, undefined, beforeId, options)).messages;
|
||||
|
||||
/** 查询当前账号可复用的人工快捷回复。 */
|
||||
export const getChatQuickReplies = async (accountId: string, options?: RequestControlOptions): Promise<ChatQuickReply[]> => {
|
||||
// response 保存契约客户端返回的快捷回复列表 DTO,随后转换为 feature UI 模型。
|
||||
const response = await runContractRequest(/* signal 是本次账号快捷回复查询的超时与取消控制信号。 */ signal => contractClient.GET('/api/v1/chat/quick-replies', {
|
||||
params: { query: { account_id: accountId } },
|
||||
signal,
|
||||
}), options);
|
||||
return response.quick_replies.map(/* reply 是当前待转换的快捷回复 DTO。 */ reply => ({
|
||||
id: reply.id,
|
||||
account_id: reply.account_id,
|
||||
content: reply.content,
|
||||
created_at: reply.created_at,
|
||||
}));
|
||||
};
|
||||
|
||||
/** 为当前账号新增人工快捷回复。 */
|
||||
export const createChatQuickReply = async (accountId: string, content: string, options?: RequestControlOptions): Promise<ChatQuickReply> => {
|
||||
// response 保存创建接口返回的快捷回复 DTO,转换后不向组件暴露生成类型。
|
||||
const response = await runContractRequest(/* signal 是本次新增快捷回复请求的超时与取消控制信号。 */ signal => contractClient.POST('/api/v1/chat/quick-replies', {
|
||||
body: { account_id: accountId, content },
|
||||
signal,
|
||||
}), options);
|
||||
return { id: response.id, account_id: response.account_id, content: response.content, created_at: response.created_at };
|
||||
};
|
||||
|
||||
/** 删除当前账号下指定的人工快捷回复。 */
|
||||
export const deleteChatQuickReply = async (accountId: string, quickReplyId: number, options?: RequestControlOptions): Promise<OperationResponse> =>
|
||||
runContractRequest(/* signal 是本次删除快捷回复请求的超时与取消控制信号。 */ signal => contractClient.DELETE('/api/v1/chat/quick-replies/{quick_reply_id}', {
|
||||
params: { path: { quick_reply_id: quickReplyId }, query: { account_id: accountId } },
|
||||
signal,
|
||||
}), options);
|
||||
|
||||
/** 查询当前账号下指定买家的完整备注;未填写时仍返回空内容。 */
|
||||
export const getChatBuyerNote = async (accountId: string, buyerId: string, options?: RequestControlOptions): Promise<ChatBuyerNote> => {
|
||||
// response 保存契约客户端返回的买家备注 DTO,转换后由聊天 feature 管理。
|
||||
const response = await runContractRequest(/* signal 是本次买家备注查询的超时与取消控制信号。 */ signal => contractClient.GET('/api/v1/chat/buyer-notes/{buyer_id}', {
|
||||
params: { path: { buyer_id: buyerId }, query: { account_id: accountId } },
|
||||
signal,
|
||||
}), options);
|
||||
return { account_id: response.account_id, buyer_id: response.buyer_id, content: response.content, updated_at: response.updated_at };
|
||||
};
|
||||
|
||||
/** 保存当前账号下指定买家的完整备注;空内容会清除已有备注。 */
|
||||
export const saveChatBuyerNote = async (accountId: string, buyerId: string, content: string, options?: RequestControlOptions): Promise<ChatBuyerNote> => {
|
||||
// response 保存保存接口返回的最终买家备注 DTO。
|
||||
const response = await runContractRequest(/* signal 是本次买家备注保存请求的超时与取消控制信号。 */ signal => contractClient.PUT('/api/v1/chat/buyer-notes/{buyer_id}', {
|
||||
params: { path: { buyer_id: buyerId } },
|
||||
body: { account_id: accountId, content },
|
||||
signal,
|
||||
}), options);
|
||||
return { account_id: response.account_id, buyer_id: response.buyer_id, content: response.content, updated_at: response.updated_at };
|
||||
};
|
||||
|
||||
// sendChatMessage 发送聊天文本消息。
|
||||
export const sendChatMessage = async (input: {
|
||||
/** account_id 表示账号标识。 */ account_id: string; /** chat_id 表示聊天标识。 */ chat_id: string; /** buyer_id 表示买家标识。 */ buyer_id: string; /** buyer_name 表示买家名称。 */ buyer_name?: string;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// @vitest-environment jsdom
|
||||
import { fireEvent,render,screen,within } from '@testing-library/react';
|
||||
import { beforeEach,describe,expect,test,vi } from 'vitest';
|
||||
import ChatMetadataFeature from './ChatMetadataFeature';
|
||||
import { useChatMetadata } from '../metadata';
|
||||
import type { ChatMetadataState } from '../metadata';
|
||||
import type { ChatQuickReply,ChatSession } from '../models';
|
||||
|
||||
vi.mock('../metadata', /* chatMetadataMockFactory 为抽屉组件交互测试提供受控的元数据 Hook 替身。 */ () => ({ useChatMetadata: vi.fn() }));
|
||||
|
||||
// useChatMetadataMock 是可为每个测试设置返回状态的元数据 Hook 替身。
|
||||
const useChatMetadataMock = vi.mocked(useChatMetadata);
|
||||
// quickReplyFixture 是用于验证操作顺序和关闭行为的账号级快捷回复。
|
||||
const quickReplyFixture: ChatQuickReply = { id: 1, account_id: 'account-1', content: '测试话术', created_at: 1 };
|
||||
// sessionFixture 是使快捷回复发送按钮可用的当前聊天会话。
|
||||
const sessionFixture: ChatSession = { account_id: 'account-1', chat_id: 'chat-1', buyer_id: 'buyer-1', buyer_name: '买家', last_message: '', last_message_at: 1, unread_count: 0 };
|
||||
|
||||
/** metadataFixture 构造抽屉组件交互所需的完整元数据状态,并允许测试观测复制动作。 */
|
||||
const metadataFixture = (copyQuickReply: ChatMetadataState['copyQuickReply']): ChatMetadataState => ({
|
||||
quickReplies: [quickReplyFixture], quickReplyDraft: '', setQuickReplyDraft: vi.fn(), quickReplyBusy: false,
|
||||
pendingDeleteQuickReply: null, requestQuickReplyDelete: vi.fn(), cancelQuickReplyDelete: vi.fn(), confirmQuickReplyDelete: vi.fn().mockResolvedValue(undefined),
|
||||
addQuickReply: vi.fn().mockResolvedValue(undefined), copyQuickReply, copiedQuickReplyID: null, buyerNote: null, noteLoading: false,
|
||||
noteDialogOpen: false, noteEditing: false, noteDraft: '', setNoteDraft: vi.fn(), noteSaving: false, openNoteDialog: vi.fn(),
|
||||
closeNoteDialog: vi.fn(), beginNoteEditing: vi.fn(), saveBuyerNote: vi.fn().mockResolvedValue(undefined), metadataError: '', clearMetadataError: vi.fn(),
|
||||
});
|
||||
|
||||
describe('ChatMetadataFeature', /* 当前回调验证快捷回复抽屉的操作排序和关闭交互。 */ () => {
|
||||
beforeEach(/* 当前回调在每个抽屉交互场景前重置 Hook 替身调用记录。 */ () => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test('删除、复制、发送排序正确,复制发送和外部点击均收起抽屉', /* 当前回调验证快捷回复操作的高频关闭流程。 */ async () => {
|
||||
// copyQuickReply 保存可观测的复制动作替身。
|
||||
const copyQuickReply = vi.fn().mockResolvedValue(undefined);
|
||||
// closeQuickReplyPanel 保存抽屉关闭动作替身。
|
||||
const closeQuickReplyPanel = vi.fn();
|
||||
// sendQuickReply 保存当前会话模板发送动作替身。
|
||||
const sendQuickReply = vi.fn().mockResolvedValue(undefined);
|
||||
useChatMetadataMock.mockReturnValue(metadataFixture(copyQuickReply));
|
||||
render(<><ChatMetadataFeature activeAccountID="account-1" selectedSession={sessionFixture} quickReplyPanelOpen closeQuickReplyPanel={closeQuickReplyPanel} sendQuickReply={sendQuickReply} sending={false} accountOnline /><button type="button">抽屉外区域</button></>);
|
||||
// replyCard 是包含当前快捷回复操作按钮的卡片元素。
|
||||
const replyCard = screen.getByText('测试话术').closest('article');
|
||||
if (replyCard == null) throw new Error('未找到快捷回复卡片');
|
||||
// actionNames 保存卡片内按钮按视觉顺序的可访问名称。
|
||||
const actionNames = within(replyCard).getAllByRole('button').map(/* actionButton 保存当前待检查的快捷回复操作按钮。 */ actionButton => actionButton.getAttribute('aria-label') || actionButton.textContent);
|
||||
expect(actionNames).toEqual(['删除快捷回复', '复制', '发送']);
|
||||
fireEvent.click(within(replyCard).getByRole('button', { name: '复制' }));
|
||||
expect(copyQuickReply).toHaveBeenCalledWith(quickReplyFixture);
|
||||
expect(closeQuickReplyPanel).toHaveBeenCalledTimes(1);
|
||||
fireEvent.click(within(replyCard).getByRole('button', { name: '发送' }));
|
||||
expect(sendQuickReply).toHaveBeenCalledWith('测试话术');
|
||||
expect(closeQuickReplyPanel).toHaveBeenCalledTimes(2);
|
||||
fireEvent.pointerDown(screen.getByRole('button', { name: '抽屉外区域' }));
|
||||
expect(closeQuickReplyPanel).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
import { Clipboard,FilePenLine,Plus,Send,Trash2,X } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { useChatMetadata } from '../metadata';
|
||||
import type { ChatSession } from '../models';
|
||||
|
||||
/** ChatMetadataFeatureProps 描述独立构建的聊天元数据控件所需上下文与外部发送能力。 */
|
||||
type ChatMetadataFeatureProps = {
|
||||
/** activeAccountID 是当前选中的闲鱼账号标识。 */
|
||||
activeAccountID: string;
|
||||
/** selectedSession 是当前正在查看的聊天会话。 */
|
||||
selectedSession: ChatSession | undefined;
|
||||
/** quickReplyPanelOpen 控制右侧快捷回复抽屉是否可见。 */
|
||||
quickReplyPanelOpen: boolean;
|
||||
/** closeQuickReplyPanel 收起右侧快捷回复抽屉。 */
|
||||
closeQuickReplyPanel: () => void;
|
||||
/** sendQuickReply 将模板文本交给既有可靠聊天发送流程。 */
|
||||
sendQuickReply: (content: string) => Promise<void>;
|
||||
/** sending 表示当前聊天发送请求是否进行中。 */
|
||||
sending: boolean;
|
||||
/** accountOnline 表示当前账号是否可以向平台发送消息。 */
|
||||
accountOnline: boolean;
|
||||
};
|
||||
|
||||
/** ChatMetadataFeature 提供账号快捷回复和买家备注交互,并由独立构建分片控制聊天页面体积。 */
|
||||
const ChatMetadataFeature: React.FC<ChatMetadataFeatureProps> = ({ activeAccountID, selectedSession, quickReplyPanelOpen, closeQuickReplyPanel, sendQuickReply, sending, accountOnline }) => {
|
||||
// chatMetadata 保存账号快捷回复和当前买家备注的独立数据、取消控制及 UI 交互状态。
|
||||
const chatMetadata = useChatMetadata(activeAccountID, selectedSession);
|
||||
// buyerNoteContent 保存未经字符截断的完整备注;展示区域仅依标题栏的两行空间裁切可见文本。
|
||||
const buyerNoteContent = chatMetadata.buyerNote?.content.trim() || '';
|
||||
// quickReplyPanelRef 指向快捷回复抽屉根节点,用于区分抽屉内交互与页面外点击。
|
||||
const quickReplyPanelRef = React.useRef<HTMLElement | null>(null);
|
||||
|
||||
React.useEffect(/* 当前副作用在抽屉展开期间监听页面级指针事件,点击抽屉外部时自动收起并在 cleanup 中移除监听。 */ () => {
|
||||
if (!quickReplyPanelOpen) return undefined;
|
||||
/** closeWhenClickOutside 仅在指针目标不属于快捷回复抽屉时收起面板。 */
|
||||
const closeWhenClickOutside = (event: PointerEvent): void => {
|
||||
// eventTarget 保存当前指针事件的目标节点;非 DOM 节点不参与抽屉内外判断。
|
||||
const eventTarget = event.target;
|
||||
if (!(eventTarget instanceof Node) || quickReplyPanelRef.current?.contains(eventTarget)) return;
|
||||
closeQuickReplyPanel();
|
||||
};
|
||||
document.addEventListener('pointerdown', closeWhenClickOutside);
|
||||
return /* 当前 cleanup 在抽屉收起或组件卸载时移除页面级监听。 */ () => document.removeEventListener('pointerdown', closeWhenClickOutside);
|
||||
}, [closeQuickReplyPanel, quickReplyPanelOpen]);
|
||||
|
||||
return <>
|
||||
{selectedSession && <div className="absolute left-40 right-[5.5rem] top-2 z-10 flex min-h-16 items-center justify-center">
|
||||
<button type="button" onClick={/* 当前回调打开当前买家的完整备注弹窗。 */ chatMetadata.openNoteDialog} className="inline-flex w-fit max-w-full items-center gap-2 rounded-lg border border-transparent px-2.5 py-1.5 text-left text-xs font-medium leading-5 text-slate-500 transition hover:border-sky-100 hover:bg-sky-50 hover:text-sky-700" title={buyerNoteContent || '添加用户备注'}>
|
||||
<FilePenLine className="h-4 w-4 shrink-0 self-center text-slate-400" />
|
||||
<span className="min-w-0 break-words line-clamp-2">{chatMetadata.noteLoading ? '正在读取备注…' : buyerNoteContent || '添加用户备注'}</span>
|
||||
</button>
|
||||
</div>}
|
||||
{quickReplyPanelOpen && activeAccountID && <aside ref={quickReplyPanelRef} aria-label="账号快捷回复" className="absolute inset-y-0 right-0 z-20 flex w-[304px] max-w-[88%] flex-col border-l border-slate-200 bg-white shadow-2xl">
|
||||
<div className="flex items-center justify-between border-b border-slate-100 px-4 py-3">
|
||||
<div>
|
||||
<div className="text-sm font-black text-slate-900">快捷回复</div>
|
||||
<div className="mt-0.5 text-[11px] font-medium text-slate-400">当前账号 · {chatMetadata.quickReplies.length}/50</div>
|
||||
</div>
|
||||
<button type="button" onClick={/* 当前回调收起右侧快捷回复抽屉。 */ closeQuickReplyPanel} className="rounded-lg p-1.5 text-slate-400 transition hover:bg-slate-100 hover:text-slate-700" aria-label="收起快捷回复"><X className="h-4 w-4" /></button>
|
||||
</div>
|
||||
<div className="min-h-0 flex-1 space-y-2 overflow-y-auto p-3">
|
||||
{chatMetadata.quickReplies.map(/* reply 保存当前待展示的账号级快捷回复。 */ reply => <article key={reply.id} className="rounded-xl border border-slate-200 bg-slate-50/70 p-3 transition hover:border-sky-200 hover:bg-sky-50/40">
|
||||
<p className="whitespace-pre-wrap break-words text-xs leading-5 text-slate-700">{reply.content}</p>
|
||||
<div className="mt-2 flex items-center justify-end gap-1">
|
||||
<button type="button" onClick={/* 当前回调请求确认删除本条快捷回复。 */ () => chatMetadata.requestQuickReplyDelete(reply)} disabled={chatMetadata.quickReplyBusy} className="rounded-lg p-1 text-slate-400 transition hover:bg-red-50 hover:text-red-600 disabled:opacity-40" aria-label="删除快捷回复"><Trash2 className="h-3.5 w-3.5" /></button>
|
||||
<button type="button" onClick={/* 当前回调复制本条快捷回复后收起抽屉。 */ () => { closeQuickReplyPanel(); void chatMetadata.copyQuickReply(reply); }} className="rounded-lg px-2 py-1 text-[11px] font-bold text-slate-500 transition hover:bg-white hover:text-sky-700" title="复制快捷回复"><Clipboard className="mr-1 inline h-3 w-3" />{chatMetadata.copiedQuickReplyID === reply.id ? '已复制' : '复制'}</button>
|
||||
<button type="button" onClick={/* 当前回调发送本条快捷回复后收起抽屉。 */ () => { closeQuickReplyPanel(); void sendQuickReply(reply.content); }} disabled={!selectedSession || sending || !accountOnline} className="rounded-lg bg-sky-500 px-2 py-1 text-[11px] font-bold text-white transition hover:bg-sky-600 disabled:cursor-not-allowed disabled:bg-slate-300" title="发送快捷回复"><Send className="mr-1 inline h-3 w-3" />发送</button>
|
||||
</div>
|
||||
</article>)}
|
||||
{chatMetadata.quickReplies.length === 0 && <div className="px-5 py-12 text-center text-xs leading-5 text-slate-400">还没有快捷回复。把常用话术添加在下方,当前账号的所有聊天都可以使用。</div>}
|
||||
</div>
|
||||
<div className="border-t border-slate-200 bg-slate-50/80 p-3">
|
||||
{chatMetadata.metadataError && <div className="mb-2 flex items-start justify-between gap-2 rounded-lg bg-red-50 px-2.5 py-2 text-[11px] leading-4 text-red-700"><span>{chatMetadata.metadataError}</span><button type="button" onClick={/* 当前回调关闭当前快捷回复或备注错误提示。 */ chatMetadata.clearMetadataError} className="shrink-0" aria-label="关闭错误提示"><X className="h-3.5 w-3.5" /></button></div>}
|
||||
<textarea value={chatMetadata.quickReplyDraft} onChange={/* 当前回调更新新增快捷回复表单文本。 */ event => chatMetadata.setQuickReplyDraft(event.target.value)} onKeyDown={/* 当前回调支持 Enter 添加、Shift Enter 换行的快捷回复输入。 */ event => { if (event.key === 'Enter' && !event.shiftKey) { event.preventDefault(); void chatMetadata.addQuickReply(); } }} rows={2} maxLength={2000} placeholder="添加常用快捷回复…" className="min-h-14 w-full resize-none rounded-xl border border-slate-200 bg-white px-3 py-2 text-xs leading-5 outline-none transition focus:border-sky-400 focus:ring-2 focus:ring-sky-100" />
|
||||
<button type="button" onClick={/* 当前回调保存底部输入框中的快捷回复。 */ () => void chatMetadata.addQuickReply()} disabled={!chatMetadata.quickReplyDraft.trim() || chatMetadata.quickReplyBusy || chatMetadata.quickReplies.length >= 50} className="mt-2 flex w-full items-center justify-center gap-1.5 rounded-xl bg-slate-900 py-2 text-xs font-bold text-white transition hover:bg-slate-700 disabled:cursor-not-allowed disabled:bg-slate-300"><Plus className="h-3.5 w-3.5" />添加快捷回复</button>
|
||||
</div>
|
||||
</aside>}
|
||||
{chatMetadata.noteDialogOpen && <div className="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/50 p-4" onClick={/* 当前回调点击遮罩关闭买家备注弹窗。 */ chatMetadata.closeNoteDialog}>
|
||||
<div role="dialog" aria-modal="true" aria-labelledby="buyer-note-title" className="flex max-h-[82vh] w-full max-w-lg flex-col overflow-hidden rounded-2xl bg-white shadow-2xl" onClick={/* 当前回调阻止备注内容点击冒泡到遮罩。 */ event => event.stopPropagation()}>
|
||||
<div className="flex items-center justify-between border-b border-slate-200 px-5 py-4"><div className="min-w-0"><div id="buyer-note-title" className="text-sm font-black text-slate-900">用户备注</div><div className="mt-0.5 truncate text-xs text-slate-400">{selectedSession?.buyer_name || selectedSession?.buyer_id || '当前用户'} · ID {selectedSession?.buyer_id || '-'}</div></div><button type="button" onClick={/* 当前回调关闭买家备注弹窗。 */ chatMetadata.closeNoteDialog} className="rounded-lg p-1.5 text-slate-400 transition hover:bg-slate-100 hover:text-slate-700" aria-label="关闭备注"><X className="h-5 w-5" /></button></div>
|
||||
<div className="min-h-0 flex-1 overflow-y-auto p-5">{chatMetadata.metadataError && <div className="mb-4 flex items-start justify-between gap-2 rounded-xl bg-red-50 px-3 py-2.5 text-xs leading-5 text-red-700"><span>{chatMetadata.metadataError}</span><button type="button" onClick={/* 当前回调关闭当前快捷回复或备注错误提示。 */ chatMetadata.clearMetadataError} aria-label="关闭错误提示"><X className="h-4 w-4" /></button></div>}{chatMetadata.noteEditing ? <textarea autoFocus value={chatMetadata.noteDraft} onChange={/* 当前回调更新买家备注编辑表单。 */ event => chatMetadata.setNoteDraft(event.target.value)} maxLength={2000} rows={10} placeholder="记录该用户的沟通偏好、需求或重要事项…" className="min-h-52 w-full resize-y rounded-xl border border-slate-200 bg-slate-50 px-3 py-3 text-sm leading-6 outline-none transition focus:border-sky-400 focus:bg-white focus:ring-2 focus:ring-sky-100" /> : <div className="min-h-40 whitespace-pre-wrap break-words rounded-xl border border-slate-100 bg-slate-50/80 px-4 py-3 text-sm leading-6 text-slate-700">{chatMetadata.buyerNote?.content || '尚未添加备注。点击“编辑”即可记录该用户的信息。'}</div>}</div>
|
||||
<div className="flex items-center justify-end gap-2 border-t border-slate-200 px-5 py-3">{chatMetadata.noteEditing ? <><button type="button" onClick={/* 当前回调关闭备注弹窗并放弃未保存变更。 */ chatMetadata.closeNoteDialog} disabled={chatMetadata.noteSaving} className="rounded-xl px-4 py-2 text-sm font-bold text-slate-600 transition hover:bg-slate-100 disabled:opacity-50">取消</button><button type="button" onClick={/* 当前回调保存当前买家备注表单。 */ () => void chatMetadata.saveBuyerNote()} disabled={chatMetadata.noteSaving} className="rounded-xl bg-sky-500 px-4 py-2 text-sm font-bold text-white shadow-sm transition hover:bg-sky-600 disabled:cursor-not-allowed disabled:bg-slate-300">{chatMetadata.noteSaving ? '保存中…' : '保存'}</button></> : <button type="button" onClick={/* 当前回调将备注弹窗切换为编辑模式。 */ chatMetadata.beginNoteEditing} className="rounded-xl bg-sky-500 px-4 py-2 text-sm font-bold text-white shadow-sm transition hover:bg-sky-600">编辑</button>}</div>
|
||||
</div>
|
||||
</div>}
|
||||
{chatMetadata.pendingDeleteQuickReply && <div className="fixed inset-0 z-[60] flex items-center justify-center bg-slate-950/50 p-4" onClick={/* 当前回调点击遮罩放弃快捷回复删除。 */ chatMetadata.cancelQuickReplyDelete}><div role="alertdialog" aria-modal="true" aria-labelledby="quick-reply-delete-title" className="w-full max-w-sm rounded-2xl bg-white p-5 shadow-2xl" onClick={/* 当前回调阻止删除确认内容点击冒泡到遮罩。 */ event => event.stopPropagation()}><div id="quick-reply-delete-title" className="text-base font-black text-slate-900">删除快捷回复?</div><p className="mt-2 whitespace-pre-wrap break-words text-sm leading-6 text-slate-500">“{chatMetadata.pendingDeleteQuickReply.content}” 将从当前账号的快捷回复中移除。</p><div className="mt-5 flex justify-end gap-2"><button type="button" onClick={/* 当前回调关闭快捷回复删除确认框。 */ chatMetadata.cancelQuickReplyDelete} disabled={chatMetadata.quickReplyBusy} className="rounded-xl px-4 py-2 text-sm font-bold text-slate-600 transition hover:bg-slate-100 disabled:opacity-50">取消</button><button type="button" onClick={/* 当前回调确认并删除快捷回复。 */ () => void chatMetadata.confirmQuickReplyDelete()} disabled={chatMetadata.quickReplyBusy} className="rounded-xl bg-red-500 px-4 py-2 text-sm font-bold text-white transition hover:bg-red-600 disabled:cursor-not-allowed disabled:bg-red-300">{chatMetadata.quickReplyBusy ? '删除中…' : '删除'}</button></div></div></div>}
|
||||
</>;
|
||||
};
|
||||
|
||||
export default ChatMetadataFeature;
|
||||
@@ -99,6 +99,17 @@ describe('useChat', /* 当前回调处理聊天加载、分页、发送和实时
|
||||
expect(sendMessageMock).toHaveBeenCalledWith(expect.objectContaining({ text: '回复内容', chat_id: 'chat-1' }), expect.objectContaining({ signal: expect.any(AbortSignal) }));
|
||||
expect(hook.result.current.messages).toContainEqual(sentMessageFixture);
|
||||
|
||||
await act(
|
||||
// retainedDraftAction 写入一段不应被快捷回复发送清空的普通消息草稿。
|
||||
() => hook.result.current.setDraft('仍在编辑的草稿'),
|
||||
);
|
||||
await act(
|
||||
// quickReplyAction 发送账号快捷回复,复用可靠发送但保留普通草稿。
|
||||
async () => hook.result.current.handleQuickReply('快捷回复内容'),
|
||||
);
|
||||
expect(sendMessageMock).toHaveBeenLastCalledWith(expect.objectContaining({ text: '快捷回复内容', chat_id: 'chat-1' }), expect.objectContaining({ signal: expect.any(AbortSignal) }));
|
||||
expect(hook.result.current.draft).toBe('仍在编辑的草稿');
|
||||
|
||||
await act(
|
||||
// imageAction 提交图片消息。
|
||||
async () => hook.result.current.handleImage(new File(['image'], 'image.png', { type: 'image/png' })),
|
||||
|
||||
@@ -49,6 +49,8 @@ export type UseChatResult = ChatFeatureState & {
|
||||
handleMessageScroll: () => void;
|
||||
/** 发送文本消息。 */
|
||||
handleSend: () => Promise<void>;
|
||||
/** 发送快捷回复且保留正在编辑的普通消息草稿。 */
|
||||
handleQuickReply: (content: string) => Promise<void>;
|
||||
/** 发送图片消息。 */
|
||||
handleImage: (file?: File) => Promise<void>;
|
||||
/** 从剪贴板候选文件中选择首张图片进入预览。 */
|
||||
@@ -508,7 +510,7 @@ export const useChat = (): UseChatResult => {
|
||||
}, [activeAccountID, contactCursors, contactsLoading, hasMoreContacts]);
|
||||
|
||||
/** 发送文本消息并记录失败重试数据。 */
|
||||
const sendText = useCallback(/* 当前回调封装可复用的交互处理逻辑。 */ async (text: string, rememberRetry: boolean): Promise<void> => {
|
||||
const sendText = useCallback(/* 当前回调封装可复用的交互处理逻辑。 */ async (text: string, rememberRetry: boolean, clearDraft: boolean): Promise<void> => {
|
||||
if (!selectedSession || !activeAccountID || sending) return;
|
||||
// sequence 请求序号。
|
||||
const sequence = ++sendSequence.current;
|
||||
@@ -522,7 +524,7 @@ export const useChat = (): UseChatResult => {
|
||||
// result 处理结果。
|
||||
const result = await sendChatMessage({ account_id: activeAccountID, chat_id: selectedSession.chat_id, buyer_id: selectedSession.buyer_id, buyer_name: selectedSession.buyer_name, item_id: selectedSession.item_id, item_title: selectedSession.item_title, text }, { signal: controller.signal });
|
||||
if (!isCurrentChatRequest(sendSequence.current, sequence, controller.signal)) return;
|
||||
setDraft('');
|
||||
if (clearDraft) setDraft('');
|
||||
setRetryText(null);
|
||||
setMessages(/* 当前回调处理用户交互或异步状态变化。 */ current => mergeLiveMessage(current, result.message));
|
||||
} catch (/* sendError 表示发送错误。 */ sendError) {
|
||||
@@ -570,9 +572,17 @@ export const useChat = (): UseChatResult => {
|
||||
// text 文本。
|
||||
const text = draft.trim();
|
||||
if (!text || !selectedSession || !activeAccountID || sending) return;
|
||||
await sendText(text, true);
|
||||
await sendText(text, true, true);
|
||||
}, [activeAccountID, draft, selectedSession, sendText, sending]);
|
||||
|
||||
/** 发送侧栏快捷回复,并在成功后保留用户尚未发送的普通草稿。 */
|
||||
const handleQuickReply = useCallback(/* 当前回调将账号级快捷回复交给既有可靠文本发送流程。 */ async (content: string): Promise<void> => {
|
||||
// text 保存去除首尾空白后的快捷回复正文,避免空模板触发发送请求。
|
||||
const text = content.trim();
|
||||
if (!text || !selectedSession || !activeAccountID || sending) return;
|
||||
await sendText(text, true, false);
|
||||
}, [activeAccountID, selectedSession, sendText, sending]);
|
||||
|
||||
/** 处理图片选择并进入确认预览,不直接触发平台发送。 */
|
||||
const handleImage = useCallback(/* 当前回调接收文件选择结果并创建图片预览。 */ async (file?: File): Promise<void> => {
|
||||
if (!file || !selectedSession || !activeAccountID || sending) return;
|
||||
@@ -608,14 +618,14 @@ export const useChat = (): UseChatResult => {
|
||||
|
||||
/** 重试最近一次失败的文本或图片发送。 */
|
||||
const retrySend = useCallback(/* 当前回调封装可复用的交互处理逻辑。 */ async (): Promise<void> => {
|
||||
if (retryText) await sendText(retryText, false);
|
||||
if (retryText) await sendText(retryText, false, true);
|
||||
else if (retryImage) await sendImage(retryImage, false);
|
||||
}, [retryImage, retryText, sendImage, sendText]);
|
||||
|
||||
return {
|
||||
accounts, activeAccountID, activeSessions, selectedSession, activeAccount, messages, search, unreadOnly, draft, loading, messagesLoading, olderLoading, hasOlder, contactsLoading, hasMoreContacts: hasMoreContacts[activeAccountID] === true, emojiOpen, sending, error, liveState, pendingImage,
|
||||
activeChatID, filteredSessions, scrollRef, imageInputRef, setActiveAccountID, setActiveChatID, setSearch, setUnreadOnly, setDraft, setEmojiOpen,
|
||||
reloadSessions, loadMoreContacts, loadOlderMessages, handleMessageScroll, handleSend, handleImage, handlePastedImages, confirmSendImage, closeImagePreview, retrySend, retryAvailable: Boolean(retryText || retryImage), unreadForAccount,
|
||||
reloadSessions, loadMoreContacts, loadOlderMessages, handleMessageScroll, handleSend, handleQuickReply, handleImage, handlePastedImages, confirmSendImage, closeImagePreview, retrySend, retryAvailable: Boolean(retryText || retryImage), unreadForAccount,
|
||||
emojiURL, xianyuEmojis, renderXianyuText, formatClock, messageTime,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,141 @@
|
||||
// @vitest-environment jsdom
|
||||
import { act,renderHook,waitFor } from '@testing-library/react';
|
||||
import { beforeEach,describe,expect,test,vi } from 'vitest';
|
||||
import { createChatQuickReply,deleteChatQuickReply,getChatBuyerNote,getChatQuickReplies,saveChatBuyerNote } from './api';
|
||||
import { useChatMetadata } from './metadata';
|
||||
import type { ChatSession } from './models';
|
||||
|
||||
vi.mock('./api', /* chatMetadataApiMockFactory 提供快捷回复和买家备注 Hook 的确定性 API 替身。 */ () => ({
|
||||
createChatQuickReply: vi.fn(),
|
||||
deleteChatQuickReply: vi.fn(),
|
||||
getChatBuyerNote: vi.fn(),
|
||||
getChatQuickReplies: vi.fn(),
|
||||
saveChatBuyerNote: vi.fn(),
|
||||
}));
|
||||
|
||||
// createQuickReplyMock 是创建快捷回复请求的可控替身。
|
||||
const createQuickReplyMock = vi.mocked(createChatQuickReply);
|
||||
// deleteQuickReplyMock 是删除快捷回复请求的可控替身。
|
||||
const deleteQuickReplyMock = vi.mocked(deleteChatQuickReply);
|
||||
// getBuyerNoteMock 是读取买家备注请求的可控替身。
|
||||
const getBuyerNoteMock = vi.mocked(getChatBuyerNote);
|
||||
// getQuickRepliesMock 是读取账号快捷回复请求的可控替身。
|
||||
const getQuickRepliesMock = vi.mocked(getChatQuickReplies);
|
||||
// saveBuyerNoteMock 是保存买家备注请求的可控替身。
|
||||
const saveBuyerNoteMock = vi.mocked(saveChatBuyerNote);
|
||||
|
||||
// sessionFixture 是当前账号下供备注隔离测试使用的会话摘要。
|
||||
const sessionFixture: ChatSession = { account_id: 'account-1', chat_id: 'chat-1', buyer_id: 'buyer-1', buyer_name: '买家', last_message: '', last_message_at: 1, unread_count: 0 };
|
||||
|
||||
/** QuickReplyFixture 是延迟响应测试使用的最小快捷回复形状。 */
|
||||
type QuickReplyFixture = {
|
||||
/** id 是快捷回复稳定标识。 */
|
||||
id: number;
|
||||
/** account_id 是快捷回复所属账号。 */
|
||||
account_id: string;
|
||||
/** content 是快捷回复文本模板。 */
|
||||
content: string;
|
||||
/** created_at 是快捷回复创建时间。 */
|
||||
created_at: number;
|
||||
};
|
||||
|
||||
/** MetadataHookProps 是可重渲染元数据 Hook 的账号与会话输入。 */
|
||||
type MetadataHookProps = {
|
||||
/** accountID 是当前选择的闲鱼账号标识。 */
|
||||
accountID: string;
|
||||
/** session 是当前选中会话;缺失时不查询买家备注。 */
|
||||
session: ChatSession | undefined;
|
||||
};
|
||||
|
||||
describe('useChatMetadata', /* 当前回调覆盖账号快捷回复与买家备注的异步状态和用户交互。 */ () => {
|
||||
beforeEach(/* 当前回调重置所有元数据 API 替身并配置默认成功响应。 */ () => {
|
||||
vi.clearAllMocks();
|
||||
getQuickRepliesMock.mockResolvedValue([{ id: 1, account_id: 'account-1', content: '您好', created_at: 1 }]);
|
||||
getBuyerNoteMock.mockResolvedValue({ account_id: 'account-1', buyer_id: 'buyer-1', content: '偏好顺丰', updated_at: 1 });
|
||||
createQuickReplyMock.mockResolvedValue({ id: 2, account_id: 'account-1', content: '现货可拍', created_at: 2 });
|
||||
deleteQuickReplyMock.mockResolvedValue({ success: true });
|
||||
saveBuyerNoteMock.mockResolvedValue({ account_id: 'account-1', buyer_id: 'buyer-1', content: '重点客户', updated_at: 2 });
|
||||
Object.defineProperty(navigator, 'clipboard', { configurable: true, value: { writeText: vi.fn().mockResolvedValue(undefined) } });
|
||||
});
|
||||
|
||||
test('新增、复制和确认删除快捷回复,且保存买家备注', /* 当前回调验证元数据常用成功路径与编辑状态分离。 */ async () => {
|
||||
// hook 是聊天元数据 Hook 的渲染结果。
|
||||
const hook = renderHook(
|
||||
// metadataHookFactory 以稳定账号和会话创建元数据 Hook。
|
||||
() => useChatMetadata('account-1', sessionFixture),
|
||||
);
|
||||
await waitFor(
|
||||
// dataAssertion 等待账号快捷回复和买家备注的初始请求完成。
|
||||
() => expect(hook.result.current.quickReplies).toHaveLength(1),
|
||||
);
|
||||
expect(hook.result.current.buyerNote?.content).toBe('偏好顺丰');
|
||||
await act(
|
||||
// draftAction 写入新增快捷回复输入框。
|
||||
() => hook.result.current.setQuickReplyDraft('现货可拍'),
|
||||
);
|
||||
await act(
|
||||
// addAction 创建新的账号快捷回复。
|
||||
async () => hook.result.current.addQuickReply(),
|
||||
);
|
||||
expect(createQuickReplyMock).toHaveBeenCalledWith('account-1', '现货可拍');
|
||||
expect(hook.result.current.quickReplies.map(/* reply 保存当前列表中的快捷回复。 */ reply => reply.id)).toEqual([2, 1]);
|
||||
await act(
|
||||
// copyAction 将新创建快捷回复复制到系统剪贴板。
|
||||
async () => hook.result.current.copyQuickReply(hook.result.current.quickReplies[0]),
|
||||
);
|
||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith('现货可拍');
|
||||
await act(
|
||||
// openDeleteAction 打开新创建快捷回复的删除确认状态。
|
||||
() => hook.result.current.requestQuickReplyDelete(hook.result.current.quickReplies[0]),
|
||||
);
|
||||
await act(
|
||||
// deleteAction 确认并删除当前待确认快捷回复。
|
||||
async () => hook.result.current.confirmQuickReplyDelete(),
|
||||
);
|
||||
expect(deleteQuickReplyMock).toHaveBeenCalledWith('account-1', 2);
|
||||
expect(hook.result.current.quickReplies.map(/* reply 保存删除后剩余的快捷回复。 */ reply => reply.id)).toEqual([1]);
|
||||
await act(
|
||||
// openNoteAction 打开默认只读的买家备注弹窗。
|
||||
() => hook.result.current.openNoteDialog(),
|
||||
);
|
||||
expect(hook.result.current.noteEditing).toBe(false);
|
||||
await act(
|
||||
// editNoteAction 进入备注编辑态并填写新的文本。
|
||||
() => { hook.result.current.beginNoteEditing(); hook.result.current.setNoteDraft('重点客户'); },
|
||||
);
|
||||
await act(
|
||||
// saveNoteAction 保存当前买家备注。
|
||||
async () => hook.result.current.saveBuyerNote(),
|
||||
);
|
||||
expect(saveBuyerNoteMock).toHaveBeenCalledWith('account-1', 'buyer-1', '重点客户');
|
||||
expect(hook.result.current.buyerNote?.content).toBe('重点客户');
|
||||
expect(hook.result.current.noteEditing).toBe(false);
|
||||
hook.unmount();
|
||||
});
|
||||
|
||||
test('账号切换后拒绝旧快捷回复响应', /* 当前回调验证请求代次保护不会让慢旧响应覆盖新账号。 */ async () => {
|
||||
// resolveOldReplies 保存稍后手动完成旧账号请求的 Promise 解析函数。
|
||||
let resolveOldReplies: ((replies: QuickReplyFixture[]) => void) | undefined;
|
||||
// oldRepliesPromise 是模拟慢旧账号快捷回复请求的受控 Promise。
|
||||
const oldRepliesPromise = new Promise<QuickReplyFixture[]>(/* resolve 保存外部可调用的旧请求完成函数。 */ resolve => { resolveOldReplies = resolve; });
|
||||
getQuickRepliesMock.mockImplementationOnce(/* 当前回调让首次账号请求保持 pending,模拟网络晚到。 */ () => oldRepliesPromise).mockResolvedValueOnce([{ id: 9, account_id: 'account-2', content: '新账号回复', created_at: 1 }]);
|
||||
// hook 是可通过 rerender 切换账号的聊天元数据 Hook。
|
||||
const hook = renderHook(
|
||||
// metadataHookFactory 根据渲染参数创建元数据 Hook。
|
||||
// props 保存当前账号和选中会话的测试输入。
|
||||
({ accountID, session }: MetadataHookProps) => useChatMetadata(accountID, session),
|
||||
{ initialProps: { accountID: 'account-1', session: sessionFixture } },
|
||||
);
|
||||
hook.rerender({ accountID: 'account-2', session: { ...sessionFixture, account_id: 'account-2', buyer_id: 'buyer-2' } });
|
||||
await waitFor(
|
||||
// newAccountAssertion 等待新账号请求先写入列表。
|
||||
() => expect(hook.result.current.quickReplies[0]?.id).toBe(9),
|
||||
);
|
||||
await act(
|
||||
// oldResponseAction 在新账号已生效后完成旧账号请求。
|
||||
() => resolveOldReplies?.([{ id: 8, account_id: 'account-1', content: '旧账号回复', created_at: 1 }]),
|
||||
);
|
||||
expect(hook.result.current.quickReplies[0]?.id).toBe(9);
|
||||
hook.unmount();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,270 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { createChatQuickReply, deleteChatQuickReply, getChatBuyerNote, getChatQuickReplies, saveChatBuyerNote } from './api';
|
||||
import type { ChatBuyerNote, ChatQuickReply, ChatSession } from './models';
|
||||
import { isChatAbortError } from './state';
|
||||
|
||||
/** ChatMetadataState 描述聊天页面中快捷回复与买家备注的短暂 UI 状态和交互动作。 */
|
||||
export type ChatMetadataState = {
|
||||
/** quickReplies 保存当前账号可用的快捷回复。 */
|
||||
quickReplies: ChatQuickReply[];
|
||||
/** quickReplyDraft 保存底部新增快捷回复输入框的表单文本。 */
|
||||
quickReplyDraft: string;
|
||||
/** setQuickReplyDraft 更新新增快捷回复表单文本。 */
|
||||
setQuickReplyDraft: (content: string) => void;
|
||||
/** quickReplyBusy 表示新增或删除快捷回复请求正在进行。 */
|
||||
quickReplyBusy: boolean;
|
||||
/** pendingDeleteQuickReply 保存等待用户确认删除的快捷回复;空值表示未打开确认框。 */
|
||||
pendingDeleteQuickReply: ChatQuickReply | null;
|
||||
/** requestQuickReplyDelete 打开指定快捷回复的删除确认框。 */
|
||||
requestQuickReplyDelete: (reply: ChatQuickReply) => void;
|
||||
/** cancelQuickReplyDelete 关闭删除确认框而不改变数据。 */
|
||||
cancelQuickReplyDelete: () => void;
|
||||
/** confirmQuickReplyDelete 删除已确认的快捷回复。 */
|
||||
confirmQuickReplyDelete: () => Promise<void>;
|
||||
/** addQuickReply 保存底部输入框中的快捷回复。 */
|
||||
addQuickReply: () => Promise<void>;
|
||||
/** copyQuickReply 将一条快捷回复写入系统剪贴板。 */
|
||||
copyQuickReply: (reply: ChatQuickReply) => Promise<void>;
|
||||
/** copiedQuickReplyID 保存最近复制成功的快捷回复标识,用于显示短暂反馈。 */
|
||||
copiedQuickReplyID: number | null;
|
||||
/** buyerNote 保存当前聊天买家的完整备注;无选中会话时为空。 */
|
||||
buyerNote: ChatBuyerNote | null;
|
||||
/** noteLoading 表示当前会话买家备注正在查询。 */
|
||||
noteLoading: boolean;
|
||||
/** noteDialogOpen 控制买家备注弹窗的可见性。 */
|
||||
noteDialogOpen: boolean;
|
||||
/** noteEditing 控制备注弹窗处于只读查看还是编辑状态。 */
|
||||
noteEditing: boolean;
|
||||
/** noteDraft 保存备注弹窗编辑态的表单文本。 */
|
||||
noteDraft: string;
|
||||
/** setNoteDraft 更新备注编辑框的表单文本。 */
|
||||
setNoteDraft: (content: string) => void;
|
||||
/** noteSaving 表示备注保存请求正在进行。 */
|
||||
noteSaving: boolean;
|
||||
/** openNoteDialog 打开完整备注弹窗并默认显示只读内容。 */
|
||||
openNoteDialog: () => void;
|
||||
/** closeNoteDialog 关闭备注弹窗并放弃未保存表单变更。 */
|
||||
closeNoteDialog: () => void;
|
||||
/** beginNoteEditing 将备注弹窗切换为编辑态。 */
|
||||
beginNoteEditing: () => void;
|
||||
/** saveBuyerNote 保存当前买家备注。 */
|
||||
saveBuyerNote: () => Promise<void>;
|
||||
/** metadataError 保存快捷回复或买家备注操作的最近用户可见错误。 */
|
||||
metadataError: string;
|
||||
/** clearMetadataError 清除当前元数据错误提示。 */
|
||||
clearMetadataError: () => void;
|
||||
};
|
||||
|
||||
/** useChatMetadata 管理账号级快捷回复及当前会话买家备注,并隔离账号/会话切换后的晚到响应。 */
|
||||
export const useChatMetadata = (activeAccountID: string, selectedSession: ChatSession | undefined): ChatMetadataState => {
|
||||
/** quickReplies 保存当前账号可用的快捷回复;账号切换时以最新请求响应替换。 */
|
||||
const [quickReplies, setQuickReplies] = useState<ChatQuickReply[]>([]);
|
||||
/** quickReplyDraft 保存新增快捷回复的小型输入框文本。 */
|
||||
const [quickReplyDraft, setQuickReplyDraft] = useState('');
|
||||
/** quickReplyBusy 防止新增或删除过程中重复提交快捷回复变更。 */
|
||||
const [quickReplyBusy, setQuickReplyBusy] = useState(false);
|
||||
/** pendingDeleteQuickReply 保存等待确认删除的快捷回复,避免误触即删除。 */
|
||||
const [pendingDeleteQuickReply, setPendingDeleteQuickReply] = useState<ChatQuickReply | null>(null);
|
||||
/** copiedQuickReplyID 保存最近复制成功的回复标识,用于按钮内的短暂成功反馈。 */
|
||||
const [copiedQuickReplyID, setCopiedQuickReplyID] = useState<number | null>(null);
|
||||
/** buyerNote 保存当前账号和买家组合对应的完整备注。 */
|
||||
const [buyerNote, setBuyerNote] = useState<ChatBuyerNote | null>(null);
|
||||
/** noteLoading 表示当前会话的买家备注仍在读取。 */
|
||||
const [noteLoading, setNoteLoading] = useState(false);
|
||||
/** noteDialogOpen 控制完整买家备注弹窗显示。 */
|
||||
const [noteDialogOpen, setNoteDialogOpen] = useState(false);
|
||||
/** noteEditing 控制备注弹窗是否显示可写表单。 */
|
||||
const [noteEditing, setNoteEditing] = useState(false);
|
||||
/** noteDraft 保存备注编辑中的表单正文,与服务端数据分离。 */
|
||||
const [noteDraft, setNoteDraft] = useState('');
|
||||
/** noteSaving 防止备注保存期间发生重复提交。 */
|
||||
const [noteSaving, setNoteSaving] = useState(false);
|
||||
/** metadataError 保存元数据请求失败的用户可见说明。 */
|
||||
const [metadataError, setMetadataError] = useState('');
|
||||
/** quickReplyControllerRef 保存当前账号快捷回复读取请求的取消控制器。 */
|
||||
const quickReplyControllerRef = useRef<AbortController | null>(null);
|
||||
/** quickReplySequenceRef 为账号快捷回复查询分配单调递增代次,阻止晚到响应覆盖新账号。 */
|
||||
const quickReplySequenceRef = useRef(0);
|
||||
/** noteControllerRef 保存当前买家备注读取请求的取消控制器。 */
|
||||
const noteControllerRef = useRef<AbortController | null>(null);
|
||||
/** noteSequenceRef 为买家备注查询分配单调递增代次,阻止旧会话覆盖新会话。 */
|
||||
const noteSequenceRef = useRef(0);
|
||||
/** copyTimerRef 保存复制反馈自动关闭计时器,卸载时由当前 Hook 清理。 */
|
||||
const copyTimerRef = useRef<number | null>(null);
|
||||
|
||||
useEffect(/* 当前副作用在账号切换时读取账号级快捷回复,并在 cleanup 中取消旧请求。 */ () => {
|
||||
quickReplyControllerRef.current?.abort();
|
||||
// sequence 保存本次账号快捷回复请求代次。
|
||||
const sequence = ++quickReplySequenceRef.current;
|
||||
if (!activeAccountID) {
|
||||
setQuickReplies([]);
|
||||
setQuickReplyDraft('');
|
||||
return undefined;
|
||||
}
|
||||
setQuickReplies([]);
|
||||
setQuickReplyDraft('');
|
||||
// controller 保存本次快捷回复请求的取消控制器。
|
||||
const controller = new AbortController();
|
||||
quickReplyControllerRef.current = controller;
|
||||
void getChatQuickReplies(activeAccountID, { signal: controller.signal }).then(/* replies 保存当前账号查询返回的快捷回复列表。 */ replies => {
|
||||
if (!controller.signal.aborted && sequence === quickReplySequenceRef.current) setQuickReplies(replies);
|
||||
}).catch(/* loadError 保存快捷回复查询失败原因;中止请求不显示错误。 */ loadError => {
|
||||
if (!controller.signal.aborted && sequence === quickReplySequenceRef.current && !isChatAbortError(loadError)) setMetadataError(loadError instanceof Error ? loadError.message : '读取快捷回复失败');
|
||||
});
|
||||
return /* 当前 cleanup 取消账号切换后不再有效的快捷回复请求。 */ () => controller.abort();
|
||||
}, [activeAccountID]);
|
||||
|
||||
useEffect(/* 当前副作用在账号或买家切换时读取备注,并丢弃已失效会话的响应。 */ () => {
|
||||
noteControllerRef.current?.abort();
|
||||
// sequence 保存本次买家备注请求代次。
|
||||
const sequence = ++noteSequenceRef.current;
|
||||
// buyerID 保存当前选中会话的稳定买家标识;没有会话时不发起请求。
|
||||
const buyerID = selectedSession?.buyer_id || '';
|
||||
if (!activeAccountID || !buyerID) {
|
||||
setBuyerNote(null);
|
||||
setNoteLoading(false);
|
||||
setNoteDialogOpen(false);
|
||||
setNoteEditing(false);
|
||||
return undefined;
|
||||
}
|
||||
// controller 保存本次买家备注请求的取消控制器。
|
||||
const controller = new AbortController();
|
||||
noteControllerRef.current = controller;
|
||||
setNoteLoading(true);
|
||||
void getChatBuyerNote(activeAccountID, buyerID, { signal: controller.signal }).then(/* note 保存当前账号与买家组合的完整备注。 */ note => {
|
||||
if (!controller.signal.aborted && sequence === noteSequenceRef.current) {
|
||||
setBuyerNote(note);
|
||||
setNoteDraft(note.content);
|
||||
}
|
||||
}).catch(/* loadError 保存买家备注读取失败原因;中止请求不显示错误。 */ loadError => {
|
||||
if (!controller.signal.aborted && sequence === noteSequenceRef.current && !isChatAbortError(loadError)) setMetadataError(loadError instanceof Error ? loadError.message : '读取买家备注失败');
|
||||
}).finally(/* 当前回调在仍为最新请求时结束备注加载状态。 */ () => {
|
||||
if (!controller.signal.aborted && sequence === noteSequenceRef.current) setNoteLoading(false);
|
||||
});
|
||||
return /* 当前 cleanup 取消会话切换后不再有效的买家备注请求。 */ () => controller.abort();
|
||||
}, [activeAccountID, selectedSession?.buyer_id]);
|
||||
|
||||
useEffect(/* 当前副作用在 Hook 卸载时清理复制反馈计时器,避免卸载后写入 React 状态。 */ () => {
|
||||
/** cleanupCopyTimer 清理仍在运行的复制反馈计时器。 */
|
||||
const cleanupCopyTimer = (): void => {
|
||||
if (copyTimerRef.current !== null) window.clearTimeout(copyTimerRef.current);
|
||||
};
|
||||
return cleanupCopyTimer;
|
||||
}, []);
|
||||
|
||||
/** 新增当前账号的快捷回复,并在服务端成功后插入当前列表。 */
|
||||
const addQuickReply = useCallback(/* 当前回调提交底部快捷回复表单。 */ async (): Promise<void> => {
|
||||
// content 保存去除首尾空白后的待创建文本,内部换行保持原样。
|
||||
const content = quickReplyDraft.trim();
|
||||
if (!activeAccountID || !content || quickReplyBusy) return;
|
||||
setQuickReplyBusy(true);
|
||||
setMetadataError('');
|
||||
try {
|
||||
// reply 保存服务端创建并返回的快捷回复。
|
||||
const reply = await createChatQuickReply(activeAccountID, content);
|
||||
setQuickReplies(/* 当前回调将新建记录插入按最新优先排列的列表。 */ current => [reply, ...current]);
|
||||
setQuickReplyDraft('');
|
||||
} catch (/* createError 保存创建快捷回复失败原因。 */ createError) {
|
||||
if (!isChatAbortError(createError)) setMetadataError(createError instanceof Error ? createError.message : '添加快捷回复失败');
|
||||
} finally {
|
||||
setQuickReplyBusy(false);
|
||||
}
|
||||
}, [activeAccountID, quickReplyBusy, quickReplyDraft]);
|
||||
|
||||
/** requestQuickReplyDelete 打开快捷回复删除确认框。 */
|
||||
const requestQuickReplyDelete = useCallback(/* 当前回调记录用户请求删除的快捷回复。 */ (reply: ChatQuickReply): void => {
|
||||
setPendingDeleteQuickReply(reply);
|
||||
}, []);
|
||||
|
||||
/** cancelQuickReplyDelete 关闭删除确认框,不改变快捷回复列表。 */
|
||||
const cancelQuickReplyDelete = useCallback(/* 当前回调放弃当前待确认的快捷回复删除动作。 */ (): void => {
|
||||
setPendingDeleteQuickReply(null);
|
||||
}, []);
|
||||
|
||||
/** confirmQuickReplyDelete 删除用户已确认的快捷回复。 */
|
||||
const confirmQuickReplyDelete = useCallback(/* 当前回调提交删除确认框中的快捷回复删除操作。 */ async (): Promise<void> => {
|
||||
if (!activeAccountID || !pendingDeleteQuickReply || quickReplyBusy) return;
|
||||
// quickReplyID 保存确认删除的稳定快捷回复标识,避免异步请求读取会变的 state。
|
||||
const quickReplyID = pendingDeleteQuickReply.id;
|
||||
setQuickReplyBusy(true);
|
||||
setMetadataError('');
|
||||
try {
|
||||
await deleteChatQuickReply(activeAccountID, quickReplyID);
|
||||
setQuickReplies(/* 当前回调只移除服务端已成功删除的快捷回复。 */ current => current.filter(/* reply 保存当前参与删除匹配的快捷回复。 */ reply => reply.id !== quickReplyID));
|
||||
setPendingDeleteQuickReply(null);
|
||||
} catch (/* deleteError 保存删除快捷回复失败原因。 */ deleteError) {
|
||||
if (!isChatAbortError(deleteError)) setMetadataError(deleteError instanceof Error ? deleteError.message : '删除快捷回复失败');
|
||||
} finally {
|
||||
setQuickReplyBusy(false);
|
||||
}
|
||||
}, [activeAccountID, pendingDeleteQuickReply, quickReplyBusy]);
|
||||
|
||||
/** copyQuickReply 将快捷回复正文复制到系统剪贴板,并给出短暂成功反馈。 */
|
||||
const copyQuickReply = useCallback(/* 当前回调响应快捷回复复制按钮的用户操作。 */ async (reply: ChatQuickReply): Promise<void> => {
|
||||
if (!navigator.clipboard?.writeText) {
|
||||
setMetadataError('当前浏览器不支持复制到剪贴板');
|
||||
return;
|
||||
}
|
||||
setMetadataError('');
|
||||
try {
|
||||
await navigator.clipboard.writeText(reply.content);
|
||||
setCopiedQuickReplyID(reply.id);
|
||||
if (copyTimerRef.current !== null) window.clearTimeout(copyTimerRef.current);
|
||||
copyTimerRef.current = window.setTimeout(/* 当前回调在短暂反馈结束后清除复制成功状态。 */ () => setCopiedQuickReplyID(null), 1600);
|
||||
} catch (/* copyError 保存系统剪贴板拒绝写入时的失败原因。 */ copyError) {
|
||||
setMetadataError(copyError instanceof Error ? copyError.message : '复制快捷回复失败');
|
||||
}
|
||||
}, []);
|
||||
|
||||
/** openNoteDialog 打开当前买家的完整备注,并默认进入只读查看状态。 */
|
||||
const openNoteDialog = useCallback(/* 当前回调响应聊天标题中的备注摘要点击。 */ (): void => {
|
||||
setNoteDraft(buyerNote?.content || '');
|
||||
setNoteEditing(false);
|
||||
setNoteDialogOpen(true);
|
||||
}, [buyerNote?.content]);
|
||||
|
||||
/** closeNoteDialog 关闭备注弹窗并恢复当前已保存备注,放弃未保存草稿。 */
|
||||
const closeNoteDialog = useCallback(/* 当前回调响应备注弹窗的关闭操作。 */ (): void => {
|
||||
setNoteDraft(buyerNote?.content || '');
|
||||
setNoteEditing(false);
|
||||
setNoteDialogOpen(false);
|
||||
}, [buyerNote?.content]);
|
||||
|
||||
/** beginNoteEditing 将当前备注弹窗切换为可编辑状态。 */
|
||||
const beginNoteEditing = useCallback(/* 当前回调响应备注弹窗中的编辑按钮。 */ (): void => {
|
||||
setNoteDraft(buyerNote?.content || '');
|
||||
setNoteEditing(true);
|
||||
}, [buyerNote?.content]);
|
||||
|
||||
/** saveBuyerNote 保存当前会话买家的备注,并在成功后回到只读查看状态。 */
|
||||
const saveBuyerNote = useCallback(/* 当前回调提交买家备注编辑表单。 */ async (): Promise<void> => {
|
||||
// buyerID 保存当前会话的稳定买家标识;会话切换后不允许把旧备注写到新买家。
|
||||
const buyerID = selectedSession?.buyer_id || '';
|
||||
if (!activeAccountID || !buyerID || noteSaving) return;
|
||||
setNoteSaving(true);
|
||||
setMetadataError('');
|
||||
try {
|
||||
// note 保存服务端标准化并持久化后的买家备注。
|
||||
const note = await saveChatBuyerNote(activeAccountID, buyerID, noteDraft);
|
||||
setBuyerNote(note);
|
||||
setNoteDraft(note.content);
|
||||
setNoteEditing(false);
|
||||
} catch (/* saveError 保存备注保存失败原因。 */ saveError) {
|
||||
if (!isChatAbortError(saveError)) setMetadataError(saveError instanceof Error ? saveError.message : '保存买家备注失败');
|
||||
} finally {
|
||||
setNoteSaving(false);
|
||||
}
|
||||
}, [activeAccountID, noteDraft, noteSaving, selectedSession?.buyer_id]);
|
||||
|
||||
/** clearMetadataError 清除快捷回复和备注区域最近展示的错误。 */
|
||||
const clearMetadataError = useCallback(/* 当前回调在用户继续编辑或关闭错误提示时清空旧错误。 */ (): void => {
|
||||
setMetadataError('');
|
||||
}, []);
|
||||
|
||||
return {
|
||||
quickReplies, quickReplyDraft, setQuickReplyDraft, quickReplyBusy,
|
||||
pendingDeleteQuickReply, requestQuickReplyDelete, cancelQuickReplyDelete, confirmQuickReplyDelete, addQuickReply,
|
||||
copyQuickReply, copiedQuickReplyID, buyerNote, noteLoading, noteDialogOpen, noteEditing, noteDraft, setNoteDraft,
|
||||
noteSaving, openNoteDialog, closeNoteDialog, beginNoteEditing, saveBuyerNote, metadataError, clearMetadataError,
|
||||
};
|
||||
};
|
||||
@@ -125,6 +125,30 @@ export interface ChatMessage {
|
||||
sent_at: number;
|
||||
}
|
||||
|
||||
/** 由当前 feature adapter 归一后的账号级快捷回复 UI 模型;不直接暴露 HTTP DTO。 */
|
||||
export interface ChatQuickReply {
|
||||
/** 快捷回复稳定标识,用于 React 列表和删除请求。 */
|
||||
id: number;
|
||||
/** 快捷回复所属的闲鱼账号标识。 */
|
||||
account_id: string;
|
||||
/** 用户点击发送时提交到当前会话的文本模板。 */
|
||||
content: string;
|
||||
/** 快捷回复创建的 Unix 秒时间戳。 */
|
||||
created_at: number;
|
||||
}
|
||||
|
||||
/** 由当前 feature adapter 归一后的买家备注 UI 模型;备注按账号与买家 ID 隔离。 */
|
||||
export interface ChatBuyerNote {
|
||||
/** 备注所属的闲鱼账号标识。 */
|
||||
account_id: string;
|
||||
/** 备注所属的稳定平台买家标识。 */
|
||||
buyer_id: string;
|
||||
/** 完整备注正文;空字符串表示尚未填写。 */
|
||||
content: string;
|
||||
/** 最近保存的 Unix 秒时间戳;空备注保持零值。 */
|
||||
updated_at: number;
|
||||
}
|
||||
|
||||
/** 简单资源创建接口的数值主键响应。 */
|
||||
/** 由当前 feature adapter 归一后的 MutationIDResponse UI 模型;不直接暴露 HTTP DTO。 */
|
||||
export interface MutationIDResponse {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import {
|
||||
AlertCircle,Check,CheckCheck,ImagePlus,Loader2,MessageCircleMore,RefreshCw,
|
||||
Search,Send,Smile,UserRound,Wifi,WifiOff,X,
|
||||
AlertCircle,Check,CheckCheck,ImagePlus,Loader2,MessageCircleMore,PanelRightClose,PanelRightOpen,
|
||||
RefreshCw,Search,Send,Smile,UserRound,Wifi,WifiOff,X,
|
||||
} from 'lucide-react';
|
||||
import React from 'react';
|
||||
import Lightbox from 'yet-another-react-lightbox';
|
||||
import 'yet-another-react-lightbox/styles.css';
|
||||
import { AudioMessage } from '../components/AudioMessage';
|
||||
import ChatMetadataFeature from '../components/ChatMetadataFeature';
|
||||
import { useChat } from '../hooks';
|
||||
import { unreadBadgeClassName,unreadBadgeLabel } from '../state';
|
||||
|
||||
@@ -17,10 +18,11 @@ const Chat: React.FC = () => {
|
||||
messages, search, unreadOnly, draft, loading, messagesLoading, olderLoading, hasOlder, contactsLoading,
|
||||
hasMoreContacts, emojiOpen, sending, error, liveState, pendingImage, scrollRef, imageInputRef, setActiveAccountID,
|
||||
setActiveChatID, setSearch, setUnreadOnly, setDraft, setEmojiOpen, reloadSessions, loadMoreContacts,
|
||||
loadOlderMessages, handleMessageScroll, handleSend, handleImage, handlePastedImages, confirmSendImage, closeImagePreview, retrySend, retryAvailable,
|
||||
loadOlderMessages, handleMessageScroll, handleSend, handleQuickReply, handleImage, handlePastedImages, confirmSendImage, closeImagePreview, retrySend, retryAvailable,
|
||||
unreadForAccount, emojiURL, xianyuEmojis, renderXianyuText, formatClock, messageTime,
|
||||
} = useChat();
|
||||
|
||||
|
||||
// imageMessages 保存当前会话中的图片消息,供灯箱按消息顺序浏览。
|
||||
const imageMessages = React.useMemo(/* 当前回调筛选当前会话中的图片消息。 */ () => messages.filter(/* 当前回调判断消息是否为图片类型。 */ message => message.message_type === 'image'), [messages]);
|
||||
// imageSlides 将聊天图片转换为灯箱组件所需的展示模型。
|
||||
@@ -31,6 +33,8 @@ const Chat: React.FC = () => {
|
||||
const openLightbox = React.useCallback(/* 当前回调定位并打开指定聊天图片。 */ (messageKey: string): void => {
|
||||
setLightboxIndex(imageMessages.findIndex(/* 当前回调匹配图片消息键。 */ item => item.message_key === messageKey));
|
||||
}, [imageMessages]);
|
||||
// quickReplyPanelOpen 保存右侧快捷回复抽屉的展开状态;页面卸载后恢复默认收起。
|
||||
const [quickReplyPanelOpen, setQuickReplyPanelOpen] = React.useState(false);
|
||||
|
||||
if (loading) return <div className="flex h-[calc(100vh-4rem)] items-center justify-center"><Loader2 className="h-8 w-8 animate-spin text-sky-500" /></div>;
|
||||
|
||||
@@ -127,13 +131,13 @@ const Chat: React.FC = () => {
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main className="flex min-h-0 min-w-0 flex-col overflow-hidden bg-surface-subtle">
|
||||
<main className="relative flex min-h-0 min-w-0 flex-col overflow-hidden bg-surface-subtle">
|
||||
{selectedSession ? (
|
||||
<>
|
||||
<div className="flex h-16 shrink-0 items-center border-b border-slate-200 bg-white px-5">
|
||||
<div className="flex h-20 shrink-0 items-start border-b border-slate-200 bg-white px-5 pt-4">
|
||||
<div className="min-w-0">
|
||||
<div className="truncate text-sm font-black text-slate-950">{selectedSession.buyer_name || selectedSession.buyer_id}</div>
|
||||
<div className="mt-0.5 truncate text-xs text-slate-500">用户 ID:{selectedSession.buyer_id}</div>
|
||||
<div className="mt-0.5 flex flex-col text-xs text-slate-500"><span>用户 ID:</span><span className="truncate">{selectedSession.buyer_id}</span></div>
|
||||
</div>
|
||||
<span className={`ml-auto rounded-full px-2.5 py-1 text-[10px] font-bold ${activeAccount?.runtime_state === 'online' ? 'bg-emerald-50 text-emerald-700' : 'bg-slate-100 text-slate-500'}`}>
|
||||
{activeAccount?.runtime_state === 'online' ? '账号在线' : '账号离线'}
|
||||
@@ -207,6 +211,9 @@ const Chat: React.FC = () => {
|
||||
</div>
|
||||
<input ref={imageInputRef} type="file" accept="image/*" className="hidden" onChange={/* 当前回调处理用户交互或异步状态变化。 */ event => void handleImage(event.target.files?.[0])} />
|
||||
<button type="button" onClick={/* 当前回调处理用户交互或异步状态变化。 */ () => imageInputRef.current?.click()} disabled={sending || activeAccount?.runtime_state !== 'online'} className="rounded-lg p-2 text-slate-500 transition hover:bg-sky-50 hover:text-sky-600 disabled:opacity-40" title="发送图片(最大 10MB)"><ImagePlus className="h-5 w-5" /></button>
|
||||
<button type="button" onClick={/* 当前回调依当前渲染状态切换右侧账号快捷回复抽屉,避免页面级外部点击监听与按钮切换相互抵消。 */ () => setQuickReplyPanelOpen(!quickReplyPanelOpen)} className="ml-auto rounded-lg p-2 text-slate-500 transition hover:bg-sky-50 hover:text-sky-600" title={quickReplyPanelOpen ? '收起快捷回复' : '展开快捷回复'} aria-label={quickReplyPanelOpen ? '收起快捷回复' : '展开快捷回复'}>
|
||||
{quickReplyPanelOpen ? <PanelRightClose className="h-5 w-5" /> : <PanelRightOpen className="h-5 w-5" />}
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex items-end gap-3 rounded-2xl border border-slate-200 bg-slate-50 p-2 transition focus-within:border-sky-400 focus-within:ring-2 focus-within:ring-sky-100">
|
||||
<textarea value={draft} onChange={/* 当前回调处理用户交互或异步状态变化。 */ event => setDraft(event.target.value)} rows={2} maxLength={2000}
|
||||
@@ -236,6 +243,7 @@ const Chat: React.FC = () => {
|
||||
<p className="mt-1 text-sm text-slate-400">该账号的新消息会实时出现在左侧列表。</p>
|
||||
</div>
|
||||
)}
|
||||
<ChatMetadataFeature activeAccountID={activeAccountID} selectedSession={selectedSession} quickReplyPanelOpen={quickReplyPanelOpen} closeQuickReplyPanel={/* 当前回调收起右侧快捷回复抽屉。 */ () => setQuickReplyPanelOpen(false)} sendQuickReply={handleQuickReply} sending={sending} accountOnline={activeAccount?.runtime_state === 'online'} />
|
||||
</main>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -628,6 +628,59 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/chat/quick-replies": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
/** getApiV1ChatQuickReplies */
|
||||
get: operations["getApiV1ChatQuickReplies"];
|
||||
put?: never;
|
||||
/** postApiV1ChatQuickReplies */
|
||||
post: operations["postApiV1ChatQuickReplies"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/chat/quick-replies/{quick_reply_id}": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
post?: never;
|
||||
/** deleteApiV1ChatQuickRepliesByquick_reply_id */
|
||||
delete: operations["deleteApiV1ChatQuickRepliesByquick_reply_id"];
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/chat/buyer-notes/{buyer_id}": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
/** getApiV1ChatBuyerNotesBybuyer_id */
|
||||
get: operations["getApiV1ChatBuyerNotesBybuyer_id"];
|
||||
/** putApiV1ChatBuyerNotesBybuyer_id */
|
||||
put: operations["putApiV1ChatBuyerNotesBybuyer_id"];
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/chat/messages": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
@@ -2526,6 +2579,29 @@ export interface components {
|
||||
[key: string]: string | number;
|
||||
}[];
|
||||
};
|
||||
ChatQuickReply: {
|
||||
id: number;
|
||||
account_id: string;
|
||||
content: string;
|
||||
created_at: number;
|
||||
};
|
||||
ChatQuickReplyList: {
|
||||
quick_replies: components["schemas"]["ChatQuickReply"][];
|
||||
};
|
||||
ChatQuickReplyCreateRequest: {
|
||||
account_id: string;
|
||||
content: string;
|
||||
};
|
||||
ChatBuyerNote: {
|
||||
account_id: string;
|
||||
buyer_id: string;
|
||||
content: string;
|
||||
updated_at: number;
|
||||
};
|
||||
ChatBuyerNoteSaveRequest: {
|
||||
account_id: string;
|
||||
content: string;
|
||||
};
|
||||
OrderDTO: {
|
||||
order_id: string;
|
||||
item_id: string;
|
||||
@@ -6091,6 +6167,324 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
getApiV1ChatQuickReplies: {
|
||||
parameters: {
|
||||
query: {
|
||||
account_id: string;
|
||||
};
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description 成功 */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ChatQuickReplyList"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
500: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
postApiV1ChatQuickReplies: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["ChatQuickReplyCreateRequest"];
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description 成功 */
|
||||
201: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ChatQuickReply"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
409: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
500: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
deleteApiV1ChatQuickRepliesByquick_reply_id: {
|
||||
parameters: {
|
||||
query: {
|
||||
account_id: string;
|
||||
};
|
||||
header?: never;
|
||||
path: {
|
||||
quick_reply_id: number;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description 成功 */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["OperationResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
500: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
getApiV1ChatBuyerNotesBybuyer_id: {
|
||||
parameters: {
|
||||
query: {
|
||||
account_id: string;
|
||||
};
|
||||
header?: never;
|
||||
path: {
|
||||
buyer_id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description 成功 */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ChatBuyerNote"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
500: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
putApiV1ChatBuyerNotesBybuyer_id: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
buyer_id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["ChatBuyerNoteSaveRequest"];
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description 成功 */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ChatBuyerNote"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
/** @description 统一错误响应 */
|
||||
500: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
getApiV1ChatMessages: {
|
||||
parameters: {
|
||||
query: {
|
||||
|
||||
@@ -58,6 +58,10 @@ export default defineConfig({
|
||||
manualChunks(id) {
|
||||
// modulePath 是统一分隔符后的模块绝对路径,用于稳定匹配依赖目录。
|
||||
const modulePath = id.split(path.sep).join('/');
|
||||
// 聊天元数据包含快捷回复和备注弹窗等低频交互,独立分片可避免挤占会话阅读首屏。
|
||||
if (modulePath.includes('/app/features/chat/components/ChatMetadataFeature.') || modulePath.includes('/app/features/chat/metadata.')) {
|
||||
return 'chat-metadata';
|
||||
}
|
||||
if (!modulePath.includes('/node_modules/')) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -93,6 +93,60 @@ func (r chatRepository) FindInboundParsedJSONContaining(ctx context.Context, acc
|
||||
return r.store.WSMessages.FindInboundParsedJSONContaining(ctx, accountID, fragment, limit)
|
||||
}
|
||||
|
||||
// ListQuickReplies 查询账号级人工快捷回复并转换为应用层非敏感模型。
|
||||
func (r chatRepository) ListQuickReplies(ctx context.Context, accountID string) ([]chatapp.QuickReply, error) {
|
||||
// rows 和 listErr 保存数据库快捷回复记录及查询错误。
|
||||
rows, listErr := r.store.Chats.ListQuickReplies(ctx, accountID)
|
||||
if listErr != nil {
|
||||
return nil, listErr
|
||||
}
|
||||
// replies 保存脱离数据库模型的快捷回复列表。
|
||||
replies := make([]chatapp.QuickReply, 0, len(rows))
|
||||
// row 表示当前待转换的快捷回复持久化记录。
|
||||
for _, row := range rows {
|
||||
replies = append(replies, chatapp.QuickReply{ID: row.ID, AccountID: row.CookieID, Content: row.Content, CreatedAt: row.CreatedAt})
|
||||
}
|
||||
return replies, nil
|
||||
}
|
||||
|
||||
// CreateQuickReply 写入账号级快捷回复并转换数据库上限错误。
|
||||
func (r chatRepository) CreateQuickReply(ctx context.Context, accountID, content string) (chatapp.QuickReply, error) {
|
||||
// row 和 createErr 保存数据库写入结果及可能的数量上限错误。
|
||||
row, createErr := r.store.Chats.CreateQuickReply(ctx, accountID, content)
|
||||
if errors.Is(createErr, db.ErrChatQuickReplyLimitReached) {
|
||||
return chatapp.QuickReply{}, chatapp.ErrQuickReplyLimitReached
|
||||
}
|
||||
if createErr != nil {
|
||||
return chatapp.QuickReply{}, createErr
|
||||
}
|
||||
return chatapp.QuickReply{ID: row.ID, AccountID: row.CookieID, Content: row.Content, CreatedAt: row.CreatedAt}, nil
|
||||
}
|
||||
|
||||
// DeleteQuickReply 删除账号下指定快捷回复并返回是否命中记录。
|
||||
func (r chatRepository) DeleteQuickReply(ctx context.Context, accountID string, quickReplyID int64) (bool, error) {
|
||||
return r.store.Chats.DeleteQuickReply(ctx, accountID, quickReplyID)
|
||||
}
|
||||
|
||||
// GetBuyerNote 读取账号和买家 ID 共同隔离的完整备注。
|
||||
func (r chatRepository) GetBuyerNote(ctx context.Context, accountID, buyerID string) (chatapp.BuyerNote, bool, error) {
|
||||
// row、found 和 readErr 保存数据库读取结果、存在状态和错误。
|
||||
row, found, readErr := r.store.Chats.GetBuyerNote(ctx, accountID, buyerID)
|
||||
if readErr != nil || !found {
|
||||
return chatapp.BuyerNote{}, found, readErr
|
||||
}
|
||||
return chatapp.BuyerNote{AccountID: row.CookieID, BuyerID: row.BuyerID, Content: row.Content, UpdatedAt: row.UpdatedAt}, true, nil
|
||||
}
|
||||
|
||||
// SaveBuyerNote 保存买家备注;空内容由数据库适配器转换为删除语义。
|
||||
func (r chatRepository) SaveBuyerNote(ctx context.Context, note chatapp.BuyerNote) (chatapp.BuyerNote, error) {
|
||||
// row 和 saveErr 保存数据库写入后的备注及错误。
|
||||
row, saveErr := r.store.Chats.SaveBuyerNote(ctx, db.ChatBuyerNote{CookieID: note.AccountID, BuyerID: note.BuyerID, Content: note.Content})
|
||||
if saveErr != nil {
|
||||
return chatapp.BuyerNote{}, saveErr
|
||||
}
|
||||
return chatapp.BuyerNote{AccountID: row.CookieID, BuyerID: row.BuyerID, Content: row.Content, UpdatedAt: row.UpdatedAt}, nil
|
||||
}
|
||||
|
||||
// chatIdentityResolver 在适配器内读取 Cookie 并调用平台身份查询接口。
|
||||
type chatIdentityResolver struct {
|
||||
// store 提供账号凭证读取能力,明文只在本次平台调用期间存在。
|
||||
@@ -139,5 +193,8 @@ func (r chatIdentityResolver) Resolve(ctx context.Context, accountID, chatID str
|
||||
// 确保数据库聊天适配器覆盖应用层会话端口的全部能力。
|
||||
var _ chatapp.SessionRepository = chatRepository{}
|
||||
|
||||
// 确保数据库聊天适配器覆盖快捷回复和买家备注的应用层端口。
|
||||
var _ chatapp.MetadataRepository = chatRepository{}
|
||||
|
||||
// 确保聊天身份适配器覆盖应用层平台身份端口。
|
||||
var _ chatapp.IdentityResolver = chatIdentityResolver{}
|
||||
@@ -0,0 +1,175 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// quickReplyLimit 限制单个账号可保存的人工快捷回复数量,防止聊天侧栏无限增长。
|
||||
const quickReplyLimit = 50
|
||||
|
||||
// chatMetadataMaxCharacters 限制快捷回复和买家备注的 Unicode 字符数量,与聊天输入上限保持一致。
|
||||
const chatMetadataMaxCharacters = 2000
|
||||
|
||||
// ErrMetadataUnavailable 表示当前聊天服务未装配快捷回复和买家备注持久化端口。
|
||||
var ErrMetadataUnavailable = errors.New("聊天元数据服务未启用")
|
||||
|
||||
// ErrMetadataForbidden 表示当前用户无权访问目标账号的聊天元数据。
|
||||
var ErrMetadataForbidden = errors.New("无权访问该账号的聊天元数据")
|
||||
|
||||
// ErrQuickReplyLimitReached 表示目标账号已保存允许数量的快捷回复。
|
||||
var ErrQuickReplyLimitReached = errors.New("快捷回复数量已达上限")
|
||||
|
||||
// ErrQuickReplyNotFound 表示待删除的快捷回复不存在于目标账号。
|
||||
var ErrQuickReplyNotFound = errors.New("快捷回复不存在")
|
||||
|
||||
// QuickReply 是账号级人工快捷回复的非敏感应用层模型。
|
||||
type QuickReply struct {
|
||||
// ID 是快捷回复的稳定数据库标识。
|
||||
ID int64
|
||||
// AccountID 是快捷回复所属账号标识,不包含账号凭证。
|
||||
AccountID string
|
||||
// Content 是用户手动发送到聊天会话的文本模板。
|
||||
Content string
|
||||
// CreatedAt 是快捷回复创建时的 Unix 秒时间戳。
|
||||
CreatedAt int64
|
||||
}
|
||||
|
||||
// BuyerNote 是按账号和买家 ID 隔离的聊天备注模型。
|
||||
type BuyerNote struct {
|
||||
// AccountID 是备注所属的账号标识。
|
||||
AccountID string
|
||||
// BuyerID 是平台买家稳定标识,不使用易变的聊天会话 ID。
|
||||
BuyerID string
|
||||
// Content 是完整备注正文;空值表示该买家尚未填写备注。
|
||||
Content string
|
||||
// UpdatedAt 是最近保存时的 Unix 秒时间戳;空备注为零。
|
||||
UpdatedAt int64
|
||||
}
|
||||
|
||||
// MetadataRepository 定义聊天快捷回复与买家备注用例所需的最小持久化能力。
|
||||
type MetadataRepository interface {
|
||||
// ListQuickReplies 读取账号下按创建时间倒序排列的快捷回复。
|
||||
ListQuickReplies(ctx context.Context, accountID string) ([]QuickReply, error)
|
||||
// CreateQuickReply 原子地创建快捷回复;达到账号上限时返回 ErrQuickReplyLimitReached。
|
||||
CreateQuickReply(ctx context.Context, accountID, content string) (QuickReply, error)
|
||||
// DeleteQuickReply 删除账号下指定快捷回复;不存在时返回 false。
|
||||
DeleteQuickReply(ctx context.Context, accountID string, quickReplyID int64) (bool, error)
|
||||
// GetBuyerNote 读取买家备注;没有记录时返回 found=false 而非错误。
|
||||
GetBuyerNote(ctx context.Context, accountID, buyerID string) (BuyerNote, bool, error)
|
||||
// SaveBuyerNote 保存完整备注;content 为空时删除已有记录。
|
||||
SaveBuyerNote(ctx context.Context, note BuyerNote) (BuyerNote, error)
|
||||
}
|
||||
|
||||
// ListQuickReplies 查询当前用户有权访问账号的人工快捷回复。
|
||||
func (s *Service) ListQuickReplies(ctx context.Context, userID int64, accountID string) ([]QuickReply, error) {
|
||||
// normalizedAccountID 保存去除空白后的账号标识,避免不同 HTTP 表达产生不同的数据分区。
|
||||
normalizedAccountID := strings.TrimSpace(accountID)
|
||||
// repository 保存已验证装配的聊天元数据持久化端口。
|
||||
repository, err := s.metadataRepository(ctx, userID, normalizedAccountID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return repository.ListQuickReplies(ctx, normalizedAccountID)
|
||||
}
|
||||
|
||||
// CreateQuickReply 校验归属和内容后,为账号保存一条人工快捷回复。
|
||||
func (s *Service) CreateQuickReply(ctx context.Context, userID int64, accountID, content string) (QuickReply, error) {
|
||||
// normalizedAccountID 保存归一化后的账号标识。
|
||||
normalizedAccountID := strings.TrimSpace(accountID)
|
||||
// normalizedContent 保存去除首尾无意义空白后的用户回复模板,同时保留内部换行。
|
||||
normalizedContent := strings.TrimSpace(content)
|
||||
if normalizedContent == "" || utf8.RuneCountInString(normalizedContent) > chatMetadataMaxCharacters {
|
||||
return QuickReply{}, ErrInvalidInput
|
||||
}
|
||||
// repository 保存已完成归属校验的元数据持久化端口。
|
||||
repository, err := s.metadataRepository(ctx, userID, normalizedAccountID)
|
||||
if err != nil {
|
||||
return QuickReply{}, err
|
||||
}
|
||||
return repository.CreateQuickReply(ctx, normalizedAccountID, normalizedContent)
|
||||
}
|
||||
|
||||
// DeleteQuickReply 校验归属后删除指定账号下的快捷回复。
|
||||
func (s *Service) DeleteQuickReply(ctx context.Context, userID int64, accountID string, quickReplyID int64) error {
|
||||
// normalizedAccountID 保存归一化后的账号标识。
|
||||
normalizedAccountID := strings.TrimSpace(accountID)
|
||||
if quickReplyID <= 0 {
|
||||
return ErrInvalidInput
|
||||
}
|
||||
// repository 保存已完成归属校验的元数据持久化端口。
|
||||
repository, err := s.metadataRepository(ctx, userID, normalizedAccountID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// deleted 和 deleteErr 保存删除是否命中目标记录及数据库错误。
|
||||
deleted, deleteErr := repository.DeleteQuickReply(ctx, normalizedAccountID, quickReplyID)
|
||||
if deleteErr != nil {
|
||||
return deleteErr
|
||||
}
|
||||
if !deleted {
|
||||
return ErrQuickReplyNotFound
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBuyerNote 返回当前用户账号下买家的完整备注;没有保存记录时返回可编辑的空备注。
|
||||
func (s *Service) GetBuyerNote(ctx context.Context, userID int64, accountID, buyerID string) (BuyerNote, error) {
|
||||
// normalizedAccountID 和 normalizedBuyerID 保存去除空白后的隔离键。
|
||||
normalizedAccountID, normalizedBuyerID := strings.TrimSpace(accountID), strings.TrimSpace(buyerID)
|
||||
if normalizedBuyerID == "" {
|
||||
return BuyerNote{}, ErrInvalidInput
|
||||
}
|
||||
// repository 保存已完成归属校验的元数据持久化端口。
|
||||
repository, err := s.metadataRepository(ctx, userID, normalizedAccountID)
|
||||
if err != nil {
|
||||
return BuyerNote{}, err
|
||||
}
|
||||
// note、found 和 readErr 保存持久化备注、存在状态及读取错误。
|
||||
note, found, readErr := repository.GetBuyerNote(ctx, normalizedAccountID, normalizedBuyerID)
|
||||
if readErr != nil {
|
||||
return BuyerNote{}, readErr
|
||||
}
|
||||
if !found {
|
||||
return BuyerNote{AccountID: normalizedAccountID, BuyerID: normalizedBuyerID}, nil
|
||||
}
|
||||
return note, nil
|
||||
}
|
||||
|
||||
// SaveBuyerNote 校验归属和长度后更新按账号隔离的买家备注。
|
||||
func (s *Service) SaveBuyerNote(ctx context.Context, userID int64, accountID, buyerID, content string) (BuyerNote, error) {
|
||||
// normalizedAccountID、normalizedBuyerID 和 normalizedContent 保存规范化后的备注隔离键及正文。
|
||||
normalizedAccountID, normalizedBuyerID, normalizedContent := strings.TrimSpace(accountID), strings.TrimSpace(buyerID), strings.TrimSpace(content)
|
||||
if normalizedBuyerID == "" || utf8.RuneCountInString(normalizedContent) > chatMetadataMaxCharacters {
|
||||
return BuyerNote{}, ErrInvalidInput
|
||||
}
|
||||
// repository 保存已完成归属校验的元数据持久化端口。
|
||||
repository, err := s.metadataRepository(ctx, userID, normalizedAccountID)
|
||||
if err != nil {
|
||||
return BuyerNote{}, err
|
||||
}
|
||||
return repository.SaveBuyerNote(ctx, BuyerNote{AccountID: normalizedAccountID, BuyerID: normalizedBuyerID, Content: normalizedContent})
|
||||
}
|
||||
|
||||
// metadataRepository 验证聊天服务装配、账号归属和元数据持久化端口。
|
||||
func (s *Service) metadataRepository(ctx context.Context, userID int64, accountID string) (MetadataRepository, error) {
|
||||
if s == nil || s.repository == nil || userID <= 0 || accountID == "" {
|
||||
return nil, ErrInvalidInput
|
||||
}
|
||||
// repository 保存从聊天基础仓储断言得到的元数据能力。
|
||||
repository, ok := s.repository.(MetadataRepository)
|
||||
if !ok {
|
||||
return nil, ErrMetadataUnavailable
|
||||
}
|
||||
// owned 和 ownershipErr 保存非敏感账号所有权判定及查询错误。
|
||||
owned, ownershipErr := s.OwnsAccount(ctx, userID, accountID)
|
||||
if ownershipErr != nil {
|
||||
return nil, ownershipErr
|
||||
}
|
||||
if !owned {
|
||||
return nil, ErrMetadataForbidden
|
||||
}
|
||||
return repository, nil
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// metadataTestRepository 是快捷回复和买家备注用例的内存持久化替身。
|
||||
type metadataTestRepository struct {
|
||||
// fakeRepository 复用聊天查询和账号归属所需的最小端口实现。
|
||||
*fakeRepository
|
||||
// replies 保存测试中的账号快捷回复列表。
|
||||
replies []QuickReply
|
||||
// note 保存测试中的买家备注;空值由 found 控制是否已持久化。
|
||||
note BuyerNote
|
||||
// found 表示测试买家备注是否已经存在。
|
||||
found bool
|
||||
}
|
||||
|
||||
// ListQuickReplies 返回当前测试替身保存的快捷回复集合。
|
||||
func (r *metadataTestRepository) ListQuickReplies(context.Context, string) ([]QuickReply, error) {
|
||||
return append([]QuickReply(nil), r.replies...), nil
|
||||
}
|
||||
|
||||
// CreateQuickReply 将测试回复追加到内存集合,并模拟已达上限错误。
|
||||
func (r *metadataTestRepository) CreateQuickReply(_ context.Context, accountID, content string) (QuickReply, error) {
|
||||
if len(r.replies) >= quickReplyLimit {
|
||||
return QuickReply{}, ErrQuickReplyLimitReached
|
||||
}
|
||||
// reply 保存当前调用构造的确定性快捷回复。
|
||||
reply := QuickReply{ID: int64(len(r.replies) + 1), AccountID: accountID, Content: content, CreatedAt: 1}
|
||||
r.replies = append(r.replies, reply)
|
||||
return reply, nil
|
||||
}
|
||||
|
||||
// DeleteQuickReply 按标识移除测试快捷回复并返回是否命中。
|
||||
func (r *metadataTestRepository) DeleteQuickReply(_ context.Context, _ string, quickReplyID int64) (bool, error) {
|
||||
// replyIndex 保存与待删除标识匹配的内存快捷回复下标。
|
||||
for replyIndex, reply := range r.replies {
|
||||
if reply.ID == quickReplyID {
|
||||
r.replies = append(r.replies[:replyIndex], r.replies[replyIndex+1:]...)
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GetBuyerNote 返回内存备注及其持久化存在状态。
|
||||
func (r *metadataTestRepository) GetBuyerNote(context.Context, string, string) (BuyerNote, bool, error) {
|
||||
return r.note, r.found, nil
|
||||
}
|
||||
|
||||
// SaveBuyerNote 保存或清除内存备注,并复现空内容的逻辑空备注语义。
|
||||
func (r *metadataTestRepository) SaveBuyerNote(_ context.Context, note BuyerNote) (BuyerNote, error) {
|
||||
if note.Content == "" {
|
||||
r.note = BuyerNote{AccountID: note.AccountID, BuyerID: note.BuyerID}
|
||||
r.found = false
|
||||
return r.note, nil
|
||||
}
|
||||
note.UpdatedAt = 1
|
||||
r.note = note
|
||||
r.found = true
|
||||
return note, nil
|
||||
}
|
||||
|
||||
// TestChatMetadataValidatesOwnershipAndContent 验证聊天元数据用例执行账号隔离、输入校验和空备注默认语义。
|
||||
func TestChatMetadataValidatesOwnershipAndContent(t *testing.T) {
|
||||
// repository 保存具备账号归属和元数据能力的内存替身。
|
||||
repository := &metadataTestRepository{fakeRepository: &fakeRepository{owned: true}}
|
||||
// service 保存使用该替身的聊天应用服务。
|
||||
service := New(repository)
|
||||
// reply 和 createErr 保存创建快捷回复的结果及错误。
|
||||
reply, createErr := service.CreateQuickReply(context.Background(), 7, " account ", " 您好\n可以直接拍 ")
|
||||
if createErr != nil || reply.Content != "您好\n可以直接拍" || len(repository.replies) != 1 {
|
||||
t.Fatalf("创建快捷回复 reply=%+v err=%v", reply, createErr)
|
||||
}
|
||||
// invalidErr 保存删除不存在快捷回复时应用服务返回的业务错误。
|
||||
if invalidErr := service.DeleteQuickReply(context.Background(), 7, "account", 99); !errors.Is(invalidErr, ErrQuickReplyNotFound) {
|
||||
t.Fatalf("删除不存在快捷回复 error=%v", invalidErr)
|
||||
}
|
||||
// emptyNote 和 noteErr 保存尚未持久化买家备注的逻辑默认值。
|
||||
emptyNote, noteErr := service.GetBuyerNote(context.Background(), 7, "account", "buyer")
|
||||
if noteErr != nil || emptyNote.Content != "" || emptyNote.BuyerID != "buyer" {
|
||||
t.Fatalf("空备注 note=%+v err=%v", emptyNote, noteErr)
|
||||
}
|
||||
// savedNote 和 saveErr 保存买家备注写入结果及错误。
|
||||
savedNote, saveErr := service.SaveBuyerNote(context.Background(), 7, "account", "buyer", " 重点客户 ")
|
||||
if saveErr != nil || savedNote.Content != "重点客户" || savedNote.UpdatedAt != 1 {
|
||||
t.Fatalf("保存备注 note=%+v err=%v", savedNote, saveErr)
|
||||
}
|
||||
// clearedNote 和 clearErr 保存清除备注后的逻辑空结果。
|
||||
clearedNote, clearErr := service.SaveBuyerNote(context.Background(), 7, "account", "buyer", "")
|
||||
if clearErr != nil || clearedNote.Content != "" || repository.found {
|
||||
t.Fatalf("清除备注 note=%+v found=%v err=%v", clearedNote, repository.found, clearErr)
|
||||
}
|
||||
// invalidErr 保存尝试创建空快捷回复时应用服务返回的输入校验错误。
|
||||
if _, invalidErr := service.CreateQuickReply(context.Background(), 7, "account", ""); !errors.Is(invalidErr, ErrInvalidInput) {
|
||||
t.Fatalf("空快捷回复 error=%v", invalidErr)
|
||||
}
|
||||
// deniedRepository 保存模拟无权访问账号的元数据替身。
|
||||
deniedRepository := &metadataTestRepository{fakeRepository: &fakeRepository{owned: false}}
|
||||
// deniedErr 保存无账号归属时读取快捷回复返回的授权错误。
|
||||
if _, deniedErr := New(deniedRepository).ListQuickReplies(context.Background(), 7, "account"); !errors.Is(deniedErr, ErrMetadataForbidden) {
|
||||
t.Fatalf("越权读取 error=%v", deniedErr)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
// chatQuickReplyLimit 是数据库事务执行上限判断时使用的账号级快捷回复最大数量。
|
||||
const chatQuickReplyLimit = 50
|
||||
|
||||
// ErrChatQuickReplyLimitReached 表示账号已达到可保存快捷回复的数量上限。
|
||||
var ErrChatQuickReplyLimitReached = errors.New("聊天快捷回复数量已达上限")
|
||||
|
||||
// ChatQuickReply 是聊天快捷回复的持久化读取模型,不含账号凭证或用户秘密。
|
||||
type ChatQuickReply struct {
|
||||
// ID 是数据库生成的稳定快捷回复标识。
|
||||
ID int64
|
||||
// CookieID 是快捷回复所属账号标识。
|
||||
CookieID string
|
||||
// Content 是人工发送时使用的文本模板。
|
||||
Content string
|
||||
// CreatedAt 是记录创建的 Unix 秒时间戳。
|
||||
CreatedAt int64
|
||||
}
|
||||
|
||||
// ChatBuyerNote 是按账号与平台买家 ID 归属的备注持久化模型。
|
||||
type ChatBuyerNote struct {
|
||||
// CookieID 是备注所属账号标识。
|
||||
CookieID string
|
||||
// BuyerID 是买家稳定平台标识,不使用聊天会话 ID。
|
||||
BuyerID string
|
||||
// Content 是完整备注正文。
|
||||
Content string
|
||||
// UpdatedAt 是最近一次保存的 Unix 秒时间戳。
|
||||
UpdatedAt int64
|
||||
}
|
||||
|
||||
// ListQuickReplies 查询账号下按最新创建时间排序的人工快捷回复。
|
||||
func (s *ChatStore) ListQuickReplies(ctx context.Context, cookieID string) ([]ChatQuickReply, error) {
|
||||
// rows 和 queryErr 保存快捷回复查询游标及数据库错误。
|
||||
rows, queryErr := s.DB.QueryContext(ctx, `SELECT id,cookie_id,content,created_at
|
||||
FROM chat_quick_replies WHERE cookie_id=? ORDER BY id DESC`, cookieID)
|
||||
if queryErr != nil {
|
||||
return nil, queryErr
|
||||
}
|
||||
defer rows.Close()
|
||||
// replies 保存按数据库顺序扫描出的快捷回复集合。
|
||||
replies := make([]ChatQuickReply, 0)
|
||||
// row 表示当前正在扫描的一条账号快捷回复。
|
||||
for rows.Next() {
|
||||
// reply 保存当前行映射得到的非敏感快捷回复。
|
||||
var reply ChatQuickReply
|
||||
// scanErr 保存当前快捷回复行字段映射失败原因。
|
||||
if scanErr := rows.Scan(&reply.ID, &reply.CookieID, &reply.Content, &reply.CreatedAt); scanErr != nil {
|
||||
return nil, scanErr
|
||||
}
|
||||
replies = append(replies, reply)
|
||||
}
|
||||
return replies, rows.Err()
|
||||
}
|
||||
|
||||
// CreateQuickReply 在账号行锁保护下创建快捷回复,确保并发请求不能突破数量上限。
|
||||
func (s *ChatStore) CreateQuickReply(ctx context.Context, cookieID, content string) (ChatQuickReply, error) {
|
||||
// transaction 和 beginErr 保存本次账号级写入事务及启动错误。
|
||||
transaction, beginErr := s.DB.BeginTx(ctx, nil)
|
||||
if beginErr != nil {
|
||||
return ChatQuickReply{}, beginErr
|
||||
}
|
||||
defer transaction.Rollback()
|
||||
// lockQuery 保存方言适配的账号行锁 SQL;SQLite 事务的单写入者语义已经提供相同串行化保证。
|
||||
lockQuery := `SELECT id FROM cookies WHERE id=?`
|
||||
if s.Dialect != DialectSQLite {
|
||||
lockQuery += ` FOR UPDATE`
|
||||
}
|
||||
// lockedAccountID 保存锁定并确认存在的账号标识。
|
||||
var lockedAccountID string
|
||||
// lockErr 保存账号行锁定或账号不存在导致的查询失败。
|
||||
if lockErr := transaction.QueryRowContext(ctx, lockQuery, cookieID).Scan(&lockedAccountID); lockErr != nil {
|
||||
return ChatQuickReply{}, lockErr
|
||||
}
|
||||
// replyCount 保存当前账号已提交快捷回复数量。
|
||||
var replyCount int
|
||||
// countErr 保存读取账号快捷回复已用数量时的事务查询错误。
|
||||
if countErr := transaction.QueryRowContext(ctx, `SELECT COUNT(*) FROM chat_quick_replies WHERE cookie_id=?`, cookieID).Scan(&replyCount); countErr != nil {
|
||||
return ChatQuickReply{}, countErr
|
||||
}
|
||||
if replyCount >= chatQuickReplyLimit {
|
||||
return ChatQuickReply{}, ErrChatQuickReplyLimitReached
|
||||
}
|
||||
// createdAt 保存新记录的 UTC 创建时间,供列表排序和传输 DTO 展示。
|
||||
createdAt := time.Now().UTC().Unix()
|
||||
// replyID 和 insertErr 保存数据库生成的主键及写入错误。
|
||||
replyID, insertErr := insertReturningID(ctx, transaction, s.Dialect, `INSERT INTO chat_quick_replies(cookie_id,content,created_at) VALUES(?,?,?)`, cookieID, content, createdAt)
|
||||
if insertErr != nil {
|
||||
return ChatQuickReply{}, insertErr
|
||||
}
|
||||
// commitErr 保存提交本次受账号锁保护写入事务时的失败原因。
|
||||
if commitErr := transaction.Commit(); commitErr != nil {
|
||||
return ChatQuickReply{}, commitErr
|
||||
}
|
||||
return ChatQuickReply{ID: replyID, CookieID: cookieID, Content: content, CreatedAt: createdAt}, nil
|
||||
}
|
||||
|
||||
// DeleteQuickReply 删除账号下指定快捷回复,并报告是否实际删除记录。
|
||||
func (s *ChatStore) DeleteQuickReply(ctx context.Context, cookieID string, quickReplyID int64) (bool, error) {
|
||||
// result 和 deleteErr 保存删除执行结果及数据库错误。
|
||||
result, deleteErr := s.DB.ExecContext(ctx, `DELETE FROM chat_quick_replies WHERE id=? AND cookie_id=?`, quickReplyID, cookieID)
|
||||
if deleteErr != nil {
|
||||
return false, deleteErr
|
||||
}
|
||||
// affected 和 affectedErr 保存删除影响行数及驱动读取错误。
|
||||
affected, affectedErr := result.RowsAffected()
|
||||
if affectedErr != nil {
|
||||
return false, affectedErr
|
||||
}
|
||||
return affected > 0, nil
|
||||
}
|
||||
|
||||
// GetBuyerNote 查询账号下买家的备注;没有记录时返回 found=false。
|
||||
func (s *ChatStore) GetBuyerNote(ctx context.Context, cookieID, buyerID string) (ChatBuyerNote, bool, error) {
|
||||
// note 保存查询得到的买家备注持久化模型。
|
||||
var note ChatBuyerNote
|
||||
// readErr 保存按账号与买家标识读取备注时产生的数据库错误。
|
||||
readErr := s.DB.QueryRowContext(ctx, `SELECT cookie_id,buyer_id,content,updated_at
|
||||
FROM chat_buyer_notes WHERE cookie_id=? AND buyer_id=?`, cookieID, buyerID).Scan(¬e.CookieID, ¬e.BuyerID, ¬e.Content, ¬e.UpdatedAt)
|
||||
if errors.Is(readErr, sql.ErrNoRows) {
|
||||
return ChatBuyerNote{}, false, nil
|
||||
}
|
||||
if readErr != nil {
|
||||
return ChatBuyerNote{}, false, readErr
|
||||
}
|
||||
return note, true, nil
|
||||
}
|
||||
|
||||
// SaveBuyerNote 保存完整备注;空正文会删除旧记录并返回逻辑空备注。
|
||||
func (s *ChatStore) SaveBuyerNote(ctx context.Context, note ChatBuyerNote) (ChatBuyerNote, error) {
|
||||
if note.Content == "" {
|
||||
// deleteErr 保存清除买家备注时产生的数据库错误;没有旧记录也视为成功。
|
||||
_, deleteErr := s.DB.ExecContext(ctx, `DELETE FROM chat_buyer_notes WHERE cookie_id=? AND buyer_id=?`, note.CookieID, note.BuyerID)
|
||||
if deleteErr != nil {
|
||||
return ChatBuyerNote{}, deleteErr
|
||||
}
|
||||
return ChatBuyerNote{CookieID: note.CookieID, BuyerID: note.BuyerID}, nil
|
||||
}
|
||||
// updatedAt 保存本次覆盖写入的 UTC 时间,客户端用它显示最新保存状态。
|
||||
updatedAt := time.Now().UTC().Unix()
|
||||
// query 保存三方言共用的 upsert 语句;方言工具负责生成冲突更新差异。
|
||||
query := `INSERT INTO chat_buyer_notes(cookie_id,buyer_id,content,updated_at) VALUES(?,?,?,?)` + dialectUpsert(s.Dialect, []string{"cookie_id", "buyer_id"}, map[string]string{"content": "EXCLUDED.content", "updated_at": "EXCLUDED.updated_at"})
|
||||
// saveErr 保存备注 upsert 执行失败原因,失败时不得返回未持久化模型。
|
||||
if _, saveErr := s.DB.ExecContext(ctx, query, note.CookieID, note.BuyerID, note.Content, updatedAt); saveErr != nil {
|
||||
return ChatBuyerNote{}, saveErr
|
||||
}
|
||||
return ChatBuyerNote{CookieID: note.CookieID, BuyerID: note.BuyerID, Content: note.Content, UpdatedAt: updatedAt}, nil
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestChatMetadataStoresRepliesAndNotesByAccount 验证快捷回复上限及买家备注的账号隔离、清除语义。
|
||||
func TestChatMetadataStoresRepliesAndNotesByAccount(t *testing.T) {
|
||||
// store、cleanup 分别保存隔离 SQLite 存储和测试结束后的资源释放函数。
|
||||
store, cleanup := newTestDB(t)
|
||||
defer cleanup()
|
||||
// ctx 保存本测试数据库调用共用的上下文。
|
||||
ctx := context.Background()
|
||||
// userID 保存创建两个账号所需的本地用户主键。
|
||||
var userID int64
|
||||
// createUserErr 保存创建测试所有者并读取主键时的数据库错误。
|
||||
if createUserErr := store.DB.QueryRowContext(ctx, `INSERT INTO users (username,email,password_hash) VALUES (?,?,?) RETURNING id`, "chat-metadata-owner", "chat-metadata-owner@example.com", "test-hash").Scan(&userID); createUserErr != nil {
|
||||
t.Fatalf("创建测试用户失败: %v", createUserErr)
|
||||
}
|
||||
// accountIDs 保存同一用户下两个需要验证数据隔离的账号标识。
|
||||
accountIDs := []string{"chat-metadata-a", "chat-metadata-b"}
|
||||
// accountID 表示当前待创建的测试账号。
|
||||
for _, accountID := range accountIDs {
|
||||
// createAccountErr 保存创建当前测试账号时的数据库错误。
|
||||
if createAccountErr := store.Cookies.CreateOwned(ctx, accountID, "test-cookie", userID); createAccountErr != nil {
|
||||
t.Fatalf("创建测试账号 %s 失败: %v", accountID, createAccountErr)
|
||||
}
|
||||
}
|
||||
// reply 保存第一个账号创建成功的快捷回复。
|
||||
reply, createReplyErr := store.Chats.CreateQuickReply(ctx, accountIDs[0], "您好,现货可拍")
|
||||
if createReplyErr != nil || reply.Content != "您好,现货可拍" {
|
||||
t.Fatalf("创建快捷回复 reply=%+v err=%v", reply, createReplyErr)
|
||||
}
|
||||
// firstAccountReplies 和 firstListErr 保存第一个账号的快捷回复列表及读取错误。
|
||||
firstAccountReplies, firstListErr := store.Chats.ListQuickReplies(ctx, accountIDs[0])
|
||||
if firstListErr != nil || len(firstAccountReplies) != 1 || firstAccountReplies[0].ID != reply.ID {
|
||||
t.Fatalf("第一个账号快捷回复 rows=%+v err=%v", firstAccountReplies, firstListErr)
|
||||
}
|
||||
// secondAccountReplies 和 secondListErr 保存第二个账号的快捷回复列表及读取错误。
|
||||
secondAccountReplies, secondListErr := store.Chats.ListQuickReplies(ctx, accountIDs[1])
|
||||
if secondListErr != nil || len(secondAccountReplies) != 0 {
|
||||
t.Fatalf("第二个账号不应读取到快捷回复 rows=%+v err=%v", secondAccountReplies, secondListErr)
|
||||
}
|
||||
// deleted 和 deleteErr 保存跨账号删除尝试的实际命中状态及错误。
|
||||
deleted, deleteErr := store.Chats.DeleteQuickReply(ctx, accountIDs[1], reply.ID)
|
||||
if deleteErr != nil || deleted {
|
||||
t.Fatalf("跨账号不应删除快捷回复 deleted=%v err=%v", deleted, deleteErr)
|
||||
}
|
||||
// index 表示当前正在填充账号上限的额外快捷回复编号。
|
||||
for index := 1; index < chatQuickReplyLimit; index++ {
|
||||
// limitCreateErr 保存填充快捷回复上限时的单条写入错误。
|
||||
if _, limitCreateErr := store.Chats.CreateQuickReply(ctx, accountIDs[0], fmt.Sprintf("快捷回复 %d", index)); limitCreateErr != nil {
|
||||
t.Fatalf("创建上限内快捷回复 index=%d err=%v", index, limitCreateErr)
|
||||
}
|
||||
}
|
||||
// overflowErr 保存第 51 条快捷回复被数据库上限拒绝时的错误。
|
||||
if _, overflowErr := store.Chats.CreateQuickReply(ctx, accountIDs[0], "超过上限"); !errors.Is(overflowErr, ErrChatQuickReplyLimitReached) {
|
||||
t.Fatalf("超过快捷回复上限 error=%v", overflowErr)
|
||||
}
|
||||
// savedNote 和 saveErr 保存第一个账号写入的买家备注及错误。
|
||||
savedNote, saveErr := store.Chats.SaveBuyerNote(ctx, ChatBuyerNote{CookieID: accountIDs[0], BuyerID: "buyer-1", Content: "偏好顺丰"})
|
||||
if saveErr != nil || savedNote.Content != "偏好顺丰" || savedNote.UpdatedAt == 0 {
|
||||
t.Fatalf("保存买家备注 note=%+v err=%v", savedNote, saveErr)
|
||||
}
|
||||
// foundNote、found 和 readErr 保存同账号同买家备注的读取结果。
|
||||
foundNote, found, readErr := store.Chats.GetBuyerNote(ctx, accountIDs[0], "buyer-1")
|
||||
if readErr != nil || !found || foundNote.Content != "偏好顺丰" {
|
||||
t.Fatalf("读取买家备注 note=%+v found=%v err=%v", foundNote, found, readErr)
|
||||
}
|
||||
// isolatedNote、isolated 和 isolatedErr 保存另一账号读取同买家 ID 的隔离结果。
|
||||
isolatedNote, isolated, isolatedErr := store.Chats.GetBuyerNote(ctx, accountIDs[1], "buyer-1")
|
||||
if isolatedErr != nil || isolated || isolatedNote.Content != "" {
|
||||
t.Fatalf("买家备注应按账号隔离 note=%+v found=%v err=%v", isolatedNote, isolated, isolatedErr)
|
||||
}
|
||||
// clearErr 保存以空正文清除买家备注时的数据库错误。
|
||||
if _, clearErr := store.Chats.SaveBuyerNote(ctx, ChatBuyerNote{CookieID: accountIDs[0], BuyerID: "buyer-1"}); clearErr != nil {
|
||||
t.Fatalf("清除买家备注失败: %v", clearErr)
|
||||
}
|
||||
// clearedNote、cleared 和 clearedErr 保存清除备注后的逻辑空结果。
|
||||
clearedNote, cleared, clearedErr := store.Chats.GetBuyerNote(ctx, accountIDs[0], "buyer-1")
|
||||
if clearedErr != nil || cleared || clearedNote.Content != "" {
|
||||
t.Fatalf("清除后备注应不存在 note=%+v found=%v err=%v", clearedNote, cleared, clearedErr)
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ func TestMigrate_AppliesCleanSchema(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestMigrate_UpgradesDatabaseWithMainChatVersions 验证已发布 main 的 00029/00030
|
||||
// 聊天迁移可以原样升级到包含聊天媒体展示字段的 00035 最终版本。
|
||||
// 聊天迁移可以原样升级到包含快捷回复和买家备注的 00036 最终版本。
|
||||
func TestMigrate_UpgradesDatabaseWithMainChatVersions(t *testing.T) {
|
||||
// tmpDir 保存隔离的已发布 main 数据库目录,测试结束后由 testing 清理。
|
||||
tmpDir := t.TempDir()
|
||||
@@ -133,7 +133,7 @@ func TestMigrate_UpgradesDatabaseWithMainChatVersions(t *testing.T) {
|
||||
|
||||
// ctx 提供迁移 API 所需的调用上下文;升级本身不依赖请求生命周期。
|
||||
ctx := context.Background()
|
||||
// migrateErr 保存从 main 00030 接续 dev 00031 至 00035 时的迁移失败。
|
||||
// migrateErr 保存从 main 00030 接续 dev 00031 至 00036 时的迁移失败。
|
||||
if migrateErr := Migrate(ctx, rawDB, DialectSQLite); migrateErr != nil {
|
||||
t.Fatalf("upgrade from main 00030: %v", migrateErr)
|
||||
}
|
||||
@@ -143,13 +143,16 @@ func TestMigrate_UpgradesDatabaseWithMainChatVersions(t *testing.T) {
|
||||
if !columnExists(t, rawDB, "chat_messages", "read_status") || !columnExists(t, rawDB, "chat_messages", "read_at") || !columnExists(t, rawDB, "chat_messages", "media_duration") || !columnExists(t, rawDB, "chat_sessions", "item_image_url") {
|
||||
t.Fatal("chat read tracking and media presentation columns should remain after dev schema baseline upgrade")
|
||||
}
|
||||
// finalVersion 验证迁移账本已推进到包含批量发布间隔的最新 dev schema 版本。
|
||||
if !tableExists(t, rawDB, "chat_quick_replies") || !tableExists(t, rawDB, "chat_buyer_notes") {
|
||||
t.Fatal("chat quick reply and buyer note tables should be created by the latest migration")
|
||||
}
|
||||
// finalVersion 验证迁移账本已推进到包含聊天元数据的最新 dev schema 版本。
|
||||
finalVersion, versionErr := goose.GetDBVersion(rawDB)
|
||||
if versionErr != nil {
|
||||
t.Fatalf("read final migration version: %v", versionErr)
|
||||
}
|
||||
if finalVersion != 35 {
|
||||
t.Fatalf("final migration version=%d, want 35", finalVersion)
|
||||
if finalVersion != 36 {
|
||||
t.Fatalf("final migration version=%d, want 36", finalVersion)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE chat_quick_replies (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
cookie_id VARCHAR(191) NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
created_at BIGINT NOT NULL,
|
||||
CONSTRAINT fk_chat_quick_replies_cookie FOREIGN KEY (cookie_id) REFERENCES cookies(id) ON DELETE CASCADE,
|
||||
INDEX idx_chat_quick_replies_account_created (cookie_id, id DESC)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE chat_buyer_notes (
|
||||
cookie_id VARCHAR(191) NOT NULL,
|
||||
buyer_id VARCHAR(191) NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
updated_at BIGINT NOT NULL,
|
||||
PRIMARY KEY (cookie_id, buyer_id),
|
||||
CONSTRAINT fk_chat_buyer_notes_cookie FOREIGN KEY (cookie_id) REFERENCES cookies(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS chat_buyer_notes;
|
||||
DROP TABLE IF EXISTS chat_quick_replies;
|
||||
@@ -0,0 +1,20 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE chat_quick_replies (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
cookie_id TEXT NOT NULL REFERENCES cookies(id) ON DELETE CASCADE,
|
||||
content TEXT NOT NULL,
|
||||
created_at BIGINT NOT NULL
|
||||
);
|
||||
CREATE INDEX idx_chat_quick_replies_account_created ON chat_quick_replies(cookie_id, id DESC);
|
||||
|
||||
CREATE TABLE chat_buyer_notes (
|
||||
cookie_id TEXT NOT NULL REFERENCES cookies(id) ON DELETE CASCADE,
|
||||
buyer_id TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
updated_at BIGINT NOT NULL,
|
||||
PRIMARY KEY (cookie_id, buyer_id)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS chat_buyer_notes;
|
||||
DROP TABLE IF EXISTS chat_quick_replies;
|
||||
@@ -0,0 +1,20 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE chat_quick_replies (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
cookie_id TEXT NOT NULL REFERENCES cookies(id) ON DELETE CASCADE,
|
||||
content TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL
|
||||
);
|
||||
CREATE INDEX idx_chat_quick_replies_account_created ON chat_quick_replies(cookie_id, id DESC);
|
||||
|
||||
CREATE TABLE chat_buyer_notes (
|
||||
cookie_id TEXT NOT NULL REFERENCES cookies(id) ON DELETE CASCADE,
|
||||
buyer_id TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
updated_at INTEGER NOT NULL,
|
||||
PRIMARY KEY (cookie_id, buyer_id)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS chat_buyer_notes;
|
||||
DROP TABLE IF EXISTS chat_quick_replies;
|
||||
@@ -233,6 +233,11 @@ type ChatPort interface {
|
||||
ReportPlatformRead(context.Context, string, string, []map[string]any) error
|
||||
ResolveSessionIdentity(context.Context, chatapp.Session) (chatapp.Session, error)
|
||||
RefreshSessionIdentities(context.Context, string, []chatapp.Session) ([]chatapp.Session, error)
|
||||
ListQuickReplies(context.Context, int64, string) ([]chatapp.QuickReply, error)
|
||||
CreateQuickReply(context.Context, int64, string, string) (chatapp.QuickReply, error)
|
||||
DeleteQuickReply(context.Context, int64, string, int64) error
|
||||
GetBuyerNote(context.Context, int64, string, string) (chatapp.BuyerNote, error)
|
||||
SaveBuyerNote(context.Context, int64, string, string, string) (chatapp.BuyerNote, error)
|
||||
}
|
||||
|
||||
// UncertainNotificationsPort 定义通知不确定状态的查询能力。
|
||||
|
||||
@@ -67,6 +67,64 @@ func TestChatHistoryAndAccountTaskSettingsEndpoints(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// canceledReadReportPort 在本地已读保存后取消浏览器请求,用于验证平台上报使用独立的短时 Context。
|
||||
type canceledReadReportPort struct {
|
||||
// contractChatPort 提供无关聊天能力的稳定测试实现。
|
||||
contractChatPort
|
||||
// cancel 在本地已读状态写入完成后模拟浏览器中止当前 HTTP 请求。
|
||||
cancel context.CancelFunc
|
||||
// reportContextCanceled 记录平台上报调用当刻是否已被取消,不能继承浏览器请求的取消状态。
|
||||
reportContextCanceled bool
|
||||
// reportContextHasDeadline 记录平台上报是否具有有界远端等待截止时间。
|
||||
reportContextHasDeadline bool
|
||||
}
|
||||
|
||||
// MarkRead 模拟本地未读状态已成功落库后浏览器立即中断连接。
|
||||
func (port *canceledReadReportPort) MarkRead(context.Context, int64, string, string) error {
|
||||
port.cancel()
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReportPlatformRead 记录平台上报使用的 Context,不进行真实外部调用。
|
||||
func (port *canceledReadReportPort) ReportPlatformRead(ctx context.Context, _ string, _ string, _ []map[string]any) error {
|
||||
port.reportContextCanceled = ctx.Err() != nil
|
||||
_, port.reportContextHasDeadline = ctx.Deadline()
|
||||
return nil
|
||||
}
|
||||
|
||||
// TestMarkChatReadKeepsPlatformReportAliveAfterClientCancellation 验证本地已读成功后,浏览器取消不会中断有界的平台已读回执。
|
||||
func TestMarkChatReadKeepsPlatformReportAliveAfterClientCancellation(t *testing.T) {
|
||||
// srv、cleanup 分别是聊天路由测试服务器和测试资源释放函数。
|
||||
srv, _, cleanup := newTestServerWithChat(t)
|
||||
defer cleanup()
|
||||
// requestCtx 和 cancel 模拟浏览器请求生命周期;测试端口在本地已读完成后触发取消。
|
||||
requestCtx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
// port 保存会记录平台回执 Context 的聊天应用替身。
|
||||
port := &canceledReadReportPort{cancel: cancel}
|
||||
srv.applications.chat = port
|
||||
// handler 是替换聊天端口后的真实 HTTP Router。
|
||||
handler := srv.Router()
|
||||
// cookie 是通过真实认证流程取得的管理员会话。
|
||||
cookie := loginHelper(t, handler)
|
||||
// request 是带有一条有效平台消息标识的已读请求。
|
||||
request := httptest.NewRequest(http.MethodPost, "/api/v1/chat/read", strings.NewReader(`{"account_id":"acc1","chat_id":"chat-read","message_ids":[{"messageId":"message.PNM"}]}`)).WithContext(requestCtx)
|
||||
request.Header.Set("Content-Type", "application/json")
|
||||
request.AddCookie(cookie)
|
||||
// recorder 保存真实 handler 响应,已取消的浏览器请求不应使本地状态返回失败。
|
||||
recorder := httptest.NewRecorder()
|
||||
handler.ServeHTTP(recorder, request)
|
||||
if recorder.Code != http.StatusOK {
|
||||
t.Fatalf("已读请求状态=%d,响应=%s", recorder.Code, recorder.Body.String())
|
||||
}
|
||||
if port.reportContextCanceled {
|
||||
t.Fatal("平台已读上报错误继承了浏览器取消")
|
||||
}
|
||||
if !port.reportContextHasDeadline {
|
||||
t.Fatal("平台已读上报缺少独立超时限制")
|
||||
}
|
||||
}
|
||||
|
||||
// TestChatWebSocketStreamsOnlyAuthenticatedAccountEvents 封装Test聊天WebSocketStreamsOnlyAuthenticated账号Events业务协调。
|
||||
func TestChatWebSocketStreamsOnlyAuthenticatedAccountEvents(t *testing.T) {
|
||||
// srv、cleanup 用于本次流程后续判断的srv、cleanup
|
||||
|
||||
@@ -29,6 +29,9 @@ type markChatReadRequest struct {
|
||||
MessageIDs []map[string]any `json:"message_ids"`
|
||||
}
|
||||
|
||||
// platformReadReportTimeout 限制平台已读回执的独立远端等待时间,浏览器断开不应取消该尽力上报。
|
||||
const platformReadReportTimeout = 5 * time.Second
|
||||
|
||||
// mountChat 封装mount聊天业务协调。
|
||||
func (s *Server) mountChat(r chi.Router) {
|
||||
r.Get("/api/chat/sessions", s.listChatSessions)
|
||||
@@ -326,9 +329,16 @@ func (s *Server) markChatRead(w http.ResponseWriter, r *http.Request) {
|
||||
writeErr(w, http.StatusInternalServerError, "更新已读状态失败")
|
||||
return
|
||||
}
|
||||
// reportCtx 和 reportCancel 为尽力上报提供独立的有界生命周期:本地已读提交成功后,浏览器中止请求不应取消平台回执。
|
||||
reportCtx, reportCancel := context.WithTimeout(context.Background(), platformReadReportTimeout)
|
||||
defer reportCancel()
|
||||
// reportErr 表示平台已读上报失败;本地已读状态已成功保存,不能回滚。
|
||||
if reportErr := s.chatApplication().ReportPlatformRead(r.Context(), input.AccountID, input.ChatID, input.MessageIDs); reportErr != nil {
|
||||
slog.Warn("上报闲鱼已读状态失败", "account", input.AccountID, "chat_id", input.ChatID, "err", reportErr)
|
||||
if reportErr := s.chatApplication().ReportPlatformRead(reportCtx, input.AccountID, input.ChatID, input.MessageIDs); reportErr != nil {
|
||||
if errors.Is(reportErr, context.Canceled) {
|
||||
slog.Debug("上报闲鱼已读状态已取消", "account", input.AccountID, "chat_id", input.ChatID)
|
||||
} else {
|
||||
slog.Warn("上报闲鱼已读状态失败", "account", input.AccountID, "chat_id", input.ChatID, "err", reportErr)
|
||||
}
|
||||
}
|
||||
writeJSON(w, http.StatusOK, operationResponse{Success: true})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
chatapp "xianyu-go/internal/application/chat"
|
||||
"xianyu-go/internal/auth"
|
||||
)
|
||||
|
||||
// chatQuickReplyResponse 是账号级人工快捷回复的具名 HTTP 响应 DTO。
|
||||
type chatQuickReplyResponse struct {
|
||||
// ID 是快捷回复稳定标识,用于删除操作。
|
||||
ID int64 `json:"id"`
|
||||
// AccountID 是快捷回复所属账号标识。
|
||||
AccountID string `json:"account_id"`
|
||||
// Content 是发送到聊天会话的文本模板。
|
||||
Content string `json:"content"`
|
||||
// CreatedAt 是快捷回复创建的 Unix 秒时间戳。
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
// chatQuickReplyListResponse 是快捷回复列表接口的具名响应 DTO。
|
||||
type chatQuickReplyListResponse struct {
|
||||
// QuickReplies 保存当前账号可用的人工快捷回复。
|
||||
QuickReplies []chatQuickReplyResponse `json:"quick_replies"`
|
||||
}
|
||||
|
||||
// chatQuickReplyCreateRequest 是创建账号级快捷回复的具名请求 DTO。
|
||||
type chatQuickReplyCreateRequest struct {
|
||||
// AccountID 是当前用户拥有的目标账号标识。
|
||||
AccountID string `json:"account_id"`
|
||||
// Content 是待保存的人工快捷回复正文。
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// chatBuyerNoteResponse 是按账号和买家 ID 隔离的完整备注响应 DTO。
|
||||
type chatBuyerNoteResponse struct {
|
||||
// AccountID 是备注所属账号标识。
|
||||
AccountID string `json:"account_id"`
|
||||
// BuyerID 是备注所属的平台买家标识。
|
||||
BuyerID string `json:"buyer_id"`
|
||||
// Content 是完整备注正文;空字符串代表未保存备注。
|
||||
Content string `json:"content"`
|
||||
// UpdatedAt 是最近保存时间;空备注保持零值。
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
// chatBuyerNoteSaveRequest 是保存买家备注的具名请求 DTO。
|
||||
type chatBuyerNoteSaveRequest struct {
|
||||
// AccountID 是当前用户拥有的目标账号标识。
|
||||
AccountID string `json:"account_id"`
|
||||
// Content 是完整备注正文,空字符串表示清除备注。
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// listChatQuickReplies 查询当前账号可复用的人工快捷回复。
|
||||
func (s *Server) listChatQuickReplies(w http.ResponseWriter, r *http.Request) {
|
||||
// session 保存认证中间件写入的当前用户身份。
|
||||
session := auth.SessionFromContext(r.Context())
|
||||
// accountID 保存去除空白后的目标账号标识。
|
||||
accountID := strings.TrimSpace(r.URL.Query().Get("account_id"))
|
||||
// replies 和 listErr 保存应用服务返回的快捷回复及查询错误。
|
||||
replies, listErr := s.chatApplication().ListQuickReplies(r.Context(), session.UserID, accountID)
|
||||
if listErr != nil {
|
||||
writeChatMetadataError(w, listErr)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, newChatQuickReplyListResponse(replies))
|
||||
}
|
||||
|
||||
// createChatQuickReply 校验请求后为账号保存一条人工快捷回复。
|
||||
func (s *Server) createChatQuickReply(w http.ResponseWriter, r *http.Request) {
|
||||
// session 保存认证中间件写入的当前用户身份。
|
||||
session := auth.SessionFromContext(r.Context())
|
||||
// request 保存反序列化后的快捷回复创建参数。
|
||||
var request chatQuickReplyCreateRequest
|
||||
// decodeErr 保存快捷回复创建请求体反序列化失败原因。
|
||||
if decodeErr := decodeJSON(r, &request); decodeErr != nil {
|
||||
writeErr(w, http.StatusBadRequest, "请求格式错误")
|
||||
return
|
||||
}
|
||||
// reply 和 createErr 保存创建后的快捷回复及应用层校验错误。
|
||||
reply, createErr := s.chatApplication().CreateQuickReply(r.Context(), session.UserID, request.AccountID, request.Content)
|
||||
if createErr != nil {
|
||||
writeChatMetadataError(w, createErr)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusCreated, newChatQuickReplyResponse(reply))
|
||||
}
|
||||
|
||||
// deleteChatQuickReply 删除当前账号下由路径标识的快捷回复。
|
||||
func (s *Server) deleteChatQuickReply(w http.ResponseWriter, r *http.Request) {
|
||||
// session 保存认证中间件写入的当前用户身份。
|
||||
session := auth.SessionFromContext(r.Context())
|
||||
// accountID 保存查询参数提供的快捷回复所属账号标识。
|
||||
accountID := strings.TrimSpace(r.URL.Query().Get("account_id"))
|
||||
// quickReplyID 和 parseErr 保存路径快捷回复 ID 及解析错误。
|
||||
quickReplyID, parseErr := strconv.ParseInt(chi.URLParam(r, "quick_reply_id"), 10, 64)
|
||||
if parseErr != nil {
|
||||
writeErr(w, http.StatusBadRequest, "快捷回复标识无效")
|
||||
return
|
||||
}
|
||||
// deleteErr 保存删除快捷回复时应用服务返回的业务或持久化错误。
|
||||
if deleteErr := s.chatApplication().DeleteQuickReply(r.Context(), session.UserID, accountID, quickReplyID); deleteErr != nil {
|
||||
writeChatMetadataError(w, deleteErr)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, operationResponse{Success: true})
|
||||
}
|
||||
|
||||
// getChatBuyerNote 返回当前账号下指定买家的完整备注;未保存时仍返回空备注。
|
||||
func (s *Server) getChatBuyerNote(w http.ResponseWriter, r *http.Request) {
|
||||
// session 保存认证中间件写入的当前用户身份。
|
||||
session := auth.SessionFromContext(r.Context())
|
||||
// accountID 和 buyerID 保存备注的账号与买家复合隔离键。
|
||||
accountID, buyerID := strings.TrimSpace(r.URL.Query().Get("account_id")), strings.TrimSpace(chi.URLParam(r, "buyer_id"))
|
||||
// note 和 readErr 保存应用层读取的备注及错误。
|
||||
note, readErr := s.chatApplication().GetBuyerNote(r.Context(), session.UserID, accountID, buyerID)
|
||||
if readErr != nil {
|
||||
writeChatMetadataError(w, readErr)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, newChatBuyerNoteResponse(note))
|
||||
}
|
||||
|
||||
// saveChatBuyerNote 保存或清除当前账号下指定买家的备注。
|
||||
func (s *Server) saveChatBuyerNote(w http.ResponseWriter, r *http.Request) {
|
||||
// session 保存认证中间件写入的当前用户身份。
|
||||
session := auth.SessionFromContext(r.Context())
|
||||
// buyerID 保存路径提供的稳定平台买家标识。
|
||||
buyerID := strings.TrimSpace(chi.URLParam(r, "buyer_id"))
|
||||
// request 保存反序列化后的备注保存参数。
|
||||
var request chatBuyerNoteSaveRequest
|
||||
// decodeErr 保存买家备注保存请求体反序列化失败原因。
|
||||
if decodeErr := decodeJSON(r, &request); decodeErr != nil {
|
||||
writeErr(w, http.StatusBadRequest, "请求格式错误")
|
||||
return
|
||||
}
|
||||
// note 和 saveErr 保存更新后的备注及应用层校验错误。
|
||||
note, saveErr := s.chatApplication().SaveBuyerNote(r.Context(), session.UserID, request.AccountID, buyerID, request.Content)
|
||||
if saveErr != nil {
|
||||
writeChatMetadataError(w, saveErr)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, newChatBuyerNoteResponse(note))
|
||||
}
|
||||
|
||||
// newChatQuickReplyResponse 将应用层快捷回复转换为稳定 HTTP DTO。
|
||||
func newChatQuickReplyResponse(reply chatapp.QuickReply) chatQuickReplyResponse {
|
||||
return chatQuickReplyResponse{ID: reply.ID, AccountID: reply.AccountID, Content: reply.Content, CreatedAt: reply.CreatedAt}
|
||||
}
|
||||
|
||||
// newChatQuickReplyListResponse 批量转换快捷回复,避免传输层序列化应用层模型。
|
||||
func newChatQuickReplyListResponse(replies []chatapp.QuickReply) chatQuickReplyListResponse {
|
||||
// response 保存将要返回给前端的具名列表 DTO。
|
||||
response := chatQuickReplyListResponse{QuickReplies: make([]chatQuickReplyResponse, 0, len(replies))}
|
||||
// reply 表示当前待转换的应用层快捷回复。
|
||||
for _, reply := range replies {
|
||||
response.QuickReplies = append(response.QuickReplies, newChatQuickReplyResponse(reply))
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
// newChatBuyerNoteResponse 将应用层买家备注转换为稳定 HTTP DTO。
|
||||
func newChatBuyerNoteResponse(note chatapp.BuyerNote) chatBuyerNoteResponse {
|
||||
return chatBuyerNoteResponse{AccountID: note.AccountID, BuyerID: note.BuyerID, Content: note.Content, UpdatedAt: note.UpdatedAt}
|
||||
}
|
||||
|
||||
// writeChatMetadataError 将聊天元数据用例错误映射到统一 HTTP 状态和错误 envelope。
|
||||
func writeChatMetadataError(w http.ResponseWriter, operationErr error) {
|
||||
switch {
|
||||
case errors.Is(operationErr, chatapp.ErrInvalidInput):
|
||||
writeErr(w, http.StatusBadRequest, "账号、买家或内容无效")
|
||||
case errors.Is(operationErr, chatapp.ErrMetadataForbidden):
|
||||
writeErr(w, http.StatusForbidden, "无权访问该账号")
|
||||
case errors.Is(operationErr, chatapp.ErrQuickReplyLimitReached):
|
||||
writeErrCode(w, http.StatusConflict, "chat_quick_reply_limit_reached", "快捷回复最多保存 50 条", "")
|
||||
case errors.Is(operationErr, chatapp.ErrQuickReplyNotFound):
|
||||
writeErr(w, http.StatusNotFound, "快捷回复不存在")
|
||||
default:
|
||||
writeErr(w, http.StatusInternalServerError, "聊天数据操作失败")
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ func TestOpenAPIRemainingVersionedSuccessResponses(t *testing.T) {
|
||||
t.Run("ai-models", testOpenAPIAIModelsSuccess)
|
||||
t.Run("cards-batch", testOpenAPICardsBatchSuccess)
|
||||
t.Run("chat-history-and-read", testOpenAPIChatHistoryAndReadSuccess)
|
||||
t.Run("chat-metadata", testOpenAPIChatMetadataSuccess)
|
||||
t.Run("local-item-and-manual-ship", testOpenAPILocalItemAndManualShipSuccess)
|
||||
t.Run("category-recommendation", testOpenAPIItemCategoryRecommendationSuccess)
|
||||
t.Run("publish-batch-preview", testOpenAPIPublishBatchPreviewSuccess)
|
||||
@@ -228,6 +229,59 @@ func testOpenAPIChatHistoryAndReadSuccess(t *testing.T) {
|
||||
assertOpenAPIRecordedSuccessResponse(t, deleteRequest, deleteRecorder)
|
||||
}
|
||||
|
||||
// testOpenAPIChatMetadataSuccess 覆盖快捷回复和按买家 ID 隔离备注的所有版本化成功响应。
|
||||
func testOpenAPIChatMetadataSuccess(t *testing.T) {
|
||||
// srv、_、cleanup 分别是装配真实聊天元数据用例的服务、无需直接读取的存储和资源释放函数。
|
||||
srv, _, cleanup := newTestServerWithChat(t)
|
||||
defer cleanup()
|
||||
// handler 是当前场景使用的真实版本化 Router。
|
||||
handler := srv.Router()
|
||||
// sessionCookie 是当前管理员认证会话。
|
||||
sessionCookie := loginHelper(t, handler)
|
||||
// createRequest 是创建账号快捷回复的版本化请求。
|
||||
createRequest := httptest.NewRequest(http.MethodPost, "/api/v1/chat/quick-replies", strings.NewReader(`{"account_id":"acc1","content":"契约快捷回复"}`))
|
||||
createRequest.Header.Set("Content-Type", "application/json")
|
||||
createRequest.AddCookie(sessionCookie)
|
||||
// createRecorder 保存快捷回复创建响应。
|
||||
createRecorder := httptest.NewRecorder()
|
||||
handler.ServeHTTP(createRecorder, createRequest)
|
||||
assertOpenAPIRecordedSuccessResponse(t, createRequest, createRecorder)
|
||||
// created 保存创建成功响应中的快捷回复标识,供删除操作精确定位。
|
||||
var created chatQuickReplyResponse
|
||||
// decodeErr 保存解析快捷回复创建响应以取得删除标识时的失败原因。
|
||||
if decodeErr := json.Unmarshal(createRecorder.Body.Bytes(), &created); decodeErr != nil {
|
||||
t.Fatalf("解析快捷回复创建响应失败: %v", decodeErr)
|
||||
}
|
||||
// listRequest 是读取账号快捷回复列表的版本化请求。
|
||||
listRequest := httptest.NewRequest(http.MethodGet, "/api/v1/chat/quick-replies?account_id=acc1", nil)
|
||||
listRequest.AddCookie(sessionCookie)
|
||||
// listRecorder 保存快捷回复列表响应。
|
||||
listRecorder := httptest.NewRecorder()
|
||||
handler.ServeHTTP(listRecorder, listRequest)
|
||||
assertOpenAPIRecordedSuccessResponse(t, listRequest, listRecorder)
|
||||
// noteRequests 保存买家备注读取和保存的版本化请求。
|
||||
noteRequests := []*http.Request{
|
||||
httptest.NewRequest(http.MethodGet, "/api/v1/chat/buyer-notes/buyer-contract?account_id=acc1", nil),
|
||||
httptest.NewRequest(http.MethodPut, "/api/v1/chat/buyer-notes/buyer-contract", strings.NewReader(`{"account_id":"acc1","content":"契约买家备注"}`)),
|
||||
}
|
||||
// noteRequest 表示当前待验证的买家备注 HTTP 请求。
|
||||
for _, noteRequest := range noteRequests {
|
||||
noteRequest.Header.Set("Content-Type", "application/json")
|
||||
noteRequest.AddCookie(sessionCookie)
|
||||
// noteRecorder 保存当前买家备注成功响应。
|
||||
noteRecorder := httptest.NewRecorder()
|
||||
handler.ServeHTTP(noteRecorder, noteRequest)
|
||||
assertOpenAPIRecordedSuccessResponse(t, noteRequest, noteRecorder)
|
||||
}
|
||||
// deleteRequest 是删除刚创建快捷回复的版本化请求。
|
||||
deleteRequest := httptest.NewRequest(http.MethodDelete, "/api/v1/chat/quick-replies/"+strconv.FormatInt(created.ID, 10)+"?account_id=acc1", nil)
|
||||
deleteRequest.AddCookie(sessionCookie)
|
||||
// deleteRecorder 保存快捷回复删除响应。
|
||||
deleteRecorder := httptest.NewRecorder()
|
||||
handler.ServeHTTP(deleteRecorder, deleteRequest)
|
||||
assertOpenAPIRecordedSuccessResponse(t, deleteRequest, deleteRecorder)
|
||||
}
|
||||
|
||||
// testOpenAPILocalItemAndManualShipSuccess 覆盖无需平台请求的商品创建和状态型手动发货成功响应。
|
||||
func testOpenAPILocalItemAndManualShipSuccess(t *testing.T) {
|
||||
// srv、store、cleanup 分别是服务、订单夹具存储和资源释放函数。
|
||||
@@ -737,6 +791,29 @@ func (contractChatPort) RefreshSessionIdentities(context.Context, string, []chat
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ListQuickReplies 返回确定性的空快捷回复集合,供只验证消息发送契约的测试端口满足完整接口。
|
||||
func (contractChatPort) ListQuickReplies(context.Context, int64, string) ([]chatapp.QuickReply, error) {
|
||||
return []chatapp.QuickReply{}, nil
|
||||
}
|
||||
|
||||
// CreateQuickReply 返回确定性的测试快捷回复,避免该端口在未来契约场景中依赖数据库。
|
||||
func (contractChatPort) CreateQuickReply(context.Context, int64, string, string) (chatapp.QuickReply, error) {
|
||||
return chatapp.QuickReply{ID: 1, AccountID: "acc1", Content: "测试快捷回复", CreatedAt: 1}, nil
|
||||
}
|
||||
|
||||
// DeleteQuickReply 保持确定性成功,用于满足聊天 HTTP 应用端口。
|
||||
func (contractChatPort) DeleteQuickReply(context.Context, int64, string, int64) error { return nil }
|
||||
|
||||
// GetBuyerNote 返回逻辑空备注,避免发送契约测试依赖真实备注持久化。
|
||||
func (contractChatPort) GetBuyerNote(context.Context, int64, string, string) (chatapp.BuyerNote, error) {
|
||||
return chatapp.BuyerNote{}, nil
|
||||
}
|
||||
|
||||
// SaveBuyerNote 返回逻辑空备注,避免发送契约测试依赖真实备注持久化。
|
||||
func (contractChatPort) SaveBuyerNote(context.Context, int64, string, string, string) (chatapp.BuyerNote, error) {
|
||||
return chatapp.BuyerNote{}, nil
|
||||
}
|
||||
|
||||
// contractItemPublishPort 是只返回确定性商品结果的单商品发布端口。
|
||||
type contractItemPublishPort struct{}
|
||||
|
||||
|
||||
@@ -18,6 +18,11 @@ func (s *Server) mountVersionedChatTaskRoutes(r chi.Router) {
|
||||
r.Post("/api/v1/chat/images", s.sendChatImage)
|
||||
r.Post("/api/v1/chat/read", s.markChatRead)
|
||||
r.Get("/api/v1/chat/ws", s.chatWebSocket)
|
||||
r.Get("/api/v1/chat/quick-replies", s.listChatQuickReplies)
|
||||
r.Post("/api/v1/chat/quick-replies", s.createChatQuickReply)
|
||||
r.Delete("/api/v1/chat/quick-replies/{quick_reply_id}", s.deleteChatQuickReply)
|
||||
r.Get("/api/v1/chat/buyer-notes/{buyer_id}", s.getChatBuyerNote)
|
||||
r.Put("/api/v1/chat/buyer-notes/{buyer_id}", s.saveChatBuyerNote)
|
||||
|
||||
r.Get("/api/v1/account-tasks/{cid}", s.getAccountTaskSettings)
|
||||
r.Put("/api/v1/account-tasks/{cid}", s.updateAccountTaskSettings)
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
import{b as ie,j as e,a as l,d as Me}from"./react-vendor-Bf9ELcll.js";import{r as T,c as L}from"./index-C6RECy_0.js";import{c as Ae,o as Pe}from"./contract-COFcZjyb.js";import{n as de,X as ce,f as Be,L as J,o as qe,p as Ge,q as Oe,r as Te,s as Le,U as Ie,t as te,u as ze,k as _e,Q as we,v as Ee,R as We,w as Ve,x as Ke,y as Ne,K as He,z as Je,F as Xe,e as Ye,H as Ze}from"./icons-vendor-B5fJPoU1.js";import"./vendor-BE-_xUHH.js";const Fe=(a,s)=>{const t=a.avatar_url||"";if(!t)return"";try{const r=new URL(t,window.location.origin);return r.hostname.endsWith("alicdn.com")&&r.searchParams.set("_v",s),r.toString()}catch{return t}},es=async a=>{const s=await T(n=>L.GET("/api/v1/accounts/details",{signal:n}),a),t=Ae(s,["data","accounts","details"]),r=Date.now().toString();return t.map(n=>({id:n.id,cookie_configured:n.has_cookie===!0,enabled:n.enabled,auto_confirm:n.auto_confirm,remark:n.remark,pause_duration:n.pause_duration,paused_until:Number(n.paused_until||0),paused:n.paused===!0,username:n.username||"",login_password_configured:void 0,show_browser:n.show_browser===!0||n.show_browser===1||n.show_browser==="1"||n.show_browser==="true",nickname:n.nickname||n.remark||`账号 ${n.id.substring(0,6)}`,avatar_url:Fe(n,r),profile_error:n.profile_error||"",ai_enabled:!1,auto_rate_enabled:n.auto_rate_enabled,rate_content:n.rate_content||"不错的买家,交易愉快",auto_polish_enabled:n.auto_polish_enabled,polish_time:n.polish_time||"03:00",last_rate_scan_at:Number(n.last_rate_scan_at||0),last_polish_date:n.last_polish_date||"",last_polish_at:Number(n.last_polish_at||0)}))},ve=async(a,s)=>T(t=>L.GET("/api/v1/account-tasks/{cid}",{params:{path:{cid:a}},signal:t}),s),ke=async(a,s,t)=>T(r=>L.PUT("/api/v1/account-tasks/{cid}",{params:{path:{cid:a}},body:s,signal:r}),t),ss=async(a,s,t)=>T(r=>L.POST("/api/v1/account-tasks/{cid}/run",{params:{path:{cid:a}},body:{task_type:s},signal:r}),{timeoutMs:12e4,...t}),as=async a=>await T(t=>L.GET("/api/v1/accounts/runtime-status",{signal:t}),a),ts=async a=>T(s=>L.POST("/api/v1/qr-login/generate",{signal:s}),{...a,timeoutMs:(a==null?void 0:a.timeoutMs)??13e4}),rs=async(a,s)=>T(t=>L.GET("/api/v1/qr-login/check/{session_id}",{params:{path:{session_id:a}},signal:t}),{signal:s,timeoutMs:1e4}),ns=async(a,s)=>T(t=>L.POST("/api/v1/qr-login/complete-verification/{session_id}",{params:{path:{session_id:a}},body:{target_account_id:s||""},signal:t})),ls=async(a,s)=>T(t=>L.PUT("/api/v1/accounts/{cid}/status",{params:{path:{cid:a}},body:{enabled:s},signal:t})),os=async a=>T(s=>L.DELETE("/api/v1/accounts/{cid}",{params:{path:{cid:a}},signal:s})),is=async(a,s,t)=>T(r=>L.PUT("/api/v1/accounts/{cid}/pause-duration",{params:{path:{cid:a}},body:{pause_duration:s},signal:r}),t),cs=async(a,s,t)=>T(r=>L.PUT("/api/v1/accounts/{cid}/settings",{params:{path:{cid:a}},body:s,signal:r}),t),ds=async(a,s)=>T(t=>L.GET("/api/v1/accounts/{cid}/long-login",{params:{path:{cid:a}},signal:t}),s),us=async(a,s,t)=>T(r=>L.PUT("/api/v1/accounts/{cid}/long-login",{params:{path:{cid:a}},body:{enabled:s},signal:r}),t),xs=async(a,s)=>T(t=>L.POST("/api/v1/password-login",{body:a,signal:t}),s),ms=async(a,s)=>T(r=>L.GET("/api/v1/password-login/check/{session_id}",{params:{path:{session_id:a}},signal:r}),{signal:s,timeoutMs:1e4}),bs=async(a,s)=>T(t=>L.DELETE("/api/v1/password-login/cancel/{session_id}",{params:{path:{session_id:a}},signal:t}),s),hs=async a=>T(s=>L.POST("/api/v1/accounts/{cid}/refresh-profile",{params:{path:{cid:a}},signal:s})),gs=async a=>{const s=await T(t=>L.GET("/api/v1/settings/ai-reply",{signal:t}),a);return Pe(s,["settings","data","result"])||{}},ps=async(a,s)=>T(t=>L.GET("/api/v1/settings/ai-reply/{cookie_id}",{params:{path:{cookie_id:a}},signal:t}),s),fs=async(a,s,t)=>{const r={ai_enabled:s.ai_enabled??!1,auto_adjust_price_enabled:s.auto_adjust_price_enabled??!1,max_discount_percent:s.max_discount_percent??10,max_discount_amount:s.max_discount_amount??100,max_bargain_rounds:s.max_bargain_rounds??3,custom_prompts:s.custom_prompts??""};return T(n=>L.PUT("/api/v1/settings/ai-reply/{cookie_id}",{params:{path:{cookie_id:a}},body:r,signal:n}),t)},ys=a=>{if(Array.isArray(a))return a.filter(Boolean);if(typeof a!="string"||!a.trim())return[];try{const s=JSON.parse(a);if(Array.isArray(s))return s.filter(Boolean)}catch{}return a.split(/[,\s;]+/).map(s=>s.trim()).filter(Boolean)},js=async a=>{const s=await T(r=>L.GET("/api/v1/notifications/channels",{signal:r}),a);return{success:!0,data:Ae(s,["data","channels","items"]).map(r=>{const n={},c=r.type==="ding_talk"?"dingtalk":r.type==="lark"?"feishu":r.type;return{id:String(r.id),name:r.name,type:c,config:n,event_types:ys(r.event_types),enabled:r.enabled}})}},_s=async(a,s)=>{const t=await T(n=>L.GET("/api/v1/notifications/accounts/{cid}/bindings",{params:{path:{cid:a}},signal:n}),s),r=Pe(t,["data","result"])||{};return Array.isArray(r.channel_ids)?r.channel_ids:[]},ws=({account:a,settings:s,saving:t,onChange:r,onClose:n,onSave:c})=>{const i=y=>r({...s,...y}),d=()=>i(s.ai_enaLine truncated
|
||||
import{b as ie,j as e,a as l,d as Me}from"./react-vendor-Bf9ELcll.js";import{r as q,c as L}from"./chat-metadata-74T0w35U.js";import{c as Ae,o as Pe}from"./contract-COFcZjyb.js";import{r as de,X as ce,h as Be,L as H,s as Te,t as Ge,u as Oe,v as qe,w as Le,U as Ie,x as te,y as ze,m as _e,Q as we,z as Ee,R as We,H as Ve,I as Je,T as Ne,K as Ke,J as He,N as Xe,g as Ye,O as Ze}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";const Fe=(a,s)=>{const t=a.avatar_url||"";if(!t)return"";try{const r=new URL(t,window.location.origin);return r.hostname.endsWith("alicdn.com")&&r.searchParams.set("_v",s),r.toString()}catch{return t}},es=async a=>{const s=await q(n=>L.GET("/api/v1/accounts/details",{signal:n}),a),t=Ae(s,["data","accounts","details"]),r=Date.now().toString();return t.map(n=>({id:n.id,cookie_configured:n.has_cookie===!0,enabled:n.enabled,auto_confirm:n.auto_confirm,remark:n.remark,pause_duration:n.pause_duration,paused_until:Number(n.paused_until||0),paused:n.paused===!0,username:n.username||"",login_password_configured:void 0,show_browser:n.show_browser===!0||n.show_browser===1||n.show_browser==="1"||n.show_browser==="true",nickname:n.nickname||n.remark||`账号 ${n.id.substring(0,6)}`,avatar_url:Fe(n,r),profile_error:n.profile_error||"",ai_enabled:!1,auto_rate_enabled:n.auto_rate_enabled,rate_content:n.rate_content||"不错的买家,交易愉快",auto_polish_enabled:n.auto_polish_enabled,polish_time:n.polish_time||"03:00",last_rate_scan_at:Number(n.last_rate_scan_at||0),last_polish_date:n.last_polish_date||"",last_polish_at:Number(n.last_polish_at||0)}))},ve=async(a,s)=>q(t=>L.GET("/api/v1/account-tasks/{cid}",{params:{path:{cid:a}},signal:t}),s),ke=async(a,s,t)=>q(r=>L.PUT("/api/v1/account-tasks/{cid}",{params:{path:{cid:a}},body:s,signal:r}),t),ss=async(a,s,t)=>q(r=>L.POST("/api/v1/account-tasks/{cid}/run",{params:{path:{cid:a}},body:{task_type:s},signal:r}),{timeoutMs:12e4,...t}),as=async a=>await q(t=>L.GET("/api/v1/accounts/runtime-status",{signal:t}),a),ts=async a=>q(s=>L.POST("/api/v1/qr-login/generate",{signal:s}),{...a,timeoutMs:(a==null?void 0:a.timeoutMs)??13e4}),rs=async(a,s)=>q(t=>L.GET("/api/v1/qr-login/check/{session_id}",{params:{path:{session_id:a}},signal:t}),{signal:s,timeoutMs:1e4}),ns=async(a,s)=>q(t=>L.POST("/api/v1/qr-login/complete-verification/{session_id}",{params:{path:{session_id:a}},body:{target_account_id:s||""},signal:t})),ls=async(a,s)=>q(t=>L.PUT("/api/v1/accounts/{cid}/status",{params:{path:{cid:a}},body:{enabled:s},signal:t})),os=async a=>q(s=>L.DELETE("/api/v1/accounts/{cid}",{params:{path:{cid:a}},signal:s})),is=async(a,s,t)=>q(r=>L.PUT("/api/v1/accounts/{cid}/pause-duration",{params:{path:{cid:a}},body:{pause_duration:s},signal:r}),t),cs=async(a,s,t)=>q(r=>L.PUT("/api/v1/accounts/{cid}/settings",{params:{path:{cid:a}},body:s,signal:r}),t),ds=async(a,s)=>q(t=>L.GET("/api/v1/accounts/{cid}/long-login",{params:{path:{cid:a}},signal:t}),s),us=async(a,s,t)=>q(r=>L.PUT("/api/v1/accounts/{cid}/long-login",{params:{path:{cid:a}},body:{enabled:s},signal:r}),t),xs=async(a,s)=>q(t=>L.POST("/api/v1/password-login",{body:a,signal:t}),s),ms=async(a,s)=>q(r=>L.GET("/api/v1/password-login/check/{session_id}",{params:{path:{session_id:a}},signal:r}),{signal:s,timeoutMs:1e4}),bs=async(a,s)=>q(t=>L.DELETE("/api/v1/password-login/cancel/{session_id}",{params:{path:{session_id:a}},signal:t}),s),hs=async a=>q(s=>L.POST("/api/v1/accounts/{cid}/refresh-profile",{params:{path:{cid:a}},signal:s})),gs=async a=>{const s=await q(t=>L.GET("/api/v1/settings/ai-reply",{signal:t}),a);return Pe(s,["settings","data","result"])||{}},ps=async(a,s)=>q(t=>L.GET("/api/v1/settings/ai-reply/{cookie_id}",{params:{path:{cookie_id:a}},signal:t}),s),fs=async(a,s,t)=>{const r={ai_enabled:s.ai_enabled??!1,auto_adjust_price_enabled:s.auto_adjust_price_enabled??!1,max_discount_percent:s.max_discount_percent??10,max_discount_amount:s.max_discount_amount??100,max_bargain_rounds:s.max_bargain_rounds??3,custom_prompts:s.custom_prompts??""};return q(n=>L.PUT("/api/v1/settings/ai-reply/{cookie_id}",{params:{path:{cookie_id:a}},body:r,signal:n}),t)},ys=a=>{if(Array.isArray(a))return a.filter(Boolean);if(typeof a!="string"||!a.trim())return[];try{const s=JSON.parse(a);if(Array.isArray(s))return s.filter(Boolean)}catch{}return a.split(/[,\s;]+/).map(s=>s.trim()).filter(Boolean)},js=async a=>{const s=await q(r=>L.GET("/api/v1/notifications/channels",{signal:r}),a);return{success:!0,data:Ae(s,["data","channels","items"]).map(r=>{const n={},c=r.type==="ding_talk"?"dingtalk":r.type==="lark"?"feishu":r.type;return{id:String(r.id),name:r.name,type:c,config:n,event_types:ys(r.event_types),enabled:r.enabled}})}},_s=async(a,s)=>{const t=await q(n=>L.GET("/api/v1/notifications/accounts/{cid}/bindings",{params:{path:{cid:a}},signal:n}),s),r=Pe(t,["data","result"])||{};return Array.isArray(r.channel_ids)?r.channel_ids:[]},ws=({account:a,settings:s,saving:t,onChange:r,onClose:n,onSave:c})=>{const i=y=>r({...s,...y}),d=()=>i(Line truncated
|
||||
|
||||
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(Be,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 只有开启自动改价后,已发送给买家的有效报价才会用于真实订单改价"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:n,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:t,children:"取消"}),e.jsxs("button",{onClick:(()=>void c()),className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:t,children:[t?e.jsx(J,{className:"w-4 h-4 animate-spin"}):e.jsx(qe,{className:"w-4 h-4"}),t?"保存中...":"保存"]})]})})]})}),document.body)},Ce=a=>({account_id:a.id,auto_rate_enabled:a.auto_rate_enabled===!0,rate_content:a.rate_content||"不错的买家,交易愉快",auto_polish_enabled:a.auto_polish_enabled===!0,polish_time:a.polish_time||"03:00",last_rate_scan_at:a.last_rate_scan_at,last_polish_date:a.last_polish_date,last_polish_at:a.last_polish_at}),Z=(a,s,t)=>a===s&&!t.aborted,ye=(a,s)=>a instanceof Error?a.message:s,je=a=>a instanceof Error&&a.message==="请求已取消",Se=(a,s)=>!a&&s==="",Ns=({account:a,onSaved:s})=>{const[t,r]=l.useState(()=>Ce(a)),[n,c]=l.useState(!0),[i,d]=l.useState(!1),[m,x]=l.useState(""),[f,b]=l.useState(""),[h,y]=l.useState(null),[C,g]=l.useState(null),p=l.useRef(0),I=l.useRef(null);l.useEffect(()=>{var v;const R=++p.current;(v=I.current)==null||v.abort();const _=new AbortController;return I.current=_,r(Ce(a)),y(null),b(""),d(!1),x(""),g(null),c(!0),ve(a.id,{signal:_.signal}).then(A=>{Z(p.current,R,_.signal)&&r(A)}).catch(A=>{Z(p.current,R,_.signal)&&!je(A)&&b(ye(A,"加载任务设置失败"))}).finally(()=>{Z(p.current,R,_.signal)&&c(!1)}),(()=>_.abort())},[a.id]),l.useEffect(()=>(()=>{var R;return(R=I.current)==null?void 0:R.abort()}),[]);const B=l.useCallback(async()=>{var v;if(!Se(i,m))return;const R=++p.current;(v=I.current)==null||v.abort();const _=new AbortController;I.current=_,d(!0),b(""),g(null);try{const A=await ke(a.id,t,{signal:_.signal});if(!Z(p.current,R,_.signal))return;r(A),s(A)}catch(A){Z(p.current,R,_.signal)&&!je(A)&&(b(ye(A,"保存失败")),g(()=>B))}finally{Z(p.current,R,_.signal)&&d(!1)}},[a.id,t,s,m,i]),G=l.useCallback(async R=>{var A;if(!Se(i,m)||!a.enabled)return;const _=++p.current;(A=I.current)==null||A.abort();const v=new AbortController;I.current=v,x(R),b(""),y(null),g(null);try{await ke(a.id,t,{signal:v.signal});const N=await ss(a.id,R,{signal:v.signal}),P=await ve(a.id,{signal:v.signal});if(!Z(p.current,_,v.signal))return;y(N.summary),r(P),s(P)}catch(N){Z(p.current,_,v.signal)&&!je(N)&&(b(ye(N,"任务执行失败")),g(()=>(()=>G(R))))}finally{Z(p.current,_,v.signal)&&x("")}},[a.enabled,a.id,t,s,m,i]),D=l.useCallback(async()=>{C&&await C()},[C]);return{form:t,loading:n,saving:i,running:m,summary:h,error:f,retryAvailable:C!==null,setForm:r,save:B,run:G,retry:D}},Re=({checked:a,onChange:s,label:t})=>e.jsx("button",{type:"button","aria-label":t,"aria-pressed":a,onClick:s,className:`relative h-8 w-14 shrink-0 rounded-full transition-colors ${a?"bg-sky-500":"bg-slate-300"}`,children:e.jsx("span",{className:`absolute left-1 top-1 h-6 w-6 rounded-full bg-white shadow-sm transition-transform ${a?"translate-x-6":""}`})}),vs=({account:a,onClose:s,onSaved:t})=>{const{form:r,loading:n,saving:c,running:i,error:d,summary:m,retryAvailable:x,setForm:f,save:b,run:h,retry:y}=Ns({account:a,onSaved:t});return e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"640px"},role:"dialog","aria-modal":"true","aria-labelledby":"account-task-title",children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"account-task-title",className:"text-2xl font-extrabold text-slate-950",children:"账号自动任务"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:a.nickname||a.remark||a.id})]}),e.jsx("button",{type:"button",onClick:s,className:"rounded-xl p-2 text-slate-400 hover:bg-slate-100 hover:text-slate-700","aria-label":"关闭",children:e.jsx(ce,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"modal-body space-y-5",children:[n&&e.jsx("div",{className:"rounded-xl bg-slate-50 px-4 py-3 text-sm text-slate-500",children:"正在读取任务设置..."}),e.jsx("section",{
Line truncated
|
||||
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(Be,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 只有开启自动改价后,已发送给买家的有效报价才会用于真实订单改价"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:n,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:t,children:"取消"}),e.jsxs("button",{onClick:(()=>void c()),className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:t,children:[t?e.jsx(H,{className:"w-4 h-4 animate-spin"}):e.jsx(Te,{className:"w-4 h-4"}),t?"保存中...":"保存"]})]})})]})}),document.body)},Ce=a=>({account_id:a.id,auto_rate_enabled:a.auto_rate_enabled===!0,rate_content:a.rate_content||"不错的买家,交易愉快",auto_polish_enabled:a.auto_polish_enabled===!0,polish_time:a.polish_time||"03:00",last_rate_scan_at:a.last_rate_scan_at,last_polish_date:a.last_polish_date,last_polish_at:a.last_polish_at}),Z=(a,s,t)=>a===s&&!t.aborted,ye=(a,s)=>a instanceof Error?a.message:s,je=a=>a instanceof Error&&a.message==="请求已取消",Se=(a,s)=>!a&&s==="",Ns=({account:a,onSaved:s})=>{const[t,r]=l.useState(()=>Ce(a)),[n,c]=l.useState(!0),[i,d]=l.useState(!1),[m,x]=l.useState(""),[f,b]=l.useState(""),[h,y]=l.useState(null),[C,g]=l.useState(null),p=l.useRef(0),I=l.useRef(null);l.useEffect(()=>{var v;const R=++p.current;(v=I.current)==null||v.abort();const _=new AbortController;return I.current=_,r(Ce(a)),y(null),b(""),d(!1),x(""),g(null),c(!0),ve(a.id,{signal:_.signal}).then(A=>{Z(p.current,R,_.signal)&&r(A)}).catch(A=>{Z(p.current,R,_.signal)&&!je(A)&&b(ye(A,"加载任务设置失败"))}).finally(()=>{Z(p.current,R,_.signal)&&c(!1)}),(()=>_.abort())},[a.id]),l.useEffect(()=>(()=>{var R;return(R=I.current)==null?void 0:R.abort()}),[]);const B=l.useCallback(async()=>{var v;if(!Se(i,m))return;const R=++p.current;(v=I.current)==null||v.abort();const _=new AbortController;I.current=_,d(!0),b(""),g(null);try{const A=await ke(a.id,t,{signal:_.signal});if(!Z(p.current,R,_.signal))return;r(A),s(A)}catch(A){Z(p.current,R,_.signal)&&!je(A)&&(b(ye(A,"保存失败")),g(()=>B))}finally{Z(p.current,R,_.signal)&&d(!1)}},[a.id,t,s,m,i]),G=l.useCallback(async R=>{var A;if(!Se(i,m)||!a.enabled)return;const _=++p.current;(A=I.current)==null||A.abort();const v=new AbortController;I.current=v,x(R),b(""),y(null),g(null);try{await ke(a.id,t,{signal:v.signal});const N=await ss(a.id,R,{signal:v.signal}),P=await ve(a.id,{signal:v.signal});if(!Z(p.current,_,v.signal))return;y(N.summary),r(P),s(P)}catch(N){Z(p.current,_,v.signal)&&!je(N)&&(b(ye(N,"任务执行失败")),g(()=>(()=>G(R))))}finally{Z(p.current,_,v.signal)&&x("")}},[a.enabled,a.id,t,s,m,i]),D=l.useCallback(async()=>{C&&await C()},[C]);return{form:t,loading:n,saving:i,running:m,summary:h,error:f,retryAvailable:C!==null,setForm:r,save:B,run:G,retry:D}},Re=({checked:a,onChange:s,label:t})=>e.jsx("button",{type:"button","aria-label":t,"aria-pressed":a,onClick:s,className:`relative h-8 w-14 shrink-0 rounded-full transition-colors ${a?"bg-sky-500":"bg-slate-300"}`,children:e.jsx("span",{className:`absolute left-1 top-1 h-6 w-6 rounded-full bg-white shadow-sm transition-transform ${a?"translate-x-6":""}`})}),vs=({account:a,onClose:s,onSaved:t})=>{const{form:r,loading:n,saving:c,running:i,error:d,summary:m,retryAvailable:x,setForm:f,save:b,run:h,retry:y}=Ns({account:a,onSaved:t});return e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"640px"},role:"dialog","aria-modal":"true","aria-labelledby":"account-task-title",children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"account-task-title",className:"text-2xl font-extrabold text-slate-950",children:"账号自动任务"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:a.nickname||a.remark||a.id})]}),e.jsx("button",{type:"button",onClick:s,className:"rounded-xl p-2 text-slate-400 hover:bg-slate-100 hover:text-slate-700","aria-label":"关闭",children:e.jsx(ce,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"modal-body space-y-5",children:[n&&e.jsx("div",{className:"rounded-xl bg-slate-50 px-4 py-3 text-sm text-slate-500",children:"正在读取任务设置..."}),e.jsx("section",{
Line truncated
|
||||
+3
-3
@@ -1,17 +1,17 @@
|
||||
import{a as c,b as U,j as e}from"./react-vendor-Bf9ELcll.js";import{r as M,c as O,a as ee}from"./index-C6RECy_0.js";import{c as te}from"./contract-COFcZjyb.js";import{X as V,W as ae,J as z,Y as se,L as q,N as J,C as X,_ as le,$ as Y,a0 as K,a1 as ne,I as re,a2 as oe,V as ce,y as ie,P as de,o as xe}from"./icons-vendor-B5fJPoU1.js";import"./vendor-BE-_xUHH.js";const pe=l=>{let n=l.api_config;if(typeof n=="string"&&n.trim())try{n=JSON.parse(n)}catch{n=void 0}return{...l,api_config:n||void 0}},Q=l=>({name:l.name,type:l.type,api_config:l.api_config?JSON.stringify(l.api_config):"",text_content:l.text_content,data_content:l.data_content,image_url:l.image_url,description:l.description,enabled:l.enabled,delay_seconds:l.delay_seconds,is_multi_spec:l.is_multi_spec,spec_name:l.spec_name,spec_value:l.spec_value}),me=async l=>{const n=await M(p=>O.GET("/api/v1/cards",{signal:p}),l);return te(n,["cards","data","items"]).map(pe)},he=async l=>M(n=>O.POST("/api/v1/cards",{body:Q(l),signal:n})),H=async(l,n)=>M(a=>O.PUT("/api/v1/cards/{card_id}",{params:{path:{card_id:String(l)}},body:Q(n),signal:a})),ue=async l=>M(n=>O.DELETE("/api/v1/cards/{card_id}",{params:{path:{card_id:String(l)}},signal:n})),be=async(l,n)=>{const a=new FormData;return a.append("file",l),M(p=>O.POST("/api/v1/cards/batch",{body:ee(a),signal:p}),n)},ge=async(l,n,a)=>M(p=>O.POST("/api/v1/cards/{card_id}/append-data",{params:{path:{card_id:String(l)}},body:{content:n},signal:p}),a),ye=(l,n,a)=>{const p=a.trim().toLocaleLowerCase();return l.filter(h=>(!n||h.type===n)&&(!p||h.name.toLocaleLowerCase().includes(p)))},Z=l=>l.split(`
|
||||
import{a as c,b as U,j as e}from"./react-vendor-Bf9ELcll.js";import{r as M,c as O,b as ee}from"./chat-metadata-74T0w35U.js";import{c as te}from"./contract-COFcZjyb.js";import{X as V,$ as ae,W as z,a0 as se,L as q,P as J,e as X,a1 as le,a2 as K,a3 as Q,a4 as ne,V as re,a5 as oe,_ as ce,T as ie,o as de,s as xe}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";const pe=l=>{let n=l.api_config;if(typeof n=="string"&&n.trim())try{n=JSON.parse(n)}catch{n=void 0}return{...l,api_config:n||void 0}},Y=l=>({name:l.name,type:l.type,api_config:l.api_config?JSON.stringify(l.api_config):"",text_content:l.text_content,data_content:l.data_content,image_url:l.image_url,description:l.description,enabled:l.enabled,delay_seconds:l.delay_seconds,is_multi_spec:l.is_multi_spec,spec_name:l.spec_name,spec_value:l.spec_value}),me=async l=>{const n=await M(p=>O.GET("/api/v1/cards",{signal:p}),l);return te(n,["cards","data","items"]).map(pe)},he=async l=>M(n=>O.POST("/api/v1/cards",{body:Y(l),signal:n})),H=async(l,n)=>M(a=>O.PUT("/api/v1/cards/{card_id}",{params:{path:{card_id:String(l)}},body:Y(n),signal:a})),ue=async l=>M(n=>O.DELETE("/api/v1/cards/{card_id}",{params:{path:{card_id:String(l)}},signal:n})),be=async(l,n)=>{const a=new FormData;return a.append("file",l),M(p=>O.POST("/api/v1/cards/batch",{body:ee(a),signal:p}),n)},ge=async(l,n,a)=>M(p=>O.POST("/api/v1/cards/{card_id}/append-data",{params:{path:{card_id:String(l)}},body:{content:n},signal:p}),a),ye=(l,n,a)=>{const p=a.trim().toLocaleLowerCase();return l.filter(h=>(!n||h.type===n)&&(!p||h.name.toLocaleLowerCase().includes(p)))},Z=l=>l.split(`
|
||||
`).map(n=>n.trim()).filter(Boolean),fe=(l,n,a)=>!!(l&&Z(n).length>0&&!a),F=(l,n,a,p)=>l===n&&a===p,W=()=>({name:"",type:"data",content:"",description:"",enabled:!0,delay_seconds:0,api_method:"GET",api_timeout:10,api_headers:"",api_params:""}),G=(l,n)=>l instanceof Error?l.message:n,je=({cards:l,loadCards:n})=>{const[a,p]=c.useState(!1),[h,_]=c.useState(!1),[f,j]=c.useState(null),[d,T]=c.useState({}),[i,y]=c.useState(W),[N,b]=c.useState(""),[r,x]=c.useState(""),s=c.useMemo(()=>l.filter(o=>o.type==="data"),[l]),u=c.useMemo(()=>ye(l,N,r),[l,r,N]),I=c.useCallback(o=>{var t,g,k,S,C;j(o),T({id:o.id,name:o.name||"",type:o.type||"text",api_url:((t=o.api_config)==null?void 0:t.url)||"",api_method:((g=o.api_config)==null?void 0:g.method)||"GET",api_timeout:((k=o.api_config)==null?void 0:k.timeout)||10,api_headers:((S=o.api_config)==null?void 0:S.headers)||"",api_params:((C=o.api_config)==null?void 0:C.params)||"",text_content:o.text_content||"",data_content:o.data_content||"",image_url:o.image_url||"",delay_seconds:o.delay_seconds||0,description:o.description||"",enabled:o.enabled}),p(!0)},[]),L=c.useCallback(async()=>{var o,t,g,k,S,C,m,A;if(f){if(!((o=d.name)!=null&&o.trim())){alert("请输入卡密名称");return}if(!d.type){alert("请选择卡密类型");return}try{const w={name:d.name.trim(),type:d.type,description:(t=d.description)==null?void 0:t.trim(),delay_seconds:d.delay_seconds||0,enabled:d.enabled??!0};d.type==="api"?w.api_config={url:((g=d.api_url)==null?void 0:g.trim())||"",method:d.api_method||"GET",timeout:d.api_timeout||10,headers:((k=d.api_headers)==null?void 0:k.trim())||void 0,params:((S=d.api_params)==null?void 0:S.trim())||void 0}:d.type==="text"?w.text_content=((C=d.text_content)==null?void 0:C.trim())||"":d.type==="data"?w.data_content=((m=d.data_content)==null?void 0:m.trim())||"":d.type==="image"&&(w.image_url=((A=d.image_url)==null?void 0:A.trim())||""),await H(f.id,w),p(!1),await n()}catch(w){console.error("更新卡密失败:",w),alert(G(w,"更新失败,请重试"))}}},[d,n,f]),P=c.useCallback(async o=>{if(confirm("确认删除该卡密吗?"))try{await ue(o),await n()}catch(t){console.error("删除卡密失败:",t),alert(G(t,"删除失败,请重试"))}},[n]),v=c.useCallback(async()=>{if(!i.name.trim()){alert("请输入卡密名称");return}if(!i.content.trim()){alert(i.type==="api"?"请输入 API 地址":"请输入卡密内容");return}try{const o={name:i.name.trim(),type:i.type,description:i.description.trim(),enabled:i.enabled,delay_seconds:i.delay_seconds};i.type==="text"&&(o.text_content=i.content.trim()),i.type==="data"&&(o.data_content=i.content.trim()),i.type==="image"&&(o.image_url=i.content.trim()),i.type==="api"&&(o.api_config={url:i.content.trim(),method:i.api_method,timeout:i.api_timeout,headers:i.api_headers.trim()||void 0,params:i.api_params.trim()||void 0}),await he(o),_(!1),y(W()),await n()}catch(o){console.error("添加卡密失败:",o),alert(G(o,"添加失败,请重试"))}},[i,n]),B=c.useCallback(async o=>{try{await H(o.id,{...o,enabled:!o.enabled}),await n()}catch(t){console.error("切换状态失败:",t)}},[n]),R=c.useCallback(async o=>{try{await navigator.clipboard.writeText(String(o)),alert(`已复制卡密组ID:${o}`)}catch{prompt("复制卡密组ID",String(o))}},[]),D=c.useCallback(()=>{const g=[["名称","类型","内容","描述","启用","延迟秒","多规格","规格名","规格值"],...[["VIP月卡","data",`VIP-MONTH-001
|
||||
VIP-MONTH-002
|
||||
VIP-MONTH-003`,"按行消费的卡密队列","是","0","否","",""],["感谢文案","text","感谢购买,如有问题联系客服~","固定文本","是","0","否","",""],["教程图","image","https://cdn.example.com/tutorial.jpg","图片URL","是","0","否","",""]]].map(m=>m.map(A=>`"${String(A).replace(/"/g,'""')}"`).join(",")).join(`
|
||||
`),k=new Blob(["\uFEFF"+g],{type:"text/csv;charset=utf-8"}),S=URL.createObjectURL(k),C=document.createElement("a");C.href=S,C.download="卡密组批量导入模板.csv",document.body.appendChild(C),C.click(),C.remove(),URL.revokeObjectURL(S)},[]);return{dataCards:s,filteredCards:u,typeFilter:N,setTypeFilter:b,nameSearch:r,setNameSearch:x,showEditModal:a,setShowEditModal:p,showAddModal:h,setShowAddModal:_,selectedCard:f,editForm:d,setEditForm:T,addForm:i,setAddForm:y,handleEdit:I,handleSaveEdit:L,handleDelete:P,handleAddCard:v,toggleCardStatus:B,copyCardID:R,downloadCardTemplate:D}},Ne=({dataCards:l,downloadCardTemplate:n,...a})=>{var x;const p=s=>{var u;a.setBatchFile(((u=s.target.files)==null?void 0:u[0])||null)},h=s=>{a.setAppendContent(s.target.value)},_=s=>{a.setAppendTargetId(s.target.value)},f=()=>a.closeBatchModal(),j=()=>a.setBatchTab("create"),d=()=>a.setBatchTab("append"),T=()=>void a.handleRetryBatchCreate(),i=()=>void a.handleRetryBatchAppend(),y=a.batchResult&&"rows"in a.batchResult?a.batchResult:null,N=s=>e.jsxs("option",{value:String(s.id),children:[s.name,"(ID: ",s.id,")"]},s.id),b=()=>void a.handleBatchCreate(),r=()=>void a.handleBatchAppend();return a.showBatchModal?U.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[e.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),e.jsx("button",{onClick:f,className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:e.jsx(V,{className:"w-5 h-5 text-gray-600"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[e.jsxs("button",{onClick:j,className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${a.batchTab==="create"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(ae,{className:"w-4 h-4"}),"批量创建卡密组"]}),e.jsxs("button",{onClick:d,className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${a.batchTab==="append"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(z,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),a.batchTab==="create"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",e.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),"。 类型填 text/data/image;data 类型的“内容”按行存卡密(CSV 单元格内换行需用引号包裹)。"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:n,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text-sm transition-colors",children:[e.jsx(se,{className:"w-4 h-4"}),"下载模板"]}),e.jsxs("label",{className:"flex-1 px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text-sm cursor-pointer transition-colors",children:[e.jsx(z,{className:"w-4 h-4"}),a.batchFile?a.batchFile.name:"选择 .xlsx / .csv / .tsv",e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv",className:"hidden",onChange:p})]})]}),((x=a.batchResult)==null?void 0:x.error)&&e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:a.batchResult.error}),e.jsx("button",{type:"button",onClick:T,disabled:!a.batchFile||a.batchBusy,className:"font-bold whitespace-nowrap",children:"重试"})]}),y&&e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4 space-y-2",children:[e.jsxs("div",{className:"text-sm font-bold text-gray-900",children:["共 ",y.total," 行 · 成功 ",y.created," · 失败 ",y.failed]}),y.failed>0&&e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1",children:y.rows.filter(s=>!s.success).map(s=>e.jsxs("div",{className:"text-xs text-red-600",children:["第 ",s.row_no," 行「",s.name,"」:",s.error]},s.row_no))})]})]}):e.jsx("div",{className:"space-y-4",children:l.length===0?e.jsx("div",{className:"rounded-xl bg-amber-50 border border-amber-200 p-4 text-sm text-amber-800",children:"暂无 data(批量卡密)类型的卡密组,请先创建一个再充卡密。"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"选择卡密组"}),e.jsx("select",{value:a.appendTargetId,onChange:_,className:"w-full
Line truncated
|
||||
VIP-002
|
||||
VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["预览:",a.appendPreview.length," 个有效卡密,空行自动忽略。"]})]}),a.appendError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-200 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:a.appendError}),e.jsx("button",{type:"button",onClick:i,disabled:a.batchBusy,className:"font-bold whitespace-nowrap",children:"重试"})]}),a.appendResult&&e.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",a.appendResult.added," 个卡密"]})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:f,className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),a.batchTab==="create"?e.jsxs("button",{onClick:b,disabled:!a.batchFile||a.batchBusy,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[a.batchBusy?e.jsx(q,{className:"w-4 h-4 animate-spin"}):e.jsx(z,{className:"w-4 h-4"}),a.batchBusy?"处理中...":"上传创建"]}):e.jsxs("button",{onClick:r,disabled:!a.appendTargetId||a.appendPreview.length===0||a.batchBusy||l.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[a.batchBusy?e.jsx(q,{className:"w-4 h-4 animate-spin"}):e.jsx(J,{className:"w-4 h-4"}),a.batchBusy?"处理中...":"追加卡密"]})]})]})}),document.body):null},ve=({type:l})=>{switch(l){case"text":return e.jsx(K,{className:"w-5 h-5 text-blue-500"});case"image":return e.jsx(Y,{className:"w-5 h-5 text-purple-500"});case"api":return e.jsx(le,{className:"w-5 h-5 text-blue-500"});default:return e.jsx(X,{className:"w-5 h-5 text-gray-500"})}},we=()=>{const[l,n]=c.useState([]),[a,p]=c.useState(!0),h=c.useRef(0),_=c.useRef(null),f=c.useCallback(async()=>{var T;const j=++h.current;(T=_.current)==null||T.abort();const d=new AbortController;_.current=d,p(!0);try{const i=await me({signal:d.signal});if(j!==h.current)return;n(i)}catch(i){j===h.current&&!d.signal.aborted&&console.error("加载卡密库存失败:",i)}finally{j===h.current&&p(!1)}},[]);return c.useEffect(()=>(f(),()=>{var d;h.current+=1,(d=_.current)==null||d.abort()}),[f]),{cards:l,setCards:n,loading:a,loadCards:f}},Ce=l=>{const n=l.dataCards,a=l.loadCards,[p,h]=c.useState(!1),[_,f]=c.useState("create"),[j,d]=c.useState(null),[T,i]=c.useState(null),[y,N]=c.useState(!1),[b,r]=c.useState(""),[x,s]=c.useState(""),[u,I]=c.useState(null),[L,P]=c.useState(""),v=c.useRef(0),B=c.useRef(null),R=c.useRef("");c.useEffect(()=>(()=>{var m;v.current+=1,(m=B.current)==null||m.abort()}),[]);const D=c.useMemo(()=>Z(x),[x]),o=c.useCallback(()=>{var m;f("create"),d(null),i(null),r((m=n[0])!=null&&m.id?String(n[0].id):""),s(""),I(null),P(""),h(!0)},[n]),t=c.useCallback(()=>{var m;v.current+=1,(m=B.current)==null||m.abort(),N(!1),h(!1)},[]),g=c.useCallback(async()=>{var w;if(!j||y)return;const m=++v.current;(w=B.current)==null||w.abort();const A=new AbortController;B.current=A,N(!0),i(null);try{const E=await be(j,{signal:A.signal});if(!F(m,v.current,"",""))return;i(E),E.created>0&&await a()}catch(E){if(!F(m,v.current,"",""))return;i({error:(E==null?void 0:E.message)||"上传失败"})}finally{F(m,v.current,"","")&&N(!1)}},[y,j,a]),k=c.useCallback(async()=>{var E;if(!fe(b,x,y))return;const m=b,A=++v.current;R.current=m,(E=B.current)==null||E.abort();const w=new AbortController;B.current=w,N(!0),I(null),P("");try{const $=await ge(m,x,{signal:w.signal});if(!F(A,v.current,m,b))return;I({added:$.added}),s(""),await a()}catch($){if(!F(A,v.current,m,b))return;P(($==null?void 0:$.message)||"追加失败")}finally{F(A,v.current,m,b)&&N(!1)}},[x,b,y,a]),S=c.useCallback(async()=>{await g()},[g]),C=c.useCallback(async()=>{R.current&&b!==R.current||await k()},[b,k]);return{showBatchModal:p,setShowBatchModal:h,batchTab:_,setBatchTab:f,batchFile:j,setBatchFile:d,batchResult:T,batchBusy:y,appendTargetId:b,setAppendTargetId:r,appendContent:x,setAppendContent:s,appendResult:u,appendError:L,appendPreview:D,openBatchModal:o,closeBatchModal:t,handleBatchCreate:g,handleBatchAppend:k,handleRetryBatchCreate:S,handleRetryBatchAppend:C}},Be=()=>{const{cards:l,loadCards:n}=we(),a=je({cards:l,loadCards:n}),{dataCards:p,filteredCards:h,typeFilter:_,setTypeFilter:f,nameSearch:j,setNameSearch:d,showEditModal:T,setShowEditModal:i,showAddModal:y,setShowAddModal:N,selectedCard:b,editForm:r,setEditForm:x,addForm:s,setAddForm:u,handleEdit:I,handleSaveEdit:L,handleDelete:P,handleAddCard:v,toggleCardStatus:B,copyCardID:R,downloadCardTemplate:D}=a,o=Ce({dataCards:p,loadCards:n});return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-
Line truncated
|
||||
VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["预览:",a.appendPreview.length," 个有效卡密,空行自动忽略。"]})]}),a.appendError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-200 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:a.appendError}),e.jsx("button",{type:"button",onClick:i,disabled:a.batchBusy,className:"font-bold whitespace-nowrap",children:"重试"})]}),a.appendResult&&e.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",a.appendResult.added," 个卡密"]})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:f,className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),a.batchTab==="create"?e.jsxs("button",{onClick:b,disabled:!a.batchFile||a.batchBusy,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[a.batchBusy?e.jsx(q,{className:"w-4 h-4 animate-spin"}):e.jsx(z,{className:"w-4 h-4"}),a.batchBusy?"处理中...":"上传创建"]}):e.jsxs("button",{onClick:r,disabled:!a.appendTargetId||a.appendPreview.length===0||a.batchBusy||l.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[a.batchBusy?e.jsx(q,{className:"w-4 h-4 animate-spin"}):e.jsx(J,{className:"w-4 h-4"}),a.batchBusy?"处理中...":"追加卡密"]})]})]})}),document.body):null},ve=({type:l})=>{switch(l){case"text":return e.jsx(Q,{className:"w-5 h-5 text-blue-500"});case"image":return e.jsx(K,{className:"w-5 h-5 text-purple-500"});case"api":return e.jsx(le,{className:"w-5 h-5 text-blue-500"});default:return e.jsx(X,{className:"w-5 h-5 text-gray-500"})}},we=()=>{const[l,n]=c.useState([]),[a,p]=c.useState(!0),h=c.useRef(0),_=c.useRef(null),f=c.useCallback(async()=>{var T;const j=++h.current;(T=_.current)==null||T.abort();const d=new AbortController;_.current=d,p(!0);try{const i=await me({signal:d.signal});if(j!==h.current)return;n(i)}catch(i){j===h.current&&!d.signal.aborted&&console.error("加载卡密库存失败:",i)}finally{j===h.current&&p(!1)}},[]);return c.useEffect(()=>(f(),()=>{var d;h.current+=1,(d=_.current)==null||d.abort()}),[f]),{cards:l,setCards:n,loading:a,loadCards:f}},Ce=l=>{const n=l.dataCards,a=l.loadCards,[p,h]=c.useState(!1),[_,f]=c.useState("create"),[j,d]=c.useState(null),[T,i]=c.useState(null),[y,N]=c.useState(!1),[b,r]=c.useState(""),[x,s]=c.useState(""),[u,I]=c.useState(null),[L,P]=c.useState(""),v=c.useRef(0),B=c.useRef(null),R=c.useRef("");c.useEffect(()=>(()=>{var m;v.current+=1,(m=B.current)==null||m.abort()}),[]);const D=c.useMemo(()=>Z(x),[x]),o=c.useCallback(()=>{var m;f("create"),d(null),i(null),r((m=n[0])!=null&&m.id?String(n[0].id):""),s(""),I(null),P(""),h(!0)},[n]),t=c.useCallback(()=>{var m;v.current+=1,(m=B.current)==null||m.abort(),N(!1),h(!1)},[]),g=c.useCallback(async()=>{var w;if(!j||y)return;const m=++v.current;(w=B.current)==null||w.abort();const A=new AbortController;B.current=A,N(!0),i(null);try{const E=await be(j,{signal:A.signal});if(!F(m,v.current,"",""))return;i(E),E.created>0&&await a()}catch(E){if(!F(m,v.current,"",""))return;i({error:(E==null?void 0:E.message)||"上传失败"})}finally{F(m,v.current,"","")&&N(!1)}},[y,j,a]),k=c.useCallback(async()=>{var E;if(!fe(b,x,y))return;const m=b,A=++v.current;R.current=m,(E=B.current)==null||E.abort();const w=new AbortController;B.current=w,N(!0),I(null),P("");try{const $=await ge(m,x,{signal:w.signal});if(!F(A,v.current,m,b))return;I({added:$.added}),s(""),await a()}catch($){if(!F(A,v.current,m,b))return;P(($==null?void 0:$.message)||"追加失败")}finally{F(A,v.current,m,b)&&N(!1)}},[x,b,y,a]),S=c.useCallback(async()=>{await g()},[g]),C=c.useCallback(async()=>{R.current&&b!==R.current||await k()},[b,k]);return{showBatchModal:p,setShowBatchModal:h,batchTab:_,setBatchTab:f,batchFile:j,setBatchFile:d,batchResult:T,batchBusy:y,appendTargetId:b,setAppendTargetId:r,appendContent:x,setAppendContent:s,appendResult:u,appendError:L,appendPreview:D,openBatchModal:o,closeBatchModal:t,handleBatchCreate:g,handleBatchAppend:k,handleRetryBatchCreate:S,handleRetryBatchAppend:C}},Be=()=>{const{cards:l,loadCards:n}=we(),a=je({cards:l,loadCards:n}),{dataCards:p,filteredCards:h,typeFilter:_,setTypeFilter:f,nameSearch:j,setNameSearch:d,showEditModal:T,setShowEditModal:i,showAddModal:y,setShowAddModal:N,selectedCard:b,editForm:r,setEditForm:x,addForm:s,setAddForm:u,handleEdit:I,handleSaveEdit:L,handleDelete:P,handleAddCard:v,toggleCardStatus:B,copyCardID:R,downloadCardTemplate:D}=a,o=Ce({dataCards:p,loadCards:n});return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-
Line truncated
|
||||
`).filter(S=>S.trim()).length} 条`:t.type==="text"&&t.text_content?g=t.text_content:t.type==="api"&&t.api_config?g=t.api_config.url:t.type==="image"&&t.image_url&&(g="图片链接"),e.jsxs("tr",{className:"hover:bg-warning-50/50 transition-colors group",children:[e.jsx("td",{className:"px-5 py-5 align-middle",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"shrink-0 rounded-xl bg-gray-50 p-2 transition-colors group-hover:bg-white",children:e.jsx(ve,{type:t.type})}),e.jsx("span",{className:"line-clamp-3 min-w-0 text-[13px] font-bold leading-5 text-gray-900",title:t.name,children:t.name})]})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("button",{onClick:(()=>R(t.id)),className:"inline-flex max-w-full items-center gap-1 rounded-lg bg-gray-100 px-2 py-1.5 font-mono text-[11px] font-extrabold text-gray-700 transition-colors hover:bg-gray-200",title:"复制卡密组ID,用于批量铺货表格",children:[e.jsx("span",{className:"truncate",children:t.id}),e.jsx(oe,{className:"h-3 w-3 shrink-0"})]})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("span",{className:`inline-flex rounded-md px-2 py-1 text-[11px] font-bold ${t.type==="text"?"bg-blue-50 text-blue-600":t.type==="data"?"bg-purple-50 text-purple-600":t.type==="api"?"bg-blue-50 text-blue-600":"bg-pink-50 text-pink-600"}`,children:t.type==="text"?"文本":t.type==="data"?"批量":t.type==="api"?"API":"图片"})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"line-clamp-3 break-all font-mono text-sm leading-5 text-gray-600",title:g,children:g})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"block truncate text-sm text-gray-500",title:t.description||"-",children:t.description||"-"})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("button",{onClick:(()=>B(t)),"aria-label":`切换卡密 ${t.name} 状态`,className:`w-12 h-8 rounded-full relative transition-colors ${t.enabled?"bg-green-500":"bg-gray-300"}`,children:e.jsx("div",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-sm transition-transform ${t.enabled?"left-5":"left-1"}`})})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e.jsx("button",{onClick:(()=>I(t)),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-black",title:"编辑",children:e.jsx(ce,{className:"w-4 h-4"})}),e.jsx("button",{onClick:(()=>P(t.id)),"aria-label":`删除卡密 ${t.name}`,className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-red-50 hover:text-red-500",children:e.jsx(ie,{className:"h-4 w-4"})})]})})]},t.id)})})]})}),h.length===0&&e.jsxs("div",{className:"py-20 text-center text-gray-400",children:[e.jsx(de,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{children:l.length===0?"暂无卡密配置,请点击右上角添加。":"没有符合当前筛选条件的卡密组。"})]})]}),T&&b&&U.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑卡密"}),e.jsx("button",{onClick:(()=>i(!1)),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",children:e.jsx(V,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["卡密名称 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:r.name||"",onChange:(t=>x({...r,name:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如:游戏点卡、会员卡等"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡券类型"}),e.jsxs("select",{value:r.type||"text",onChange:(t=>x({...r,type:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"请选择类型"}),e.jsx("option",{value:"text",children:"固定文字"}),e.jsx("option",{value:"data",children:"批量数据"}),(b==null?void 0:b.type)==="api"&&e.jsx("option",{value:"api",children:"API接口(仅保留现有配置)"}),e.jsx("option",{value:"image",children:"图片"})]})]})]}),r.type==="api"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 space-y-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900",children:"API 配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"API 地址"}),e.jsx("input",{type:"url",value:r.api_url||"",onChange:(t=>x({...r,api_url:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https:/Line truncated
|
||||
卡号1:密码1
|
||||
卡号2:密码2
|
||||
或者
|
||||
兑换码1
|
||||
兑换码2`}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持格式:卡号:密码 或 单独的兑换码"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-blue-600",children:r.data_content?r.data_content.split(`
|
||||
`).filter(t=>t.trim()).length:0})," 条"]})]})]}),r.type==="image"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"图片配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),e.jsx("input",{type:"url",value:r.image_url||"",onChange:(t=>x({...r,image_url:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://example.com/image.png"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"仅保存图片 URL;发货时会临时下载并上传到闲鱼"})]}),r.image_url&&e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片预览"}),e.jsx("img",{src:r.image_url,alt:"预览",className:"max-w-full max-h-48 rounded-xl border border-gray-200",onError:(t=>{t.currentTarget.src="https://via.placeholder.com/400x200?text=图片加载失败"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"延时发货时间(秒)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",value:r.delay_seconds||0,onChange:(t=>x({...r,delay_seconds:parseInt(t.target.value)||0})),className:"flex-1 ios-input px-4 py-3 rounded-xl",min:"0",max:"3600",placeholder:"0"}),e.jsx("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:"秒"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"0表示立即发货,最大3600秒(1小时)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注信息"}),e.jsx("textarea",{value:r.description||"",onChange:(t=>x({...r,description:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none",placeholder:"可选的备注信息"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsx("span",{className:"font-bold text-gray-900",children:"启用状态"}),e.jsx("button",{type:"button",onClick:(()=>x({...r,enabled:!r.enabled})),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${r.enabled?"bg-brand":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${r.enabled?"translate-x-7":"translate-x-1"}`})})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:(()=>i(!1)),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:L,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body),y&&U.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"780px"},children:[e.jsxs("div",{className:"modal-header flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"添加新卡密"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"选择交付方式并录入自动发货内容"})]}),e.jsx("button",{onClick:(()=>N(!1)),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",title:"关闭",children:e.jsx(V,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡密名称"}),e.jsx("input",{type:"text",value:s.name,onChange:(t=>u({...s,name:t.target.value})),placeholder:"例如:VIP会员卡密",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"类型"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[e.jsxs("button",{type:"button",onClick:(()=>u({...s,type:"data",content:""})),className:`p-3 rounded-xl font-bold transition-all ${s.type==="data"?"bg-brand text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(X,{className:"w-5 h-5 mx-auto mb-1"}),"批量库存"]}),e.jsxs("button",{type:"button",onClick:(()=>u({...s,type:"text",content:""})),className:`p-3 rounded-xl font-bold transition-all ${s.type==="text"?"bg-brand text-white":"bg-gray-100 text-gray-600"}`,children:[e.jsx(K,{className:"w-5 h-5 mx-auto mb-1"}),"文本"]}),e.jsxs("button",{type:"button",onClick:(()=>u({...s,type:"image",content:""})),className:`p-3 rounded-xl font-bold transition-all ${s.type==="image"?"bg-brand tLine truncated
|
||||
`).filter(t=>t.trim()).length:0})," 条"]})]})]}),r.type==="image"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"图片配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),e.jsx("input",{type:"url",value:r.image_url||"",onChange:(t=>x({...r,image_url:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://example.com/image.png"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"仅保存图片 URL;发货时会临时下载并上传到闲鱼"})]}),r.image_url&&e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片预览"}),e.jsx("img",{src:r.image_url,alt:"预览",className:"max-w-full max-h-48 rounded-xl border border-gray-200",onError:(t=>{t.currentTarget.src="https://via.placeholder.com/400x200?text=图片加载失败"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"延时发货时间(秒)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",value:r.delay_seconds||0,onChange:(t=>x({...r,delay_seconds:parseInt(t.target.value)||0})),className:"flex-1 ios-input px-4 py-3 rounded-xl",min:"0",max:"3600",placeholder:"0"}),e.jsx("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:"秒"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"0表示立即发货,最大3600秒(1小时)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注信息"}),e.jsx("textarea",{value:r.description||"",onChange:(t=>x({...r,description:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none",placeholder:"可选的备注信息"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsx("span",{className:"font-bold text-gray-900",children:"启用状态"}),e.jsx("button",{type:"button",onClick:(()=>x({...r,enabled:!r.enabled})),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${r.enabled?"bg-brand":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${r.enabled?"translate-x-7":"translate-x-1"}`})})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:(()=>i(!1)),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:L,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body),y&&U.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"780px"},children:[e.jsxs("div",{className:"modal-header flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"添加新卡密"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"选择交付方式并录入自动发货内容"})]}),e.jsx("button",{onClick:(()=>N(!1)),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",title:"关闭",children:e.jsx(V,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡密名称"}),e.jsx("input",{type:"text",value:s.name,onChange:(t=>u({...s,name:t.target.value})),placeholder:"例如:VIP会员卡密",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"类型"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[e.jsxs("button",{type:"button",onClick:(()=>u({...s,type:"data",content:""})),className:`p-3 rounded-xl font-bold transition-all ${s.type==="data"?"bg-brand text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(X,{className:"w-5 h-5 mx-auto mb-1"}),"批量库存"]}),e.jsxs("button",{type:"button",onClick:(()=>u({...s,type:"text",content:""})),className:`p-3 rounded-xl font-bold transition-all ${s.type==="text"?"bg-brand text-white":"bg-gray-100 text-gray-600"}`,children:[e.jsx(Q,{className:"w-5 h-5 mx-auto mb-1"}),"文本"]}),e.jsxs("button",{type:"button",onClick:(()=>u({...s,type:"image",content:""})),className:`p-3 rounded-xl font-bold transition-all ${s.type==="image"?"bg-brand tLine truncated
|
||||
CODE-789012
|
||||
...`:"请输入每次发货时发送的固定文字"}),s.type==="data"&&e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-brand",children:s.content.split(`
|
||||
`).filter(t=>t.trim()).length})," 条"]})]}),s.type==="api"&&e.jsxs("div",{className:"border-t border-gray-100 pt-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求方法"}),e.jsxs("select",{value:s.api_method,onChange:(t=>u({...s,api_method:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"GET",children:"GET"}),e.jsx("option",{value:"POST",children:"POST"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"超时时间(秒)"}),e.jsx("input",{type:"number",min:"1",max:"60",value:s.api_timeout,onChange:(t=>u({...s,api_timeout:parseInt(t.target.value)||10})),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求头(JSON)"}),e.jsx("textarea",{value:s.api_headers,onChange:(t=>u({...s,api_headers:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"Authorization":"Bearer token"}'})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求参数(JSON)"}),e.jsx("textarea",{value:s.api_params,onChange:(t=>u({...s,api_params:t.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"order_id":"{order_id}"}'})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_180px] gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"描述"}),e.jsx("input",{value:s.description,onChange:(t=>u({...s,description:t.target.value})),placeholder:"卡密用途描述(可选)",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"延时发货(秒)"}),e.jsx("input",{type:"number",value:s.delay_seconds,onChange:(t=>u({...s,delay_seconds:parseInt(t.target.value)||0})),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"3600"})]})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:(()=>N(!1)),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:v,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(J,{className:"w-4 h-4"}),"添加卡密"]})]})})]})}),document.body),e.jsx(Ne,{dataCards:p,downloadCardTemplate:D,...o})]})};export{Be as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{d as E,j as e,a}from"./react-vendor-Bf9ELcll.js";import{L as pe}from"./vendor-BE-_xUHH.js";import{B as me}from"./audio-codec-mjVr_wwJ.js";import{L as G,an as de,ao as ge,u as xe,ap as ue,aq as he,M as Q0,V as _e,R as be,ag as D0,m as fe,ar as je,x as J0,as as we,at as Ne,au as ye,av as Ce,S as W0,X as Oe}from"./icons-vendor-BSp7PTZg.js";import{a as U0,i as R,d as i0,e as V0,f as z0,m as Z0,h as ve,j as ke,k as q0,l as Se,s as Re,n as Ee,o as Ie,p as Me,g as Le,q as G0,u as $0,t as P0,C as De}from"./chat-metadata-74T0w35U.js";import{p as Ue,s as qe}from"./index-dO7JyNQY.js";const H0="ydisks:chat-audio-play",Pe=[6,10,15,8,17,12,7,16,11,6,14,9];function Te(u){const _=u.trim();if(typeof location>"u"||location.protocol!=="https:")return _;try{const n=new URL(_);return n.protocol==="http:"&&n.hostname.endsWith(".aliyuncs.com")&&(n.protocol="https:"),n.toString()}catch{return _}}function T0(u){const _=Number.isFinite(u)?Math.max(0,Math.floor(u)):0,n=Math.floor(_/60),l=_%60;return`${n}:${l.toString().padStart(2,"0")}`}function A0(u){window.dispatchEvent(new CustomEvent(H0,{detail:u}))}const Ae=({messageKey:u,src:_,outgoing:n,initialDuration:l=0})=>{const x=E.useRef(null),C=E.useRef(0),[o,I]=E.useState("idle"),[M,L]=E.useState(l),[V,T]=E.useState(0);E.useEffect(()=>(()=>{var d;C.current+=1,(d=x.current)==null||d.destroy(),x.current=null}),[_]),E.useEffect(()=>{L(Math.max(0,l))},[l]),E.useEffect(()=>{const d=f=>{const w=f.detail,N=x.current;w!==u&&(N!=null&&N.isPlaying())&&N.pause()};return window.addEventListener(H0,d),(()=>window.removeEventListener(H0,d))},[u]),E.useEffect(()=>{if(o!=="playing")return;const d=window.setInterval(()=>{const f=x.current;f&&T(f.getCurrentPosition())},100);return(()=>window.clearInterval(d))},[o]);const A=(d,f)=>{const w=()=>C.current===f&&x.current===d;d.onPlay(()=>{w()&&I("playing")}),d.onResume(()=>{w()&&I("playing")}),d.onPause(()=>{w()&&I("paused")}),d.onStop(()=>{w()&&(I("idle"),T(0))}),d.onEnded(()=>{w()&&(I("idle"),T(0))})},r0=async()=>{var w;const d=x.current;if(d!=null&&d.isPlaying()){d.pause();return}if(d!=null&&d.isPaused()){A0(u),d.resume();return}if(d!=null&&d.isInit()){A0(u),d.play();return}if(o==="loading")return;const f=C.current+1;C.current=f,I("loading"),T(0);try{const N=new me;if(x.current=N,A(N,f),await N.initWithUrl(Te(_)),C.current!==f||x.current!==N){N.destroy();return}L(N.getDuration()||Math.max(0,l)),A0(u),N.play()}catch{if(C.current!==f)return;(w=x.current)==null||w.destroy(),x.current=null,I("error"),T(0)}},H=o==="playing"||o==="paused"?V:M,$=M>0?o==="playing"||o==="paused"?`${T0(H)} / ${T0(M)}`:T0(M):"--:--",P=o==="loading"?"正在解码":o==="playing"?"正在播放":o==="paused"?"已暂停":o==="error"?"加载失败,点击重试":"语音消息",O=o==="playing"?"暂停语音消息":o==="paused"?"继续播放语音消息":o==="error"?"重新加载语音消息":o==="loading"?"正在加载语音消息":"播放语音消息";return e.jsxs("div",{className:`flex h-11 min-w-56 items-center gap-2 rounded-2xl border px-2 shadow-sm ${n?"rounded-br-md border-sky-400 bg-sky-500 text-white":"rounded-bl-md border-slate-200 bg-white text-slate-800"}`,children:[e.jsx("button",{type:"button","aria-label":O,title:O,disabled:o==="loading",onClick:(()=>void r0()),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-wait ${n?"bg-white text-sky-600 hover:bg-sky-50 focus-visible:ring-white":"bg-sky-50 text-sky-600 hover:bg-sky-100 focus-visible:ring-sky-400"}`,children:o==="loading"?e.jsx(G,{className:"h-4 w-4 animate-spin"}):o==="playing"?e.jsx(de,{className:"h-4 w-4 fill-current"}):o==="error"?e.jsx(ge,{className:"h-4 w-4"}):e.jsx(xe,{className:"ml-px h-4 w-4 fill-current"})}),e.jsxs("div",{className:"min-w-0 flex flex-1 items-center gap-2",children:[e.jsx("div",{className:"flex h-5 flex-1 items-center gap-0.5","aria-hidden":"true",children:Pe.map((d,f)=>e.jsx("span",{className:`w-0.5 rounded-full ${o==="playing"?"animate-pulse":""} ${n?"bg-sky-100":o==="error"?"bg-red-300":"bg-sky-400"}`,style:{height:`${d}px`,animationDelay:`${f*45}ms`}},`${u}-${f}`))}),e.jsx("span",{className:`shrink-0 font-mono text-[11px] font-semibold tabular-nums ${n?"text-sky-100":o==="error"?"text-red-500":"text-slate-500"}`,children:$}),e.jsx("span",{className:"sr-only",children:P})]})]})},X0=[["尊嘟假嘟","https://img.alicdn.com/imgextra/i2/O1CN01hWzOgD1KcmFEIaGwE_!!6000000001185-2-tps-64-64.png_110x10000.jpg_.webp"],["鸡哔你","https://img.alicdn.com/imgextra/i1/O1CN01P9TVJl1JCqCZcQIdW_!!6000000000993-2-tps-64-64.png_110x10000.jpg_.webp"],["谁懂啊","https://img.alicdn.com/imgextra/i1/O1CN01r9qUnx1g3tcrtSmcs_!!6000000004087-2-tps-64-64.png_110x10000.jpg_.webp"],["吗喽","https://img.alicdn.com/imgextra/i4/O1CN01dTynZh1LnbIYTHI1D_!!6000000001344-2-tps-64-64.png_110x10000.jpg_.webp"],["功德+1","https://img.alicdn.com/imgextra/i1/O1CN01l1G5pS1IVn37pfQJi_!!6000000000899
Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{d as S,j as e,a as n}from"./react-vendor-Bf9ELcll.js";import{L as oe}from"./vendor-BE-_xUHH.js";import{B as pe}from"./audio-codec-mjVr_wwJ.js";import{L as $,al as de,am as me,q as ge,an as xe,ao as ue,M as z0,I as he,R as _e,ad as D0,k as be,ap as fe,t as W0,aq as je,ar as we,ai as J0,X as Ne}from"./icons-vendor-B5fJPoU1.js";import{g as U0,p as ye,b as Q0,m as V0,s as Ce,d as Oe,e as ve,f as ke,h as Z0}from"./index-C6RECy_0.js";const F0="ydisks:chat-audio-play",Se=[6,10,15,8,17,12,7,16,11,6,14,9];function Re(r){const c=r.trim();if(typeof location>"u"||location.protocol!=="https:")return c;try{const a=new URL(c);return a.protocol==="http:"&&a.hostname.endsWith(".aliyuncs.com")&&(a.protocol="https:"),a.toString()}catch{return c}}function q0(r){const c=Number.isFinite(r)?Math.max(0,Math.floor(r)):0,a=Math.floor(c/60),i=c%60;return`${a}:${i.toString().padStart(2,"0")}`}function T0(r){window.dispatchEvent(new CustomEvent(F0,{detail:r}))}const Ee=({messageKey:r,src:c,outgoing:a,initialDuration:i=0})=>{const x=S.useRef(null),N=S.useRef(0),[d,R]=S.useState("idle"),[E,L]=S.useState(i),[W,q]=S.useState(0);S.useEffect(()=>(()=>{var u;N.current+=1,(u=x.current)==null||u.destroy(),x.current=null}),[c]),S.useEffect(()=>{L(Math.max(0,i))},[i]),S.useEffect(()=>{const u=b=>{const j=b.detail,y=x.current;j!==r&&(y!=null&&y.isPlaying())&&y.pause()};return window.addEventListener(F0,u),(()=>window.removeEventListener(F0,u))},[r]),S.useEffect(()=>{if(d!=="playing")return;const u=window.setInterval(()=>{const b=x.current;b&&q(b.getCurrentPosition())},100);return(()=>window.clearInterval(u))},[d]);const T=(u,b)=>{const j=()=>N.current===b&&x.current===u;u.onPlay(()=>{j()&&R("playing")}),u.onResume(()=>{j()&&R("playing")}),u.onPause(()=>{j()&&R("paused")}),u.onStop(()=>{j()&&(R("idle"),q(0))}),u.onEnded(()=>{j()&&(R("idle"),q(0))})},n0=async()=>{var j;const u=x.current;if(u!=null&&u.isPlaying()){u.pause();return}if(u!=null&&u.isPaused()){T0(r),u.resume();return}if(u!=null&&u.isInit()){T0(r),u.play();return}if(d==="loading")return;const b=N.current+1;N.current=b,R("loading"),q(0);try{const y=new pe;if(x.current=y,T(y,b),await y.initWithUrl(Re(c)),N.current!==b||x.current!==y){y.destroy();return}L(y.getDuration()||Math.max(0,i)),T0(r),y.play()}catch{if(N.current!==b)return;(j=x.current)==null||j.destroy(),x.current=null,R("error"),q(0)}},A=d==="playing"||d==="paused"?W:E,G=E>0?d==="playing"||d==="paused"?`${q0(A)} / ${q0(E)}`:q0(E):"--:--",D=d==="loading"?"正在解码":d==="playing"?"正在播放":d==="paused"?"已暂停":d==="error"?"加载失败,点击重试":"语音消息",k=d==="playing"?"暂停语音消息":d==="paused"?"继续播放语音消息":d==="error"?"重新加载语音消息":d==="loading"?"正在加载语音消息":"播放语音消息";return e.jsxs("div",{className:`flex h-11 min-w-56 items-center gap-2 rounded-2xl border px-2 shadow-sm ${a?"rounded-br-md border-sky-400 bg-sky-500 text-white":"rounded-bl-md border-slate-200 bg-white text-slate-800"}`,children:[e.jsx("button",{type:"button","aria-label":k,title:k,disabled:d==="loading",onClick:(()=>void n0()),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-wait ${a?"bg-white text-sky-600 hover:bg-sky-50 focus-visible:ring-white":"bg-sky-50 text-sky-600 hover:bg-sky-100 focus-visible:ring-sky-400"}`,children:d==="loading"?e.jsx($,{className:"h-4 w-4 animate-spin"}):d==="playing"?e.jsx(de,{className:"h-4 w-4 fill-current"}):d==="error"?e.jsx(me,{className:"h-4 w-4"}):e.jsx(ge,{className:"ml-px h-4 w-4 fill-current"})}),e.jsxs("div",{className:"min-w-0 flex flex-1 items-center gap-2",children:[e.jsx("div",{className:"flex h-5 flex-1 items-center gap-0.5","aria-hidden":"true",children:Se.map((u,b)=>e.jsx("span",{className:`w-0.5 rounded-full ${d==="playing"?"animate-pulse":""} ${a?"bg-sky-100":d==="error"?"bg-red-300":"bg-sky-400"}`,style:{height:`${u}px`,animationDelay:`${b*45}ms`}},`${r}-${b}`))}),e.jsx("span",{className:`shrink-0 font-mono text-[11px] font-semibold tabular-nums ${a?"text-sky-100":d==="error"?"text-red-500":"text-slate-500"}`,children:G}),e.jsx("span",{className:"sr-only",children:D})]})]})},X0=[["尊嘟假嘟","https://img.alicdn.com/imgextra/i2/O1CN01hWzOgD1KcmFEIaGwE_!!6000000001185-2-tps-64-64.png_110x10000.jpg_.webp"],["鸡哔你","https://img.alicdn.com/imgextra/i1/O1CN01P9TVJl1JCqCZcQIdW_!!6000000000993-2-tps-64-64.png_110x10000.jpg_.webp"],["谁懂啊","https://img.alicdn.com/imgextra/i1/O1CN01r9qUnx1g3tcrtSmcs_!!6000000004087-2-tps-64-64.png_110x10000.jpg_.webp"],["吗喽","https://img.alicdn.com/imgextra/i4/O1CN01dTynZh1LnbIYTHI1D_!!6000000001344-2-tps-64-64.png_110x10000.jpg_.webp"],["功德+1","https://img.alicdn.com/imgextra/i1/O1CN01l1G5pS1IVn37pfQJi_!!6000000000899-2-tps-64-64.png_110x10000.jpg_.webp"],["city不city啊","https://img.alicdn.com/imgextra/i2/O1CN01zRjPTR29lWHqabmDA_!!6000000008108-2-tps-64-64.png
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{j as e,a as c}from"./react-vendor-Bf9ELcll.js";import{f as ge}from"./dateTime-DDi7rqpW.js";import{l as xe,m as he,n as se,D as pe,d as be,o as fe,p as ae,E as ye,q as je}from"./icons-vendor-BSp7PTZg.js";import{R as P,B as ve,X as re,Y as ne,T as W,a as Ne,C as X,A as we,b as _e,c as ke,P as le,d as oe,L as De}from"./charts-vendor-DBu_rVrn.js";import{r as M,c as K}from"./chat-metadata-74T0w35U.js";import{c as ue,o as Se}from"./contract-COFcZjyb.js";import"./vendor-BE-_xUHH.js";const F=t=>{const a=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0");return`${a}-${s}-${l}`},J=(t,a)=>{const s=new Date(t);return s.setHours(12,0,0,0),s.setDate(s.getDate()+a),s},H=(t,a)=>({startDate:F(J(t,-(a-1))),endDate:F(t)}),me=(t,a=new Date,s="",l="")=>{if(t==="custom"&&s&&l){if(s>l)throw new Error("开始日期不能晚于结束日期");return{startDate:s,endDate:l}}return t==="yesterday"?H(J(a,-1),1):H(a,t==="3days"?3:t==="30days"?30:t==="today"?1:7)},Ce=t=>{const a=new Date(`${t.startDate}T12:00:00`),s=new Date(`${t.endDate}T12:00:00`),l=Math.round((s.getTime()-a.getTime())/864e5)+1,n=J(a,-1);return H(n,l)},i=(t,a)=>a===void 0?`rgb(var(--color-${t}))`:`rgb(var(--color-${t}) / ${a})`,$e=({chartData:t,selectedRangeLabel:a,totalAmount:s})=>e.jsxs("div",{className:"ios-card p-8 rounded-xl",children:[e.jsxs("div",{className:"mb-10",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"营收趋势分析"}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:[a,"的销售额走势"]})]}),e.jsx("div",{className:"dashboard-revenue-chart h-[350px] w-full",children:t.length===0||s===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(xe,{className:"w-16 h-16 mb-4 opacity-20"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无营收数据"}),e.jsx("p",{className:"text-sm mt-2",children:"所选时间范围内暂无订单记录"})]}):t.length<=2?e.jsx(P,{width:"100%",height:"100%",children:e.jsxs(ve,{data:t,margin:{top:30,right:20,left:0,bottom:30},barCategoryGap:"45%",children:[e.jsx(re,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:i("neutral-700"),fontSize:14,fontWeight:600},dy:10}),e.jsx(ne,{axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500},tickFormatter:(l=>`¥${l}`)}),e.jsx(W,{contentStyle:{backgroundColor:i("white"),borderRadius:"8px",border:`1px solid ${i("neutral-200")}`,boxShadow:"var(--shadow-xl)",padding:"12px 16px"},labelStyle:{color:i("neutral-500"),fontWeight:500},itemStyle:{color:i("brand"),fontWeight:600},cursor:{fill:i("brand",.08)},formatter:(l=>[`¥${Number(l).toFixed(2)}`,"营收"])}),e.jsx(Ne,{dataKey:"amount",fill:i("brand"),maxBarSize:72,radius:[12,12,0,0],activeBar:!1,stroke:"none",strokeWidth:0,children:t.map((l,n)=>e.jsx(X,{fill:i("brand"),stroke:"none",strokeWidth:0},`cell-${n}`))})]})}):e.jsx(P,{width:"100%",height:"100%",children:e.jsxs(we,{data:t,margin:{top:10,right:10,left:-20,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"colorAmount",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:i("brand"),stopOpacity:.5}),e.jsx("stop",{offset:"95%",stopColor:i("brand"),stopOpacity:0})]})}),e.jsx(re,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500},dy:15}),e.jsx(ne,{axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500}}),e.jsx(_e,{vertical:!1,stroke:i("neutral-100"),strokeDasharray:"3 3"}),e.jsx(W,{contentStyle:{backgroundColor:i("white"),borderRadius:"8px",border:`1px solid ${i("neutral-200")}`,boxShadow:"var(--shadow-xl)",padding:"12px 16px"},labelStyle:{color:i("neutral-500"),fontWeight:500},itemStyle:{color:i("brand"),fontWeight:600},cursor:{stroke:i("brand"),strokeWidth:2,strokeDasharray:"4 4"}}),e.jsx(ke,{type:"monotone",dataKey:"amount",stroke:i("brand"),strokeWidth:4,fillOpacity:1,fill:"url(#colorAmount)",activeDot:{r:8,fill:i("white"),stroke:i("brand"),strokeWidth:2}})]})})})]}),ie=t=>{const a=String(t||"");return a==="paid"?"pending_ship":["processing","pending_ship","shipped","completed","cancelled","refunding"].includes(a)?a:"unknown"},Re=async t=>M(a=>K.GET("/api/v1/analytics/dashboard",{signal:a}),t),Le=async(t,a)=>{const s=await M(n=>K.GET("/api/v1/items",{params:{query:{cookie_id:t}},signal:n}),a);return ue(s,["items","data","results"]).map(n=>({...n,id:n.id||`${n.cookie_id}-${n.item_id}`,is_multi_spec:n.is_multi_spec===!0||n.is_multi_spec===1,multi_quantity_delivery:n.multi_quantity_delivery===!0||n.multi_quantity_delivery===1}))},ce=async(t=7,a)=>{let s;if(typeof t=="number"){const l=new Date,n=new Date;n.setDate(n.getDate()-t),s={start_date:F(n),end_date:F(l)}}else s=t;return M(l=>K.GET("/api/v1/analytics/orders",{params:{query:{...s,timezone_offset_minutes:-new Date().getTimezoneOffset()}},signal:l}),a)},Te=async(t,a)=>{const s=await M(u=>K.GET("/api/v1/analytics/orders/valid",{params:{query:{...t,tiLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{j as e,a as c}from"./react-vendor-Bf9ELcll.js";import{f as ge}from"./dateTime-DDi7rqpW.js";import{j as xe,k as he,l as se,D as pe,c as be,P as fe,m as ae,E as ye,T as je}from"./icons-vendor-B5fJPoU1.js";import{R as q,B as ve,X as re,Y as ne,T as W,a as Ne,C as X,A as we,b as _e,c as ke,P as le,d as oe,L as De}from"./charts-vendor-DBu_rVrn.js";import{r as M,c as K}from"./index-C6RECy_0.js";import{c as ue,o as Se}from"./contract-COFcZjyb.js";import"./vendor-BE-_xUHH.js";const F=t=>{const a=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0");return`${a}-${s}-${l}`},J=(t,a)=>{const s=new Date(t);return s.setHours(12,0,0,0),s.setDate(s.getDate()+a),s},H=(t,a)=>({startDate:F(J(t,-(a-1))),endDate:F(t)}),me=(t,a=new Date,s="",l="")=>{if(t==="custom"&&s&&l){if(s>l)throw new Error("开始日期不能晚于结束日期");return{startDate:s,endDate:l}}return t==="yesterday"?H(J(a,-1),1):H(a,t==="3days"?3:t==="30days"?30:t==="today"?1:7)},Ce=t=>{const a=new Date(`${t.startDate}T12:00:00`),s=new Date(`${t.endDate}T12:00:00`),l=Math.round((s.getTime()-a.getTime())/864e5)+1,n=J(a,-1);return H(n,l)},i=(t,a)=>a===void 0?`rgb(var(--color-${t}))`:`rgb(var(--color-${t}) / ${a})`,$e=({chartData:t,selectedRangeLabel:a,totalAmount:s})=>e.jsxs("div",{className:"ios-card p-8 rounded-xl",children:[e.jsxs("div",{className:"mb-10",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"营收趋势分析"}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:[a,"的销售额走势"]})]}),e.jsx("div",{className:"dashboard-revenue-chart h-[350px] w-full",children:t.length===0||s===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(xe,{className:"w-16 h-16 mb-4 opacity-20"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无营收数据"}),e.jsx("p",{className:"text-sm mt-2",children:"所选时间范围内暂无订单记录"})]}):t.length<=2?e.jsx(q,{width:"100%",height:"100%",children:e.jsxs(ve,{data:t,margin:{top:30,right:20,left:0,bottom:30},barCategoryGap:"45%",children:[e.jsx(re,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:i("neutral-700"),fontSize:14,fontWeight:600},dy:10}),e.jsx(ne,{axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500},tickFormatter:(l=>`¥${l}`)}),e.jsx(W,{contentStyle:{backgroundColor:i("white"),borderRadius:"8px",border:`1px solid ${i("neutral-200")}`,boxShadow:"var(--shadow-xl)",padding:"12px 16px"},labelStyle:{color:i("neutral-500"),fontWeight:500},itemStyle:{color:i("brand"),fontWeight:600},cursor:{fill:i("brand",.08)},formatter:(l=>[`¥${Number(l).toFixed(2)}`,"营收"])}),e.jsx(Ne,{dataKey:"amount",fill:i("brand"),maxBarSize:72,radius:[12,12,0,0],activeBar:!1,stroke:"none",strokeWidth:0,children:t.map((l,n)=>e.jsx(X,{fill:i("brand"),stroke:"none",strokeWidth:0},`cell-${n}`))})]})}):e.jsx(q,{width:"100%",height:"100%",children:e.jsxs(we,{data:t,margin:{top:10,right:10,left:-20,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"colorAmount",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:i("brand"),stopOpacity:.5}),e.jsx("stop",{offset:"95%",stopColor:i("brand"),stopOpacity:0})]})}),e.jsx(re,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500},dy:15}),e.jsx(ne,{axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500}}),e.jsx(_e,{vertical:!1,stroke:i("neutral-100"),strokeDasharray:"3 3"}),e.jsx(W,{contentStyle:{backgroundColor:i("white"),borderRadius:"8px",border:`1px solid ${i("neutral-200")}`,boxShadow:"var(--shadow-xl)",padding:"12px 16px"},labelStyle:{color:i("neutral-500"),fontWeight:500},itemStyle:{color:i("brand"),fontWeight:600},cursor:{stroke:i("brand"),strokeWidth:2,strokeDasharray:"4 4"}}),e.jsx(ke,{type:"monotone",dataKey:"amount",stroke:i("brand"),strokeWidth:4,fillOpacity:1,fill:"url(#colorAmount)",activeDot:{r:8,fill:i("white"),stroke:i("brand"),strokeWidth:2}})]})})})]}),ie=t=>{const a=String(t||"");return a==="paid"?"pending_ship":["processing","pending_ship","shipped","completed","cancelled","refunding"].includes(a)?a:"unknown"},Re=async t=>M(a=>K.GET("/api/v1/analytics/dashboard",{signal:a}),t),Le=async(t,a)=>{const s=await M(n=>K.GET("/api/v1/items",{params:{query:{cookie_id:t}},signal:n}),a);return ue(s,["items","data","results"]).map(n=>({...n,id:n.id||`${n.cookie_id}-${n.item_id}`,is_multi_spec:n.is_multi_spec===!0||n.is_multi_spec===1,multi_quantity_delivery:n.multi_quantity_delivery===!0||n.multi_quantity_delivery===1}))},ce=async(t=7,a)=>{let s;if(typeof t=="number"){const l=new Date,n=new Date;n.setDate(n.getDate()-t),s={start_date:F(n),end_date:F(l)}}else s=t;return M(l=>K.GET("/api/v1/analytics/orders",{params:{query:{...s,timezone_offset_minutes:-new Date().getTimezoneOffset()}},signal:l}),a)},Te=async(t,a)=>{const s=await M(u=>K.GET("/api/v1/analytics/orders/valid",{params:{query:{...t,timezone_oLine truncated
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
import{j as e,a as n,b as we}from"./react-vendor-Bf9ELcll.js";import{r as B,c as q,a as Qe,A as gt}from"./index-C6RECy_0.js";import{c as et}from"./contract-COFcZjyb.js";import{a3 as yt,U as $e,R as Se,N as De,a4 as Pe,a5 as _e,V as ft,y as jt,B as vt,a6 as Oe,a7 as Nt,a8 as wt,A as _t,d as kt,X as ye,o as Ct,a9 as Ue,I as ze}from"./icons-vendor-B5fJPoU1.js";import"./vendor-BE-_xUHH.js";const Ke="ydisks-amap-js-api",It="c9b68d4ce9a2a97f22a4a439404488ca";let fe=null;const St=()=>It,Pt=()=>window.AMap?Promise.resolve(window.AMap):fe||(fe=new Promise((s,a)=>{const r=document.getElementById(Ke),d=r||document.createElement("script"),u=()=>{window.__ydisksAmapLoaded=void 0,window.clearTimeout(G)},f=()=>{window.AMap?(u(),s(window.AMap)):(u(),a(new Error("高德地图 API 加载完成但未找到 AMap 对象")))},G=window.setTimeout(()=>{u(),a(new Error("高德地图 API 加载超时,请检查网络或 VITE_AMAP_JS_KEY 配置"))},15e3);window.__ydisksAmapLoaded=f,d.id=Ke,d.async=!0,d.src=`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(St())}&plugin=AMap.PlaceSearch&callback=__ydisksAmapLoaded`,d.onerror=()=>{u(),a(new Error("高德地图 API 加载失败,请检查网络或 VITE_AMAP_JS_KEY 配置"))},r||document.head.appendChild(d)}).catch(s=>{throw fe=null,s}),fe),ke=s=>Number.isFinite(s)&&s!==0,Bt=s=>{var u,f;const a=Number((u=s.location)==null?void 0:u.lng),r=Number((f=s.location)==null?void 0:f.lat),d={area:String(s.adname||"").trim(),city:String(s.cityname||"").trim(),division_id:String(s.adcode||"").trim(),longitude:a,latitude:r,poi_id:String(s.id||"").trim(),poi_name:String(s.name||"").trim(),province:String(s.pname||"").trim()};return!d.division_id||!d.province||!d.city||!d.poi_id||!d.poi_name||!ke(a)||!ke(r)||a<-180||a>180||r<-90||r>90?null:d},qt=async(s,a,r={})=>{if(!ke(s)||!ke(a)||s<-180||s>180||a<-90||a>90)throw new Error("经纬度无效");const d=await Pt();return new Promise((u,f)=>{var $,R;let G=!1;const k=Math.max(1,r.timeoutMs??1e4),M=F=>{var p;G||(G=!0,globalThis.clearTimeout(W),(p=r.signal)==null||p.removeEventListener("abort",I),F())},I=()=>M(()=>f(new DOMException("aborted","AbortError"))),W=globalThis.setTimeout(()=>M(()=>f(new Error("高德地图附近地址查询超时,请稍后重试"))),k);if(($=r.signal)!=null&&$.aborted){I();return}(R=r.signal)==null||R.addEventListener("abort",I,{once:!0}),new d.PlaceSearch({extensions:"all",pageSize:10}).searchNearBy("",[s,a],1e3,(F,p)=>{var x;if(G)return;if(F!=="complete"){if(F==="no_data"){M(()=>u([]));return}M(()=>f(new Error("高德地图附近地址查询失败,请稍后重试")));return}const E=(((x=p==null?void 0:p.poiList)==null?void 0:x.pois)||[]).map(Bt).filter(j=>j!==null);M(()=>u(E))})})},Et=async s=>B(a=>q.GET("/api/v1/accounts/details",{signal:a}),s),Je=async s=>B(a=>q.GET("/api/v1/automation-rules",{signal:a}),s),Lt=(s,a,r)=>qt(s,a,r),Be=(s,a)=>{if(s instanceof gt)switch(s.code){case"stock_permission_missing":return"发布失败:该账号没有库存发布权限,无法按库存数量发布商品。请换账号或先在闲鱼确认库存能力。";case"conflict":case"item_conflict":return"商品状态已发生变化,请刷新后重试。";case"external_result_unknown":case"manual_review_required":return"平台结果暂时无法确认,请先人工核对闲鱼状态,再决定是否重试。";case"retryable":case"temporarily_unavailable":return"平台暂时不可用,请稍后重试。";default:return s.message||a}if(s instanceof Error)return s.message;const r=typeof s=="object"&&s!==null&&"message"in s?s.message:void 0;return typeof r=="string"?r:a},qe=s=>s===!0||s===1||s==="1",Ze=async(s,a)=>{const r=await B(u=>q.GET("/api/v1/items",{params:{query:{cookie_id:s}},signal:u}),a);return et(r,["items","data","results"]).map(u=>({...u,id:u.id||`${u.cookie_id}-${u.item_id}`,is_multi_spec:qe(u.is_multi_spec),is_multi_qty_ship:qe(u.is_multi_qty_ship??u.multi_quantity_delivery),multi_quantity_delivery:qe(u.multi_quantity_delivery??u.is_multi_qty_ship)}))},At=async s=>B(a=>q.POST("/api/v1/items/get-all-from-account",{body:{cookie_id:s},signal:a})),Mt=async(s,a)=>B(r=>q.DELETE("/api/v1/items/{cookie_id}/{item_id}",{params:{path:{cookie_id:s,item_id:a}},signal:r})),Rt=async(s,a)=>B(r=>q.POST("/api/v1/items/{cookie_id}",{params:{path:{cookie_id:s}},body:a,signal:r})),Ft=async s=>{const a=new FormData;a.set("cookie_id",s.cookie_id),a.set("title",s.title),a.set("description",s.description),a.set("price",s.price),a.set("original_price",s.original_price||""),a.set("quantity",String(s.quantity)),a.set("postage_mode",s.postage_mode),a.set("postage",s.postage||""),s.location&&a.set("location",JSON.stringify(s.location));for(const r of s.images)a.append("images",r);return B(r=>q.POST("/api/v1/items/publish",{body:Qe(a),signal:r}))},Gt=async(s,a,r)=>B(d=>q.POST("/api/v1/items/publish-categories/recommend",{body:{cookie_id:s,keyword:a},signal:d}),r),Tt=async(s,a)=>{const r=new FormData;return r.set("file",s.file),s.imagesZip&&r.seLine truncated
|
||||
`),ee=new Blob(["\uFEFF"+A],{type:"text/csv;charset=utf-8"}),T=URL.createObjectURL(ee),P=document.createElement("a");P.href=T,P.download="批量铺货模板.csv",document.body.appendChild(P),P.click(),P.remove(),URL.revokeObjectURL(T)},[]),i=n.useCallback(()=>{y(c=>({...c,cookie_id:s||c.cookie_id})),p(!0)},[s]),h=n.useCallback(()=>{v(c=>({...c,cookie_id:s||c.cookie_id})),x(!0)},[s]),L=n.useCallback(async c=>{if(!(c?s:g.cookie_id))return alert("请先选择发布账号");if(!navigator.geolocation)return alert("当前浏览器不支持定位");O();const A=new AbortController;Q.current=A;const ee=++K.current;S(!0);try{const T=await new Promise((ue,he)=>{const Ce=te=>ue(te),ie=te=>he(te);navigator.geolocation.getCurrentPosition(Ce,ie,{enableHighAccuracy:!0,timeout:15e3,maximumAge:6e4})});if(A.signal.aborted||ee!==K.current)return;const P=await Lt(T.coords.longitude,T.coords.latitude,{signal:A.signal});if(A.signal.aborted||ee!==K.current)return;if(!P.length)throw new Error("当前位置附近没有可用的高德发货地,请稍后重试");c?(G(P),k(P[0])):(H(P),z(P[0]))}catch(T){if(A.signal.aborted||ee!==K.current)return;if(typeof T=="object"&&T!==null&&"code"in T){const P=T;alert(P.code===P.PERMISSION_DENIED?"定位权限被拒绝,请在浏览器设置中允许定位":"无法获取当前位置,请稍后重试")}else alert(Be(T,"获取发货地失败"))}finally{ee===K.current&&(Q.current=null,S(!1))}},[O,g.cookie_id,s,k,G]);return{selectedAccount:s,setSelectedAccount:a,loading:M,publishing:W,showEditModal:$,setShowEditModal:R,showAddModal:F,setShowAddModal:p,showPublishModal:E,setShowPublishModal:x,locationLoading:j,publishLocations:Y,setPublishLocations:H,publishLocation:X,setPublishLocation:z,selectedItem:D,editForm:C,setEditForm:le,addForm:b,setAddForm:y,publishForm:g,setPublishForm:v,publishImagePreviews:m,handleSync:ae,handleEdit:de,handleSaveEdit:ne,handleDelete:xe,handleAddItem:me,handlePublishItem:ve,downloadPublishTemplate:l,openAddModal:i,openPublishModal:h,locateForPublish:L}},Xt=s=>{const a=String(s||"").trim();return a?/^[¥¥]/.test(a)?a:`¥${a}`:"-"},ls=({onConfigureDelivery:s})=>{const[a,r]=n.useState([]),[d,u]=n.useState([]),[f,G]=n.useState([]),[k,M]=n.useState(""),[I,W]=n.useState(""),U=n.useRef(0),$=n.useRef(0),R=n.useCallback(async()=>{const t=++U.current,o=await Ze();t===U.current&&r(o)},[]),F=n.useCallback(async()=>{const t=++$.current,o=await Je();t===$.current&&u(o)},[]),p=Yt({selectedAccount:k,loadItems:R,loadShippingRules:F}),{showBatchModal:E,batchLoading:x,batchPhase:j,batchFile:S,setBatchFile:Y,batchImagesZip:H,setBatchImagesZip:X,batchCategoryKeyword:z,setBatchCategoryKeyword:D,batchCategoryLoading:Z,batchFallbackCategory:C,setBatchFallbackCategory:le,batchPreview:b,batchDetail:y,recentBatch:g,setRecentBatch:v,batchLocations:m,batchLocation:re,batchPublishIntervalSeconds:Q,setBatchPublishIntervalSeconds:K,setBatchLocations:O,setBatchLocation:ae,openBatchModal:de,handleRecommendBatchCategory:ne,openRecentBatchResult:xe,handlePreviewBatch:me,handleStartBatch:ve,handleCancelBatch:l,abandonBatchPreview:i,closeBatchModal:h,handleRetryBatchFailed:L}=p,c=Ht({selectedAccount:k,setSelectedAccount:M,setItems:r,loadItems:R,loadShippingRules:F,onConfigureDelivery:s,setBatchLocations:O,setBatchLocation:ae}),{loading:N,publishing:A,showEditModal:ee,setShowEditModal:T,showAddModal:P,setShowAddModal:ue,showPublishModal:he,setShowPublishModal:Ce,locationLoading:ie,publishLocations:te,setPublishLocations:st,publishLocation:at,setPublishLocation:Ee,selectedItem:Le,editForm:se,setEditForm:Ne,addForm:J,setAddForm:pe,publishForm:w,setPublishForm:V,publishImagePreviews:Ae,handleSync:lt,handleEdit:rt,handleSaveEdit:nt,handleDelete:it,handleAddItem:ct,handlePublishItem:ot,downloadPublishTemplate:dt,openAddModal:xt,openPublishModal:mt,locateForPublish:Me}=c;n.useEffect(()=>{const t=new AbortController,o=++U.current,_=++$.current;let ge=!0;return Promise.all([Et({signal:t.signal}),Ze(void 0,{signal:t.signal}),Je({signal:t.signal}),tt(20,{signal:t.signal})]).then(([ce,ht,pt,Te])=>{if(!ge||t.signal.aborted||o!==U.current||_!==$.current)return;G(ce),r(ht),u(pt);const bt=Te.find(Ie=>["running","canceling"].includes(Ie.status))||Te.find(Ie=>Ie.status!=="preview");v(bt||null)}).catch(ce=>{t.signal.aborted||console.error("加载商品配置失败:",ce)}),(()=>{ge=!1,t.abort()})},[]);const ut=t=>d.filter(o=>o.cookie_id===t.cookie_id&&o.item_id===t.item_id).length>0?d.filter(o=>o.cookie_id===t.cookie_id&&o.item_id===t.item_id):d.filter(o=>o.cookie_id===t.cookie_id&&!o.item_id),Re=n.useMemo(()=>new Map(f.map(t=>[t.id,t])),[f]),Fe=n.useMemo(()=>I?a.filter(t=>t.cookie_id===I):a,[I,a]),be=t=>{const o=Re.get(t),_=(o==null?void 0:o.remark)||(o==null?void 0:o.nickname);return _?`${_} · ${t.slice(0,6)}`:`账号 ${t.slice(0,8)}`},Ge=t=>{const o=Re.get(t);return(o==null?void 0:o.remark)||(o==null?void 0:o.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{
Line truncated
|
||||
import{j as e,a as n,b as we}from"./react-vendor-Bf9ELcll.js";import{r as B,c as q,b as Qe,A as gt}from"./chat-metadata-74T0w35U.js";import{c as et}from"./contract-COFcZjyb.js";import{a6 as yt,U as $e,R as Ie,P as De,a7 as Pe,a8 as _e,_ as ft,T as jt,B as vt,a9 as Oe,aa as Nt,ab as wt,A as _t,f as kt,X as ye,s as Ct,ac as Ue,V as ze}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";const Ke="ydisks-amap-js-api",St="c9b68d4ce9a2a97f22a4a439404488ca";let fe=null;const It=()=>St,Pt=()=>window.AMap?Promise.resolve(window.AMap):fe||(fe=new Promise((s,a)=>{const r=document.getElementById(Ke),d=r||document.createElement("script"),u=()=>{window.__ydisksAmapLoaded=void 0,window.clearTimeout(G)},f=()=>{window.AMap?(u(),s(window.AMap)):(u(),a(new Error("高德地图 API 加载完成但未找到 AMap 对象")))},G=window.setTimeout(()=>{u(),a(new Error("高德地图 API 加载超时,请检查网络或 VITE_AMAP_JS_KEY 配置"))},15e3);window.__ydisksAmapLoaded=f,d.id=Ke,d.async=!0,d.src=`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(It())}&plugin=AMap.PlaceSearch&callback=__ydisksAmapLoaded`,d.onerror=()=>{u(),a(new Error("高德地图 API 加载失败,请检查网络或 VITE_AMAP_JS_KEY 配置"))},r||document.head.appendChild(d)}).catch(s=>{throw fe=null,s}),fe),ke=s=>Number.isFinite(s)&&s!==0,Bt=s=>{var u,f;const a=Number((u=s.location)==null?void 0:u.lng),r=Number((f=s.location)==null?void 0:f.lat),d={area:String(s.adname||"").trim(),city:String(s.cityname||"").trim(),division_id:String(s.adcode||"").trim(),longitude:a,latitude:r,poi_id:String(s.id||"").trim(),poi_name:String(s.name||"").trim(),province:String(s.pname||"").trim()};return!d.division_id||!d.province||!d.city||!d.poi_id||!d.poi_name||!ke(a)||!ke(r)||a<-180||a>180||r<-90||r>90?null:d},qt=async(s,a,r={})=>{if(!ke(s)||!ke(a)||s<-180||s>180||a<-90||a>90)throw new Error("经纬度无效");const d=await Pt();return new Promise((u,f)=>{var $,R;let G=!1;const k=Math.max(1,r.timeoutMs??1e4),M=F=>{var p;G||(G=!0,globalThis.clearTimeout(W),(p=r.signal)==null||p.removeEventListener("abort",S),F())},S=()=>M(()=>f(new DOMException("aborted","AbortError"))),W=globalThis.setTimeout(()=>M(()=>f(new Error("高德地图附近地址查询超时,请稍后重试"))),k);if(($=r.signal)!=null&&$.aborted){S();return}(R=r.signal)==null||R.addEventListener("abort",S,{once:!0}),new d.PlaceSearch({extensions:"all",pageSize:10}).searchNearBy("",[s,a],1e3,(F,p)=>{var x;if(G)return;if(F!=="complete"){if(F==="no_data"){M(()=>u([]));return}M(()=>f(new Error("高德地图附近地址查询失败,请稍后重试")));return}const E=(((x=p==null?void 0:p.poiList)==null?void 0:x.pois)||[]).map(Bt).filter(j=>j!==null);M(()=>u(E))})})},Et=async s=>B(a=>q.GET("/api/v1/accounts/details",{signal:a}),s),Je=async s=>B(a=>q.GET("/api/v1/automation-rules",{signal:a}),s),Lt=(s,a,r)=>qt(s,a,r),Be=(s,a)=>{if(s instanceof gt)switch(s.code){case"stock_permission_missing":return"发布失败:该账号没有库存发布权限,无法按库存数量发布商品。请换账号或先在闲鱼确认库存能力。";case"conflict":case"item_conflict":return"商品状态已发生变化,请刷新后重试。";case"external_result_unknown":case"manual_review_required":return"平台结果暂时无法确认,请先人工核对闲鱼状态,再决定是否重试。";case"retryable":case"temporarily_unavailable":return"平台暂时不可用,请稍后重试。";default:return s.message||a}if(s instanceof Error)return s.message;const r=typeof s=="object"&&s!==null&&"message"in s?s.message:void 0;return typeof r=="string"?r:a},qe=s=>s===!0||s===1||s==="1",Ze=async(s,a)=>{const r=await B(u=>q.GET("/api/v1/items",{params:{query:{cookie_id:s}},signal:u}),a);return et(r,["items","data","results"]).map(u=>({...u,id:u.id||`${u.cookie_id}-${u.item_id}`,is_multi_spec:qe(u.is_multi_spec),is_multi_qty_ship:qe(u.is_multi_qty_ship??u.multi_quantity_delivery),multi_quantity_delivery:qe(u.multi_quantity_delivery??u.is_multi_qty_ship)}))},At=async s=>B(a=>q.POST("/api/v1/items/get-all-from-account",{body:{cookie_id:s},signal:a})),Mt=async(s,a)=>B(r=>q.DELETE("/api/v1/items/{cookie_id}/{item_id}",{params:{path:{cookie_id:s,item_id:a}},signal:r})),Rt=async(s,a)=>B(r=>q.POST("/api/v1/items/{cookie_id}",{params:{path:{cookie_id:s}},body:a,signal:r})),Ft=async s=>{const a=new FormData;a.set("cookie_id",s.cookie_id),a.set("title",s.title),a.set("description",s.description),a.set("price",s.price),a.set("original_price",s.original_price||""),a.set("quantity",String(s.quantity)),a.set("postage_mode",s.postage_mode),a.set("postage",s.postage||""),s.location&&a.set("location",JSON.stringify(s.location));for(const r of s.images)a.append("images",r);return B(r=>q.POST("/api/v1/items/publish",{body:Qe(a),signal:r}))},Gt=async(s,a,r)=>B(d=>q.POST("/api/v1/items/publish-categories/recommend",{body:{cookie_id:s,keyword:a},signal:d}),r),Tt=async(s,a)=>{const r=new FormData;return r.set("file",s.file),s.imagesZLine truncated
|
||||
`),ee=new Blob(["\uFEFF"+A],{type:"text/csv;charset=utf-8"}),T=URL.createObjectURL(ee),P=document.createElement("a");P.href=T,P.download="批量铺货模板.csv",document.body.appendChild(P),P.click(),P.remove(),URL.revokeObjectURL(T)},[]),i=n.useCallback(()=>{y(c=>({...c,cookie_id:s||c.cookie_id})),p(!0)},[s]),h=n.useCallback(()=>{v(c=>({...c,cookie_id:s||c.cookie_id})),x(!0)},[s]),L=n.useCallback(async c=>{if(!(c?s:g.cookie_id))return alert("请先选择发布账号");if(!navigator.geolocation)return alert("当前浏览器不支持定位");O();const A=new AbortController;Q.current=A;const ee=++K.current;I(!0);try{const T=await new Promise((ue,he)=>{const Ce=te=>ue(te),ie=te=>he(te);navigator.geolocation.getCurrentPosition(Ce,ie,{enableHighAccuracy:!0,timeout:15e3,maximumAge:6e4})});if(A.signal.aborted||ee!==K.current)return;const P=await Lt(T.coords.longitude,T.coords.latitude,{signal:A.signal});if(A.signal.aborted||ee!==K.current)return;if(!P.length)throw new Error("当前位置附近没有可用的高德发货地,请稍后重试");c?(G(P),k(P[0])):(H(P),z(P[0]))}catch(T){if(A.signal.aborted||ee!==K.current)return;if(typeof T=="object"&&T!==null&&"code"in T){const P=T;alert(P.code===P.PERMISSION_DENIED?"定位权限被拒绝,请在浏览器设置中允许定位":"无法获取当前位置,请稍后重试")}else alert(Be(T,"获取发货地失败"))}finally{ee===K.current&&(Q.current=null,I(!1))}},[O,g.cookie_id,s,k,G]);return{selectedAccount:s,setSelectedAccount:a,loading:M,publishing:W,showEditModal:$,setShowEditModal:R,showAddModal:F,setShowAddModal:p,showPublishModal:E,setShowPublishModal:x,locationLoading:j,publishLocations:Y,setPublishLocations:H,publishLocation:X,setPublishLocation:z,selectedItem:D,editForm:C,setEditForm:le,addForm:b,setAddForm:y,publishForm:g,setPublishForm:v,publishImagePreviews:m,handleSync:ae,handleEdit:de,handleSaveEdit:ne,handleDelete:xe,handleAddItem:me,handlePublishItem:ve,downloadPublishTemplate:l,openAddModal:i,openPublishModal:h,locateForPublish:L}},Xt=s=>{const a=String(s||"").trim();return a?/^[¥¥]/.test(a)?a:`¥${a}`:"-"},ls=({onConfigureDelivery:s})=>{const[a,r]=n.useState([]),[d,u]=n.useState([]),[f,G]=n.useState([]),[k,M]=n.useState(""),[S,W]=n.useState(""),U=n.useRef(0),$=n.useRef(0),R=n.useCallback(async()=>{const t=++U.current,o=await Ze();t===U.current&&r(o)},[]),F=n.useCallback(async()=>{const t=++$.current,o=await Je();t===$.current&&u(o)},[]),p=Yt({selectedAccount:k,loadItems:R,loadShippingRules:F}),{showBatchModal:E,batchLoading:x,batchPhase:j,batchFile:I,setBatchFile:Y,batchImagesZip:H,setBatchImagesZip:X,batchCategoryKeyword:z,setBatchCategoryKeyword:D,batchCategoryLoading:Z,batchFallbackCategory:C,setBatchFallbackCategory:le,batchPreview:b,batchDetail:y,recentBatch:g,setRecentBatch:v,batchLocations:m,batchLocation:re,batchPublishIntervalSeconds:Q,setBatchPublishIntervalSeconds:K,setBatchLocations:O,setBatchLocation:ae,openBatchModal:de,handleRecommendBatchCategory:ne,openRecentBatchResult:xe,handlePreviewBatch:me,handleStartBatch:ve,handleCancelBatch:l,abandonBatchPreview:i,closeBatchModal:h,handleRetryBatchFailed:L}=p,c=Ht({selectedAccount:k,setSelectedAccount:M,setItems:r,loadItems:R,loadShippingRules:F,onConfigureDelivery:s,setBatchLocations:O,setBatchLocation:ae}),{loading:N,publishing:A,showEditModal:ee,setShowEditModal:T,showAddModal:P,setShowAddModal:ue,showPublishModal:he,setShowPublishModal:Ce,locationLoading:ie,publishLocations:te,setPublishLocations:st,publishLocation:at,setPublishLocation:Ee,selectedItem:Le,editForm:se,setEditForm:Ne,addForm:J,setAddForm:pe,publishForm:w,setPublishForm:V,publishImagePreviews:Ae,handleSync:lt,handleEdit:rt,handleSaveEdit:nt,handleDelete:it,handleAddItem:ct,handlePublishItem:ot,downloadPublishTemplate:dt,openAddModal:xt,openPublishModal:mt,locateForPublish:Me}=c;n.useEffect(()=>{const t=new AbortController,o=++U.current,_=++$.current;let ge=!0;return Promise.all([Et({signal:t.signal}),Ze(void 0,{signal:t.signal}),Je({signal:t.signal}),tt(20,{signal:t.signal})]).then(([ce,ht,pt,Te])=>{if(!ge||t.signal.aborted||o!==U.current||_!==$.current)return;G(ce),r(ht),u(pt);const bt=Te.find(Se=>["running","canceling"].includes(Se.status))||Te.find(Se=>Se.status!=="preview");v(bt||null)}).catch(ce=>{t.signal.aborted||console.error("加载商品配置失败:",ce)}),(()=>{ge=!1,t.abort()})},[]);const ut=t=>d.filter(o=>o.cookie_id===t.cookie_id&&o.item_id===t.item_id).length>0?d.filter(o=>o.cookie_id===t.cookie_id&&o.item_id===t.item_id):d.filter(o=>o.cookie_id===t.cookie_id&&!o.item_id),Re=n.useMemo(()=>new Map(f.map(t=>[t.id,t])),[f]),Fe=n.useMemo(()=>S?a.filter(t=>t.cookie_id===S):a,[S,a]),be=t=>{const o=Re.get(t),_=(o==null?void 0:o.remark)||(o==null?void 0:o.nickname);return _?`${_} · ${t.slice(0,6)}`:`账号 ${t.slice(0,8)}`},Ge=t=>{const o=Re.get(t);return(o==null?void 0:o.remark)||(o==null?void 0:o.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{j as e,b as _e,a as d}from"./react-vendor-Bf9ELcll.js";import{al as te,S as ae,am as je,y as Q,g as I,L as J,H as Ne,T as ve,x as V,X as ne,J as re,N as le,s as ke,R as we,P as Se}from"./icons-vendor-BSp7PTZg.js";import{r as R,c as B}from"./chat-metadata-74T0w35U.js";import"./vendor-BE-_xUHH.js";const Y=["smtp_server","smtp_port","smtp_user","smtp_password","smtp_from_name","smtp_from_address","smtp_use_tls","smtp_use_ssl"],H=(s,t)=>{if(typeof s=="boolean")return s;if(typeof s=="string"){if(["true","1","yes","on"].includes(s.toLowerCase()))return!0;if(["false","0","no","off"].includes(s.toLowerCase()))return!1}return t},oe=s=>{const t=Object.prototype.hasOwnProperty.call(s,"use_custom_smtp"),a=Y.some(r=>String(s[r]??"").trim()!=="");return{...s,use_custom_smtp:t?H(s.use_custom_smtp,!1):a}},ie=(s,t)=>{const a={...s,use_custom_smtp:!0};for(const r of Y)String(a[r]??"").trim()===""&&t[r]!==void 0&&(a[r]=t[r]);return a.smtp_port||(a.smtp_port=587),a.smtp_from_address||(a.smtp_from_address=a.smtp_user||""),a.smtp_use_tls=H(a.smtp_use_tls,!0),a.smtp_use_ssl=H(a.smtp_use_ssl,!1),a},ce=s=>{const t=oe(s),a={to_email:String(t.to_email??"").trim(),use_custom_smtp:t.use_custom_smtp===!0};if(a.use_custom_smtp)for(const r of Y)a[r]=t[r];return a},$={bark:{label:"Bark",icon:I,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"Ydisks闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app/<key>/这是测试推送内容","URL 路径里 <key> 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:je,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:ae,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"-1001234567890
Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{j as e,b as _e,a as d}from"./react-vendor-Bf9ELcll.js";import{aj as te,ai as ae,ak as je,u as Q,e as I,L as z,w as Ne,y as ve,t as V,X as ne,z as re,F as le,o as ke,R as we,N as Se}from"./icons-vendor-B5fJPoU1.js";import{r as R,c as B}from"./index-C6RECy_0.js";import"./vendor-BE-_xUHH.js";const Y=["smtp_server","smtp_port","smtp_user","smtp_password","smtp_from_name","smtp_from_address","smtp_use_tls","smtp_use_ssl"],H=(s,t)=>{if(typeof s=="boolean")return s;if(typeof s=="string"){if(["true","1","yes","on"].includes(s.toLowerCase()))return!0;if(["false","0","no","off"].includes(s.toLowerCase()))return!1}return t},oe=s=>{const t=Object.prototype.hasOwnProperty.call(s,"use_custom_smtp"),a=Y.some(r=>String(s[r]??"").trim()!=="");return{...s,use_custom_smtp:t?H(s.use_custom_smtp,!1):a}},ie=(s,t)=>{const a={...s,use_custom_smtp:!0};for(const r of Y)String(a[r]??"").trim()===""&&t[r]!==void 0&&(a[r]=t[r]);return a.smtp_port||(a.smtp_port=587),a.smtp_from_address||(a.smtp_from_address=a.smtp_user||""),a.smtp_use_tls=H(a.smtp_use_tls,!0),a.smtp_use_ssl=H(a.smtp_use_ssl,!1),a},ce=s=>{const t=oe(s),a={to_email:String(t.to_email??"").trim(),use_custom_smtp:t.use_custom_smtp===!0};if(a.use_custom_smtp)for(const r of Y)a[r]=t[r];return a},F={bark:{label:"Bark",icon:I,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"Ydisks闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app/<key>/这是测试推送内容","URL 路径里 <key> 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:Q,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:je,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:ae,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"-1001234567890 或你的Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{j as e,b as Y,a as r}from"./react-vendor-Bf9ELcll.js";import{f as ee}from"./dateTime-DDi7rqpW.js";import{U as ne,V as ie,X as H,W as oe,R as K,P as ce,Y as se,p as te,E as de,N as xe,_ as ue,T as me,j as he,i as pe,s as ge}from"./icons-vendor-BSp7PTZg.js";import{r as O,c as M,b as be}from"./chat-metadata-74T0w35U.js";import{o as ye,c as fe}from"./contract-COFcZjyb.js";import"./vendor-BE-_xUHH.js";const je=[{key:"all",label:"全部"},{key:"processing",label:"处理中"},{key:"shipped",label:"已发货"},{key:"pending_ship",label:"待发货"},{key:"completed",label:"已完成"},{key:"cancelled",label:"已取消"},{key:"refunding",label:"退款中"}],ve=s=>{const t=typeof s=="object"&&s!==null?s:{},a=Array.isArray(t.results)?t.results:[];return{total:Number(t.total||0),success_count:Number(t.success_count||0),failed_count:Number(t.failed_count||0),results:a.map(Ne)}},Ne=s=>{const t=typeof s=="object"&&s!==null?s:{};return{order_id:String(t.order_id||"unknown"),success:t.success===!0,message:String(t.message||"")}},we=s=>(s==null?void 0:s.results.filter(_e))||[],_e=s=>!s.success,ke=(s,t)=>s!==null&&!t,Ce=s=>{if(!s)return"请选择订单文件";const t=s.name.toLowerCase().split(".").pop()||"";return["xlsx","csv","tsv","json"].includes(t)?"":"仅支持 .xlsx、.csv、.tsv、.json 格式"},z=(s,t)=>s===t,Se=(s,t)=>s instanceof Error&&s.message?s.message:t,Ee=({filter:s,onFilterChange:t,accountFilter:a,onAccountFilterChange:m,accounts:h,accountName:x,searchText:p,onSearchChange:f})=>{const b=i=>t(i.currentTarget.dataset.status||"all"),y=i=>m(i.target.value),j=i=>f(i.target.value);return e.jsxs("div",{className:"p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-surface-muted",children:[e.jsx("div",{className:"flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full",children:je.map(i=>e.jsx("button",{"data-status":i.key,onClick:b,className:`px-5 py-2 rounded-lg text-sm font-bold transition-all whitespace-nowrap ${s===i.key?"bg-white text-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:i.label},i.key))}),e.jsxs("div",{className:"flex w-full md:w-auto flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ne,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{"aria-label":"按账号筛选订单",value:a,onChange:y,className:"ios-input pl-10 pr-9 py-2.5 rounded-xl w-full sm:w-56 bg-white border-none shadow-sm",children:[e.jsx("option",{value:"",children:"全部账号"}),h.map(i=>e.jsx("option",{value:i.id,children:x(i.id)},i.id))]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx(ie,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-brand transition-colors"}),e.jsx("input",{type:"text",placeholder:"搜索订单号/商品/买家...",value:p,onChange:j,className:"ios-input pl-10 pr-4 py-2.5 rounded-xl w-64 bg-white border-none shadow-sm focus:ring-0"})]})]})]})},Oe=s=>{const t=x=>{var p;s.setImportFile(((p=x.target.files)==null?void 0:p[0])||null)},a=()=>s.closeImportModal(),m=()=>void s.handleImportOrders(),h=()=>void s.handleRetryImport();return s.showImportModal?Y.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-header",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"插入订单"}),e.jsx("button",{onClick:a,className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:e.jsx(H,{className:"w-5 h-5 text-gray-600"})})]})}),e.jsxs("div",{className:"modal-body space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"选择Excel文件"}),e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv,.json",onChange:t,className:"w-full ios-input px-4 py-3 rounded-xl text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持 .xlsx、.csv、.tsv、.json 格式"})]}),s.importFile&&e.jsx("div",{className:"p-3 bg-blue-50 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-blue-900",children:s.importFile.name})]})}),s.importError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-100 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:s.importError}),e.jsx("button",{type:"button",onClick:h,disabled:s.importing||!s.importFile,className:"font-bold whitespace-nowrap",children:"重试"})]}),s.importResult&&s.importResult.failed_count>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-100 p-3 text-sm font-bold text-amber-800",children:["导入完成:Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{j as e,b as H,a as r}from"./react-vendor-Bf9ELcll.js";import{f as ee}from"./dateTime-DDi7rqpW.js";import{U as ne,I as ie,X as K,J as oe,R as Y,N as ce,O as se,m as te,E as de,F as xe,V as me,y as ue,h as he,g as pe,o as ge}from"./icons-vendor-B5fJPoU1.js";import{r as O,c as M,a as be}from"./index-C6RECy_0.js";import{o as ye,c as fe}from"./contract-COFcZjyb.js";import"./vendor-BE-_xUHH.js";const je=[{key:"all",label:"全部"},{key:"processing",label:"处理中"},{key:"shipped",label:"已发货"},{key:"pending_ship",label:"待发货"},{key:"completed",label:"已完成"},{key:"cancelled",label:"已取消"},{key:"refunding",label:"退款中"}],ve=s=>{const t=typeof s=="object"&&s!==null?s:{},a=Array.isArray(t.results)?t.results:[];return{total:Number(t.total||0),success_count:Number(t.success_count||0),failed_count:Number(t.failed_count||0),results:a.map(Ne)}},Ne=s=>{const t=typeof s=="object"&&s!==null?s:{};return{order_id:String(t.order_id||"unknown"),success:t.success===!0,message:String(t.message||"")}},we=s=>(s==null?void 0:s.results.filter(_e))||[],_e=s=>!s.success,ke=(s,t)=>s!==null&&!t,Ce=s=>{if(!s)return"请选择订单文件";const t=s.name.toLowerCase().split(".").pop()||"";return["xlsx","csv","tsv","json"].includes(t)?"":"仅支持 .xlsx、.csv、.tsv、.json 格式"},z=(s,t)=>s===t,Se=(s,t)=>s instanceof Error&&s.message?s.message:t,Ee=({filter:s,onFilterChange:t,accountFilter:a,onAccountFilterChange:u,accounts:h,accountName:x,searchText:p,onSearchChange:f})=>{const b=i=>t(i.currentTarget.dataset.status||"all"),y=i=>u(i.target.value),j=i=>f(i.target.value);return e.jsxs("div",{className:"p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-surface-muted",children:[e.jsx("div",{className:"flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full",children:je.map(i=>e.jsx("button",{"data-status":i.key,onClick:b,className:`px-5 py-2 rounded-lg text-sm font-bold transition-all whitespace-nowrap ${s===i.key?"bg-white text-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:i.label},i.key))}),e.jsxs("div",{className:"flex w-full md:w-auto flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ne,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{"aria-label":"按账号筛选订单",value:a,onChange:y,className:"ios-input pl-10 pr-9 py-2.5 rounded-xl w-full sm:w-56 bg-white border-none shadow-sm",children:[e.jsx("option",{value:"",children:"全部账号"}),h.map(i=>e.jsx("option",{value:i.id,children:x(i.id)},i.id))]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx(ie,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-brand transition-colors"}),e.jsx("input",{type:"text",placeholder:"搜索订单号/商品/买家...",value:p,onChange:j,className:"ios-input pl-10 pr-4 py-2.5 rounded-xl w-64 bg-white border-none shadow-sm focus:ring-0"})]})]})]})},Oe=s=>{const t=x=>{var p;s.setImportFile(((p=x.target.files)==null?void 0:p[0])||null)},a=()=>s.closeImportModal(),u=()=>void s.handleImportOrders(),h=()=>void s.handleRetryImport();return s.showImportModal?H.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-header",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"插入订单"}),e.jsx("button",{onClick:a,className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:e.jsx(K,{className:"w-5 h-5 text-gray-600"})})]})}),e.jsxs("div",{className:"modal-body space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"选择Excel文件"}),e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv,.json",onChange:t,className:"w-full ios-input px-4 py-3 rounded-xl text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持 .xlsx、.csv、.tsv、.json 格式"})]}),s.importFile&&e.jsx("div",{className:"p-3 bg-blue-50 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-blue-900",children:s.importFile.name})]})}),s.importError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-100 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:s.importError}),e.jsx("button",{type:"button",onClick:h,disabled:s.importing||!s.importFile,className:"font-bold whitespace-nowrap",children:"重试"})]}),s.importResult&&s.importResult.failed_count>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-100 p-3 text-sm font-bold text-amber-800",children:["导入完成:成功 "Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{j as e,a as d,b as Oe}from"./react-vendor-Bf9ELcll.js";import{k as We,ae as ut,af as St,m as Rt,ag as pt,R as Ge,N as rt,Z as lt,u as At,n as nt,I as Pt,a1 as Tt,X as Ae,V as qe,y as Pe,h as Mt,g as $t,a6 as Et,ah as Lt,o as it,ai as It}from"./icons-vendor-B5fJPoU1.js";import{r as N,c as w}from"./index-C6RECy_0.js";import{o as $e,c as Ze}from"./contract-COFcZjyb.js";import"./vendor-BE-_xUHH.js";const Ve=(t,s)=>t.allowed_resolutions.includes(s),Dt=(t,s)=>({runs:t.runs.filter(l=>!s||l.cookie_id===s),pending_tasks:t.pending_tasks.filter(l=>!s||l.cookie_id===s)}),Ft=t=>({external_result_unknown:"外部动作结果未知",invalid_snapshot:"历史数据无法恢复",rule_unavailable:"规则不可用",partial_failure:"部分动作失败",execution_failed:"动作执行失败"})[t]||"自动化异常",zt=({runs:t,pendingTasks:s,onResolveRun:l,onResolveDeferredTask:u})=>e.jsxs("section",{className:"rounded-2xl border border-red-200 bg-red-50 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(We,{className:"w-5 h-5 text-red-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-black text-red-900",children:"需要人工处理的自动化任务"}),e.jsx("p",{className:"text-sm text-red-700 mt-1",children:"请先在闲鱼聊天、订单或商品列表中核对真实结果,再选择继续或重试。"})]})]}),e.jsxs("div",{className:"space-y-3",children:[t.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 订单 ",r.order_id||"-"," · 已记录发送 ",r.sent_count," 条"]}),e.jsx("div",{className:"text-xs font-bold text-red-800 mt-1",children:Ft(r.issue_kind)}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 shrink-0",children:[Ve(r,"continue")&&e.jsx("button",{onClick:(()=>l(r.id,"continue")),className:"px-3 py-2 rounded-lg bg-emerald-100 text-emerald-800 text-xs font-bold",children:"已执行,继续下一步"}),Ve(r,"retry")&&e.jsx("button",{onClick:(()=>l(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"未执行,安全重试"}),Ve(r,"cancel")&&e.jsx("button",{onClick:(()=>l(r.id,"cancel")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"终止"})]})]},`run-${r.id}`)),s.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 延迟任务重试已达 ",r.attempt_count," 次"]}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx("button",{onClick:(()=>u(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"重新入队"}),e.jsx("button",{onClick:(()=>u(r.id,"dismiss")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"忽略"})]})]},`task-${r.id}`))]})]}),Ot=async t=>N(s=>w.GET("/api/v1/accounts/details",{signal:s}),t),gt=async t=>N(s=>w.GET("/api/v1/cards",{signal:s}),t),bt=async(t,s)=>N(l=>w.GET("/api/v1/items",{params:{query:{cookie_id:t}},signal:l}),s),ht=t=>t.map(s=>{var l,u;return{id:String(s.id),name:s.name||"",trigger_type:s.trigger_type||"order_paid",item_keyword:s.item_title||s.item_id||"",cookie_id:s.cookie_id||"",item_id:s.item_id||"",item_title:s.item_title||"",card_group_id:Number(((l=(s.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:l.card_id)||0),card_group_name:((u=(s.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:u.card_name)||"",priority:s.priority||100,enabled:s.enabled||!1,config_json:s.config_json||"{}",actions:(s.actions||[]).map(r=>({id:r.id?String(r.id):void 0,action_type:r.action_type,card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),message_template:r.message_template||"",delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}",enabled:r.enabled!==!1,sort_order:Number(r.sort_order||0)})),variants:(s.actions||[]).filter(r=>r.action_type==="send_card").map(r=>{let h={};try{h=JSON.parse(r.config_json||"{}")}catch{}return{id:r.id?String(r.id):void 0,spec_name:h.spec_name||"",spec_value:h.spec_value||"",card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),enabled:r.enabled!==!1,delay_override:h.delay_override===!0,delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}"}})}}),Gt=async()=>{const t=await N(l=>w.GET("/api/v1/automation-rules",{signal:l})),s=Ze(Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{j as e,a as d,b as Oe}from"./react-vendor-Bf9ELcll.js";import{m as We,ah as ut,ai as St,p as Rt,aj as pt,R as Ge,P as rt,Z as lt,y as At,r as nt,V as Pt,a4 as Tt,X as Ae,_ as qe,T as Pe,j as Mt,i as $t,a9 as Et,ak as Lt,s as it,S as Dt}from"./icons-vendor-BSp7PTZg.js";import{r as N,c as w}from"./chat-metadata-74T0w35U.js";import{o as $e,c as Ze}from"./contract-COFcZjyb.js";import"./vendor-BE-_xUHH.js";const Ve=(t,s)=>t.allowed_resolutions.includes(s),It=(t,s)=>({runs:t.runs.filter(l=>!s||l.cookie_id===s),pending_tasks:t.pending_tasks.filter(l=>!s||l.cookie_id===s)}),Ft=t=>({external_result_unknown:"外部动作结果未知",invalid_snapshot:"历史数据无法恢复",rule_unavailable:"规则不可用",partial_failure:"部分动作失败",execution_failed:"动作执行失败"})[t]||"自动化异常",zt=({runs:t,pendingTasks:s,onResolveRun:l,onResolveDeferredTask:u})=>e.jsxs("section",{className:"rounded-2xl border border-red-200 bg-red-50 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(We,{className:"w-5 h-5 text-red-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-black text-red-900",children:"需要人工处理的自动化任务"}),e.jsx("p",{className:"text-sm text-red-700 mt-1",children:"请先在闲鱼聊天、订单或商品列表中核对真实结果,再选择继续或重试。"})]})]}),e.jsxs("div",{className:"space-y-3",children:[t.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 订单 ",r.order_id||"-"," · 已记录发送 ",r.sent_count," 条"]}),e.jsx("div",{className:"text-xs font-bold text-red-800 mt-1",children:Ft(r.issue_kind)}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 shrink-0",children:[Ve(r,"continue")&&e.jsx("button",{onClick:(()=>l(r.id,"continue")),className:"px-3 py-2 rounded-lg bg-emerald-100 text-emerald-800 text-xs font-bold",children:"已执行,继续下一步"}),Ve(r,"retry")&&e.jsx("button",{onClick:(()=>l(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"未执行,安全重试"}),Ve(r,"cancel")&&e.jsx("button",{onClick:(()=>l(r.id,"cancel")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"终止"})]})]},`run-${r.id}`)),s.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 延迟任务重试已达 ",r.attempt_count," 次"]}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx("button",{onClick:(()=>u(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"重新入队"}),e.jsx("button",{onClick:(()=>u(r.id,"dismiss")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"忽略"})]})]},`task-${r.id}`))]})]}),Ot=async t=>N(s=>w.GET("/api/v1/accounts/details",{signal:s}),t),gt=async t=>N(s=>w.GET("/api/v1/cards",{signal:s}),t),bt=async(t,s)=>N(l=>w.GET("/api/v1/items",{params:{query:{cookie_id:t}},signal:l}),s),ht=t=>t.map(s=>{var l,u;return{id:String(s.id),name:s.name||"",trigger_type:s.trigger_type||"order_paid",item_keyword:s.item_title||s.item_id||"",cookie_id:s.cookie_id||"",item_id:s.item_id||"",item_title:s.item_title||"",card_group_id:Number(((l=(s.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:l.card_id)||0),card_group_name:((u=(s.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:u.card_name)||"",priority:s.priority||100,enabled:s.enabled||!1,config_json:s.config_json||"{}",actions:(s.actions||[]).map(r=>({id:r.id?String(r.id):void 0,action_type:r.action_type,card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),message_template:r.message_template||"",delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}",enabled:r.enabled!==!1,sort_order:Number(r.sort_order||0)})),variants:(s.actions||[]).filter(r=>r.action_type==="send_card").map(r=>{let h={};try{h=JSON.parse(r.config_json||"{}")}catch{}return{id:r.id?String(r.id):void 0,spec_name:h.spec_name||"",spec_value:h.spec_value||"",card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),enabled:r.enabled!==!1,delay_override:h.delay_override===!0,delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}"}})}}),Gt=async()=>{const t=await N(l=>w.GET("/api/v1/automation-rules",{signal:l})Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{a as r,j as e}from"./react-vendor-Bf9ELcll.js";import{r as M,c as q}from"./chat-metadata-74T0w35U.js";import{h as xe,R as ae,ad as ue,v as pe,J as T,N as D,ae as me,x as he,b as re,af as le,ag as ge,s as ye}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";const ne="https://dashscope.aliyuncs.com/compatible-mode/v1",fe=[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],be=new Set(["ai_api_key_configured","smtp_password_configured","qq_reply_secret_key_configured","captcha.remote_secret_key_configured","smtp_server","smtp_port","smtp_user","smtp_password","smtp_from","smtp_from_name","smtp_from_address","registration_enabled","show_default_login_info","login_captcha_enabled","item_sync_enabled","item_sync_interval","item_sync_max_pages","default_reply"]),oe=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),we=s=>{if("values"in s||"secrets"in s)return s;const a={},n={};for(const[d,x]of Object.entries(s))if(x!=null){if(oe.has(d)){n[d]=x===""?{action:"clear"}:{action:"replace",value:String(x)};continue}(typeof x=="string"||typeof x=="number"||typeof x=="boolean")&&(a[d]=x)}return Object.keys(n).length>0?{values:a,secrets:n}:a},je=s=>{const a={...s};for(const n of oe){const d=`${n}_configured`;d in a&&(a[d]=a[d]===!0||a[d]==="true")}if("renewal_log_retention_days"in a){const n=Number(a.renewal_log_retention_days);a.renewal_log_retention_days=Number.isFinite(n)?n:10}return a},ve=async(s,a)=>M(n=>q.PUT("/api/v1/session/credentials",{body:s,signal:n}),a),_e=async s=>{const a=await M(n=>q.GET("/api/v1/settings/system",{signal:n}),s);return je(a)},Ne=async(s,a)=>M(n=>q.PUT("/api/v1/settings/system",{body:we(s),signal:n}),a),Se=async(s,a="",n)=>{const d=await M(x=>q.POST("/api/v1/settings/ai-models",{body:{base_url:s,api_key:a},signal:x}),n);return Array.isArray(d.models)?d.models:[]},ke=async s=>M(a=>q.GET("/api/v1/session",{signal:a}),s),Ce=s=>Object.fromEntries(Object.entries(s).filter(([a,n])=>!be.has(a)&&n!==void 0&&n!==null)),Ee=s=>s.new_username.trim().length<3?"用户名至少需要 3 个字符":s.current_password?s.new_password&&s.new_password.length<8?"新密码至少需要 8 个字符":s.new_password!==s.confirm_password?"两次输入的新密码不一致":"":"请输入当前密码确认身份",f=(s,a,n)=>s===a&&!n.aborted,K=s=>s instanceof Error&&s.message==="请求已取消",U=(s,a)=>s instanceof Error?s.message:a,Ae=(s="")=>({new_username:s,current_password:"",new_password:"",confirm_password:""}),$=(s,a)=>({type:s,text:a}),Ie=()=>{const[s,a]=r.useState(null),[n,d]=r.useState(!1),[x,m]=r.useState(""),[S,A]=r.useState(!1),[R,k]=r.useState(""),[C,w]=r.useState([]),[j,I]=r.useState(!1),[P,u]=r.useState(""),[G,v]=r.useState(!1),[z,L]=r.useState(!1),[F,p]=r.useState(!1),[b,J]=r.useState(!1),[V,Y]=r.useState(!1),[W,_]=r.useState(!1),[O,y]=r.useState(null),[t,ee]=r.useState(()=>Ae()),[ce,B]=r.useState("idle"),se=r.useRef(null),te=r.useRef(null),h=r.useRef(0),H=r.useRef(null);te.current=s;const E=r.useCallback(()=>{var c;(c=H.current)==null||c.abort();const o=new AbortController;return H.current=o,h.current+=1,{controller:o,sequence:h.current}},[]),Q=r.useCallback(async(o,c=!1,l)=>{const i=o||te.current,g=(i==null?void 0:i.ai_api_url)||(i==null?void 0:i.ai_base_url)||ne;I(!0),u("");try{const N=await Se(g,(i==null?void 0:i.ai_api_key)||"",{signal:l});if(l!=null&&l.aborted)return;w(N),v(c&&N.length>0),!(i!=null&&i.ai_model)&&N.length>0&&a(Z=>Z&&{...Z,ai_model:N[0]})}catch(N){if(l!=null&&l.aborted||K(N))return;w([]),v(!1),u(U(N,"读取模型失败"))}finally{l!=null&&l.aborted||I(!1)}},[]),X=r.useCallback(()=>{const{controller:o,sequence:c}=E();d(!0),B("loading"),m(""),Promise.all([_e({signal:o.signal}),ke({signal:o.signal})]).then(([l,i])=>{f(h.current,c,o.signal)&&(a(l),i.username&&ee(g=>({...g,new_username:i.username||""})),Q(l,!1,o.signal),B("success"))}).catch(l=>{!f(h.current,c,o.signal)||K(l)||(a(null),m(U(l,"加载配置失败")),B("error"))}).finally(()=>{f(h.current,c,o.signal)&&d(!1)})},[E,Q]);r.useEffect(()=>(X(),(()=>{var o;return(o=H.current)==null?void 0:o.abort()})),[X]),r.useEffect(()=>{const o=c=>{var l;(l=se.current)!=null&&l.contains(c.target)||v(!1)};return document.addEventListener("mousedown",o),(()=>document.removeEventListener("mousedown",o))},[]);const ie=r.useCallback(async()=>{if(!s||S)return;const{controller:o,sequence:c}=E();A(!0),k("");try{if(await Ne(Ce(s),{signal:o.signal}),!f(h.current,c,o.signal))return;window.alert("系统配置已保存")}catch(l){if(!f(h.current,c,o.signal)||K(l))return;k(U(l,"保存配置失败"))}finally{f(h.current,c,o.signal)&&A(!1)}},[E,S,s]),de=r.useCallback(async o=>{o.preventDefault(),y(null);const c=Ee(t);if(c){y($("error",c));return}const{controller:l,sequence:i}=E();_(!0);try{const g=await ve({current_password:t.current_password,new_username:t.new_username.trim(),new_password:t.new_password||void 0},{signal:l.signal});if(!f(hLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{a as r,j as e}from"./react-vendor-Bf9ELcll.js";import{r as M,c as q}from"./index-C6RECy_0.js";import{f as xe,R as ae,aa as ue,r as pe,z as T,F as D,ab as me,t as he,S as re,ac as le,ad as ge,o as ye}from"./icons-vendor-B5fJPoU1.js";import"./vendor-BE-_xUHH.js";const ne="https://dashscope.aliyuncs.com/compatible-mode/v1",fe=[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],be=new Set(["ai_api_key_configured","smtp_password_configured","qq_reply_secret_key_configured","captcha.remote_secret_key_configured","smtp_server","smtp_port","smtp_user","smtp_password","smtp_from","smtp_from_name","smtp_from_address","registration_enabled","show_default_login_info","login_captcha_enabled","item_sync_enabled","item_sync_interval","item_sync_max_pages","default_reply"]),oe=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),we=s=>{if("values"in s||"secrets"in s)return s;const a={},n={};for(const[d,x]of Object.entries(s))if(x!=null){if(oe.has(d)){n[d]=x===""?{action:"clear"}:{action:"replace",value:String(x)};continue}(typeof x=="string"||typeof x=="number"||typeof x=="boolean")&&(a[d]=x)}return Object.keys(n).length>0?{values:a,secrets:n}:a},je=s=>{const a={...s};for(const n of oe){const d=`${n}_configured`;d in a&&(a[d]=a[d]===!0||a[d]==="true")}if("renewal_log_retention_days"in a){const n=Number(a.renewal_log_retention_days);a.renewal_log_retention_days=Number.isFinite(n)?n:10}return a},ve=async(s,a)=>M(n=>q.PUT("/api/v1/session/credentials",{body:s,signal:n}),a),_e=async s=>{const a=await M(n=>q.GET("/api/v1/settings/system",{signal:n}),s);return je(a)},Ne=async(s,a)=>M(n=>q.PUT("/api/v1/settings/system",{body:we(s),signal:n}),a),Se=async(s,a="",n)=>{const d=await M(x=>q.POST("/api/v1/settings/ai-models",{body:{base_url:s,api_key:a},signal:x}),n);return Array.isArray(d.models)?d.models:[]},ke=async s=>M(a=>q.GET("/api/v1/session",{signal:a}),s),Ce=s=>Object.fromEntries(Object.entries(s).filter(([a,n])=>!be.has(a)&&n!==void 0&&n!==null)),Ee=s=>s.new_username.trim().length<3?"用户名至少需要 3 个字符":s.current_password?s.new_password&&s.new_password.length<8?"新密码至少需要 8 个字符":s.new_password!==s.confirm_password?"两次输入的新密码不一致":"":"请输入当前密码确认身份",f=(s,a,n)=>s===a&&!n.aborted,K=s=>s instanceof Error&&s.message==="请求已取消",U=(s,a)=>s instanceof Error?s.message:a,Ae=(s="")=>({new_username:s,current_password:"",new_password:"",confirm_password:""}),$=(s,a)=>({type:s,text:a}),Ie=()=>{const[s,a]=r.useState(null),[n,d]=r.useState(!1),[x,m]=r.useState(""),[S,A]=r.useState(!1),[R,k]=r.useState(""),[C,w]=r.useState([]),[j,I]=r.useState(!1),[P,u]=r.useState(""),[z,v]=r.useState(!1),[G,L]=r.useState(!1),[F,p]=r.useState(!1),[b,V]=r.useState(!1),[Y,J]=r.useState(!1),[W,_]=r.useState(!1),[O,y]=r.useState(null),[t,ee]=r.useState(()=>Ae()),[ce,B]=r.useState("idle"),se=r.useRef(null),te=r.useRef(null),h=r.useRef(0),H=r.useRef(null);te.current=s;const E=r.useCallback(()=>{var c;(c=H.current)==null||c.abort();const o=new AbortController;return H.current=o,h.current+=1,{controller:o,sequence:h.current}},[]),Q=r.useCallback(async(o,c=!1,l)=>{const i=o||te.current,g=(i==null?void 0:i.ai_api_url)||(i==null?void 0:i.ai_base_url)||ne;I(!0),u("");try{const N=await Se(g,(i==null?void 0:i.ai_api_key)||"",{signal:l});if(l!=null&&l.aborted)return;w(N),v(c&&N.length>0),!(i!=null&&i.ai_model)&&N.length>0&&a(Z=>Z&&{...Z,ai_model:N[0]})}catch(N){if(l!=null&&l.aborted||K(N))return;w([]),v(!1),u(U(N,"读取模型失败"))}finally{l!=null&&l.aborted||I(!1)}},[]),X=r.useCallback(()=>{const{controller:o,sequence:c}=E();d(!0),B("loading"),m(""),Promise.all([_e({signal:o.signal}),ke({signal:o.signal})]).then(([l,i])=>{f(h.current,c,o.signal)&&(a(l),i.username&&ee(g=>({...g,new_username:i.username||""})),Q(l,!1,o.signal),B("success"))}).catch(l=>{!f(h.current,c,o.signal)||K(l)||(a(null),m(U(l,"加载配置失败")),B("error"))}).finally(()=>{f(h.current,c,o.signal)&&d(!1)})},[E,Q]);r.useEffect(()=>(X(),(()=>{var o;return(o=H.current)==null?void 0:o.abort()})),[X]),r.useEffect(()=>{const o=c=>{var l;(l=se.current)!=null&&l.contains(c.target)||v(!1)};return document.addEventListener("mousedown",o),(()=>document.removeEventListener("mousedown",o))},[]);const ie=r.useCallback(async()=>{if(!s||S)return;const{controller:o,sequence:c}=E();A(!0),k("");try{if(await Ne(Ce(s),{signal:o.signal}),!f(h.current,c,o.signal))return;window.alert("系统配置已保存")}catch(l){if(!f(h.current,c,o.signal)||K(l))return;k(U(l,"保存配置失败"))}finally{f(h.current,c,o.signal)&&A(!1)}},[E,S,s]),de=r.useCallback(async o=>{o.preventDefault(),y(null);const c=Ee(t);if(c){y($("error",c));return}const{controller:l,sequence:i}=E();_(!0);try{const g=await ve({current_password:t.current_password,new_username:t.new_username.trim(),new_password:t.new_password||void 0},{signal:l.signal});if(!f(h.currentLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{a as c,d as U,j as r}from"./react-vendor-Bf9ELcll.js";import{o as ae}from"./vendor-BE-_xUHH.js";import{F as se,X as D,T as re,C as ne,S as ie,P as oe}from"./icons-vendor-BSp7PTZg.js";let z=!1;class $ extends Error{constructor(t,a){super(de(a,t)),this.name="ApiError",this.status=t,this.code=M(a)?a.code:`http_${t}`,this.requestId=M(a)?a.request_id:void 0,this.request_id=this.requestId,this.details=M(a)?a.details:void 0,this.payload=a}}const le=()=>{z||typeof window>"u"||(z=!0,window.dispatchEvent(new Event("auth:logout")),queueMicrotask(()=>{z=!1}))},ce=(e,t)=>{const a=new AbortController,s=()=>a.abort(e==null?void 0:e.reason);e!=null&&e.aborted?s():e==null||e.addEventListener("abort",s,{once:!0});const i=globalThis.setTimeout(()=>a.abort(new DOMException("timeout","TimeoutError")),Math.max(1,t));return{signal:a.signal,cleanup:()=>{globalThis.clearTimeout(i),e==null||e.removeEventListener("abort",s)}}},M=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.code=="string"&&typeof t.message=="string"},de=(e,t)=>typeof e=="string"?e:M(e)?e.message:`请求失败: ${t}`,ue=3e4,me=(e,t)=>fetch(e,{...t,credentials:"include"}),be=typeof location>"u"?"http://localhost":location.origin,p=ae({baseUrl:be,fetch:me});function ve(e){return e}async function h(e,t={}){var s;const a=ce(t.signal,t.timeoutMs??ue);try{const i=await e(a.signal);if(i.response.status===401&&!t.skipAuthLogout&&le(),i.error!==void 0)throw new $(i.response.status,i.error);if(i.data===void 0)throw new $(i.response.status,void 0);return i.data}catch(i){throw a.signal.aborted?new Error((s=t.signal)!=null&&s.aborted?"请求已取消":"请求超时,请稍后重试"):i}finally{a.cleanup()}}const je=async e=>(await h(a=>p.GET("/api/v1/accounts/details",{signal:a}),e)).map(a=>({id:a.id,enabled:a.enabled,auto_confirm:a.auto_confirm,remark:a.remark,pause_duration:a.pause_duration,paused_until:a.paused_until,paused:a.paused,username:a.username,show_browser:a.show_browser,nickname:a.nickname,avatar_url:a.avatar_url,profile_error:a.profile_error})),Ne=async e=>h(t=>p.GET("/api/v1/accounts/runtime-status",{signal:t}),e),Ce=async(e,t,a,s=!1)=>await h(d=>p.GET("/api/v1/chat/sessions",{params:{query:{account_id:e,cursor:t,refresh:s?1:void 0}},signal:d}),{timeoutMs:s?6e4:a==null?void 0:a.timeoutMs,signal:a==null?void 0:a.signal}),Re=async(e,t,a,s,i)=>await h(f=>p.GET("/api/v1/chat/messages",{params:{query:{account_id:e,chat_id:t,cursor:a,before_id:s}},signal:f}),i),pe=async(e,t)=>(await h(s=>p.GET("/api/v1/chat/quick-replies",{params:{query:{account_id:e}},signal:s}),t)).quick_replies.map(s=>({id:s.id,account_id:s.account_id,content:s.content,created_at:s.created_at})),he=async(e,t,a)=>{const s=await h(i=>p.POST("/api/v1/chat/quick-replies",{body:{account_id:e,content:t},signal:i}),a);return{id:s.id,account_id:s.account_id,content:s.content,created_at:s.created_at}},fe=async(e,t,a)=>h(s=>p.DELETE("/api/v1/chat/quick-replies/{quick_reply_id}",{params:{path:{quick_reply_id:t},query:{account_id:e}},signal:s}),a),ge=async(e,t,a)=>{const s=await h(i=>p.GET("/api/v1/chat/buyer-notes/{buyer_id}",{params:{path:{buyer_id:t},query:{account_id:e}},signal:i}),a);return{account_id:s.account_id,buyer_id:s.buyer_id,content:s.content,updated_at:s.updated_at}},ye=async(e,t,a,s)=>{const i=await h(d=>p.PUT("/api/v1/chat/buyer-notes/{buyer_id}",{params:{path:{buyer_id:t}},body:{account_id:e,content:a},signal:d}),s);return{account_id:i.account_id,buyer_id:i.buyer_id,content:i.content,updated_at:i.updated_at}},Ee=async(e,t)=>h(a=>p.POST("/api/v1/chat/messages",{body:e,signal:a}),t),qe=async(e,t)=>{const a=new FormData;a.set("account_id",e.account_id),a.set("chat_id",e.chat_id),a.set("buyer_id",e.buyer_id),a.set("image",e.image);const s=[["buyer_name",e.buyer_name],["buyer_avatar_url",e.buyer_avatar_url],["item_id",e.item_id],["item_title",e.item_title]];for(const[i,d]of s)d&&a.set(i,d);return h(i=>p.POST("/api/v1/chat/images",{body:a,signal:i}),{timeoutMs:12e4,...t})},Te=async(e,t,a,s)=>h(i=>p.POST("/api/v1/chat/read",{body:{account_id:e,chat_id:t,message_ids:a.map(d=>({messageId:d.messageId,sessionId:d.sessionId,cid:d.cid,conversationType:d.conversationType}))},signal:i}),s),De=e=>{const t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return t>99?"99+":String(t)},Me=e=>(Number.isFinite(e)?Math.max(0,Math.floor(e)):0)<10?"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-red-500 text-[10px] font-bold leading-none text-white":"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-red-500 px-1.5 text-[10px] font-bold leading-none text-white",Qe=(e,t)=>e.filter(a=>a.direction==="incoming"&&a.message_type!=="system"&&!a.message_key.startsWith("in-")).map(a=>({messageId:a.message_key,sessionId:t,cid:`${t}@goofish`,conversationType:1})),Le=(e,t,a)=>{const s=t.trim().toLowerCase();return e.filter(i=>a&&i.unread_count<=0?!1:s?[i.buyer_name,i.buyer_id,i.item_title,i.last_message].some(d=>(d||"").toLowerCase().includes(s)):!0)}Line truncated
|
||||
+105
-85
@@ -3,7 +3,7 @@ import{a as y}from"./react-vendor-Bf9ELcll.js";/**
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const M=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),n=t=>{const a=_(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/**
|
||||
*/const M=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=_(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -13,419 +13,439 @@ import{a as y}from"./react-vendor-Bf9ELcll.js";/**
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const g=y.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:s="",children:h,iconNode:i,...d},p)=>y.createElement("svg",{ref:p,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",s),...!h&&!x(d)&&{"aria-hidden":"true"},...d},[...i.map(([r,l])=>y.createElement(r,l)),...Array.isArray(h)?h:[h]]));/**
|
||||
*/const g=y.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:s="",children:h,iconNode:i,...n},p)=>y.createElement("svg",{ref:p,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",s),...!h&&!x(n)&&{"aria-hidden":"true"},...n},[...i.map(([r,l])=>y.createElement(r,l)),...Array.isArray(h)?h:[h]]));/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const e=(t,a)=>{const c=y.forwardRef(({className:o,...s},h)=>y.createElement(g,{ref:h,iconNode:a,className:k(`lucide-${M(n(t))}`,`lucide-${t}`,o),...s}));return c.displayName=n(t),c};/**
|
||||
*/const e=(t,a)=>{const c=y.forwardRef(({className:o,...s},h)=>y.createElement(g,{ref:h,iconNode:a,className:k(`lucide-${M(d(t))}`,`lucide-${t}`,o),...s}));return c.displayName=d(t),c};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const m=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],G1=e("activity",m);/**
|
||||
*/const m=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Y1=e("activity",m);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const u=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Q1=e("arrow-right",u);/**
|
||||
*/const u=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],e2=e("arrow-right",u);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const $=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],J1=e("bell",$);/**
|
||||
*/const $=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],a2=e("bell",$);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const N=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],X1=e("bot",N);/**
|
||||
*/const N=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],t2=e("bot",N);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const w=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Y1=e("box",w);/**
|
||||
*/const w=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],c2=e("box",w);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const f=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],e2=e("calendar-clock",f);/**
|
||||
*/const f=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],o2=e("calendar-clock",f);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const z=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],a2=e("check-check",z);/**
|
||||
*/const z=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],h2=e("check-check",z);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const b=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t2=e("check",b);/**
|
||||
*/const b=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],y2=e("check",b);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],c2=e("chevron-down",q);/**
|
||||
*/const q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],s2=e("chevron-down",q);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const C=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],o2=e("chevron-left",C);/**
|
||||
*/const C=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],n2=e("chevron-left",C);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const j=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],h2=e("chevron-right",j);/**
|
||||
*/const j=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],d2=e("chevron-right",j);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],y2=e("circle-alert",A);/**
|
||||
*/const A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],k2=e("circle-alert",A);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const H=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],s2=e("circle-check",H);/**
|
||||
*/const H=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],i2=e("circle-check",H);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const V=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],d2=e("circle-dashed",V);/**
|
||||
*/const V=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],p2=e("circle-dashed",V);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const L=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],n2=e("circle-dollar-sign",L);/**
|
||||
*/const L=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],r2=e("circle-dollar-sign",L);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const P=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],k2=e("clock-3",P);/**
|
||||
*/const P=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],l2=e("clipboard",P);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const S=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],i2=e("clock",S);/**
|
||||
*/const S=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],M2=e("clock-3",S);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const U=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],p2=e("cloud-upload",U);/**
|
||||
*/const R=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_2=e("clock",R);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const D=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],r2=e("code",D);/**
|
||||
*/const U=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],x2=e("cloud-upload",U);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const E=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],l2=e("copy",E);/**
|
||||
*/const D=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],v2=e("code",D);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const R=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],M2=e("credit-card",R);/**
|
||||
*/const E=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],g2=e("copy",E);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const B=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],_2=e("database",B);/**
|
||||
*/const B=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],m2=e("credit-card",B);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const T=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],x2=e("dollar-sign",T);/**
|
||||
*/const F=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],u2=e("database",F);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const W=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],v2=e("external-link",W);/**
|
||||
*/const O=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],$2=e("dollar-sign",O);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const F=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],g2=e("eye-off",F);/**
|
||||
*/const T=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],N2=e("external-link",T);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const I=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],m2=e("eye",I);/**
|
||||
*/const W=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],w2=e("eye-off",W);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const O=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],u2=e("file-down",O);/**
|
||||
*/const I=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],f2=e("eye",I);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Z=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],$2=e("file-text",Z);/**
|
||||
*/const Z=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],z2=e("file-down",Z);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const K=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],N2=e("funnel",K);/**
|
||||
*/const K=[["path",{d:"m18.226 5.226-2.52-2.52A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.351",key:"1k2beg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]],b2=e("file-pen-line",K);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const G=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],w2=e("gift",G);/**
|
||||
*/const G=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],q2=e("file-text",G);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Q=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],f2=e("git-commit-horizontal",Q);/**
|
||||
*/const Q=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],C2=e("funnel",Q);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const J=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],z2=e("image-plus",J);/**
|
||||
*/const J=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],j2=e("gift",J);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const X=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],b2=e("image",X);/**
|
||||
*/const X=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],A2=e("git-commit-horizontal",X);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Y=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],q2=e("key",Y);/**
|
||||
*/const Y=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],H2=e("image-plus",Y);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const e1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],C2=e("layers",e1);/**
|
||||
*/const e1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],V2=e("image",e1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const a1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],j2=e("layout-dashboard",a1);/**
|
||||
*/const a1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],L2=e("key",a1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const t1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],A2=e("link-2",t1);/**
|
||||
*/const t1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],P2=e("layers",t1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const c1=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],H2=e("list-plus",c1);/**
|
||||
*/const c1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],S2=e("layout-dashboard",c1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const o1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],V2=e("loader-circle",o1);/**
|
||||
*/const o1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],R2=e("link-2",o1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const h1=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],L2=e("locate-fixed",h1);/**
|
||||
*/const h1=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],U2=e("list-plus",h1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const y1=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],P2=e("lock-keyhole",y1);/**
|
||||
*/const y1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],D2=e("loader-circle",y1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const s1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],S2=e("lock",s1);/**
|
||||
*/const s1=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],E2=e("locate-fixed",s1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const d1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],U2=e("log-out",d1);/**
|
||||
*/const n1=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],B2=e("lock-keyhole",n1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const n1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],D2=e("mail",n1);/**
|
||||
*/const d1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],F2=e("lock",d1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const k1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]],E2=e("message-circle-more",k1);/**
|
||||
*/const k1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],O2=e("log-out",k1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const i1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],R2=e("message-circle",i1);/**
|
||||
*/const i1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],T2=e("mail",i1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const p1=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],B2=e("message-square-quote",p1);/**
|
||||
*/const p1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]],W2=e("message-circle-more",p1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const r1=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],T2=e("package-check",r1);/**
|
||||
*/const r1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],I2=e("message-circle",r1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const l1=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],W2=e("package-plus",l1);/**
|
||||
*/const l1=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],Z2=e("message-square-quote",l1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const M1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],F2=e("package",M1);/**
|
||||
*/const M1=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],K2=e("package-check",M1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const _1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],I2=e("pause",_1);/**
|
||||
*/const _1=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],G2=e("package-plus",_1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const x1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],O2=e("pen",x1);/**
|
||||
*/const x1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Q2=e("package",x1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const v1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Z2=e("play",v1);/**
|
||||
*/const v1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],J2=e("panel-right-close",v1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const g1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],K2=e("plus",g1);/**
|
||||
*/const g1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],X2=e("panel-right-open",g1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const m1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],G2=e("power",m1);/**
|
||||
*/const m1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Y2=e("pause",m1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const u1=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Q2=e("qr-code",u1);/**
|
||||
*/const u1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],e0=e("pen",u1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const $1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],J2=e("refresh-cw",$1);/**
|
||||
*/const $1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],a0=e("play",$1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const N1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],X2=e("rotate-ccw",N1);/**
|
||||
*/const N1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],t0=e("plus",N1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const w1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Y2=e("save",w1);/**
|
||||
*/const w1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],c0=e("power",w1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const f1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],e0=e("search",f1);/**
|
||||
*/const f1=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],o0=e("qr-code",f1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const z1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],a0=e("send",z1);/**
|
||||
*/const z1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],h0=e("refresh-cw",z1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const b1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],t0=e("settings",b1);/**
|
||||
*/const b1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],y0=e("rotate-ccw",b1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const q1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],c0=e("shield-check",q1);/**
|
||||
*/const q1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],s0=e("save",q1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const C1=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],o0=e("shopping-bag",C1);/**
|
||||
*/const C1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],n0=e("search",C1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const j1=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],h0=e("shopping-cart",j1);/**
|
||||
*/const j1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],d0=e("send",j1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const A1=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],y0=e("sliders-horizontal",A1);/**
|
||||
*/const A1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],k0=e("settings",A1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const H1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],s0=e("smile",H1);/**
|
||||
*/const H1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],i0=e("shield-check",H1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const V1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],d0=e("sparkles",V1);/**
|
||||
*/const V1=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],p0=e("shopping-bag",V1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const L1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],n0=e("square-pen",L1);/**
|
||||
*/const L1=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],r0=e("shopping-cart",L1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const P1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],k0=e("trash-2",P1);/**
|
||||
*/const P1=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],l0=e("sliders-horizontal",P1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const S1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],i0=e("trending-up",S1);/**
|
||||
*/const S1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],M0=e("smile",S1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const U1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],p0=e("triangle-alert",U1);/**
|
||||
*/const R1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],_0=e("sparkles",R1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const D1=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],r0=e("truck",D1);/**
|
||||
*/const U1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],x0=e("square-pen",U1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const E1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],l0=e("upload",E1);/**
|
||||
*/const D1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],v0=e("trash-2",D1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const R1=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],M0=e("user-round",R1);/**
|
||||
*/const E1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],g0=e("trending-up",E1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const B1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],_0=e("user",B1);/**
|
||||
*/const B1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],m0=e("triangle-alert",B1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const T1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],x0=e("users",T1);/**
|
||||
*/const F1=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],u0=e("truck",F1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const W1=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],v0=e("webhook",W1);/**
|
||||
*/const O1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],$0=e("upload",O1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const F1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],g0=e("wifi-off",F1);/**
|
||||
*/const T1=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],N0=e("user-round",T1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const I1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],m0=e("wifi",I1);/**
|
||||
*/const W1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],w0=e("user",W1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const O1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],u0=e("x",O1);/**
|
||||
*/const I1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],f0=e("users",I1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Z1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],$0=e("zap",Z1);export{b2 as $,Q1 as A,Y1 as B,M2 as C,x2 as D,v2 as E,m2 as F,f2 as G,p0 as H,e0 as I,l0 as J,q2 as K,V2 as L,E2 as M,K2 as N,r0 as O,F2 as P,Q2 as Q,J2 as R,c0 as S,i0 as T,_0 as U,n0 as V,H2 as W,u0 as X,u2 as Y,$0 as Z,r2 as _,S2 as a,$2 as a0,y0 as a1,l2 as a2,N2 as a3,W2 as a4,p2 as a5,s2 as a6,d2 as a7,A2 as a8,L2 as a9,_2 as aa,c2 as ab,P2 as ac,M0 as ad,k2 as ae,w2 as af,n2 as ag,C2 as ah,a0 as ai,D2 as aj,v0 as ak,I2 as al,X2 as am,m0 as an,g0 as ao,a2 as ap,s0 as aq,z2 as ar,j2 as b,x0 as c,o0 as d,J1 as e,t0 as f,h2 as g,o2 as h,U2 as i,h0 as j,y2 as k,G1 as l,T2 as m,X1 as n,Y2 as o,B2 as p,Z2 as q,d0 as r,e2 as s,t2 as t,R2 as u,i2 as v,O2 as w,G2 as x,k0 as y,g2 as z};
|
||||
*/const Z1=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],z0=e("webhook",Z1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const K1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],b0=e("wifi-off",K1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const G1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],q0=e("wifi",G1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Q1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],C0=e("x",Q1);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const J1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],j0=e("zap",J1);export{U2 as $,e2 as A,c2 as B,l2 as C,$2 as D,N2 as E,b2 as F,A2 as G,e0 as H,c0 as I,w2 as J,L2 as K,D2 as L,W2 as M,f2 as N,m0 as O,t0 as P,o0 as Q,h0 as R,d0 as S,v0 as T,w0 as U,n0 as V,$0 as W,C0 as X,u0 as Y,j0 as Z,x0 as _,F2 as a,z2 as a0,v2 as a1,V2 as a2,q2 as a3,l0 as a4,g2 as a5,C2 as a6,G2 as a7,x2 as a8,i2 as a9,p2 as aa,R2 as ab,E2 as ac,u2 as ad,s2 as ae,B2 as af,N0 as ag,M2 as ah,j2 as ai,r2 as aj,P2 as ak,T2 as al,z0 as am,Y2 as an,y0 as ao,q0 as ap,b0 as aq,h2 as ar,M0 as as,H2 as at,J2 as au,X2 as av,i0 as b,S2 as c,f0 as d,m2 as e,p0 as f,a2 as g,k0 as h,d2 as i,n2 as j,O2 as k,r0 as l,k2 as m,Y1 as n,Q2 as o,K2 as p,g0 as q,t2 as r,s0 as s,Z2 as t,a0 as u,_0 as v,o2 as w,y2 as x,I2 as y,_2 as z};
|
||||
@@ -0,0 +1 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--color-neutral-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
|
||||
@@ -1,2 +0,0 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DhFdaJwB.js","assets/react-vendor-Bf9ELcll.js","assets/dateTime-DDi7rqpW.js","assets/icons-vendor-B5fJPoU1.js","assets/charts-vendor-DBu_rVrn.js","assets/vendor-BE-_xUHH.js","assets/vendor-DUblxfbA.css","assets/contract-COFcZjyb.js","assets/AccountList-C1r-CuCX.js","assets/OrderList-KOW-fFIJ.js","assets/CardList-BbF66c_P.js","assets/ItemList-C1pjlQfG.js","assets/Settings-aZQUe0t0.js","assets/Rules-CacQ324l.js","assets/Notifications-CccTJna_.js","assets/Chat-DJNDDkT1.js","assets/audio-codec-mjVr_wwJ.js"])))=>i.map(i=>d[i]);
|
||||
import{d as P,j as t,a as l,e as K}from"./react-vendor-Bf9ELcll.js";import{o as W}from"./vendor-BE-_xUHH.js";import{L as z,a as I,S as J,U as Q,A as X,b as ee,c as te,M as se,C as ne,B as re,d as ae,Z as oe,e as ie,f as ce,G as R,g as le,h as de,i as ue}from"./icons-vendor-B5fJPoU1.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))c(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&c(a)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function c(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();class he extends P.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(){return{hasError:!0}}render(){const{hasError:n}=this.state,{children:s}=this.props;return n?t.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas p-6 text-ink",children:t.jsxs("section",{className:"max-w-md text-center",children:[t.jsx("h1",{className:"text-xl font-semibold",children:"页面暂时无法显示"}),t.jsx("button",{className:"ios-btn-primary mt-6 px-4 py-2",type:"button",onClick:this.handleReload,children:"重新加载"})]})}):s}}let S=!1;class O extends Error{constructor(n,s){super(pe(s,n)),this.name="ApiError",this.status=n,this.code=N(s)?s.code:`http_${n}`,this.requestId=N(s)?s.request_id:void 0,this.request_id=this.requestId,this.details=N(s)?s.details:void 0,this.payload=s}}const me=()=>{S||typeof window>"u"||(S=!0,window.dispatchEvent(new Event("auth:logout")),queueMicrotask(()=>{S=!1}))},fe=(e,n)=>{const s=new AbortController,c=()=>s.abort(e==null?void 0:e.reason);e!=null&&e.aborted?c():e==null||e.addEventListener("abort",c,{once:!0});const r=globalThis.setTimeout(()=>s.abort(new DOMException("timeout","TimeoutError")),Math.max(1,n));return{signal:s.signal,cleanup:()=>{globalThis.clearTimeout(r),e==null||e.removeEventListener("abort",c)}}},N=e=>{if(typeof e!="object"||e===null)return!1;const n=e;return typeof n.code=="string"&&typeof n.message=="string"},pe=(e,n)=>typeof e=="string"?e:N(e)?e.message:`请求失败: ${n}`,xe=3e4,ge=(e,n)=>fetch(e,{...n,credentials:"include"}),be=typeof location>"u"?"http://localhost":location.origin,v=W({baseUrl:be,fetch:ge});function nt(e){return e}async function w(e,n={}){var c;const s=fe(n.signal,n.timeoutMs??xe);try{const r=await e(s.signal);if(r.response.status===401&&!n.skipAuthLogout&&me(),r.error!==void 0)throw new O(r.response.status,r.error);if(r.data===void 0)throw new O(r.response.status,void 0);return r.data}catch(r){throw s.signal.aborted?new Error((c=n.signal)!=null&&c.aborted?"请求已取消":"请求超时,请稍后重试"):r}finally{s.cleanup()}}const ve=async e=>{const n=await w(s=>v.POST("/api/v1/session/login",{body:e,signal:s}),{skipAuthLogout:!0});return{...n,token:n.token??void 0}},we=async e=>{const n=await w(s=>v.POST("/api/v1/session/initialize",{body:{password:e},signal:s}),{skipAuthLogout:!0});return{...n,token:n.token??void 0}},ye=async e=>w(n=>v.GET("/api/v1/session",{signal:n}),e),Le=async()=>({success:!0,message:(await w(n=>v.POST("/api/v1/session/logout",{body:{},signal:n}))).message}),U=l.createContext(void 0),je=({children:e})=>{const[n,s]=l.useState(!1),[c,r]=l.useState(!1),[i,a]=l.useState(!0),[o,u]=l.useState(!1),d=()=>{s(!1),r(!1)};l.useEffect(()=>{const x=new AbortController;let p=!0;ye({signal:x.signal}).then(b=>{if(p){if((b==null?void 0:b.initialized)===!1){u(!0),d();return}u(!1),b!=null&&b.authenticated?(s(!0),r(b.is_admin===!0)):d()}}).catch(b=>{!p||b instanceof DOMException&&b.name==="AbortError"||(u(!1),d())}).finally(()=>{p&&a(!1)});const h=()=>d();return window.addEventListener("auth:logout",h),(()=>{p=!1,x.abort(),window.removeEventListener("auth:logout",h)})},[]);const m=async x=>{const p=await ve(x);return p.success&&(u(!1),s(!0),r(p.is_admin===!0)),p},g=async x=>{const p=await we(x);return p.success&&(u(!1),s(!0),r(p.is_admin===!0)),p},f=async()=>{try{await Le()}finally{d()}};return t.jsx(U.Provider,{value:{checkingAuth:i,isLoggedIn:n,isAdmin:c,needsInit:o,signIn:m,initialize:g,signOut:f},children:e})},B=()=>{const e=l.useContext(U);if(!e)throw new Error("useSession 必须在 SessionProvider 内使用");return e},q="ydisks.sidebar.v1",Ce=()=>{try{return window.localStorage.getItem(q)==="collapsed"}catch{return!1}},_e=e=>{try{window.localStorage.setItem(q,e?"collapsed":"expanded")}catch{}},Ne=({className:e="w-full h-full text-white"})=>t.jsx("svg",{className:e,viewBox:"0 0 256 256","aria-hidden":"true",children:t.jsx("g",{stroke:"nLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--color-neutral-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
|
||||
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DBUkwLYQ.js","assets/react-vendor-Bf9ELcll.js","assets/dateTime-DDi7rqpW.js","assets/icons-vendor-BSp7PTZg.js","assets/charts-vendor-DBu_rVrn.js","assets/vendor-BE-_xUHH.js","assets/vendor-DUblxfbA.css","assets/chat-metadata-74T0w35U.js","assets/contract-COFcZjyb.js","assets/AccountList-D1PDvKjr.js","assets/OrderList-CKY0um79.js","assets/CardList-BG11KU7H.js","assets/ItemList-D-9IbEjX.js","assets/Settings-BMAitcQx.js","assets/Rules-DCuiI2LD.js","assets/Notifications-BepLRaYn.js","assets/Chat-8cCRP4iO.js","assets/audio-codec-mjVr_wwJ.js"])))=>i.map(i=>d[i]);
|
||||
import{d as P,j as e,a as i,e as H}from"./react-vendor-Bf9ELcll.js";import{r as j,c as L,g as Z,a as Y}from"./chat-metadata-74T0w35U.js";import{L as D,a as A,b as K,U as W,A as J,c as Q,d as X,M as ee,e as te,B as se,f as ne,Z as ae,g as re,h as oe,G as I,i as ie,j as le,k as ce}from"./icons-vendor-BSp7PTZg.js";import"./vendor-BE-_xUHH.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))m(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&m(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function m(r){if(r.ep)return;r.ep=!0;const l=n(r);fetch(r.href,l)}})();class de extends P.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(){return{hasError:!0}}render(){const{hasError:s}=this.state,{children:n}=this.props;return s?e.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas p-6 text-ink",children:e.jsxs("section",{className:"max-w-md text-center",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"页面暂时无法显示"}),e.jsx("button",{className:"ios-btn-primary mt-6 px-4 py-2",type:"button",onClick:this.handleReload,children:"重新加载"})]})}):n}}const ue=async t=>{const s=await j(n=>L.POST("/api/v1/session/login",{body:t,signal:n}),{skipAuthLogout:!0});return{...s,token:s.token??void 0}},he=async t=>{const s=await j(n=>L.POST("/api/v1/session/initialize",{body:{password:t},signal:n}),{skipAuthLogout:!0});return{...s,token:s.token??void 0}},me=async t=>j(s=>L.GET("/api/v1/session",{signal:s}),t),fe=async()=>({success:!0,message:(await j(s=>L.POST("/api/v1/session/logout",{body:{},signal:s}))).message}),$=i.createContext(void 0),xe=({children:t})=>{const[s,n]=i.useState(!1),[m,r]=i.useState(!1),[l,o]=i.useState(!0),[a,d]=i.useState(!1),c=()=>{n(!1),r(!1)};i.useEffect(()=>{const p=new AbortController;let x=!0;me({signal:p.signal}).then(b=>{if(x){if((b==null?void 0:b.initialized)===!1){d(!0),c();return}d(!1),b!=null&&b.authenticated?(n(!0),r(b.is_admin===!0)):c()}}).catch(b=>{!x||b instanceof DOMException&&b.name==="AbortError"||(d(!1),c())}).finally(()=>{x&&o(!1)});const u=()=>c();return window.addEventListener("auth:logout",u),(()=>{x=!1,p.abort(),window.removeEventListener("auth:logout",u)})},[]);const h=async p=>{const x=await ue(p);return x.success&&(d(!1),n(!0),r(x.is_admin===!0)),x},g=async p=>{const x=await he(p);return x.success&&(d(!1),n(!0),r(x.is_admin===!0)),x},f=async()=>{try{await fe()}finally{c()}};return e.jsx($.Provider,{value:{checkingAuth:l,isLoggedIn:s,isAdmin:m,needsInit:a,signIn:h,initialize:g,signOut:f},children:t})},M=()=>{const t=i.useContext($);if(!t)throw new Error("useSession 必须在 SessionProvider 内使用");return t},z="ydisks.sidebar.v1",pe=()=>{try{return window.localStorage.getItem(z)==="collapsed"}catch{return!1}},ge=t=>{try{window.localStorage.setItem(z,t?"collapsed":"expanded")}catch{}},be=({className:t="w-full h-full text-white"})=>e.jsx("svg",{className:t,viewBox:"0 0 256 256","aria-hidden":"true",children:e.jsx("g",{stroke:"none",fill:"none",fillRule:"evenodd",children:e.jsx("path",{d:"M121.73,57.0003 C138.901,57.0003 154.897,65.5053 164.52,79.7493 C166.029,81.9823 165.441,85.0143 163.209,86.5233 C160.976,88.0323 157.944,87.4433 156.436,85.2113 C148.629,73.6553 135.655,66.7563 121.73,66.7563 C104.076789,66.7563 88.6201962,77.6596007 82.5581814,93.8184545 C83.9120803,93.7133631 85.2800264,93.66 86.6602,93.66 C111.537727,93.66 132.442611,110.997575 137.926382,134.224255 L162.5425,92.109 L162.615557,91.9879406 L162.756884,91.77367 L162.911804,91.5639102 L162.98657,91.4716759 C163.351845,91.025169 163.786059,90.6571744 164.264191,90.3738733 L164.550153,90.2178351 L164.729252,90.1315693 L164.989203,90.021723 L165.230265,89.9354653 L165.542393,89.8445739 C165.666021,89.8126706 165.790834,89.7857324 165.916565,89.7637431 L166.116517,89.7342499 C166.29505,89.7098142 166.475001,89.6957386 166.655596,89.6918808 L166.7539,89.693 C196.8909,89.693 221.4079,114.21 221.4079,144.347 C221.4079,174.482 196.8909,199 166.7539,199 L125.0869,199 C122.3919,199 120.2079,196.815 120.2079,194.122 C120.2079,191.429 122.3919,189.244 125.0869,189.244 L166.7539,189.244 C191.5109,189.244 211.6519,169.104 211.6519,144.347 C211.6519,120.513406 192.985349,100.957891 169.504046,99.5322548 L112.7745,196.584 C111.8995,198.08 110.2965,199 108.5635,199 L86.6602,199 C57.6182,199 33.9902,175.373 33.9902,146.33 C33.9902,122.475163 49.9316132,102.273061 71.7206298,95.817503 L71.9446339,9Line truncated
|
||||
@@ -6,12 +6,13 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Ydisks闲鱼助手 - 自动发货与管家系统</title>
|
||||
<meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" />
|
||||
<script type="module" crossorigin src="/static/assets/index-C6RECy_0.js"></script>
|
||||
<script type="module" crossorigin src="/static/assets/index-dO7JyNQY.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/react-vendor-Bf9ELcll.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/vendor-BE-_xUHH.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-B5fJPoU1.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-BSp7PTZg.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/chat-metadata-74T0w35U.js">
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/vendor-DUblxfbA.css">
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-ITqHo9y-.css">
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-Bu1X-GTG.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
Reference in new issue
Block a user