@ezychat/web 0.0.0-stage → 0.1.39
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.
- package/dist-lib/assets/font-1be3448e292f.woff2 +0 -0
- package/dist-lib/assets/font-3100e775e861.woff2 +0 -0
- package/dist-lib/assets/font-34b9c504cab7.woff2 +0 -0
- package/dist-lib/assets/font-5c66f9e07e90.woff2 +0 -0
- package/dist-lib/assets/font-6e9e020a25f9.woff2 +0 -0
- package/dist-lib/assets/font-71d5ee93cc1e.woff2 +0 -0
- package/dist-lib/assets/font-ca157063339a.woff2 +0 -0
- package/dist-lib/chunks/admin-BPgvUcQO.js +602 -0
- package/dist-lib/chunks/admin-B_hIZ1Sp.js +603 -0
- package/dist-lib/chunks/app-C2A7ZZsu.js +97 -0
- package/dist-lib/chunks/app-RX8Fy2Oz.js +97 -0
- package/dist-lib/chunks/auth-Cif_yktU.js +127 -0
- package/dist-lib/chunks/auth-DJBQd10l.js +127 -0
- package/dist-lib/chunks/common-BwLWsyiW.js +80 -0
- package/dist-lib/chunks/common-CDytP7HK.js +80 -0
- package/dist-lib/chunks/errors-BIyy5VTn.js +39 -0
- package/dist-lib/chunks/errors-CEweqDjm.js +39 -0
- package/dist-lib/chunks/inbox-IiNeuwOm.js +487 -0
- package/dist-lib/chunks/inbox-VvClcCZP.js +487 -0
- package/dist-lib/chunks/registerSW-Gn8zt2XY.js +16 -0
- package/dist-lib/ezychat-web.css +2 -0
- package/dist-lib/index.js +16732 -0
- package/dist-lib/public/apple-touch-icon.png +0 -0
- package/dist-lib/public/brand/ezychat-logo.png +0 -0
- package/dist-lib/public/favicon.ico +0 -0
- package/dist-lib/public/icon-192.png +0 -0
- package/dist-lib/public/icon-512.png +0 -0
- package/dist-lib/public/icon-maskable-512.png +0 -0
- package/dist-lib/public/illustrations/empty-inbox.png +0 -0
- package/dist-lib/public/illustrations/link-whatsapp.png +0 -0
- package/dist-lib/public/illustrations/no-results.png +0 -0
- package/dist-lib/public/illustrations/tunnel.png +0 -0
- package/dist-lib/public/illustrations/welcome.png +0 -0
- package/dist-lib/public/share-app.svg +16 -0
- package/dist-lib/sw.ts +71 -0
- package/dist-lib/types/App.d.ts +2 -0
- package/dist-lib/types/access/AccessGate.d.ts +24 -0
- package/dist-lib/types/access/BannerSlot.d.ts +35 -0
- package/dist-lib/types/access/events.d.ts +16 -0
- package/dist-lib/types/admin/AdminLayout.d.ts +36 -0
- package/dist-lib/types/admin/AiConnectionBanner.d.ts +7 -0
- package/dist-lib/types/admin/AiConnectionSection.d.ts +3 -0
- package/dist-lib/types/admin/AiContextPanel.d.ts +11 -0
- package/dist-lib/types/admin/AiEditDialog.d.ts +13 -0
- package/dist-lib/types/admin/AiMemberPage.d.ts +1 -0
- package/dist-lib/types/admin/AiQuickConnect.d.ts +22 -0
- package/dist-lib/types/admin/AiTryIt.d.ts +8 -0
- package/dist-lib/types/admin/AiVoiceSection.d.ts +2 -0
- package/dist-lib/types/admin/AuditPage.d.ts +1 -0
- package/dist-lib/types/admin/CloudflareSetup.d.ts +5 -0
- package/dist-lib/types/admin/CreateTokenDialog.d.ts +13 -0
- package/dist-lib/types/admin/CustomerEnrichmentSection.d.ts +1 -0
- package/dist-lib/types/admin/EnrichmentAuditScore.d.ts +4 -0
- package/dist-lib/types/admin/IntegrationsSection.d.ts +7 -0
- package/dist-lib/types/admin/MembersPage.d.ts +2 -0
- package/dist-lib/types/admin/QuickRepliesPage.d.ts +2 -0
- package/dist-lib/types/admin/ResolveAllChatsCard.d.ts +1 -0
- package/dist-lib/types/admin/SettingsPage.d.ts +2 -0
- package/dist-lib/types/admin/TokenConnectSteps.d.ts +12 -0
- package/dist-lib/types/admin/TunnelPage.d.ts +1 -0
- package/dist-lib/types/admin/WhatsAppPage.d.ts +11 -0
- package/dist-lib/types/admin/adminUi.d.ts +62 -0
- package/dist-lib/types/admin/ai-status.d.ts +12 -0
- package/dist-lib/types/admin/audit-actions.d.ts +10 -0
- package/dist-lib/types/admin/line-diff.d.ts +26 -0
- package/dist-lib/types/admin/use-chatgpt-sign-in.d.ts +14 -0
- package/dist-lib/types/api/ai.d.ts +174 -0
- package/dist-lib/types/api/client.d.ts +22 -0
- package/dist-lib/types/api/enrichment.d.ts +8 -0
- package/dist-lib/types/api/queries.d.ts +664 -0
- package/dist-lib/types/api/resume-reconnect.d.ts +15 -0
- package/dist-lib/types/api/socket.d.ts +19 -0
- package/dist-lib/types/api/voice.d.ts +33 -0
- package/dist-lib/types/auth/AuthProvider.d.ts +15 -0
- package/dist-lib/types/auth/AuthShell.d.ts +28 -0
- package/dist-lib/types/auth/ChangePasswordPage.d.ts +2 -0
- package/dist-lib/types/auth/LoginPage.d.ts +2 -0
- package/dist-lib/types/auth/RequireAuth.d.ts +12 -0
- package/dist-lib/types/auth/UserMenu.d.ts +5 -0
- package/dist-lib/types/components/app/AboutDialog.d.ts +7 -0
- package/dist-lib/types/components/app/AppCredits.d.ts +8 -0
- package/dist-lib/types/components/app/DesktopUpdates.d.ts +3 -0
- package/dist-lib/types/components/app/DevBuildBadge.d.ts +5 -0
- package/dist-lib/types/components/app/ErrorBoundary.d.ts +23 -0
- package/dist-lib/types/components/app/FeatureRequestAction.d.ts +7 -0
- package/dist-lib/types/components/app/SearchField.d.ts +7 -0
- package/dist-lib/types/components/app/SegmentedControl.d.ts +19 -0
- package/dist-lib/types/components/app/ShareAppAction.d.ts +5 -0
- package/dist-lib/types/components/app/index.d.ts +81 -0
- package/dist-lib/types/components/ui/alert-dialog.d.ts +18 -0
- package/dist-lib/types/components/ui/avatar.d.ts +11 -0
- package/dist-lib/types/components/ui/badge.d.ts +9 -0
- package/dist-lib/types/components/ui/button.d.ts +10 -0
- package/dist-lib/types/components/ui/card.d.ts +9 -0
- package/dist-lib/types/components/ui/checkbox.d.ts +4 -0
- package/dist-lib/types/components/ui/command.d.ts +18 -0
- package/dist-lib/types/components/ui/dialog.d.ts +17 -0
- package/dist-lib/types/components/ui/drawer.d.ts +13 -0
- package/dist-lib/types/components/ui/dropdown-menu.d.ts +25 -0
- package/dist-lib/types/components/ui/input.d.ts +3 -0
- package/dist-lib/types/components/ui/label.d.ts +4 -0
- package/dist-lib/types/components/ui/popover.d.ts +10 -0
- package/dist-lib/types/components/ui/progress.d.ts +4 -0
- package/dist-lib/types/components/ui/radio-group.d.ts +5 -0
- package/dist-lib/types/components/ui/scroll-area.d.ts +5 -0
- package/dist-lib/types/components/ui/select.d.ts +15 -0
- package/dist-lib/types/components/ui/separator.d.ts +4 -0
- package/dist-lib/types/components/ui/sheet.d.ts +14 -0
- package/dist-lib/types/components/ui/skeleton.d.ts +2 -0
- package/dist-lib/types/components/ui/sonner.d.ts +4 -0
- package/dist-lib/types/components/ui/switch.d.ts +6 -0
- package/dist-lib/types/components/ui/table.d.ts +10 -0
- package/dist-lib/types/components/ui/tabs.d.ts +11 -0
- package/dist-lib/types/components/ui/textarea.d.ts +3 -0
- package/dist-lib/types/components/ui/tooltip.d.ts +7 -0
- package/dist-lib/types/create-app.d.ts +20 -0
- package/dist-lib/types/extensions/context.d.ts +8 -0
- package/dist-lib/types/extensions/i18n.d.ts +15 -0
- package/dist-lib/types/extensions/index.d.ts +4 -0
- package/dist-lib/types/extensions/routes.d.ts +12 -0
- package/dist-lib/types/extensions/types.d.ts +116 -0
- package/dist-lib/types/i18n/LanguageSelect.d.ts +4 -0
- package/dist-lib/types/i18n/LocaleSync.d.ts +2 -0
- package/dist-lib/types/i18n/date-locale.d.ts +5 -0
- package/dist-lib/types/i18n/index.d.ts +17 -0
- package/dist-lib/types/i18n/locale-store.d.ts +26 -0
- package/dist-lib/types/i18n/resources.d.ts +1711 -0
- package/dist-lib/types/i18n/use-change-locale.d.ts +9 -0
- package/dist-lib/types/inbox/ChatAvatar.d.ts +13 -0
- package/dist-lib/types/inbox/ChatFilters.d.ts +6 -0
- package/dist-lib/types/inbox/ChatList.d.ts +9 -0
- package/dist-lib/types/inbox/ChatListItem.d.ts +13 -0
- package/dist-lib/types/inbox/Composer.d.ts +30 -0
- package/dist-lib/types/inbox/Conversation.d.ts +7 -0
- package/dist-lib/types/inbox/ConversationHeader.d.ts +25 -0
- package/dist-lib/types/inbox/CustomerPanel.d.ts +32 -0
- package/dist-lib/types/inbox/EmojiPicker.d.ts +6 -0
- package/dist-lib/types/inbox/EventItem.d.ts +14 -0
- package/dist-lib/types/inbox/GettingStartedCard.d.ts +10 -0
- package/dist-lib/types/inbox/GroupPanel.d.ts +19 -0
- package/dist-lib/types/inbox/InboxPage.d.ts +2 -0
- package/dist-lib/types/inbox/MediaView.d.ts +8 -0
- package/dist-lib/types/inbox/MessageBubble.d.ts +31 -0
- package/dist-lib/types/inbox/MessageList.d.ts +21 -0
- package/dist-lib/types/inbox/NotesPanel.d.ts +15 -0
- package/dist-lib/types/inbox/PanelHeader.d.ts +13 -0
- package/dist-lib/types/inbox/ProfileImageContext.d.ts +5 -0
- package/dist-lib/types/inbox/QuickReplyPicker.d.ts +18 -0
- package/dist-lib/types/inbox/ReconnectBanner.d.ts +8 -0
- package/dist-lib/types/inbox/TagInput.d.ts +14 -0
- package/dist-lib/types/inbox/TypingIndicator.d.ts +6 -0
- package/dist-lib/types/inbox/VoiceNote.d.ts +36 -0
- package/dist-lib/types/inbox/WaBanner.d.ts +9 -0
- package/dist-lib/types/inbox/chat-title.d.ts +4 -0
- package/dist-lib/types/inbox/navigation-guard.d.ts +17 -0
- package/dist-lib/types/inbox/timeline.d.ts +26 -0
- package/dist-lib/types/inbox/useCanonicalChatRedirect.d.ts +2 -0
- package/dist-lib/types/inbox/useDirectory.d.ts +21 -0
- package/dist-lib/types/inbox/useSwipeReply.d.ts +11 -0
- package/dist-lib/types/index.d.ts +43 -0
- package/dist-lib/types/lib/ai-handoff.d.ts +4 -0
- package/dist-lib/types/lib/app-links.d.ts +9 -0
- package/dist-lib/types/lib/desktop-updates.d.ts +15 -0
- package/dist-lib/types/lib/error-reporter.d.ts +6 -0
- package/dist-lib/types/lib/format.d.ts +20 -0
- package/dist-lib/types/lib/jid.d.ts +15 -0
- package/dist-lib/types/lib/links.d.ts +40 -0
- package/dist-lib/types/lib/share-app.d.ts +18 -0
- package/dist-lib/types/lib/theme.d.ts +29 -0
- package/dist-lib/types/lib/use-media-query.d.ts +2 -0
- package/dist-lib/types/lib/utils.d.ts +2 -0
- package/dist-lib/types/lib/version.d.ts +12 -0
- package/dist-lib/types/lib/voice-recorder.d.ts +26 -0
- package/dist-lib/types/pwa/InstallHint.d.ts +9 -0
- package/dist-lib/types/pwa/PushToggle.d.ts +20 -0
- package/dist-lib/types/pwa/desktop-notifications.d.ts +18 -0
- package/dist-lib/types/pwa/push.d.ts +13 -0
- package/dist-lib/types/setup/AiAssistantStep.d.ts +9 -0
- package/dist-lib/types/setup/SetupWizard.d.ts +3 -0
- package/dist-lib/types/setup/WaLinkStep.d.ts +8 -0
- package/dist-lib/types/setup/agent-name.d.ts +8 -0
- package/dist-lib/types/setup/connected-label.d.ts +7 -0
- package/dist-lib/types/setup/username.d.ts +9 -0
- package/dist-lib/types/wa/PhoneLink.d.ts +4 -0
- package/package.json +81 -4
- package/README.md +0 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Helpers for WhatsApp JIDs (e.g. `60123456789@s.whatsapp.net`, `12345-678@g.us`). */
|
|
2
|
+
import type { Chat } from '@ezychat/shared';
|
|
3
|
+
export declare function isGroupJid(jid: string): boolean;
|
|
4
|
+
/** The user part before `@` and before any `:device` suffix. */
|
|
5
|
+
export declare function jidUser(jid: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Human-readable phone (`+60123456789`) for phone-number JIDs; '' for a WhatsApp ID (`@lid`),
|
|
8
|
+
* whose digits are never shown; 'Group' for groups; the raw user part for anything else.
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatJid(jid: string): string;
|
|
11
|
+
/** `+<digits>` when WhatsApp has told us the chat's phone number, else null (WhatsApp ID only). */
|
|
12
|
+
export declare function formatPhone(chat: Pick<Chat, 'phone'>): string | null;
|
|
13
|
+
/** For use in route paths: `/chats/${encodeJid(jid)}`. */
|
|
14
|
+
export declare function encodeJid(jid: string): string;
|
|
15
|
+
export declare function decodeJid(param: string): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** External links used for attribution and support across the app. */
|
|
2
|
+
export declare const ANCHOR_SPRINT_URL = "https://www.anchorsprint.com";
|
|
3
|
+
export declare const EZYCHAT_WEBSITE_URL = "https://ezychat.ai/";
|
|
4
|
+
export declare const GITHUB_REPO_URL = "https://github.com/ossmalaysia/ezychat-lite";
|
|
5
|
+
export declare const GITHUB_ISSUES_URL = "https://github.com/ossmalaysia/ezychat-lite/issues/new/choose";
|
|
6
|
+
/** The website feedback form in the app's language, with the running version filled in. */
|
|
7
|
+
export declare function feedbackUrl(locale: string, version: string | null): string;
|
|
8
|
+
/** Contact Anchor Sprint for custom features. */
|
|
9
|
+
export declare const CUSTOM_FEATURE_URL = "https://www.anchorsprint.com";
|
|
10
|
+
/**
|
|
11
|
+
* The outside links the UI shows (About, Report an issue, release notes, feedback, support).
|
|
12
|
+
* Another product build overrides them through `createInboxApp({ links })`; `null` hides a link.
|
|
13
|
+
*/
|
|
14
|
+
export interface AppLinks {
|
|
15
|
+
/** Product website (About, and the share link when there is no source code link). */
|
|
16
|
+
website: string;
|
|
17
|
+
/** "Report an issue" page; when null, an email link to `supportEmail` is shown instead. */
|
|
18
|
+
reportIssue: string | null;
|
|
19
|
+
/** Public source code ("View on GitHub" in About). */
|
|
20
|
+
sourceCode: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Release notes for one version, shown by the desktop update panel. Lite opens its GitHub
|
|
23
|
+
* release through the desktop bridge; another value is opened as a plain link.
|
|
24
|
+
*/
|
|
25
|
+
releaseNotes: ((version: string) => string | null) | null;
|
|
26
|
+
/** The feedback / feature request form in the app's language. */
|
|
27
|
+
feedback: (locale: string, version: string | null) => string;
|
|
28
|
+
/** Support email address (mailto link where there is no report-issue page). */
|
|
29
|
+
supportEmail: string | null;
|
|
30
|
+
}
|
|
31
|
+
/** Lite's links: GitHub repository and issues, feedback on ezychat.ai. */
|
|
32
|
+
export declare const LITE_APP_LINKS: Readonly<AppLinks>;
|
|
33
|
+
/** Lite's links with the given overrides (an explicit `null` hides that link). */
|
|
34
|
+
export declare function resolveAppLinks(overrides?: Partial<AppLinks>): AppLinks;
|
|
35
|
+
/** True when the release notes are Lite's own GitHub releases (opened via the desktop bridge). */
|
|
36
|
+
export declare function isLiteReleaseNotes(links: AppLinks): boolean;
|
|
37
|
+
/** Where "Report an issue" points: the page, else an email to support, else nothing. */
|
|
38
|
+
export declare function reportIssueHref(links: AppLinks): string | null;
|
|
39
|
+
/** The link the share-the-app actions share: the source code page, else the website. */
|
|
40
|
+
export declare function shareAppUrl(links: AppLinks): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Only this public project URL is shared, never the private inbox address. */
|
|
2
|
+
export declare const SHARE_APP_URL = "https://github.com/ossmalaysia/ezychat-lite";
|
|
3
|
+
export declare const SHARE_APP_CAPTION = "I'm using EzyChat Lite \u2014 a free WhatsApp team inbox that runs on my own computer. One number, a shared inbox for my team, and I own my data.";
|
|
4
|
+
/** Social share pages for a link (another product shares its own website). */
|
|
5
|
+
export declare function socialShareLinks(url: string): {
|
|
6
|
+
linkedin: string;
|
|
7
|
+
facebook: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const SOCIAL_SHARE_LINKS: {
|
|
10
|
+
linkedin: string;
|
|
11
|
+
facebook: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function shareAppMessage(caption: string, url?: string): string;
|
|
14
|
+
export declare function copyShareText(text: string): Promise<void>;
|
|
15
|
+
/** Native share failures fall back to copying. Closing the share sheet is quiet. */
|
|
16
|
+
export declare function shareApp(caption: string, url?: string): Promise<'shared' | 'cancelled' | 'copied'>;
|
|
17
|
+
/** Rasterize the static brand card locally; no inbox content enters the image. */
|
|
18
|
+
export declare function downloadShareCard(): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type ThemePreference = 'system' | 'light' | 'dark';
|
|
2
|
+
export type ResolvedTheme = 'light' | 'dark';
|
|
3
|
+
export declare const THEME_STORAGE_KEY = "wati.theme";
|
|
4
|
+
/** `labelKey` is a translation key (`common:theme.*`). */
|
|
5
|
+
export declare const THEME_OPTIONS: readonly [{
|
|
6
|
+
readonly value: "system";
|
|
7
|
+
readonly labelKey: "theme.system";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "light";
|
|
10
|
+
readonly labelKey: "theme.light";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "dark";
|
|
13
|
+
readonly labelKey: "theme.dark";
|
|
14
|
+
}];
|
|
15
|
+
/** Device preference, independent of server settings and shared with other tabs. */
|
|
16
|
+
export declare function createThemeStore(target?: Window): {
|
|
17
|
+
getSnapshot: () => {
|
|
18
|
+
theme: ThemePreference;
|
|
19
|
+
resolvedTheme: ResolvedTheme;
|
|
20
|
+
};
|
|
21
|
+
subscribe(listener: () => void): () => boolean;
|
|
22
|
+
setTheme(value: string): void;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
};
|
|
25
|
+
export declare function useTheme(): {
|
|
26
|
+
setTheme: (value: string) => void;
|
|
27
|
+
theme: ThemePreference;
|
|
28
|
+
resolvedTheme: ResolvedTheme;
|
|
29
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Shape of GET /api/health (only the fields the UI needs). */
|
|
2
|
+
export interface HealthInfo {
|
|
3
|
+
app: string;
|
|
4
|
+
version: string;
|
|
5
|
+
mode: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const healthQueryKey: readonly ["health"];
|
|
8
|
+
/** Version baked into the web bundle at build time (root package.json), or null if not defined. */
|
|
9
|
+
export declare const BUILD_VERSION: string | null;
|
|
10
|
+
export declare function useAppVersion(): string | null;
|
|
11
|
+
/** The server's run mode from GET /api/health ('dev' for local and test servers), or null while unknown. */
|
|
12
|
+
export declare function useServerMode(): string | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records a WhatsApp voice note: microphone → Ogg/Opus (mono, 48 kHz, voice mode), encoded in a
|
|
3
|
+
* worker by opus-recorder's bundled WebAssembly encoder, so every browser (Safari included) yields
|
|
4
|
+
* the format WhatsApp expects. The encoder is loaded only when a recording starts.
|
|
5
|
+
*/
|
|
6
|
+
/** Longest recording; the server refuses longer voice notes. */
|
|
7
|
+
export declare const VOICE_NOTE_MAX_SECONDS = 300;
|
|
8
|
+
export type VoiceSupport = 'ok' | 'insecure' | 'unsupported';
|
|
9
|
+
/** Why a recording could not start. */
|
|
10
|
+
export type VoiceStartError = 'blocked' | 'no-microphone' | 'failed';
|
|
11
|
+
export interface VoiceRecording {
|
|
12
|
+
/** Current input level, 0 (silence) to 1. */
|
|
13
|
+
level(): number;
|
|
14
|
+
/** Ends the recording and returns the Ogg/Opus file. */
|
|
15
|
+
stop(): Promise<Blob>;
|
|
16
|
+
/** Ends the recording and discards it. */
|
|
17
|
+
cancel(): void;
|
|
18
|
+
}
|
|
19
|
+
/** Browsers allow the microphone only on secure pages (https, localhost, the desktop app). */
|
|
20
|
+
export declare function voiceSupport(): VoiceSupport;
|
|
21
|
+
export declare class VoiceStartFailure extends Error {
|
|
22
|
+
readonly reason: VoiceStartError;
|
|
23
|
+
constructor(reason: VoiceStartError);
|
|
24
|
+
}
|
|
25
|
+
/** Must be called from a click or tap: browsers only start audio from a user action. */
|
|
26
|
+
export declare function startVoiceRecording(): Promise<VoiceRecording>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* iOS Safari only delivers notifications to Home Screen web apps.
|
|
3
|
+
* Renders nothing elsewhere (or when `force` is false and already installed).
|
|
4
|
+
*/
|
|
5
|
+
export declare function InstallHint({ className, force }: {
|
|
6
|
+
className?: string;
|
|
7
|
+
force?: boolean;
|
|
8
|
+
}): import("react").JSX.Element | null;
|
|
9
|
+
export default InstallHint;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
/** The two parts of the toggle for a settings row: the switch, and what goes under the row. */
|
|
3
|
+
export interface PushToggleParts {
|
|
4
|
+
/** Just the switch (null when this device cannot turn notifications on). */
|
|
5
|
+
control: React.ReactNode;
|
|
6
|
+
/** Hints and problems, shown under the whole row. */
|
|
7
|
+
notes: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Push-notification opt-in for the current device (place it in the user menu).
|
|
11
|
+
* `compact` renders a single row suitable for menus / side bars. With `children`, it renders
|
|
12
|
+
* nothing itself and hands the switch and its notes to a settings row (`labelledBy` names it).
|
|
13
|
+
*/
|
|
14
|
+
export declare function PushToggle({ compact, className, labelledBy, children, }: {
|
|
15
|
+
compact?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
labelledBy?: string;
|
|
18
|
+
children?: (parts: PushToggleParts) => React.ReactNode;
|
|
19
|
+
}): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
20
|
+
export default PushToggle;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NotificationPayload } from '@ezychat/shared';
|
|
2
|
+
interface DesktopNotifications {
|
|
3
|
+
isSupported(): Promise<boolean>;
|
|
4
|
+
show(notification: NotificationPayload): Promise<boolean>;
|
|
5
|
+
clear(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
watiNotifications?: DesktopNotifications;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare function isDesktopNotifications(): boolean;
|
|
13
|
+
export declare function desktopNotificationsEnabled(): boolean;
|
|
14
|
+
export declare function setDesktopNotifications(enabledNext: boolean): Promise<void>;
|
|
15
|
+
/** Only called for authenticated, targeted live events; history messages never enter this path. */
|
|
16
|
+
export declare function showDesktopNotification(value: NotificationPayload): Promise<void>;
|
|
17
|
+
export declare function clearDesktopNotifications(): void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function isPushSupported(): boolean;
|
|
2
|
+
export declare function isIOS(): boolean;
|
|
3
|
+
export declare function isStandalone(): boolean;
|
|
4
|
+
/** iOS only delivers web push to Home Screen web apps. */
|
|
5
|
+
export declare function needsInstallForPush(): boolean;
|
|
6
|
+
export declare function urlBase64ToUint8Array(base64: string): Uint8Array<ArrayBuffer>;
|
|
7
|
+
export declare function fetchVapidKey(): Promise<string>;
|
|
8
|
+
/** Current service worker registration (waits for it to become ready, max `timeoutMs`). */
|
|
9
|
+
export declare function getSWRegistration(timeoutMs?: number): Promise<ServiceWorkerRegistration | null>;
|
|
10
|
+
export declare function getCurrentSubscription(): Promise<PushSubscription | null>;
|
|
11
|
+
/** Ask permission, subscribe with the server's VAPID key and register the subscription. */
|
|
12
|
+
export declare function subscribePush(): Promise<PushSubscription | null>;
|
|
13
|
+
export declare function unsubscribePush(): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup step 3 (skippable): describe the business, connect the AI, optionally turn it on.
|
|
3
|
+
* Finish creates the Sales Agent with the recommended instructions and hand-off rules, saves the
|
|
4
|
+
* text as one Business context item and turns the agent on when chosen.
|
|
5
|
+
*/
|
|
6
|
+
export declare function AiAssistantStep({ businessName, onDone, }: {
|
|
7
|
+
businessName: string;
|
|
8
|
+
onDone: (aiOn: boolean) => void;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface WaLinkStepProps {
|
|
3
|
+
onContinue?: () => void;
|
|
4
|
+
onSkip?: () => void;
|
|
5
|
+
}
|
|
6
|
+
/** Shows the pairing QR (from wa status) until the number is linked. */
|
|
7
|
+
export declare function WaLinkStep({ onContinue, onSkip }: WaLinkStepProps): React.JSX.Element;
|
|
8
|
+
export default WaLinkStep;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The longest Sales Agent name the server accepts (AiMemberBody.displayName). */
|
|
2
|
+
export declare const AGENT_NAME_MAX = 64;
|
|
3
|
+
/**
|
|
4
|
+
* The Sales Agent name for a business, e.g. "Kedai Aisyah AI". A long business name is shortened at
|
|
5
|
+
* a word boundary so the whole name, the " AI" part included, fits in AGENT_NAME_MAX characters.
|
|
6
|
+
* `format` is the translated template (the business name may come first or last).
|
|
7
|
+
*/
|
|
8
|
+
export declare function agentNameFor(business: string, format: (business: string) => string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
|
+
import type { WaStatus } from '@ezychat/shared';
|
|
3
|
+
/**
|
|
4
|
+
* "Connected as …" for the linked account. A WhatsApp ID (`@lid`) own JID has no printable number,
|
|
5
|
+
* so fall back to the account name, else the plain "Connected." — never an empty number.
|
|
6
|
+
*/
|
|
7
|
+
export declare function connectedAsLabel(me: WaStatus['me'], t: TFunction<'auth'>): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The username offered when "Your name" gives too few usable characters (e.g. a name in Chinese). */
|
|
2
|
+
export declare const USERNAME_FALLBACK = "admin";
|
|
3
|
+
/** "Aisyah Rahman" → "aisyah.rahman"; characters a username cannot hold are dropped (may be short). */
|
|
4
|
+
export declare function usernameFromName(name: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* The username prefilled from "Your name": always a valid username once a name is typed, so the
|
|
7
|
+
* owner never has to type one. Falls back to "admin" when the name gives fewer than 3 characters.
|
|
8
|
+
*/
|
|
9
|
+
export declare function usernameFrom(name: string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** "ABCD1234" → "ABCD-1234", the way WhatsApp displays pairing codes. */
|
|
2
|
+
export declare function formatPairingCode(code: string): string;
|
|
3
|
+
/** Link WhatsApp with a phone number + 8-character pairing code instead of scanning a QR. */
|
|
4
|
+
export declare function PhoneLink(): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,83 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezychat/web",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.39",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "EzyChat core: the team inbox web app (React) as a library, with createInboxApp and its extension API.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/ossmalaysia/ezychat-lite.git",
|
|
10
|
+
"directory": "apps/web"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://ezychat.ai/",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"ezychat-source": "./src/index.ts",
|
|
16
|
+
"types": "./dist-lib/types/index.d.ts",
|
|
17
|
+
"default": "./dist-lib/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./style.css": "./dist-lib/ezychat-web.css",
|
|
20
|
+
"./sw.ts": "./dist-lib/sw.ts",
|
|
21
|
+
"./public/*": {
|
|
22
|
+
"ezychat-source": "./public/*",
|
|
23
|
+
"default": "./dist-lib/public/*"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"types": "./dist-lib/types/index.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist-lib"
|
|
30
|
+
],
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"dev": "vite",
|
|
36
|
+
"build": "vite build && node ../../scripts/precompress-web.mjs",
|
|
37
|
+
"preview": "vite preview",
|
|
38
|
+
"test": "vitest run --passWithNoTests",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"build:lib": "node ../../scripts/build-web-lib.mjs"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@ezychat/shared": "0.1.39",
|
|
44
|
+
"@fontsource-variable/inter": "^5.3.0",
|
|
45
|
+
"@tanstack/react-query": "^5.104.0",
|
|
46
|
+
"@types/react": "^19.3.0",
|
|
47
|
+
"@types/react-dom": "^19.3.0",
|
|
48
|
+
"class-variance-authority": "^0.7.1",
|
|
49
|
+
"clsx": "^2.1.1",
|
|
50
|
+
"cmdk": "^1.1.1",
|
|
51
|
+
"cn": "^0.4.0",
|
|
52
|
+
"date-fns": "^4.4.0",
|
|
53
|
+
"i18next": "^26.4.2",
|
|
54
|
+
"lucide-react": "^1.50.0",
|
|
55
|
+
"next-themes": "^0.4.6",
|
|
56
|
+
"opus-recorder": "8.0.5",
|
|
57
|
+
"qrcode.react": "^4.2.0",
|
|
58
|
+
"radix-ui": "^1.6.7",
|
|
59
|
+
"react": "^19.3.0",
|
|
60
|
+
"react-dom": "^19.3.0",
|
|
61
|
+
"react-i18next": "^17.0.15",
|
|
62
|
+
"react-router-dom": "^7.18.4",
|
|
63
|
+
"socket.io-client": "^4.8.4",
|
|
64
|
+
"sonner": "^2.0.8",
|
|
65
|
+
"tailwind-merge": "^3.7.0",
|
|
66
|
+
"tw-animate-css": "^1.4.0",
|
|
67
|
+
"vaul": "^1.1.2"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
71
|
+
"@testing-library/dom": "^10.4.2",
|
|
72
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
73
|
+
"@testing-library/react": "^16.3.3",
|
|
74
|
+
"@testing-library/user-event": "^14.6.7",
|
|
75
|
+
"@vitejs/plugin-react": "^6.1.1",
|
|
76
|
+
"jsdom": "^30.1.1",
|
|
77
|
+
"tailwindcss": "^4.3.3",
|
|
78
|
+
"vite": "^8.3.2",
|
|
79
|
+
"vite-plugin-pwa": "^1.3.0",
|
|
80
|
+
"workbox-precaching": "^7.4.1",
|
|
81
|
+
"workbox-window": "^7.4.1"
|
|
82
|
+
}
|
|
83
|
+
}
|
package/README.md
DELETED