@meistrari/chat-nuxt 1.1.2 → 1.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 (151) hide show
  1. package/README.md +95 -11
  2. package/dist/module.d.mts +5 -0
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +96 -23
  5. package/dist/runtime/components/chat/conversation-list.d.vue.ts +1 -0
  6. package/dist/runtime/components/chat/conversation-list.vue +22 -2
  7. package/dist/runtime/components/chat/conversation-list.vue.d.ts +1 -0
  8. package/dist/runtime/components/chat/message-list.d.vue.ts +1 -0
  9. package/dist/runtime/components/chat/message-list.vue +23 -2
  10. package/dist/runtime/components/chat/message-list.vue.d.ts +1 -0
  11. package/dist/runtime/composables/useChat.d.ts +2 -1
  12. package/dist/runtime/composables/useChat.js +32 -3
  13. package/dist/runtime/composables/useChatApi.js +2 -1
  14. package/dist/runtime/composables/useConversations.d.ts +3 -2
  15. package/dist/runtime/composables/useConversations.js +99 -11
  16. package/dist/runtime/composables/useEmbedConfig.d.ts +11 -6
  17. package/dist/runtime/composables/useEmbedConfig.js +35 -7
  18. package/dist/runtime/composables/useIDB.js +4 -0
  19. package/dist/runtime/composables/usePdf.d.ts +840 -1
  20. package/dist/runtime/composables/usePdf.js +21 -3
  21. package/dist/runtime/composables/useWorkspaceContextFiles.d.ts +3 -3
  22. package/dist/runtime/composables/useWorkspaceContextFiles.js +19 -10
  23. package/dist/runtime/composables/useWorkspaceCredentials.d.ts +3 -3
  24. package/dist/runtime/composables/useWorkspaceExternalSkills.d.ts +1 -1
  25. package/dist/runtime/composables/useWorkspaceExternalSkills.js +5 -6
  26. package/dist/runtime/composables/useWorkspacePersonalization.d.ts +1 -1
  27. package/dist/runtime/composables/useWorkspacePersonalization.js +4 -5
  28. package/dist/runtime/composables/useWorkspaceSettings.js +12 -9
  29. package/dist/runtime/embed/components/ChatConfigurationModal.d.vue.ts +25 -0
  30. package/dist/runtime/embed/components/ChatConfigurationModal.vue +373 -0
  31. package/dist/runtime/embed/components/ChatConfigurationModal.vue.d.ts +25 -0
  32. package/dist/runtime/embed/components/ChatEmbed.vue +12 -1
  33. package/dist/runtime/embed/components/ChatEmbedInner.vue +31 -16
  34. package/dist/runtime/embed/components/configuration/ChatConfigurationContextFilesTab.d.vue.ts +22 -0
  35. package/dist/runtime/embed/components/configuration/ChatConfigurationContextFilesTab.vue +133 -0
  36. package/dist/runtime/embed/components/configuration/ChatConfigurationContextFilesTab.vue.d.ts +22 -0
  37. package/dist/runtime/embed/components/configuration/ChatConfigurationCredentialsTab.d.vue.ts +10 -0
  38. package/dist/runtime/embed/components/configuration/ChatConfigurationCredentialsTab.vue +220 -0
  39. package/dist/runtime/embed/components/configuration/ChatConfigurationCredentialsTab.vue.d.ts +10 -0
  40. package/dist/runtime/embed/components/configuration/ChatConfigurationExternalSkillsTab.d.vue.ts +32 -0
  41. package/dist/runtime/embed/components/configuration/ChatConfigurationExternalSkillsTab.vue +222 -0
  42. package/dist/runtime/embed/components/configuration/ChatConfigurationExternalSkillsTab.vue.d.ts +32 -0
  43. package/dist/runtime/embed/components/configuration/ChatConfigurationKnowledgeSourcesTab.d.vue.ts +18 -0
  44. package/dist/runtime/embed/components/configuration/ChatConfigurationKnowledgeSourcesTab.vue +142 -0
  45. package/dist/runtime/embed/components/configuration/ChatConfigurationKnowledgeSourcesTab.vue.d.ts +18 -0
  46. package/dist/runtime/embed/components/configuration/ChatConfigurationPersonalizationTab.d.vue.ts +10 -0
  47. package/dist/runtime/embed/components/configuration/ChatConfigurationPersonalizationTab.vue +37 -0
  48. package/dist/runtime/embed/components/configuration/ChatConfigurationPersonalizationTab.vue.d.ts +10 -0
  49. package/dist/runtime/embed/components/configuration/ChatConfigurationTelaToolsTab.d.vue.ts +20 -0
  50. package/dist/runtime/embed/components/configuration/ChatConfigurationTelaToolsTab.vue +146 -0
  51. package/dist/runtime/embed/components/configuration/ChatConfigurationTelaToolsTab.vue.d.ts +20 -0
  52. package/dist/runtime/server/api/admin/trigger-usage-report.post.d.ts +4 -1
  53. package/dist/runtime/server/api/admin/trigger-usage-report.post.js +2 -0
  54. package/dist/runtime/server/api/chat/workspace/settings.get.d.ts +1 -1
  55. package/dist/runtime/server/api/chat/workspace/settings.get.js +1 -0
  56. package/dist/runtime/server/api/conversations/[id]/cancel.post.d.ts +4 -1
  57. package/dist/runtime/server/api/conversations/[id]/cancel.post.js +1 -0
  58. package/dist/runtime/server/api/conversations/[id]/clear.post.d.ts +1 -1
  59. package/dist/runtime/server/api/conversations/[id]/clear.post.js +1 -0
  60. package/dist/runtime/server/api/conversations/[id]/duplicate.post.d.ts +1 -1
  61. package/dist/runtime/server/api/conversations/[id]/duplicate.post.js +46 -12
  62. package/dist/runtime/server/api/conversations/[id]/files.get.d.ts +1 -1
  63. package/dist/runtime/server/api/conversations/[id]/files.get.js +2 -0
  64. package/dist/runtime/server/api/conversations/[id]/index.delete.d.ts +3 -1
  65. package/dist/runtime/server/api/conversations/[id]/index.delete.js +1 -0
  66. package/dist/runtime/server/api/conversations/[id]/index.get.d.ts +1 -1
  67. package/dist/runtime/server/api/conversations/[id]/index.get.js +1 -0
  68. package/dist/runtime/server/api/conversations/[id]/index.patch.d.ts +1 -1
  69. package/dist/runtime/server/api/conversations/[id]/index.patch.js +1 -0
  70. package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.d.ts +1 -1
  71. package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.js +2 -0
  72. package/dist/runtime/server/api/conversations/[id]/messages/index.get.d.ts +14 -1
  73. package/dist/runtime/server/api/conversations/[id]/messages/index.get.js +2 -0
  74. package/dist/runtime/server/api/conversations/[id]/messages/index.post.d.ts +4 -1
  75. package/dist/runtime/server/api/conversations/[id]/messages/index.post.js +2 -0
  76. package/dist/runtime/server/api/conversations/[id]/usage.get.d.ts +1 -1
  77. package/dist/runtime/server/api/conversations/[id]/usage.get.js +1 -0
  78. package/dist/runtime/server/api/conversations/generate-title.post.d.ts +3 -1
  79. package/dist/runtime/server/api/conversations/generate-title.post.js +2 -0
  80. package/dist/runtime/server/api/conversations/index.get.d.ts +1 -1
  81. package/dist/runtime/server/api/conversations/index.get.js +1 -0
  82. package/dist/runtime/server/api/conversations/index.post.d.ts +1 -1
  83. package/dist/runtime/server/api/conversations/index.post.js +1 -0
  84. package/dist/runtime/server/api/external-skills/discover.post.d.ts +1 -1
  85. package/dist/runtime/server/api/external-skills/discover.post.js +2 -0
  86. package/dist/runtime/server/api/github/disconnect.post.d.ts +3 -1
  87. package/dist/runtime/server/api/github/disconnect.post.js +2 -0
  88. package/dist/runtime/server/api/github/status.get.d.ts +1 -1
  89. package/dist/runtime/server/api/github/status.get.js +2 -0
  90. package/dist/runtime/server/api/tela/canvas.get.d.ts +1 -1
  91. package/dist/runtime/server/api/tela/canvas.get.js +1 -0
  92. package/dist/runtime/server/api/tela/projects.get.d.ts +1 -1
  93. package/dist/runtime/server/api/tela/projects.get.js +1 -0
  94. package/dist/runtime/server/api/tela/workspaces.get.d.ts +1 -1
  95. package/dist/runtime/server/api/tela/workspaces.get.js +1 -0
  96. package/dist/runtime/server/api/tela/workstations.get.d.ts +1 -1
  97. package/dist/runtime/server/api/tela/workstations.get.js +1 -0
  98. package/dist/runtime/server/api/vault/permalink-metadata.post.d.ts +5 -1
  99. package/dist/runtime/server/api/vault/permalink-metadata.post.js +2 -0
  100. package/dist/runtime/server/api/vault/resolve.post.d.ts +9 -1
  101. package/dist/runtime/server/api/vault/resolve.post.js +2 -0
  102. package/dist/runtime/server/api/vault/upload.post.d.ts +6 -1
  103. package/dist/runtime/server/api/vault/upload.post.js +2 -0
  104. package/dist/runtime/server/api/workspace/credentials/[id].delete.d.ts +3 -1
  105. package/dist/runtime/server/api/workspace/credentials/[id].delete.js +1 -0
  106. package/dist/runtime/server/api/workspace/credentials/[id].put.d.ts +1 -1
  107. package/dist/runtime/server/api/workspace/credentials/[id].put.js +1 -0
  108. package/dist/runtime/server/api/workspace/credentials/index.get.d.ts +1 -1
  109. package/dist/runtime/server/api/workspace/credentials/index.get.js +1 -0
  110. package/dist/runtime/server/api/workspace/credentials/index.post.d.ts +1 -1
  111. package/dist/runtime/server/api/workspace/credentials/index.post.js +1 -0
  112. package/dist/runtime/server/api/workspace/settings.get.d.ts +1 -1
  113. package/dist/runtime/server/api/workspace/settings.get.js +1 -0
  114. package/dist/runtime/server/api/workspace/settings.patch.d.ts +1 -1
  115. package/dist/runtime/server/api/workspace/settings.patch.js +1 -0
  116. package/dist/runtime/server/api/workspace/usage.get.d.ts +1 -1
  117. package/dist/runtime/server/api/workspace/usage.get.js +1 -0
  118. package/dist/runtime/server/db/index.js +1 -0
  119. package/dist/runtime/server/middleware/domain-validation.d.ts +1 -1
  120. package/dist/runtime/server/middleware/domain-validation.js +2 -0
  121. package/dist/runtime/server/middleware/request-logger.d.ts +1 -1
  122. package/dist/runtime/server/middleware/request-logger.js +1 -0
  123. package/dist/runtime/server/tasks/send-daily-usage-report.d.ts +1 -1
  124. package/dist/runtime/server/tasks/send-daily-usage-report.js +1 -0
  125. package/dist/runtime/server/utils/agent-api.d.ts +1 -1
  126. package/dist/runtime/server/utils/agent-api.js +2 -0
  127. package/dist/runtime/server/utils/auth-api.js +2 -0
  128. package/dist/runtime/server/utils/auth.d.ts +1 -1
  129. package/dist/runtime/server/utils/auth.js +1 -0
  130. package/dist/runtime/server/utils/tela-api.d.ts +1 -1
  131. package/dist/runtime/server/utils/tela-api.js +2 -0
  132. package/dist/runtime/server/utils/workspace.js +1 -0
  133. package/dist/runtime/types/chat.d.ts +2 -1
  134. package/dist/runtime/types/workspace-settings.d.ts +3 -0
  135. package/dist/runtime/types/workspace-settings.js +0 -0
  136. package/dist/runtime/utils/conversation-list-skeleton.d.ts +31 -0
  137. package/dist/runtime/utils/conversation-list-skeleton.js +12 -0
  138. package/dist/runtime/utils/file.js +42 -42
  139. package/dist/types.d.mts +2 -0
  140. package/package.json +24 -12
  141. package/dist/runtime/composables/PageNavigation.d.ts +0 -13
  142. package/dist/runtime/composables/PageNavigation.js +0 -18
  143. /package/dist/runtime/components/{TelaChat.d.vue.ts → MeistrariChatEmbed.d.vue.ts} +0 -0
  144. /package/dist/runtime/components/{TelaChat.vue → MeistrariChatEmbed.vue} +0 -0
  145. /package/dist/runtime/components/{TelaChat.vue.d.ts → MeistrariChatEmbed.vue.d.ts} +0 -0
  146. /package/dist/runtime/components/{pdf-preview.d.vue.ts → pdf-preview.client.d.vue.ts} +0 -0
  147. /package/dist/runtime/components/{pdf-preview.vue → pdf-preview.client.vue} +0 -0
  148. /package/dist/runtime/components/{pdf-preview.vue.d.ts → pdf-preview.client.vue.d.ts} +0 -0
  149. /package/dist/runtime/components/{pdf-viewer.d.vue.ts → pdf-viewer.client.d.vue.ts} +0 -0
  150. /package/dist/runtime/components/{pdf-viewer.vue → pdf-viewer.client.vue} +0 -0
  151. /package/dist/runtime/components/{pdf-viewer.vue.d.ts → pdf-viewer.client.vue.d.ts} +0 -0
