@greatapps/greatchat-ui 0.1.5 → 0.2.0

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 (42) hide show
  1. package/dist/index.d.ts +106 -5
  2. package/dist/index.js +1787 -1116
  3. package/dist/index.js.map +1 -1
  4. package/package.json +17 -13
  5. package/src/components/channel-card.tsx +1 -1
  6. package/src/components/channel-create-dialog.tsx +126 -0
  7. package/src/components/channel-edit-dialog.tsx +132 -0
  8. package/src/components/channels-page.tsx +242 -0
  9. package/src/components/chat-dashboard.tsx +433 -0
  10. package/src/components/chat-input.tsx +1 -2
  11. package/src/components/chat-view.tsx +1 -8
  12. package/src/components/contact-avatar.tsx +1 -2
  13. package/src/components/contact-form-dialog.tsx +139 -0
  14. package/src/components/contact-info-panel.tsx +1 -4
  15. package/src/components/contacts-page.tsx +41 -0
  16. package/src/components/contacts-table.tsx +216 -0
  17. package/src/components/data-table.tsx +185 -0
  18. package/src/components/inbox-item.tsx +6 -4
  19. package/src/components/inbox-page.tsx +167 -0
  20. package/src/components/inbox-sidebar.tsx +1 -5
  21. package/src/components/message-bubble.tsx +4 -6
  22. package/src/components/new-conversation-dialog.tsx +2 -6
  23. package/src/components/whatsapp-icon.tsx +21 -0
  24. package/src/components/whatsapp-qr-dialog.tsx +147 -0
  25. package/src/components/whatsapp-status-badge.tsx +1 -1
  26. package/src/index.ts +37 -2
  27. package/src/components/ui/alert-dialog.tsx +0 -167
  28. package/src/components/ui/avatar.tsx +0 -51
  29. package/src/components/ui/badge.tsx +0 -44
  30. package/src/components/ui/button.tsx +0 -62
  31. package/src/components/ui/command.tsx +0 -106
  32. package/src/components/ui/dialog.tsx +0 -133
  33. package/src/components/ui/dropdown-menu.tsx +0 -173
  34. package/src/components/ui/input.tsx +0 -19
  35. package/src/components/ui/scroll-area.tsx +0 -50
  36. package/src/components/ui/select.tsx +0 -156
  37. package/src/components/ui/separator.tsx +0 -26
  38. package/src/components/ui/skeleton.tsx +0 -16
  39. package/src/components/ui/tabs.tsx +0 -64
  40. package/src/components/ui/textarea.tsx +0 -18
  41. package/src/components/ui/tooltip.tsx +0 -58
  42. package/src/lib/utils.ts +0 -6
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { ClassValue } from 'clsx';
1
+ export { cn } from '@greatapps/greatauth-ui/ui';
2
2
  import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import * as _tanstack_query_core from '@tanstack/query-core';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { ReactNode } from 'react';
5
+ import { ReactNode, SVGProps } from 'react';
6
+ import { ColumnDef } from '@tanstack/react-table';
6
7
 
