@zennify/sdk-js 1.37.7 → 1.39.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zennify/sdk-js",
3
- "version": "1.37.7",
3
+ "version": "1.39.0",
4
4
  "description": "A simple package to work with https://api.zennify.app",
5
5
  "main": "dist/main.js",
6
6
  "keywords": [],
@@ -14,15 +14,15 @@
14
14
  },
15
15
  "types": "./types/main.d.ts",
16
16
  "devDependencies": {
17
- "@types/node": "^20.12.12",
18
- "discord.js": "^14.15.3",
19
- "typescript": "^5.5.3"
17
+ "@types/node": "^20.19.7",
18
+ "discord.js": "^14.21.0",
19
+ "typescript": "^5.8.3"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "tsc"
23
23
  },
24
24
  "dependencies": {
25
- "undici-types": "^5.26.5"
25
+ "undici-types": "^5.28.4"
26
26
  },
27
27
  "bugs": {
28
28
  "url": "https://github.com/zennify-ofc/sdk-js/issues"
package/src/errors.ts CHANGED
@@ -26,6 +26,23 @@ export interface APIErrors {
26
26
  'PLEASE_REVERIFY': {};
27
27
  // = user errors
28
28
  'USER_NOT_FOUND': {};
29
+ /// legal errors
30
+ 'USER_LEGAL_DATA_ALREADY_EXISTS': {};
31
+ 'USER_LEGAL_RESPONSIBLE_INVALID': {};
32
+
33
+ 'USER_LEGAL_DOCUMENTS_REQUIRED': {};
34
+ 'USER_LEGAL_DOCUMENT_INVALID': {};
35
+ 'USER_LEGAL_NAME_INVALID': {};
36
+ 'USER_LEGAL_BORN_INVALID': {};
37
+ 'USER_LEGAL_PHONE_INVALID': {};
38
+ 'USER_LEGAL_ADDRESS_INVALID': { prop: InvalidAddressProps };
39
+
40
+ 'USER_LEGAL_RESPONSIBLE_DOCUMENTS_REQUIRED': {};
41
+ 'USER_LEGAL_RESPONSIBLE_DOCUMENT_INVALID': {};
42
+ 'USER_LEGAL_RESPONSIBLE_NAME_INVALID': {};
43
+ 'USER_LEGAL_RESPONSIBLE_BORN_INVALID': {};
44
+ 'USER_LEGAL_RESPONSIBLE_PHONE_INVALID': {};
45
+ 'USER_LEGAL_RESPONSIBLE_ADDRESS_INVALID': { prop: InvalidAddressProps };
29
46
  /// token errors
30
47
  'INVALID_TOKEN_NAME': {};
31
48
  'INVALID_TOKEN_EXPIRATION': {};
@@ -191,6 +208,7 @@ export interface APIErrors {
191
208
  'STORE_ALREADY_CONFIGURED': {};
192
209
  }
193
210
 
211
+ type InvalidAddressProps = "cep" | "state" | "city" | "neighborhood" | "line1" | "line2" | "number";
194
212
  type ExpectedAdditionalData = {
195
213
  field: string;
196
214
  received: any;
@@ -11,7 +11,7 @@ export interface PartialProduct {
11
11
  export interface Product {
12
12
  id: number,
13
13
  name: string,
14
- created_at: string,
14
+ created_at: number,
15
15
  store_id: number,
16
16
  owner_id: number,
17
17
  icon_id?: string | null,
@@ -15,7 +15,7 @@ export type ProductStatistics = {
15
15
 
16
16
  export type Statistics = Record<string, Record<number, ProductStatistics>>
17
17
  export type StatisticsResponse = {
18
- last_update: string,
19
- created_at: string
18
+ last_update: number,
19
+ created_at: number
20
20
  statistics: Statistics
21
21
  };
@@ -5,7 +5,7 @@ export type Addons = 'custom_bot' | 'divulgation' | 'antiraid' | 'managed_automo
5
5
  export interface PartialStore {
6
6
  id: number,
7
7
  name: string,
8
- expires_at: string,
8
+ expires_at: number,
9
9
  icon_id?: string | null,
10
10
  banner_id?: string | null,
11
11
  pending_setup?: boolean | null,
@@ -24,15 +24,15 @@ export type StoreModeratorPermissions =
24
24
  export type StoreModerator = {
25
25
  username: string,
26
26
  discord_user_id: string | null,
27
- created_at: string,
27
+ created_at: number,
28
28
  permissions: StoreModeratorPermissions[]
29
29
  }
30
30
 
31
31
  export interface FullStore {
32
32
  id: number,
33
33
  name: string,
34
- created_at: string,
35
- expires_at: string,
34
+ created_at: number,
35
+ expires_at: number,
36
36
  owner_id: number,
37
37
  icon_id: string | null,
38
38
  banner_id: string | null,
@@ -66,7 +66,7 @@ export type StoreInvite = {
66
66
  },
67
67
  store: {
68
68
  name: string,
69
- created_at: string
69
+ created_at: number
70
70
  icon_id?: string | null,
71
71
  banner_id?: string | null,
72
72
  }
@@ -1,6 +1,6 @@
1
1
  export type BaseTransaction<TransactionMetadata = any> = {
2
2
  id: string,
3
- created_at: string,
3
+ created_at: number,
4
4
  entity: 'semiauto' | 'mercadopago',
5
5
  method: 'pix',
6
6
  managed?: boolean | null,
@@ -30,7 +30,7 @@ type SaleTransaction = {
30
30
  type: 'sale',
31
31
  order: DiscordOrder & {
32
32
  id: string,
33
- created_at: string,
33
+ created_at: number,
34
34
  discount: number,
35
35
  subtotal: number,
36
36
  total_value: number,
@@ -70,6 +70,6 @@ export type FullTransaction<TransactionMetadata = any> = BaseTransaction<Transac
70
70
  export type PartialTransaction = {
71
71
  id: string,
72
72
  base_value: number,
73
- created_at: string,
73
+ created_at: number,
74
74
  status: 'approved' | 'cancelled' | 'expired' | 'pending' | 'refused' | 'rejected' | 'analysis' | 'refunded' | 'refunded_partial'
75
75
  }
@@ -79,6 +79,62 @@
79
79
  "name": "User not found",
80
80
  "message": "Try again."
81
81
  },
82
+ "USER_LEGAL_DATA_ALREADY_EXISTS": {
83
+ "name": "Legal data already exists",
84
+ "message": "You already have legal data registered."
85
+ },
86
+ "USER_LEGAL_RESPONSIBLE_INVALID": {
87
+ "name": "Invalid legal guardian",
88
+ "message": "Legal guardian data is invalid or required."
89
+ },
90
+ "USER_LEGAL_DOCUMENTS_REQUIRED": {
91
+ "name": "Documents required",
92
+ "message": "Personal documents must be uploaded."
93
+ },
94
+ "USER_LEGAL_DOCUMENT_INVALID": {
95
+ "name": "Invalid document",
96
+ "message": "The provided document is not valid."
97
+ },
98
+ "USER_LEGAL_NAME_INVALID": {
99
+ "name": "Invalid name",
100
+ "message": "The provided name is not valid."
101
+ },
102
+ "USER_LEGAL_BORN_INVALID": {
103
+ "name": "Invalid birth date",
104
+ "message": "The provided birth date is not valid."
105
+ },
106
+ "USER_LEGAL_PHONE_INVALID": {
107
+ "name": "Invalid phone number",
108
+ "message": "The provided phone number is not valid."
109
+ },
110
+ "USER_LEGAL_ADDRESS_INVALID": {
111
+ "name": "Invalid address",
112
+ "message": "The address field \"{prop}\" is invalid."
113
+ },
114
+ "USER_LEGAL_RESPONSIBLE_DOCUMENTS_REQUIRED": {
115
+ "name": "Guardian documents required",
116
+ "message": "Legal guardian documents must be uploaded."
117
+ },
118
+ "USER_LEGAL_RESPONSIBLE_DOCUMENT_INVALID": {
119
+ "name": "Invalid guardian document",
120
+ "message": "The legal guardian document is not valid."
121
+ },
122
+ "USER_LEGAL_RESPONSIBLE_NAME_INVALID": {
123
+ "name": "Invalid guardian name",
124
+ "message": "The legal guardian name is not valid."
125
+ },
126
+ "USER_LEGAL_RESPONSIBLE_BORN_INVALID": {
127
+ "name": "Invalid guardian birth date",
128
+ "message": "The legal guardian birth date is not valid."
129
+ },
130
+ "USER_LEGAL_RESPONSIBLE_PHONE_INVALID": {
131
+ "name": "Invalid guardian phone number",
132
+ "message": "The legal guardian phone number is not valid."
133
+ },
134
+ "USER_LEGAL_RESPONSIBLE_ADDRESS_INVALID": {
135
+ "name": "Invalid guardian address",
136
+ "message": "The guardian address field \"{prop}\" is invalid."
137
+ },
82
138
  "INVALID_TOKEN_NAME": {
83
139
  "name": "Invalid Token Name",
84
140
  "message": "Must be a string between 1 and 50 characters"
@@ -75,6 +75,62 @@
75
75
  "name": "Usuário não encontrado",
76
76
  "message": "Tente novamente."
77
77
  },
78
+ "USER_LEGAL_DATA_ALREADY_EXISTS": {
79
+ "name": "Dados legais já existem",
80
+ "message": "Você já possui dados legais cadastrados."
81
+ },
82
+ "USER_LEGAL_RESPONSIBLE_INVALID": {
83
+ "name": "Responsável legal inválido",
84
+ "message": "Os dados do responsável legal são inválidos ou obrigatórios."
85
+ },
86
+ "USER_LEGAL_DOCUMENTS_REQUIRED": {
87
+ "name": "Documentos obrigatórios",
88
+ "message": "É necessário enviar os documentos pessoais."
89
+ },
90
+ "USER_LEGAL_DOCUMENT_INVALID": {
91
+ "name": "Documento inválido",
92
+ "message": "O documento informado não é válido."
93
+ },
94
+ "USER_LEGAL_NAME_INVALID": {
95
+ "name": "Nome inválido",
96
+ "message": "O nome informado não é válido."
97
+ },
98
+ "USER_LEGAL_BORN_INVALID": {
99
+ "name": "Data de nascimento inválida",
100
+ "message": "A data de nascimento informada não é válida."
101
+ },
102
+ "USER_LEGAL_PHONE_INVALID": {
103
+ "name": "Telefone inválido",
104
+ "message": "O telefone informado não é válido."
105
+ },
106
+ "USER_LEGAL_ADDRESS_INVALID": {
107
+ "name": "Endereço inválido",
108
+ "message": "O campo \"{prop}\" do endereço é inválido."
109
+ },
110
+ "USER_LEGAL_RESPONSIBLE_DOCUMENTS_REQUIRED": {
111
+ "name": "Documentos do responsável obrigatórios",
112
+ "message": "É necessário enviar os documentos do responsável legal."
113
+ },
114
+ "USER_LEGAL_RESPONSIBLE_DOCUMENT_INVALID": {
115
+ "name": "Documento do responsável inválido",
116
+ "message": "O documento do responsável legal não é válido."
117
+ },
118
+ "USER_LEGAL_RESPONSIBLE_NAME_INVALID": {
119
+ "name": "Nome do responsável inválido",
120
+ "message": "O nome do responsável legal não é válido."
121
+ },
122
+ "USER_LEGAL_RESPONSIBLE_BORN_INVALID": {
123
+ "name": "Data de nascimento do responsável inválida",
124
+ "message": "A data de nascimento do responsável legal não é válida."
125
+ },
126
+ "USER_LEGAL_RESPONSIBLE_PHONE_INVALID": {
127
+ "name": "Telefone do responsável inválido",
128
+ "message": "O telefone do responsável legal não é válido."
129
+ },
130
+ "USER_LEGAL_RESPONSIBLE_ADDRESS_INVALID": {
131
+ "name": "Endereço do responsável inválido",
132
+ "message": "O campo \"{prop}\" do endereço do responsável é inválido."
133
+ },
78
134
  "INVALID_TOKEN_NAME": {
79
135
  "name": "Nome de token inválido",
80
136
  "message": "Precisa ser uma string entre 1 e 50 caracteres"
package/types/errors.d.ts CHANGED
@@ -23,6 +23,24 @@ export interface APIErrors {
23
23
  'VERIFY_YOUR_EMAIL': {};
24
24
  'PLEASE_REVERIFY': {};
25
25
  'USER_NOT_FOUND': {};
26
+ 'USER_LEGAL_DATA_ALREADY_EXISTS': {};
27
+ 'USER_LEGAL_RESPONSIBLE_INVALID': {};
28
+ 'USER_LEGAL_DOCUMENTS_REQUIRED': {};
29
+ 'USER_LEGAL_DOCUMENT_INVALID': {};
30
+ 'USER_LEGAL_NAME_INVALID': {};
31
+ 'USER_LEGAL_BORN_INVALID': {};
32
+ 'USER_LEGAL_PHONE_INVALID': {};
33
+ 'USER_LEGAL_ADDRESS_INVALID': {
34
+ prop: InvalidAddressProps;
35
+ };
36
+ 'USER_LEGAL_RESPONSIBLE_DOCUMENTS_REQUIRED': {};
37
+ 'USER_LEGAL_RESPONSIBLE_DOCUMENT_INVALID': {};
38
+ 'USER_LEGAL_RESPONSIBLE_NAME_INVALID': {};
39
+ 'USER_LEGAL_RESPONSIBLE_BORN_INVALID': {};
40
+ 'USER_LEGAL_RESPONSIBLE_PHONE_INVALID': {};
41
+ 'USER_LEGAL_RESPONSIBLE_ADDRESS_INVALID': {
42
+ prop: InvalidAddressProps;
43
+ };
26
44
  'INVALID_TOKEN_NAME': {};
27
45
  'INVALID_TOKEN_EXPIRATION': {};
28
46
  'INVALID_TOKEN_PERMISSIONS': {};
@@ -176,6 +194,7 @@ export interface APIErrors {
176
194
  'YOU_REACHED_THE_PRODUCT_LIMIT_ON_PANEL': {};
177
195
  'STORE_ALREADY_CONFIGURED': {};
178
196
  }
197
+ type InvalidAddressProps = "cep" | "state" | "city" | "neighborhood" | "line1" | "line2" | "number";
179
198
  type ExpectedAdditionalData = {
180
199
  field: string;
181
200
  received: any;
@@ -10,7 +10,7 @@ export interface PartialProduct {
10
10
  export interface Product {
11
11
  id: number;
12
12
  name: string;
13
- created_at: string;
13
+ created_at: number;
14
14
  store_id: number;
15
15
  owner_id: number;
16
16
  icon_id?: string | null;
@@ -13,7 +13,7 @@ export type ProductStatistics = {
13
13
  };
14
14
  export type Statistics = Record<string, Record<number, ProductStatistics>>;
15
15
  export type StatisticsResponse = {
16
- last_update: string;
17
- created_at: string;
16
+ last_update: number;
17
+ created_at: number;
18
18
  statistics: Statistics;
19
19
  };
@@ -3,7 +3,7 @@ export type Addons = 'custom_bot' | 'divulgation' | 'antiraid' | 'managed_automo
3
3
  export interface PartialStore {
4
4
  id: number;
5
5
  name: string;
6
- expires_at: string;
6
+ expires_at: number;
7
7
  icon_id?: string | null;
8
8
  banner_id?: string | null;
9
9
  pending_setup?: boolean | null;
@@ -13,14 +13,14 @@ export type StoreModeratorPermissions = 'MANAGE_DISCORD_PANELS' | 'MANAGE_PRODUC
13
13
  export type StoreModerator = {
14
14
  username: string;
15
15
  discord_user_id: string | null;
16
- created_at: string;
16
+ created_at: number;
17
17
  permissions: StoreModeratorPermissions[];
18
18
  };
19
19
  export interface FullStore {
20
20
  id: number;
21
21
  name: string;
22
- created_at: string;
23
- expires_at: string;
22
+ created_at: number;
23
+ expires_at: number;
24
24
  owner_id: number;
25
25
  icon_id: string | null;
26
26
  banner_id: string | null;
@@ -47,7 +47,7 @@ export type StoreInvite = {
47
47
  };
48
48
  store: {
49
49
  name: string;
50
- created_at: string;
50
+ created_at: number;
51
51
  icon_id?: string | null;
52
52
  banner_id?: string | null;
53
53
  };
@@ -1,6 +1,6 @@
1
1
  export type BaseTransaction<TransactionMetadata = any> = {
2
2
  id: string;
3
- created_at: string;
3
+ created_at: number;
4
4
  entity: 'semiauto' | 'mercadopago';
5
5
  method: 'pix';
6
6
  managed?: boolean | null;
@@ -28,7 +28,7 @@ type SaleTransaction = {
28
28
  type: 'sale';
29
29
  order: DiscordOrder & {
30
30
  id: string;
31
- created_at: string;
31
+ created_at: number;
32
32
  discount: number;
33
33
  subtotal: number;
34
34
  total_value: number;
@@ -67,7 +67,7 @@ export type FullTransaction<TransactionMetadata = any> = BaseTransaction<Transac
67
67
  export type PartialTransaction = {
68
68
  id: string;
69
69
  base_value: number;
70
- created_at: string;
70
+ created_at: number;
71
71
  status: 'approved' | 'cancelled' | 'expired' | 'pending' | 'refused' | 'rejected' | 'analysis' | 'refunded' | 'refunded_partial';
72
72
  };
73
73
  export {};