@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.
Files changed (158) hide show
  1. package/.editorconfig +6 -0
  2. package/.vscode/extensions.json +5 -0
  3. package/.vscode/settings.json +7 -0
  4. package/components/Animations/ExpandTransition.ts +89 -0
  5. package/components/Animations/index.ts +1 -0
  6. package/components/Themes/CustomTheme.ts +77 -0
  7. package/components/Themes/index.ts +1 -0
  8. package/main.ts +16 -0
  9. package/modules/Api/README.md +469 -0
  10. package/modules/Api/endpoints/BannerComposable.ts +31 -0
  11. package/modules/Api/endpoints/BrandComposable.ts +21 -0
  12. package/modules/Api/endpoints/CartComposable.ts +121 -0
  13. package/modules/Api/endpoints/CommonComposable.ts +24 -0
  14. package/modules/Api/endpoints/CouponComposable.ts +18 -0
  15. package/modules/Api/endpoints/CustomerComposable.ts +255 -0
  16. package/modules/Api/endpoints/InterestComposable.ts +11 -0
  17. package/modules/Api/endpoints/LoggoutComposable.ts +8 -0
  18. package/modules/Api/endpoints/MenuComposable.ts +25 -0
  19. package/modules/Api/endpoints/PairOfferComposable.ts +14 -0
  20. package/modules/Api/endpoints/PaymentComposable.ts +14 -0
  21. package/modules/Api/endpoints/ProductCommentComposable.ts +51 -0
  22. package/modules/Api/endpoints/ProductQuoteShipment.ts +20 -0
  23. package/modules/Api/endpoints/PublicComposable.ts +9 -0
  24. package/modules/Api/endpoints/ReviewComposable.ts +64 -0
  25. package/modules/Api/endpoints/SearchComposable.ts +27 -0
  26. package/modules/Api/endpoints/ShowcaseComposable.ts +45 -0
  27. package/modules/Api/endpoints/TemplateComposable.ts +8 -0
  28. package/modules/Api/endpoints/ThirdPartyComposable.ts +14 -0
  29. package/modules/Api/endpoints/UpsellComposable.ts +18 -0
  30. package/modules/Api/endpoints/UrlComposable.ts +26 -0
  31. package/modules/Api/endpoints/VariationComposable.ts +36 -0
  32. package/modules/Api/endpoints/WalletComposable.ts +36 -0
  33. package/modules/Api/endpoints/ZipcodeComposable.ts +10 -0
  34. package/modules/Api/index.ts +194 -0
  35. package/modules/Api/paramsSerializer/encodeWafNormalizer.ts +7 -0
  36. package/modules/Api/types/context/api-config.types.ts +68 -0
  37. package/modules/Api/types/context/api-params.types.ts +74 -0
  38. package/modules/Api/types/endpoints/attribute/attribute.interfaces.ts +42 -0
  39. package/modules/Api/types/endpoints/banner/banner.interfaces.ts +45 -0
  40. package/modules/Api/types/endpoints/brand/brand-field.types.ts +3 -0
  41. package/modules/Api/types/endpoints/brand/brand.interfaces.ts +23 -0
  42. package/modules/Api/types/endpoints/cart/cart.interfaces.ts +161 -0
  43. package/modules/Api/types/endpoints/cart/cart.types.ts +27 -0
  44. package/modules/Api/types/endpoints/common/common.interfaces.ts +21 -0
  45. package/modules/Api/types/endpoints/context/context.types.ts +1 -0
  46. package/modules/Api/types/endpoints/country/country.types.ts +7502 -0
  47. package/modules/Api/types/endpoints/coupon/coupon.interfaces.ts +13 -0
  48. package/modules/Api/types/endpoints/customer/customer-erros.ts +13 -0
  49. package/modules/Api/types/endpoints/customer/customer-obsearch.ts +103 -0
  50. package/modules/Api/types/endpoints/customer/customer.interfaces.ts +448 -0
  51. package/modules/Api/types/endpoints/customer/customer.types.ts +3 -0
  52. package/modules/Api/types/endpoints/description/description.interfaces.ts +30 -0
  53. package/modules/Api/types/endpoints/discounts/discounts.interfaces.ts +9 -0
  54. package/modules/Api/types/endpoints/discounts/discounts.types.ts +5 -0
  55. package/modules/Api/types/endpoints/filters/filter.type.ts +1 -0
  56. package/modules/Api/types/endpoints/filters/filters.interfaces.ts +26 -0
  57. package/modules/Api/types/endpoints/interest/interest.interfaces.ts +22 -0
  58. package/modules/Api/types/endpoints/media/media.interfaces.ts +13 -0
  59. package/modules/Api/types/endpoints/menu/menu.enums.ts +8 -0
  60. package/modules/Api/types/endpoints/menu/menu.interfaces.ts +26 -0
  61. package/modules/Api/types/endpoints/order/order.interfaces.ts +63 -0
  62. package/modules/Api/types/endpoints/page/page.interfaces.ts +15 -0
  63. package/modules/Api/types/endpoints/pagination/pagination.interfaces.ts +6 -0
  64. package/modules/Api/types/endpoints/pair-offer/pair-offer.interfaces.ts +19 -0
  65. package/modules/Api/types/endpoints/payment/payment.interfaces.ts +103 -0
  66. package/modules/Api/types/endpoints/payment/payment.types.ts +27 -0
  67. package/modules/Api/types/endpoints/price/price.interfaces.ts +22 -0
  68. package/modules/Api/types/endpoints/product/product-obsearch.types.ts +63 -0
  69. package/modules/Api/types/endpoints/product/product.interfaces.ts +109 -0
  70. package/modules/Api/types/endpoints/product/product.types.ts +3 -0
  71. package/modules/Api/types/endpoints/product-comment/product-comment-obsearch.types.ts +24 -0
  72. package/modules/Api/types/endpoints/product-comment/product-comment.interfaces.ts +32 -0
  73. package/modules/Api/types/endpoints/redirect/redirect.interfaces.ts +7 -0
  74. package/modules/Api/types/endpoints/review/review-obsearch.types.ts +18 -0
  75. package/modules/Api/types/endpoints/review/review.interfaces.ts +34 -0
  76. package/modules/Api/types/endpoints/seal/seal.interfaces.ts +21 -0
  77. package/modules/Api/types/endpoints/seal/seal.types.ts +3 -0
  78. package/modules/Api/types/endpoints/search/search.interfaces.ts +11 -0
  79. package/modules/Api/types/endpoints/seo/seo.interfaces.ts +11 -0
  80. package/modules/Api/types/endpoints/shipment/shipment.interfaces.ts +137 -0
  81. package/modules/Api/types/endpoints/showcase/showcase.enums.ts +8 -0
  82. package/modules/Api/types/endpoints/showcase/showcase.interfaces.ts +10 -0
  83. package/modules/Api/types/endpoints/simple-product/simple-product.interfaces.ts +15 -0
  84. package/modules/Api/types/endpoints/storage/storage.interfaces.ts +16 -0
  85. package/modules/Api/types/endpoints/template/template.interfaces.ts +30 -0
  86. package/modules/Api/types/endpoints/third-party/oauth.interfaces.ts +6 -0
  87. package/modules/Api/types/endpoints/upsell/upsell.interfaces.ts +13 -0
  88. package/modules/Api/types/endpoints/url/url.interfaces.ts +85 -0
  89. package/modules/Api/types/endpoints/wallet/wallet-obsearch.ts +8 -0
  90. package/modules/Api/types/endpoints/wallet/wallet.interfaces.ts +57 -0
  91. package/modules/Api/types/endpoints/zipcode/zipcode.interfaces.ts +23 -0
  92. package/modules/Api/types/index.ts +459 -0
  93. package/modules/Api/usePublicApi.ts +68 -0
  94. package/modules/Tracking/endpoints/BannerComposable.ts +33 -0
  95. package/modules/Tracking/endpoints/CartComposable.ts +75 -0
  96. package/modules/Tracking/endpoints/CustomerComposable.ts +68 -0
  97. package/modules/Tracking/endpoints/ProductQuoteShipment.ts +14 -0
  98. package/modules/Tracking/endpoints/SearchComposable.ts +32 -0
  99. package/modules/Tracking/endpoints/ShowcaseComposable.ts +54 -0
  100. package/modules/Tracking/endpoints/UrlComposable.ts +41 -0
  101. package/modules/Tracking/endpoints/types.ts +11 -0
  102. package/modules/Tracking/events/actions/addPaymentInfo.ts +31 -0
  103. package/modules/Tracking/events/actions/addShippingInfo.ts +27 -0
  104. package/modules/Tracking/events/actions/addToCart.ts +35 -0
  105. package/modules/Tracking/events/actions/beginCheckout.ts +28 -0
  106. package/modules/Tracking/events/actions/customerProfile.ts +36 -0
  107. package/modules/Tracking/events/actions/generateLead.ts +12 -0
  108. package/modules/Tracking/events/actions/login.ts +8 -0
  109. package/modules/Tracking/events/actions/purchase.ts +42 -0
  110. package/modules/Tracking/events/actions/removeFromCart.ts +52 -0
  111. package/modules/Tracking/events/actions/search.ts +8 -0
  112. package/modules/Tracking/events/actions/selectItem.ts +64 -0
  113. package/modules/Tracking/events/actions/selectPromotion.ts +24 -0
  114. package/modules/Tracking/events/actions/shippingCalculation.ts +7 -0
  115. package/modules/Tracking/events/actions/signup.ts +8 -0
  116. package/modules/Tracking/events/actions/upsertToCart.ts +62 -0
  117. package/modules/Tracking/events/views/viewCart.ts +28 -0
  118. package/modules/Tracking/events/views/viewHome.ts +5 -0
  119. package/modules/Tracking/events/views/viewItem.ts +31 -0
  120. package/modules/Tracking/events/views/viewItemList.ts +65 -0
  121. package/modules/Tracking/events/views/viewNotFound.ts +5 -0
  122. package/modules/Tracking/events/views/viewOther.ts +5 -0
  123. package/modules/Tracking/events/views/viewPayment.ts +7 -0
  124. package/modules/Tracking/events/views/viewPromotion.ts +28 -0
  125. package/modules/Tracking/events/views/viewShipping.ts +7 -0
  126. package/modules/Tracking/index.ts +84 -0
  127. package/modules/Tracking/publicApiTracking.ts +36 -0
  128. package/modules/Tracking/types/actions/add-payment-info.interfaces.ts +12 -0
  129. package/modules/Tracking/types/actions/add-shipping-info.interfaces.ts +11 -0
  130. package/modules/Tracking/types/actions/add-to-cart.interfaces.ts +10 -0
  131. package/modules/Tracking/types/actions/begin-checkout.interfaces.ts +12 -0
  132. package/modules/Tracking/types/actions/customer-profile.interfaces.ts +19 -0
  133. package/modules/Tracking/types/actions/file-download.interfaces.ts +4 -0
  134. package/modules/Tracking/types/actions/generate-lead.interfaces.ts +12 -0
  135. package/modules/Tracking/types/actions/login.interfaces.ts +4 -0
  136. package/modules/Tracking/types/actions/purchase.interfaces.ts +18 -0
  137. package/modules/Tracking/types/actions/remove-from-cart.interfaces.ts +10 -0
  138. package/modules/Tracking/types/actions/search.interfaces.ts +4 -0
  139. package/modules/Tracking/types/actions/select-item.interfaces.ts +16 -0
  140. package/modules/Tracking/types/actions/select-promotion.interfaces.ts +8 -0
  141. package/modules/Tracking/types/actions/share.interfaces.ts +4 -0
  142. package/modules/Tracking/types/actions/shipping-calculation.interfaces.ts +3 -0
  143. package/modules/Tracking/types/actions/signup.interfaces.ts +4 -0
  144. package/modules/Tracking/types/event.types.ts +54 -0
  145. package/modules/Tracking/types/index.ts +37 -0
  146. package/modules/Tracking/types/item.interfaces.ts +30 -0
  147. package/modules/Tracking/types/views/view-cart.interfaces.ts +11 -0
  148. package/modules/Tracking/types/views/view-home.interfaces.ts +3 -0
  149. package/modules/Tracking/types/views/view-item-list.interfaces.ts +11 -0
  150. package/modules/Tracking/types/views/view-item.interfaces.ts +15 -0
  151. package/modules/Tracking/types/views/view-not-found.interfaces.ts +3 -0
  152. package/modules/Tracking/types/views/view-other.interfaces.ts +3 -0
  153. package/modules/Tracking/types/views/view-payment.interfaces.ts +3 -0
  154. package/modules/Tracking/types/views/view-promotion.interfaces.ts +8 -0
  155. package/modules/Tracking/types/views/view-shipping.interfaces.ts +3 -0
  156. package/modules/Tracking/utils/cart.ts +100 -0
  157. package/modules/Tracking/utils/pushDatalayer.ts +7 -0
  158. package/package.json +27 -0
