@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
package/.editorconfig ADDED
@@ -0,0 +1,6 @@
1
+ [*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
2
+ charset = utf-8
3
+ indent_size = 2
4
+ indent_style = space
5
+ insert_final_newline = true
6
+ trim_trailing_whitespace = true
@@ -0,0 +1,5 @@
1
+ {
2
+ "recommendations": [
3
+ "EditorConfig.EditorConfig"
4
+ ],
5
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "editor.tabSize": 2,
3
+ "editor.formatOnSave": false,
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.eslint": "explicit"
6
+ },
7
+ }
@@ -0,0 +1,89 @@
1
+ import {
2
+ defineComponent,
3
+ h,
4
+ Transition,
5
+ type BaseTransitionProps,
6
+ type PropType,
7
+ } from 'vue';
8
+
9
+ export const ExpandTransition = defineComponent({
10
+ name: 'ExpandTransition',
11
+ props: {
12
+ mode: {
13
+ type: String as PropType<BaseTransitionProps<Element>['mode']>,
14
+ default: 'out-in',
15
+ },
16
+ },
17
+ setup(props, { slots }) {
18
+ const beforeEnter = (el: Element) => {
19
+ const element = el as HTMLElement;
20
+ element.style.height = '0';
21
+ element.style.opacity = '0';
22
+ element.style.overflow = 'hidden';
23
+ };
24
+
25
+ const enter = (el: Element, done: () => void) => {
26
+ const element = el as HTMLElement;
27
+ element.style.transition = 'none';
28
+ element.style.height = 'auto';
29
+ const targetHeight = element.scrollHeight + 'px';
30
+ element.style.height = '0';
31
+ void element.offsetHeight;
32
+ element.style.transition =
33
+ 'height 300ms ease-in-out, opacity 300ms ease-in-out';
34
+ element.style.height = targetHeight;
35
+ element.style.opacity = '1';
36
+
37
+ const cleanup = () => {
38
+ element.style.height = 'auto';
39
+ element.style.overflow = '';
40
+ element.removeEventListener('transitionend', cleanup);
41
+ done();
42
+ };
43
+
44
+ element.addEventListener('transitionend', cleanup);
45
+ };
46
+
47
+ const leave = (el: Element, done: () => void) => {
48
+ const element = el as HTMLElement;
49
+ const height = element.scrollHeight + 'px';
50
+ element.style.height = height;
51
+ element.style.opacity = '1';
52
+ element.style.overflow = 'hidden';
53
+ void element.offsetHeight;
54
+ element.style.transition =
55
+ 'height 300ms ease-in-out, opacity 300ms ease-in-out';
56
+ element.style.height = '0';
57
+ element.style.opacity = '0';
58
+
59
+ const cleanup = () => {
60
+ element.removeEventListener('transitionend', cleanup);
61
+ done();
62
+ };
63
+
64
+ element.addEventListener('transitionend', cleanup);
65
+ };
66
+
67
+ const cancel = (el: Element) => {
68
+ const element = el as HTMLElement;
69
+ element.style.transition = '';
70
+ element.style.height = 'auto';
71
+ element.style.opacity = '';
72
+ element.style.overflow = '';
73
+ };
74
+
75
+ return () =>
76
+ h(
77
+ Transition,
78
+ {
79
+ mode: props.mode,
80
+ onBeforeEnter: beforeEnter,
81
+ onEnter: enter,
82
+ onLeave: leave,
83
+ onEnterCancelled: cancel,
84
+ onLeaveCancelled: cancel,
85
+ },
86
+ slots,
87
+ );
88
+ },
89
+ });
@@ -0,0 +1 @@
1
+ export { ExpandTransition } from './ExpandTransition';
@@ -0,0 +1,77 @@
1
+ import { defineComponent, h, Fragment, onMounted } from 'vue';
2
+
3
+ import { useTemplateStore } from '@/stores/useTemplateStore';
4
+
5
+ export const CustomTheme = defineComponent({
6
+ name: 'CustomTheme',
7
+ setup(_, { slots }) {
8
+ const templateStore = useTemplateStore();
9
+
10
+ function applyColors() {
11
+ if (!templateStore.getTemplate?.settings.colors) return;
12
+
13
+ document.documentElement.style.setProperty(
14
+ '--checkout-cta-default',
15
+ templateStore.getTemplate?.settings.colors.CheckoutCTADefault,
16
+ );
17
+ document.documentElement.style.setProperty(
18
+ '--checkout-cta-hover',
19
+ templateStore.getTemplate?.settings.colors.CheckoutCTAHover,
20
+ );
21
+ document.documentElement.style.setProperty(
22
+ '--checkout-cta-text',
23
+ templateStore.getTemplate?.settings.colors.CheckoutCTAText,
24
+ );
25
+ document.documentElement.style.setProperty(
26
+ '--primary-cta-text',
27
+ templateStore.getTemplate?.settings.colors.PrimaryCTAText,
28
+ );
29
+ document.documentElement.style.setProperty(
30
+ '--primary-interactive-default',
31
+ templateStore.getTemplate?.settings.colors.PrimaryInteractiveDefault,
32
+ );
33
+ document.documentElement.style.setProperty(
34
+ '--primary-interactive-hover',
35
+ templateStore.getTemplate?.settings.colors.PrimaryInteractiveHover,
36
+ );
37
+ document.documentElement.style.setProperty(
38
+ '--primary-interactive-hover-low',
39
+ templateStore.getTemplate?.settings.colors.PrimaryInteractiveHoverLow,
40
+ );
41
+ document.documentElement.style.setProperty(
42
+ '--primary-surface-disabled',
43
+ templateStore.getTemplate?.settings.colors.PrimarySurfaceDisabled,
44
+ );
45
+ document.documentElement.style.setProperty(
46
+ '--primary-surface-low',
47
+ templateStore.getTemplate?.settings.colors.PrimarySurfaceLow,
48
+ );
49
+ document.documentElement.style.setProperty(
50
+ '--primary-text-decorative',
51
+ templateStore.getTemplate?.settings.colors.PrimaryTextDecorative,
52
+ );
53
+ }
54
+
55
+ function applyFont() {
56
+ if (!templateStore.getTemplate?.settings.font) return;
57
+
58
+ const fontLink = document.createElement('link');
59
+ fontLink.rel = 'stylesheet';
60
+ fontLink.setAttribute('uappi-custom-font', '');
61
+ fontLink.href = templateStore.getTemplate?.settings.font.link;
62
+ document.head.appendChild(fontLink);
63
+
64
+ document.documentElement.style.setProperty(
65
+ '--font-family',
66
+ templateStore.getTemplate?.settings.font.family,
67
+ );
68
+ }
69
+
70
+ onMounted(() => {
71
+ applyColors();
72
+ applyFont();
73
+ });
74
+
75
+ return () => h(Fragment, null, slots.default?.());
76
+ },
77
+ });
@@ -0,0 +1 @@
1
+ export { CustomTheme } from './CustomTheme';
package/main.ts ADDED
@@ -0,0 +1,16 @@
1
+ import Api from './modules/Api';
2
+ import Tracking from './modules/Tracking';
3
+
4
+ import { ExpandTransition } from './components/Animations';
5
+ import { CustomTheme } from './components/Themes';
6
+
7
+ const components = {
8
+ ExpandTransition,
9
+ CustomTheme
10
+ }
11
+
12
+ export default {
13
+ Api,
14
+ Tracking,
15
+ components
16
+ };
@@ -0,0 +1,469 @@
1
+ # ../../api
2
+
3
+ Composables Vue 3 + TypeScript para integração simplificada com a API pública da Uappi, facilitando o consumo, gerenciamento e reutilização de endpoints em aplicações modernas.
4
+
5
+ ## Instalação
6
+
7
+ Adicione ao seu projeto:
8
+
9
+ ```bash
10
+ npm install ../../api
11
+ ```
12
+
13
+ ## Escopos Disponíveis
14
+
15
+ O pacote expõe os seguintes escopos, cada um agrupando recursos relacionados:
16
+
17
+ - [**cart**](#cart): Operações de carrinho, como adicionar/remover produtos, simular frete, pagamentos e condições.
18
+ - listDetail Lista detalhes do carrinho
19
+ - addProduct Adiciona um produto ao carrinho
20
+ - deleteProduct Remove um produto do carrinho
21
+ - upsertProduct Atualiza ou insere produto
22
+ - shipmentQuote Lista opções de frete com base no carrinho
23
+ - selectShipment Seleciona opção de frete
24
+ - applyAddresses Aplica endereços entrega/faturamento ao carrinho
25
+ - listPayments Lista formas de pagamento
26
+ - buy: Finaliza a compra
27
+ - paymentConditions: Lista condições de pagamento
28
+
29
+ - [**common**](#common): Utilitários como consulta de CEP, países e bandeiras de cartão.
30
+ - listZipcode: Lista detalhes de endereço de CEP
31
+ - listContries: Lista detalhes de países
32
+ - countryDetail: Detalhes de um país
33
+ - listCardFlags: Retorna dados utilitários sobre cada bandeira de cartão (regex de validação, etc)
34
+
35
+ - [**customer**](#customer): Recursos para autenticação, cadastro, endereços, pedidos, newsletter, avaliações e histórico do cliente.
36
+ - addNewsletter: Inscreve na newsletter da loja por email e name
37
+ - deleteNewsletter: Remove inscrição na newsletter (apenas cliente logado)
38
+ - createProductReview: Avalia um produto (apenas clientes logado)
39
+ - listProductReview: Listagem paginada de todas avaliações do produto
40
+ - listStoreReview: Listagem paginada de todas avaliações da loja
41
+ - createInterest: Cria uma solicitação de interesse em um produto fora de estoque
42
+ - changePasswordByAuthenticated: Alteração de senha com cliente autenticado
43
+ - changePasswordByCode: Alteração de senha através de código enviado por e-mail
44
+ - check: Verifica existencia de cliente com base no e-mail ou documento
45
+ - listAddress: Listagem de endereços do cliente logado
46
+ - createAddress: Cria novo endereço do cliente logado
47
+ - deleteAddress: Remove um endereço do cliente logado
48
+ - updateAddress: Atualiza endereço do cliente logado
49
+ - updatePrimaryAddress: Define um endereço como principal
50
+ - detail: Detalhes do cliente logado
51
+ - passwordRecovery: Recuperação de senha
52
+ - signinByDocument: Login por documento
53
+ - signinByEmail: Login por e-mail
54
+ - signup: Cadastro de novo cliente
55
+ - update: Atualiza dados do cliente
56
+ - loggout: Logout
57
+ - detailOrderGroup: Detalhes de pedido
58
+ - listOrderGroups: Lista pedidos
59
+ - listOrderItemHistory: Exibe o histórico de atualizações do pedido
60
+ - listCustomerHistory: Exibe o histórico de atualizações do cliente (senha, endereço, etc.)
61
+ - listCustomerReview: Lista avaliações do cliente em produto
62
+ - listWalletTransaction: Lista transações da carteira
63
+ - claimGiftCard: Resgata gift card
64
+
65
+ - [**customization**](#customization): Listagem de banners, vitrines e menus customizados.
66
+ - listShowcase: Lista detalhes de vitrines
67
+ - listBanners: Lista detalhes de banners
68
+ - listMenu: Lista detalhes de menus
69
+ - listTemplateSettings: Lista as configurações de settings e apps da loja com base na URI
70
+
71
+ - [**product**](#product): Consulta de marcas, variações, busca, comentários e informações de produtos.
72
+ - listBrands: Listagem de marcas ativas
73
+ - listVariation: Lista variações de um produto
74
+ - getUrl: Consulta URL de produto (categorias, institucionais, detalhe de produto, etc.)
75
+ - getSearch: Pesquisa produtos por termo
76
+ - listShipmentQuoteProduct: Lista opções frete com base em um produto
77
+ - deleteProductComment: Remove um comentário no produto
78
+ - createProductComment: Adiciona um comentário no produto
79
+ - listProductComments: Lista comentários de produto
80
+
81
+ - [**promotional**](#promotional): Ofertas, cupons, carteiras e pontos promocionais.
82
+ - listPairOffers: Lista ofertas em pares de um produto (compre junto)
83
+ - addCoupon: Adiciona cupom no carrinho
84
+ - deleteCoupon: Remove cupom no carrinho
85
+ - applyWallet: Aplica carteira saldo da carteira no carrinho
86
+ - deleteWallet: Remove carteira saldo da carteira no carrinho
87
+ - applyPoint: Aplica saldo de pontos no carrinho
88
+ - deletePoint: Remove saldo de pontos no carrinho
89
+
90
+ ---
91
+
92
+ ## Exemplos de Uso por Escopo
93
+
94
+ ### [cart](#cart)
95
+ ```ts
96
+ import publicApi from '../../api';
97
+
98
+ // Listar detalhes do carrinho
99
+ await publicApi.cart.listDetail(): CartResponse;
100
+
101
+ // Adiciona produto ao carrinho
102
+ await publicApi.cart.addProduct(
103
+ payload: UpsertCartRequest
104
+ ): CartResponse;
105
+
106
+ // Remover um ou varios produtos do carrinho
107
+ await publicApi.cart.deleteProduct(
108
+ payload: DeleteCartRequest
109
+ ): CartResponse;
110
+
111
+ // Adiciona ou atualiza a quantidade do produto no carrinho
112
+ await publicApi.cart.upsertProduct(
113
+ payload: UpsertCartRequest
114
+ ): CartResponse;
115
+
116
+ // Retorna opções de frete no contexto do carrinho
117
+ await publicApi.cart.shipmentQuote(
118
+ payload: ShipmentQuoteCartRequest
119
+ ): CartResponse;
120
+
121
+ // Seleciona uma opção de frete no contexto do carrinho.
122
+ await publicApi.cart.selectShipment(
123
+ payload: SelectShipimentRequest
124
+ ): CartResponse;
125
+
126
+ // Aplica endereço no contexto do carrinho.
127
+ await publicApi.cart.applyAddresses(
128
+ payload: AddressesToCartRequest
129
+ ): CartResponse;
130
+
131
+ // Lista as opções de pagamento no contexto do carrinho.
132
+ await publicApi.cart.listPayments(): PaymentResponse;
133
+
134
+ // Informa as condições do pagamento, para verificar condições do mix de pagamento
135
+ await publicApi.cart.paymentConditions(
136
+ payload: PaymentConditionsRequest
137
+ ): PaymentConditionsResponse;
138
+ ```
139
+
140
+ ### [common](#common)
141
+ ```ts
142
+ import publicApi from '../../api';
143
+
144
+ // Consultar CEP
145
+ await publicApi.common.listZipcode(zipcode: string): ZipcodeResponse;
146
+
147
+ // Retorna dados complementares de cada pais
148
+ await publicApi.common.listContries(): Array<CountryResponse>;
149
+
150
+ // Retorna os detalhes de um pais
151
+ await publicApi.common.countryDetail(code: CountryAlpha3): CountryResponse;
152
+
153
+ // Retorna dados utilitários sobre cada bandeira de cartão
154
+ await publicApi.common.listCardFlags(): CardFlags;
155
+ ```
156
+
157
+ ### [customer](#customer)
158
+ ```ts
159
+ import publicApi from '../../api';
160
+
161
+ // Inscreve na newsletter da loja por email e name
162
+ await publicApi.customer.addNewsletter(): CustomerOrderResponse;
163
+
164
+ // Remove inscrição na newsletter (apenas clientes logado)
165
+ await publicApi.customer.deleteNewsletter(): CustomerOrderResponse;
166
+
167
+ // Avalia um produto (apenas clientes logado)
168
+ await publicApi.customer.createProductReview(
169
+ productId: number,
170
+ payload: ProductReviewRequest,
171
+ ): ProductReviewResponse;
172
+
173
+ // Listagem paginada de todas avaliações do produto
174
+ await publicApi.customer.listProductReview(
175
+ options?: Pick<
176
+ ApiParams<ReviewFields, ReviewSortFields, ReviewConditionFields>,
177
+ 'condition' | 'order' | 'fields' | 'limit' | 'offset'
178
+ >
179
+ ): ProductReviewResponse;
180
+
181
+ // Listagem paginada de todas avaliações da loja
182
+ await publicApi.customer.listStoreReview(): ProductReviewResponse;
183
+
184
+ //
185
+ await publicApi.customer.createInterest(
186
+ payload: RequestInterest
187
+ ): ResponseInterest;
188
+
189
+ // Alteração de senha com cliente autenticado
190
+ await publicApi.customer.changePasswordByAuthenticated(
191
+ payload: ChangePasswordCustomerAuthenticated,
192
+ ): boolean;
193
+
194
+ // Alteração de senha através de código enviado por e-mail
195
+ await publicApi.customer.changePasswordByCode(
196
+ payload: ChangePasswordCustomerByCode
197
+ ): boolean;
198
+
199
+ // Verifica existencia de cliente com base no e-mail ou documento
200
+ await publicApi.customer.check(
201
+ payload: CheckCustomer
202
+ ): boolean;
203
+
204
+ // Listagem de endereços do cliente logado
205
+ await publicApi.customer.listAddress(): CustomerAddressesResponse;
206
+
207
+ // Cria novo endereço do cliente logado
208
+ await publicApi.customer.createAddress(
209
+ payload: UpsertCustomerAddressRequest
210
+ ): CustomerAddressResponse;
211
+
212
+ // Remove um endereço do cliente logado
213
+ await publicApi.customer.deleteAddress(
214
+ addressId: number
215
+ ): CustomerAddressResponse;
216
+
217
+ // Atualiza endereço do cliente logado
218
+ await publicApi.customer.updateAddress(
219
+ addressId: number,
220
+ payload: UpsertCustomerAddressRequest,
221
+ ): CustomerAddressResponse;
222
+
223
+ //
224
+ await publicApi.customer.updatePrimaryAddress(
225
+ addressId: number
226
+ ): CustomerAddressResponse;
227
+
228
+ //
229
+ await publicApi.customer.detail(
230
+ options?: Pick<
231
+ ApiParams<CustomerFields, CustomerSortFields, CustomerConditionFields>,
232
+ 'condition' | 'fields' | 'order'
233
+ >
234
+ ): CustomerResponse;
235
+
236
+ //
237
+ await publicApi.customer.passwordRecovery(
238
+ payload: PasswordRecoveryCustomer
239
+ ): boolean;
240
+
241
+ //
242
+ await publicApi.customer.signinByDocument(
243
+ payload: SigninCustomerByDocument
244
+ ): ResponseSigninCustomer;
245
+
246
+ //
247
+ await publicApi.customer.signinByEmail(
248
+ payload: SigninCustomerByEmail
249
+ ): ResponseSigninCustomer;
250
+
251
+ //
252
+ await publicApi.customer.signup(
253
+ payload: SignupCustomer
254
+ ): CustomerResponse;
255
+
256
+ //
257
+ await publicApi.customer.update(
258
+ payload: UpdateCustomer
259
+ ): CustomerResponse;
260
+
261
+ //
262
+ await publicApi.customer.loggout(): boolean;
263
+
264
+ //
265
+ await publicApi.customer.detailOrderGroup(
266
+ orderId: number,
267
+ options?: Pick<ApiParams<CustomerOrderGroupFields>, 'fields'>,
268
+ ): CustomerOrderResponse;
269
+
270
+ //
271
+ await publicApi.customer.listOrderGroups(
272
+ options?: Pick<
273
+ ApiParams<
274
+ CustomerOrderGroupFields,
275
+ CustomerOrderGroupSortFields,
276
+ CustomerOrderGroupConditionFields
277
+ >,
278
+ 'condition' | 'fields' | 'limit' | 'offset' | 'order'
279
+ >,
280
+ ): CustomerOrdersResponse;
281
+
282
+ //
283
+ await publicApi.customer.listOrderItemHistory(
284
+ orderId: number,
285
+ options?: Pick<
286
+ ApiParams<
287
+ '',
288
+ CustomerOrderItemHistorySortFields,
289
+ CustomerOrderItemHistoryConditionFields
290
+ >,
291
+ 'condition' | 'fields' | 'limit' | 'offset' | 'order'
292
+ >,
293
+ ): CustomerOrderItemHistoriesResponse;
294
+
295
+ //
296
+ await publicApi.customer.listCustomerHistory(
297
+ options?: Pick<
298
+ ApiParams<
299
+ '',
300
+ CustomerHistorySortFields,
301
+ CustomerHistoryConditionFields
302
+ >,
303
+ 'condition' | 'limit' | 'offset' | 'order'
304
+ >,
305
+ ): CustomerHistoryResponse;
306
+
307
+ //
308
+ await publicApi.customer.listCustomerReview(
309
+ options?: Pick<
310
+ ApiParams<
311
+ ReviewFields,
312
+ ReviewSortFields,
313
+ ReviewConditionFields
314
+ >,
315
+ 'condition' | 'order' | 'fields' | 'limit' | 'offset'
316
+ >,
317
+ ): ProductReviewResponse;
318
+
319
+ //
320
+ await publicApi.customer.listWalletTransaction(
321
+ options?: Pick<
322
+ ApiParams<
323
+ '',
324
+ WalletSortFields,
325
+ WalletConditionFields
326
+ >,
327
+ 'condition' | 'order' | 'limit' | 'offset'
328
+ >,
329
+ ): WalletTransactionResponse;
330
+
331
+ //
332
+ await publicApi.customer.claimGiftCard(
333
+ payload: ClaimGiftCardRequest
334
+ ): ClaimGiftCardResponse;
335
+ ```
336
+
337
+ ### [customization](#customization)
338
+ ```ts
339
+ import publicApi from '../../api';
340
+
341
+ // Esse método possui sobrecarga de função, permitindo uma mesma função possuir duas assinaturas.
342
+ // Retorna uma ou varias vitrines com base nos code passado como parametro
343
+ await publicApi.customization.listShowcase(codes: Array<string>): Array<Showcase>;
344
+ await publicApi.customization.listShowcase(code: string): Showcase;
345
+
346
+ // Esse método possui sobrecarga de função, permitindo uma mesma função possuir duas assinaturas.
347
+ // Esse método possui Generic AdditionalParameters usado para definir a tipagem dos parametros personalizados e dinamicos cadastrados no grupo de banner.
348
+ // Retorna uma ou varios grupos de banner com base nos code passado como parametro
349
+ await publicApi.customization.listBanners<AdditionalParameters>(codes: Array<string>): Array<Banners<AdditionalParameters>>;
350
+ await publicApi.customization.listBanners<AdditionalParameters>(code: string): Banners<AdditionalParameters>;
351
+
352
+ // Esse método possui sobrecarga de função, permitindo uma mesma função possuir duas assinaturas.
353
+ // Retorna uma ou varias vitrines com base nos code passado como parametro
354
+ await publicApi.customization.listMenu(codes: Array<string>) Array<Menu>;
355
+ await publicApi.customization.listMenu(code: string) Menu;
356
+ ```
357
+
358
+ ### [product](#product)
359
+ ```ts
360
+ import publicApi from '../../api';
361
+
362
+ // Listar marcas
363
+ await publicApi.product.listBrands(
364
+ options?: Pick<
365
+ ApiParams<BrandFields, BrandOrders, BrandConditions>,
366
+ 'condition' | 'fields' | 'offset' | 'limit' | 'order'
367
+ >
368
+ ): Brand;
369
+
370
+ // Buscar variações de um produto
371
+ await publicApi.product.listVariation(
372
+ variationData: VariationData,
373
+ options?: Pick<
374
+ ApiParams<ProductFields, ProductSortFields, ProductConditionFields>,
375
+ 'condition' | 'fields' | 'meta'
376
+ >
377
+ ): Product;
378
+
379
+ // Nesse método é necessário definir o Generic UrlType conforme a request da página que espera ser retornado, exemplo: para buscar uma página de catalogo é informamos UrlListing. Todos os tipos podem ser conferidos na documentação oficial.
380
+ // Request com dados da página (categoria, detalhe de produto, institucional, marca, etc)
381
+ await publicApi.product.getUrl<UrlType>(
382
+ path: string,
383
+ options?: Pick<
384
+ ApiParams<ProductFields, ProductOrderFields, ProductConditionFields>,
385
+ 'condition' | 'fields' | 'limit' | 'offset' | 'meta' | 'order'
386
+ >
387
+ ): UrlType;
388
+
389
+ // Retorna uma lista de produtos com base no termo de pesquisa. Pode ser usado para criar uma sugestão no header do site e também para criar uma listagem paginada de busca de produto
390
+ await publicApi.product.getSearch(
391
+ term: string,
392
+ options?: Pick<
393
+ ApiParams<ProductFields, ProductSortFields, ProductConditionFields>,
394
+ 'condition' | 'fields' | 'limit' | 'meta' | 'offset' | 'order'
395
+ >
396
+ ): Search;
397
+
398
+ // Usado para cotar frete no contexto do produto informado na requisição. Não considera produtos persistidos no carrinho.
399
+ await publicApi.product.listShipmentQuoteProduct(
400
+ payload: Pick<ApiParams, 'targetCountryCode' | 'targetZipCode' | 'items'>,
401
+ ): ShipmentQuoteProductResponse;
402
+
403
+ // Permite o cliente deletar seu comentário/pergunta realizada no produto.
404
+ await publicApi.product.deleteProductComment(
405
+ commentId: number
406
+ ): boolean;
407
+
408
+ // Permite o cliente criar um comentário/pergunta no produto.
409
+ await publicApi.product.createProductComment(
410
+ productId: number,
411
+ payload: CreateProductComment,
412
+ ): ProductComment;
413
+
414
+ // Retorna uma listagem paginada de todos os comentários do produto
415
+ await publicApi.product.listProductComments(
416
+ options?: Pick<
417
+ ApiParams<
418
+ ProductCommentFields,
419
+ ProductCommentSortFields,
420
+ ProductCommentConditionFields
421
+ >,
422
+ 'condition' | 'order' | 'limit' | 'offset' | 'fields'
423
+ >
424
+ ): ProductCommentsResponse;
425
+ ```
426
+
427
+
428
+ ### [promotional](#promotional)
429
+ ```ts
430
+ import publicApi from '../../api';
431
+
432
+ // Retorna a listagem de opções de compre junto no contexto do produto.
433
+ await publicApi.promotional.listPairOffers(
434
+ productId: number,
435
+ options?: Pick<ApiParams<ProductFields>, 'fields' | 'variationMap'>
436
+ ): PairOfferResponse;
437
+
438
+ // Adiciona cupom no contexto do carrinho.
439
+ await publicApi.promotional.addCoupon(
440
+ payload: AddCouponRequest
441
+ ): CartResponse;
442
+
443
+ // Remove cupom no contexto do carrinho.
444
+ await publicApi.promotional.deleteCoupon(): CartResponse;
445
+
446
+ // Aplica saldo em carteira como forma de desconto no contexto carrinho.
447
+ await publicApi.promotional.applyWallet(): CartResponse;
448
+
449
+ // Remove saldo em carteira aplicado no contexto do carrinho.
450
+ await publicApi.promotional.deleteWallet(): CartResponse;
451
+
452
+ // Aplica saldo de pontos como forma de desconto no contexto do carrinho.
453
+ await publicApi.promotional.applyPoint(): CartResponse;
454
+
455
+ // Remove saldo de pontos aplicado no contexto do carrinho.
456
+ await publicApi.promotional.deletePoint(): CartResponse;
457
+ ```
458
+
459
+ ## Tipos
460
+
461
+ Todos os métodos retornam dados tipados para melhor experiência com TypeScript.
462
+
463
+ ## Contribuição
464
+
465
+ Contribuições são bem-vindas! Abra uma issue ou envie um pull request.
466
+
467
+ ## Licença
468
+
469
+ ISC