@meistrari/chat-nuxt 1.11.0 → 1.12.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 (72) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +15 -0
  3. package/dist/runtime/components/chat/conversation-item.d.vue.ts +6 -1
  4. package/dist/runtime/components/chat/conversation-item.vue +30 -141
  5. package/dist/runtime/components/chat/conversation-item.vue.d.ts +6 -1
  6. package/dist/runtime/components/chat/conversation-list.d.vue.ts +1 -0
  7. package/dist/runtime/components/chat/conversation-list.vue +300 -72
  8. package/dist/runtime/components/chat/conversation-list.vue.d.ts +1 -0
  9. package/dist/runtime/components/chat/conversation-new-group-button.d.vue.ts +7 -0
  10. package/dist/runtime/components/chat/conversation-new-group-button.vue +90 -0
  11. package/dist/runtime/components/chat/conversation-new-group-button.vue.d.ts +7 -0
  12. package/dist/runtime/components/chat/conversation-new-group-popover-content.d.vue.ts +23 -0
  13. package/dist/runtime/components/chat/conversation-new-group-popover-content.vue +75 -0
  14. package/dist/runtime/components/chat/conversation-new-group-popover-content.vue.d.ts +23 -0
  15. package/dist/runtime/components/chat/mobile/shell/drawer.d.vue.ts +2 -2
  16. package/dist/runtime/components/chat/mobile/shell/drawer.vue +370 -41
  17. package/dist/runtime/components/chat/mobile/shell/drawer.vue.d.ts +2 -2
  18. package/dist/runtime/components/chat/mobile/shell/shell.d.vue.ts +6 -6
  19. package/dist/runtime/components/chat/mobile/shell/shell.vue +1 -1
  20. package/dist/runtime/components/chat/mobile/shell/shell.vue.d.ts +6 -6
  21. package/dist/runtime/components/chat/topbar.d.vue.ts +2 -2
  22. package/dist/runtime/components/chat/topbar.vue.d.ts +2 -2
  23. package/dist/runtime/composables/useConversationGroups.d.ts +12 -0
  24. package/dist/runtime/composables/useConversationGroups.js +160 -0
  25. package/dist/runtime/composables/useConversationItem.d.ts +48 -0
  26. package/dist/runtime/composables/useConversationItem.js +176 -0
  27. package/dist/runtime/composables/useConversationList.d.ts +128 -0
  28. package/dist/runtime/composables/useConversationList.js +553 -0
  29. package/dist/runtime/composables/useConversations.d.ts +2 -0
  30. package/dist/runtime/composables/useConversations.js +45 -1
  31. package/dist/runtime/composables/usePendingConversationGroup.d.ts +5 -0
  32. package/dist/runtime/composables/usePendingConversationGroup.js +33 -0
  33. package/dist/runtime/embed/components/ChatConfigurationModal.d.vue.ts +1 -1
  34. package/dist/runtime/embed/components/ChatConfigurationModal.vue.d.ts +1 -1
  35. package/dist/runtime/embed/components/ChatEmbedInner.vue +24 -5
  36. package/dist/runtime/server/api/chat/conversations/[id]/group.patch.d.ts +1 -0
  37. package/dist/runtime/server/api/chat/conversations/[id]/group.patch.js +1 -0
  38. package/dist/runtime/server/api/chat/conversations/groups/[groupId]/index.delete.d.ts +1 -0
  39. package/dist/runtime/server/api/chat/conversations/groups/[groupId]/index.delete.js +1 -0
  40. package/dist/runtime/server/api/chat/conversations/groups/[groupId]/index.patch.d.ts +1 -0
  41. package/dist/runtime/server/api/chat/conversations/groups/[groupId]/index.patch.js +1 -0
  42. package/dist/runtime/server/api/chat/conversations/groups/index.get.d.ts +1 -0
  43. package/dist/runtime/server/api/chat/conversations/groups/index.get.js +1 -0
  44. package/dist/runtime/server/api/chat/conversations/groups/index.post.d.ts +1 -0
  45. package/dist/runtime/server/api/chat/conversations/groups/index.post.js +1 -0
  46. package/dist/runtime/server/api/conversations/[id]/duplicate.post.js +1 -0
  47. package/dist/runtime/server/api/conversations/[id]/group.patch.d.ts +2 -0
  48. package/dist/runtime/server/api/conversations/[id]/group.patch.js +46 -0
  49. package/dist/runtime/server/api/conversations/groups/[groupId]/index.delete.d.ts +4 -0
  50. package/dist/runtime/server/api/conversations/groups/[groupId]/index.delete.js +25 -0
  51. package/dist/runtime/server/api/conversations/groups/[groupId]/index.patch.d.ts +2 -0
  52. package/dist/runtime/server/api/conversations/groups/[groupId]/index.patch.js +30 -0
  53. package/dist/runtime/server/api/conversations/groups/index.get.d.ts +2 -0
  54. package/dist/runtime/server/api/conversations/groups/index.get.js +13 -0
  55. package/dist/runtime/server/api/conversations/groups/index.post.d.ts +2 -0
  56. package/dist/runtime/server/api/conversations/groups/index.post.js +26 -0
  57. package/dist/runtime/server/api/conversations/index.post.js +1 -0
  58. package/dist/runtime/server/db/schema/conversation-groups.d.ts +143 -0
  59. package/dist/runtime/server/db/schema/conversation-groups.js +20 -0
  60. package/dist/runtime/server/db/schema/conversations.d.ts +17 -0
  61. package/dist/runtime/server/db/schema/conversations.js +3 -0
  62. package/dist/runtime/server/db/schema/index.d.ts +1 -0
  63. package/dist/runtime/server/db/schema/index.js +1 -0
  64. package/dist/runtime/server/utils/conversation-group.d.ts +4 -0
  65. package/dist/runtime/server/utils/conversation-group.js +48 -0
  66. package/dist/runtime/types/chat.d.ts +2 -1
  67. package/dist/runtime/utils/conversation-groups.d.ts +18 -0
  68. package/dist/runtime/utils/conversation-groups.js +30 -0
  69. package/drizzle/0016_dry_aaron_stack.sql +16 -0
  70. package/drizzle/meta/0016_snapshot.json +887 -0
  71. package/drizzle/meta/_journal.json +7 -0
  72. package/package.json +1 -1
