@uappi/public-sdk 1.0.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/.editorconfig +6 -0
- package/.vscode/extensions.json +5 -0
- package/.vscode/settings.json +7 -0
- package/components/Animations/ExpandTransition.ts +89 -0
- package/components/Animations/index.ts +1 -0
- package/components/Themes/CustomTheme.ts +77 -0
- package/components/Themes/index.ts +1 -0
- package/main.ts +16 -0
- package/modules/Api/README.md +469 -0
- package/modules/Api/endpoints/BannerComposable.ts +31 -0
- package/modules/Api/endpoints/BrandComposable.ts +21 -0
- package/modules/Api/endpoints/CartComposable.ts +121 -0
- package/modules/Api/endpoints/CommonComposable.ts +24 -0
- package/modules/Api/endpoints/CouponComposable.ts +18 -0
- package/modules/Api/endpoints/CustomerComposable.ts +255 -0
- package/modules/Api/endpoints/InterestComposable.ts +11 -0
- package/modules/Api/endpoints/LoggoutComposable.ts +8 -0
- package/modules/Api/endpoints/MenuComposable.ts +25 -0
- package/modules/Api/endpoints/PairOfferComposable.ts +14 -0
- package/modules/Api/endpoints/PaymentComposable.ts +14 -0
- package/modules/Api/endpoints/ProductCommentComposable.ts +51 -0
- package/modules/Api/endpoints/ProductQuoteShipment.ts +20 -0
- package/modules/Api/endpoints/PublicComposable.ts +9 -0
- package/modules/Api/endpoints/ReviewComposable.ts +64 -0
- package/modules/Api/endpoints/SearchComposable.ts +27 -0
- package/modules/Api/endpoints/ShowcaseComposable.ts +45 -0
- package/modules/Api/endpoints/TemplateComposable.ts +8 -0
- package/modules/Api/endpoints/ThirdPartyComposable.ts +14 -0
- package/modules/Api/endpoints/UpsellComposable.ts +18 -0
- package/modules/Api/endpoints/UrlComposable.ts +26 -0
- package/modules/Api/endpoints/VariationComposable.ts +36 -0
- package/modules/Api/endpoints/WalletComposable.ts +36 -0
- package/modules/Api/endpoints/ZipcodeComposable.ts +10 -0
- package/modules/Api/index.ts +194 -0
- package/modules/Api/paramsSerializer/encodeWafNormalizer.ts +7 -0
- package/modules/Api/types/context/api-config.types.ts +68 -0
- package/modules/Api/types/context/api-params.types.ts +74 -0
- package/modules/Api/types/endpoints/attribute/attribute.interfaces.ts +42 -0
- package/modules/Api/types/endpoints/banner/banner.interfaces.ts +45 -0
- package/modules/Api/types/endpoints/brand/brand-field.types.ts +3 -0
- package/modules/Api/types/endpoints/brand/brand.interfaces.ts +23 -0
- package/modules/Api/types/endpoints/cart/cart.interfaces.ts +161 -0
- package/modules/Api/types/endpoints/cart/cart.types.ts +27 -0
- package/modules/Api/types/endpoints/common/common.interfaces.ts +21 -0
- package/modules/Api/types/endpoints/context/context.types.ts +1 -0
- package/modules/Api/types/endpoints/country/country.types.ts +7502 -0
- package/modules/Api/types/endpoints/coupon/coupon.interfaces.ts +13 -0
- package/modules/Api/types/endpoints/customer/customer-erros.ts +13 -0
- package/modules/Api/types/endpoints/customer/customer-obsearch.ts +103 -0
- package/modules/Api/types/endpoints/customer/customer.interfaces.ts +448 -0
- package/modules/Api/types/endpoints/customer/customer.types.ts +3 -0
- package/modules/Api/types/endpoints/description/description.interfaces.ts +30 -0
- package/modules/Api/types/endpoints/discounts/discounts.interfaces.ts +9 -0
- package/modules/Api/types/endpoints/discounts/discounts.types.ts +5 -0
- package/modules/Api/types/endpoints/filters/filter.type.ts +1 -0
- package/modules/Api/types/endpoints/filters/filters.interfaces.ts +26 -0
- package/modules/Api/types/endpoints/interest/interest.interfaces.ts +22 -0
- package/modules/Api/types/endpoints/media/media.interfaces.ts +13 -0
- package/modules/Api/types/endpoints/menu/menu.enums.ts +8 -0
- package/modules/Api/types/endpoints/menu/menu.interfaces.ts +26 -0
- package/modules/Api/types/endpoints/order/order.interfaces.ts +63 -0
- package/modules/Api/types/endpoints/page/page.interfaces.ts +15 -0
- package/modules/Api/types/endpoints/pagination/pagination.interfaces.ts +6 -0
- package/modules/Api/types/endpoints/pair-offer/pair-offer.interfaces.ts +19 -0
- package/modules/Api/types/endpoints/payment/payment.interfaces.ts +103 -0
- package/modules/Api/types/endpoints/payment/payment.types.ts +27 -0
- package/modules/Api/types/endpoints/price/price.interfaces.ts +22 -0
- package/modules/Api/types/endpoints/product/product-obsearch.types.ts +63 -0
- package/modules/Api/types/endpoints/product/product.interfaces.ts +109 -0
- package/modules/Api/types/endpoints/product/product.types.ts +3 -0
- package/modules/Api/types/endpoints/product-comment/product-comment-obsearch.types.ts +24 -0
- package/modules/Api/types/endpoints/product-comment/product-comment.interfaces.ts +32 -0
- package/modules/Api/types/endpoints/redirect/redirect.interfaces.ts +7 -0
- package/modules/Api/types/endpoints/review/review-obsearch.types.ts +18 -0
- package/modules/Api/types/endpoints/review/review.interfaces.ts +34 -0
- package/modules/Api/types/endpoints/seal/seal.interfaces.ts +21 -0
- package/modules/Api/types/endpoints/seal/seal.types.ts +3 -0
- package/modules/Api/types/endpoints/search/search.interfaces.ts +11 -0
- package/modules/Api/types/endpoints/seo/seo.interfaces.ts +11 -0
- package/modules/Api/types/endpoints/shipment/shipment.interfaces.ts +137 -0
- package/modules/Api/types/endpoints/showcase/showcase.enums.ts +8 -0
- package/modules/Api/types/endpoints/showcase/showcase.interfaces.ts +10 -0
- package/modules/Api/types/endpoints/simple-product/simple-product.interfaces.ts +15 -0
- package/modules/Api/types/endpoints/storage/storage.interfaces.ts +16 -0
- package/modules/Api/types/endpoints/template/template.interfaces.ts +30 -0
- package/modules/Api/types/endpoints/third-party/oauth.interfaces.ts +6 -0
- package/modules/Api/types/endpoints/upsell/upsell.interfaces.ts +13 -0
- package/modules/Api/types/endpoints/url/url.interfaces.ts +85 -0
- package/modules/Api/types/endpoints/wallet/wallet-obsearch.ts +8 -0
- package/modules/Api/types/endpoints/wallet/wallet.interfaces.ts +57 -0
- package/modules/Api/types/endpoints/zipcode/zipcode.interfaces.ts +23 -0
- package/modules/Api/types/index.ts +459 -0
- package/modules/Api/usePublicApi.ts +68 -0
- package/modules/Tracking/endpoints/BannerComposable.ts +33 -0
- package/modules/Tracking/endpoints/CartComposable.ts +75 -0
- package/modules/Tracking/endpoints/CustomerComposable.ts +68 -0
- package/modules/Tracking/endpoints/ProductQuoteShipment.ts +14 -0
- package/modules/Tracking/endpoints/SearchComposable.ts +32 -0
- package/modules/Tracking/endpoints/ShowcaseComposable.ts +54 -0
- package/modules/Tracking/endpoints/UrlComposable.ts +41 -0
- package/modules/Tracking/endpoints/types.ts +11 -0
- package/modules/Tracking/events/actions/addPaymentInfo.ts +31 -0
- package/modules/Tracking/events/actions/addShippingInfo.ts +27 -0
- package/modules/Tracking/events/actions/addToCart.ts +35 -0
- package/modules/Tracking/events/actions/beginCheckout.ts +28 -0
- package/modules/Tracking/events/actions/customerProfile.ts +36 -0
- package/modules/Tracking/events/actions/generateLead.ts +12 -0
- package/modules/Tracking/events/actions/login.ts +8 -0
- package/modules/Tracking/events/actions/purchase.ts +42 -0
- package/modules/Tracking/events/actions/removeFromCart.ts +52 -0
- package/modules/Tracking/events/actions/search.ts +8 -0
- package/modules/Tracking/events/actions/selectItem.ts +64 -0
- package/modules/Tracking/events/actions/selectPromotion.ts +24 -0
- package/modules/Tracking/events/actions/shippingCalculation.ts +7 -0
- package/modules/Tracking/events/actions/signup.ts +8 -0
- package/modules/Tracking/events/actions/upsertToCart.ts +62 -0
- package/modules/Tracking/events/views/viewCart.ts +28 -0
- package/modules/Tracking/events/views/viewHome.ts +5 -0
- package/modules/Tracking/events/views/viewItem.ts +31 -0
- package/modules/Tracking/events/views/viewItemList.ts +65 -0
- package/modules/Tracking/events/views/viewNotFound.ts +5 -0
- package/modules/Tracking/events/views/viewOther.ts +5 -0
- package/modules/Tracking/events/views/viewPayment.ts +7 -0
- package/modules/Tracking/events/views/viewPromotion.ts +28 -0
- package/modules/Tracking/events/views/viewShipping.ts +7 -0
- package/modules/Tracking/index.ts +84 -0
- package/modules/Tracking/publicApiTracking.ts +36 -0
- package/modules/Tracking/types/actions/add-payment-info.interfaces.ts +12 -0
- package/modules/Tracking/types/actions/add-shipping-info.interfaces.ts +11 -0
- package/modules/Tracking/types/actions/add-to-cart.interfaces.ts +10 -0
- package/modules/Tracking/types/actions/begin-checkout.interfaces.ts +12 -0
- package/modules/Tracking/types/actions/customer-profile.interfaces.ts +19 -0
- package/modules/Tracking/types/actions/file-download.interfaces.ts +4 -0
- package/modules/Tracking/types/actions/generate-lead.interfaces.ts +12 -0
- package/modules/Tracking/types/actions/login.interfaces.ts +4 -0
- package/modules/Tracking/types/actions/purchase.interfaces.ts +18 -0
- package/modules/Tracking/types/actions/remove-from-cart.interfaces.ts +10 -0
- package/modules/Tracking/types/actions/search.interfaces.ts +4 -0
- package/modules/Tracking/types/actions/select-item.interfaces.ts +16 -0
- package/modules/Tracking/types/actions/select-promotion.interfaces.ts +8 -0
- package/modules/Tracking/types/actions/share.interfaces.ts +4 -0
- package/modules/Tracking/types/actions/shipping-calculation.interfaces.ts +3 -0
- package/modules/Tracking/types/actions/signup.interfaces.ts +4 -0
- package/modules/Tracking/types/event.types.ts +54 -0
- package/modules/Tracking/types/index.ts +37 -0
- package/modules/Tracking/types/item.interfaces.ts +30 -0
- package/modules/Tracking/types/views/view-cart.interfaces.ts +11 -0
- package/modules/Tracking/types/views/view-home.interfaces.ts +3 -0
- package/modules/Tracking/types/views/view-item-list.interfaces.ts +11 -0
- package/modules/Tracking/types/views/view-item.interfaces.ts +15 -0
- package/modules/Tracking/types/views/view-not-found.interfaces.ts +3 -0
- package/modules/Tracking/types/views/view-other.interfaces.ts +3 -0
- package/modules/Tracking/types/views/view-payment.interfaces.ts +3 -0
- package/modules/Tracking/types/views/view-promotion.interfaces.ts +8 -0
- package/modules/Tracking/types/views/view-shipping.interfaces.ts +3 -0
- package/modules/Tracking/utils/cart.ts +100 -0
- package/modules/Tracking/utils/pushDatalayer.ts +7 -0
- package/package.json +27 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type { Banners } from '../types';
|
|
4
|
+
|
|
5
|
+
export function listBanners<AdditionalParameters = []>(
|
|
6
|
+
codes: string,
|
|
7
|
+
): Promise<Banners<AdditionalParameters>>;
|
|
8
|
+
|
|
9
|
+
export function listBanners<AdditionalParameters = []>(
|
|
10
|
+
codes: Array<string>,
|
|
11
|
+
): Promise<Array<Banners<AdditionalParameters>>>;
|
|
12
|
+
|
|
13
|
+
export function listBanners<AdditionalParameters = []>(
|
|
14
|
+
codes: Array<string> | string,
|
|
15
|
+
) {
|
|
16
|
+
if (Array.isArray(codes)) {
|
|
17
|
+
return usePublicApi<Array<Banners<AdditionalParameters>>>({
|
|
18
|
+
endpoint: '/publics/template/banners/',
|
|
19
|
+
params: {
|
|
20
|
+
codes
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return usePublicApi<Array<Banners<AdditionalParameters>>>({
|
|
26
|
+
endpoint: '/publics/template/banners/',
|
|
27
|
+
params: {
|
|
28
|
+
codes: [codes]
|
|
29
|
+
}
|
|
30
|
+
}).then(data => data[0]);
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
Brand,
|
|
5
|
+
ApiParams,
|
|
6
|
+
BrandFields,
|
|
7
|
+
BrandConditions,
|
|
8
|
+
BrandOrders,
|
|
9
|
+
} from '../types';
|
|
10
|
+
|
|
11
|
+
export function listBrands(
|
|
12
|
+
options?: Pick<
|
|
13
|
+
ApiParams<BrandFields, BrandOrders, BrandConditions>,
|
|
14
|
+
'condition' | 'fields' | 'offset' | 'limit' | 'order'
|
|
15
|
+
>,
|
|
16
|
+
) {
|
|
17
|
+
return usePublicApi<Brand, BrandFields, BrandOrders, BrandConditions>({
|
|
18
|
+
endpoint: '/publics/products/brands',
|
|
19
|
+
params: options,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
CartResponse,
|
|
5
|
+
DeleteCartRequest,
|
|
6
|
+
UpsertCartRequest,
|
|
7
|
+
ShipmentQuoteCartRequest,
|
|
8
|
+
SelectShipimentRequest,
|
|
9
|
+
AddressesToCartRequest,
|
|
10
|
+
PaymentResponse,
|
|
11
|
+
BuyCartRequest,
|
|
12
|
+
BuyCartResponse,
|
|
13
|
+
} from '../types';
|
|
14
|
+
|
|
15
|
+
export function listDetail() {
|
|
16
|
+
const response = usePublicApi<CartResponse>({
|
|
17
|
+
endpoint: '/cart',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return response;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function addProduct(payload: UpsertCartRequest) {
|
|
24
|
+
return usePublicApi<CartResponse>({
|
|
25
|
+
endpoint: '/cart',
|
|
26
|
+
method: 'POST',
|
|
27
|
+
payload,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function upsertProduct(payload: UpsertCartRequest) {
|
|
32
|
+
return usePublicApi<CartResponse>({
|
|
33
|
+
endpoint: '/cart',
|
|
34
|
+
method: 'PUT',
|
|
35
|
+
payload,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function deleteProduct(payload: DeleteCartRequest) {
|
|
40
|
+
return usePublicApi<CartResponse>({
|
|
41
|
+
endpoint: '/cart',
|
|
42
|
+
method: 'DELETE',
|
|
43
|
+
payload,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function shipmentQuote(payload: ShipmentQuoteCartRequest) {
|
|
48
|
+
return usePublicApi<CartResponse, ShipmentQuoteCartRequest>({
|
|
49
|
+
endpoint: '/cart/quote',
|
|
50
|
+
method: 'POST',
|
|
51
|
+
payload,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function selectShipment(payload: SelectShipimentRequest) {
|
|
56
|
+
return usePublicApi<CartResponse>({
|
|
57
|
+
endpoint: '/cart/shipping',
|
|
58
|
+
method: 'PUT',
|
|
59
|
+
payload,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function applyAddresses(payload: AddressesToCartRequest) {
|
|
64
|
+
return usePublicApi<CartResponse>({
|
|
65
|
+
endpoint: '/cart/address',
|
|
66
|
+
method: 'PUT',
|
|
67
|
+
payload,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function applyWallet() {
|
|
72
|
+
return usePublicApi<CartResponse>({
|
|
73
|
+
endpoint: '/cart/promotionals/customer-wallet',
|
|
74
|
+
method: 'POST',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function deleteWallet() {
|
|
79
|
+
return usePublicApi<CartResponse>({
|
|
80
|
+
endpoint: '/cart/promotionals/customer-wallet',
|
|
81
|
+
method: 'DELETE',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function applyPoint() {
|
|
86
|
+
return usePublicApi<CartResponse>({
|
|
87
|
+
endpoint: '/cart/promotionals/point-system',
|
|
88
|
+
method: 'POST',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function deletePoint() {
|
|
93
|
+
return usePublicApi<CartResponse>({
|
|
94
|
+
endpoint: '/cart/promotionals/point-system',
|
|
95
|
+
method: 'DELETE',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function listPayments() {
|
|
100
|
+
return usePublicApi<PaymentResponse>({
|
|
101
|
+
endpoint: '/cart/payments',
|
|
102
|
+
method: 'GET',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function buy(payload: BuyCartRequest) {
|
|
107
|
+
return usePublicApi<BuyCartResponse>({
|
|
108
|
+
endpoint: '/cart/buy',
|
|
109
|
+
method: 'POST',
|
|
110
|
+
payload,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
export function recovery(recoveryCode: string) {
|
|
116
|
+
const response = usePublicApi<CartResponse>({
|
|
117
|
+
endpoint: `/cart/recovery/${recoveryCode}`,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
return response;
|
|
121
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type { CardFlags, CountryAlpha3, CountryResponse } from '../types';
|
|
4
|
+
|
|
5
|
+
export function listContries() {
|
|
6
|
+
return usePublicApi<Array<CountryResponse>>({
|
|
7
|
+
method: 'GET',
|
|
8
|
+
endpoint: '/common/countries',
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function countryDetail(code: CountryAlpha3) {
|
|
13
|
+
return usePublicApi<CountryResponse>({
|
|
14
|
+
method: 'GET',
|
|
15
|
+
endpoint: `/common/country/${code}`,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function listCardFlags() {
|
|
20
|
+
return usePublicApi<CardFlags>({
|
|
21
|
+
method: 'GET',
|
|
22
|
+
endpoint: '/publics/payments/card-flags',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type { AddCouponRequest, CartResponse } from '../types';
|
|
4
|
+
|
|
5
|
+
export function addCoupon(payload: AddCouponRequest) {
|
|
6
|
+
return usePublicApi<CartResponse>({
|
|
7
|
+
endpoint: '/cart/promotionals/coupon',
|
|
8
|
+
method: 'PUT',
|
|
9
|
+
payload,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function deleteCoupon() {
|
|
14
|
+
return usePublicApi<CartResponse>({
|
|
15
|
+
endpoint: '/cart/promotionals/coupon',
|
|
16
|
+
method: 'DELETE',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ApiParams,
|
|
5
|
+
CustomerResponse,
|
|
6
|
+
SignupCustomer,
|
|
7
|
+
SigninCustomerByDocument,
|
|
8
|
+
SigninCustomerByEmail,
|
|
9
|
+
ResponseSigninCustomer,
|
|
10
|
+
CheckCustomer,
|
|
11
|
+
ChangePasswordCustomerAuthenticated,
|
|
12
|
+
UpdateCustomer,
|
|
13
|
+
PasswordRecoveryCustomer,
|
|
14
|
+
CustomerFields,
|
|
15
|
+
CustomerSortFields,
|
|
16
|
+
CustomerConditionFields,
|
|
17
|
+
ChangePasswordCustomerByCode,
|
|
18
|
+
UpsertCustomerAddressRequest,
|
|
19
|
+
CustomerAddressResponse,
|
|
20
|
+
CustomerAddressesResponse,
|
|
21
|
+
CustomerOrderResponse,
|
|
22
|
+
CustomerOrderGroupFields,
|
|
23
|
+
CustomerOrderGroupConditionFields,
|
|
24
|
+
CustomerOrderGroupSortFields,
|
|
25
|
+
CustomerOrderItemHistoriesResponse,
|
|
26
|
+
CustomerOrdersResponse,
|
|
27
|
+
CustomerOrderItemHistorySortFields,
|
|
28
|
+
CustomerOrderItemHistoryConditionFields,
|
|
29
|
+
CustomerHistoryResponse,
|
|
30
|
+
CustomerHistorySortFields,
|
|
31
|
+
CustomerHistoryConditionFields,
|
|
32
|
+
AddCustomerToNewsletterRequest,
|
|
33
|
+
AddCustomerToNewsletterResponse,
|
|
34
|
+
CheckCustomerResponse,
|
|
35
|
+
UpdateCustomerDocument,
|
|
36
|
+
UpdateCustomerDocumentResponse,
|
|
37
|
+
} from '../types';
|
|
38
|
+
|
|
39
|
+
export function detail(
|
|
40
|
+
options?: Pick<
|
|
41
|
+
ApiParams<CustomerFields, CustomerSortFields, CustomerConditionFields>,
|
|
42
|
+
'condition' | 'fields' | 'order'
|
|
43
|
+
>,
|
|
44
|
+
) {
|
|
45
|
+
return usePublicApi<
|
|
46
|
+
CustomerResponse,
|
|
47
|
+
CustomerFields,
|
|
48
|
+
CustomerSortFields,
|
|
49
|
+
CustomerConditionFields
|
|
50
|
+
>({ endpoint: '/customer', params: options });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function signup(payload: SignupCustomer) {
|
|
54
|
+
return usePublicApi<CustomerResponse>({
|
|
55
|
+
endpoint: '/customer',
|
|
56
|
+
method: 'POST',
|
|
57
|
+
payload,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function signinByEmail(payload: SigninCustomerByEmail) {
|
|
62
|
+
return usePublicApi<ResponseSigninCustomer>({
|
|
63
|
+
endpoint: '/customer/login/email',
|
|
64
|
+
method: 'POST',
|
|
65
|
+
payload,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function signinByDocument(payload: SigninCustomerByDocument) {
|
|
70
|
+
return usePublicApi<ResponseSigninCustomer>({
|
|
71
|
+
endpoint: '/customer/login/document',
|
|
72
|
+
method: 'POST',
|
|
73
|
+
payload,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function check(payload: CheckCustomer) {
|
|
78
|
+
return usePublicApi<CheckCustomerResponse>({
|
|
79
|
+
endpoint: '/customer/login/check',
|
|
80
|
+
method: 'POST',
|
|
81
|
+
payload,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function update(payload: UpdateCustomer) {
|
|
86
|
+
return usePublicApi<CustomerResponse>({
|
|
87
|
+
endpoint: '/customer',
|
|
88
|
+
method: 'PUT',
|
|
89
|
+
payload,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function updateDocument(payload: UpdateCustomerDocument) {
|
|
94
|
+
return usePublicApi<UpdateCustomerDocumentResponse>({
|
|
95
|
+
endpoint: '/customer/document',
|
|
96
|
+
method: 'PUT',
|
|
97
|
+
payload,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function changePasswordByAuthenticated(
|
|
102
|
+
payload: ChangePasswordCustomerAuthenticated,
|
|
103
|
+
) {
|
|
104
|
+
return usePublicApi<boolean>({
|
|
105
|
+
endpoint: '/customer/password',
|
|
106
|
+
method: 'PUT',
|
|
107
|
+
payload,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function passwordRecovery(payload: PasswordRecoveryCustomer) {
|
|
112
|
+
return usePublicApi<boolean>({
|
|
113
|
+
endpoint: '/customer/password-recovery',
|
|
114
|
+
method: 'POST',
|
|
115
|
+
payload,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// TODO validar retorno
|
|
120
|
+
export function changePasswordByCode(payload: ChangePasswordCustomerByCode) {
|
|
121
|
+
return usePublicApi<boolean>({
|
|
122
|
+
endpoint: '/customer/password-recovery',
|
|
123
|
+
method: 'PUT',
|
|
124
|
+
payload,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function createAddress(payload: UpsertCustomerAddressRequest) {
|
|
129
|
+
return usePublicApi<CustomerAddressResponse>({
|
|
130
|
+
method: 'POST',
|
|
131
|
+
endpoint: '/customer/address',
|
|
132
|
+
payload,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function updateAddress(
|
|
137
|
+
addressId: number,
|
|
138
|
+
payload: UpsertCustomerAddressRequest,
|
|
139
|
+
) {
|
|
140
|
+
return usePublicApi<CustomerAddressResponse>({
|
|
141
|
+
method: 'PUT',
|
|
142
|
+
endpoint: `/customer/address/${addressId}`,
|
|
143
|
+
payload,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function updatePrimaryAddress(addressId: number) {
|
|
148
|
+
return usePublicApi<CustomerAddressResponse>({
|
|
149
|
+
method: 'PUT',
|
|
150
|
+
endpoint: `/customer/address/main/${addressId}`,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function deleteAddress(addressId: number) {
|
|
155
|
+
return usePublicApi<CustomerAddressResponse>({
|
|
156
|
+
method: 'DELETE',
|
|
157
|
+
endpoint: `/customer/address/${addressId}`,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function listAddress() {
|
|
162
|
+
return usePublicApi<CustomerAddressesResponse>({
|
|
163
|
+
method: 'GET',
|
|
164
|
+
endpoint: '/customer/address',
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function detailOrderGroup(
|
|
169
|
+
orderId: number,
|
|
170
|
+
options?: Pick<ApiParams<CustomerOrderGroupFields>, 'fields'>,
|
|
171
|
+
) {
|
|
172
|
+
return usePublicApi<CustomerOrderResponse, CustomerOrderGroupFields>({
|
|
173
|
+
method: 'GET',
|
|
174
|
+
endpoint: `/customer/orders/groups/${orderId}`,
|
|
175
|
+
params: options,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function listOrderGroups(
|
|
180
|
+
options?: Pick<
|
|
181
|
+
ApiParams<
|
|
182
|
+
CustomerOrderGroupFields,
|
|
183
|
+
CustomerOrderGroupSortFields,
|
|
184
|
+
CustomerOrderGroupConditionFields
|
|
185
|
+
>,
|
|
186
|
+
'condition' | 'fields' | 'limit' | 'offset' | 'order'
|
|
187
|
+
>,
|
|
188
|
+
) {
|
|
189
|
+
return usePublicApi<
|
|
190
|
+
CustomerOrdersResponse,
|
|
191
|
+
CustomerOrderGroupFields,
|
|
192
|
+
CustomerOrderGroupSortFields,
|
|
193
|
+
CustomerOrderGroupConditionFields
|
|
194
|
+
>({
|
|
195
|
+
method: 'GET',
|
|
196
|
+
endpoint: '/customer/orders/groups',
|
|
197
|
+
params: options,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function listOrderItemHistory(
|
|
202
|
+
orderId: number,
|
|
203
|
+
options?: Pick<
|
|
204
|
+
ApiParams<
|
|
205
|
+
'',
|
|
206
|
+
CustomerOrderItemHistorySortFields,
|
|
207
|
+
CustomerOrderItemHistoryConditionFields
|
|
208
|
+
>,
|
|
209
|
+
'condition' | 'fields' | 'limit' | 'offset' | 'order'
|
|
210
|
+
>,
|
|
211
|
+
) {
|
|
212
|
+
return usePublicApi<
|
|
213
|
+
CustomerOrderItemHistoriesResponse,
|
|
214
|
+
'',
|
|
215
|
+
CustomerOrderItemHistorySortFields,
|
|
216
|
+
CustomerOrderItemHistoryConditionFields
|
|
217
|
+
>({
|
|
218
|
+
method: 'GET',
|
|
219
|
+
endpoint: `/customer/orders/${orderId}/history`,
|
|
220
|
+
params: options,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function addNewsletter(payload: AddCustomerToNewsletterRequest) {
|
|
225
|
+
return usePublicApi<AddCustomerToNewsletterResponse>({
|
|
226
|
+
method: 'POST',
|
|
227
|
+
endpoint: '/customer/newsletter',
|
|
228
|
+
payload,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function deleteNewsletter() {
|
|
233
|
+
return usePublicApi<CustomerOrderResponse, CustomerOrderGroupFields>({
|
|
234
|
+
method: 'DELETE',
|
|
235
|
+
endpoint: '/customer/newsletter',
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function listCustomerHistory(
|
|
240
|
+
options?: Pick<
|
|
241
|
+
ApiParams<'', CustomerHistorySortFields, CustomerHistoryConditionFields>,
|
|
242
|
+
'condition' | 'limit' | 'offset' | 'order'
|
|
243
|
+
>,
|
|
244
|
+
) {
|
|
245
|
+
return usePublicApi<
|
|
246
|
+
CustomerHistoryResponse,
|
|
247
|
+
'',
|
|
248
|
+
CustomerHistorySortFields,
|
|
249
|
+
CustomerHistoryConditionFields
|
|
250
|
+
>({
|
|
251
|
+
endpoint: '/customer/history',
|
|
252
|
+
method: 'GET',
|
|
253
|
+
params: options,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type { RequestInterest, ResponseInterest } from '../types';
|
|
4
|
+
|
|
5
|
+
export function createInterest(payload: RequestInterest) {
|
|
6
|
+
return usePublicApi<ResponseInterest, RequestInterest>({
|
|
7
|
+
endpoint: '/publics/products/interests',
|
|
8
|
+
method: 'POST',
|
|
9
|
+
payload,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type { Menu } from '../types';
|
|
4
|
+
|
|
5
|
+
export function listMenu(codes: string): Promise<Menu>;
|
|
6
|
+
|
|
7
|
+
export function listMenu(codes: Array<string>): Promise<Array<Menu>>;
|
|
8
|
+
|
|
9
|
+
export function listMenu(codes: Array<string> | string) {
|
|
10
|
+
if (Array.isArray(codes)) {
|
|
11
|
+
return usePublicApi<Array<Menu>>({
|
|
12
|
+
endpoint: '/publics/template/menus/',
|
|
13
|
+
params: {
|
|
14
|
+
codes,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return usePublicApi<Array<Menu>>({
|
|
20
|
+
endpoint: '/publics/template/menus/',
|
|
21
|
+
params: {
|
|
22
|
+
codes: [codes],
|
|
23
|
+
},
|
|
24
|
+
}).then(data => data[0]);
|
|
25
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type { ApiParams, ProductFields, PairOfferResponse } from '../types';
|
|
4
|
+
|
|
5
|
+
export function listPairOffers(
|
|
6
|
+
productId: number,
|
|
7
|
+
options?: Pick<ApiParams<ProductFields>, 'fields' | 'variationMap'>,
|
|
8
|
+
) {
|
|
9
|
+
return usePublicApi<PairOfferResponse, ProductFields>({
|
|
10
|
+
endpoint: `/publics/products/${productId}/pair-offers`,
|
|
11
|
+
method: 'GET',
|
|
12
|
+
params: options,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
PaymentConditionsRequest,
|
|
5
|
+
PaymentConditionsResponse,
|
|
6
|
+
} from '../types';
|
|
7
|
+
|
|
8
|
+
export function paymentConditions(payload: PaymentConditionsRequest) {
|
|
9
|
+
return usePublicApi<PaymentConditionsResponse>({
|
|
10
|
+
endpoint: '/publics/payments/conditions',
|
|
11
|
+
method: 'POST',
|
|
12
|
+
payload,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ApiParams,
|
|
5
|
+
ProductComment,
|
|
6
|
+
CreateProductComment,
|
|
7
|
+
ProductCommentConditionFields,
|
|
8
|
+
ProductCommentFields,
|
|
9
|
+
ProductCommentSortFields,
|
|
10
|
+
ProductCommentsResponse,
|
|
11
|
+
} from '../types';
|
|
12
|
+
|
|
13
|
+
export function listProductComments(
|
|
14
|
+
options?: Pick<
|
|
15
|
+
ApiParams<
|
|
16
|
+
ProductCommentFields,
|
|
17
|
+
ProductCommentSortFields,
|
|
18
|
+
ProductCommentConditionFields
|
|
19
|
+
>,
|
|
20
|
+
'condition' | 'order' | 'limit' | 'offset' | 'fields'
|
|
21
|
+
>,
|
|
22
|
+
) {
|
|
23
|
+
return usePublicApi<
|
|
24
|
+
ProductCommentsResponse,
|
|
25
|
+
ProductCommentFields,
|
|
26
|
+
ProductCommentSortFields,
|
|
27
|
+
ProductCommentConditionFields
|
|
28
|
+
>({
|
|
29
|
+
endpoint: '/publics/products/comments',
|
|
30
|
+
method: 'GET',
|
|
31
|
+
params: options,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function createProductComment(
|
|
36
|
+
productId: number,
|
|
37
|
+
payload: CreateProductComment,
|
|
38
|
+
) {
|
|
39
|
+
return usePublicApi<ProductComment, CreateProductComment>({
|
|
40
|
+
endpoint: `/publics/products/${productId}/comments`,
|
|
41
|
+
method: 'POST',
|
|
42
|
+
payload,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function deleteProductComment(commentId: number) {
|
|
47
|
+
return usePublicApi<boolean>({
|
|
48
|
+
endpoint: `/publics/products/comments/${commentId}`,
|
|
49
|
+
method: 'DELETE',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ApiParams,
|
|
5
|
+
ShipmentQuoteProductRequest,
|
|
6
|
+
ShipmentQuoteProductResponse,
|
|
7
|
+
} from '../types';
|
|
8
|
+
|
|
9
|
+
export async function listShipmentQuoteProduct(
|
|
10
|
+
payload: Pick<ApiParams, 'targetCountryCode' | 'targetZipCode' | 'items'>,
|
|
11
|
+
) {
|
|
12
|
+
return usePublicApi<
|
|
13
|
+
ShipmentQuoteProductResponse,
|
|
14
|
+
ShipmentQuoteProductRequest
|
|
15
|
+
>({
|
|
16
|
+
endpoint: '/publics/products/quote',
|
|
17
|
+
method: 'GET',
|
|
18
|
+
params: payload,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { usePublicApi } from '..';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ApiParams,
|
|
5
|
+
ProductReviewRequest,
|
|
6
|
+
ProductReviewResponse,
|
|
7
|
+
ReviewConditionFields,
|
|
8
|
+
ReviewFields,
|
|
9
|
+
ReviewSortFields,
|
|
10
|
+
} from '../types';
|
|
11
|
+
|
|
12
|
+
export function listProductReview(
|
|
13
|
+
options?: Pick<
|
|
14
|
+
ApiParams<ReviewFields, ReviewSortFields, ReviewConditionFields>,
|
|
15
|
+
'condition' | 'order' | 'fields' | 'limit' | 'offset'
|
|
16
|
+
>,
|
|
17
|
+
) {
|
|
18
|
+
return usePublicApi<
|
|
19
|
+
ProductReviewResponse,
|
|
20
|
+
ReviewFields,
|
|
21
|
+
ReviewSortFields,
|
|
22
|
+
ReviewConditionFields
|
|
23
|
+
>({
|
|
24
|
+
endpoint: '/review/product',
|
|
25
|
+
method: 'GET',
|
|
26
|
+
params: options,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function createProductReview(
|
|
31
|
+
productId: number,
|
|
32
|
+
payload: ProductReviewRequest,
|
|
33
|
+
) {
|
|
34
|
+
return usePublicApi<ProductReviewRequest>({
|
|
35
|
+
endpoint: `/review/product/${productId}`,
|
|
36
|
+
method: 'POST',
|
|
37
|
+
payload,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function listStoreReview() {
|
|
42
|
+
return usePublicApi<ProductReviewResponse>({
|
|
43
|
+
endpoint: '/review/sales-channel',
|
|
44
|
+
method: 'GET',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function listCustomerReview(
|
|
49
|
+
options?: Pick<
|
|
50
|
+
ApiParams<ReviewFields, ReviewSortFields, ReviewConditionFields>,
|
|
51
|
+
'condition' | 'order' | 'fields' | 'limit' | 'offset'
|
|
52
|
+
>,
|
|
53
|
+
) {
|
|
54
|
+
return usePublicApi<
|
|
55
|
+
ProductReviewResponse,
|
|
56
|
+
ReviewFields,
|
|
57
|
+
ReviewSortFields,
|
|
58
|
+
ReviewConditionFields
|
|
59
|
+
>({
|
|
60
|
+
endpoint: '/review/product/customer',
|
|
61
|
+
method: 'GET',
|
|
62
|
+
params: options,
|
|
63
|
+
});
|
|
64
|
+
}
|