@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,459 @@
|
|
|
1
|
+
// Response de API
|
|
2
|
+
import type {
|
|
3
|
+
ApiResponse,
|
|
4
|
+
ApiStatus,
|
|
5
|
+
ApiMethod,
|
|
6
|
+
ApiContext,
|
|
7
|
+
ApiError,
|
|
8
|
+
ApiErrorData,
|
|
9
|
+
} from './context/api-config.types';
|
|
10
|
+
import type {
|
|
11
|
+
ApiParams,
|
|
12
|
+
ApiParamsCondition,
|
|
13
|
+
ApiParamsConditionGroup,
|
|
14
|
+
ApiParamsMeta,
|
|
15
|
+
ApiParamsOrder,
|
|
16
|
+
} from './context/api-params.types';
|
|
17
|
+
import type {
|
|
18
|
+
Attribute,
|
|
19
|
+
AttributeValue,
|
|
20
|
+
Combination,
|
|
21
|
+
ValueList,
|
|
22
|
+
Variations,
|
|
23
|
+
CurrentAttribute,
|
|
24
|
+
} from './endpoints/attribute/attribute.interfaces';
|
|
25
|
+
import type { Banner, Banners } from './endpoints/banner/banner.interfaces';
|
|
26
|
+
import type {
|
|
27
|
+
BrandFields,
|
|
28
|
+
BrandConditions,
|
|
29
|
+
BrandOrders,
|
|
30
|
+
} from './endpoints/brand/brand-field.types';
|
|
31
|
+
import type { Brand, BrandItem } from './endpoints/brand/brand.interfaces';
|
|
32
|
+
import type {
|
|
33
|
+
CartCustomer,
|
|
34
|
+
CartResponse,
|
|
35
|
+
DeleteCartRequest,
|
|
36
|
+
UpsertCartRequest,
|
|
37
|
+
UpsertCartItem,
|
|
38
|
+
AddressToCartRequest,
|
|
39
|
+
AddressesToCartRequest,
|
|
40
|
+
AddressToCartResponse,
|
|
41
|
+
BuyCartRequest,
|
|
42
|
+
BuyCartResponse,
|
|
43
|
+
} from './endpoints/cart/cart.interfaces';
|
|
44
|
+
import type {
|
|
45
|
+
AddressToCartType,
|
|
46
|
+
CartErrorCode,
|
|
47
|
+
} from './endpoints/cart/cart.types';
|
|
48
|
+
import type { CountryResponse } from './endpoints/common/common.interfaces';
|
|
49
|
+
import type { ContextType } from './endpoints/context/context.types';
|
|
50
|
+
import type {
|
|
51
|
+
CountryAlpha2,
|
|
52
|
+
CountryAlpha3,
|
|
53
|
+
CountryName,
|
|
54
|
+
CountryPhoneCode,
|
|
55
|
+
StateCode,
|
|
56
|
+
StateName,
|
|
57
|
+
} from './endpoints/country/country.types';
|
|
58
|
+
import type {
|
|
59
|
+
AddCouponRequest,
|
|
60
|
+
Coupon,
|
|
61
|
+
} from './endpoints/coupon/coupon.interfaces';
|
|
62
|
+
import type { CustomerErrorCode } from './endpoints/customer/customer-erros';
|
|
63
|
+
import type {
|
|
64
|
+
CustomerConditionFields,
|
|
65
|
+
CustomerFields,
|
|
66
|
+
CustomerSortFields,
|
|
67
|
+
CustomerOrderGroupConditionFields,
|
|
68
|
+
CustomerOrderGroupFields,
|
|
69
|
+
CustomerOrderGroupSortFields,
|
|
70
|
+
CustomerOrderItemHistoryConditionFields,
|
|
71
|
+
CustomerOrderItemHistorySortFields,
|
|
72
|
+
CustomerHistoryConditionFields,
|
|
73
|
+
CustomerHistorySortFields,
|
|
74
|
+
} from './endpoints/customer/customer-obsearch';
|
|
75
|
+
import type {
|
|
76
|
+
UpdateCustomer,
|
|
77
|
+
ChangePasswordCustomerAuthenticated,
|
|
78
|
+
ChangePasswordCustomerByCode,
|
|
79
|
+
CheckCustomer,
|
|
80
|
+
CheckCustomerResponse,
|
|
81
|
+
PasswordRecoveryCustomer,
|
|
82
|
+
CustomerResponse,
|
|
83
|
+
SigninCustomerByDocument,
|
|
84
|
+
SigninCustomerByEmail,
|
|
85
|
+
SignupCustomer,
|
|
86
|
+
ResponseSigninCustomer,
|
|
87
|
+
CustomerDocument,
|
|
88
|
+
UpsertCustomerAddressRequest,
|
|
89
|
+
CustomerAddressResponse,
|
|
90
|
+
CustomerAddressesResponse,
|
|
91
|
+
CustomerOrderPayment,
|
|
92
|
+
CustomerOrderResponse,
|
|
93
|
+
CustomerOrderItem,
|
|
94
|
+
CustomerOrderItemHistoriesResponse,
|
|
95
|
+
CustomerOrderItemHistoryResponse,
|
|
96
|
+
CustomerOrdersResponse,
|
|
97
|
+
CustomerHistory,
|
|
98
|
+
CustomerHistoryResponse,
|
|
99
|
+
AddCustomerToNewsletterRequest,
|
|
100
|
+
AddCustomerToNewsletterResponse,
|
|
101
|
+
UpdateCustomerDocument,
|
|
102
|
+
UpdateCustomerDocumentResponse
|
|
103
|
+
} from './endpoints/customer/customer.interfaces';
|
|
104
|
+
import type {
|
|
105
|
+
CustomerGender,
|
|
106
|
+
CustomerOrigin,
|
|
107
|
+
} from './endpoints/customer/customer.types';
|
|
108
|
+
import type { Descriptions } from './endpoints/description/description.interfaces';
|
|
109
|
+
import type { Discount } from './endpoints/discounts/discounts.interfaces';
|
|
110
|
+
import type { DiscountType } from './endpoints/discounts/discounts.types';
|
|
111
|
+
import type { TypeFilter } from './endpoints/filters/filter.type';
|
|
112
|
+
import type {
|
|
113
|
+
Filter,
|
|
114
|
+
PriceFilter,
|
|
115
|
+
FilterValue,
|
|
116
|
+
} from './endpoints/filters/filters.interfaces';
|
|
117
|
+
import type {
|
|
118
|
+
InterestType,
|
|
119
|
+
RequestInterest,
|
|
120
|
+
ResponseInterest,
|
|
121
|
+
} from './endpoints/interest/interest.interfaces';
|
|
122
|
+
import type { Media } from './endpoints/media/media.interfaces';
|
|
123
|
+
import type { Target, Type } from './endpoints/menu/menu.enums';
|
|
124
|
+
import type { Menu, MenuItem } from './endpoints/menu/menu.interfaces';
|
|
125
|
+
import type { Order, OrderItem } from './endpoints/order/order.interfaces';
|
|
126
|
+
import type { Page } from './endpoints/page/page.interfaces';
|
|
127
|
+
import type { Pagination } from './endpoints/pagination/pagination.interfaces';
|
|
128
|
+
import type {
|
|
129
|
+
PairOffer,
|
|
130
|
+
PairOfferResponse,
|
|
131
|
+
} from './endpoints/pair-offer/pair-offer.interfaces';
|
|
132
|
+
import type {
|
|
133
|
+
Payment,
|
|
134
|
+
PaymentConfiguration,
|
|
135
|
+
PaymentOption,
|
|
136
|
+
PaymentResponse,
|
|
137
|
+
PaymentType,
|
|
138
|
+
CardFlags,
|
|
139
|
+
PaymentConditionsRequest,
|
|
140
|
+
PaymentConditionsResponse,
|
|
141
|
+
} from './endpoints/payment/payment.interfaces';
|
|
142
|
+
import type {
|
|
143
|
+
ConfigurationCode,
|
|
144
|
+
PaymentCode,
|
|
145
|
+
} from './endpoints/payment/payment.types';
|
|
146
|
+
import type {
|
|
147
|
+
ProductFields,
|
|
148
|
+
ProductConditionFields,
|
|
149
|
+
ProductSortFields,
|
|
150
|
+
} from './endpoints/product/product-obsearch.types';
|
|
151
|
+
import type {
|
|
152
|
+
Product,
|
|
153
|
+
ProductCategory,
|
|
154
|
+
ProductDimension,
|
|
155
|
+
ProductFlags,
|
|
156
|
+
ProductPrice,
|
|
157
|
+
Stock,
|
|
158
|
+
ProductInstallment,
|
|
159
|
+
} from './endpoints/product/product.interfaces';
|
|
160
|
+
import type {
|
|
161
|
+
ProductStatus,
|
|
162
|
+
ProductType,
|
|
163
|
+
} from './endpoints/product/product.types';
|
|
164
|
+
import type {
|
|
165
|
+
ProductCommentConditionFields,
|
|
166
|
+
ProductCommentFields,
|
|
167
|
+
ProductCommentSortFields,
|
|
168
|
+
} from './endpoints/product-comment/product-comment-obsearch.types';
|
|
169
|
+
import type {
|
|
170
|
+
ProductComment,
|
|
171
|
+
CreateProductComment,
|
|
172
|
+
ProductCommentsResponse,
|
|
173
|
+
} from './endpoints/product-comment/product-comment.interfaces';
|
|
174
|
+
import type { Redirect } from './endpoints/redirect/redirect.interfaces';
|
|
175
|
+
import type {
|
|
176
|
+
ReviewConditionFields,
|
|
177
|
+
ReviewSortFields,
|
|
178
|
+
ReviewFields,
|
|
179
|
+
} from './endpoints/review/review-obsearch.types';
|
|
180
|
+
import type {
|
|
181
|
+
ProductReviewRequest,
|
|
182
|
+
ProductReviewResponse,
|
|
183
|
+
ProductReview,
|
|
184
|
+
} from './endpoints/review/review.interfaces';
|
|
185
|
+
import type { Seal, SealSetting } from './endpoints/seal/seal.interfaces';
|
|
186
|
+
import type { Seals } from './endpoints/seal/seal.types';
|
|
187
|
+
import type { Search } from './endpoints/search/search.interfaces';
|
|
188
|
+
import type { Seo } from './endpoints/seo/seo.interfaces';
|
|
189
|
+
import type {
|
|
190
|
+
ShippingOption,
|
|
191
|
+
QuoteGroupProduct,
|
|
192
|
+
ShippingOptionProduct,
|
|
193
|
+
QuoteGroupProductItem,
|
|
194
|
+
ShipmentQuoteCartRequest,
|
|
195
|
+
ShipmentQuoteProductRequest,
|
|
196
|
+
ShipmentQuoteProductResponse,
|
|
197
|
+
SelectShipimentRequest,
|
|
198
|
+
} from './endpoints/shipment/shipment.interfaces';
|
|
199
|
+
import type { TitleType } from './endpoints/showcase/showcase.enums';
|
|
200
|
+
import type { Showcase } from './endpoints/showcase/showcase.interfaces';
|
|
201
|
+
import type { SimpleProduct } from './endpoints/simple-product/simple-product.interfaces';
|
|
202
|
+
import type { Storage } from './endpoints/storage/storage.interfaces';
|
|
203
|
+
import type {
|
|
204
|
+
UrlBrand,
|
|
205
|
+
UrlListing,
|
|
206
|
+
UrlMenu,
|
|
207
|
+
UrlPage,
|
|
208
|
+
UrlProduct,
|
|
209
|
+
} from './endpoints/url/url.interfaces';
|
|
210
|
+
import type {
|
|
211
|
+
WalletConditionFields,
|
|
212
|
+
WalletSortFields,
|
|
213
|
+
} from './endpoints/wallet/wallet-obsearch';
|
|
214
|
+
import type {
|
|
215
|
+
WalletTransaction,
|
|
216
|
+
WalletTransactionResponse,
|
|
217
|
+
ClaimGiftCardRequest,
|
|
218
|
+
ClaimGiftCardResponse,
|
|
219
|
+
} from './endpoints/wallet/wallet.interfaces';
|
|
220
|
+
import type { ZipcodeResponse } from './endpoints/zipcode/zipcode.interfaces';
|
|
221
|
+
|
|
222
|
+
import type { TemplateResponse } from './endpoints/template/template.interfaces';
|
|
223
|
+
|
|
224
|
+
import type { UpsellResponse, Upsell } from './endpoints/upsell/upsell.interfaces';
|
|
225
|
+
import type { PriceRule } from './endpoints/price/price.interfaces';
|
|
226
|
+
|
|
227
|
+
import type { RedirectRequest, OauthType } from './endpoints/third-party/oauth.interfaces';
|
|
228
|
+
|
|
229
|
+
export type {
|
|
230
|
+
// Config da useApi
|
|
231
|
+
ApiResponse,
|
|
232
|
+
ApiStatus,
|
|
233
|
+
ApiMethod,
|
|
234
|
+
ApiError,
|
|
235
|
+
ApiErrorData,
|
|
236
|
+
ApiContext,
|
|
237
|
+
ApiParams,
|
|
238
|
+
ApiParamsCondition,
|
|
239
|
+
ApiParamsConditionGroup,
|
|
240
|
+
ApiParamsMeta,
|
|
241
|
+
ApiParamsOrder,
|
|
242
|
+
|
|
243
|
+
// Endpoints
|
|
244
|
+
TemplateResponse,
|
|
245
|
+
|
|
246
|
+
// TODO organizar por modulos
|
|
247
|
+
ContextType,
|
|
248
|
+
DiscountType,
|
|
249
|
+
Discount,
|
|
250
|
+
|
|
251
|
+
// Types
|
|
252
|
+
Target,
|
|
253
|
+
Type,
|
|
254
|
+
ProductStatus,
|
|
255
|
+
ProductType,
|
|
256
|
+
TitleType,
|
|
257
|
+
|
|
258
|
+
// Interfaces
|
|
259
|
+
|
|
260
|
+
// Atributos
|
|
261
|
+
Attribute,
|
|
262
|
+
AttributeValue,
|
|
263
|
+
Combination,
|
|
264
|
+
ValueList,
|
|
265
|
+
Variations,
|
|
266
|
+
CurrentAttribute,
|
|
267
|
+
WalletConditionFields,
|
|
268
|
+
WalletSortFields,
|
|
269
|
+
WalletTransaction,
|
|
270
|
+
WalletTransactionResponse,
|
|
271
|
+
ClaimGiftCardRequest,
|
|
272
|
+
ClaimGiftCardResponse,
|
|
273
|
+
RedirectRequest,
|
|
274
|
+
OauthType,
|
|
275
|
+
|
|
276
|
+
// banner
|
|
277
|
+
Banner,
|
|
278
|
+
Banners,
|
|
279
|
+
Seo,
|
|
280
|
+
Media,
|
|
281
|
+
Menu,
|
|
282
|
+
MenuItem,
|
|
283
|
+
Descriptions,
|
|
284
|
+
Showcase,
|
|
285
|
+
|
|
286
|
+
// Marcas
|
|
287
|
+
Brand,
|
|
288
|
+
BrandItem,
|
|
289
|
+
BrandFields,
|
|
290
|
+
BrandConditions,
|
|
291
|
+
BrandOrders,
|
|
292
|
+
|
|
293
|
+
// Pagination
|
|
294
|
+
Pagination,
|
|
295
|
+
|
|
296
|
+
// Selos
|
|
297
|
+
Seal,
|
|
298
|
+
SealSetting,
|
|
299
|
+
Seals,
|
|
300
|
+
|
|
301
|
+
// Shipment
|
|
302
|
+
ShippingOption,
|
|
303
|
+
QuoteGroupProduct,
|
|
304
|
+
ShippingOptionProduct,
|
|
305
|
+
QuoteGroupProductItem,
|
|
306
|
+
ShipmentQuoteCartRequest,
|
|
307
|
+
ShipmentQuoteProductRequest,
|
|
308
|
+
ShipmentQuoteProductResponse,
|
|
309
|
+
SelectShipimentRequest,
|
|
310
|
+
|
|
311
|
+
// Avise-me/Sobconsulta = Interests
|
|
312
|
+
InterestType,
|
|
313
|
+
RequestInterest,
|
|
314
|
+
ResponseInterest,
|
|
315
|
+
|
|
316
|
+
// Compre junto
|
|
317
|
+
PairOffer,
|
|
318
|
+
PairOfferResponse,
|
|
319
|
+
|
|
320
|
+
// Avaliaçoes
|
|
321
|
+
ProductReviewRequest,
|
|
322
|
+
ProductReviewResponse,
|
|
323
|
+
ProductReview,
|
|
324
|
+
ReviewConditionFields,
|
|
325
|
+
ReviewSortFields,
|
|
326
|
+
ReviewFields,
|
|
327
|
+
|
|
328
|
+
// Filtros de listagem
|
|
329
|
+
TypeFilter,
|
|
330
|
+
Filter,
|
|
331
|
+
PriceFilter,
|
|
332
|
+
FilterValue,
|
|
333
|
+
|
|
334
|
+
// Institutional page
|
|
335
|
+
Page,
|
|
336
|
+
|
|
337
|
+
// Redirects
|
|
338
|
+
Redirect,
|
|
339
|
+
|
|
340
|
+
// Product
|
|
341
|
+
ProductFields,
|
|
342
|
+
ProductConditionFields,
|
|
343
|
+
ProductSortFields,
|
|
344
|
+
Product,
|
|
345
|
+
ProductCategory,
|
|
346
|
+
ProductDimension,
|
|
347
|
+
ProductFlags,
|
|
348
|
+
ProductPrice,
|
|
349
|
+
ProductInstallment,
|
|
350
|
+
Stock,
|
|
351
|
+
SimpleProduct,
|
|
352
|
+
|
|
353
|
+
// Product comment
|
|
354
|
+
ProductComment,
|
|
355
|
+
CreateProductComment,
|
|
356
|
+
ProductCommentsResponse,
|
|
357
|
+
ProductCommentConditionFields,
|
|
358
|
+
ProductCommentFields,
|
|
359
|
+
ProductCommentSortFields,
|
|
360
|
+
|
|
361
|
+
// Request das páginas
|
|
362
|
+
UrlMenu,
|
|
363
|
+
UrlBrand,
|
|
364
|
+
UrlListing,
|
|
365
|
+
UrlPage,
|
|
366
|
+
UrlProduct,
|
|
367
|
+
|
|
368
|
+
// Busca de produto
|
|
369
|
+
Search,
|
|
370
|
+
|
|
371
|
+
// Cart
|
|
372
|
+
CartCustomer,
|
|
373
|
+
CartResponse,
|
|
374
|
+
DeleteCartRequest,
|
|
375
|
+
UpsertCartRequest,
|
|
376
|
+
UpsertCartItem,
|
|
377
|
+
AddressToCartRequest,
|
|
378
|
+
AddressesToCartRequest,
|
|
379
|
+
AddressToCartType,
|
|
380
|
+
CartErrorCode,
|
|
381
|
+
AddressToCartResponse,
|
|
382
|
+
BuyCartRequest,
|
|
383
|
+
BuyCartResponse,
|
|
384
|
+
|
|
385
|
+
// Payment
|
|
386
|
+
ConfigurationCode,
|
|
387
|
+
PaymentCode,
|
|
388
|
+
Payment,
|
|
389
|
+
PaymentConfiguration,
|
|
390
|
+
PaymentOption,
|
|
391
|
+
PaymentResponse,
|
|
392
|
+
PaymentType,
|
|
393
|
+
CardFlags,
|
|
394
|
+
PaymentConditionsRequest,
|
|
395
|
+
PaymentConditionsResponse,
|
|
396
|
+
|
|
397
|
+
// Customer
|
|
398
|
+
UpdateCustomer,
|
|
399
|
+
ChangePasswordCustomerAuthenticated,
|
|
400
|
+
ChangePasswordCustomerByCode,
|
|
401
|
+
CheckCustomer,
|
|
402
|
+
CheckCustomerResponse,
|
|
403
|
+
PasswordRecoveryCustomer,
|
|
404
|
+
CustomerResponse,
|
|
405
|
+
SigninCustomerByDocument,
|
|
406
|
+
SigninCustomerByEmail,
|
|
407
|
+
ResponseSigninCustomer,
|
|
408
|
+
CustomerDocument,
|
|
409
|
+
SignupCustomer,
|
|
410
|
+
CustomerGender,
|
|
411
|
+
CustomerOrigin,
|
|
412
|
+
CustomerConditionFields,
|
|
413
|
+
CustomerFields,
|
|
414
|
+
CustomerSortFields,
|
|
415
|
+
CustomerOrderGroupConditionFields,
|
|
416
|
+
CustomerOrderGroupFields,
|
|
417
|
+
CustomerOrderGroupSortFields,
|
|
418
|
+
CustomerOrderItemHistoryConditionFields,
|
|
419
|
+
CustomerOrderItemHistorySortFields,
|
|
420
|
+
CustomerHistoryConditionFields,
|
|
421
|
+
CustomerHistorySortFields,
|
|
422
|
+
CustomerErrorCode,
|
|
423
|
+
UpsertCustomerAddressRequest,
|
|
424
|
+
CustomerAddressResponse,
|
|
425
|
+
CustomerAddressesResponse,
|
|
426
|
+
CustomerOrderPayment,
|
|
427
|
+
CustomerOrderResponse,
|
|
428
|
+
CustomerOrderItem,
|
|
429
|
+
CustomerOrderItemHistoriesResponse,
|
|
430
|
+
CustomerOrderItemHistoryResponse,
|
|
431
|
+
CustomerOrdersResponse,
|
|
432
|
+
CustomerHistory,
|
|
433
|
+
CustomerHistoryResponse,
|
|
434
|
+
AddCustomerToNewsletterRequest,
|
|
435
|
+
AddCustomerToNewsletterResponse,
|
|
436
|
+
UpdateCustomerDocument,
|
|
437
|
+
UpdateCustomerDocumentResponse,
|
|
438
|
+
|
|
439
|
+
// Order
|
|
440
|
+
Order,
|
|
441
|
+
OrderItem,
|
|
442
|
+
Storage,
|
|
443
|
+
|
|
444
|
+
// COUNTRY TYPES
|
|
445
|
+
CountryAlpha2,
|
|
446
|
+
CountryAlpha3,
|
|
447
|
+
CountryName,
|
|
448
|
+
CountryPhoneCode,
|
|
449
|
+
StateCode,
|
|
450
|
+
StateName,
|
|
451
|
+
ZipcodeResponse,
|
|
452
|
+
CountryResponse,
|
|
453
|
+
AddCouponRequest,
|
|
454
|
+
Coupon,
|
|
455
|
+
|
|
456
|
+
UpsellResponse,
|
|
457
|
+
Upsell,
|
|
458
|
+
PriceRule
|
|
459
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import axios, { type AxiosError, AxiosHeaders } from 'axios';
|
|
2
|
+
|
|
3
|
+
import type { ApiContext, ApiError, ApiErrorData } from './types';
|
|
4
|
+
|
|
5
|
+
import { encodeWafNormalizer } from './paramsSerializer/encodeWafNormalizer';
|
|
6
|
+
|
|
7
|
+
export async function usePublicApi<
|
|
8
|
+
ResponseType,
|
|
9
|
+
FieldOptions = '',
|
|
10
|
+
OrderOptions = '',
|
|
11
|
+
ConditionOptions = '',
|
|
12
|
+
>(
|
|
13
|
+
apiContext: ApiContext<any, FieldOptions, OrderOptions, ConditionOptions>,
|
|
14
|
+
): Promise<ResponseType>;
|
|
15
|
+
|
|
16
|
+
export async function usePublicApi<
|
|
17
|
+
ResponseType,
|
|
18
|
+
RequestType = object,
|
|
19
|
+
FieldOptions = '',
|
|
20
|
+
OrderOptions = FieldOptions,
|
|
21
|
+
ConditionOptions = FieldOptions,
|
|
22
|
+
>({
|
|
23
|
+
endpoint,
|
|
24
|
+
method = 'GET',
|
|
25
|
+
payload,
|
|
26
|
+
params,
|
|
27
|
+
}: ApiContext<RequestType, FieldOptions, OrderOptions, ConditionOptions>) {
|
|
28
|
+
const headers = new AxiosHeaders({
|
|
29
|
+
'Uappi-Cookie-Name': 'token',
|
|
30
|
+
Accept: 'application/json',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (
|
|
34
|
+
window.location.hostname === 'localhost' ||
|
|
35
|
+
window.location.hostname === '127.0.0.1'
|
|
36
|
+
)
|
|
37
|
+
headers.set('uappi-environment', 'development');
|
|
38
|
+
|
|
39
|
+
const axiosInstance = axios.create({
|
|
40
|
+
baseURL: `${window.location.protocol}//${window.location.host}/api/v3`,
|
|
41
|
+
headers,
|
|
42
|
+
paramsSerializer: {
|
|
43
|
+
encode: encodeWafNormalizer,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return axiosInstance<{ data: ResponseType; status: boolean }>(endpoint, {
|
|
48
|
+
method,
|
|
49
|
+
data: payload || undefined,
|
|
50
|
+
params,
|
|
51
|
+
withCredentials: true,
|
|
52
|
+
})
|
|
53
|
+
.then(({ data }) => {
|
|
54
|
+
return data.data;
|
|
55
|
+
})
|
|
56
|
+
.catch(e => {
|
|
57
|
+
const axiosError = e as AxiosError;
|
|
58
|
+
const apiErrorData = (
|
|
59
|
+
axiosError.response!.data as { data: ApiErrorData; status: boolean }
|
|
60
|
+
).data;
|
|
61
|
+
|
|
62
|
+
throw {
|
|
63
|
+
message: apiErrorData.message || '',
|
|
64
|
+
errorCode: apiErrorData.errorCode,
|
|
65
|
+
status: axiosError.status,
|
|
66
|
+
} as ApiError;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import publicApi from '../../Api';
|
|
2
|
+
|
|
3
|
+
import { viewPromotion } from '../events/views/viewPromotion';
|
|
4
|
+
|
|
5
|
+
import type { Banners } from '../../Api/types';
|
|
6
|
+
|
|
7
|
+
export function listBanners<AdditionalParameters = []>(
|
|
8
|
+
codes: string,
|
|
9
|
+
): Promise<Banners<AdditionalParameters>>;
|
|
10
|
+
|
|
11
|
+
export function listBanners<AdditionalParameters = []>(
|
|
12
|
+
codes: Array<string>,
|
|
13
|
+
): Promise<Array<Banners<AdditionalParameters>>>;
|
|
14
|
+
|
|
15
|
+
export function listBanners<AdditionalParameters = []>(
|
|
16
|
+
codes: Array<string> | string,
|
|
17
|
+
) {
|
|
18
|
+
if (Array.isArray(codes)) {
|
|
19
|
+
return publicApi.customization
|
|
20
|
+
.listBanners<AdditionalParameters>(codes)
|
|
21
|
+
.then(data => {
|
|
22
|
+
viewPromotion<AdditionalParameters>(data);
|
|
23
|
+
return data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return publicApi.customization
|
|
28
|
+
.listBanners<AdditionalParameters>([codes])
|
|
29
|
+
.then(data => {
|
|
30
|
+
viewPromotion(data);
|
|
31
|
+
return data[0];
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import publicApi from '../../Api';
|
|
2
|
+
|
|
3
|
+
import { addShippingInfoAction } from '../events/actions/addShippingInfo';
|
|
4
|
+
import { addToCartAction } from '../events/actions/addToCart';
|
|
5
|
+
import { purchaseAction } from '../events/actions/purchase';
|
|
6
|
+
import { removeFromCartAction } from '../events/actions/removeFromCart';
|
|
7
|
+
import { shippingCalculationAction } from '../events/actions/shippingCalculation';
|
|
8
|
+
import { upsertToCartAction } from '../events/actions/upsertToCart';
|
|
9
|
+
|
|
10
|
+
import type { UpsertTrackingCartRequest } from '../types';
|
|
11
|
+
import type {
|
|
12
|
+
BuyCartRequest,
|
|
13
|
+
CartResponse,
|
|
14
|
+
DeleteCartRequest,
|
|
15
|
+
SelectShipimentRequest,
|
|
16
|
+
ShipmentQuoteCartRequest,
|
|
17
|
+
UpsertCartRequest,
|
|
18
|
+
} from '../../Api/types';
|
|
19
|
+
|
|
20
|
+
export function listDetail() {
|
|
21
|
+
return publicApi.cart.listDetail().then(data => {
|
|
22
|
+
return data;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function addProduct(payload: UpsertTrackingCartRequest) {
|
|
27
|
+
return publicApi.cart.addProduct(payload as UpsertCartRequest).then(data => {
|
|
28
|
+
addToCartAction(payload, data);
|
|
29
|
+
return data;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function upsertProduct(payload: UpsertTrackingCartRequest) {
|
|
34
|
+
return publicApi.cart
|
|
35
|
+
.upsertProduct(payload as UpsertCartRequest)
|
|
36
|
+
.then(data => {
|
|
37
|
+
upsertToCartAction(payload, data);
|
|
38
|
+
return data;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function deleteProduct(
|
|
43
|
+
payload: DeleteCartRequest,
|
|
44
|
+
oldCartResponse: CartResponse,
|
|
45
|
+
) {
|
|
46
|
+
return publicApi.cart.deleteProduct(payload).then(data => {
|
|
47
|
+
removeFromCartAction(payload, data, oldCartResponse);
|
|
48
|
+
return data;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function selectShipment(payload: SelectShipimentRequest) {
|
|
53
|
+
return publicApi.cart.selectShipment(payload).then(data => {
|
|
54
|
+
addShippingInfoAction(data);
|
|
55
|
+
return data;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function shipmentQuote(payload: ShipmentQuoteCartRequest) {
|
|
60
|
+
return publicApi.cart.shipmentQuote(payload).then(data => {
|
|
61
|
+
shippingCalculationAction();
|
|
62
|
+
return data;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function buy(
|
|
67
|
+
payload: BuyCartRequest,
|
|
68
|
+
paymentMethod: string,
|
|
69
|
+
cartResponse: CartResponse,
|
|
70
|
+
) {
|
|
71
|
+
return publicApi.cart.buy(payload).then(data => {
|
|
72
|
+
purchaseAction(paymentMethod, cartResponse);
|
|
73
|
+
return data;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import publicApi from '../../Api';
|
|
2
|
+
|
|
3
|
+
import type { TrackingCustomerFields } from './types';
|
|
4
|
+
|
|
5
|
+
import { customerProfileAction } from '../events/actions/customerProfile';
|
|
6
|
+
import { generateLead } from '../events/actions/generateLead';
|
|
7
|
+
import { loginAction } from '../events/actions/login';
|
|
8
|
+
import { signupAction } from '../events/actions/signup';
|
|
9
|
+
|
|
10
|
+
import type { CustomerLead } from '../types';
|
|
11
|
+
import type {
|
|
12
|
+
ApiParams,
|
|
13
|
+
CustomerConditionFields,
|
|
14
|
+
CustomerSortFields,
|
|
15
|
+
SigninCustomerByDocument,
|
|
16
|
+
SigninCustomerByEmail,
|
|
17
|
+
SignupCustomer,
|
|
18
|
+
} from '../../Api/types';
|
|
19
|
+
|
|
20
|
+
export function detail(
|
|
21
|
+
options?: Pick<
|
|
22
|
+
ApiParams<
|
|
23
|
+
TrackingCustomerFields,
|
|
24
|
+
CustomerSortFields,
|
|
25
|
+
CustomerConditionFields
|
|
26
|
+
>,
|
|
27
|
+
'condition' | 'fields' | 'order'
|
|
28
|
+
>,
|
|
29
|
+
) {
|
|
30
|
+
return publicApi.customer
|
|
31
|
+
.detail({
|
|
32
|
+
...options,
|
|
33
|
+
fields: ['addresses', 'flags'],
|
|
34
|
+
})
|
|
35
|
+
.then(data => {
|
|
36
|
+
customerProfileAction(data);
|
|
37
|
+
|
|
38
|
+
return data;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function signup(payload: SignupCustomer) {
|
|
43
|
+
return publicApi.customer.signup(payload).then(data => {
|
|
44
|
+
signupAction();
|
|
45
|
+
return data;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function signinByEmail(payload: SigninCustomerByEmail) {
|
|
50
|
+
return publicApi.customer.signinByEmail(payload).then(data => {
|
|
51
|
+
loginAction();
|
|
52
|
+
return data;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function signinByDocument(payload: SigninCustomerByDocument) {
|
|
57
|
+
return publicApi.customer.signinByDocument(payload).then(data => {
|
|
58
|
+
loginAction();
|
|
59
|
+
return data;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function addNewsletter(payload: CustomerLead) {
|
|
64
|
+
return publicApi.customer.addNewsletter(payload).then(data => {
|
|
65
|
+
generateLead(payload);
|
|
66
|
+
return data;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import publicApi from '../../Api';
|
|
2
|
+
|
|
3
|
+
import { shippingCalculationAction } from '../events/actions/shippingCalculation';
|
|
4
|
+
|
|
5
|
+
import type { ApiParams } from '../../Api/types';
|
|
6
|
+
|
|
7
|
+
export async function listShipmentQuoteProduct(
|
|
8
|
+
payload: Pick<ApiParams, 'targetCountryCode' | 'targetZipCode' | 'items'>,
|
|
9
|
+
) {
|
|
10
|
+
return publicApi.product.listShipmentQuoteProduct(payload).then(data => {
|
|
11
|
+
shippingCalculationAction();
|
|
12
|
+
return data;
|
|
13
|
+
});
|
|
14
|
+
}
|