@zennify/sdk-js 1.0.0-beta.9 → 1.1.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/src/utils.ts CHANGED
@@ -1,31 +1,14 @@
1
1
  import { ZennifyAPIRequestError } from './RequestError';
2
2
  import { APIErrors } from './errors';
3
3
 
4
- type ExpectedErrorAdditional = { field: string; received: any; type: string }
5
- type ExpectedError = Extract<
6
- APIErrors,
7
- | 'EXPECTED_AN_OBJECT_ARRAY'
8
- | 'EXPECTED_A_STRING_ARRAY'
9
- | 'EXPECTED_A_NUMBER_ARRAY'
10
- | 'EXPECTED_AN_OBJECT'
11
- | 'EXPECTED_A_NON_EMPTY_OBJECT'
12
- | 'EXPECTED_A_STRING'
13
- | 'EXPECTED_A_NUMBER'
14
- | 'EXPECTED_A_VALID_ID'
15
- >;
16
-
17
- type CommonError = Exclude<APIErrors, ExpectedError>;
18
-
19
- export function GetResponseError(code: CommonError): { code: CommonError };
20
- export function GetResponseError(code: ExpectedError, additional: ExpectedErrorAdditional): { code: ExpectedError } & ExpectedErrorAdditional;
21
- export function GetResponseError<T extends object>(code: CommonError, additional?: T): { code: CommonError } & T;
22
- export function GetResponseError(code: APIErrors, additional: any = {}) {
23
- return { code, ...additional };
24
- }
4
+ export function GetResponseError<Code extends keyof APIErrors>(
5
+ code: Code,
6
+ additional: APIErrors[Code]
7
+ ) { return { code, ...additional }; }
25
8
 
26
9
  export async function TreatZennifyResponse<T extends any>(response: Response): Promise<T> {
27
10
 
28
- const body = await response.json();
11
+ const body = await response.json().catch(() => ({}));
29
12
 
30
13
  if (response.ok) {
31
14
  return body as T;
@@ -33,4 +16,4 @@ export async function TreatZennifyResponse<T extends any>(response: Response): P
33
16
 
34
17
  throw new ZennifyAPIRequestError(response, body);
35
18
 
36
- }
19
+ }
@@ -3,6 +3,10 @@
3
3
  "name": "An unknown error occurred.",
4
4
  "message": "Contact support with ID {id}"
5
5
  },
6
+ "MISSING_PERMISSIONS": {
7
+ "name": "You don't have permission to do this operation",
8
+ "message": "Verify your permissions"
9
+ },
6
10
  "UNKNOWN_TRANSLATION": {
7
11
  "name": "{code} not yet translated",
8
12
  "message": "Contact support."
@@ -43,6 +47,10 @@
43
47
  "name": "Expected a valid ID",
44
48
  "message": "IDs must be integers between 0 and 2.147.483.647"
45
49
  },
50
+ "STORE_ALREADY_CONFIGURED": {
51
+ "name": "This store is already configured",
52
+ "message": "Go back to dashboard and access the store again"
53
+ },
46
54
  "DUPLICATED_VALUES_ISNT_ALLOWED": {
47
55
  "name": "Duplicated values aren't allowed",
48
56
  "message": "Received \"{received}\", Check \"{field}\" field"
@@ -175,6 +183,30 @@
175
183
  "name": "You inserted an invalid additional",
176
184
  "message": "Remove the additional \"{addon}\"."
177
185
  },
186
+ "UNKNOWN_ORDER": {
187
+ "name": "Order not found.",
188
+ "message": "Check if the ID is correct."
189
+ },
190
+ "MP_ACCOUNT_OFFLINE": {
191
+ "name": "Unable to generate an order",
192
+ "message": "It appears that this Mercado Pago account is offline."
193
+ },
194
+ "MP_PIX_KEY_NOT_CONFIGURED": {
195
+ "name": "PIX key not configured",
196
+ "message": "The seller must configure a PIX key in Mercado Pago."
197
+ },
198
+ "MP_NOT_ALLOWED_TO_SELL": {
199
+ "name": "Not authorized by Mercado Pago to sell",
200
+ "message": "Please contact Mercado Pago support."
201
+ },
202
+ "INVALID_OPERATION_FOR_CURRENT_TRANSACTION_STATUS": {
203
+ "name": "Invalid operation for this transaction.",
204
+ "message": "The current status doesn't allow this operation."
205
+ },
206
+ "INVALID_OPERATION_FOR_PAYMENT_ENTITY": {
207
+ "name": "This payment entity doesn't support this operation",
208
+ "message": "Try using another payment entity or check the request"
209
+ },
178
210
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX": {
179
211
  "name": "This seller has not yet configured receipt via PIX",
180
212
  "message": "Choose another method or wait for seller configuration."
@@ -197,7 +229,7 @@
197
229
  },