7
8
  interface ApiResponse<T> {
8
9
  status: 0 | 1;
@@ -137,8 +138,6 @@ declare function createGchatClient(config: GchatClientConfig): {
137
138
  provisionChannel: (idAccount: number, id: number) => Promise<ApiResponse<unknown>>;
138
139
  };
139
140
 
140
- declare function cn(...inputs: ClassValue[]): string;
141
-
142
141
  /**
143
142
  * Groups messages by date. Assumes messages are pre-sorted by datetime_add (ascending).
144
143
  */
@@ -484,4 +483,106 @@ interface WhatsappStatusBadgeProps {
484
483
  }
485
484
  declare function WhatsappStatusBadge({ status, hasSession, }: WhatsappStatusBadgeProps): react_jsx_runtime.JSX.Element;
486
485
 
487
- export { type ApiResponse, type Channel, ChannelCard, type ChannelCardProps, ChatInput, type ChatInputProps, ChatView, type ChatViewProps, type Contact, ContactAvatar, type ContactAvatarProps, ContactInfoPanel, type ContactInfoPanelProps, DEFAULT_CHANNEL_STATUS_POLLING, DEFAULT_INBOX_POLLING, DEFAULT_MESSAGES_POLLING, DEFAULT_QR_POLLING, type GchatClientConfig, type GchatHookConfig, type Inbox, InboxItem, type InboxItemProps, type InboxMessage, InboxSidebar, type InboxSidebarProps, type InboxStats, MessageBubble, type MessageBubbleProps, type MessageContentType, NewConversationDialog, type NewConversationDialogProps, type WhatsappStatus, WhatsappStatusBadge, type WhatsappStatusBadgeProps, cn, createGchatClient, formatDateGroup, formatMessageTime, groupMessagesByDate, useChannelQR, useChannelWhatsappStatus, useChannels, useConnectChannel, useContacts, useCreateChannel, useCreateContact, useCreateInbox, useDeleteChannel, useDeleteContact, useDeleteInbox, useDisconnectChannel, useEditMessage, useGetContact, useInbox, useInboxMessages, useInboxStats, useInboxes, useLogoutChannel, useRetryMessage, useRevokeMessage, useSendMessage, useUpdateChannel, useUpdateContact, useUpdateInbox };
486
+ declare function WhatsappIcon(props: SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
487
+
488
+ interface WhatsappQrDialogProps {
489
+ open: boolean;
490
+ onOpenChange: (open: boolean) => void;
491
+ channelId: number;
492
+ config: GchatHookConfig;
493
+ }
494
+ declare function WhatsappQrDialog({ open, onOpenChange, channelId, config, }: WhatsappQrDialogProps): react_jsx_runtime.JSX.Element;
495
+
496
+ interface ChannelCreateDialogProps {
497
+ open: boolean;
498
+ onOpenChange: (open: boolean) => void;
499
+ config: GchatHookConfig;
500
+ renderAgentSelect?: (props: {
501
+ value: number | null;
502
+ onChange: (value: number | null) => void;
503
+ disabled?: boolean;
504
+ }) => ReactNode;
505
+ }
506
+ declare function ChannelCreateDialog({ open, onOpenChange, config, renderAgentSelect, }: ChannelCreateDialogProps): react_jsx_runtime.JSX.Element;
507
+
508
+ interface ChannelEditDialogProps {
509
+ open: boolean;
510
+ onOpenChange: (open: boolean) => void;
511
+ channel: Channel;
512
+ config: GchatHookConfig;
513
+ renderAgentSelect?: (props: {
514
+ value: number | null;
515
+ onChange: (value: number | null) => void;
516
+ disabled?: boolean;
517
+ }) => ReactNode;
518
+ }
519
+ declare function ChannelEditDialog({ open, onOpenChange, channel, config, renderAgentSelect, }: ChannelEditDialogProps): react_jsx_runtime.JSX.Element;
520
+
521
+ interface ContactFormDialogProps {
522
+ open: boolean;
523
+ onOpenChange: (open: boolean) => void;
524
+ contact?: Contact;
525
+ config: GchatHookConfig;
526
+ }
527
+ declare function ContactFormDialog({ open, onOpenChange, contact, config, }: ContactFormDialogProps): react_jsx_runtime.JSX.Element;
528
+
529
+ interface ContactsTableProps {
530
+ config: GchatHookConfig;
531
+ }
532
+ declare function ContactsTable({ config }: ContactsTableProps): react_jsx_runtime.JSX.Element;
533
+
534
+ interface DataTableProps<TData, TValue> {
535
+ columns: ColumnDef<TData, TValue>[];
536
+ data: TData[];
537
+ isLoading?: boolean;
538
+ emptyMessage?: string;
539
+ total?: number;
540
+ page?: number;
541
+ onPageChange?: (page: number) => void;
542
+ pageSize?: number;
543
+ onRowClick?: (row: TData) => void;
544
+ selectedRowId?: string | number | null;
545
+ getRowId?: (row: TData) => string | number;
546
+ compact?: boolean;
547
+ }
548
+ declare function DataTable<TData, TValue>({ columns, data, isLoading, emptyMessage, total, page, onPageChange, pageSize, onRowClick, selectedRowId, getRowId, compact, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
549
+
550
+ interface InboxPageProps {
551
+ config: GchatHookConfig;
552
+ filterChannelId?: number | null;
553
+ }
554
+ declare function InboxPage({ config, filterChannelId }: InboxPageProps): react_jsx_runtime.JSX.Element;
555
+
556
+ interface ChannelsPageProps {
557
+ config: GchatHookConfig;
558
+ renderAgentSelect?: (props: {
559
+ value: number | null;
560
+ onChange: (value: number | null) => void;
561
+ disabled?: boolean;
562
+ }) => ReactNode;
563
+ /** Optional: resolve agent info for a channel. Returns { name, active } */
564
+ getAgentInfo?: (idAgent: number | null) => {
565
+ name: string;
566
+ active: boolean;
567
+ } | null;
568
+ }
569
+ declare function ChannelsPage({ config, renderAgentSelect, getAgentInfo, }: ChannelsPageProps): react_jsx_runtime.JSX.Element;
570
+
571
+ interface ContactsPageProps {
572
+ config: GchatHookConfig;
573
+ }
574
+ declare function ContactsPage({ config }: ContactsPageProps): react_jsx_runtime.JSX.Element;
575
+
576
+ interface ChatDashboardProps {
577
+ config: GchatHookConfig;
578
+ userName?: string;
579
+ onNavigateToInbox?: (filters?: {
580
+ status?: string;
581
+ channelId?: number;
582
+ }) => void;
583
+ onNavigateToChannels?: () => void;
584
+ renderExtraSection?: () => ReactNode;
585
+ }
586
+ declare function ChatDashboard({ config, userName, onNavigateToInbox, onNavigateToChannels, renderExtraSection, }: ChatDashboardProps): react_jsx_runtime.JSX.Element;
587
+
588
+ export { type ApiResponse, type Channel, ChannelCard, type ChannelCardProps, ChannelCreateDialog, type ChannelCreateDialogProps, ChannelEditDialog, type ChannelEditDialogProps, ChannelsPage, type ChannelsPageProps, ChatDashboard, type ChatDashboardProps, ChatInput, type ChatInputProps, ChatView, type ChatViewProps, type Contact, ContactAvatar, type ContactAvatarProps, ContactFormDialog, type ContactFormDialogProps, ContactInfoPanel, type ContactInfoPanelProps, ContactsPage, type ContactsPageProps, ContactsTable, type ContactsTableProps, DEFAULT_CHANNEL_STATUS_POLLING, DEFAULT_INBOX_POLLING, DEFAULT_MESSAGES_POLLING, DEFAULT_QR_POLLING, DataTable, type DataTableProps, type GchatClientConfig, type GchatHookConfig, type Inbox, InboxItem, type InboxItemProps, type InboxMessage, InboxPage, type InboxPageProps, InboxSidebar, type InboxSidebarProps, type InboxStats, MessageBubble, type MessageBubbleProps, type MessageContentType, NewConversationDialog, type NewConversationDialogProps, WhatsappIcon, WhatsappQrDialog, type WhatsappQrDialogProps, type WhatsappStatus, WhatsappStatusBadge, type WhatsappStatusBadgeProps, createGchatClient, formatDateGroup, formatMessageTime, groupMessagesByDate, useChannelQR, useChannelWhatsappStatus, useChannels, useConnectChannel, useContacts, useCreateChannel, useCreateContact, useCreateInbox, useDeleteChannel, useDeleteContact, useDeleteInbox, useDisconnectChannel, useEditMessage, useGetContact, useInbox, useInboxMessages, useInboxStats, useInboxes, useLogoutChannel, useRetryMessage, useRevokeMessage, useSendMessage, useUpdateChannel, useUpdateContact, useUpdateInbox };