@ezychat/web 0.1.64 → 0.1.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist-lib/chunks/{admin-Bfr7e_J2.js → admin-B1DhZkUR.js} +196 -6
  2. package/dist-lib/chunks/{admin-CxZlJff7.js → admin-DsEZbwfb.js} +196 -6
  3. package/dist-lib/chunks/common-9_yrKOKp.js +179 -0
  4. package/dist-lib/chunks/common-BST94roU.js +179 -0
  5. package/dist-lib/chunks/{inbox-B0qUKtSa.js → inbox-CYEiGkVa.js} +60 -2
  6. package/dist-lib/chunks/{inbox-6O27i4oH.js → inbox-DmBXnPBY.js} +60 -2
  7. package/dist-lib/ezychat-web.css +1 -1
  8. package/dist-lib/index.js +7209 -5182
  9. package/dist-lib/types/admin/AdminLayout.d.ts +4 -0
  10. package/dist-lib/types/admin/AgentDirectCard.d.ts +13 -0
  11. package/dist-lib/types/admin/AgentResolutionCard.d.ts +10 -0
  12. package/dist-lib/types/admin/SafetyPage.d.ts +6 -0
  13. package/dist-lib/types/admin/SafetyReport.d.ts +10 -0
  14. package/dist-lib/types/admin/adminUi.d.ts +4 -1
  15. package/dist-lib/types/api/ai-groups.d.ts +25 -0
  16. package/dist-lib/types/api/ai.d.ts +42 -3
  17. package/dist-lib/types/api/inbox-mutations.d.ts +7 -5
  18. package/dist-lib/types/api/queries.d.ts +56 -14
  19. package/dist-lib/types/api/safety.d.ts +203 -0
  20. package/dist-lib/types/api/templates.d.ts +9 -0
  21. package/dist-lib/types/components/app/InfoTip.d.ts +30 -0
  22. package/dist-lib/types/components/app/index.d.ts +3 -1
  23. package/dist-lib/types/extensions/types.d.ts +1 -1
  24. package/dist-lib/types/i18n/resources.d.ts +351 -0
  25. package/dist-lib/types/inbox/Composer.d.ts +16 -3
  26. package/dist-lib/types/inbox/MentionPicker.d.ts +16 -0
  27. package/dist-lib/types/inbox/SafetyMessage.d.ts +23 -0
  28. package/dist-lib/types/inbox/mentions.d.ts +42 -0
  29. package/dist-lib/types/inbox/reply-window.d.ts +5 -0
  30. package/dist-lib/types/inbox/useDirectory.d.ts +5 -2
  31. package/dist-lib/types/index.d.ts +2 -0
  32. package/dist-lib/types/lib/links.d.ts +6 -0
  33. package/dist-lib/types/lib/tips.d.ts +23 -0
  34. package/package.json +5 -5
  35. package/dist-lib/chunks/common-C66WoZaM.js +0 -85
  36. package/dist-lib/chunks/common-CEBPnKob.js +0 -85
@@ -1,12 +1,16 @@
1
1
  import type React from 'react';
2
- import { type QuickReply, type ReplyPhraseListItem, type FixEnglishStatus } from '@ezychat/shared';
2
+ import { type GroupMember, type QuickReply, type ReplyPhraseListItem, type FixEnglishStatus } from '@ezychat/shared';
3
3
  /** Lets the conversation hand files dropped anywhere on it to the composer. */
4
4
  export interface ComposerHandle {
5
5
  addFiles(files: readonly File[]): void;
6
6
  }