198
230
  "THIS_COUPON_HAS_EXPIRED": {
199
231
  "name": "This coupon has expired",
200
- "message": "Use a valid coupon."
232
+ "message": "Try using another coupon."
201
233
  },
202
234
  "THIS_COUPON_REACHED_THE_USE_LIMIT": {
203
235
  "name": "This coupon reached the use limit",
@@ -223,6 +255,18 @@
223
255
  "name": "Invalid store name",
224
256
  "message": "The name must be up to 50 characters"
225
257
  },
258
+ "UNKNOWN_AUTOROLE_RULE": {
259
+ "name": "Unknown Discord autorole rule",
260
+ "message": "Try to create a new rule"
261
+ },
262
+ "AUTOROLE_RULE_ALREADY_EXISTS": {
263
+ "name": "An automatic role rule already exists for this role!",
264
+ "message": "Use the update route."
265
+ },
266
+ "YOU_REACHED_THE_AUTOROLE_RULE_LIMIT": {
267
+ "name": "You have reached the limit of automatic roles!",
268
+ "message": "Try deleting the ones you no longer use."
269
+ },
226
270
  "WAIT_OR_TRY_AGAIN_WITH_ANOTHER_DISCORD_BOT": {
227
271
  "name": "Wait or try again with another BOT",
228
272
  "message": "Your actions are being limited"
@@ -235,6 +279,14 @@
235
279
  "name": "Disable \"Require code grant\"",
236
280
  "message": "With it enabled, you won't be able to invite the bot."
237
281
  },
282
+ "UNKNOWN_DISCORD_CHANNEL": {
283
+ "name": "Unknown Discord channel",
284
+ "message": "Perhaps this channel no longer exists."
285
+ },
286
+ "INVALID_DISCORD_CHANNEL_FOR_MESSAGE": {
287
+ "name": "Invalid channel for messages",
288
+ "message": "The selected channel doesn't support messages"
289
+ },
238
290
  "UNKNOWN_PRODUCT": {
239
291
  "name": "Unknown product",
240
292
  "message": "Perhaps this product no longer exists."
@@ -271,6 +323,50 @@
271
323
  "name": "Invalid item cost",
272
324
  "message": "It must be between R$ 0.00 and R$ 999,999.00"
273
325
  },
326
+ "UNKNOWN_COUPON": {
327
+ "name": "Unknown coupon",
328
+ "message": "Perhaps this coupon no longer exists."
329
+ },
330
+ "INVALID_COUPON_NAME": {
331
+ "name": "Invalid coupon name",
332
+ "message": "Must consist only of letters and numbers"
333
+ },
334
+ "INVALID_COUPON_TYPE": {
335
+ "name": "Invalid coupon type",
336
+ "message": "Must be either 'value' or 'percentage'"
337
+ },
338
+ "INVALID_COUPON_VALUE": {
339
+ "name": "Invalid coupon value",
340
+ "message": "Must be between 0% and 100% for percentage and R$ 0.00 and R$ 999,999 for value"
341
+ },
342
+ "INVALID_COUPON_AMOUNT": {
343
+ "name": "Invalid coupon amount",
344
+ "message": "Must be a number between 0 and 32,768"
345
+ },
346
+ "INVALID_COUPON_MIN_VALUE": {
347
+ "name": "Invalid minimum coupon value",
348
+ "message": "Must be between R$ 0.00 and R$ 999,999.00"
349
+ },
350
+ "INVALID_COUPON_EXPIRATION": {
351
+ "name": "Invalid coupon expiration",
352
+ "message": "Must be a future date or 0 (Never expires)"
353
+ },
354
+ "INVALID_COUPON_MAX_USES_PER_USER": {
355
+ "name": "Invalid maximum uses per coupon",
356
+ "message": "Must be a number between 0 and 32,768"
357
+ },
358
+ "INVALID_COUPON_ONLY_FIRST_BUY": {
359
+ "name": "Invalid first purchase coupon setting",
360
+ "message": "Must be a boolean type (true or false)"
361
+ },
362
+ "YOU_REACHED_THE_COUPON_LIMIT": {
363
+ "name": "You have reached the coupon limit for this store",
364
+ "message": "Try deleting coupons you no longer use"
365
+ },
366
+ "COUPON_NAME_ALREADY_EXIST": {
367
+ "name": "You already have a coupon with this name",
368
+ "message": "Try setting a different name"
369
+ },
274
370
  "UNKNOWN_FILE": {
275
371
  "name": "Unknown file",
276
372
  "message": "Perhaps it has already been deleted"
@@ -3,6 +3,10 @@
3
3
  "name": "Um erro deconhecido ocorreu.",
4
4
  "message": "Contate o suporte com o ID {id}"
5
5
  },
