n8n-nodes-aib 0.3.1 → 0.3.2

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.
@@ -51,6 +51,7 @@ class AibDigital {
51
51
  noDataExpression: true,
52
52
  default: "enviarMensagem",
53
53
  options: [
54
+ { name: "Selecionar conta", value: "selecionarConta", action: "Selecionar a conta (âncora do fluxo)" },
54
55
  { name: "Enviar mensagem", value: "enviarMensagem", action: "Enviar mensagem de texto" },
55
56
  { name: "Listar conversas", value: "listarConversas", action: "Listar conversas" },
56
57
  { name: "Buscar conversa", value: "buscarConversa", action: "Buscar uma conversa" },
@@ -358,6 +359,22 @@ class AibDigital {
358
359
  const campos = this.getNodeParameter("camposContato", i, {});
359
360
  res = await api(this, "PATCH", `/api/v1/contatos/${contatoId}`, campos, qs);
360
361
  }
362
+ else if (operation === "selecionarConta") {
363
+ // A âncora do fluxo, como o "Selecionar conta" do Chatwoot: devolve a
364
+ // conta escolhida para os nós seguintes referenciarem por expressão.
365
+ const contaSel = this.getNodeParameter("conta", i, "");
366
+ if (contaSel) {
367
+ const r = await api(this, "GET", "/api/v1/contas");
368
+ const achada = (r?.contas ?? []).find((c) => c.id === contaSel);
369
+ if (!achada)
370
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Conta não encontrada para esta chave");
371
+ res = achada;
372
+ }
373
+ else {
374
+ const ping = await api(this, "GET", "/api/v1/ping");
375
+ res = { id: "", nome: "— a conta da chave —", escopo: ping?.escopo };
376
+ }
377
+ }
361
378
  else {
362
379
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operação desconhecida: ${operation}`);
363
380
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aib",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Nós do Sistema AIB Digital para n8n: gatilho de mensagens do WhatsApp (via AIB Inbox) e ações — enviar mensagem, mover card no funil, pausar IA — escolhendo conta e caixa por dropdown.",
5
5
  "license": "MIT",
6
6
  "author": "AIB Digital",