@@ -0,0 +1,27 @@
1
+ import { usePublicApi } from '..';
2
+
3
+ import type {
4
+ ApiParams,
5
+ ProductFields,
6
+ ProductConditionFields,
7
+ ProductSortFields,
8
+ Search,
9
+ } from '../types';
10
+
11
+ export function getSearch(
12
+ term: string,
13
+ options?: Pick<
14
+ ApiParams<ProductFields, ProductSortFields, ProductConditionFields>,
15
+ 'condition' | 'fields' | 'limit' | 'meta' | 'offset' | 'order'
16
+ >,
17
+ ) {
18
+ return usePublicApi<
19
+ Search,
20
+ ProductFields,
21
+ ProductSortFields,
22
+ ProductConditionFields
23
+ >({
24
+ endpoint: `/publics/products/search/${term}`,
25
+ params: options,
26
+ });
27
+ }
@@ -0,0 +1,45 @@
1
+ import { usePublicApi } from '..';
2
+
3
+ import type { Showcase, ApiParams, ProductFields } from '../types';
4
+
5
+ export function listShowcase(
6
+ codes: string,
7
+ options?: Pick<
8
+ ApiParams<ProductFields>,
9
+ 'condition' | 'fields' | 'meta' | 'order'
10
+ >,
11
+ ): Promise<Showcase>;
12
+
13
+ export function listShowcase(
14
+ codes: Array<string>,
15
+ options?: Pick<
16
+ ApiParams<ProductFields>,
17
+ 'condition' | 'fields' | 'meta' | 'order'
18
+ >,
19
+ ): Promise<Array<Showcase>>;
20
+
21
+ export function listShowcase(
22
+ codes: Array<string> | string,
23
+ options?: Pick<
24
+ ApiParams<ProductFields>,
25
+ 'condition' | 'fields' | 'meta' | 'order'
26
+ >,
27
+ ) {
28
+ if (Array.isArray(codes)) {
29
+ return usePublicApi<Array<Showcase>, ProductFields>({
30
+ endpoint: '/publics/template/showcases/',
31
+ params: {
32
+ codes,
33
+ ...options,
34
+ },
35
+ });
36
+ }
37
+
38
+ return usePublicApi<Array<Showcase>, ProductFields>({
39
+ endpoint: '/publics/template/showcases/',
40
+ params: {
41
+ codes: [codes],
42
+ ...options,
43
+ },
44
+ }).then(data => data[0]);
45
+ }
@@ -0,0 +1,8 @@
1
+ import { usePublicApi } from '..';
2
+ import type { TemplateResponse } from "../types";
3
+
4
+ export function listTemplateSettings<Setting>(uri: string) {
5
+ return usePublicApi<TemplateResponse<Setting>>({
6
+ endpoint: `/publics/template/custom-settings?uri=${uri}`,
7
+ });
8
+ }
@@ -0,0 +1,14 @@
1
+ import { usePublicApi } from '..';
2
+
3
+ import type {
4
+ RedirectRequest,
5
+ OauthType,
6
+ } from '../types';
7
+
8
+ export function oauthRedirect(type: OauthType, payload: RedirectRequest) {
9
+ return usePublicApi<string, RedirectRequest>({
10
+ endpoint: `/third-party/${type}/oauth/redirect`,
11
+ method: 'GET',
12
+ params: payload,
13
+ });
14
+ }
@@ -0,0 +1,18 @@
1
+ import { usePublicApi } from '..';
2
+
3
+ import type {
4
+ ApiParams,
5
+ ProductFields,
6
+ UpsellResponse,
7
+ } from '../types';
8
+
9
+ export function upsells(
10
+ location: string,
11
+ options?: Pick<ApiParams<ProductFields>, 'fields'>,
12
+ ) {
13
+ options
14
+ return usePublicApi<UpsellResponse, ProductFields>({
15
+ endpoint: `/cart/upsell/${location}`,
16
+ params: options,
17
+ });
18
+ }
@@ -0,0 +1,26 @@
1
+ import { usePublicApi } from '..';
2
+
3
+ import type {
4
+ ApiParams,
5
+ ProductFields,
6
+ ProductConditionFields,
7
+ ProductSortFields,
8
+ } from '../types';
9
+
10
+ export function getUrl<UrlType>(
11
+ path: string,
12
+ options?: Pick<
13
+ ApiParams<ProductFields, ProductSortFields, ProductConditionFields>,
14
+ 'condition' | 'fields' | 'limit' | 'offset' | 'meta' | 'order'
15
+ >,
16
+ ) {
17
+ return usePublicApi<
18
+ UrlType,
19
+ ProductFields,
20
+ ProductSortFields,
21
+ ProductConditionFields
22
+ >({
23
+ endpoint: `/publics/url/?url=${path}`,
24
+ params: options,
25
+ });
26
+ }
@@ -0,0 +1,36 @@
1
+ import { usePublicApi } from '..';
2
+
3
+ import type {
4
+ ProductFields,
5
+ ProductSortFields,
6
+ ProductConditionFields,
7
+ ApiParams,
8
+ Product,
9
+ } from '../types';
10
+
11
+ interface VariationData {
12
+ productId: number;
13
+ variations: Array<number> | number;
14
+ }
15
+
16
+ export function listVariation(
17
+ variationData: VariationData,
18
+ options?: Pick<
19
+ ApiParams<ProductFields, ProductSortFields, ProductConditionFields>,
20
+ 'condition' | 'fields' | 'meta'
21
+ >,
22
+ ) {
23
+ const variationIds: string = Array.isArray(variationData.variations)
24
+ ? variationData.variations.join('-')
25
+ : variationData.variations.toString();
26
+
27
+ return usePublicApi<
28
+ Product,
29
+ ProductFields,
30
+ ProductSortFields,
31
+ ProductConditionFields
32
+ >({
33
+ endpoint: `/publics/products/${variationData.productId}/variation/${variationIds}`,
34
+ params: options,
35
+ });
36
+ }
@@ -0,0 +1,36 @@
1
+ import { usePublicApi } from '../usePublicApi';
2
+
3
+ import type {
4
+ ApiParams,
5
+ ClaimGiftCardRequest,
6
+ ClaimGiftCardResponse,
7
+ WalletConditionFields,
8
+ WalletSortFields,
9
+ WalletTransactionResponse,
10
+ } from '../types';
11
+
12
+ export function listWalletTransaction(
13
+ options?: Pick<
14
+ ApiParams<'', WalletSortFields, WalletConditionFields>,
15
+ 'condition' | 'order' | 'limit' | 'offset'
16
+ >,
17
+ ) {
18
+ return usePublicApi<
19
+ WalletTransactionResponse,
20
+ '',
21
+ WalletSortFields,
22
+ WalletConditionFields
23
+ >({
24
+ endpoint: '/customer/wallet/transaction',
25
+ method: 'GET',
26
+ params: options,
27
+ });
28
+ }
29
+
30
+ export function claimGiftCard(payload: ClaimGiftCardRequest) {
31
+ return usePublicApi<ClaimGiftCardResponse>({
32
+ endpoint: '/customer/gift-cards/link',
33
+ method: 'POST',
34
+ payload,
35
+ });
36
+ }
@@ -0,0 +1,10 @@
1
+ import { usePublicApi } from '..';
2
+
3
+ import type { ZipcodeResponse } from '../types';
4
+
5
+ export function listZipcode(zipcode: string) {
6
+ return usePublicApi<ZipcodeResponse>({
7
+ endpoint: `/shipping/zipcode/consult/BRA/${zipcode}`,
8
+ method: 'GET',
9
+ });
10
+ }
@@ -0,0 +1,194 @@
1
+ import { listBanners } from './endpoints/BannerComposable';
2
+ import { listBrands } from './endpoints/BrandComposable';
3
+ import {
4
+ addProduct,
5
+ deleteProduct,
6
+ listDetail,
7
+ shipmentQuote,
8
+ upsertProduct,
9
+ selectShipment,
10
+ applyAddresses,
11
+ applyWallet,
12
+ deleteWallet,
13
+ listPayments,
14
+ buy,
15
+ applyPoint,
16
+ deletePoint,
17
+ recovery
18
+ } from './endpoints/CartComposable';
19
+ import {
20
+ listContries,
21
+ listCardFlags,
22
+ countryDetail,
23
+ } from './endpoints/CommonComposable';
24
+ import { addCoupon, deleteCoupon } from './endpoints/CouponComposable';
25
+ import {
26
+ changePasswordByAuthenticated,
27
+ changePasswordByCode,
28
+ check,
29
+ createAddress,
30
+ deleteAddress,
31
+ detail,
32
+ listAddress,
33
+ passwordRecovery,
34
+ signinByDocument,
35
+ signinByEmail,
36
+ signup,
37
+ update,
38
+ updatePrimaryAddress,
39
+ updateAddress,
40
+ detailOrderGroup,
41
+ listOrderGroups,
42
+ deleteNewsletter,
43
+ listOrderItemHistory,
44
+ listCustomerHistory,
45
+ addNewsletter,
46
+ updateDocument
47
+ } from './endpoints/CustomerComposable';
48
+ import { createInterest } from './endpoints/InterestComposable';
49
+ import { loggout } from './endpoints/LoggoutComposable';
50
+ import { listMenu } from './endpoints/MenuComposable';
51
+ import { listPairOffers } from './endpoints/PairOfferComposable';
52
+ import { paymentConditions } from './endpoints/PaymentComposable';
53
+ import {
54
+ deleteProductComment,
55
+ createProductComment,
56
+ listProductComments,
57
+ } from './endpoints/ProductCommentComposable';
58
+ import { listShipmentQuoteProduct } from './endpoints/ProductQuoteShipment';
59
+ import {
60
+ createProductReview,
61
+ listProductReview,
62
+ listStoreReview,
63
+ listCustomerReview,
64
+ } from './endpoints/ReviewComposable';
65
+ import { getSearch } from './endpoints/SearchComposable';
66
+ import { listShowcase } from './endpoints/ShowcaseComposable';
67
+ import { getUrl } from './endpoints/UrlComposable';
68
+ import { listVariation } from './endpoints/VariationComposable';
69
+ import {
70
+ listWalletTransaction,
71
+ claimGiftCard,
72
+ } from './endpoints/WalletComposable';
73
+ import { listZipcode } from './endpoints/ZipcodeComposable';
74
+ import { listTemplateSettings } from './endpoints/TemplateComposable';
75
+ import { upsells } from './endpoints/UpsellComposable'
76
+ import { contact } from './endpoints/PublicComposable'
77
+ import { oauthRedirect } from './endpoints/ThirdPartyComposable';
78
+
79
+
80
+ import { usePublicApi } from './usePublicApi';
81
+
82
+ const thirdParty = {
83
+ oauthRedirect
84
+ }
85
+
86
+ const customization = {
87
+ listShowcase,
88
+ listBanners,
89
+ listMenu,
90
+ listTemplateSettings
91
+ };
92
+
93
+ const customer = {
94
+ addNewsletter,
95
+ createProductReview,
96
+ listProductReview,
97
+ listStoreReview,
98
+ createInterest,
99
+ changePasswordByAuthenticated,
100
+ changePasswordByCode,
101
+ check,
102
+ createAddress,
103
+ deleteAddress,
104
+ detail,
105
+ listAddress,
106
+ passwordRecovery,
107
+ signinByDocument,
108
+ signinByEmail,
109
+ signup,
110
+ update,
111
+ updatePrimaryAddress,
112
+ updateAddress,
113
+ loggout,
114
+ detailOrderGroup,
115
+ listOrderGroups,
116
+ deleteNewsletter,
117
+ listOrderItemHistory,
118
+ listCustomerHistory,
119
+ listCustomerReview,
120
+ listWalletTransaction,
121
+ claimGiftCard,
122
+ updateDocument,
123
+ };
124
+
125
+ const cart = {
126
+ addProduct,
127
+ deleteProduct,
128
+ listDetail,
129
+ shipmentQuote,
130
+ upsertProduct,
131
+ selectShipment,
132
+ applyAddresses,
133
+ listPayments,
134
+ buy,
135
+ paymentConditions,
136
+ upsells,
137
+ recovery
138
+ };
139
+
140
+ const product = {
141
+ listBrands,
142
+ listVariation,
143
+ getUrl,
144
+ getSearch,
145
+ listShipmentQuoteProduct,
146
+ deleteProductComment,
147
+ createProductComment,
148
+ listProductComments,
149
+ };
150
+
151
+ const common = {
152
+ listZipcode,
153
+ listContries,
154
+ countryDetail,
155
+ listCardFlags,
156
+ };
157
+
158
+ const promotional = {
159
+ listPairOffers,
160
+ addCoupon,
161
+ deleteCoupon,
162
+ applyWallet,
163
+ deleteWallet,
164
+ applyPoint,
165
+ deletePoint,
166
+ };
167
+
168
+ const notify = {
169
+ contact
170
+ }
171
+
172
+ export {
173
+ usePublicApi,
174
+ common,
175
+ customer,
176
+ customization,
177
+ cart,
178
+ product,
179
+ promotional,
180
+ notify,
181
+ thirdParty
182
+ };
183
+ export default {
184
+ usePublicApi,
185
+
186
+ common,
187
+ customer,
188
+ customization,
189
+ cart,
190
+ product,
191
+ promotional,
192
+ notify,
193
+ thirdParty
194
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Normalizador de parametros/filtros para transpassar a regra EVA081 do Sucuri Web Firewall
3
+ *
4
+ */
5
+ export function encodeWafNormalizer(param: string) {
6
+ return String(param).replace(/\[/g, '_:').replace(/\]/g, ':_');
7
+ }
@@ -0,0 +1,68 @@
1
+ import type { Ref } from 'vue';
2
+
3
+ import type { ApiParams, CustomerErrorCode } from '..';
4
+
5
+ export type ApiStatus = 'pending' | 'success' | 'error';
6
+
7
+ export type ApiMethod =
8
+ | 'POST'
9
+ | 'GET'
10
+ | 'PUT'
11
+ | 'PATCH'
12
+ | 'DELETE'
13
+ | 'post'
14
+ | 'get'
15
+ | 'put'
16
+ | 'patch'
17
+ | 'delete';
18
+
19
+ export interface ApiResponse<ResponseType> {
20
+ data: Ref<ResponseType | undefined>;
21
+ status: Ref<ApiStatus>;
22
+ //eslint-disable-next-line
23
+ error: Ref<any | null>;
24
+ fetchData: () => Promise<void>;
25
+ }
26
+ export interface ApiContext<
27
+ RequestType,
28
+ FieldOptions = '',
29
+ OrderOptions = FieldOptions,
30
+ ConditionOptions = FieldOptions,
31
+ > {
32
+ endpoint: string;
33
+ method?: ApiMethod;
34
+ payload?: RequestType;
35
+ params?: ApiParams<FieldOptions, OrderOptions, ConditionOptions>;
36
+ }
37
+
38
+ export interface ApiError {
39
+ message: string;
40
+ errorCode: ApiErrorData['errorCode'];
41
+ status: number;
42
+ }
43
+
44
+ export interface ApiErrorData {
45
+ code: number;
46
+ datails: [];
47
+ errorCode:
48
+ | 'BAD_REQUEST'
49
+ | 'UNAUTHORIZED'
50
+ | 'PAYMENT_REQUIRED'
51
+ | 'FORBIDDEN'
52
+ | 'NOT_FOUND'
53
+ | 'METHOD_NOT_ALLOWED Método não permitido'
54
+ | 'NOT_ACCEPTABLE'
55
+ | 'PROXY_AUTHENTICATION_REQUIRED'
56
+ | 'REQUEST_TIME_OUT'
57
+ | 'CONFLICT'
58
+ | 'UNSUPPORTED_MIDIA_TYPE'
59
+ | 'INTERNAL_SERVER_ERROR'
60
+ | 'NOT_IMPLEMENTED'
61
+ | 'BAD_GATEWAY'
62
+ | 'SERVICE_UNAVAILABLE'
63
+ | 'GATEWAY_TIME_OUT'
64
+ | 'UAPPI_TOOLS_ITEM_EVALUATED'
65
+ | 'UAPPI_TOOLS_REVIEW_NOT_FOUND'
66
+ | CustomerErrorCode;
67
+ message: string;
68
+ }
@@ -0,0 +1,74 @@
1
+ export interface ApiParams<
2
+ FieldOptions = '',
3
+ OrderOptions = '',
4
+ ConditionOptions = '',
5
+ > {
6
+ codes?: Array<string>;
7
+ limit?: number;
8
+ offset?: number;
9
+ fields?: Array<FieldOptions>;
10
+ order?: Array<ApiParamsOrder<OrderOptions>>;
11
+ condition?: ApiParamsConditionGroup<ConditionOptions>;
12
+ meta?: ApiParamsMeta;
13
+
14
+ // for product quote
15
+ targetZipCode?: string;
16
+ targetCountryCode?: string;
17
+ items?: Array<{ productId: number; quantity: number }>;
18
+
19
+ variationMap?: Record<string, number>;
20
+
21
+ loginUrl?: string;
22
+ registerUrl?: string;
23
+ }
24
+
25
+ export interface ApiParamsOrder<FieldOptions> {
26
+ field: FieldOptions;
27
+ order: 'ASC' | 'DESC';
28
+ }
29
+
30
+ export interface ApiParamsConditionGroup<FieldOptions> {
31
+ type: 'AND' | 'OR';
32
+ conditions: Array<
33
+ ApiParamsConditionGroup<FieldOptions> | ApiParamsCondition<FieldOptions>
34
+ >;
35
+ }
36
+
37
+ export interface ApiParamsCondition<FieldOptions> {
38
+ field: FieldOptions;
39
+ type?: undefined;
40
+ value:
41
+ | boolean
42
+ | string
43
+ | number
44
+ | Array<string>
45
+ | Array<number>
46
+ | null
47
+ | undefined;
48
+ operator?:
49
+ | '='
50
+ | '!='
51
+ | '>'
52
+ | '>='
53
+ | '<'
54
+ | '<='
55
+ | 'in'
56
+ | 'notIn'
57
+ | 'like'
58
+ | 'between';
59
+ }
60
+
61
+ export interface ApiParamsMeta {
62
+ dimensions?: {
63
+ size?: 'Meter' | 'Centimeter';
64
+ weight?: 'Gram' | 'Kilogram';
65
+ };
66
+ priceParameters?: {
67
+ [productId: string]: {
68
+ code?: string;
69
+ quantity?: number;
70
+ upsellId?: number;
71
+ productPairOfferId?: number;
72
+ };
73
+ };
74
+ }
@@ -0,0 +1,42 @@
1
+ export interface Variations {
2
+ attributes: Array<Attribute>;
3
+ combinations: Array<Combination>;
4
+ valueList: ValueList;
5
+ }
6
+
7
+ export type ValueList = Array<number>;
8
+ export interface Combination {
9
+ active: boolean;
10
+ stock: number;
11
+ combination: Array<number>;
12
+ comparisonPrice: number;
13
+ medias: Array<never>;
14
+ name: string;
15
+ productId: number;
16
+ sku: string;
17
+ url: string;
18
+ currentAttributes: Array<CurrentAttribute>;
19
+ }
20
+ export interface Attribute {
21
+ displayName: string;
22
+ id: number;
23
+ includeSample: boolean;
24
+ name: string;
25
+ sampleAsProductImage: boolean;
26
+ values: Array<AttributeValue>;
27
+ }
28
+
29
+ export interface AttributeValue {
30
+ color: null;
31
+ id: number;
32
+ image: null | string;
33
+ label: string;
34
+ order: number;
35
+ originalImage: null | string;
36
+ }
37
+
38
+ export interface CurrentAttribute {
39
+ id: number;
40
+ name: string;
41
+ value: AttributeValue;
42
+ }
@@ -0,0 +1,45 @@
1
+ export interface Banners<AdditionalParameters = []> {
2
+ id: number;
3
+ code: string;
4
+ title: string;
5
+ description: string;
6
+ desktopWidth: string;
7
+ desktopHeight: string;
8
+ tabletWidth: string;
9
+ tabletHeight: string;
10
+ mobileWidth: string;
11
+ mobileHeight: string;
12
+ createdAt: string;
13
+ additionalParameter: Array<string>;
14
+ banners: [] | Array<Banner<AdditionalParameters>>;
15
+ }
16
+ export interface Banner<AdditionalParameters> {
17
+ id: number;
18
+ templateBannerGroupId: number;
19
+ name: string;
20
+ alt: string;
21
+ desktopImage: string;
22
+ desktopOriginalImage: string;
23
+ tabletImage: string;
24
+ tabletOriginalImage: string;
25
+ mobileImage: string;
26
+ mobileOriginalImage: string;
27
+ desktopUrl: string;
28
+ tabletUrl: string;
29
+ mobileUrl: string;
30
+ desktopWidth: string;
31
+ desktopHeight: string;
32
+ tabletWidth: string;
33
+ tabletHeight: string;
34
+ mobileWidth: string;
35
+ mobileHeight: string;
36
+ active: boolean;
37
+ order: number;
38
+ scheduling: {
39
+ startDate: string;
40
+ endDate: null | string;
41
+ id: number;
42
+ };
43
+ createdAt: string;
44
+ additionalParameter: AdditionalParameters;
45
+ }
@@ -0,0 +1,3 @@
1
+ export type BrandFields = 'bannerGroups' | 'linkedTradePolicies' | 'urls';
2
+ export type BrandOrders = 'id' | 'name';
3
+ export type BrandConditions = 'name' | 'code' | 'active';
@@ -0,0 +1,23 @@
1
+ import type { Descriptions, Redirect, Pagination } from '../..';
2
+
3
+ export interface Brand {
4
+ registers: Array<BrandItem>;
5
+ pagination: Pagination;
6
+ }
7
+
8
+ export interface BrandItem {
9
+ id: number;
10
+ code: string;
11
+ name: string;
12
+ logo: string;
13
+ originalLogo: string;
14
+ productOrdering: string;
15
+ active: boolean;
16
+ createdAt: string;
17
+ updatedAt: Date;
18
+ linkedTradePolicies: Array<number>;
19
+ url: null | string;
20
+ urls: null | Array<Redirect>;
21
+ urlsRemove: null | Array<string>;
22
+ description: null | Descriptions;
23
+ }