6
+ "MISSING_PERMISSIONS": {
7
+ "name": "Você não tem permissão para realizar essa operação.",
8
+ "message": "Verifique as suas permissões."
9
+ },
6
10
  "UNKNOWN_TRANSLATION": {
7
11
  "name": "{code} não traduzido ainda",
8
12
  "message": "Entre em contato com o suporte."
@@ -175,41 +179,69 @@
175
179
  "name": "Adicional inválido",
176
180
  "message": "Remova o adicional \"{addon}\"."
177
181
  },
182
+ "UNKNOWN_ORDER": {
183
+ "name": "Pedido não encontrado.",
184
+ "message": "Verifique o ID enviado."
185
+ },
186
+ "MP_ACCOUNT_OFFLINE": {
187
+ "name": "Não foi possível gerar um pedido",
188
+ "message": "Aparentemente essa conta do Mercado Pago está inoperante."
189
+ },
190
+ "MP_PIX_KEY_NOT_CONFIGURED": {
191
+ "name": "Chave PIX não configurada",
192
+ "message": "O vendedor deve configurar uma chave pix no Mercado Pago."
193
+ },
194
+ "MP_NOT_ALLOWED_TO_SELL": {
195
+ "name": "Sem autorização do Mercado Pago para vender",
196
+ "message": "Entre em contato com o Mercado Pago."
197
+ },
198
+ "INVALID_OPERATION_FOR_CURRENT_TRANSACTION_STATUS": {
199
+ "name": "Operação inválida para essa transação.",
200
+ "message": "O estado atual não permite que a operação seja realizada."
201
+ },
202
+ "INVALID_OPERATION_FOR_PAYMENT_ENTITY": {
203
+ "name": "Essa entidade de pagamento não suporta essa operação",
204
+ "message": "Tente usando uma outra entidade de pagamento"
205
+ },
178
206
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX": {
179
- "name": "Pix não configurado",
207
+ "name": "O vendedor não configurou o recebimento via Pix",
180
208
  "message": "Escolha outro método ou aguarde a configuração do vendedor."
181
209
  },
182
210
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_BOLETO": {
183
- "name": "Boleto não configurado",
211
+ "name": "O vendedor não configurou o recebimento via Boleto",
184
212
  "message": "Escolha outro método ou aguarde a configuração do vendedor."
185
213
  },
186
214
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_CRYPTO": {
187
- "name": "Cripto não configurado",
215
+ "name": "O vendedor não configurou o recebimento via Cripto",
188
216
  "message": "Escolha outro método ou aguarde a configuração do vendedor."
189
217
  },
190
218
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_VISA": {
191
- "name": "Visa não configurado",
219
+ "name": "O vendedor não configurou o recebimento via Visa",
192
220
  "message": "Escolha outro método ou aguarde a configuração do vendedor."
193
221
  },
194
222
  "THIS_COUPON_DOES_NOT_EXISTS": {
195
- "name": "O cupom \"{name}\" não existe",
223
+ "name": "O cupom \"{received}\" não existe",
196
224
  "message": "Verifique o código do cupom."
197
225
  },
198
226
  "THIS_COUPON_HAS_EXPIRED": {
199
- "name": "Cupom expirado",
200
- "message": "Use um cupom válido."
227
+ "name": "O cupom inserido está expirado",
228
+ "message": "Tente usar outro cupom."
229
+ },
230
+ "STORE_ALREADY_CONFIGURED": {
231
+ "name": "Essa loja já foi configurada",
232
+ "message": "Volte para a dashboard e acesse a loja normalmente"
201
233
  },
202
234
  "THIS_COUPON_REACHED_THE_USE_LIMIT": {
203
235
  "name": "O cupom atingiu o limite de usos",
204
- "message": "Tente novamente depois."
236
+ "message": "Tente usar um cupom diferente."
205
237
  },
206
238
  "SELECT_MORE_ITENS_TO_REACH_MINIMUM_COUPON_VALUE": {
207
239
  "name": "Adicione mais itens pra atingir o valor mínimo do cupom",
208
- "message": "O valor mínimo para usar esse cupom é de {value}."
240
+ "message": "O valor mínimo para usar esse cupom é de {formated_value}."
209
241
  },
210
242
  "THIS_COUPON_IS_VALID_ONLY_FOR_THE_FIRST_BUY": {
211
243
  "name": "Cupom válido apenas para a primeira compra",
212
- "message": "Cupom válido apenas na primeira compra."
244
+ "message": "Tente usar um cupom diferente desse."
213
245
  },
214
246
  "UNKNOWN_STORE": {
215
247
  "name": "Loja desconhecida",
@@ -217,12 +249,24 @@
217
249
  },
218
250
  "UNKNOWN_BANK": {
219
251
  "name": "Banco não suportado",
220
- "message": "Ainda não suportamos o banco \"{bank}\""
252
+ "message": "Ainda não suportamos o banco \"{received}\""
221
253
  },
