@uappi/public-sdk 1.11.0 → 1.13.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.
@@ -0,0 +1,27 @@
1
+ import { usePublicApi } from '..';
2
+
3
+ import type {
4
+ ApiParams,
5
+ Product,
6
+ ProductFields,
7
+ ProductConditionFields,
8
+ ProductSortFields,
9
+ } from '../types';
10
+
11
+ export function getProductById(
12
+ productId: number,
13
+ options?: Pick<
14
+ ApiParams<ProductFields, ProductSortFields, ProductConditionFields>,
15
+ 'condition' | 'fields' | 'meta'
16
+ >,
17
+ ) {
18
+ return usePublicApi<
19
+ Product,
20
+ ProductFields,
21
+ ProductSortFields,
22
+ ProductConditionFields
23
+ >({
24
+ endpoint: `/publics/products/${productId}`,
25
+ params: options,
26
+ });
27
+ }
@@ -9,6 +9,7 @@ import type {
9
9
  ReviewConditionFields,
10
10
  ReviewFields,
11
11
  ReviewSortFields,
12
+ StoreReviewRequest,
12
13
  } from '../types';
13
14
 
14
15
  export function listProductReview(
@@ -65,6 +66,14 @@ export function listStoreReview() {
65
66
  });
66
67
  }
67
68
 
69
+ export function createStoreReview(payload: StoreReviewRequest) {
70
+ return usePublicApi<ProductReviewResponse>({
71
+ endpoint: '/review/sales-channel',
72
+ method: 'POST',
73
+ payload
74
+ });
75
+ }
76
+
68
77
  export function listCustomerReview(
69
78
  options?: Pick<
70
79
  ApiParams<ReviewFields, ReviewSortFields, ReviewConditionFields>,
@@ -63,6 +63,7 @@ import {
63
63
  createProductComment,
64
64
  listProductComments,
65
65
  } from './endpoints/ProductCommentComposable';
66
+ import { getProductById } from './endpoints/ProductComposable';
66
67
  import { listShipmentQuoteProduct } from './endpoints/ProductQuoteShipment';
67
68
  import {
68
69
  createProductReview,
@@ -70,6 +71,7 @@ import {
70
71
  listProductReview,
71
72
  listStoreReview,
72
73
  listCustomerReview,
74
+ createStoreReview
73
75
  } from './endpoints/ReviewComposable';
74
76
  import { getSearch } from './endpoints/SearchComposable';
75
77
  import { listShowcase } from './endpoints/ShowcaseComposable';
@@ -130,6 +132,7 @@ const customer = {
130
132
  listOrderItemHistory,
131
133
  listCustomerHistory,
132
134
  listCustomerReview,
135
+ createStoreReview,
133
136
  listWalletTransaction,
134
137
  claimGiftCard,
135
138
  updateDocument,
@@ -168,6 +171,7 @@ const product = {
168
171
  getUrl,
169
172
  getVerify,
170
173
  getSearch,
174
+ getProductById,
171
175
  listShipmentQuoteProduct,
172
176
  deleteProductComment,
173
177
  createProductComment,
@@ -36,6 +36,8 @@ export interface Product {
36
36
  medias: null | Array<Media>;
37
37
  originalPrice: null;
38
38
  parentProductId: null | number;
39
+ parentProduct: null | Product;
40
+ haveChildren: boolean;
39
41
  price: null | ProductPrice;
40
42
  priceRules: null;
41
43
  relatedProducts: null;
@@ -53,6 +55,7 @@ export interface Product {
53
55
 
54
56
  combination: Array<never>;
55
57
  createdAt: string;
58
+ deletedAt: null | string;
56
59
  isGiftCard: boolean;
57
60
 
58
61
 
@@ -58,3 +58,28 @@ export interface CreateProductReviewMediaResponse {
58
58
  mediaId: number;
59
59
  reviewId: number;
60
60
  }
61
+
62
+ export interface StoreReviewResponse {
63
+ salesChannelId: number;
64
+ customerId: number;
65
+ salesChannelDomain: string;
66
+
67
+ id: number;
68
+ name: string;
69
+ email: string;
70
+ comment: string;
71
+ recommended: boolean;
72
+ score: number;
73
+ active: boolean;
74
+ masked: boolean;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ }
78
+
79
+ export interface StoreReviewRequest {
80
+ name?: string;
81
+ email?: string;
82
+ comment: string;
83
+ recommended: boolean;
84
+ score: number;
85
+ }
@@ -202,6 +202,7 @@ import type {
202
202
  ProductReview,
203
203
  CreateProductReviewResponse,
204
204
  CreateProductReviewMediaResponse,
205
+ StoreReviewRequest
205
206
  } from './endpoints/review/review.interfaces';
206
207
  import type { Seal, SealSetting } from './endpoints/seal/seal.interfaces';
207
208
  import type { Seals } from './endpoints/seal/seal.types';
@@ -371,6 +372,7 @@ export type {
371
372
  ReviewConditionFields,
372
373
  ReviewSortFields,
373
374
  ReviewFields,
375
+ StoreReviewRequest,
374
376
 
375
377
  // Filtros de listagem
376
378
  TypeFilter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uappi/public-sdk",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Pacotes públicos para desenvolvimento do ecossistema Uappi",
5
5
  "main": "main.ts",
6
6
  "scripts": {