@uappi/public-sdk 1.2.10 → 1.3.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/modules/Api/README.md
CHANGED
|
@@ -77,6 +77,8 @@ O pacote expõe os seguintes escopos, cada um agrupando recursos relacionados:
|
|
|
77
77
|
- deleteProductComment: Remove um comentário no produto
|
|
78
78
|
- createProductComment: Adiciona um comentário no produto
|
|
79
79
|
- listProductComments: Lista comentários de produto
|
|
80
|
+
- getCategoryTree: Retorna a árvore de uma categoria (atual, filhas, irmãs e pai)
|
|
81
|
+
- listCategoriesTree: Retorna a árvore completa de categorias ativas
|
|
80
82
|
|
|
81
83
|
- [**promotional**](#promotional): Ofertas, cupons, carteiras e pontos promocionais.
|
|
82
84
|
- listPairOffers: Lista ofertas em pares de um produto (compre junto)
|
|
@@ -422,6 +424,14 @@ await api.product.listProductComments(
|
|
|
422
424
|
'condition' | 'order' | 'limit' | 'offset' | 'fields'
|
|
423
425
|
>
|
|
424
426
|
): ProductCommentsResponse;
|
|
427
|
+
|
|
428
|
+
// Retorna a árvore de uma categoria: categoria atual, filhas, irmãs e pai.
|
|
429
|
+
await api.product.getCategoryTree(
|
|
430
|
+
categoryId: number
|
|
431
|
+
): CategoryTree;
|
|
432
|
+
|
|
433
|
+
// Retorna a árvore completa de categorias ativas, com todos os níveis aninhados.
|
|
434
|
+
await api.product.listCategoriesTree(): Array<CategoryTreeItem>;
|
|
425
435
|
```
|
|
426
436
|
|
|
427
437
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type { CategoryTree, CategoryTreeItem } from '../types';
|
|
4
|
+
|
|
5
|
+
export function getCategoryTree(categoryId: number) {
|
|
6
|
+
return usePublicApi<CategoryTree>({
|
|
7
|
+
endpoint: `/publics/products/categories/${categoryId}/tree`,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function listCategoriesTree() {
|
|
12
|
+
return usePublicApi<Array<CategoryTreeItem>>({
|
|
13
|
+
endpoint: '/publics/products/categories/tree',
|
|
14
|
+
});
|
|
15
|
+
}
|
package/modules/Api/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { listBanners } from './endpoints/BannerComposable';
|
|
2
2
|
import { listBrands } from './endpoints/BrandComposable';
|
|
3
|
+
import { getCategoryTree, listCategoriesTree } from './endpoints/CategoryComposable';
|
|
3
4
|
import {
|
|
4
5
|
addProduct,
|
|
5
6
|
deleteProduct,
|
|
@@ -168,6 +169,8 @@ const product = {
|
|
|
168
169
|
deleteProductComment,
|
|
169
170
|
createProductComment,
|
|
170
171
|
listProductComments,
|
|
172
|
+
getCategoryTree,
|
|
173
|
+
listCategoriesTree,
|
|
171
174
|
};
|
|
172
175
|
|
|
173
176
|
const common = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface CategoryTreeNode {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface CategoryTree {
|
|
8
|
+
current: CategoryTreeNode;
|
|
9
|
+
children: Array<CategoryTreeNode>;
|
|
10
|
+
sisters: Array<CategoryTreeNode>;
|
|
11
|
+
parent: Array<CategoryTreeNode>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface CategoryTreeItem extends CategoryTreeNode {
|
|
15
|
+
children: Array<CategoryTreeItem>;
|
|
16
|
+
}
|
|
@@ -45,6 +45,11 @@ import type {
|
|
|
45
45
|
AddressToCartType,
|
|
46
46
|
CartErrorCode,
|
|
47
47
|
} from './endpoints/cart/cart.types';
|
|
48
|
+
import type {
|
|
49
|
+
CategoryTree,
|
|
50
|
+
CategoryTreeItem,
|
|
51
|
+
CategoryTreeNode,
|
|
52
|
+
} from './endpoints/category/category.interfaces';
|
|
48
53
|
import type { CountryResponse } from './endpoints/common/common.interfaces';
|
|
49
54
|
import type { ContextType } from './endpoints/context/context.types';
|
|
50
55
|
import type {
|
|
@@ -314,6 +319,11 @@ export type {
|
|
|
314
319
|
BrandConditions,
|
|
315
320
|
BrandOrders,
|
|
316
321
|
|
|
322
|
+
// Categorias
|
|
323
|
+
CategoryTree,
|
|
324
|
+
CategoryTreeItem,
|
|
325
|
+
CategoryTreeNode,
|
|
326
|
+
|
|
317
327
|
// Pagination
|
|
318
328
|
Pagination,
|
|
319
329
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uappi/public-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Pacotes públicos para desenvolvimento do ecossistema Uappi",
|
|
5
5
|
"main": "main.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
"type-check": "tsc --noEmit",
|
|
9
9
|
"prepush": "npm run lint && npm run type-check",
|
|
10
10
|
"prepublishOnly": "npm run lint && npm run type-check",
|
|
11
|
-
"prepare": "husky"
|
|
12
|
-
"publish": "npm publish --access public"
|
|
11
|
+
"prepare": "husky"
|
|
13
12
|
},
|
|
14
13
|
"repository": {
|
|
15
14
|
"type": "git",
|