222
254
  "INVALID_STORE_NAME": {
223
255
  "name": "Nome de loja inválido",
224
256
  "message": "O nome deve ter até 50 caracteres"
225
257
  },
258
+ "UNKNOWN_AUTOROLE_RULE": {
259
+ "name": "Regra de cargo automático desconhecida",
260
+ "message": "Tente criar uma nova regra"
261
+ },
262
+ "AUTOROLE_RULE_ALREADY_EXISTS": {
263
+ "name": "Já existe uma regra de cargo automático pra esse cargo!",
264
+ "message": "Use a rota de alteração."
265
+ },
266
+ "YOU_REACHED_THE_AUTOROLE_RULE_LIMIT": {
267
+ "name": "Você já atingiu o limite de cargos automáticos!",
268
+ "message": "Tente apagar os que você não usa mais"
269
+ },
226
270
  "WAIT_OR_TRY_AGAIN_WITH_ANOTHER_DISCORD_BOT": {
227
271
  "name": "Aguarde ou tente novamente com outro BOT",
228
272
  "message": "Sua ações estão sendo limitadas"
@@ -235,6 +279,14 @@
235
279
  "name": "Desabilite o \"Require code grant\"",
236
280
  "message": "Com ele ativado você não conseguirá convidar o bot"
237
281
  },
282
+ "UNKNOWN_DISCORD_CHANNEL": {
283
+ "name": "Canal do Discord desconhecido",
284
+ "message": "Talvez esse canal não exista mais."
285
+ },
286
+ "INVALID_DISCORD_CHANNEL_FOR_MESSAGE": {
287
+ "name": "Canal inválido para envio",
288
+ "message": "O canal selecionado não suporta mensagens"
289
+ },
238
290
  "UNKNOWN_PRODUCT": {
239
291
  "name": "Produto desconhecido",
240
292
  "message": "Talvez esse produto não exista mais."
@@ -271,6 +323,50 @@
271
323
  "name": "O custo do item é inválido",
272
324
  "message": "Deve ser entre R$ 0.00 e R$ 999.999,00"
273
325
  },
326
+ "UNKNOWN_COUPON": {
327
+ "name": "Cupom desconhecido",
328
+ "message": "Talvez esse cupom não exista mais."
329
+ },
330
+ "INVALID_COUPON_NAME": {
331
+ "name": "Nome do cupom inválido",
332
+ "message": "Deve ser composto apenas de letras e números"
333
+ },
334
+ "INVALID_COUPON_TYPE": {
335
+ "name": "Tipo do cupom inválido",
336
+ "message": "Deve ser valor ou porcentagem"
337
+ },
338
+ "INVALID_COUPON_VALUE": {
339
+ "name": "Valor do cupom inválido",
340
+ "message": "Deve ser entre 0% e 100% pra porcentagem e R$ 0.00 e R$ 999.999 pra valor"
341
+ },
342
+ "INVALID_COUPON_AMOUNT": {
343
+ "name": "Quantidade de cupons inválida",
344
+ "message": "Deve ser um número entre 0 e 32768"
345
+ },
346
+ "INVALID_COUPON_MIN_VALUE": {
347
+ "name": "Valor mínimo do cupom inválido",
348
+ "message": "Deve ser entre R$ 0.00 e R$ 999.999,00"
349
+ },
350
+ "INVALID_COUPON_EXPIRATION": {
351
+ "name": "Expiração do cupom inválido",
352
+ "message": "Deve ser uma data futura ou 0 (Nunca expira)"
353
+ },
354
+ "INVALID_COUPON_MAX_USES_PER_USER": {
355
+ "name": "Uso máximo por cupom inválido",
356
+ "message": "Deve ser um número entre 0 e 32768"
357
+ },
358
+ "INVALID_COUPON_ONLY_FIRST_BUY": {
359
+ "name": "Configuração de primeira compra cupom inválida",
360
+ "message": "Deve ser um tipo booleano (verdadeiro ou falso)"
361
+ },
362
+ "YOU_REACHED_THE_COUPON_LIMIT": {
363
+ "name": "Você atingiu o limite de cupons nessa loja",
364
+ "message": "Tente apagar cupons que você não usa mais"
365
+ },
366
+ "COUPON_NAME_ALREADY_EXIST": {
367
+ "name": "Você já tem um cupom com esse nome",
368
+ "message": "Tente configurar um nome diferente"
369
+ },
274
370
  "UNKNOWN_FILE": {
275
371
  "name": "Imagem desconhecida",
276
372
  "message": "Talvez ela já tenha sido apagada"
@@ -329,7 +425,7 @@
329
425
  },
330
426
  "PANEL_NAME_ALREADY_EXIST": {
331
427
  "name": "Você já possui outro painel com este nome",
332
- "message": "Tente alterar o nome"
428
+ "message": "Tente alterar o nome do painel"
333
429
  },
