@in.pulse-crm/sdk 2.5.14 → 2.5.16

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,12 +51,12 @@ class SocketClient {
51
51
  * @returns A function that, when called, removes the event listener for the specified event.
52
52
  */
53
53
  on = (event, callback) => {
54
- if (!this.listeners.get(event)) {
55
- this.ws.on(event, (data) => {
56
- callback(data);
57
- });
58
- this.listeners.set(event, callback);
54
+ const oldListener = this.listeners.get(event);
55
+ if (oldListener) {
56
+ this.ws.off(event, oldListener);
59
57
  }
58
+ this.ws.on(event, callback);
59
+ this.listeners.set(event, callback);
60
60
  };
61
61
  /**
62
62
  * Removes a previously registered event listener from the WebSocket connection.
@@ -1,71 +1,71 @@
1
1
  export interface Customer {
2
2
  CODIGO: number;
3
3
  RAZAO: string;
4
- FANTASIA: string;
4
+ FANTASIA: string | null;
5
5
  PESSOA: "FIS" | "JUR" | null;
6
6
  ATIVO: "SIM" | "NAO" | null;
7
- CPF_CNPJ: string;
8
- IE_RG: string;
9
- GRUPO: number;
10
- END_RUA: string;
11
- CIDADE: string;
12
- BAIRRO: string;
13
- ESTADO: string;
14
- CEP: string;
15
- COMPLEMENTO: string;
16
- AREA1: number;
17
- AREA2: number;
18
- AREA3: number;
19
- AREAFAX: number;
20
- FONE1: string;
21
- FONE2: string;
22
- FONE3: string;
23
- FAX: string;
24
- DESC_FONE1: string;
25
- DESC_FONE2: string;
26
- DESC_FONE3: string;
27
- DESCFAX: string;
28
- EMAIL: string;
29
- WEBSITE: string;
30
- DATACAD: Date;
31
- STATUS_CAD: string;
32
- OBS_ADMIN: string;
33
- OBS_OPERADOR: string;
34
- ORIGEM: number;
35
- OPERADOR: number;
36
- COD_MIDIA: number;
37
- COD_ERP: string;
7
+ CPF_CNPJ: string | null;
8
+ IE_RG: string | null;
9
+ GRUPO: number | null;
10
+ END_RUA: string | null;
11
+ CIDADE: string | null;
12
+ BAIRRO: string | null;
13
+ ESTADO: string | null;
14
+ CEP: string | null;
15
+ COMPLEMENTO: string | null;
16
+ AREA1: number | null;
17
+ AREA2: number | null;
18
+ AREA3: number | null;
19
+ AREAFAX: number | null;
20
+ FONE1: string | null;
21
+ FONE2: string | null;
22
+ FONE3: string | null;
23
+ FAX: string | null;
24
+ DESC_FONE1: string | null;
25
+ DESC_FONE2: string | null;
26
+ DESC_FONE3: string | null;
27
+ DESCFAX: string | null;
28
+ EMAIL: string | null;
29
+ WEBSITE: string | null;
30
+ DATACAD: string | null;
31
+ STATUS_CAD: string | null;
32
+ OBS_ADMIN: string | null;
33
+ OBS_OPERADOR: string | null;
34
+ ORIGEM: number | null;
35
+ OPERADOR: number | null;
36
+ COD_MIDIA: number | null;
37
+ COD_ERP: string | null;
38
38
  BLOCK_COMPRAS: "SIM" | "NAO" | null;
39
- COD_UNIDADE: number;
40
- SALDO_DISPONIVEL: number;
41
- SALDO_LIMITE: number;
42
- POTENCIAL: number;
43
- DATA_ULT_COMPRA: Date;
44
- SEGMENTO: number;
45
- ULTI_RESULTADO: Date;
46
- DT_AGENDAMENTO: Date;
47
- COD_CAMPANHA: number;
48
- COD_RESULTADO: number;
49
- CONTATO_MAIL: string;
39
+ COD_UNIDADE: number | null;
40
+ SALDO_DISPONIVEL: number | null;
41
+ SALDO_LIMITE: number | null;
42
+ POTENCIAL: number | null;
43
+ DATA_ULT_COMPRA: string | null;
44
+ SEGMENTO: number | null;
45
+ ULTI_RESULTADO: string | null;
46
+ DT_AGENDAMENTO: string | null;
47
+ COD_CAMPANHA: number | null;
48
+ COD_RESULTADO: number | null;
49
+ CONTATO_MAIL: string | null;
50
50
  ATUALIZADOR: "CADASTRO" | "ATUALIZAÇÃO" | null;
51
- OPERADOR_LOGIN: string;
52
- OBS_FONE1: string;
53
- OBS_FONE2: string;
54
- OBS_FONE3: string;
55
- NR_FUNCIONARIOS: number;
56
- EMAIL2: string;
57
- OBS_CLIENTES: string;
58
- VENCIMENTO_LIMITE_CREDITO: Date;
51
+ OPERADOR_LOGIN: string | null;
52
+ OBS_FONE1: string | null;
53
+ OBS_FONE2: string | null;
54
+ OBS_FONE3: string | null;
55
+ NR_FUNCIONARIOS: number | null;
56
+ EMAIL2: string | null;
57
+ OBS_CLIENTES: string | null;
58
+ VENCIMENTO_LIMITE_CREDITO: string | null;
59
59
  PERIODO_RECOMPRA: number;
60
- DT_ULTIMO_ORCAMENTO_VENDA: Date;
60
+ DT_ULTIMO_ORCAMENTO_VENDA: string | null;
61
61
  POSSUI_ORCAMENTO: "S" | "N" | null;
62
62
  POSSUI_VENDA: "S" | "N" | null;
63
- CODIGOPRINCIPAL: number;
64
- SETOR: number;
63
+ CODIGOPRINCIPAL: number | null;
64
+ SETOR: number | null;
65
65
  }
66
66
  export interface CreateCustomerDTO {
67
67
  RAZAO: string;
68
- CPF_CNPJ: string;
68
+ CPF_CNPJ?: string | null;
69
69
  FANTASIA?: string | null;
70
70
  PESSOA?: "FIS" | "JUR" | null;
71
71
  ATIVO?: "SIM" | "NAO" | null;
@@ -1,7 +1,7 @@
1
1
  import ApiClient from "./api-client";
2
2
  import { Wallet } from "./types/wallet.types";
3
3
  export default class WalletsClient extends ApiClient {
4
- createWallet(instance: string, name: string): Promise<Wallet>;
4
+ createWallet(name: string): Promise<Wallet>;
5
5
  deleteWallet(walletId: number): Promise<Wallet>;
6
6
  updateWalletName(id: number, newName: string): Promise<Wallet>;
7
7
  addUserToWallet(walletId: number, userId: number): Promise<Wallet>;
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const api_client_1 = __importDefault(require("./api-client"));
7
7
  class WalletsClient extends api_client_1.default {
8
- async createWallet(instance, name) {
8
+ async createWallet(name) {
9
9
  try {
10
- const response = await this.httpClient.post(`/api/wallets`, { instance, name });
10
+ const response = await this.httpClient.post(`/api/wallets`, { name });
11
11
  return response.data.data;
12
12
  }
13
13
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.5.14",
3
+ "version": "2.5.16",
4
4
  "description": "SDKs for abstraction of api consumption of in.pulse-crm application",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -60,13 +60,13 @@ export default class SocketClient {
60
60
  * @returns A function that, when called, removes the event listener for the specified event.
61
61
  */
62
62
  public on: ListenSocketEventFn = (event, callback) => {
63
- if (!this.listeners.get(event)) {
64
- this.ws.on(event, (data) => {
65
- callback(data);
66
- });
67
-
68
- this.listeners.set(event, callback);
63
+ const oldListener = this.listeners.get(event);
64
+ if (oldListener) {
65
+ this.ws.off(event, oldListener);
69
66
  }
67
+
68
+ this.ws.on(event, callback);
69
+ this.listeners.set(event, callback);
70
70
  };
71
71
 
72
72
  /**
@@ -1,72 +1,72 @@
1
1
  export interface Customer {
2
2
  CODIGO: number;
3
3
  RAZAO: string;
4
- FANTASIA: string;
4
+ FANTASIA: string | null;
5
5
  PESSOA: "FIS" | "JUR" | null;
6
6
  ATIVO: "SIM" | "NAO" | null;
7
- CPF_CNPJ: string;
8
- IE_RG: string;
9
- GRUPO: number;
10
- END_RUA: string;
11
- CIDADE: string;
12
- BAIRRO: string;
13
- ESTADO: string;
14
- CEP: string;
15
- COMPLEMENTO: string;
16
- AREA1: number;
17
- AREA2: number;
18
- AREA3: number;
19
- AREAFAX: number;
20
- FONE1: string;
21
- FONE2: string;
22
- FONE3: string;
23
- FAX: string;
24
- DESC_FONE1: string;
25
- DESC_FONE2: string;
26
- DESC_FONE3: string;
27
- DESCFAX: string;
28
- EMAIL: string;
29
- WEBSITE: string;
30
- DATACAD: Date;
31
- STATUS_CAD: string;
32
- OBS_ADMIN: string;
33
- OBS_OPERADOR: string;
34
- ORIGEM: number;
35
- OPERADOR: number;
36
- COD_MIDIA: number;
37
- COD_ERP: string;
7
+ CPF_CNPJ: string | null;
8
+ IE_RG: string | null;
9
+ GRUPO: number | null;
10
+ END_RUA: string | null;
11
+ CIDADE: string | null;
12
+ BAIRRO: string | null;
13
+ ESTADO: string | null;
14
+ CEP: string | null;
15
+ COMPLEMENTO: string | null;
16
+ AREA1: number | null;
17
+ AREA2: number | null;
18
+ AREA3: number | null;
19
+ AREAFAX: number | null;
20
+ FONE1: string | null;
21
+ FONE2: string | null;
22
+ FONE3: string | null;
23
+ FAX: string | null;
24
+ DESC_FONE1: string | null;
25
+ DESC_FONE2: string | null;
26
+ DESC_FONE3: string | null;
27
+ DESCFAX: string | null;
28
+ EMAIL: string | null;
29
+ WEBSITE: string | null;
30
+ DATACAD: string | null;
31
+ STATUS_CAD: string | null;
32
+ OBS_ADMIN: string | null;
33
+ OBS_OPERADOR: string | null;
34
+ ORIGEM: number | null;
35
+ OPERADOR: number | null;
36
+ COD_MIDIA: number | null;
37
+ COD_ERP: string | null;
38
38
  BLOCK_COMPRAS: "SIM" | "NAO" | null;
39
- COD_UNIDADE: number;
40
- SALDO_DISPONIVEL: number;
41
- SALDO_LIMITE: number;
42
- POTENCIAL: number;
43
- DATA_ULT_COMPRA: Date;
44
- SEGMENTO: number;
45
- ULTI_RESULTADO: Date;
46
- DT_AGENDAMENTO: Date;
47
- COD_CAMPANHA: number;
48
- COD_RESULTADO: number;
49
- CONTATO_MAIL: string;
39
+ COD_UNIDADE: number | null;
40
+ SALDO_DISPONIVEL: number | null;
41
+ SALDO_LIMITE: number | null;
42
+ POTENCIAL: number | null;
43
+ DATA_ULT_COMPRA: string | null;
44
+ SEGMENTO: number | null;
45
+ ULTI_RESULTADO: string | null;
46
+ DT_AGENDAMENTO: string | null;
47
+ COD_CAMPANHA: number | null;
48
+ COD_RESULTADO: number | null;
49
+ CONTATO_MAIL: string | null;
50
50
  ATUALIZADOR: "CADASTRO" | "ATUALIZAÇÃO" | null;
51
- OPERADOR_LOGIN: string;
52
- OBS_FONE1: string;
53
- OBS_FONE2: string;
54
- OBS_FONE3: string;
55
- NR_FUNCIONARIOS: number;
56
- EMAIL2: string;
57
- OBS_CLIENTES: string;
58
- VENCIMENTO_LIMITE_CREDITO: Date;
51
+ OPERADOR_LOGIN: string | null;
52
+ OBS_FONE1: string | null;
53
+ OBS_FONE2: string | null;
54
+ OBS_FONE3: string | null;
55
+ NR_FUNCIONARIOS: number | null;
56
+ EMAIL2: string | null;
57
+ OBS_CLIENTES: string | null;
58
+ VENCIMENTO_LIMITE_CREDITO: string | null;
59
59
  PERIODO_RECOMPRA: number;
60
- DT_ULTIMO_ORCAMENTO_VENDA: Date;
60
+ DT_ULTIMO_ORCAMENTO_VENDA: string | null;
61
61
  POSSUI_ORCAMENTO: "S" | "N" | null;
62
62
  POSSUI_VENDA: "S" | "N" | null;
63
- CODIGOPRINCIPAL: number;
64
- SETOR: number;
63
+ CODIGOPRINCIPAL: number | null;
64
+ SETOR: number | null;
65
65
  }
66
66
 
67
67
  export interface CreateCustomerDTO {
68
68
  RAZAO: string;
69
- CPF_CNPJ: string;
69
+ CPF_CNPJ?: string | null;
70
70
  FANTASIA?: string | null;
71
71
  PESSOA?: "FIS" | "JUR" | null;
72
72
  ATIVO?: "SIM" | "NAO" | null;
@@ -4,11 +4,11 @@ import { Wallet } from "./types/wallet.types";
4
4
 
5
5
  export default class WalletsClient extends ApiClient {
6
6
 
7
- public async createWallet(instance: string, name: string) {
7
+ public async createWallet(name: string) {
8
8
  try {
9
9
  const response = await this.httpClient.post<DataResponse<Wallet>>(
10
10
  `/api/wallets`,
11
- { instance, name }
11
+ { name }
12
12
  );
13
13
  return response.data.data
14
14
  } catch (error) {