@@ -0,0 +1,30 @@
1
+ function byUpdatedAtDesc(a, b) {
2
+ return new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime();
3
+ }
4
+ function byGroupOrder(a, b) {
5
+ const createdAtDelta = new Date(a.createdAt ?? 0).getTime() - new Date(b.createdAt ?? 0).getTime();
6
+ if (createdAtDelta !== 0)
7
+ return createdAtDelta;
8
+ return a.name.localeCompare(b.name);
9
+ }
10
+ export function groupConversationsByGroup(conversations, groups) {
11
+ const groupById = new Map(groups.map((group) => [group.id, group]));
12
+ const itemsByGroupId = /* @__PURE__ */ new Map();
13
+ const unfiled = [];
14
+ for (const conversation of conversations) {
15
+ if (conversation.groupId && groupById.has(conversation.groupId)) {
16
+ const groupItems = itemsByGroupId.get(conversation.groupId) ?? [];
17
+ groupItems.push(conversation);
18
+ itemsByGroupId.set(conversation.groupId, groupItems);
19
+ continue;
20
+ }
21
+ unfiled.push(conversation);
22
+ }
23
+ return {
24
+ groups: [...groups].sort(byGroupOrder).map((group) => ({
25
+ group,
26
+ items: [...itemsByGroupId.get(group.id) ?? []].sort(byUpdatedAtDesc)
27
+ })),
28
+ unfiled: [...unfiled].sort(byUpdatedAtDesc)
29
+ };
30
+ }
@@ -0,0 +1,16 @@
1
+ CREATE TABLE "chat"."conversation_groups" (
2
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3
+ "workspace_id" text NOT NULL,
4
+ "tela_agent_id" text,
5
+ "conversation_scope" text,
6
+ "name" text NOT NULL,
7
+ "created_by" text,
8
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
9
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
10
+ );
11
+ --> statement-breakpoint
12
+ ALTER TABLE "chat"."conversations" ADD COLUMN "group_id" uuid;--> statement-breakpoint
13
+ CREATE INDEX "idx_conversation_groups_workspace" ON "chat"."conversation_groups" USING btree ("workspace_id");--> statement-breakpoint
14
+ CREATE INDEX "idx_conversation_groups_runtime_created_at" ON "chat"."conversation_groups" USING btree ("workspace_id","tela_agent_id","conversation_scope","created_at");--> statement-breakpoint
15
+ ALTER TABLE "chat"."conversations" ADD CONSTRAINT "conversations_group_id_conversation_groups_id_fk" FOREIGN KEY ("group_id") REFERENCES "chat"."conversation_groups"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
16
+ CREATE INDEX "idx_conversations_group" ON "chat"."conversations" USING btree ("group_id");