334
430
  "YOU_REACHED_THE_PRODUCT_LIMIT_ON_PANEL": {
335
431
  "name": "Você atingiu o limite de produtos no painel",
@@ -1,6 +1,6 @@
1
1
  import { APIErrors } from './errors';
2
2
  type Body = Record<string, any> & {
3
- code: APIErrors;
3
+ code: keyof APIErrors;
4
4
  };
5
5
  export declare class ZennifyAPIRequestError extends Error {
6
6
  status: number;
package/types/errors.d.ts CHANGED
@@ -1 +1,142 @@
1
- export type APIErrors = 'UNKNOWN_ERROR' | 'UNKNOWN_TRANSLATION' | 'METHOD_NOT_ALLOWED' | 'EXPECTED_AN_OBJECT_ARRAY' | 'EXPECTED_A_STRING_ARRAY' | 'EXPECTED_A_NUMBER_ARRAY' | 'EXPECTED_AN_OBJECT' | 'EXPECTED_A_NON_EMPTY_OBJECT' | 'EXPECTED_A_STRING' | 'EXPECTED_A_NUMBER' | 'EXPECTED_A_VALID_ID' | 'DUPLICATED_VALUES_ISNT_ALLOWED' | 'GRANT_CODE_MISSING_IN_QUERY' | 'INVALID_SCOPE' | 'VERIFY_YOUR_EMAIL' | 'PLEASE_REVERIFY' | 'USER_NOT_FOUND' | 'INVALID_PASSWORD' | 'YOU_MUST_INSERT_THE_ACTUAL_PASSWORD' | 'THE_PASSWORD_DOES_NOT_MATCH' | 'THE_PASSWORD_MUST_HAVE_AT_LEAST_8_CHARACTERS' | 'THE_PASSWORD_MUST_HAVE_AT_LEAST_ONE_NUMBER' | 'THE_PASSWORD_MUST_HAVE_AT_LEAST_ONE_LETTER' | 'THE_PASSWORD_MUST_HAVE_AT_LEAST_ONE_SPECIAL_CHARACTER' | 'THE_EMAIL_SENDED_ISNT_VALID' | 'CELLPHONE_NUMBERS_MUST_HAVE_THE_9_DIGIT' | 'THE_CELLPHONE_NUMBER_MUST_HAVE_ONLY_DIGITS' | 'THE_PIX_KEY_INSERTED_ISNT_VALID' | 'INSERT_A_VALID_URL' | 'THE_ONLY_ACCEPTED_PROTOCOL_IS_HTTPS' | 'THIS_DOMAIN_IS_BLACKLISTED' | 'THE_URL_EXTENSION_ISNT_ACCEPTED_YET' | 'THE_URL_IS_INACCESSIBLE_BY_THE_WEBHOOK_SERVER' | 'THE_URL_WOULD_NOT_HAVE_REDIRECTS' | 'THE_URL_HAS_TIMEOUT_5S' | 'INVALID_PAYMENT_METHOD' | 'YOU_NEED_TO_INSERT_AT_LEAST_1_ITEM' | 'ONE_PROVIDED_PRODUCT_IS_OUT_OF_STOCK' | 'WE_DONT_HAVE_THIS_AMOUNT_IN_STOCK' | 'THIS_SELLER_WAS_BANNED_FROM_ZENNIFY' | 'WE_DO_NOT_YET_SUPPORT_MULTIPLE_USER_PRODUCTS' | 'WE_DO_NOT_YET_SUPPORT_MULTIPLE_STORE_PRODUCTS' | 'YOU_ALREADY_HAVE_ANOTHER_ORDER_WAITING_PAYMENT' | 'YOU_INSERTED_AN_INVALID_ADDITIONAL' | 'THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX' | 'THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_BOLETO' | 'THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_CRYPTO' | 'THIS_COUPON_DOES_NOT_EXISTS' | 'THIS_COUPON_HAS_EXPIRED' | 'THIS_COUPON_REACHED_THE_USE_LIMIT' | 'SELECT_MORE_ITENS_TO_REACH_MINIMUM_COUPON_VALUE' | 'THIS_COUPON_IS_VALID_ONLY_FOR_THE_FIRST_BUY' | 'UNKNOWN_STORE' | 'UNKNOWN_BANK' | 'INVALID_STORE_NAME' | 'WAIT_OR_TRY_AGAIN_WITH_ANOTHER_DISCORD_BOT' | 'INVALID_DISCORD_BOT_TOKEN' | 'DISABLE_REQUIRE_CODE_GRANT' | 'UNKNOWN_PRODUCT' | 'INVALID_PRODUCT_NAME' | 'INVALID_PRODUCT_VALUE' | 'YOU_REACHED_THE_PRODUCT_LIMIT' | 'PRODUCT_NAME_ALREADY_EXIST' | 'INVALID_PRODUCT_DESCRIPTION_FOR_DISCORD' | 'UNKNOWN_STOCK' | 'INVALID_STOCK_CONTENT' | 'INVALID_STOCK_COST' | 'UNKNOWN_FILE' | 'NO_FILES_FOUND' | 'INVALID_FILE_TYPE' | 'INVALID_FILE_NAME' | 'INVALID_FILE_SIZE' | 'YOU_REACHED_STORAGE_LIMIT' | 'YOU_REACHED_MEDIA_LIMIT' | 'YOU_ALREADY_HAVE_THIS_MEDIA' | 'MEDIA_NAME_ALREADY_EXIST' | 'UNKNOWN_PANEL' | 'INVALID_PANEL_NAME' | 'INVALID_PANEL_DESCRIPTION' | 'INVALID_PANEL_PLACEHOLDER' | 'YOU_REACHED_PANEL_LIMIT' | 'PANEL_NAME_ALREADY_EXIST' | 'YOU_REACHED_THE_PRODUCT_LIMIT_ON_PANEL';
1
+ export interface APIErrors {
2
+ 'UNKNOWN_ERROR': {
3
+ id: string | number;
4
+ };
5
+ 'UNKNOWN_TRANSLATION': {
6
+ code: keyof APIErrors | string;
7
+ };
8
+ 'INVALID_DISCORD_CHANNEL_FOR_MESSAGE': {};
9
+ 'MISSING_PERMISSIONS': {};
10
+ 'METHOD_NOT_ALLOWED': {};
11
+ 'EXPECTED_AN_OBJECT_ARRAY': ExpectedAdditionalData;
12
+ 'EXPECTED_A_STRING_ARRAY': ExpectedAdditionalData;
13
+ 'EXPECTED_A_NUMBER_ARRAY': ExpectedAdditionalData;
14
+ 'EXPECTED_AN_OBJECT': ExpectedAdditionalData;
15
+ 'EXPECTED_A_NON_EMPTY_OBJECT': ExpectedAdditionalData;
16
+ 'EXPECTED_A_STRING': ExpectedAdditionalData;
17
+ 'EXPECTED_A_NUMBER': ExpectedAdditionalData;
18
+ 'EXPECTED_A_VALID_ID': ExpectedAdditionalData;
19
+ 'DUPLICATED_VALUES_ISNT_ALLOWED': {};
20
+ 'GRANT_CODE_MISSING_IN_QUERY': {};
21
+ 'INVALID_SCOPE': {};
22
+ 'VERIFY_YOUR_EMAIL': {};
23
+ 'PLEASE_REVERIFY': {};
24
+ 'USER_NOT_FOUND': {};
25
+ 'INVALID_PASSWORD': {};
26
+ 'YOU_MUST_INSERT_THE_ACTUAL_PASSWORD': {};
27
+ 'THE_PASSWORD_DOES_NOT_MATCH': {};
28
+ 'THE_PASSWORD_MUST_HAVE_AT_LEAST_8_CHARACTERS': {};
29
+ 'THE_PASSWORD_MUST_HAVE_AT_LEAST_ONE_NUMBER': {};
30
+ 'THE_PASSWORD_MUST_HAVE_AT_LEAST_ONE_LETTER': {};
31
+ 'THE_PASSWORD_MUST_HAVE_AT_LEAST_ONE_SPECIAL_CHARACTER': {};
32
+ 'THE_EMAIL_SENDED_ISNT_VALID': {};
33
+ 'CELLPHONE_NUMBERS_MUST_HAVE_THE_9_DIGIT': {};
34
+ 'THE_CELLPHONE_NUMBER_MUST_HAVE_ONLY_DIGITS': {};
35
+ 'THE_PIX_KEY_INSERTED_ISNT_VALID': {};
36
+ 'INSERT_A_VALID_URL': {};
37
+ 'THE_ONLY_ACCEPTED_PROTOCOL_IS_HTTPS': {};
38
+ 'THIS_DOMAIN_IS_BLACKLISTED': {};
39
+ 'THE_URL_EXTENSION_ISNT_ACCEPTED_YET': {};
40
+ 'THE_URL_IS_INACCESSIBLE_BY_THE_WEBHOOK_SERVER': {};
41
+ 'THE_URL_WOULD_NOT_HAVE_REDIRECTS': {};
42
+ 'THE_URL_HAS_TIMEOUT_5S': {};
43
+ 'INVALID_PAYMENT_METHOD': {};
44
+ 'YOU_NEED_TO_INSERT_AT_LEAST_1_ITEM': {};
45
+ 'ONE_PROVIDED_PRODUCT_IS_OUT_OF_STOCK': {
46
+ name: string;
47
+ };
48
+ 'WE_DONT_HAVE_THIS_AMOUNT_IN_STOCK': {
49
+ name: string;
50
+ received: string | number;
51
+ available: string | number;
52
+ };
53
+ 'THIS_SELLER_WAS_BANNED_FROM_ZENNIFY': {};
54
+ 'WE_DO_NOT_YET_SUPPORT_MULTIPLE_USER_PRODUCTS': {
55
+ name: string;
56
+ id: string | number;
57
+ };
58
+ 'WE_DO_NOT_YET_SUPPORT_MULTIPLE_STORE_PRODUCTS': {
59
+ name: string;
60
+ id: string | number;
61
+ };
62
+ 'YOU_ALREADY_HAVE_ANOTHER_ORDER_WAITING_PAYMENT': {
63
+ id: string | number;
64
+ };
65
+ 'YOU_INSERTED_AN_INVALID_ADDITIONAL': {
66
+ addon: string;
67
+ };
68
+ 'UNKNOWN_ORDER': {};
69
+ 'INVALID_OPERATION_FOR_CURRENT_TRANSACTION_STATUS': {};
70
+ 'INVALID_OPERATION_FOR_PAYMENT_ENTITY': {};
71
+ 'THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX': {};
72
+ 'THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_BOLETO': {};
73
+ 'THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_CRYPTO': {};
74
+ 'THIS_COUPON_DOES_NOT_EXISTS': {
75
+ received: string;
76
+ };
77
+ 'THIS_COUPON_HAS_EXPIRED': {};
78
+ 'THIS_COUPON_REACHED_THE_USE_LIMIT': {};
79
+ 'SELECT_MORE_ITENS_TO_REACH_MINIMUM_COUPON_VALUE': {
80
+ formated_value: string;
81
+ value: number;
82
+ };
83
+ 'THIS_COUPON_IS_VALID_ONLY_FOR_THE_FIRST_BUY': {};
84
+ 'UNKNOWN_STORE': {};
85
+ 'UNKNOWN_BANK': {
86
+ received: string;
87
+ };
88
+ 'INVALID_STORE_NAME': {};
89
+ 'UNKNOWN_AUTOROLE_RULE': {};
90
+ 'AUTOROLE_RULE_ALREADY_EXISTS': {};
91
+ 'YOU_REACHED_THE_AUTOROLE_RULE_LIMIT': {};
92
+ 'WAIT_OR_TRY_AGAIN_WITH_ANOTHER_DISCORD_BOT': {};
93
+ 'INVALID_DISCORD_BOT_TOKEN': {};
94
+ 'DISABLE_REQUIRE_CODE_GRANT': {};
95
+ 'UNKNOWN_DISCORD_CHANNEL': {};
96
+ 'UNKNOWN_PRODUCT': {};
97
+ 'INVALID_PRODUCT_NAME': {};
98
+ 'INVALID_PRODUCT_VALUE': {};
99
+ 'YOU_REACHED_THE_PRODUCT_LIMIT': {};
100
+ 'PRODUCT_NAME_ALREADY_EXIST': {};
101
+ 'INVALID_PRODUCT_DESCRIPTION_FOR_DISCORD': {};
102
+ 'UNKNOWN_STOCK': {};
103
+ 'INVALID_STOCK_CONTENT': {};
104
+ 'INVALID_STOCK_COST': {};
105
+ 'UNKNOWN_COUPON': {};
106
+ 'INVALID_COUPON_NAME': {};
107
+ 'INVALID_COUPON_TYPE': {};
108
+ 'INVALID_COUPON_VALUE': {};
109
+ 'INVALID_COUPON_AMOUNT': {};
110
+ 'INVALID_COUPON_MIN_VALUE': {};
111
+ 'INVALID_COUPON_EXPIRATION': {};
112
+ 'INVALID_COUPON_MAX_USES_PER_USER': {};
113
+ 'INVALID_COUPON_ONLY_FIRST_BUY': {};
114
+ 'YOU_REACHED_THE_COUPON_LIMIT': {};
115
+ 'COUPON_NAME_ALREADY_EXIST': {};
116
+ 'UNKNOWN_FILE': {};
117
+ 'NO_FILES_FOUND': {};
118
+ 'INVALID_FILE_TYPE': {};
119
+ 'INVALID_FILE_NAME': {};
120
+ 'INVALID_FILE_SIZE': {};
121
+ 'YOU_REACHED_STORAGE_LIMIT': {};
122
+ 'YOU_REACHED_MEDIA_LIMIT': {};
123
+ 'YOU_ALREADY_HAVE_THIS_MEDIA': {};
124
+ 'MEDIA_NAME_ALREADY_EXIST': {};
125
+ 'UNKNOWN_PANEL': {};
126
+ 'INVALID_PANEL_NAME': {};
127
+ 'INVALID_PANEL_DESCRIPTION': {};
128
+ 'INVALID_PANEL_PLACEHOLDER': {};
129
+ 'YOU_REACHED_PANEL_LIMIT': {};
130
+ 'PANEL_NAME_ALREADY_EXIST': {};
131
+ 'YOU_REACHED_THE_PRODUCT_LIMIT_ON_PANEL': {};
132
+ 'STORE_ALREADY_CONFIGURED': {};
133
+ 'MP_ACCOUNT_OFFLINE': {};
134
+ 'MP_PIX_KEY_NOT_CONFIGURED': {};
135
+ 'MP_NOT_ALLOWED_TO_SELL': {};
136
+ }
137
+ type ExpectedAdditionalData = {
138
+ field: string;
139
+ received: any;
140
+ type: string;
141
+ };
142
+ export {};
@@ -0,0 +1,9 @@
1
+ interface ImageSources {
2
+ void: void;
3
+ null: null;
4
+ empty: string;
5
+ product_icon: string;
6
+ general: string;
7
+ }
8
+ export declare function GetImageURL<Source extends keyof ImageSources>(source: Source, store_id?: number | null, id?: number | null): ImageSources[Source] | string;
9
+ export {};
@@ -0,0 +1,19 @@
1
+ import { type ChannelType } from 'discord.js';
2
+ export interface DiscordGuildChannel {
3
+ id: string;
4
+ name: string;
5
+ type: ChannelType;
6
+ }
7
+ export interface DiscordGuildRole {
8
+ id: string;
9
+ name: string;
10
+ position: number;
11
+ color: number;
12
+ }
13
+ export interface DiscordGuild {
14
+ id: string;
15
+ name: string;
16
+ icon_url: string;
17
+ owner_id: string;
18
+ channels: DiscordGuildChannel[];
19
+ }
@@ -0,0 +1,6 @@
1
+ export interface Medium {
2
+ id: number;
3
+ name: string;
4
+ size: number;
5
+ mime_type: string;
6
+ }
@@ -0,0 +1,14 @@
1
+ export interface PanelProduct {
2
+ id: number;
3
+ position: number;
4
+ emoji: string;
5
+ }
6
+ export interface Panel {
7
+ id: number;
8
+ name: string;
9
+ placeholder: string;
10
+ description: string | null;
11
+ icon_id: number | null;
12
+ banner_id: number | null;
13
+ products: PanelProduct[];
14
+ }
@@ -0,0 +1,28 @@
1
+ export interface PartialProduct {
2
+ id: number;
3
+ name: string;
4
+ value: number;
5
+ icon_id: number | null;
6
+ banner_id: number | null;
7
+ stock_locked: boolean | null;
8
+ stock_count: number;
9
+ }
10
+ export interface Product {
11
+ id: number;
12
+ name: string;
13
+ created_at: string;
14
+ store_id: number;
15
+ owner_id: number;
16
+ icon_id?: null | number;
17
+ banner_id?: null | number;
18
+ value: number;
19
+ description: {
20
+ short: null | string;
21
+ discord: null | string;
22
+ website: null | string;
23
+ };
24
+ stock: {
25
+ size: number;
26
+ locked: boolean;
27
+ };
28
+ }
@@ -0,0 +1,12 @@
1
+ export type Statistic = {
2
+ count: number;
3
+ users: number;
4
+ value: number;
5
+ rating: number;
6
+ };
7
+ export type Statistics = Record<string, Record<number, Statistic>>;
8
+ export type StatisticsResponse = {
9
+ last_update: string;
10
+ created_at: string;
11
+ statistics: Statistics;
12
+ };
@@ -0,0 +1,29 @@
1
+ import { DiscordGuild } from "./Guild";
2
+ export type Addons = 'custom_bot' | 'divulgation' | 'antiraid' | 'managed_automod';
3
+ export type Banks = 'Banco Inter S.A.' | 'Nu Pagamentos S.A.' | 'Picpay Serviços S.A.' | 'Mercadopago.com Representações Ltda.' | 'Caixa Econômica Federal' | 'PagSeguro Internet S.A.' | 'Banco do Brasil S.A.' | 'Banco Bradesco S.A.' | 'Banco Santander (Brasil) S.A.';
4
+ export interface PartialStore {
5
+ id: number;
6
+ name: string;
7
+ expires_at: string;
8
+ icon_id?: number | null;
9
+ pending_setup?: boolean | null;
10
+ }
11
+ export interface FullStore {
12
+ id: number;
13
+ name: string;
14
+ created_at: string;
15
+ expires_at: string;
16
+ owner_id: number;
17
+ icon_id: number | null;
18
+ banner_id: number | null;
19
+ addons: Addons[];
20
+ blocked_banks: Banks[];
21
+ pending_setup?: boolean | null;
22
+ discord_channels: Record<string /** guild id */, Record<'sale' | 'voice' | 'feedback' | 'carts', string | null | void /** channel id */>>;
23
+ discord_bot: {
24
+ id: string;
25
+ app_id: string | null;
26
+ token: string | null;
27
+ };
28
+ discord_bot_guilds: Record<string, DiscordGuild>;
29
+ }