@@ -0,0 +1,133 @@
1
+ <script setup>
2
+ defineProps({
3
+ searchQuery: { type: String, required: true },
4
+ filteredContextFiles: { type: Array, required: true },
5
+ filteredPendingFiles: { type: Array, required: true },
6
+ currentFileCount: { type: Number, required: true },
7
+ maxFiles: { type: Number, required: true },
8
+ getFileType: { type: Function, required: true }
9
+ });
10
+ const emit = defineEmits(["update:searchQuery", "handleFileSelect", "removePendingFile", "removeContextFile"]);
11
+ const fileInputRef = ref(null);
12
+ function openFileDialog() {
13
+ fileInputRef.value?.click();
14
+ }
15
+ function onFileChange(event) {
16
+ emit("handleFileSelect", event);
17
+ }
18
+ </script>
19
+
20
+ <template>
21
+ <div mb-24px>
22
+ <h2 text-16px font-semibold text-primary tracking="-.2px" leading-20px>
23
+ Arquivos de contexto
24
+ </h2>
25
+ <div h-px bg-gray-200 mt-24px />
26
+ </div>
27
+
28
+ <input ref="fileInputRef" type="file" multiple hidden @change="onFileChange">
29
+
30
+ <div flex items-center justify-between mb-24px>
31
+ <div
32
+ flex items-center gap-8px
33
+ w-240px pl-12px pr-8px py-4px
34
+ bg-white b=".5px gray-200" rounded-10px
35
+ shadow-sm
36
+ >
37
+ <div i-ph-magnifying-glass text-12px text-gray-400 />
38
+ <input
39
+ :value="searchQuery"
40
+ type="text"
41
+ placeholder="Buscar"
42
+ text-14px text-primary placeholder:text-gray-400
43
+ bg-transparent border-none outline-none
44
+ flex-1 leading-18px tracking="-.15px"
45
+ @input="emit('update:searchQuery', $event.target.value)"
46
+ >
47
+ </div>
48
+ <button
49
+ px-16px py-10px
50
+ bg-white b=".5px gray-200" rounded-12px
51
+ text-16px font-semibold text-gray-900
52
+ cursor-pointer hover:bg-gray-50 transition
53
+ :disabled="currentFileCount >= maxFiles"
54
+ :class="{ 'opacity-50 cursor-not-allowed': currentFileCount >= maxFiles }"
55
+ @click="openFileDialog"
56
+ >
57
+ Enviar
58
+ </button>
59
+ </div>
60
+
61
+ <div w-full>
62
+ <div flex items-center b-y=".5px gray-200" bg-white>
63
+ <div flex-1 px-20px py-12px>
64
+ <span text-12px font-semibold text-primary leading-16px>Nome</span>
65
+ </div>
66
+ <div w-100px px-20px py-12px>
67
+ <span text-12px font-semibold text-primary leading-16px>Tipo</span>
68
+ </div>
69
+ <div w-40px />
70
+ </div>
71
+
72
+ <div>
73
+ <div
74
+ v-for="file in filteredContextFiles"
75
+ :key="`existing-${file.url}`"
76
+ flex items-center b-b=".5px gray-100" bg-white
77
+ >
78
+ <div flex items-center gap-8px flex-1 h-48px px-20px py-12px>
79
+ <div i-ph-file-pdf text-16px text-red-500 shrink-0 />
80
+ <span text-14px text-gray-900 leading-18px tracking="-.15px" truncate>
81
+ {{ file.name }}
82
+ </span>
83
+ </div>
84
+ <div w-100px h-48px px-20px py-12px flex items-center>
85
+ <span text-12px text-tertiary leading-16px>
86
+ {{ getFileType(file.name) }}
87
+ </span>
88
+ </div>
89
+ <div w-40px px-8px py-12px>
90
+ <button
91
+ p-4px rounded-6px hover:bg-gray-100 transition cursor-pointer
92
+ @click="emit('removeContextFile', file.url)"
93
+ >
94
+ <div i-ph-x text-16px text-primary />
95
+ </button>
96
+ </div>
97
+ </div>
98
+
99
+ <div
100
+ v-for="file in filteredPendingFiles"
101
+ :key="`pending-${file.name}-${file.size}-${file.lastModified}`"
102
+ flex items-center b-b=".5px blue-200" bg-blue-50
103
+ >
104
+ <div flex items-center gap-8px flex-1 h-48px px-20px py-12px>
105
+ <div i-ph-file-pdf text-16px text-blue-500 shrink-0 />
106
+ <span text-14px text-blue-900 leading-18px tracking="-.15px" truncate>
107
+ {{ file.name }}
108
+ </span>
109
+ </div>
110
+ <div w-100px h-48px px-20px py-12px flex items-center>
111
+ <span text-12px text-blue-500 leading-16px>
112
+ {{ getFileType(file.name) }}
113
+ </span>
114
+ </div>
115
+ <div w-40px px-8px py-12px>
116
+ <button
117
+ p-4px rounded-6px hover:bg-blue-100 transition cursor-pointer
118
+ @click="emit('removePendingFile', file)"
119
+ >
120
+ <div i-ph-x text-16px text-blue-500 />
121
+ </button>
122
+ </div>
123
+ </div>
124
+
125
+ <div
126
+ v-if="filteredContextFiles.length === 0 && filteredPendingFiles.length === 0"
127
+ flex items-center justify-center py-48px text-14px text-tertiary
128
+ >
129
+ Nenhum arquivo adicionado ainda
130
+ </div>
131
+ </div>
132
+ </div>
133
+ </template>
@@ -0,0 +1,22 @@
1
+ import type { ContextFile } from '../../../server/db/schema.js';
2
+ type __VLS_Props = {
3
+ searchQuery: string;
4
+ filteredContextFiles: readonly ContextFile[];
5
+ filteredPendingFiles: readonly File[];
6
+ currentFileCount: number;
7
+ maxFiles: number;
8
+ getFileType: (fileName: string) => string;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
11
+ handleFileSelect: (event: Event) => any;
12
+ removeContextFile: (url: string) => any;
13
+ removePendingFile: (file: File) => any;
14
+ "update:searchQuery": (value: string) => any;
15
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
16
+ onHandleFileSelect?: ((event: Event) => any) | undefined;
17
+ onRemoveContextFile?: ((url: string) => any) | undefined;
18
+ onRemovePendingFile?: ((file: File) => any) | undefined;
19
+ "onUpdate:searchQuery"?: ((value: string) => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ searchQuery: string;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ "update:searchQuery": (value: string) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ "onUpdate:searchQuery"?: ((value: string) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,220 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ searchQuery: { type: String, required: true }
4
+ });
5
+ const emit = defineEmits(["update:searchQuery"]);
6
+ const localSearchQuery = computed({
7
+ get: () => props.searchQuery,
8
+ set: (value) => emit("update:searchQuery", value)
9
+ });
10
+ const {
11
+ credentials,
12
+ loading: credentialsLoading,
13
+ fetchCredentials,
14
+ filteredCredentials,
15
+ credentialModalOpen,
16
+ deleteModalOpen,
17
+ credentialForm,
18
+ credentialSaving,
19
+ credentialDeleting,
20
+ credentialError,
21
+ editingCredential,
22
+ deletingCredential,
23
+ openCreateModal,
24
+ closeModal,
25
+ handleSave,
26
+ handleDelete,
27
+ getMenuItems,
28
+ formatLastRotated
29
+ } = useWorkspaceCredentials(localSearchQuery);
30
+ onMounted(() => {
31
+ if (!credentials.value.length)
32
+ fetchCredentials();
33
+ });
34
+ </script>
35
+
36
+ <template>
37
+ <div mb-24px>
38
+ <h2 text-16px font-semibold text-primary tracking="-.2px" leading-20px>
39
+ Credenciais
40
+ </h2>
41
+ <div h-px bg-gray-200 mt-24px />
42
+ </div>
43
+
44
+ <div flex items-center justify-between mb-16px>
45
+ <div
46
+ flex items-center gap-8px
47
+ w-240px pl-12px pr-8px py-4px
48
+ bg-white b=".5px gray-200" rounded-10px
49
+ shadow-sm
50
+ >
51
+ <div i-ph-magnifying-glass text-12px text-gray-400 />
52
+ <input
53
+ v-model="localSearchQuery"
54
+ type="text"
55
+ placeholder="Buscar por key"
56
+ text-14px text-primary placeholder:text-gray-400
57
+ bg-transparent border-none outline-none
58
+ flex-1 leading-18px tracking="-.15px"
59
+ >
60
+ </div>
61
+ <TelaButton
62
+ variant="secondary"
63
+ @click="openCreateModal"
64
+ >
65
+ <div i-ph-plus text-16px />
66
+ <span>Adicionar</span>
67
+ </TelaButton>
68
+ </div>
69
+
70
+ <div v-if="credentialsLoading && !credentials.length" flex items-center justify-center py-48px>
71
+ <div i-ph-spinner animate-spin text-32px text-gray-400 />
72
+ </div>
73
+
74
+ <div v-else :class="{ 'opacity-50 pointer-events-none': credentialsLoading }">
75
+ <TelaTable v-if="credentials.length > 0" class="table-fixed" w-full overflow-x-hidden>
76
+ <TelaTableHeader>
77
+ <TelaTableRow>
78
+ <TelaTableHead class="!py-10px text-14px font-medium text-secondary">
79
+ Nome
80
+ </TelaTableHead>
81
+ <TelaTableHead class="!py-10px !w-200px text-14px font-medium text-secondary hide-narrow">
82
+ Valor
83
+ </TelaTableHead>
84
+ <TelaTableHead class="!py-10px !w-180px text-14px font-medium text-secondary">
85
+ Última rotação
86
+ </TelaTableHead>
87
+ <TelaTableHead class="!py-10px !w-48px" />
88
+ </TelaTableRow>
89
+ </TelaTableHeader>
90
+ <TelaTableBody>
91
+ <TelaTableRow
92
+ v-for="credential in filteredCredentials"
93
+ :key="credential.id"
94
+ >
95
+ <TelaTableCell class="!py-14px">
96
+ <span text-14px font-mono text-primary>{{ credential.key }}</span>
97
+ </TelaTableCell>
98
+ <TelaTableCell class="!py-14px !w-200px hide-narrow">
99
+ <span text-14px text-primary>••••••••••</span>
100
+ </TelaTableCell>
101
+ <TelaTableCell class="!py-14px !w-180px">
102
+ <span text-14px text-secondary>{{ formatLastRotated(credential.updatedAt, credential.createdAt) }}</span>
103
+ </TelaTableCell>
104
+ <TelaTableCell class="!py-14px !w-48px">
105
+ <TelaDropdownMenu :items="getMenuItems(credential)" align="end">
106
+ <button p-6px rounded-6px text-gray-400 hover:text-gray-600 transition-colors cursor-pointer>
107
+ <div i-ph-dots-three text-18px />
108
+ </button>
109
+ </TelaDropdownMenu>
110
+ </TelaTableCell>
111
+ </TelaTableRow>
112
+ <TelaTableRow v-if="filteredCredentials.length === 0 && searchQuery">
113
+ <TelaTableCell :colspan="4" class="!py-32px text-center">
114
+ <span text-14px text-secondary>Nenhum resultado para "{{ searchQuery }}"</span>
115
+ </TelaTableCell>
116
+ </TelaTableRow>
117
+ </TelaTableBody>
118
+ </TelaTable>
119
+
120
+ <div v-else flex="~ col" items-center justify-center py-48px gap-8px>
121
+ <div i-ph-password-bold-duotone text-32px text-gray-300 />
122
+ <p text-14px text-secondary>
123
+ Nenhuma credencial adicionada ainda
124
+ </p>
125
+ </div>
126
+ </div>
127
+
128
+ <TelaModal
129
+ v-model="credentialModalOpen"
130
+ :prevent-close="credentialSaving"
131
+ class="w-420px! relative p-20px! pt-16px!"
132
+ compact
133
+ :title="editingCredential ? 'Editar credencial' : 'Nova credencial'"
134
+ small-title
135
+ :is-close-icon="false"
136
+ hide-dividers
137
+ @keydown.esc.stop="credentialModalOpen = false"
138
+ >
139
+ <div relative flex="~ col" pt-24px gap-24px w-full>
140
+ <TelaIconButton
141
+ icon="i-ph-x"
142
+ size="md"
143
+ color="secondary"
144
+ outline-none
145
+ absolute p-8px top--32px right--12px
146
+ @click="credentialModalOpen = false"
147
+ />
148
+ <form flex="~ col" gap-24px w-full @submit.prevent="handleSave">
149
+ <div v-if="credentialError" body-12-regular text-red-500 bg-red-50 px-12px py-8px rounded-8px>
150
+ {{ credentialError }}
151
+ </div>
152
+
153
+ <div flex="~ col" gap-8px>
154
+ <TelaLabel for="credentialKey">
155
+ Nome
156
+ </TelaLabel>
157
+ <TelaInput
158
+ id="credentialKey"
159
+ v-model="credentialForm.key"
160
+ size="sm"
161
+ :disabled="!!editingCredential"
162
+ :autofocus="!editingCredential"
163
+ placeholder="DATABASE_URL"
164
+ input-class="!px-9px !py-4px"
165
+ />
166
+ <p body-12-regular text-secondary>
167
+ Apenas letras maiúsculas, números e underscore (ex: API_KEY)
168
+ </p>
169
+ </div>
170
+
171
+ <div flex="~ col" gap-8px>
172
+ <TelaLabel for="credentialValue">
173
+ Valor
174
+ </TelaLabel>
175
+ <TelaInput
176
+ id="credentialValue"
177
+ v-model="credentialForm.value"
178
+ size="sm"
179
+ type="password"
180
+ :autofocus="!!editingCredential"
181
+ :placeholder="editingCredential ? 'Novo valor (deixe vazio para manter)' : 'Valor da credencial'"
182
+ input-class="!px-9px !py-4px"
183
+ />
184
+ </div>
185
+
186
+ <div flex items-center justify-end gap-8px>
187
+ <TelaButton type="button" size="md" variant="secondary" @click="closeModal">
188
+ Cancelar
189
+ </TelaButton>
190
+ <TelaButton
191
+ type="submit"
192
+ size="md"
193
+ :loading="credentialSaving"
194
+ :disabled="!editingCredential && (!credentialForm.key || !credentialForm.value)"
195
+ >
196
+ {{ editingCredential ? "Salvar" : "Adicionar" }}
197
+ </TelaButton>
198
+ </div>
199
+ </form>
200
+ </div>
201
+ </TelaModal>
202
+
203
+ <TelaConfirmationModal
204
+ v-model:open="deleteModalOpen"
205
+ title="Excluir credencial?"
206
+ variant="danger"
207
+ confirm-button-text="Excluir"
208
+ cancel-button-text="Cancelar"
209
+ :loading="credentialDeleting"
210
+ @confirm="handleDelete"
211
+ @cancel="deleteModalOpen = false"
212
+ @keydown.esc.stop="deleteModalOpen = false"
213
+ >
214
+ A credencial <span font-mono font-semibold>{{ deletingCredential?.key }}</span> será excluída permanentemente.
215
+ </TelaConfirmationModal>
216
+ </template>
217
+
218
+ <style scoped>
219
+ @media (max-width:950px){.hide-narrow{display:none}}
220
+ </style>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ searchQuery: string;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ "update:searchQuery": (value: string) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ "onUpdate:searchQuery"?: ((value: string) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,32 @@
1
+ import type { ExternalSkill } from '../../../server/db/schema.js';
2
+ type __VLS_Props = {
3
+ searchQuery: string;
4
+ displayedSkills: readonly ExternalSkill[];
5
+ filteredSkills: readonly ExternalSkill[];
6
+ hasChanges: boolean;
7
+ isPending: (ref: string) => boolean;
8
+ skillModalOpen: boolean;
9
+ skillRefInput: string;
10
+ skillError: string;
11
+ discoveringSkills: boolean;
12
+ gitHubButtonText: string;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
15
+ "update:searchQuery": (value: string) => any;
16
+ "update:skillModalOpen": (value: boolean) => any;
17
+ "update:skillRefInput": (value: string) => any;
18
+ removeSkill: (ref: string) => any;
19
+ closeSkillModal: () => any;
20
+ handleAddSkillAndClose: () => any;
21
+ connectGitHub: () => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
23
+ "onUpdate:searchQuery"?: ((value: string) => any) | undefined;
24
+ "onUpdate:skillModalOpen"?: ((value: boolean) => any) | undefined;
25
+ "onUpdate:skillRefInput"?: ((value: string) => any) | undefined;
26
+ onRemoveSkill?: ((ref: string) => any) | undefined;
27
+ onCloseSkillModal?: (() => any) | undefined;
28
+ onHandleAddSkillAndClose?: (() => any) | undefined;
29
+ onConnectGitHub?: (() => any) | undefined;
30
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
@@ -0,0 +1,222 @@
1
+ <script setup>
2
+ defineProps({
3
+ searchQuery: { type: String, required: true },
4
+ displayedSkills: { type: Array, required: true },
5
+ filteredSkills: { type: Array, required: true },
6
+ hasChanges: { type: Boolean, required: true },
7
+ isPending: { type: Function, required: true },
8
+ skillModalOpen: { type: Boolean, required: true },
9
+ skillRefInput: { type: String, required: true },
10
+ skillError: { type: String, required: true },
11
+ discoveringSkills: { type: Boolean, required: true },
12
+ gitHubButtonText: { type: String, required: true }
13
+ });
14
+ const emit = defineEmits(["update:searchQuery", "update:skillModalOpen", "update:skillRefInput", "removeSkill", "closeSkillModal", "handleAddSkillAndClose", "connectGitHub"]);
15
+ const githubIconUrl = "/github.svg";
16
+ </script>
17
+
18
+ <template>
19
+ <div mb-24px>
20
+ <h2 text-16px font-semibold text-primary tracking="-.2px" leading-20px>
21
+ Skills Externas
22
+ </h2>
23
+ <div h-px bg-gray-200 mt-24px />
24
+ </div>
25
+
26
+ <div v-if="displayedSkills.length === 0 && !hasChanges" flex="~ col" items-center justify-center h-400px gap-24px>
27
+ <div
28
+ w-88px h-64px rounded-10px bg-white b=".5px gray-100"
29
+ flex items-center justify-center
30
+ shadow-sm
31
+ >
32
+ <div i-ph-wrench text-32px style="color: #DFE3E7;" />
33
+ </div>
34
+ <p text-20px font-semibold text-primary tracking="-.5px" leading-24px text-center>
35
+ Sua equipe ainda não<br>adicionou skills externas
36
+ </p>
37
+ <div flex items-center gap-12px>
38
+ <TelaButton
39
+ variant="primary"
40
+ @click="emit('update:skillModalOpen', true)"
41
+ >
42
+ <div i-ph-plus text-16px />
43
+ <span>Adicionar Skill</span>
44
+ </TelaButton>
45
+ <TelaButton
46
+ variant="secondary"
47
+ @click="emit('connectGitHub')"
48
+ >
49
+ <img :src="githubIconUrl">
50
+ <span>{{ gitHubButtonText }}</span>
51
+ </TelaButton>
52
+ </div>
53
+ </div>
54
+
55
+ <template v-else>
56
+ <div flex items-center justify-between mb-24px>
57
+ <div
58
+ flex items-center gap-8px
59
+ w-240px pl-12px
60
+ bg-white b=".5px gray-200" rounded-10px
61
+ shadow-sm
62
+ >
63
+ <div i-ph-magnifying-glass text-12px text-gray-400 />
64
+ <input
65
+ :value="searchQuery"
66
+ type="text"
67
+ placeholder="Buscar skills"
68
+ text-14px text-primary placeholder:text-gray-400 h-32px
69
+ bg-transparent border-none outline-none
70
+ flex-1 leading-18px tracking="-.15px"
71
+ @input="emit('update:searchQuery', $event.target.value)"
72
+ >
73
+ </div>
74
+
75
+ <div flex items-center gap-8px>
76
+ <TelaButton
77
+ variant="secondary"
78
+ @click="emit('update:skillModalOpen', true)"
79
+ >
80
+ <div i-ph-plus text-16px />
81
+ <span>Adicionar Skill</span>
82
+ </TelaButton>
83
+ <TelaButton
84
+ variant="secondary"
85
+ @click="emit('connectGitHub')"
86
+ >
87
+ <img :src="githubIconUrl">
88
+ <span>{{ gitHubButtonText }}</span>
89
+ </TelaButton>
90
+ </div>
91
+ </div>
92
+
93
+ <div max-h-400px overflow-y-auto>
94
+ <TelaTable class="table-fixed" w-full>
95
+ <TelaTableHeader>
96
+ <TelaTableRow>
97
+ <TelaTableHead class="!py-12px text-12px font-semibold text-primary leading-16px w-160px!">
98
+ Skill
99
+ </TelaTableHead>
100
+ <TelaTableHead class="!py-12px !w-280px text-12px font-semibold text-primary leading-16px">
101
+ Fonte
102
+ </TelaTableHead>
103
+ <TelaTableHead class="!py-12px !w-48px" />
104
+ </TelaTableRow>
105
+ </TelaTableHeader>
106
+ <TelaTableBody>
107
+ <TelaTableRow
108
+ v-for="skill in filteredSkills"
109
+ :key="skill.ref"
110
+ hover:bg-gray-50 transition
111
+ :class="{
112
+ 'bg-blue-50': isPending(skill.ref)
113
+ }"
114
+ >
115
+ <TelaTableCell>
116
+ <div flex="~ col" gap-2px>
117
+ <span text-14px text-gray-900 tracking="-.15px" truncate>
118
+ {{ skill.name }}
119
+ </span>
120
+ </div>
121
+ </TelaTableCell>
122
+ <TelaTableCell>
123
+ <div flex items-center gap-8px>
124
+ <span text-12px text-tertiary truncate font-mono>
125
+ {{ skill.ref }}
126
+ </span>
127
+ <TelaBadge v-if="!skill.isPublic">
128
+ Privado
129
+ </TelaBadge>
130
+ </div>
131
+ </TelaTableCell>
132
+ <TelaTableCell class="!w-48px">
133
+ <TelaDropdownMenu
134
+ :items="[
135
+ {
136
+ label: 'Excluir',
137
+ icon: 'i-ph-trash',
138
+ color: 'negative',
139
+ click: () => emit('removeSkill', skill.ref)
140
+ }
141
+ ]"
142
+ align="end"
143
+ >
144
+ <button
145
+ p-4px rounded-6px text-gray-400
146
+ hover:text-gray-600 hover:bg-gray-100
147
+ cursor-pointer transition
148
+ >
149
+ <div i-ph-dots-three text-16px />
150
+ </button>
151
+ </TelaDropdownMenu>
152
+ </TelaTableCell>
153
+ </TelaTableRow>
154
+ </TelaTableBody>
155
+ </TelaTable>
156
+ </div>
157
+ </template>
158
+
159
+ <TelaModal
160
+ :model-value="skillModalOpen"
161
+ !w-420px
162
+ !p-20px
163
+ hide-header
164
+ @update:model-value="(v) => {
165
+ if (!v) emit('closeSkillModal');
166
+ }"
167
+ >
168
+ <div flex="~ col" w-full>
169
+ <div flex items-center justify-between mb-16px>
170
+ <span text-12px font-460 leading-16px text-black-500>
171
+ Adicionar Skill
172
+ </span>
173
+ <button
174
+ p-4px rounded-8px
175
+ hover:bg-gray-100
176
+ transition cursor-pointer
177
+ @click="emit('closeSkillModal')"
178
+ >
179
+ <div i-ph-x text-20px />
180
+ </button>
181
+ </div>
182
+
183
+ <div flex="~ col" gap-8px>
184
+ <label text-14px font-580 leading-16px tracking="-.15px" text-primary>
185
+ Referência da Skill
186
+ </label>
187
+ <TelaInput
188
+ :model-value="skillRefInput"
189
+ type="text"
190
+ size="sm"
191
+ placeholder="github.com/owner/repo/tree/main/path"
192
+ :disabled="discoveringSkills"
193
+ @update:model-value="(v) => emit('update:skillRefInput', v)"
194
+ />
195
+ <p v-if="skillError" text-12px text-red-500>
196
+ {{ skillError }}
197
+ </p>
198
+ <p v-else text-12px font-400 leading-16px text-secondary>
199
+ Cole a URL do repositório ou a referência gh:owner/repo/path
200
+ </p>
201
+ </div>
202
+
203
+ <div flex justify-end gap-12px mt-24px>
204
+ <TelaButton
205
+ variant="secondary"
206
+ :disabled="discoveringSkills"
207
+ @click="emit('closeSkillModal')"
208
+ >
209
+ Cancelar
210
+ </TelaButton>
211
+ <TelaButton
212
+ variant="primary"
213
+ :disabled="discoveringSkills"
214
+ @click="emit('handleAddSkillAndClose')"
215
+ >
216
+ <div v-if="discoveringSkills" i-ph-spinner animate-spin text-14px />
217
+ <span>{{ discoveringSkills ? "Buscando..." : "Adicionar" }}</span>
218
+ </TelaButton>
219
+ </div>
220
+ </div>
221
+ </TelaModal>
222
+ </template>