@youfocus-technology/chat-agent 0.0.0-stage → 0.1.1

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/README.md CHANGED
@@ -1,3 +1,108 @@
1
- # Temporary Holding Version
1
+ # @youfocus-technology/chat-agent
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Widget do agente de IA da YouFocus, entregue como Web Component (`<youfocus-agent>`). O Vue 3 e o CSS já vão dentro do pacote, então ele funciona em HTML puro, Vue 2 e Vue 3 sem dependências extras.
4
+
5
+ > A versão `0.1.x` ainda usa dados mock: as respostas, sugestões e o histórico não vêm do backend.
6
+
7
+ ## Instalação
8
+
9
+ ```bash
10
+ npm install @youfocus-technology/chat-agent
11
+ ```
12
+
13
+ ## Uso
14
+
15
+ Importar o pacote uma vez registra a tag `<youfocus-agent>` na página:
16
+
17
+ ```js
18
+ import '@youfocus-technology/chat-agent'
19
+ ```
20
+
21
+ ```html
22
+ <youfocus-agent
23
+ whatsapp-url="https://wa.me/5500000000000"
24
+ human-agent-url="https://wa.me/5500000000000"
25
+ ></youfocus-agent>
26
+ ```
27
+
28
+ O projeto que hospeda o widget decide onde e quando mostrar a tag. O widget não se esconde sozinho ao fechar: ele só emite o evento `close`.
29
+
30
+ Os estilos ficam isolados no Shadow DOM. No documento, o pacote registra só a `@font-face` da fonte Figtree. Nenhuma `@property` é registrada, então o widget não interfere no Tailwind do site (v3 ou v4). Em SSR, o import não quebra: a tag só é registrada quando existe `window`.
31
+
32
+ | Atributo | Descrição |
33
+ | ----------------- | ------------------------------------------------------------------------- |
34
+ | `whatsapp-url` | Link do WhatsApp no rodapé. |
35
+ | `human-agent-url` | Link do botão "Falar com um agente humano". Sem ele, usa o `whatsapp-url`. |
36
+
37
+ | Evento | Quando |
38
+ | ------- | ------------------------------------ |
39
+ | `close` | O usuário clicou no botão de fechar. |
40
+
41
+ ### HTML puro
42
+
43
+ ```html
44
+ <youfocus-agent whatsapp-url="https://wa.me/5500000000000"></youfocus-agent>
45
+
46
+ <script>
47
+ const agent = document.querySelector('youfocus-agent')
48
+ agent.addEventListener('close', () => {
49
+ agent.hidden = true
50
+ })
51
+ </script>
52
+ ```
53
+
54
+ ### Vue 2
55
+
56
+ Avise o Vue que a tag é um elemento externo, para ele não tentar resolvê-la como componente:
57
+
58
+ ```js
59
+ import Vue from 'vue'
60
+ import '@youfocus-technology/chat-agent'
61
+
62
+ Vue.config.ignoredElements = ['youfocus-agent']
63
+ ```
64
+
65
+ ```html
66
+ <youfocus-agent v-if="showAgent" :whatsapp-url="whatsappUrl" @close="showAgent = false" />
67
+ ```
68
+
69
+ ### Vue 3 (Vite)
70
+
71
+ ```js
72
+ // vite.config.js
73
+ vue({
74
+ template: {
75
+ compilerOptions: {
76
+ isCustomElement: (tag) => tag === 'youfocus-agent',
77
+ },
78
+ },
79
+ })
80
+ ```
81
+
82
+ ```html
83
+ <youfocus-agent v-if="showAgent" :whatsapp-url="whatsappUrl" @close="showAgent = false" />
84
+ ```
85
+
86
+ ## Desenvolvimento
87
+
88
+ Requer Node 22 ou superior.
89
+
90
+ ```bash
91
+ npm install
92
+ npm run dev # playground em index.html
93
+ npm test
94
+ npm run lint
95
+ npm run build # gera dist/youfocus-agent.js (ES) e dist/youfocus-agent.umd.cjs (UMD)
96
+ ```
97
+
98
+ ## Publicação
99
+
100
+ O `prepublishOnly` roda o build antes de publicar, e o `publishConfig` já deixa o pacote público.
101
+
102
+ ```bash
103
+ npm login
104
+ npm version patch # ou minor; pular na primeira publicação (0.1.0)
105
+ npm publish --access public
106
+ ```
107
+
108
+ Antes de publicar, `npm pack --dry-run` mostra o que vai no pacote: só `dist/`, `README.md` e `package.json`.