@uappi/public-sdk 1.0.0 → 1.0.1

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.
@@ -1,69 +1,72 @@
1
1
  import { defineComponent, h, Fragment, onMounted } from 'vue';
2
2
 
3
- import { useTemplateStore } from '@/stores/useTemplateStore';
4
-
5
- export const CustomTheme = defineComponent({
6
- name: 'CustomTheme',
7
- setup(_, { slots }) {
8
- const templateStore = useTemplateStore();
3
+ import type { CSSVariables } from './types';
9
4
 
5
+ export const ColorTheme = defineComponent({
6
+ name: 'ColorTheme',
7
+ props: {
8
+ variables: {
9
+ type: Object as () => CSSVariables,
10
+ },
11
+ },
12
+ setup(props, { slots }) {
10
13
  function applyColors() {
11
- if (!templateStore.getTemplate?.settings.colors) return;
14
+ if (!props.variables?.colors) return;
12
15
 
13
16
  document.documentElement.style.setProperty(
14
17
  '--checkout-cta-default',
15
- templateStore.getTemplate?.settings.colors.CheckoutCTADefault,
18
+ props.variables.colors.CheckoutCTADefault,
16
19
  );
17
20
  document.documentElement.style.setProperty(
18
21
  '--checkout-cta-hover',
19
- templateStore.getTemplate?.settings.colors.CheckoutCTAHover,
22
+ props.variables.colors.CheckoutCTAHover,
20
23
  );
21
24
  document.documentElement.style.setProperty(
22
25
  '--checkout-cta-text',
23
- templateStore.getTemplate?.settings.colors.CheckoutCTAText,
26
+ props.variables.colors.CheckoutCTAText,
24
27
  );
25
28
  document.documentElement.style.setProperty(
26
29
  '--primary-cta-text',
27
- templateStore.getTemplate?.settings.colors.PrimaryCTAText,
30
+ props.variables.colors.PrimaryCTAText,
28
31
  );
29
32
  document.documentElement.style.setProperty(
30
33
  '--primary-interactive-default',
31
- templateStore.getTemplate?.settings.colors.PrimaryInteractiveDefault,
34
+ props.variables.colors.PrimaryInteractiveDefault,
32
35
  );
33
36
  document.documentElement.style.setProperty(
34
37
  '--primary-interactive-hover',
35
- templateStore.getTemplate?.settings.colors.PrimaryInteractiveHover,
38
+ props.variables.colors.PrimaryInteractiveHover,
36
39
  );
37
40
  document.documentElement.style.setProperty(
38
41
  '--primary-interactive-hover-low',
39
- templateStore.getTemplate?.settings.colors.PrimaryInteractiveHoverLow,
42
+ props.variables.colors.PrimaryInteractiveHoverLow,
40
43
  );
41
44
  document.documentElement.style.setProperty(
42
45
  '--primary-surface-disabled',
43
- templateStore.getTemplate?.settings.colors.PrimarySurfaceDisabled,
46
+ props.variables.colors.PrimarySurfaceDisabled,
44
47
  );
45
48
  document.documentElement.style.setProperty(
46
49
  '--primary-surface-low',
47
- templateStore.getTemplate?.settings.colors.PrimarySurfaceLow,
50
+ props.variables.colors.PrimarySurfaceLow,
48
51
  );
49
52
  document.documentElement.style.setProperty(
50
53
  '--primary-text-decorative',
51
- templateStore.getTemplate?.settings.colors.PrimaryTextDecorative,
54
+ props.variables.colors.PrimaryTextDecorative,
52
55
  );
53
56
  }
54
57
 
55
58
  function applyFont() {
56
- if (!templateStore.getTemplate?.settings.font) return;
59
+ if (!props.variables.font) return;
57
60
 
58
61
  const fontLink = document.createElement('link');
59
62
  fontLink.rel = 'stylesheet';
60
63
  fontLink.setAttribute('uappi-custom-font', '');
61
- fontLink.href = templateStore.getTemplate?.settings.font.link;
64
+ fontLink.href = props.variables.font.link;
62
65
  document.head.appendChild(fontLink);
63
66
 
64
67
  document.documentElement.style.setProperty(
65
68
  '--font-family',
66
- templateStore.getTemplate?.settings.font.family,
69
+ props.variables.font.family,
67
70
  );
68
71
  }
69
72
 
@@ -0,0 +1 @@
1
+ export { ColorTheme } from './ColorTheme';
@@ -0,0 +1,18 @@
1
+ export interface CSSVariables {
2
+ font?: {
3
+ family: string;
4
+ link: string;
5
+ };
6
+ colors?: {
7
+ CheckoutCTADefault: string;
8
+ CheckoutCTAHover: string;
9
+ CheckoutCTAText: string;
10
+ PrimaryCTAText: string;
11
+ PrimaryInteractiveDefault: string;
12
+ PrimaryInteractiveHover: string;
13
+ PrimaryInteractiveHoverLow: string;
14
+ PrimarySurfaceDisabled: string;
15
+ PrimarySurfaceLow: string;
16
+ PrimaryTextDecorative: string;
17
+ };
18
+ }
package/main.ts CHANGED
@@ -2,14 +2,14 @@ import Api from './modules/Api';
2
2
  import Tracking from './modules/Tracking';
3
3
 
4
4
  import { ExpandTransition } from './components/Animations';
5
- import { CustomTheme } from './components/Themes';
5
+ import { ColorTheme } from './components/ColorTheme';
6
6
 
7
7
  const components = {
8
8
  ExpandTransition,
9
- CustomTheme
9
+ ColorTheme
10
10
  }
11
11
 
12
- export default {
12
+ export {
13
13
  Api,
14
14
  Tracking,
15
15
  components
@@ -93,85 +93,85 @@ O pacote expõe os seguintes escopos, cada um agrupando recursos relacionados:
93
93
 
94
94
  ### [cart](#cart)
95
95
  ```ts
96
- import publicApi from '../../api';
96
+ import api from '../../api';
97
97
 
98
98
  // Listar detalhes do carrinho
99
- await publicApi.cart.listDetail(): CartResponse;
99
+ await api.cart.listDetail(): CartResponse;
100
100
 
101
101
  // Adiciona produto ao carrinho
102
- await publicApi.cart.addProduct(
102
+ await api.cart.addProduct(
103
103
  payload: UpsertCartRequest
104
104
  ): CartResponse;
105
105
 
106
106
  // Remover um ou varios produtos do carrinho
107
- await publicApi.cart.deleteProduct(
107
+ await api.cart.deleteProduct(
108
108
  payload: DeleteCartRequest
109
109
  ): CartResponse;
110
110
 
111
111
  // Adiciona ou atualiza a quantidade do produto no carrinho
112
- await publicApi.cart.upsertProduct(
112
+ await api.cart.upsertProduct(
113
113
  payload: UpsertCartRequest
114
114
  ): CartResponse;
115
115
 
116
116
  // Retorna opções de frete no contexto do carrinho
117
- await publicApi.cart.shipmentQuote(
117
+ await api.cart.shipmentQuote(
118
118
  payload: ShipmentQuoteCartRequest
119
119
  ): CartResponse;
120
120
 
121
121
  // Seleciona uma opção de frete no contexto do carrinho.
122
- await publicApi.cart.selectShipment(
122
+ await api.cart.selectShipment(
123
123
  payload: SelectShipimentRequest
124
124
  ): CartResponse;
125
125
 
126
126
  // Aplica endereço no contexto do carrinho.
127
- await publicApi.cart.applyAddresses(
127
+ await api.cart.applyAddresses(
128
128
  payload: AddressesToCartRequest
129
129
  ): CartResponse;
130
130
 
131
131
  // Lista as opções de pagamento no contexto do carrinho.
132
- await publicApi.cart.listPayments(): PaymentResponse;
132
+ await api.cart.listPayments(): PaymentResponse;
133
133
 
134
134
  // Informa as condições do pagamento, para verificar condições do mix de pagamento
135
- await publicApi.cart.paymentConditions(
135
+ await api.cart.paymentConditions(
136
136
  payload: PaymentConditionsRequest
137
137
  ): PaymentConditionsResponse;
138
138
  ```
139
139
 
140
140
  ### [common](#common)
141
141
  ```ts
142
- import publicApi from '../../api';
142
+ import api from '../../api';
143
143
 
144
144
  // Consultar CEP
145
- await publicApi.common.listZipcode(zipcode: string): ZipcodeResponse;
145
+ await api.common.listZipcode(zipcode: string): ZipcodeResponse;
146
146
 
147
147
  // Retorna dados complementares de cada pais
148
- await publicApi.common.listContries(): Array<CountryResponse>;
148
+ await api.common.listContries(): Array<CountryResponse>;
149
149
 
150
150
  // Retorna os detalhes de um pais
151
- await publicApi.common.countryDetail(code: CountryAlpha3): CountryResponse;
151
+ await api.common.countryDetail(code: CountryAlpha3): CountryResponse;
152
152
 
153
153
  // Retorna dados utilitários sobre cada bandeira de cartão
154
- await publicApi.common.listCardFlags(): CardFlags;
154
+ await api.common.listCardFlags(): CardFlags;
155
155
  ```
156
156
 
157
157
  ### [customer](#customer)
158
158
  ```ts
159
- import publicApi from '../../api';
159
+ import api from '../../api';
160
160
 
161
161
  // Inscreve na newsletter da loja por email e name
162
- await publicApi.customer.addNewsletter(): CustomerOrderResponse;
162
+ await api.customer.addNewsletter(): CustomerOrderResponse;
163
163
 
164
164
  // Remove inscrição na newsletter (apenas clientes logado)
165
- await publicApi.customer.deleteNewsletter(): CustomerOrderResponse;
165
+ await api.customer.deleteNewsletter(): CustomerOrderResponse;
166
166
 
167
167
  // Avalia um produto (apenas clientes logado)
168
- await publicApi.customer.createProductReview(
168
+ await api.customer.createProductReview(
169
169
  productId: number,
170
170
  payload: ProductReviewRequest,
171
171
  ): ProductReviewResponse;
172
172
 
173
173
  // Listagem paginada de todas avaliações do produto
174
- await publicApi.customer.listProductReview(
174
+ await api.customer.listProductReview(
175
175
  options?: Pick<
176
176
  ApiParams<ReviewFields, ReviewSortFields, ReviewConditionFields>,
177
177
  'condition' | 'order' | 'fields' | 'limit' | 'offset'
@@ -179,54 +179,54 @@ await publicApi.customer.listProductReview(
179
179
  ): ProductReviewResponse;
180
180
 
181
181
  // Listagem paginada de todas avaliações da loja
182
- await publicApi.customer.listStoreReview(): ProductReviewResponse;
182
+ await api.customer.listStoreReview(): ProductReviewResponse;
183
183
 
184
184
  //
185
- await publicApi.customer.createInterest(
185
+ await api.customer.createInterest(
186
186
  payload: RequestInterest
187
187
  ): ResponseInterest;
188
188
 
189
189
  // Alteração de senha com cliente autenticado
190
- await publicApi.customer.changePasswordByAuthenticated(
190
+ await api.customer.changePasswordByAuthenticated(
191
191
  payload: ChangePasswordCustomerAuthenticated,
192
192
  ): boolean;
193
193
 
194
194
  // Alteração de senha através de código enviado por e-mail
195
- await publicApi.customer.changePasswordByCode(
195
+ await api.customer.changePasswordByCode(
196
196
  payload: ChangePasswordCustomerByCode
197
197
  ): boolean;
198
198
 
199
199
  // Verifica existencia de cliente com base no e-mail ou documento
200
- await publicApi.customer.check(
200
+ await api.customer.check(
201
201
  payload: CheckCustomer
202
202
  ): boolean;
203
203
 
204
204
  // Listagem de endereços do cliente logado
205
- await publicApi.customer.listAddress(): CustomerAddressesResponse;
205
+ await api.customer.listAddress(): CustomerAddressesResponse;
206
206
 
207
207
  // Cria novo endereço do cliente logado
208
- await publicApi.customer.createAddress(
208
+ await api.customer.createAddress(
209
209
  payload: UpsertCustomerAddressRequest
210
210
  ): CustomerAddressResponse;
211
211
 
212
212
  // Remove um endereço do cliente logado
213
- await publicApi.customer.deleteAddress(
213
+ await api.customer.deleteAddress(
214
214
  addressId: number
215
215
  ): CustomerAddressResponse;
216
216
 
217
217
  // Atualiza endereço do cliente logado
218
- await publicApi.customer.updateAddress(
218
+ await api.customer.updateAddress(
219
219
  addressId: number,
220
220
  payload: UpsertCustomerAddressRequest,
221
221
  ): CustomerAddressResponse;
222
222
 
223
223
  //
224
- await publicApi.customer.updatePrimaryAddress(
224
+ await api.customer.updatePrimaryAddress(
225
225
  addressId: number
226
226
  ): CustomerAddressResponse;
227
227
 
228
228
  //
229
- await publicApi.customer.detail(
229
+ await api.customer.detail(
230
230
  options?: Pick<
231
231
  ApiParams<CustomerFields, CustomerSortFields, CustomerConditionFields>,
232
232
  'condition' | 'fields' | 'order'
@@ -234,41 +234,41 @@ await publicApi.customer.detail(
234
234
  ): CustomerResponse;
235
235
 
236
236
  //
237
- await publicApi.customer.passwordRecovery(
237
+ await api.customer.passwordRecovery(
238
238
  payload: PasswordRecoveryCustomer
239
239
  ): boolean;
240
240
 
241
241
  //
242
- await publicApi.customer.signinByDocument(
242
+ await api.customer.signinByDocument(
243
243
  payload: SigninCustomerByDocument
244
244
  ): ResponseSigninCustomer;
245
245
 
246
246
  //
247
- await publicApi.customer.signinByEmail(
247
+ await api.customer.signinByEmail(
248
248
  payload: SigninCustomerByEmail
249
249
  ): ResponseSigninCustomer;
250
250
 
251
251
  //
252
- await publicApi.customer.signup(
252
+ await api.customer.signup(
253
253
  payload: SignupCustomer
254
254
  ): CustomerResponse;
255
255
 
256
256
  //
257
- await publicApi.customer.update(
257
+ await api.customer.update(
258
258
  payload: UpdateCustomer
259
259
  ): CustomerResponse;
260
260
 
261
261
  //
262
- await publicApi.customer.loggout(): boolean;
262
+ await api.customer.loggout(): boolean;
263
263
 
264
264
  //
265
- await publicApi.customer.detailOrderGroup(
265
+ await api.customer.detailOrderGroup(
266
266
  orderId: number,
267
267
  options?: Pick<ApiParams<CustomerOrderGroupFields>, 'fields'>,
268
268
  ): CustomerOrderResponse;
269
269
 
270
270
  //
271
- await publicApi.customer.listOrderGroups(
271
+ await api.customer.listOrderGroups(
272
272
  options?: Pick<
273
273
  ApiParams<
274
274
  CustomerOrderGroupFields,
@@ -280,7 +280,7 @@ await publicApi.customer.listOrderGroups(
280
280
  ): CustomerOrdersResponse;
281
281
 
282
282
  //
283
- await publicApi.customer.listOrderItemHistory(
283
+ await api.customer.listOrderItemHistory(
284
284
  orderId: number,
285
285
  options?: Pick<
286
286
  ApiParams<
@@ -293,7 +293,7 @@ await publicApi.customer.listOrderItemHistory(
293
293
  ): CustomerOrderItemHistoriesResponse;
294
294
 
295
295
  //
296
- await publicApi.customer.listCustomerHistory(
296
+ await api.customer.listCustomerHistory(
297
297
  options?: Pick<
298
298
  ApiParams<
299
299
  '',
@@ -305,7 +305,7 @@ await publicApi.customer.listCustomerHistory(
305
305
  ): CustomerHistoryResponse;
306
306
 
307
307
  //
308
- await publicApi.customer.listCustomerReview(
308
+ await api.customer.listCustomerReview(
309
309
  options?: Pick<
310
310
  ApiParams<
311
311
  ReviewFields,
@@ -317,7 +317,7 @@ await publicApi.customer.listCustomerReview(
317
317
  ): ProductReviewResponse;
318
318
 
319
319
  //
320
- await publicApi.customer.listWalletTransaction(
320
+ await api.customer.listWalletTransaction(
321
321
  options?: Pick<
322
322
  ApiParams<
323
323
  '',
@@ -329,38 +329,38 @@ await publicApi.customer.listWalletTransaction(
329
329
  ): WalletTransactionResponse;
330
330
 
331
331
  //
332
- await publicApi.customer.claimGiftCard(
332
+ await api.customer.claimGiftCard(
333
333
  payload: ClaimGiftCardRequest
334
334
  ): ClaimGiftCardResponse;
335
335
  ```
336
336
 
337
337
  ### [customization](#customization)
338
338
  ```ts
339
- import publicApi from '../../api';
339
+ import api from '../../api';
340
340
 
341
341
  // Esse método possui sobrecarga de função, permitindo uma mesma função possuir duas assinaturas.
342
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;
343
+ await api.customization.listShowcase(codes: Array<string>): Array<Showcase>;
344
+ await api.customization.listShowcase(code: string): Showcase;
345
345
 
346
346
  // Esse método possui sobrecarga de função, permitindo uma mesma função possuir duas assinaturas.
347
347
  // Esse método possui Generic AdditionalParameters usado para definir a tipagem dos parametros personalizados e dinamicos cadastrados no grupo de banner.
348
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>;
349
+ await api.customization.listBanners<AdditionalParameters>(codes: Array<string>): Array<Banners<AdditionalParameters>>;
350
+ await api.customization.listBanners<AdditionalParameters>(code: string): Banners<AdditionalParameters>;
351
351
 
352
352
  // Esse método possui sobrecarga de função, permitindo uma mesma função possuir duas assinaturas.
353
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;
354
+ await api.customization.listMenu(codes: Array<string>) Array<Menu>;
355
+ await api.customization.listMenu(code: string) Menu;
356
356
  ```
357
357
 
358
358
  ### [product](#product)
359
359
  ```ts
360
- import publicApi from '../../api';
360
+ import api from '../../api';
361
361
 
362
362
  // Listar marcas
363
- await publicApi.product.listBrands(
363
+ await api.product.listBrands(
364
364
  options?: Pick<
365
365
  ApiParams<BrandFields, BrandOrders, BrandConditions>,
366
366
  'condition' | 'fields' | 'offset' | 'limit' | 'order'
@@ -368,7 +368,7 @@ await publicApi.product.listBrands(
368
368
  ): Brand;
369
369
 
370
370
  // Buscar variações de um produto
371
- await publicApi.product.listVariation(
371
+ await api.product.listVariation(
372
372
  variationData: VariationData,
373
373
  options?: Pick<
374
374
  ApiParams<ProductFields, ProductSortFields, ProductConditionFields>,
@@ -378,7 +378,7 @@ await publicApi.product.listVariation(
378
378
 
379
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
380
  // Request com dados da página (categoria, detalhe de produto, institucional, marca, etc)
381
- await publicApi.product.getUrl<UrlType>(
381
+ await api.product.getUrl<UrlType>(
382
382
  path: string,
383
383
  options?: Pick<
384
384
  ApiParams<ProductFields, ProductOrderFields, ProductConditionFields>,
@@ -387,7 +387,7 @@ await publicApi.product.getUrl<UrlType>(
387
387
  ): UrlType;
388
388
 
389
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(
390
+ await api.product.getSearch(
391
391
  term: string,
392
392
  options?: Pick<
393
393
  ApiParams<ProductFields, ProductSortFields, ProductConditionFields>,
@@ -396,23 +396,23 @@ await publicApi.product.getSearch(
396
396
  ): Search;
397
397
 
398
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(
399
+ await api.product.listShipmentQuoteProduct(
400
400
  payload: Pick<ApiParams, 'targetCountryCode' | 'targetZipCode' | 'items'>,
401
401
  ): ShipmentQuoteProductResponse;
402
402
 
403
403
  // Permite o cliente deletar seu comentário/pergunta realizada no produto.
404
- await publicApi.product.deleteProductComment(
404
+ await api.product.deleteProductComment(
405
405
  commentId: number
406
406
  ): boolean;
407
407
 
408
408
  // Permite o cliente criar um comentário/pergunta no produto.
409
- await publicApi.product.createProductComment(
409
+ await api.product.createProductComment(
410
410
  productId: number,
411
411
  payload: CreateProductComment,
412
412
  ): ProductComment;
413
413
 
414
414
  // Retorna uma listagem paginada de todos os comentários do produto
415
- await publicApi.product.listProductComments(
415
+ await api.product.listProductComments(
416
416
  options?: Pick<
417
417
  ApiParams<
418
418
  ProductCommentFields,
@@ -427,33 +427,33 @@ await publicApi.product.listProductComments(
427
427
 
428
428
  ### [promotional](#promotional)
429
429
  ```ts
430
- import publicApi from '../../api';
430
+ import api from '../../api';
431
431
 
432
432
  // Retorna a listagem de opções de compre junto no contexto do produto.
433
- await publicApi.promotional.listPairOffers(
433
+ await api.promotional.listPairOffers(
434
434
  productId: number,
435
435
  options?: Pick<ApiParams<ProductFields>, 'fields' | 'variationMap'>
436
436
  ): PairOfferResponse;
437
437
 
438
438
  // Adiciona cupom no contexto do carrinho.
439
- await publicApi.promotional.addCoupon(
439
+ await api.promotional.addCoupon(
440
440
  payload: AddCouponRequest
441
441
  ): CartResponse;
442
442
 
443
443
  // Remove cupom no contexto do carrinho.
444
- await publicApi.promotional.deleteCoupon(): CartResponse;
444
+ await api.promotional.deleteCoupon(): CartResponse;
445
445
 
446
446
  // Aplica saldo em carteira como forma de desconto no contexto carrinho.
447
- await publicApi.promotional.applyWallet(): CartResponse;
447
+ await api.promotional.applyWallet(): CartResponse;
448
448
 
449
449
  // Remove saldo em carteira aplicado no contexto do carrinho.
450
- await publicApi.promotional.deleteWallet(): CartResponse;
450
+ await api.promotional.deleteWallet(): CartResponse;
451
451
 
452
452
  // Aplica saldo de pontos como forma de desconto no contexto do carrinho.
453
- await publicApi.promotional.applyPoint(): CartResponse;
453
+ await api.promotional.applyPoint(): CartResponse;
454
454
 
455
455
  // Remove saldo de pontos aplicado no contexto do carrinho.
456
- await publicApi.promotional.deletePoint(): CartResponse;
456
+ await api.promotional.deletePoint(): CartResponse;
457
457
  ```
458
458
 
459
459
  ## Tipos
@@ -1,4 +1,4 @@
1
- import { usePublicApi } from '../usePublicApi';
1
+ import { usePublicApi } from '..';
2
2
 
3
3
  import type {
4
4
  ApiParams,
@@ -0,0 +1,40 @@
1
+ <script setup lang="ts">
2
+ import api from '../../Api';
3
+
4
+ import { Props } from './types';
5
+
6
+ const props = defineProps<Props>();
7
+
8
+ async function oauth() {
9
+ await api.thirdParty
10
+ .oauthRedirect('google-login', {
11
+ loginUrl: `${window.location.origin}${props.uri}/signin`,
12
+ registerUrl: `${window.location.origin}${props.uri}/signup`,
13
+ })
14
+ .then(data => {
15
+ const specs = `
16
+ width=500,
17
+ height=600,
18
+ left=${window.screenX + (window.innerWidth - 500) / 2},
19
+ top=${window.screenY + (window.innerHeight - 600) / 2},
20
+ menubar=no,
21
+ toolbar=no,
22
+ location=no,
23
+ status=no,
24
+ resizable=yes,
25
+ scrollbars=yes
26
+ `;
27
+
28
+ window.open(data, '_self', specs);
29
+ });
30
+ }
31
+ </script>
32
+
33
+ <template>
34
+ <button class="facebook-auth--sign-in" @click="oauth">
35
+ <img src="./img/facebook-icon.svg" width="10" height="20" />
36
+ Continuar com o Facebook
37
+ </button>
38
+ </template>
39
+
40
+ <style scoped src="./styles.scoped.css" />
@@ -0,0 +1,10 @@
1
+ <svg width="10" height="20" viewBox="0 0 10 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_7763_7415)">
3
+ <path d="M2.97111 20C2.97017 19.947 2.96875 19.8937 2.96875 19.8407C2.96875 16.8994 2.96781 13.9581 2.97158 11.0168C2.97158 10.8938 2.94517 10.8622 2.82513 10.8629C1.92517 10.8688 1.02521 10.8646 0.125253 10.8683C0.029975 10.8688 2.35547e-05 10.8465 0.000495231 10.7421C0.00426864 9.64575 0.00426864 8.54937 0.000495231 7.45323C2.35547e-05 7.34669 0.0233715 7.316 0.129027 7.31649C1.03299 7.32116 1.93672 7.31747 2.84069 7.32165C2.94305 7.32214 2.97205 7.29734 2.97158 7.18712C2.9671 6.31585 2.96403 5.44435 2.97135 4.57308C2.97819 3.75779 3.11521 2.96877 3.47321 2.23523C4.01045 1.1337 4.88045 0.471596 6.0179 0.166936C6.62165 0.00490947 7.23647 -0.0115387 7.85461 0.00515495C8.52627 0.0230761 9.19747 0.0510625 9.86701 0.116119C9.97172 0.126184 10.0005 0.160062 10 0.270044C9.99554 1.24368 9.99554 2.21731 10 3.19095C10.0005 3.29626 9.97125 3.31738 9.87574 3.31664C9.31774 3.31173 8.75975 3.31394 8.20152 3.31443C7.98903 3.31443 7.77725 3.32769 7.56877 3.37384C6.92446 3.51647 6.60066 3.89233 6.52896 4.57431C6.50868 4.76604 6.50514 4.95777 6.50538 5.15C6.50585 5.83321 6.5075 6.51642 6.50349 7.19939C6.50302 7.29562 6.52707 7.32189 6.61999 7.3214C7.66146 7.31796 8.70292 7.32066 9.74414 7.31674C9.84767 7.31625 9.87715 7.33589 9.86253 7.45102C9.7215 8.55354 9.58519 9.6568 9.45217 10.7603C9.44085 10.8548 9.40312 10.8678 9.32435 10.8676C8.42439 10.8651 7.52443 10.8671 6.62448 10.8644C6.54028 10.8644 6.50302 10.8745 6.50302 10.98C6.50608 13.9662 6.50561 16.9527 6.50561 19.9389C6.50561 19.9592 6.50726 19.9796 6.50821 20H2.97111Z" fill="#FEFEFE"/>
4
+ </g>
5
+ <defs>
6
+ <clipPath id="clip0_7763_7415">
7
+ <rect width="10" height="20" fill="white"/>
8
+ </clipPath>
9
+ </defs>
10
+ </svg>
@@ -0,0 +1,14 @@
1
+ .facebook-auth--sign-in {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ gap: 10px;
6
+ height: 40px;
7
+ width: 100%;
8
+ border-radius: 4px;
9
+ background-color: #3B5998;
10
+
11
+ font-weight: 500;
12
+ font-size: 14px;
13
+ color: #FFF;
14
+ }
@@ -0,0 +1,3 @@
1
+ export interface Props {
2
+ uri: string;
3
+ }
@@ -0,0 +1,40 @@
1
+ <script setup lang="ts">
2
+ import api from '../../Api';
3
+
4
+ import { Props } from './types';
5
+
6
+ const props = defineProps<Props>();
7
+
8
+ async function oauth() {
9
+ await api.thirdParty
10
+ .oauthRedirect('google-login', {
11
+ loginUrl: `${window.location.origin}${props.uri}/signin`,
12
+ registerUrl: `${window.location.origin}${props.uri}/signup`,
13
+ })
14
+ .then(data => {
15
+ const specs = `
16
+ width=500,
17
+ height=600,
18
+ left=${window.screenX + (window.innerWidth - 500) / 2},
19
+ top=${window.screenY + (window.innerHeight - 600) / 2},
20
+ menubar=no,
21
+ toolbar=no,
22
+ location=no,
23
+ status=no,
24
+ resizable=yes,
25
+ scrollbars=yes
26
+ `;
27
+
28
+ window.open(data, '_self', specs);
29
+ });
30
+ }
31
+ </script>
32
+
33
+ <template>
34
+ <button class="google-auth--sign-in" @click="oauth">
35
+ <img src="./img/google-icon.svg" width="20" height="20" />
36
+ Continuar com o Google
37
+ </button>
38
+ </template>
39
+
40
+ <style scoped src="./styles.scoped.css" />
@@ -0,0 +1,18 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_8027_1418)">
3
+ <mask id="mask0_8027_1418" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="20" height="20">
4
+ <path d="M20 0H0V20H20V0Z" fill="white"/>
5
+ </mask>
6
+ <g mask="url(#mask0_8027_1418)">
7
+ <path d="M19.6 10.2297C19.6 9.51969 19.54 8.83969 19.42 8.17969H10V12.0497H15.38C15.15 13.2997 14.44 14.3597 13.38 15.0697V17.5797H16.61C18.5 15.8397 19.59 13.2797 19.59 10.2297H19.6Z" fill="#4285F4"/>
8
+ <path d="M9.99957 20.0004C12.6996 20.0004 14.9596 19.1004 16.6196 17.5804L13.3896 15.0704C12.4896 15.6704 11.3496 16.0204 9.99957 16.0204C7.39957 16.0204 5.18957 14.2604 4.39957 11.9004H1.05957V14.4904C2.70957 17.7604 6.08957 20.0004 9.99957 20.0004Z" fill="#34A853"/>
9
+ <path d="M4.4 11.8998C4.2 11.2998 4.09 10.6598 4.09 9.99977C4.09 9.33977 4.2 8.69977 4.4 8.09977V5.50977H1.06C0.38 6.85977 0 8.38977 0 9.99977C0 11.6098 0.39 13.1398 1.06 14.4898L4.4 11.8998Z" fill="#FBBC04"/>
10
+ <path d="M9.99957 3.9798C11.4696 3.9798 12.7896 4.4798 13.8196 5.4798L16.6896 2.6098C14.9596 0.999799 12.6896 0.00979897 9.99957 0.00979897C6.08957 -0.000201028 2.70957 2.2398 1.05957 5.5098L4.39957 8.0998C5.18957 5.7398 7.38957 3.9798 9.99957 3.9798Z" fill="#E94235"/>
11
+ </g>
12
+ </g>
13
+ <defs>
14
+ <clipPath id="clip0_8027_1418">
15
+ <rect width="20" height="20" fill="white"/>
16
+ </clipPath>
17
+ </defs>
18
+ </svg>
@@ -0,0 +1,14 @@
1
+ .google-auth--sign-in {
2
+ display: flex;
3
+ justify-content: center;
4
+ align-items: center;
5
+ gap: 10px;
6
+ margin: 0;
7
+ width: 100%;
8
+ height: 44px;
9
+ border-radius: 4px;
10
+
11
+ font: var(--button);
12
+ border: 1px solid var(--neutral-border);
13
+ background-color: var(--neutral-surface-low);
14
+ }
@@ -0,0 +1,3 @@
1
+ export interface Props {
2
+ uri: string;
3
+ }
@@ -1,4 +1,4 @@
1
- import publicApi from '../../Api';
1
+ import api from '../../Api';
2
2
 
3
3
  import { viewPromotion } from '../events/views/viewPromotion';
4
4
 
@@ -16,7 +16,7 @@ export function listBanners<AdditionalParameters = []>(
16
16
  codes: Array<string> | string,
17
17
  ) {
18
18
  if (Array.isArray(codes)) {
19
- return publicApi.customization
19
+ return api.customization
20
20
  .listBanners<AdditionalParameters>(codes)
21
21
  .then(data => {
22
22
  viewPromotion<AdditionalParameters>(data);
@@ -24,7 +24,7 @@ export function listBanners<AdditionalParameters = []>(
24
24
  });
25
25
  }
26
26
 
27
- return publicApi.customization
27
+ return api.customization
28
28
  .listBanners<AdditionalParameters>([codes])
29
29
  .then(data => {
30
30
  viewPromotion(data);
@@ -1,4 +1,4 @@
1
- import publicApi from '../../Api';
1
+ import api from '../../Api';
2
2
 
3
3
  import { addShippingInfoAction } from '../events/actions/addShippingInfo';
4
4
  import { addToCartAction } from '../events/actions/addToCart';
@@ -18,20 +18,20 @@ import type {
18
18
  } from '../../Api/types';
19
19
 
20
20
  export function listDetail() {
21
- return publicApi.cart.listDetail().then(data => {
21
+ return api.cart.listDetail().then(data => {
22
22
  return data;
23
23
  });
24
24
  }
25
25
 
26
26
  export function addProduct(payload: UpsertTrackingCartRequest) {
27
- return publicApi.cart.addProduct(payload as UpsertCartRequest).then(data => {
27
+ return api.cart.addProduct(payload as UpsertCartRequest).then(data => {
28
28
  addToCartAction(payload, data);
29
29
  return data;
30
30
  });
31
31
  }
32
32
 
33
33
  export function upsertProduct(payload: UpsertTrackingCartRequest) {
34
- return publicApi.cart
34
+ return api.cart
35
35
  .upsertProduct(payload as UpsertCartRequest)
36
36
  .then(data => {
37
37
  upsertToCartAction(payload, data);
@@ -43,21 +43,21 @@ export function deleteProduct(
43
43
  payload: DeleteCartRequest,
44
44
  oldCartResponse: CartResponse,
45
45
  ) {
46
- return publicApi.cart.deleteProduct(payload).then(data => {
46
+ return api.cart.deleteProduct(payload).then(data => {
47
47
  removeFromCartAction(payload, data, oldCartResponse);
48
48
  return data;
49
49
  });
50
50
  }
51
51
 
52
52
  export function selectShipment(payload: SelectShipimentRequest) {
53
- return publicApi.cart.selectShipment(payload).then(data => {
53
+ return api.cart.selectShipment(payload).then(data => {
54
54
  addShippingInfoAction(data);
55
55
  return data;
56
56
  });
57
57
  }
58
58
 
59
59
  export function shipmentQuote(payload: ShipmentQuoteCartRequest) {
60
- return publicApi.cart.shipmentQuote(payload).then(data => {
60
+ return api.cart.shipmentQuote(payload).then(data => {
61
61
  shippingCalculationAction();
62
62
  return data;
63
63
  });
@@ -68,7 +68,7 @@ export function buy(
68
68
  paymentMethod: string,
69
69
  cartResponse: CartResponse,
70
70
  ) {
71
- return publicApi.cart.buy(payload).then(data => {
71
+ return api.cart.buy(payload).then(data => {
72
72
  purchaseAction(paymentMethod, cartResponse);
73
73
  return data;
74
74
  });
@@ -1,4 +1,4 @@
1
- import publicApi from '../../Api';
1
+ import api from '../../Api';
2
2
 
3
3
  import { shippingCalculationAction } from '../events/actions/shippingCalculation';
4
4
 
@@ -7,7 +7,7 @@ import type { ApiParams } from '../../Api/types';
7
7
  export async function listShipmentQuoteProduct(
8
8
  payload: Pick<ApiParams, 'targetCountryCode' | 'targetZipCode' | 'items'>,
9
9
  ) {
10
- return publicApi.product.listShipmentQuoteProduct(payload).then(data => {
10
+ return api.product.listShipmentQuoteProduct(payload).then(data => {
11
11
  shippingCalculationAction();
12
12
  return data;
13
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uappi/public-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Pacotes públicos para desenvolvimento do ecossistema Uappi",
5
5
  "main": "main.ts",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- export { CustomTheme } from './CustomTheme';