7
7
  export interface ComposerProps {
8
8
  quickReplies: QuickReply[];
9
- onSend(text: string): void;
9
+ /**
10
+ * `mentions`: the tagged members' addresses (groups only; the text then carries `@<number>`);
11
+ * `shown`: the text as the box showed it (`@Name`), for the pending bubble.
12
+ */
13
+ onSend(text: string, mentions?: string[], shown?: string): void;
10
14
  /**
11
15
  * One file to send, with the caption (the typed text goes with the first file). Files picked,
12
16
  * pasted or dropped wait in the tray until Send; they are sent one after another, in order:
@@ -52,6 +56,15 @@ export interface ComposerProps {
52
56
  chatJid: string;
53
57
  name: string;
54
58
  } | null;
59
+ /**
60
+ * Tag group members with `@` (docs/features/group-mentions/design.md): a group whose connection
61
+ * can tag. `members` is null while loading; `onOpen` runs when the picker opens. Null: no picker.
62
+ */
63
+ mentions?: {
64
+ members: GroupMember[] | null;
65
+ error: boolean;
66
+ onOpen(): void;
67
+ } | null;
55
68
  /**
56
69
  * Fix English (docs/features/grammar-fix/design.md): spelling and grammar marks in this chat
57
70
  * (any chat type; null or a status with both checks off = nothing shown).
@@ -66,4 +79,4 @@ export interface ComposerProps {
66
79
  onAddWord(word: string): Promise<unknown>;
67
80
  } | null;
68
81
  }
69
- export declare function Composer({ quickReplies, onSend, onAttach, onVoiceNote, onTyping, confirmSend, disabled, placeholder, replyTo, onCancelReply, aiSuggest, askEzy, fixEnglish, ref, }: ComposerProps): React.JSX.Element;
82
+ export declare function Composer({ quickReplies, onSend, onAttach, onVoiceNote, onTyping, confirmSend, disabled, placeholder, replyTo, onCancelReply, aiSuggest, askEzy, fixEnglish, mentions, ref, }: ComposerProps): React.JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { GroupMember } from '@ezychat/shared';
2
+ export interface MentionPickerProps {
3
+ /** Members matching the query (already filtered by the Composer), or null while loading. */
4
+ members: GroupMember[] | null;
5
+ error: boolean;
6
+ /** Text typed after `@`. */
7
+ query: string;
8
+ activeIndex: number;
9
+ onPick(member: GroupMember): void;
10
+ onHover?(index: number): void;
11
+ }
12
+ /**
13
+ * The `@` member picker of a group chat (docs/features/group-mentions). Like the quick-reply picker,
14
+ * focus stays in the textarea and the Composer drives ↑/↓/Enter/Tab/Escape.
15
+ */
16
+ export declare function MentionPicker({ members, error, query, activeIndex, onPick, onHover, }: Readonly<MentionPickerProps>): import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import type { Message, MessageSafety } from '@ezychat/shared';
2
+ /**
3
+ * WhatsApp Safety in the chat (docs/features/whatsapp-safety/design.md): a short banner on a flagged
4
+ * message, its file behind a check before download (locked for agents when the risk is high), and a
5
+ * bar on top of the chat for a reported, blocked or possibly hacked number.
6
+ */
7
+ /** The banner shows only while the finding matters (not after "Mark safe"). */
8
+ export declare function showsSafety(m: Message): m is Message & {
9
+ safety: MessageSafety;
10
+ };
11
+ export declare function SafetyNotice({ safety, hasFile }: {
12
+ safety: MessageSafety;
13
+ hasFile: boolean;
14
+ }): import("react").JSX.Element;
15
+ /** The flagged file: checked before download, locked for agents while the risk is high. */
16
+ export declare function SafetyFile({ message, safety }: {
17
+ message: Message;
18
+ safety: MessageSafety;
19
+ }): import("react").JSX.Element;
20
+ /** A bar on top of a direct chat: blocked, reported as scam, or a customer who may be hacked. */
21
+ export declare function SafetyChatBar({ jid }: {
22
+ jid: string;
23
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,42 @@
1
+ import type { GroupMember } from '@ezychat/shared';
2
+ /**
3
+ * Tagging group members in the composer (design: docs/features/group-mentions/design.md).
4
+ *
5
+ * The box shows a tag as `@Name` (what the teammate picked); on send each tag still in the text
6
+ * becomes WhatsApp's own form, `@<number>` (the user part of the member's address), and its
7
+ * address goes in `mentions`. A tag whose name was edited is plain text again.
8
+ */
9
+ export interface DraftTag {
10
+ /** What the box shows after `@`. */
11
+ label: string;
12
+ /** The member's address as the group lists it (phone-number JID or WhatsApp ID). */
13
+ jid: string;
14
+ }
15
+ /** Most members one message may tag (the server's `MAX_MESSAGE_MENTIONS`). */
16
+ export declare const MAX_TAGS = 50;
17
+ /** The `@query` being typed right before the caret (start of text or after a space), else null. */
18
+ export declare function mentionQuery(text: string, caret: number): {
19
+ start: number;
20
+ query: string;
21
+ } | null;
22
+ /** The name a member is tagged by: saved/WhatsApp name, else username, else +number. */
23
+ export declare function memberLabel(m: Pick<GroupMember, 'name' | 'username' | 'phone' | 'jid'>): string;
24
+ /**
25
+ * Members to offer for `query` (case-insensitive): a word of the name, the username or the number
26
+ * starts with it. The linked number itself is never offered. Named members first, A–Z.
27
+ */
28
+ export declare function filterMembers(members: GroupMember[], query: string): GroupMember[];
29
+ /** Puts `@Label ` in place of the `@query` being typed; returns the new text and caret. */
30
+ export declare function insertTag(text: string, start: number, caret: number, member: GroupMember): {
31
+ text: string;
32
+ caret: number;
33
+ tag: DraftTag;
34
+ };
35
+ /**
36
+ * The text and mentions to send: each tag still written as `@Label` (a whole tag, not followed by
37
+ * a letter or digit) becomes `@<number>`; tags the teammate edited away are dropped.
38
+ */
39
+ export declare function toWhatsApp(text: string, tags: DraftTag[]): {
40
+ text: string;
41
+ mentions: string[];
42
+ };
@@ -17,6 +17,11 @@ export declare function replyWindowEnding(left: number): boolean;
17
17
  export declare function useNow(intervalMs?: number): number;
18
18
  /** The reply window hours of a chat's inbox (removed inboxes included), or null without one. */
19
19
  export declare function useReplyWindowHours(): (inboxId: number) => number | null;
20
+ /**
21
+ * Whether a chat's inbox can tag group members (@mention). Its connection must say so
22
+ * (`capabilities.mentions`); an inbox not listed yet cannot.
23
+ */
24
+ export declare function useInboxCanTag(): (inboxId: number) => boolean;
20
25
  /**
21
26
  * Whether a chat's reply window is closed (`null`: its inbox has no window). Re-renders only when
22
27
  * the window closes, not every minute, so a whole conversation is not redrawn while it ticks.
@@ -21,9 +21,12 @@ export interface Directory {
21
21
  assignable: DirectoryEntry[];
22
22
  /**
23
23
  * The assign dropdown of a chat of this inbox: active people who may open it, and the AI agent
24
- * that answers this inbox (no other AI agent: the server refuses it).
24
+ * that answers this inbox (no other AI agent: the server refuses it). `direct`: a direct chat, which
25
+ * a group-only agent (`aiNoDirect`) never takes.
25
26
  */
26
- assignableFor(inboxId: number): DirectoryEntry[];
27
+ assignableFor(inboxId: number, opts?: {
28
+ direct?: boolean;
29
+ }): DirectoryEntry[];
27
30
  /** Display name for a user id ("You" for the current user when `youLabel`). */
28
31
  nameOf(id: number | null | undefined, opts?: {
29
32
  youLabel?: boolean;
@@ -15,6 +15,8 @@ export { api, ApiError, errorMessage } from './api/client';
15
15
  export { cn } from './lib/utils';
16
16
  export { Banner, EmptyState, PageHeader, ResponsiveDialog, ResponsiveTable, SegmentedControl, StatusDot, type Column, type SegmentedOption, type StatusTone, } from './components/app';
17
17
  export { ErrorBoundary } from './components/app/ErrorBoundary';
18
+ export { InfoTip, type InfoTipContent, type InfoTipProps } from './components/app/InfoTip';
19
+ export { TIP_TOPICS, type TipGuide, type TipTopic } from './lib/tips';
18
20
  export * from './components/ui/alert-dialog';
19
21
  export * from './components/ui/avatar';
20
22
  export * from './components/ui/badge';
@@ -1,3 +1,4 @@
1
+ import { type TipGuide } from './tips';
1
2
  /** External links used for attribution and support across the app. */
2
3
  export declare const ANCHOR_SPRINT_URL = "https://www.anchorsprint.com";
3
4
  export declare const EZYCHAT_WEBSITE_URL = "https://ezychat.ai/";
@@ -34,6 +35,11 @@ export interface AppLinks {
34
35
  * ready message (in the UI language) to the team. Nothing is counted in the app. null hides them.
35
36
  */
36
37
  connectorRequest: ((message: string) => string) | null;
38
+ /**
39
+ * "Full guide" in the "?" tips (`InfoTip`): the guide page for a slug in the UI language, with the
40
+ * tip's topic for campaign tags. null hides the link (the tip keeps its text and outside page).
41
+ */
42
+ guide: ((guide: TipGuide, locale: string, topic: string) => string) | null;
37
43
  }
38
44
  /**
39
45
  * The EzyChat Enterprise section of the website. The campaign tag lets the website count upgrade
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The "?" tips (`InfoTip`) that explain a new concept in plain words. Copy lives in `common.json`
3
+ * under `tips.<topic>` (`title`, `body`, `step1`…`stepN`, `action`); this file holds each tip's shape.
4
+ * Design: docs/features/concept-tips/design.md.
5
+ */
6
+ export declare const TIP_TOPICS: readonly ["whatsappLink", "aiConnection", "apiKey", "claudeKey", "aiModel", "businessContext", "instructions", "handoff", "tryIt", "voice", "tunnel", "lan", "mcp", "accessToken", "connectors", "safetyAi", "autoBlock", "lockedFiles", "reportNumber"];
7
+ export type TipTopic = (typeof TIP_TOPICS)[number];
8
+ /** The ezychat.ai guides a tip can link to (each exists in en, ms and zh). */
9
+ export type TipGuide = 'getting-started' | 'set-up-ai-agent' | 'connect-cloudflare' | 'connect-ai-assistant';
10
+ export interface TipShape {
11
+ /** Number of "Show steps" lines (`step1`…`stepN`), folded until asked for; 0 = none. */
12
+ steps: number;
13
+ /** Outside page where the thing is made (opened in the OS browser); its label is `action`. */
14
+ action?: string;
15
+ /** ezychat.ai guide shown as "Full guide". */
16
+ guide?: TipGuide;
17
+ }
18
+ export declare const TIPS: Readonly<Record<TipTopic, TipShape>>;
19
+ /**
20
+ * The guide on ezychat.ai in the app's language. The campaign tags let the website count visits
21
+ * from tips; the app itself sends nothing (no tracking in Lite).
22
+ */
23
+ export declare function tipGuideUrl(guide: TipGuide, locale: string, topic: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezychat/web",
3
- "version": "0.1.64",
3
+ "version": "0.1.66",
4
4
  "type": "module",
5
5
  "description": "EzyChat core: the team inbox web app (React) as a library, with createInboxApp and its extension API.",
6
6
  "license": "MIT",
@@ -40,9 +40,9 @@
40
40
  "build:lib": "node ../../scripts/build-web-lib.mjs"
41
41
  },
42
42
  "dependencies": {
43
- "@ezychat/shared": "0.1.64",
43
+ "@ezychat/shared": "0.1.66",
44
44
  "@fontsource-variable/inter": "^5.3.0",
45
- "@tanstack/react-query": "^5.104.5",
45
+ "@tanstack/react-query": "^5.105.0",
46
46
  "@types/react": "^19.3.0",
47
47
  "@types/react-dom": "^19.3.0",
48
48
  "class-variance-authority": "^0.7.1",
@@ -50,7 +50,7 @@
50
50
  "cmdk": "^1.1.1",
51
51
  "cn": "^0.5.0",
52
52
  "date-fns": "^4.4.0",
53
- "i18next": "^26.5.2",
53
+ "i18next": "^26.5.11",
54
54
  "lucide-react": "^1.59.0",
55
55
  "next-themes": "^0.4.6",
56
56
  "nspell": "2.1.5",
@@ -59,7 +59,7 @@
59
59
  "radix-ui": "^1.8.1",
60
60
  "react": "^19.3.1",
61
61
  "react-dom": "^19.3.1",
62
- "react-i18next": "^17.0.15",
62
+ "react-i18next": "^17.1.9",
63
63
  "react-router-dom": "^7.18.4",
64
64
  "socket.io-client": "^4.8.4",
65
65
  "sonner": "^2.0.8",
@@ -1,85 +0,0 @@
1
- // src/i18n/locales/ms/common.json
2
- var e = "{{product}}", t = "Binaan Dev", n = {
3
- save: "Simpan",
4
- saving: "Menyimpan…",
5
- cancel: "Batal",
6
- close: "Tutup",
7
- confirm: "Sahkan",
8
- delete: "Padam",
9
- edit: "Sunting",
10
- add: "Tambah",
11
- retry: "Cuba semula",
12
- tryAgain: "Cuba lagi",
13
- copy: "Salin",
14
- copied: "Disalin",
15
- back: "Kembali",
16
- next: "Seterusnya",
17
- continue: "Teruskan",
18
- done: "Selesai",
19
- search: "Cari",
20
- clear: "Kosongkan",
21
- reload: "Muat semula",
22
- open: "Buka",
23
- learnMore: "Ketahui lebih lanjut"
24
- }, r = {
25
- loading: "Memuatkan…",
26
- somethingWentWrong: "Berlaku ralat",
27
- noResults: "Tiada hasil",
28
- optional: "Pilihan"
29
- }, i = {
30
- today: "Hari ini",
31
- yesterday: "Semalam",
32
- justNow: "sebentar tadi"
33
- }, a = {
34
- admin: "Pentadbir",
35
- agent: "Ejen"
36
- }, o = {
37
- label: "Penampilan",
38
- system: "Sistem",
39
- light: "Cerah",
40
- dark: "Gelap"
41
- }, s = {
42
- label: "Bahasa",
43
- saveFailed: "Tidak dapat menyimpan pilihan bahasa anda",
44
- loadFailed: "Tidak dapat memuatkan bahasa itu. Muat semula halaman dan cuba lagi."
45
- }, c = {
46
- menu: "Menu akaun",
47
- adminSettings: "Tetapan pentadbir",
48
- changePassword: "Tukar kata laluan",
49
- share: "Kongsi aplikasi ini",
50
- reportIssue: "Laporkan masalah",
51
- about: "Perihal {{appName}}",
52
- signOut: "Log keluar",
53
- emailSupport: "E-mel sokongan"
54
- }, l = {
55
- title: "Berlaku ralat",
56
- body: "Bahagian aplikasi ini mengalami ralat yang tidak dijangka. Ralat telah dilaporkan.",
57
- reload: "Muat semula halaman",
58
- goHome: "Pergi ke peti masuk"
59
- }, u = {
60
- pausedTitle: "{{product}} dijeda",
61
- pausedBody: "Peti masuk pasukan tidak tersedia buat masa ini. Nombor WhatsApp anda kekal dipautkan dan mesej baharu masih diterima. Minta orang yang menguruskan aplikasi ini untuk menyemaknya.",
62
- autoCheck: "Halaman ini menyemak semula setiap minit dan membuka peti masuk apabila ia tersedia.",
63
- code: "Sebab: {{code}}",
64
- checkAgain: "Semak semula",
65
- checking: "Menyemak…"
66
- }, d = {
67
- cta: "Naik taraf ke Enterprise",
68
- agents: "Perlukan lebih banyak ejen AI? EzyChat Enterprise ada satu ejen AI untuk setiap nombor WhatsApp.",
69
- numbers: "Perlukan lebih banyak nombor WhatsApp? EzyChat Enterprise memautkan beberapa nombor ke satu peti masuk pasukan.",
70
- about: "Lebih banyak nombor WhatsApp dan ejen AI, dengan sokongan daripada Anchor Sprint."
71
- }, f = {
72
- appName: e,
73
- devBuild: t,
74
- actions: n,
75
- status: r,
76
- time: i,
77
- roles: a,
78
- theme: o,
79
- language: s,
80
- account: c,
81
- errorBoundary: l,
82
- access: u,
83
- upgrade: d
84
- };
85
- export { u as access, c as account, n as actions, e as appName, f as default, t as devBuild, l as errorBoundary, s as language, a as roles, r as status, o as theme, i as time, d as upgrade };
@@ -1,85 +0,0 @@
1
- // src/i18n/locales/zh-CN/common.json
2
- var e = "{{product}}", t = "开发版本", n = {
3
- save: "保存",
4
- saving: "正在保存…",
5
- cancel: "取消",
6
- close: "关闭",
7
- confirm: "确认",
8
- delete: "删除",
9
- edit: "编辑",
10
- add: "添加",
11
- retry: "重试",
12
- tryAgain: "再试一次",
13
- copy: "复制",
14
- copied: "已复制",
15
- back: "返回",
16
- next: "下一步",
17
- continue: "继续",
18
- done: "完成",
19
- search: "搜索",
20
- clear: "清除",
21
- reload: "重新加载",
22
- open: "打开",
23
- learnMore: "了解更多"
24
- }, r = {
25
- loading: "正在加载…",
26
- somethingWentWrong: "出了点问题",
27
- noResults: "没有结果",
28
- optional: "可选"
29
- }, i = {
30
- today: "今天",
31
- yesterday: "昨天",
32
- justNow: "刚刚"
33
- }, a = {
34
- admin: "管理员",
35
- agent: "客服"
36
- }, o = {
37
- label: "外观",
38
- system: "跟随系统",
39
- light: "浅色",
40
- dark: "深色"
41
- }, s = {
42
- label: "语言",
43
- saveFailed: "无法保存您的语言偏好",
44
- loadFailed: "无法加载该语言,请刷新页面后重试。"
45
- }, c = {
46
- menu: "账户菜单",
47
- adminSettings: "管理设置",
48
- changePassword: "修改密码",
49
- share: "分享此应用",
50
- reportIssue: "报告问题",
51
- about: "关于 {{appName}}",
52
- signOut: "退出登录",
53
- emailSupport: "发送邮件给支持团队"
54
- }, l = {
55
- title: "出了点问题",
56
- body: "应用的这一部分发生了意外错误,错误已上报。",
57
- reload: "重新加载页面",
58
- goHome: "前往收件箱"
59
- }, u = {
60
- pausedTitle: "{{product}} 已暂停",
61
- pausedBody: "团队收件箱目前无法使用。您的 WhatsApp 号码仍保持关联,新消息也照常接收。请联系负责此应用的人员进行检查。",
62
- autoCheck: "此页面每分钟会重新检查一次,收件箱可用时会自动打开。",
63
- code: "原因:{{code}}",
64
- checkAgain: "重新检查",
65
- checking: "正在检查…"
66
- }, d = {
67
- cta: "升级到企业版",
68
- agents: "需要更多 AI 客服?EzyChat Enterprise 为每个 WhatsApp 号码提供一个 AI 客服。",
69
- numbers: "需要更多 WhatsApp 号码?EzyChat Enterprise 可将多个号码连接到同一个团队收件箱。",
70
- about: "更多 WhatsApp 号码和 AI 客服,并由 Anchor Sprint 提供支持。"
71
- }, f = {
72
- appName: e,
73
- devBuild: t,
74
- actions: n,
75
- status: r,
76
- time: i,
77
- roles: a,
78
- theme: o,
79
- language: s,
80
- account: c,
81
- errorBoundary: l,
82
- access: u,
83
- upgrade: d
84
- };
85
- export { u as access, c as account, n as actions, e as appName, f as default, t as devBuild, l as errorBoundary, s as language, a as roles, r as status, o as theme, i as time, d as upgrade };