@connection-hub/sdk 0.0.5

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 ADDED
@@ -0,0 +1,108 @@
1
+ # Connection Hub SDK
2
+
3
+ SDK oficial para integração com a API do Connection Hub.
4
+
5
+ # Aviso Importante
6
+
7
+ Este SDK é parte integrante de uma solução comercial e requer licenciamento adequado para utilização em ambiente de produção.
8
+ Para informações sobre preços, licenciamento e suporte, entre em contato com nossa equipe comercial em comercial@connectionhub.com.br.
9
+
10
+ ## Instalação
11
+
12
+ ```bash
13
+ npm install @connection-hub/sdk
14
+ ```
15
+
16
+ ## Uso
17
+
18
+ ### Inicialização
19
+
20
+ ```typescript
21
+ import { ConnectionHubClient } from "@connection-hub/sdk";
22
+
23
+ const client = new ConnectionHubClient({
24
+ apiUrl: "sua-url-api", // Opcional, apenas se você adquiriu servidor exclusivo
25
+ accessToken: "seu-token-acesso", // Obtenha seu token no painel contratado
26
+ });
27
+ ```
28
+
29
+ ### Envio de Mensagens
30
+
31
+ ```typescript
32
+ // Facebook Text
33
+ const fbMessage = await client.messaging.sendTextToFacebook(
34
+ "channelToken",
35
+ "recipientId",
36
+ "Olá, como posso ajudar?"
37
+ );
38
+
39
+ // Facebook File (image,audio,video,documentos)
40
+ const fbMessage = await client.messaging.sendFileToFacebook(
41
+ "channelToken",
42
+ "recipientId",
43
+ "file url"
44
+ );
45
+
46
+ // Instagram Text
47
+ const igMessage = await client.messaging.sendTextToInstagram(
48
+ "channelToken",
49
+ "recipientId",
50
+ "Olá, como posso ajudar?"
51
+ );
52
+
53
+ // Instagram File (image,video)
54
+ const igMessage = await client.messaging.sendFileToInstagram(
55
+ "channelToken",
56
+ "recipientId",
57
+ "file url"
58
+ );
59
+
60
+ // Email
61
+ const email = await client.messaging.sendEmail(
62
+ "channelToken",
63
+ "Assunto do Email",
64
+ "Corpo do email",
65
+ "destinatario@exemplo.com",
66
+ [], // anexos (opcional)
67
+ "messageId", // inReplyTo (opcional)
68
+ ["reference1", "reference2"] // references (opcional)
69
+ );
70
+ ```
71
+
72
+ ### Webhooks
73
+
74
+ ```typescript
75
+ // Configurar webhook
76
+ await client.webhooks.setupWebhook(
77
+ "channelToken",
78
+ "https://seu-servidor.com/webhook"
79
+ );
80
+
81
+ // Remover webhook / desconectar canal
82
+ await client.webhooks.removeWebhook("channelToken");
83
+ ```
84
+
85
+ ### Gerenciamento de Conexões
86
+
87
+ ````typescript
88
+ // Listar conexões
89
+ const connections = await client.connections.listConnections();
90
+
91
+ // Obter conexão específica
92
+ const connection = await client.connections.getConnection('channelToken');
93
+
94
+
95
+ ## Tipos
96
+
97
+ O SDK inclui tipos TypeScript para melhor desenvolvimento:
98
+
99
+ ```typescript
100
+ import {
101
+ ConnectionData,
102
+ MessageData
103
+ } from '@connection-hub/sdk';
104
+ ````
105
+
106
+ ## Suporte
107
+
108
+ Para suporte, entre em contato com nossa equipe através do email suporte@connectionhub.com.br
@@ -0,0 +1,46 @@
1
+ import { ConnectionHubConfig } from "./types";
2
+ import { AuthService } from "./lib/auth";
3
+ import { MessagingService } from "./lib/messaging";
4
+ import { WebhookService } from "./lib/webhooks";
5
+ import { ConnectionService } from "./lib/connections";
6
+ export declare class ConnectionHubClient {
7
+ private readonly api;
8
+ private readonly config;
9
+ private credentialsValidated;
10
+ private validationPromise;
11
+ auth: AuthService;
12
+ messaging: MessagingService;
13
+ webhooks: WebhookService;
14
+ connections: ConnectionService;
15
+ /**
16
+ * Cria uma nova instância do cliente Connection Hub
17
+ * @param config Configuração do cliente
18
+ */
19
+ constructor(config: ConnectionHubConfig);
20
+ /**
21
+ * Valida se a apiKey e o accessToken são válidos
22
+ * @returns Uma promessa que resolve para true se as credenciais são válidas
23
+ */
24
+ validateCredentials(): Promise<boolean>;
25
+ /**
26
+ * Verifica se as credenciais foram validadas
27
+ * @returns true se as credenciais foram validadas com sucesso
28
+ */
29
+ isCredentialsValidated(): boolean;
30
+ /**
31
+ * Verifica se o cliente pode executar operações
32
+ * @param throwError Se true, lança um erro caso as credenciais não sejam válidas (padrão: true)
33
+ * @returns true se o cliente pode executar operações
34
+ */
35
+ canExecuteOperations(throwError?: boolean): boolean;
36
+ /**
37
+ * Aguarda a validação das credenciais ser concluída
38
+ * @returns Uma promessa que resolve para true se as credenciais são válidas
39
+ */
40
+ waitForValidation(): Promise<boolean>;
41
+ /**
42
+ * Atualiza o token de acesso
43
+ * @param token Novo token de acesso
44
+ */
45
+ setAccessToken(token: string): void;
46
+ }
package/dist/client.js ADDED
@@ -0,0 +1 @@
1
+ const _0x4bfcc3=_0x37cc;(function(_0x533611,_0x3aff17){const _0x294de0=_0x37cc,_0x39c63a=_0x533611();while(!![]){try{const _0x2d4aa9=-parseInt(_0x294de0(0x1c3))/(-0xcc6+0x85*-0x11+0x39a*0x6)+-parseInt(_0x294de0(0x1bc))/(0xc*-0x1f+0x25d2+0x2cc*-0xd)*(parseInt(_0x294de0(0x1d0))/(-0x9b9*-0x1+-0x87+-0x92f*0x1))+parseInt(_0x294de0(0x1d4))/(0x1d65+-0x251c+-0x7bb*-0x1)+parseInt(_0x294de0(0x1d9))/(0x1e97+0x156e+-0x1a00*0x2)+-parseInt(_0x294de0(0x1d6))/(0x31*-0x5+0x1*-0x1645+0x1f*0xc0)*(-parseInt(_0x294de0(0x1cc))/(0x4d7+0xb8*0x10+-0x1050))+-parseInt(_0x294de0(0x1b2))/(0x22f1+-0x1*-0x227c+-0x4565)*(parseInt(_0x294de0(0x1b6))/(-0x1521+0x24b0+-0x7c3*0x2))+parseInt(_0x294de0(0x1d1))/(-0x1d6+-0x32*0x35+0xc3a)*(parseInt(_0x294de0(0x1f2))/(0x1d*0x71+-0xa05+-0x2bd));if(_0x2d4aa9===_0x3aff17)break;else _0x39c63a['push'](_0x39c63a['shift']());}catch(_0x2ae33c){_0x39c63a['push'](_0x39c63a['shift']());}}}(_0x3d2f,0x5*0x369d+-0x386c9+0x4849d));import _0x3b74d3 from'axios';function _0x3d2f(){const _0x1d63aa=['edentials','accessToke','Cliente\x20nã','21627QKWQRz','i.connecti','AccessToke','baseURL','success','canExecute','184VZNGkf','setAccessT','XvbFx','defaults','onhub.com.','ram\x20valida','Content-Ty','224351TaKlfM','idation','applicatio','Operations','vPFSz','Promise','tório','data','ais\x20não\x20fo','11837NrTkBq','messaging','date','oken','5358asDUtB','1140WAmnao','yMYLa','SlpFk','452596FarIEA','headers','558TPmWdq','WIbBH','n\x20é\x20obriga','730060bNHtez','euQDX','n/json','credential','\x20inválidas','sValidated','Bearer\x20','validateCr','zado\x20corre','apiUrl','YfPJe','das\x20ou\x20são','https://ap','ion','s\x20credenci','response','webhooks','XHOmE','config','Authorizat','/auth/vali','QtCZa','IIIPz','o\x20iniciali','api','20075iIRWsg','auth','MKjtW','get','validation','create','tamente.\x20A','status','waitForVal','isCredenti','alsValidat','connection','336ZjnRCD'];_0x3d2f=function(){return _0x1d63aa;};return _0x3d2f();}import{AuthService}from'./lib/auth';import{MessagingService}from'./lib/messaging';import{WebhookService}from'./lib/webhooks';import{ConnectionService}from'./lib/connections';function _0x37cc(_0x19ab09,_0x37a770){const _0x44dd0f=_0x3d2f();return _0x37cc=function(_0xd8aa54,_0x533962){_0xd8aa54=_0xd8aa54-(0x16a1+0x1*-0x1ca5+0x74*0x11);let _0x1e6d22=_0x44dd0f[_0xd8aa54];return _0x1e6d22;},_0x37cc(_0x19ab09,_0x37a770);}export class ConnectionHubClient{constructor(_0x1a3f97){const _0x5e4f4e=_0x37cc,_0x245ab4={};_0x245ab4[_0x5e4f4e(0x1be)]=_0x5e4f4e(0x1b8)+_0x5e4f4e(0x1d8)+_0x5e4f4e(0x1c9),_0x245ab4[_0x5e4f4e(0x1d3)]=_0x5e4f4e(0x1c5)+_0x5e4f4e(0x1db),_0x245ab4[_0x5e4f4e(0x1ef)]=_0x5e4f4e(0x1ec)+_0x5e4f4e(0x1e6),_0x245ab4[_0x5e4f4e(0x1ee)]=_0x5e4f4e(0x1e5)+_0x5e4f4e(0x1b7)+_0x5e4f4e(0x1c0)+'br';const _0x181be3=_0x245ab4;this[_0x5e4f4e(0x1dc)+_0x5e4f4e(0x1de)]=![],this[_0x5e4f4e(0x1f6)+_0x5e4f4e(0x1c8)]=null;if(!_0x1a3f97[_0x5e4f4e(0x1b4)+'n'])throw new Error(_0x181be3[_0x5e4f4e(0x1be)]);this[_0x5e4f4e(0x1eb)]=_0x1a3f97;const _0x538db5={};_0x538db5[_0x5e4f4e(0x1c2)+'pe']=_0x181be3[_0x5e4f4e(0x1d3)];const _0x2211c9=_0x538db5;_0x1a3f97[_0x5e4f4e(0x1b4)+'n']&&(_0x2211c9[_0x181be3[_0x5e4f4e(0x1ef)]]=_0x5e4f4e(0x1df)+_0x1a3f97[_0x5e4f4e(0x1b4)+'n']);const _0x37d2e5={};_0x37d2e5[_0x5e4f4e(0x1b9)]=_0x1a3f97[_0x5e4f4e(0x1e2)]||_0x181be3[_0x5e4f4e(0x1ee)],_0x37d2e5[_0x5e4f4e(0x1d5)]=_0x2211c9,this[_0x5e4f4e(0x1f1)]=_0x3b74d3[_0x5e4f4e(0x1f7)](_0x37d2e5),this[_0x5e4f4e(0x1f3)]=new AuthService(this[_0x5e4f4e(0x1f1)],this),this[_0x5e4f4e(0x1cd)]=new MessagingService(this[_0x5e4f4e(0x1f1)],this),this[_0x5e4f4e(0x1e9)]=new WebhookService(this[_0x5e4f4e(0x1f1)],this),this[_0x5e4f4e(0x1b1)+'s']=new ConnectionService(this[_0x5e4f4e(0x1f1)],this),this[_0x5e4f4e(0x1f6)+_0x5e4f4e(0x1c8)]=this[_0x5e4f4e(0x1e0)+_0x5e4f4e(0x1b3)]();}async[_0x4bfcc3(0x1e0)+_0x4bfcc3(0x1b3)](){const _0x2a9a8c=_0x4bfcc3,_0x32f1bd={'euQDX':_0x2a9a8c(0x1ed)+_0x2a9a8c(0x1ce),'XHOmE':function(_0x25faa0,_0x1f3d61){return _0x25faa0===_0x1f3d61;},'yMYLa':function(_0xec5437,_0x4aada8){return _0xec5437(_0x4aada8);},'WIbBH':function(_0x1feb68,_0x17d098){return _0x1feb68===_0x17d098;},'MKjtW':function(_0x32a804,_0x26aa37){return _0x32a804===_0x26aa37;}};try{if(this[_0x2a9a8c(0x1f6)+_0x2a9a8c(0x1c8)])return this[_0x2a9a8c(0x1f6)+_0x2a9a8c(0x1c8)];return this[_0x2a9a8c(0x1f6)+_0x2a9a8c(0x1c8)]=new Promise(async _0x1ccddd=>{const _0x4cd4f4=_0x2a9a8c;try{const _0x1c7ffc=await this[_0x4cd4f4(0x1f1)][_0x4cd4f4(0x1f5)](_0x32f1bd[_0x4cd4f4(0x1da)]);this[_0x4cd4f4(0x1dc)+_0x4cd4f4(0x1de)]=_0x32f1bd[_0x4cd4f4(0x1ea)](_0x1c7ffc[_0x4cd4f4(0x1ca)][_0x4cd4f4(0x1ba)],!![]),_0x32f1bd[_0x4cd4f4(0x1d2)](_0x1ccddd,this[_0x4cd4f4(0x1dc)+_0x4cd4f4(0x1de)]);}catch(_0x261bb9){_0x32f1bd[_0x4cd4f4(0x1d7)](_0x261bb9[_0x4cd4f4(0x1e8)]?.[_0x4cd4f4(0x1f9)],-0x1326*0x1+-0x8ce+-0x1d85*-0x1)||_0x32f1bd[_0x4cd4f4(0x1f4)](_0x261bb9[_0x4cd4f4(0x1e8)]?.[_0x4cd4f4(0x1f9)],-0x1*-0x170b+-0x34a*0x9+-0x2b6*-0x3)?(this[_0x4cd4f4(0x1dc)+_0x4cd4f4(0x1de)]=![],_0x32f1bd[_0x4cd4f4(0x1d2)](_0x1ccddd,![])):(this[_0x4cd4f4(0x1dc)+_0x4cd4f4(0x1de)]=![],_0x32f1bd[_0x4cd4f4(0x1d2)](_0x1ccddd,![]));}finally{this[_0x4cd4f4(0x1f6)+_0x4cd4f4(0x1c8)]=null;}}),this[_0x2a9a8c(0x1f6)+_0x2a9a8c(0x1c8)];}catch(_0x415cca){return this[_0x2a9a8c(0x1dc)+_0x2a9a8c(0x1de)]=![],![];}}[_0x4bfcc3(0x1fb)+_0x4bfcc3(0x1b0)+'ed'](){const _0x5e5140=_0x4bfcc3;return this[_0x5e5140(0x1dc)+_0x5e5140(0x1de)];}[_0x4bfcc3(0x1bb)+_0x4bfcc3(0x1c6)](_0x20e22e=!![]){const _0x1b73bc=_0x4bfcc3,_0x38bd65={};_0x38bd65[_0x1b73bc(0x1e3)]=_0x1b73bc(0x1b5)+_0x1b73bc(0x1f0)+_0x1b73bc(0x1e1)+_0x1b73bc(0x1f8)+_0x1b73bc(0x1e7)+_0x1b73bc(0x1cb)+_0x1b73bc(0x1c1)+_0x1b73bc(0x1e4)+_0x1b73bc(0x1dd)+'.';const _0x57c6ed=_0x38bd65;if(!this[_0x1b73bc(0x1dc)+_0x1b73bc(0x1de)]&&_0x20e22e)throw new Error(_0x57c6ed[_0x1b73bc(0x1e3)]);return this[_0x1b73bc(0x1dc)+_0x1b73bc(0x1de)];}async[_0x4bfcc3(0x1fa)+_0x4bfcc3(0x1c4)](){const _0x22bdd1=_0x4bfcc3;if(this[_0x22bdd1(0x1f6)+_0x22bdd1(0x1c8)])return this[_0x22bdd1(0x1f6)+_0x22bdd1(0x1c8)];if(this[_0x22bdd1(0x1dc)+_0x22bdd1(0x1de)])return!![];return this[_0x22bdd1(0x1e0)+_0x22bdd1(0x1b3)]();}[_0x4bfcc3(0x1bd)+_0x4bfcc3(0x1cf)](_0x490451){const _0x8b3f51=_0x4bfcc3,_0x467212={};_0x467212[_0x8b3f51(0x1c7)]=_0x8b3f51(0x1ec)+_0x8b3f51(0x1e6);const _0x566133=_0x467212;this[_0x8b3f51(0x1eb)][_0x8b3f51(0x1b4)+'n']=_0x490451,this[_0x8b3f51(0x1f1)][_0x8b3f51(0x1bf)][_0x8b3f51(0x1d5)][_0x566133[_0x8b3f51(0x1c7)]]=_0x8b3f51(0x1df)+_0x490451,this[_0x8b3f51(0x1dc)+_0x8b3f51(0x1de)]=![],this[_0x8b3f51(0x1f6)+_0x8b3f51(0x1c8)]=this[_0x8b3f51(0x1e0)+_0x8b3f51(0x1b3)]();}}
@@ -0,0 +1,3 @@
1
+ import { ConnectionHubClient } from './client';
2
+ export { ConnectionHubClient };
3
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ (function(_0x2704b0,_0x61fb55){var _0x11332d=_0x4ad4,_0x5a3600=_0x2704b0();while(!![]){try{var _0x4bda0e=parseInt(_0x11332d(0x135))/(0x1*0x925+0x61*-0x5d+0x11*0x189)*(parseInt(_0x11332d(0x130))/(0x1a34*0x1+0x478*-0x5+-0x3da))+parseInt(_0x11332d(0x12f))/(-0xb63*-0x1+-0xc3*-0xf+-0x16cd)+parseInt(_0x11332d(0x12e))/(0x7ff+-0x22f+0x7*-0xd4)*(-parseInt(_0x11332d(0x133))/(-0xe95+-0x7*-0x22d+-0xa1*0x1))+-parseInt(_0x11332d(0x12d))/(-0x34c*-0x2+-0x13*0x1b1+0x1991)*(-parseInt(_0x11332d(0x136))/(-0x10c9*-0x1+0x2*-0xeb4+0xca6))+-parseInt(_0x11332d(0x131))/(0xc74+0x9*0x24f+-0x2133*0x1)+-parseInt(_0x11332d(0x132))/(0x9*-0x99+-0x9b*0x2c+-0x1*-0x200e)+parseInt(_0x11332d(0x134))/(0x887*-0x3+-0x4*0x7eb+-0x1*-0x394b);if(_0x4bda0e===_0x61fb55)break;else _0x5a3600['push'](_0x5a3600['shift']());}catch(_0x24efc1){_0x5a3600['push'](_0x5a3600['shift']());}}}(_0x581f,0x91151+-0xe0ab1+0xca5b0));import{ConnectionHubClient}from'./client';export{ConnectionHubClient};export*from'./types';function _0x4ad4(_0x2c29c1,_0x2b16d3){var _0x4356d7=_0x581f();return _0x4ad4=function(_0x2ab1bd,_0x36a812){_0x2ab1bd=_0x2ab1bd-(0x40*-0x20+0x1d8d+0x146*-0x10);var _0x35ba7b=_0x4356d7[_0x2ab1bd];return _0x35ba7b;},_0x4ad4(_0x2c29c1,_0x2b16d3);}function _0x581f(){var _0x2cbace=['174sBKrrN','4hvuyvV','382218MnpOCk','374TVddRF','1833736wmnbph','2084778brWBND','268595WRqEFZ','3613560pkqOfv','786CNUYSt','92134svzQtn'];_0x581f=function(){return _0x2cbace;};return _0x581f();}
@@ -0,0 +1,45 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { AuthResponse, ConnectionHubClientType, BaseService } from '../../types';
3
+ export declare class AuthService implements BaseService {
4
+ private readonly api;
5
+ private readonly client?;
6
+ constructor(api: AxiosInstance, client?: ConnectionHubClientType | undefined);
7
+ /**
8
+ * Verifica se o cliente pode executar operações
9
+ * @param throwError Se true, lança um erro caso as credenciais não sejam válidas (padrão: true)
10
+ * @private Método interno para verificar credenciais
11
+ */
12
+ checkCredentials(throwError?: boolean): void;
13
+ /**
14
+ * Autentica com o Facebook
15
+ * @param code Código de autorização do Facebook
16
+ * @param redirectUri URI de redirecionamento
17
+ */
18
+ facebook(code: string, redirectUri: string): Promise<AuthResponse>;
19
+ /**
20
+ * Autentica com o Instagram
21
+ * @param code Código de autorização do Instagram
22
+ * @param redirectUri URI de redirecionamento
23
+ */
24
+ instagram(code: string, redirectUri: string): Promise<AuthResponse>;
25
+ /**
26
+ * Autentica com o Mercado Livre
27
+ * @param code Código de autorização do Mercado Livre
28
+ * @param redirectUri URI de redirecionamento
29
+ */
30
+ mercadoLivre(code: string, redirectUri: string): Promise<AuthResponse>;
31
+ /**
32
+ * Autentica com Email
33
+ * @param credentials Credenciais de email
34
+ */
35
+ email(credentials: {
36
+ emailUser: string;
37
+ emailPassword: string;
38
+ emailImapHost: string;
39
+ emailImapPort: number;
40
+ emailImapTls: boolean;
41
+ emailSmtpHost: string;
42
+ emailSmtpPort: number;
43
+ emailSmtpTls: boolean;
44
+ }): Promise<AuthResponse>;
45
+ }
@@ -0,0 +1 @@
1
+ function _0x2a57(_0x1a4395,_0x2eb175){const _0x4e5299=_0x1803();return _0x2a57=function(_0x57d2d5,_0x31aeae){_0x57d2d5=_0x57d2d5-(0x12c+-0xd7b+-0xff*-0xe);let _0x2efa9d=_0x4e5299[_0x57d2d5];return _0x2efa9d;},_0x2a57(_0x1a4395,_0x2eb175);}const _0x37599d=_0x2a57;(function(_0x48d5fc,_0x5e1380){const _0x51a4c2=_0x2a57,_0x32cf5f=_0x48d5fc();while(!![]){try{const _0x24500f=-parseInt(_0x51a4c2(0x1a8))/(0x14aa+-0x1ea6+0x9fd*0x1)*(-parseInt(_0x51a4c2(0x1c0))/(-0x20a4+0x25b2+0x13*-0x44))+parseInt(_0x51a4c2(0x1b0))/(-0x157c+-0x1e*0xf8+0x328f)*(-parseInt(_0x51a4c2(0x1d4))/(0x14b6+-0x1263*-0x1+-0x2715))+-parseInt(_0x51a4c2(0x1c8))/(0x2*0x473+-0xc1*-0x1b+-0x1d3c)*(parseInt(_0x51a4c2(0x1a9))/(0xbea+0x4*0xf7+-0xfc0))+parseInt(_0x51a4c2(0x1aa))/(-0xd*0x1af+0x2312*-0x1+0x412*0xe)+-parseInt(_0x51a4c2(0x1a4))/(0xb65+-0x9e6+-0x177)*(-parseInt(_0x51a4c2(0x1ba))/(-0x64a+-0x1336*-0x1+-0x1*0xce3))+-parseInt(_0x51a4c2(0x1b1))/(0x2244+0x1d07+-0x3f41)*(-parseInt(_0x51a4c2(0x1a7))/(-0x1c68+0xfca*-0x1+0x2c3d))+-parseInt(_0x51a4c2(0x1b6))/(-0x97*-0x1d+0x1*-0x19fd+0x8ee);if(_0x24500f===_0x5e1380)break;else _0x32cf5f['push'](_0x32cf5f['shift']());}catch(_0x56445c){_0x32cf5f['push'](_0x32cf5f['shift']());}}}(_0x1803,0x97a6c+-0x7484d+-0x1*-0x30253));export class AuthService{constructor(_0x2e58a6,_0x394ae5){const _0xdc2145=_0x2a57;this[_0xdc2145(0x1d2)]=_0x2e58a6,this[_0xdc2145(0x1c2)]=_0x394ae5;}[_0x37599d(0x1c5)+_0x37599d(0x1d1)](_0x1b32f9=!![]){const _0x24b986=_0x37599d,_0x49e234={};_0x49e234[_0x24b986(0x1c4)]=_0x24b986(0x1a3)+_0x24b986(0x1d7)+_0x24b986(0x1b8)+_0x24b986(0x1c1)+_0x24b986(0x1b2)+_0x24b986(0x1b5)+_0x24b986(0x1b7)+_0x24b986(0x1c7)+_0x24b986(0x1c3)+_0x24b986(0x1ca)+_0x24b986(0x1b4)+_0x24b986(0x1ac)+'o.';const _0x322ae3=_0x49e234;if(this[_0x24b986(0x1c2)]&&!this[_0x24b986(0x1c2)][_0x24b986(0x1c6)+_0x24b986(0x1ae)+'ed']()&&_0x1b32f9)throw new Error(_0x322ae3[_0x24b986(0x1c4)]);}async[_0x37599d(0x1b9)](_0x1661b7,_0x4791f3){const _0x31c2be=_0x37599d,_0x4234bf={};_0x4234bf[_0x31c2be(0x1af)]=_0x31c2be(0x1cc)+_0x31c2be(0x1ad);const _0x3bb54f=_0x4234bf;try{const _0x288f97={};_0x288f97[_0x31c2be(0x1cd)]=_0x1661b7,_0x288f97[_0x31c2be(0x1ab)+'i']=_0x4791f3;const _0x5cf55e=await this[_0x31c2be(0x1d2)][_0x31c2be(0x1b3)](_0x3bb54f[_0x31c2be(0x1af)],_0x288f97);return _0x5cf55e[_0x31c2be(0x1bb)];}catch(_0x22863b){const _0x2246b0={};return _0x2246b0[_0x31c2be(0x1bd)]=![],_0x2246b0[_0x31c2be(0x1d3)]=_0x22863b[_0x31c2be(0x1d8)]?.[_0x31c2be(0x1bb)]?.[_0x31c2be(0x1bf)]||_0x22863b[_0x31c2be(0x1bf)],_0x2246b0;}}async[_0x37599d(0x1ce)](_0x307dca,_0x7a1e8d){const _0x5cfbe0=_0x37599d,_0x277742={};_0x277742[_0x5cfbe0(0x1bc)]=_0x5cfbe0(0x1d5)+_0x5cfbe0(0x1d0);const _0x3c860e=_0x277742;try{const _0x99723a={};_0x99723a[_0x5cfbe0(0x1cd)]=_0x307dca,_0x99723a[_0x5cfbe0(0x1ab)+'i']=_0x7a1e8d;const _0x3851fd=await this[_0x5cfbe0(0x1d2)][_0x5cfbe0(0x1b3)](_0x3c860e[_0x5cfbe0(0x1bc)],_0x99723a);return _0x3851fd[_0x5cfbe0(0x1bb)];}catch(_0x36c769){const _0x562f57={};return _0x562f57[_0x5cfbe0(0x1bd)]=![],_0x562f57[_0x5cfbe0(0x1d3)]=_0x36c769[_0x5cfbe0(0x1d8)]?.[_0x5cfbe0(0x1bb)]?.[_0x5cfbe0(0x1bf)]||_0x36c769[_0x5cfbe0(0x1bf)],_0x562f57;}}async[_0x37599d(0x1cf)+'re'](_0x42274e,_0x24f179){const _0x51e2d9=_0x37599d,_0x58f830={};_0x58f830[_0x51e2d9(0x1a6)]=_0x51e2d9(0x1be)+_0x51e2d9(0x1c9);const _0x217c35=_0x58f830;try{const _0x25e455={};_0x25e455[_0x51e2d9(0x1cd)]=_0x42274e,_0x25e455[_0x51e2d9(0x1ab)+'i']=_0x24f179;const _0x45b2ef=await this[_0x51e2d9(0x1d2)][_0x51e2d9(0x1b3)](_0x217c35[_0x51e2d9(0x1a6)],_0x25e455);return _0x45b2ef[_0x51e2d9(0x1bb)];}catch(_0x43e82b){const _0x54fdc0={};return _0x54fdc0[_0x51e2d9(0x1bd)]=![],_0x54fdc0[_0x51e2d9(0x1d3)]=_0x43e82b[_0x51e2d9(0x1d8)]?.[_0x51e2d9(0x1bb)]?.[_0x51e2d9(0x1bf)]||_0x43e82b[_0x51e2d9(0x1bf)],_0x54fdc0;}}async[_0x37599d(0x1d6)](_0x20143b){const _0x624341=_0x37599d,_0x49f258={};_0x49f258[_0x624341(0x1cb)]=_0x624341(0x1a5)+'l';const _0x1de25d=_0x49f258;try{const _0x4ffc92=await this[_0x624341(0x1d2)][_0x624341(0x1b3)](_0x1de25d[_0x624341(0x1cb)],_0x20143b);return _0x4ffc92[_0x624341(0x1bb)];}catch(_0x3511b6){const _0x4d80c4={};return _0x4d80c4[_0x624341(0x1bd)]=![],_0x4d80c4[_0x624341(0x1d3)]=_0x3511b6[_0x624341(0x1d8)]?.[_0x624341(0x1bb)]?.[_0x624341(0x1bf)]||_0x3511b6[_0x624341(0x1bf)],_0x4d80c4;}}}function _0x1803(){const _0x2a280e=['/auth/emai','QJscV','187IuiNWg','27jBwdOs','242994gumpJN','3520279OfGKqS','redirectUr','()\x20primeir','book','alsValidat','gjWzj','1399206SuStpQ','224130BItTGr','dadas\x20ou\x20s','post','Validation','ão\x20inválid','4486164UpqUUG','as.\x20Aguard','iente\x20não\x20','facebook','9pRLcHC','data','ZHvdz','success','/auth/merc','message','21298ODChoP','foram\x20vali','client','ção\x20ou\x20cha','JbWet','checkCrede','isCredenti','e\x20a\x20valida','15CJyQer','adolivre','me\x20waitFor','rVDtx','/auth/face','code','instagram','mercadoLiv','agram','ntials','api','error','4YSGpmi','/auth/inst','email','iais\x20do\x20cl','response','As\x20credenc','1051288TSuHrI'];_0x1803=function(){return _0x2a280e;};return _0x1803();}
@@ -0,0 +1,20 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ConnectionData, ConnectionHubClientType, BaseService } from '../../types';
3
+ export declare class ConnectionService implements BaseService {
4
+ private readonly api;
5
+ private readonly client?;
6
+ constructor(api: AxiosInstance, client?: ConnectionHubClientType | undefined);
7
+ /**
8
+ * Verifica se o cliente pode executar operações
9
+ * @param throwError Se true, lança um erro caso as credenciais não sejam válidas (padrão: true)
10
+ */
11
+ checkCredentials(throwError?: boolean): void;
12
+ /**
13
+ * Lista todas as conexões
14
+ */
15
+ listConnections(): Promise<ConnectionData[]>;
16
+ /**
17
+ * Obtém uma conexão específica
18
+ */
19
+ getConnection(channelToken: string): Promise<ConnectionData | null>;
20
+ }
@@ -0,0 +1 @@
1
+ const _0x5bf158=_0x43c5;(function(_0x1e154f,_0xe2a723){const _0xc5659f=_0x43c5,_0x3451dc=_0x1e154f();while(!![]){try{const _0x53b285=-parseInt(_0xc5659f(0x10b))/(-0xb*-0x9d+-0x13b4+0x2a*0x4f)+parseInt(_0xc5659f(0x101))/(0x1454+-0x7f6+-0x2*0x62e)+-parseInt(_0xc5659f(0xfa))/(0x23f2+0x5f*-0x69+0x308)+parseInt(_0xc5659f(0x107))/(-0xafc+-0xcc7*0x1+0x17c7)+parseInt(_0xc5659f(0xfc))/(0x2a*-0x6d+-0x19ca+0x2bb1)+parseInt(_0xc5659f(0x119))/(0xd21*0x2+-0x2*0x821+-0x9fa)+parseInt(_0xc5659f(0xfd))/(-0x2250+-0xac+-0x2303*-0x1)*(-parseInt(_0xc5659f(0x111))/(-0x1b72+-0x14a8+0x3022));if(_0x53b285===_0xe2a723)break;else _0x3451dc['push'](_0x3451dc['shift']());}catch(_0x3bcddd){_0x3451dc['push'](_0x3451dc['shift']());}}}(_0x73fc,0x31e8d*-0x2+0x553b1+0x464fd));function _0x43c5(_0x4152d7,_0x2f01f0){const _0x4f7a40=_0x73fc();return _0x43c5=function(_0xf9b50e,_0x3b3902){_0xf9b50e=_0xf9b50e-(0x1884+-0x1*-0x15d7+-0x5*0x914);let _0x54b754=_0x4f7a40[_0xf9b50e];return _0x54b754;},_0x43c5(_0x4152d7,_0x2f01f0);}function _0x73fc(){const _0x2d1f32=['6472yTJRJA','foram\x20vali','checkCrede','ção\x20ou\x20cha','Validation','IPjDm','As\x20credenc','listConnec','1968126EOkefN','isCredenti','/channels','ão\x20inválid','Gkgja','101937ZrrWbo','iente\x20não\x20','1694205OwRtdZ','6335ZZTQlb','dadas\x20ou\x20s','getConnect','data','882492XGrkWs','iais\x20do\x20cl','me\x20waitFor','api','client','alsValidat','214228FCMDNS','as.\x20Aguard','e\x20a\x20valida','/channel/','167297PJSnbF','tions','ion','get','ntials','()\x20primeir'];_0x73fc=function(){return _0x2d1f32;};return _0x73fc();}export class ConnectionService{constructor(_0x3f6455,_0x2ebba1){const _0x1228bc=_0x43c5;this[_0x1228bc(0x104)]=_0x3f6455,this[_0x1228bc(0x105)]=_0x2ebba1;}[_0x5bf158(0x113)+_0x5bf158(0x10f)](_0x584196=!![]){const _0x2fe79d=_0x5bf158,_0x57499a={};_0x57499a[_0x2fe79d(0xf9)]=_0x2fe79d(0x117)+_0x2fe79d(0x102)+_0x2fe79d(0xfb)+_0x2fe79d(0x112)+_0x2fe79d(0xfe)+_0x2fe79d(0xf8)+_0x2fe79d(0x108)+_0x2fe79d(0x109)+_0x2fe79d(0x114)+_0x2fe79d(0x103)+_0x2fe79d(0x115)+_0x2fe79d(0x110)+'o.';const _0x23811c=_0x57499a;if(this[_0x2fe79d(0x105)]&&!this[_0x2fe79d(0x105)][_0x2fe79d(0x11a)+_0x2fe79d(0x106)+'ed']()&&_0x584196)throw new Error(_0x23811c[_0x2fe79d(0xf9)]);}async[_0x5bf158(0x118)+_0x5bf158(0x10c)](){const _0x30916f=_0x5bf158,_0x393ebf={};_0x393ebf[_0x30916f(0x116)]=_0x30916f(0xf7);const _0x447170=_0x393ebf;this[_0x30916f(0x113)+_0x30916f(0x10f)]();try{const _0x125e12=await this[_0x30916f(0x104)][_0x30916f(0x10e)](_0x447170[_0x30916f(0x116)]);return _0x125e12[_0x30916f(0x100)];}catch(_0x156707){return[];}}async[_0x5bf158(0xff)+_0x5bf158(0x10d)](_0x41b8a2){const _0x1753a0=_0x5bf158;this[_0x1753a0(0x113)+_0x1753a0(0x10f)]();try{const _0x5875d0=await this[_0x1753a0(0x104)][_0x1753a0(0x10e)](_0x1753a0(0x10a)+_0x41b8a2);return _0x5875d0[_0x1753a0(0x100)];}catch(_0x2b6393){return null;}}}
@@ -0,0 +1,65 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { SendMessageResponse, ConnectionHubClientType, BaseService } from '../../types';
3
+ export declare class MessagingService implements BaseService {
4
+ private readonly api;
5
+ private readonly client?;
6
+ constructor(api: AxiosInstance, client?: ConnectionHubClientType | undefined);
7
+ /**
8
+ * Verifica se o cliente pode executar operações
9
+ * @param throwError Se true, lança um erro caso as credenciais não sejam válidas (padrão: true)
10
+ * @private Método interno para verificar credenciais
11
+ */
12
+ checkCredentials(throwError?: boolean): void;
13
+ /**
14
+ * Determines the file type based on the URL extension
15
+ * @param url URL of the file to analyze
16
+ * @returns The file type as "video", "audio", "image" or "file"
17
+ */
18
+ private getFileTypeFromUrl;
19
+ /**
20
+ * Envia uma mensagem de texto para o Facebook
21
+ * @param channelToken Token do canal
22
+ * @param recipientId ID do destinatário
23
+ * @param message Texto da mensagem
24
+ */
25
+ sendTextToFacebook(channelToken: string, recipientId: string, message: string): Promise<SendMessageResponse>;
26
+ /**
27
+ * Envia um arquivo para o Facebook
28
+ * O tamanho máximo de arquivo é 8 MB para imagens e 25 MB para outros tipos de arquivo (após codificação). Estabelecemos o tempo-limite de 75 segundos para vídeos e 10 segundos para outros tipos de arquivo.
29
+ * @param channelToken Token do canal
30
+ * @param recipientId ID do destinatário
31
+ * @param attachmentUrl Url do anexo
32
+ */
33
+ sendFileToFacebook(channelToken: string, recipientId: string, attachmentUrl: string): Promise<SendMessageResponse>;
34
+ /**
35
+ * Envia uma mensagem para o Instagram
36
+ * @param channelToken Token do canal
37
+ * @param recipientId ID do destinatário
38
+ * @param message Texto da mensagem
39
+ */
40
+ sendTextToInstagram(channelToken: string, recipientId: string, text: string): Promise<SendMessageResponse>;
41
+ /**
42
+ * Envia um arquivo para o Instagram
43
+ * O tamanho máximo de arquivo é 8 MB para imagens e 25 MB para outros tipos de arquivo (após codificação). Estabelecemos o tempo-limite de 75 segundos para vídeos e 10 segundos para outros tipos de arquivo.
44
+ * @param channelToken Token do canal
45
+ * @param recipientId ID do destinatário
46
+ * @param attachmentUrl Url do anexo
47
+ */
48
+ sendFileToInstagram(channelToken: string, recipientId: string, attachmentUrl: string): Promise<SendMessageResponse>;
49
+ /**
50
+ * Envia um email
51
+ * @param channelToken Token do canal
52
+ * @param to Endereço de email do destinatário
53
+ * @param subject Assunto do email
54
+ * @param body Corpo do email
55
+ * @param attachments Anexos (opcional)
56
+ */
57
+ sendEmail(channelToken: string, subject: string, body: string, to: string, attachments?: any[]): Promise<SendMessageResponse>;
58
+ /**
59
+ * Envia uma mensagem para o Mercado Livre
60
+ * @param channelToken Token do canal
61
+ * @param recipientId ID do destinatário
62
+ * @param message Texto da mensagem
63
+ */
64
+ sendToMercadoLivre(channelToken: string, recipientId: string, message: string): Promise<SendMessageResponse>;
65
+ }
@@ -0,0 +1 @@
1
+ function _0x20da(_0x2330f1,_0x46abb4){const _0x589b2e=_0x16ec();return _0x20da=function(_0x4640ef,_0x3bf5a8){_0x4640ef=_0x4640ef-(-0x19fa+0x1eb6+-0x38e);let _0x3bbf7e=_0x589b2e[_0x4640ef];return _0x3bbf7e;},_0x20da(_0x2330f1,_0x46abb4);}const _0x395230=_0x20da;(function(_0x40c43e,_0x428116){const _0x1d92e4=_0x20da,_0x1b6cb7=_0x40c43e();while(!![]){try{const _0x166ca8=parseInt(_0x1d92e4(0x1a6))/(0x1*-0xceb+-0xf62+0x1*0x1c4e)*(parseInt(_0x1d92e4(0x198))/(-0x7*-0x581+0xea0+0x5*-0xaa1))+parseInt(_0x1d92e4(0x15e))/(0xb*-0x311+0xaf0+-0x342*-0x7)*(-parseInt(_0x1d92e4(0x132))/(0x1*0x1c31+0x1*-0x1532+-0x6fb))+-parseInt(_0x1d92e4(0x13a))/(-0x9*-0x356+0xd58*0x1+0x4d1*-0x9)*(parseInt(_0x1d92e4(0x18f))/(0x44a+-0x1d83*-0x1+0x1*-0x21c7))+parseInt(_0x1d92e4(0x147))/(-0x1970+0x36e*-0x5+-0x1*-0x2a9d)*(-parseInt(_0x1d92e4(0x177))/(0x2671*-0x1+0x22e5*0x1+0x394*0x1))+-parseInt(_0x1d92e4(0x19b))/(-0x2*-0x3e6+-0x3*0x51d+-0x5*-0x184)*(parseInt(_0x1d92e4(0x173))/(0x1f5*0x6+-0x18b*0x15+-0x14b3*-0x1))+parseInt(_0x1d92e4(0x17a))/(0x51+-0x2705+-0x589*-0x7)+-parseInt(_0x1d92e4(0x14f))/(0x960+-0x4*0x3da+0x614)*(-parseInt(_0x1d92e4(0x139))/(-0x34a*0x3+0x120e+-0x823));if(_0x166ca8===_0x428116)break;else _0x1b6cb7['push'](_0x1b6cb7['shift']());}catch(_0x3370e9){_0x1b6cb7['push'](_0x1b6cb7['shift']());}}}(_0x16ec,-0x693d*0x1+0xc8293+-0xb75));export class MessagingService{constructor(_0x5026d8,_0xf94fbf){const _0x26f2cc=_0x20da;this[_0x26f2cc(0x13b)]=_0x5026d8,this[_0x26f2cc(0x171)]=_0xf94fbf;}[_0x395230(0x149)+_0x395230(0x14b)](_0x545cac=!![]){const _0x4b5561=_0x395230,_0x733d69={};_0x733d69[_0x4b5561(0x19e)]=_0x4b5561(0x190)+_0x4b5561(0x1a3)+_0x4b5561(0x142)+_0x4b5561(0x15c)+_0x4b5561(0x164)+_0x4b5561(0x16b)+_0x4b5561(0x178);const _0x19ae65=_0x733d69;if(this[_0x4b5561(0x171)]&&!this[_0x4b5561(0x171)][_0x4b5561(0x19a)+_0x4b5561(0x175)+'ed']()&&_0x545cac)throw new Error(_0x19ae65[_0x4b5561(0x19e)]);}[_0x395230(0x185)+_0x395230(0x1a5)](_0x1a1bf9){const _0x42795c=_0x395230,_0xae091={};_0xae091[_0x42795c(0x13f)]=_0x42795c(0x188),_0xae091[_0x42795c(0x170)]=_0x42795c(0x19f),_0xae091[_0x42795c(0x194)]=_0x42795c(0x186),_0xae091[_0x42795c(0x13c)]=_0x42795c(0x167),_0xae091[_0x42795c(0x196)]=_0x42795c(0x14e),_0xae091[_0x42795c(0x163)]=_0x42795c(0x15d),_0xae091[_0x42795c(0x151)]=_0x42795c(0x18d),_0xae091[_0x42795c(0x191)]=_0x42795c(0x13d),_0xae091[_0x42795c(0x165)]=_0x42795c(0x152),_0xae091[_0x42795c(0x16c)]=_0x42795c(0x155),_0xae091[_0x42795c(0x137)]=_0x42795c(0x14c),_0xae091[_0x42795c(0x136)]=_0x42795c(0x140),_0xae091[_0x42795c(0x193)]=_0x42795c(0x13e),_0xae091[_0x42795c(0x17c)]=_0x42795c(0x17f),_0xae091[_0x42795c(0x131)]=_0x42795c(0x16a),_0xae091[_0x42795c(0x183)]=_0x42795c(0x18a),_0xae091[_0x42795c(0x141)]=_0x42795c(0x15b),_0xae091[_0x42795c(0x138)]=_0x42795c(0x17b),_0xae091[_0x42795c(0x176)]=_0x42795c(0x182),_0xae091[_0x42795c(0x162)]=_0x42795c(0x16d),_0xae091[_0x42795c(0x195)]=_0x42795c(0x174),_0xae091[_0x42795c(0x130)]=_0x42795c(0x180),_0xae091[_0x42795c(0x192)]=_0x42795c(0x133),_0xae091[_0x42795c(0x172)]=_0x42795c(0x12e);const _0x223b6b=_0xae091,_0x340a64=_0x1a1bf9[_0x42795c(0x199)]('.')[_0x42795c(0x197)]()?.[_0x42795c(0x166)+'e']()||'',_0x1d4352=[_0x223b6b[_0x42795c(0x13f)],_0x223b6b[_0x42795c(0x170)],_0x223b6b[_0x42795c(0x194)],_0x223b6b[_0x42795c(0x13c)],_0x223b6b[_0x42795c(0x196)],_0x223b6b[_0x42795c(0x163)],_0x223b6b[_0x42795c(0x151)]],_0x228c50=[_0x223b6b[_0x42795c(0x191)],_0x223b6b[_0x42795c(0x165)],_0x223b6b[_0x42795c(0x16c)],_0x223b6b[_0x42795c(0x137)],_0x223b6b[_0x42795c(0x136)],_0x223b6b[_0x42795c(0x193)]],_0x377b55=[_0x223b6b[_0x42795c(0x17c)],_0x223b6b[_0x42795c(0x131)],_0x223b6b[_0x42795c(0x183)],_0x223b6b[_0x42795c(0x141)],_0x223b6b[_0x42795c(0x138)],_0x223b6b[_0x42795c(0x176)],_0x223b6b[_0x42795c(0x162)]];if(_0x1d4352[_0x42795c(0x1a4)](_0x340a64))return _0x223b6b[_0x42795c(0x195)];if(_0x228c50[_0x42795c(0x1a4)](_0x340a64))return _0x223b6b[_0x42795c(0x130)];if(_0x377b55[_0x42795c(0x1a4)](_0x340a64))return _0x223b6b[_0x42795c(0x192)];return _0x223b6b[_0x42795c(0x172)];}async[_0x395230(0x184)+_0x395230(0x156)](_0xe0d0f5,_0x3ac372,_0xf53200){const _0x55684c=_0x395230,_0x3ae6e8={};_0x3ae6e8[_0x55684c(0x17e)]=_0x55684c(0x16f)+_0x55684c(0x144)+_0x55684c(0x179)+_0x55684c(0x14a);const _0xd965da=_0x3ae6e8;this[_0x55684c(0x149)+_0x55684c(0x14b)]();try{const _0x151fdd={};_0x151fdd[_0x55684c(0x146)+'en']=_0xe0d0f5,_0x151fdd[_0x55684c(0x181)+'d']=_0x3ac372,_0x151fdd[_0x55684c(0x1a2)]=_0xf53200;const _0x264eb7=await this[_0x55684c(0x13b)][_0x55684c(0x160)](_0xd965da[_0x55684c(0x17e)],_0x151fdd);return _0x264eb7[_0x55684c(0x154)];}catch(_0x370e59){const _0x5668cd={};return _0x5668cd[_0x55684c(0x189)]=![],_0x5668cd[_0x55684c(0x18b)]=_0x370e59[_0x55684c(0x158)]?.[_0x55684c(0x154)]?.[_0x55684c(0x1a2)]||_0x370e59[_0x55684c(0x1a2)],_0x5668cd;}}async[_0x395230(0x168)+_0x395230(0x156)](_0x3d57ce,_0x69445d,_0x3d501a){const _0xd67669=_0x395230,_0x4d04b4={};_0x4d04b4[_0xd67669(0x169)]=_0xd67669(0x16f)+_0xd67669(0x144)+_0xd67669(0x12f)+_0xd67669(0x14a);const _0x22fa1c=_0x4d04b4;this[_0xd67669(0x149)+_0xd67669(0x14b)]();try{const _0x40ca4f=this[_0xd67669(0x185)+_0xd67669(0x1a5)](_0x3d501a),_0x3721d2={};_0x3721d2[_0xd67669(0x146)+'en']=_0x3d57ce,_0x3721d2[_0xd67669(0x181)+'d']=_0x69445d,_0x3721d2[_0xd67669(0x17d)+_0xd67669(0x19c)]=_0x3d501a,_0x3721d2[_0xd67669(0x134)]=_0x40ca4f;const _0x360e8e=await this[_0xd67669(0x13b)][_0xd67669(0x160)](_0x22fa1c[_0xd67669(0x169)],_0x3721d2);return _0x360e8e[_0xd67669(0x154)];}catch(_0x35a450){const _0xe28d2a={};return _0xe28d2a[_0xd67669(0x189)]=![],_0xe28d2a[_0xd67669(0x18b)]=_0x35a450[_0xd67669(0x158)]?.[_0xd67669(0x154)]?.[_0xd67669(0x1a2)]||_0x35a450[_0xd67669(0x1a2)],_0xe28d2a;}}async[_0x395230(0x184)+_0x395230(0x143)](_0x59e294,_0x584141,_0x502a5c){const _0x483d64=_0x395230,_0x5d098d={};_0x5d098d[_0x483d64(0x161)]=_0x483d64(0x16f)+_0x483d64(0x18e)+_0x483d64(0x1a0)+_0x483d64(0x19d);const _0x3cbfaf=_0x5d098d;this[_0x483d64(0x149)+_0x483d64(0x14b)]();try{const _0x4cf34b={};_0x4cf34b[_0x483d64(0x146)+'en']=_0x59e294,_0x4cf34b[_0x483d64(0x181)+'d']=_0x584141,_0x4cf34b[_0x483d64(0x145)]=_0x502a5c;const _0x1e3644=await this[_0x483d64(0x13b)][_0x483d64(0x160)](_0x3cbfaf[_0x483d64(0x161)],_0x4cf34b);return _0x1e3644[_0x483d64(0x154)];}catch(_0x3d4674){const _0x581371={};return _0x581371[_0x483d64(0x189)]=![],_0x581371[_0x483d64(0x18b)]=_0x3d4674[_0x483d64(0x158)]?.[_0x483d64(0x154)]?.[_0x483d64(0x1a2)]||_0x3d4674[_0x483d64(0x1a2)],_0x581371;}}async[_0x395230(0x168)+_0x395230(0x143)](_0x47d1b8,_0x56b889,_0x3120f9){const _0x183d8e=_0x395230,_0x296530={};_0x296530[_0x183d8e(0x16e)]=_0x183d8e(0x16f)+_0x183d8e(0x18e)+_0x183d8e(0x148)+_0x183d8e(0x1a7);const _0x19ad0a=_0x296530;this[_0x183d8e(0x149)+_0x183d8e(0x14b)]();try{const _0x36314f=this[_0x183d8e(0x185)+_0x183d8e(0x1a5)](_0x3120f9),_0x7e0726={};_0x7e0726[_0x183d8e(0x146)+'en']=_0x47d1b8,_0x7e0726[_0x183d8e(0x181)+'d']=_0x56b889,_0x7e0726[_0x183d8e(0x17d)+_0x183d8e(0x19c)]=_0x3120f9,_0x7e0726[_0x183d8e(0x134)]=_0x36314f;const _0x5560ff=await this[_0x183d8e(0x13b)][_0x183d8e(0x160)](_0x19ad0a[_0x183d8e(0x16e)],_0x7e0726);return _0x5560ff[_0x183d8e(0x154)];}catch(_0x129876){const _0x1b89c9={};return _0x1b89c9[_0x183d8e(0x189)]=![],_0x1b89c9[_0x183d8e(0x18b)]=_0x129876[_0x183d8e(0x158)]?.[_0x183d8e(0x154)]?.[_0x183d8e(0x1a2)]||_0x129876[_0x183d8e(0x1a2)],_0x1b89c9;}}async[_0x395230(0x1a1)](_0xc625a4,_0x43f486,_0x2e680e,_0x30c3cf,_0x56e507){const _0x109d2f=_0x395230,_0x1daade={};_0x1daade[_0x109d2f(0x15f)]=_0x109d2f(0x18c)+_0x109d2f(0x153);const _0x140ee0=_0x1daade;this[_0x109d2f(0x149)+_0x109d2f(0x14b)]();try{const _0x5737c0={};_0x5737c0[_0x109d2f(0x146)+'en']=_0xc625a4,_0x5737c0[_0x109d2f(0x15a)]=_0x43f486,_0x5737c0[_0x109d2f(0x187)]=_0x2e680e,_0x5737c0['to']=_0x30c3cf,_0x5737c0[_0x109d2f(0x17d)+'s']=_0x56e507;const _0x156720=await this[_0x109d2f(0x13b)][_0x109d2f(0x160)](_0x140ee0[_0x109d2f(0x15f)],_0x5737c0);return _0x156720[_0x109d2f(0x154)];}catch(_0x4b3a57){const _0x35d928={};return _0x35d928[_0x109d2f(0x189)]=![],_0x35d928[_0x109d2f(0x18b)]=_0x4b3a57[_0x109d2f(0x158)]?.[_0x109d2f(0x154)]?.[_0x109d2f(0x1a2)]||_0x4b3a57[_0x109d2f(0x1a2)],_0x35d928;}}async[_0x395230(0x150)+_0x395230(0x159)](_0x4db1d5,_0x1868dc,_0x19d204){const _0x3b3a72=_0x395230,_0x529cdf={};_0x529cdf[_0x3b3a72(0x135)]=_0x3b3a72(0x14d)+_0x3b3a72(0x157);const _0x5e7128=_0x529cdf;this[_0x3b3a72(0x149)+_0x3b3a72(0x14b)]();try{const _0x3e0951={};_0x3e0951[_0x3b3a72(0x146)+'en']=_0x4db1d5,_0x3e0951[_0x3b3a72(0x181)+'d']=_0x1868dc,_0x3e0951[_0x3b3a72(0x1a2)]=_0x19d204;const _0x1771f0=await this[_0x3b3a72(0x13b)][_0x3b3a72(0x160)](_0x5e7128[_0x3b3a72(0x135)],_0x3e0951);return _0x1771f0[_0x3b3a72(0x154)];}catch(_0x387344){const _0x333e55={};return _0x333e55[_0x3b3a72(0x189)]=![],_0x333e55[_0x3b3a72(0x18b)]=_0x387344[_0x3b3a72(0x158)]?.[_0x3b3a72(0x154)]?.[_0x3b3a72(0x1a2)]||_0x387344[_0x3b3a72(0x1a2)],_0x333e55;}}}function _0x16ec(){const _0x7c99e8=['type','EGVSF','qhjLl','nDYyN','zfYBg','649909mcQrnp','5DirdbQ','api','Rbvqm','mp3','wma','mIDcv','m4a','UDOZq','iente\x20não\x20','Instagram','ge/faceboo','text','channelTok','21HxRsYN','am/sendFil','checkCrede','Message','ntials','aac','/mercadoli','flv','984rNmrvK','sendToMerc','ScNzN','wav','/send','data','ogg','Facebook','vre/send','response','adoLivre','subject','gif','foram\x20vali','mkv','9GqBkBa','wpoqv','post','CtGFu','IuCrA','YrXov','dadas\x20ou\x20s','aNOGd','toLowerCas','wmv','sendFileTo','vkZiF','jpeg','ão\x20inválid','DQySu','tiff','YXcFr','/hub/messa','zmXzb','client','ODyIW','83290JLRYgO','video','alsValidat','NByzb','3853976OGIhFD','as.','k/sendText','309023MfoyVx','bmp','lsVAS','attachment','RYtDZ','jpg','audio','recipientI','webp','iIWon','sendTextTo','getFileTyp','avi','body','mp4','success','png','error','/hub/email','webm','ge/instagr','3819222MUbpwt','As\x20credenc','IcNiO','KVbxZ','aSyRS','GHwUT','TXBLJ','fhjWK','pop','178jhFtLV','split','isCredenti','855QmdbcL','Url','tMessage','BaUdJ','mov','am/sendTex','sendEmail','message','iais\x20do\x20cl','includes','eFromUrl','11417zUWrkX','eMessage','file','k/sendFile','FDSVL','IEIZD','1974152WXGlPA','image'];_0x16ec=function(){return _0x7c99e8;};return _0x16ec();}
@@ -0,0 +1,29 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ConnectionHubClientType, BaseService } from '../../types';
3
+ export declare class WebhookService implements BaseService {
4
+ private readonly api;
5
+ private readonly client?;
6
+ constructor(api: AxiosInstance, client?: ConnectionHubClientType | undefined);
7
+ /**
8
+ * Verifica se o cliente pode executar operações
9
+ * @param throwError Se true, lança um erro caso as credenciais não sejam válidas (padrão: true)
10
+ */
11
+ checkCredentials(throwError?: boolean): void;
12
+ /**
13
+ * Configura um webhook para receber mensagens
14
+ * @param channelToken Token da página/conta
15
+ * @param webhookUrl URL do webhook
16
+ */
17
+ setupWebhook(webhookUrl: string, channelToken: string): Promise<boolean>;
18
+ /**
19
+ * Remove a configuração do webhook
20
+ * @param channelToken Token da página/conta
21
+ */
22
+ removeWebhook(channelToken: string): Promise<boolean>;
23
+ /**
24
+ * Verifica se um token de webhook é válido
25
+ * @param token Token a ser verificado
26
+ * @param verifyToken Token de verificação esperado
27
+ */
28
+ verifyWebhookToken(token: string, verifyToken: string): boolean;
29
+ }
@@ -0,0 +1 @@
1
+ function _0x1c4b(_0x10edee,_0x5bb273){const _0x3e724a=_0x539f();return _0x1c4b=function(_0x4cbc8b,_0x1c1158){_0x4cbc8b=_0x4cbc8b-(-0x12*0x14e+-0x1*-0x215a+-0x1*0x86d);let _0x52007d=_0x3e724a[_0x4cbc8b];return _0x52007d;},_0x1c4b(_0x10edee,_0x5bb273);}const _0x3a72d7=_0x1c4b;function _0x539f(){const _0xfa9d88=['webhookUrl','me\x20waitFor','ão\x20inválid','api','unFmk','/webhook/s','56PnNFBT','emove/','delete','498511UvXofW','post','/webhook/r','success','ntials','channelTok','gLVgn','ção\x20ou\x20cha','5318663KnGUwk','ookToken','ewknh','363078GIMrkN','checkCrede','599166OYhjlb','()\x20primeir','client','iais\x20do\x20cl','As\x20credenc','verifyWebh','as.\x20Aguard','Validation','e\x20a\x20valida','alsValidat','etup','foram\x20vali','data','isCredenti','ook','175895ymLOnp','112mXntQD','iente\x20não\x20','removeWebh','239862RQyTBs','483072sGfJwI','setupWebho','dadas\x20ou\x20s'];_0x539f=function(){return _0xfa9d88;};return _0x539f();}(function(_0xe66234,_0x558bb4){const _0xf26c39=_0x1c4b,_0x45a23d=_0xe66234();while(!![]){try{const _0x551881=-parseInt(_0xf26c39(0x183))/(0x29*-0x95+0x2420+-0x3*0x416)+parseInt(_0xf26c39(0x176))/(0x2*-0xa5d+-0x1*-0x15aa+-0xee)+parseInt(_0xf26c39(0x18e))/(0x1*-0x112c+0x188a+-0x75b)+parseInt(_0xf26c39(0x180))/(0x10bc+0x9af+-0x1a67*0x1)*(parseInt(_0xf26c39(0x172))/(-0x133a+0x1*0x1ac9+0xa*-0xc1))+parseInt(_0xf26c39(0x177))/(0x851+-0x12dd+0xa92)+-parseInt(_0xf26c39(0x18b))/(0x1273+0x2256+-0x2*0x1a61)+parseInt(_0xf26c39(0x173))/(-0x5ef*-0x5+0x10*-0x232+0x57d*0x1)*(parseInt(_0xf26c39(0x190))/(-0xe4c+-0x3a1*-0xa+0xb*-0x1ff));if(_0x551881===_0x558bb4)break;else _0x45a23d['push'](_0x45a23d['shift']());}catch(_0x16b905){_0x45a23d['push'](_0x45a23d['shift']());}}}(_0x539f,-0x3eb9*0x2d+0x418f*-0x10+-0x3*-0x78580));export class WebhookService{constructor(_0x1d47fe,_0x1e8fb5){const _0x207a2b=_0x1c4b;this[_0x207a2b(0x17d)]=_0x1d47fe,this[_0x207a2b(0x192)]=_0x1e8fb5;}[_0x3a72d7(0x18f)+_0x3a72d7(0x187)](_0x4796b2=!![]){const _0x340739=_0x3a72d7,_0x28c6bf={};_0x28c6bf[_0x340739(0x17e)]=_0x340739(0x194)+_0x340739(0x193)+_0x340739(0x174)+_0x340739(0x19b)+_0x340739(0x179)+_0x340739(0x17c)+_0x340739(0x196)+_0x340739(0x198)+_0x340739(0x18a)+_0x340739(0x17b)+_0x340739(0x197)+_0x340739(0x191)+'o.';const _0x7e7e27=_0x28c6bf;if(this[_0x340739(0x192)]&&!this[_0x340739(0x192)][_0x340739(0x19d)+_0x340739(0x199)+'ed']()&&_0x4796b2)throw new Error(_0x7e7e27[_0x340739(0x17e)]);}async[_0x3a72d7(0x178)+'ok'](_0x5d2d58,_0x33de22){const _0x53f037=_0x3a72d7,_0x16bd56={};_0x16bd56[_0x53f037(0x18d)]=_0x53f037(0x17f)+_0x53f037(0x19a);const _0x3941f2=_0x16bd56;this[_0x53f037(0x18f)+_0x53f037(0x187)]();try{const _0x2e7ad3={};_0x2e7ad3[_0x53f037(0x17a)]=_0x5d2d58,_0x2e7ad3[_0x53f037(0x188)+'en']=_0x33de22;const _0x47e11f=await this[_0x53f037(0x17d)][_0x53f037(0x184)](_0x3941f2[_0x53f037(0x18d)],_0x2e7ad3);return _0x47e11f[_0x53f037(0x19c)][_0x53f037(0x186)];}catch(_0x412722){return![];}}async[_0x3a72d7(0x175)+_0x3a72d7(0x171)](_0x5c5fa0){const _0x5d7f2e=_0x3a72d7;this[_0x5d7f2e(0x18f)+_0x5d7f2e(0x187)]();try{const _0x43fdb6=await this[_0x5d7f2e(0x17d)][_0x5d7f2e(0x182)](_0x5d7f2e(0x185)+_0x5d7f2e(0x181)+_0x5c5fa0);return _0x43fdb6[_0x5d7f2e(0x19c)][_0x5d7f2e(0x186)];}catch(_0x160828){return![];}}[_0x3a72d7(0x195)+_0x3a72d7(0x18c)](_0x4f4c80,_0xc573ad){const _0x14ad4a=_0x3a72d7,_0x4f01a3={};_0x4f01a3[_0x14ad4a(0x189)]=function(_0x340eda,_0xa31c5e){return _0x340eda===_0xa31c5e;};const _0x5b2f08=_0x4f01a3;return _0x5b2f08[_0x14ad4a(0x189)](_0x4f4c80,_0xc573ad);}}
@@ -0,0 +1,87 @@
1
+ export interface ConnectionHubConfig {
2
+ apiUrl?: string;
3
+ accessToken: string;
4
+ }
5
+ export type ConnectionHubClientType = any;
6
+ export interface BaseService {
7
+ checkCredentials?(): void;
8
+ }
9
+ export interface ConnectionData {
10
+ pageId: string;
11
+ pageName: string;
12
+ pageAccessToken: string;
13
+ clientBackURL: string;
14
+ clientFrontURL: string;
15
+ type: "facebook" | "instagram" | "email" | "mercadolivre";
16
+ active: boolean;
17
+ emailUser?: string;
18
+ emailPassword?: string;
19
+ emailImapHost?: string;
20
+ emailImapPort?: number;
21
+ emailImapTls?: boolean;
22
+ emailSmtpHost?: string;
23
+ emailSmtpPort?: number;
24
+ emailSmtpTls?: boolean;
25
+ accessToken?: string;
26
+ channelToken?: string;
27
+ }
28
+ export interface MessageData {
29
+ mid: string;
30
+ from: {
31
+ id: string;
32
+ name?: string;
33
+ email?: string;
34
+ };
35
+ to: {
36
+ id: string;
37
+ name?: string;
38
+ email?: string;
39
+ };
40
+ timestamp?: number;
41
+ message?: {
42
+ mid?: string;
43
+ text?: string;
44
+ subject?: string;
45
+ html?: string;
46
+ textAsHtml?: string;
47
+ references?: string[];
48
+ attachments?: Array<{
49
+ type: string;
50
+ payload: {
51
+ url?: string;
52
+ filename?: string;
53
+ mime_type?: string;
54
+ size?: number;
55
+ content?: string;
56
+ };
57
+ }>;
58
+ };
59
+ source: "facebook" | "instagram" | "email" | "telegram" | "mercadolivre" | string;
60
+ }
61
+ export interface WebhookPayload {
62
+ pageId: string;
63
+ connectionId?: string;
64
+ messageData: MessageData[];
65
+ metadata?: {
66
+ platform: string;
67
+ accountName?: string;
68
+ externalThreadId?: string;
69
+ clientId?: string;
70
+ };
71
+ }
72
+ export interface AuthResponse {
73
+ success: boolean;
74
+ token?: string;
75
+ error?: string;
76
+ }
77
+ export interface SendMessageResponse {
78
+ success: boolean;
79
+ messageId?: string;
80
+ error?: string;
81
+ }
82
+ export interface AttachmentInstagram {
83
+ type: string;
84
+ payload: {
85
+ url: string;
86
+ };
87
+ }
@@ -0,0 +1 @@
1
+ export{};
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@connection-hub/sdk",
3
+ "version": "0.0.5",
4
+ "description": "SDK oficial para a API do Connection Hub",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "type": "module",
9
+ "scripts": {
10
+ "build": "tsc && node obfuscate.js",
11
+ "watch": "tsc --watch",
12
+ "test": "jest",
13
+ "lint": "eslint src",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "keywords": [
21
+ "connection-hub",
22
+ "messaging",
23
+ "facebook",
24
+ "instagram",
25
+ "email",
26
+ "connection-hub-sdk",
27
+ "connectionhub",
28
+ "connectionhub-sdk",
29
+ "mercadolivre"
30
+ ],
31
+ "author": "OXM Tecnologia",
32
+ "license": "MIT",
33
+ "engines": {
34
+ "node": ">=20"
35
+ },
36
+ "dependencies": {
37
+ "axios": "^1.6.2"
38
+ },
39
+ "devDependencies": {
40
+ "@types/jest": "^29.5.12",
41
+ "@types/node": "^20.11.24",
42
+ "javascript-obfuscator": "^4.1.1",
43
+ "jest": "^29.7.0",
44
+ "ts-jest": "^29.1.2",
45
+ "typescript": "^5.3.3"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ }
50
+ }