cloudcommerce 0.1.5 → 0.1.7

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 (108) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/ecomplus-stores/monocard/functions/core/package.json +1 -1
  3. package/ecomplus-stores/monocard/functions/events/package.json +2 -2
  4. package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
  5. package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
  6. package/ecomplus-stores/monocard/functions/ssr/package.json +7 -7
  7. package/ecomplus-stores/monocard/package.json +1 -1
  8. package/ecomplus-stores/tia-sonia/functions/core/package.json +1 -1
  9. package/ecomplus-stores/tia-sonia/functions/events/package.json +2 -2
  10. package/ecomplus-stores/tia-sonia/functions/modules/package.json +2 -2
  11. package/ecomplus-stores/tia-sonia/functions/passport/package.json +2 -2
  12. package/ecomplus-stores/tia-sonia/functions/ssr/package.json +7 -7
  13. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/{acai-com-granola.jpg → hero-acai-granola.jpg} +0 -0
  14. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/{cafe-com-tapioca-e-aveia.jpg → hero-cafe-tapioca-aveia.jpg} +0 -0
  15. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/hero-piquenique-snack-cookies.jpg +0 -0
  16. package/ecomplus-stores/tia-sonia/functions/ssr/src/assets/prices.css +3 -0
  17. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/CategoriesSlider.vue +19 -0
  18. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/HeroBanner.vue +112 -0
  19. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/PitchBar.vue +48 -16
  20. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/TheHeader.vue +39 -19
  21. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderNav.vue +4 -0
  22. package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Base.astro +5 -3
  23. package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Pages.astro +2 -0
  24. package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Home.astro +55 -17
  25. package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/head-scripts.ts +15 -0
  26. package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/modules-info-preset.ts +27 -0
  27. package/ecomplus-stores/tia-sonia/package.json +1 -1
  28. package/package.json +7 -7
  29. package/packages/api/package.json +1 -1
  30. package/packages/apps/correios/package.json +2 -2
  31. package/packages/apps/custom-payment/package.json +1 -1
  32. package/packages/apps/custom-shipping/package.json +1 -1
  33. package/packages/apps/discounts/package.json +1 -1
  34. package/packages/apps/emails/package.json +1 -1
  35. package/packages/apps/fb-conversions/CHANGELOG.md +1 -0
  36. package/packages/apps/fb-conversions/README.md +1 -0
  37. package/packages/apps/fb-conversions/lib/fb-conversions-events.js +145 -0
  38. package/packages/apps/fb-conversions/lib/fb-conversions-events.js.map +1 -0
  39. package/packages/apps/fb-conversions/lib/index.js +2 -0
  40. package/packages/apps/fb-conversions/lib/index.js.map +1 -0
  41. package/packages/apps/fb-conversions/package.json +33 -0
  42. package/packages/apps/fb-conversions/src/fb-conversions-events.ts +178 -0
  43. package/packages/apps/fb-conversions/src/index.ts +1 -0
  44. package/packages/apps/fb-conversions/tsconfig.json +3 -0
  45. package/packages/apps/frenet/package.json +3 -3
  46. package/packages/apps/galaxpay/package.json +2 -2
  47. package/packages/apps/infinitepay/package.json +2 -2
  48. package/packages/apps/jadlog/package.json +2 -2
  49. package/packages/apps/loyalty-points/package.json +1 -1
  50. package/packages/apps/mercadopago/package.json +2 -2
  51. package/packages/apps/pagarme/package.json +2 -2
  52. package/packages/apps/pix/package.json +2 -2
  53. package/packages/apps/tiny-erp/package.json +2 -2
  54. package/packages/cli/package.json +1 -1
  55. package/packages/config/package.json +1 -1
  56. package/packages/emails/package.json +2 -2
  57. package/packages/events/lib/firebase.js +2 -0
  58. package/packages/events/lib/firebase.js.map +1 -1
  59. package/packages/events/package.json +2 -1
  60. package/packages/events/src/firebase.ts +2 -0
  61. package/packages/firebase/lib/config.d.ts +4 -0
  62. package/packages/firebase/lib/config.js +7 -0
  63. package/packages/firebase/lib/config.js.map +1 -1
  64. package/packages/firebase/package.json +1 -1
  65. package/packages/firebase/src/config.ts +7 -0
  66. package/packages/i18n/package.json +1 -1
  67. package/packages/modules/package.json +2 -2
  68. package/packages/passport/package.json +1 -1
  69. package/packages/ssr/package.json +4 -2
  70. package/packages/storefront/astro.config.mjs +3 -1
  71. package/packages/storefront/client.d.ts +1 -0
  72. package/packages/storefront/dist/client/HeaderButtons.6f668467.js +1 -0
  73. package/packages/storefront/dist/client/Prices.2ada125b.js +1 -0
  74. package/packages/storefront/dist/client/ProductCard.e5bdea60.js +1 -0
  75. package/packages/storefront/dist/client/assets/{_...slug_.15bda576.css → _...slug_.81b9a00c.css} +1 -1
  76. package/packages/storefront/dist/client/chunks/{HeaderButtons.1abd5bf4.js → HeaderButtons.cfa275db.js} +1 -1
  77. package/packages/storefront/dist/client/chunks/{LoginForm.7e7d6137.js → LoginForm.1ba3ad0d.js} +1 -1
  78. package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.9a6ab0d6.js +1 -0
  79. package/packages/storefront/dist/client/chunks/{_plugin-vue_export-helper.fc452b02.js → _plugin-vue_export-helper.0d33cd48.js} +1 -1
  80. package/packages/storefront/dist/client/chunks/{runtime-core.esm-bundler.b4556b35.js → runtime-core.esm-bundler.45ba83fa.js} +1 -1
  81. package/packages/storefront/dist/client/{client.2a3e5a58.js → client.4d2b3a73.js} +1 -1
  82. package/packages/storefront/dist/client/sw.js +1 -1
  83. package/packages/storefront/dist/server/entry.mjs +274 -376
  84. package/packages/storefront/package.json +6 -7
  85. package/packages/storefront/src/lib/components/Prices.vue +113 -98
  86. package/packages/storefront/src/lib/composables/use-prices.ts +19 -12
  87. package/packages/storefront/src/lib/ssr/image.ts +3 -2
  88. package/packages/storefront/src/lib/state/modules-info.ts +10 -4
  89. package/packages/types/package.json +1 -1
  90. package/ecomplus-stores/monocard/functions/ssr/.nvmrc +0 -1
  91. package/ecomplus-stores/tia-sonia/functions/ssr/.nvmrc +0 -1
  92. package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/InlineScripts.astro +0 -10
  93. package/packages/storefront/.nvmrc +0 -1
  94. package/packages/storefront/dist/client/HeaderButtons.300c19e5.js +0 -1
  95. package/packages/storefront/dist/client/Prices.6c44a513.js +0 -1
  96. package/packages/storefront/dist/client/ProductCard.69bba7fc.js +0 -1
  97. package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.e4525076.js +0 -1
  98. package/packages/storefront/dist/server/chunks/avif/avif_node_dec.wasm +0 -0
  99. package/packages/storefront/dist/server/chunks/avif/avif_node_enc.wasm +0 -0
  100. package/packages/storefront/dist/server/chunks/image-pool.abfa6f7b.mjs +0 -10794
  101. package/packages/storefront/dist/server/chunks/mozjpeg/mozjpeg_node_dec.wasm +0 -0
  102. package/packages/storefront/dist/server/chunks/mozjpeg/mozjpeg_node_enc.wasm +0 -0
  103. package/packages/storefront/dist/server/chunks/png/squoosh_oxipng_bg.wasm +0 -0
  104. package/packages/storefront/dist/server/chunks/png/squoosh_png_bg.wasm +0 -0
  105. package/packages/storefront/dist/server/chunks/resize/squoosh_resize_bg.wasm +0 -0
  106. package/packages/storefront/dist/server/chunks/rotate/rotate.wasm +0 -0
  107. package/packages/storefront/dist/server/chunks/webp/webp_node_dec.wasm +0 -0
  108. package/packages/storefront/dist/server/chunks/webp/webp_node_enc.wasm +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,36 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.7](https://github.com/ecomplus/cloud-commerce/compare/v0.1.6...v0.1.7) (2023-01-04)
6
+
7
+
8
+ ### Features
9
+
10
+ * **storefront:** New optional global `window.storefront.modulesInfoPreset` ([aa587fd](https://github.com/ecomplus/cloud-commerce/commit/aa587fd977016116b65b52847fd76121673dd464))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **deps:** update all non-major dependencies ([#101](https://github.com/ecomplus/cloud-commerce/issues/101)) ([9fcfe7c](https://github.com/ecomplus/cloud-commerce/commit/9fcfe7cfaed2a643cc19bad927d1bce42845655e))
16
+ * **storefront:** Edit `usePrices` composable to support compound discount labels ([7ae2114](https://github.com/ecomplus/cloud-commerce/commit/7ae211456949b8728857be79142d019a8653dabb))
17
+ * **storefront:** Fix `Prices` component slots binds to pass values instead of Computed/Ref objects ([951507a](https://github.com/ecomplus/cloud-commerce/commit/951507ace35fc69b96ba7387d5a557ee46a1ec06))
18
+ * **storefront:** Fix `window.storefront.modulesInfoPreset` typedef ([8bf3cc5](https://github.com/ecomplus/cloud-commerce/commit/8bf3cc53bf20c767d14915aa5f16bcd2d3bdc0e4))
19
+ * **storefront:** Fix typedef and cashback/installments handlers on `usePrices` and `Prices` ([f0bd969](https://github.com/ecomplus/cloud-commerce/commit/f0bd969cd6d646237d7c36df503d759ae1711fbf))
20
+ * **storefront:** Minor fix SSR image transform typedef to not require `alt` property ([0875cb0](https://github.com/ecomplus/cloud-commerce/commit/0875cb043bc002b765f02c04916aaa0633de605f))
21
+ * **storefront:** Remove root slot from `Prices` to support attributes inheritance ([9a0a8b0](https://github.com/ecomplus/cloud-commerce/commit/9a0a8b0246999d6cd48be2bad0896df95c944345))
22
+
23
+ ### [0.1.6](https://github.com/ecomplus/cloud-commerce/compare/v0.1.5...v0.1.6) (2022-12-29)
24
+
25
+
26
+ ### Features
27
+
28
+ * **fb-conversions:** App to send carts/orders to Facebook Conversions API ([#99](https://github.com/ecomplus/cloud-commerce/issues/99)) ([1c6a785](https://github.com/ecomplus/cloud-commerce/commit/1c6a785b194c4dda81409c6ddfd36aaeea974e5b))
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **fb-conversions:** Add `firebase-admin` (peer) to dependencies ([6a0cf07](https://github.com/ecomplus/cloud-commerce/commit/6a0cf07a267316538ce04ce637b4f30103c498cb))
34
+
5
35
  ### [0.1.5](https://github.com/ecomplus/cloud-commerce/compare/v0.1.4...v0.1.5) (2022-12-28)
6
36
 
7
37
 
@@ -15,6 +15,6 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/firebase": "^0.1.4"
18
+ "@cloudcommerce/firebase": "^0.1.6"
19
19
  }
20
20
  }
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/events": "^0.1.4",
19
- "@cloudcommerce/firebase": "^0.1.4"
18
+ "@cloudcommerce/events": "^0.1.6",
19
+ "@cloudcommerce/firebase": "^0.1.6"
20
20
  }
21
21
  }
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/firebase": "^0.1.4",
19
- "@cloudcommerce/modules": "^0.1.4"
18
+ "@cloudcommerce/firebase": "^0.1.6",
19
+ "@cloudcommerce/modules": "^0.1.6"
20
20
  }
21
21
  }
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/firebase": "^0.1.4",
19
- "@cloudcommerce/passport": "^0.1.4"
18
+ "@cloudcommerce/firebase": "^0.1.6",
19
+ "@cloudcommerce/passport": "^0.1.6"
20
20
  }
21
21
  }
@@ -13,20 +13,20 @@
13
13
  "logs": "firebase functions:log"
14
14
  },
15
15
  "engines": {
16
- "node": "16"
16
+ "node": "18"
17
17
  },
18
18
  "main": "index.js",
19
19
  "dependencies": {
20
20
  "@astrojs/image": "^0.12.1",
21
21
  "@astrojs/node": "^4.0.0",
22
- "@cloudcommerce/api": "^0.1.4",
23
- "@cloudcommerce/firebase": "^0.1.4",
24
- "@cloudcommerce/ssr": "^0.1.4"
22
+ "@cloudcommerce/api": "^0.1.6",
23
+ "@cloudcommerce/firebase": "^0.1.6",
24
+ "@cloudcommerce/ssr": "^0.1.6"
25
25
  },
26
26
  "devDependencies": {
27
- "@cloudcommerce/i18n": "^0.1.4",
28
- "@cloudcommerce/storefront": "^0.1.4",
29
- "@cloudcommerce/types": "^0.1.4",
27
+ "@cloudcommerce/i18n": "^0.1.6",
28
+ "@cloudcommerce/storefront": "^0.1.6",
29
+ "@cloudcommerce/types": "^0.1.6",
30
30
  "@iconify-json/arcticons": "^1.1.34",
31
31
  "@iconify-json/wpf": "^1.1.3",
32
32
  "lottie-web": "^5.10.0",
@@ -23,6 +23,6 @@
23
23
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
24
24
  },
25
25
  "dependencies": {
26
- "@cloudcommerce/cli": "^0.1.4"
26
+ "@cloudcommerce/cli": "^0.1.6"
27
27
  }
28
28
  }
@@ -15,6 +15,6 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/firebase": "^0.1.4"
18
+ "@cloudcommerce/firebase": "^0.1.6"
19
19
  }
20
20
  }
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/events": "^0.1.4",
19
- "@cloudcommerce/firebase": "^0.1.4"
18
+ "@cloudcommerce/events": "^0.1.6",
19
+ "@cloudcommerce/firebase": "^0.1.6"
20
20
  }
21
21
  }
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/firebase": "^0.1.4",
19
- "@cloudcommerce/modules": "^0.1.4"
18
+ "@cloudcommerce/firebase": "^0.1.6",
19
+ "@cloudcommerce/modules": "^0.1.6"
20
20
  }
21
21
  }
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/firebase": "^0.1.4",
19
- "@cloudcommerce/passport": "^0.1.4"
18
+ "@cloudcommerce/firebase": "^0.1.6",
19
+ "@cloudcommerce/passport": "^0.1.6"
20
20
  }
21
21
  }
@@ -13,20 +13,20 @@
13
13
  "logs": "firebase functions:log"
14
14
  },
15
15
  "engines": {
16
- "node": "16"
16
+ "node": "18"
17
17
  },
18
18
  "main": "index.js",
19
19
  "dependencies": {
20
20
  "@astrojs/image": "^0.12.1",
21
21
  "@astrojs/node": "^4.0.0",
22
- "@cloudcommerce/api": "^0.1.4",
23
- "@cloudcommerce/firebase": "^0.1.4",
24
- "@cloudcommerce/ssr": "^0.1.4"
22
+ "@cloudcommerce/api": "^0.1.6",
23
+ "@cloudcommerce/firebase": "^0.1.6",
24
+ "@cloudcommerce/ssr": "^0.1.6"
25
25
  },
26
26
  "devDependencies": {
27
- "@cloudcommerce/i18n": "^0.1.4",
28
- "@cloudcommerce/storefront": "^0.1.4",
29
- "@cloudcommerce/types": "^0.1.4",
27
+ "@cloudcommerce/i18n": "^0.1.6",
28
+ "@cloudcommerce/storefront": "^0.1.6",
29
+ "@cloudcommerce/types": "^0.1.6",
30
30
  "@fontsource/dm-serif-text": "^4.5.9",
31
31
  "@fontsource/roboto-condensed": "^4.5.9",
32
32
  "@iconify-json/tabler": "^1.1.53"
@@ -0,0 +1,3 @@
1
+ [data-sf-prices-discount] {
2
+ @apply text-secondary-800 font-bold;
3
+ }
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ import type { Categories } from '@cloudcommerce/types';
3
+
4
+ export interface Props {
5
+ categories: Partial<Categories>[],
6
+ }
7
+
8
+ defineProps<Props>();
9
+ </script>
10
+
11
+ <template>
12
+ <nav class="CategoriesSlider">
13
+ <ul role="list">
14
+ <li v-for="(category, i) in categories" :key="i">
15
+ {{ category.name }}
16
+ </li>
17
+ </ul>
18
+ </nav>
19
+ </template>
@@ -0,0 +1,112 @@
1
+ <script setup lang="ts">
2
+ import type { Products } from '@cloudcommerce/types';
3
+ import { ref } from 'vue';
4
+ import { useElementHover } from '@vueuse/core';
5
+ import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue';
6
+ import Prices from '@@components/Prices.vue';
7
+
8
+ export interface Props {
9
+ pointers?: Array<{
10
+ product: Partial<Products> & { price: number },
11
+ position: {
12
+ x: number,
13
+ y: number,
14
+ },
15
+ }>,
16
+ blogPost?: {
17
+ title: string,
18
+ link: string,
19
+ description: string,
20
+ }
21
+ }
22
+
23
+ defineProps<Props>();
24
+ const postLink = ref<HTMLElement>(null);
25
+ const isPostLinkHovered = useElementHover(postLink);
26
+ </script>
27
+
28
+ <template>
29
+ <div class="relative">
30
+ <slot />
31
+ <Popover
32
+ v-for="{ product, position } in pointers"
33
+ :key="product.sku" class="z-20"
34
+ v-slot="{ open }"
35
+ >
36
+ <PopoverButton
37
+ class="absolute outline-none"
38
+ :style="{
39
+ top: `${position.y}%`,
40
+ left: `${position.x}%`,
41
+ }"
42
+ >
43
+ <span class="flex h-4 w-4">
44
+ <span
45
+ v-if="!open"
46
+ class="animate-ping absolute inline-flex h-full w-full
47
+ bg-primary opacity-75 rounded-full motion-reduce:hidden"
48
+ ></span>
49
+ <span
50
+ class="relative inline-flex h-4 w-4 rounded-full"
51
+ :class="open ? 'bg-primary/90' : 'bg-primary/50'"
52
+ ></span>
53
+ <Fade>
54
+ <PopoverPanel
55
+ class="absolute top-5 z-30"
56
+ :class="position.x > 55 ? 'right-0 text-right' : 'left-0 text-left'"
57
+ >
58
+ <article class="bg-white/80 rounded-sm w-60 py-2 px-3 leading-snug">
59
+ <div class="truncate text-sm mb-1">
60
+ <a
61
+ :href="product.slug"
62
+ :title="product.name"
63
+ class="underline decoration-dashed"
64
+ >
65
+ {{ product.name }}
66
+ </a>
67
+ </div>
68
+ <Prices :product="product"/>
69
+ <button class="bg-success-600 text-white hover:bg-success-700
70
+ rounded px-2 py-1 mt-1 mr-2 text-sm uppercase font-bold">
71
+ <i class="i-shopping-cart-plus"></i>
72
+ Comprar
73
+ </button>
74
+ <button class="bg-success-500 text-white hover:bg-success-700
75
+ rounded px-2 py-1 mt-1 text-sm uppercase font-bold">
76
+ <span class="text-xs">kit com</span> 3
77
+ <span class="bg-success-100 text-success-800
78
+ text-xs px-1 ml-1 rounded-full">
79
+ -5%
80
+ </span>
81
+ </button>
82
+ </article>
83
+ </PopoverPanel>
84
+ </Fade>
85
+ </span>
86
+ </PopoverButton>
87
+ </Popover>
88
+ <a
89
+ v-if="blogPost"
90
+ class="absolute bottom-0 left-0 w-full pb-3 px-7 z-10
91
+ hover:bg-white/70 transition-colors"
92
+ :href="blogPost.link"
93
+ ref="postLink"
94
+ >
95
+ <article class="prose">
96
+ <h3
97
+ class="font-brand mb-1 bg-secondary/90 rounded-sm text-white
98
+ inline-block px-3 py-2"
99
+ style="--un-prose-links: var(--c-primary)"
100
+ v-html="blogPost.title"
101
+ ></h3>
102
+ <p
103
+ class="text-secondary text-lg"
104
+ :class="isPostLinkHovered
105
+ ? 'my-3 xl:text-xl'
106
+ : 'my-1 underline decoration-2 truncate'"
107
+ v-html="blogPost.description"
108
+ ></p>
109
+ </article>
110
+ </a>
111
+ </div>
112
+ </template>
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { ref, computed } from 'vue';
2
+ import { ref, computed, watch } from 'vue';
3
+ import { useTimeout, useSwipe } from '@vueuse/core';
3
4
 
4
5
  type Slide = {
5
6
  icon?: 'shipping' | 'credit-card' | 'discount' | 'cashback',
@@ -28,27 +29,55 @@ const slideIndex = ref(0);
28
29
  const slide = computed(() => {
29
30
  return slides.value[slideIndex.value];
30
31
  });
32
+ const { ready, start } = useTimeout(150, { controls: true, immediate: false });
33
+ const isToPrev = ref(false);
31
34
  const prev = () => {
32
- if (slideIndex.value) {
33
- slideIndex.value -= 1;
34
- } else {
35
- slideIndex.value = slides.value.length - 1;
36
- }
35
+ isToPrev.value = true;
36
+ start();
37
37
  };
38
38
  const next = () => {
39
- if (slideIndex.value < slides.value.length - 1) {
40
- slideIndex.value += 1;
41
- } else {
42
- slideIndex.value = 0;
43
- }
39
+ isToPrev.value = false;
40
+ start();
44
41
  };
42
+ watch(ready, (isReady) => {
43
+ if (isReady) {
44
+ if (isToPrev.value) {
45
+ if (slideIndex.value) {
46
+ slideIndex.value -= 1;
47
+ } else {
48
+ slideIndex.value = slides.value.length - 1;
49
+ }
50
+ } else if (slideIndex.value < slides.value.length - 1) {
51
+ slideIndex.value += 1;
52
+ } else {
53
+ slideIndex.value = 0;
54
+ }
55
+ }
56
+ });
57
+ const slider = ref<HTMLElement>(null);
58
+ useSwipe(slider, {
59
+ onSwipeEnd(e, direction) {
60
+ if (direction === 'LEFT') next();
61
+ else if (direction === 'RIGHT') prev();
62
+ },
63
+ });
45
64
  </script>
46
65
 
47
66
  <template>
48
- <div class="PitchBar w-full p-2 bg-white/60 leading-snug">
49
- <div class="flex justify-between items-center max-w-4xl m-auto">
50
- <button class="i-chevron-left text-2xl text-base-600" @click="prev"></button>
51
- <div class="flex items-center gap-2 lg:gap-3 text-base-800">
67
+ <div class="PitchBar w-full px-2 py-1 bg-white/70 leading-snug">
68
+ <div class="flex justify-between items-center max-w-4xl m-auto" ref="slider">
69
+ <button
70
+ class="i-chevron-left text-2xl p-4 text-base-600 hover:text-base-800"
71
+ @click="prev"
72
+ ></button>
73
+ <div
74
+ class="flex items-center gap-2 lg:gap-3 text-base-800
75
+ transition-transform duration-300"
76
+ :class="ready ? null : {
77
+ 'motion-safe:translate-x-1/3': !isToPrev,
78
+ 'motion-safe:-translate-x-1/3': isToPrev,
79
+ }"
80
+ >
52
81
  <span v-if="slide.icon" class="text-2xl">
53
82
  <i v-if="slide.icon === 'shipping'" class="i-truck-delivery"></i>
54
83
  <i v-else-if="slide.icon === 'credit-card'" class="i-credit-card"></i>
@@ -59,7 +88,10 @@ const next = () => {
59
88
  <strong v-if="slide.title" v-html="slide.title" class="uppercase"></strong>
60
89
  <span v-html="slide.html"></span>
61
90
  </div>
62
- <button class="i-chevron-right text-2xl text-base-600" @click="next"></button>
91
+ <button
92
+ class="i-chevron-right text-2xl p-4 text-base-600 hover:text-base-800"
93
+ @click="next"
94
+ ></button>
63
95
  </div>
64
96
  </div>
65
97
  </template>
@@ -7,7 +7,7 @@ import {
7
7
  toRefs,
8
8
  onMounted,
9
9
  } from 'vue';
10
- import { useWindowScroll } from '@vueuse/core';
10
+ import { promiseTimeout, useTimeout, useWindowScroll } from '@vueuse/core';
11
11
 
12
12
  export interface Props {
13
13
  logo?: ImgHTMLAttributes;
@@ -18,30 +18,51 @@ const props = withDefaults(defineProps<Props>(), {
18
18
  logoAltHeading: 'h2',
19
19
  });
20
20
  const { logo } = toRefs(props);
21
- const { y } = useWindowScroll();
22
21
  const header = ref<HTMLElement | null>(null);
23
- const logoImg = ref<HTMLElement | null>(null);
24
- let height: number = (Number(logo.value.height) || 0) + 20;
25
- onMounted(() => {
26
- logoImg.value.onload = () => {
27
- height = header.value.offsetHeight;
28
- };
22
+ const logoImg = ref<HTMLImageElement | null>(null);
23
+ const { ready, start } = useTimeout(100, { controls: true, immediate: false });
24
+ const height = ref(0);
25
+ if (!import.meta.env.SSR) {
26
+ onMounted(() => {
27
+ const fixHeight = () => {
28
+ height.value = header.value.offsetHeight;
29
+ start();
30
+ };
31
+ if (logoImg.value.complete && logoImg.value.naturalHeight !== 0) {
32
+ fixHeight();
33
+ } else {
34
+ logoImg.value.onload = fixHeight;
35
+ }
36
+ window.addEventListener('resize', fixHeight);
37
+ });
38
+ }
39
+ const { y } = useWindowScroll();
40
+ const isSticky = computed(() => ready.value && y.value > height.value * 1.5);
41
+ const transition = ref('none');
42
+ watch(isSticky, async (isSetSticky) => {
43
+ if (!isSetSticky) {
44
+ start();
45
+ transition.value = 'none';
46
+ } else {
47
+ await promiseTimeout(300);
48
+ transition.value = 'opacity var(--transition-slow), transform var(--transition)';
49
+ }
29
50
  });
30
- const isHidden = ref(false);
31
- const isSticky = computed(() => y.value > height);
51
+ const isScrollDown = ref(false);
32
52
  watch(y, (newY, oldY) => {
33
- isHidden.value = newY > 0 && newY > oldY;
53
+ isScrollDown.value = newY > 0 && newY < oldY;
34
54
  });
35
55
  </script>
36
56
 
37
57
  <template>
58
+ <div :style="isSticky ? `height: ${height}px` : null"></div>
38
59
  <header
39
- class="TheHeader z-50 sticky top-0"
40
- :class="[
41
- isHidden ? 'opacity-0 -translate-y-full' : null,
42
- isSticky ? 'bg-white/80 backdrop-blur-md shadow' : null,
43
- ]"
44
- style="transition: opacity var(--transition-slow), transform var(--transition)"
60
+ class="TheHeader z-50 top-0 overflow-auto will-change-transform"
61
+ :class="{
62
+ 'sticky bg-white/80 backdrop-blur-md shadow': isSticky,
63
+ 'opacity-0 -translate-y-full': isSticky && !isScrollDown,
64
+ }"
65
+ :style="{ transition }"
45
66
  ref="header"
46
67
  >
47
68
  <div
@@ -125,8 +146,7 @@ watch(y, (newY, oldY) => {
125
146
  <ul class="flex items-center gap-2 md:gap-3 text-sm">
126
147
  <li>
127
148
  <a
128
- class="text-on-primary font-bold uppercase rounded px-4 py-2"
129
- :class="isSticky ? 'bg-primary' : 'bg-primary/80'"
149
+ class="primary hover:bg-primary-300 font-bold uppercase rounded px-4 py-2"
130
150
  href="#"
131
151
  >
132
152
  <i class="i-chevron-down mr-1"></i> Produtos
@@ -5,6 +5,10 @@
5
5
  </a>
6
6
  <a href="#" class="text-primary-800 hover:text-primary-900">
7
7
  Promoções
8
+ <span class="relative rounded px-2 py-1 ml-1
9
+ bg-primary border-3 border-primary-bold">
10
+ Leve 5 pague 4
11
+ </span>
8
12
  </a>
9
13
  </nav>
10
14
  </template>
@@ -6,7 +6,7 @@ import '@fontsource/roboto-condensed';
6
6
  import '@fontsource/roboto-condensed/400-italic.css';
7
7
  import '@fontsource/roboto-condensed/700.css';
8
8
  import '@fontsource/roboto-condensed/700-italic.css';
9
- import InlineScripts from '~/scripts/InlineScripts.astro';
9
+ import '../assets/prices.css';
10
10
 
11
11
  export interface Props {
12
12
  pageContext: PageContext;
@@ -17,7 +17,9 @@ const { pageContext, title } = Astro.props as Props;
17
17
  ---
18
18
 
19
19
  <Base pageContext={pageContext} title={title}>
20
- <InlineScripts slot="before-head-end" />
20
+ <Fragment slot="before-head-end">
21
+ <script src="../scripts/head-scripts.ts"></script>
22
+ </Fragment>
21
23
  <slot />
22
24
  </Base>
23
25
 
@@ -37,7 +39,7 @@ body {
37
39
  overflow-x: hidden;
38
40
  background-color: var(--c-brand-light-blue);
39
41
  }
40
- a {
42
+ a, button {
41
43
  transition: color var(--transition), background-color var(--transition);
42
44
  }
43
45
  </style>
@@ -23,6 +23,7 @@ const { pageContext, title } = Astro.props as Props;
23
23
  src="/img/uploads/granolas-espalhadas.png"
24
24
  alt="Granolas Tia Sônia espalhadas"
25
25
  format="webp"
26
+ quality={75}
26
27
  width={650}
27
28
  height={540}
28
29
  fetchpriority="low"
@@ -33,6 +34,7 @@ const { pageContext, title } = Astro.props as Props;
33
34
  src="/img/uploads/granolas-espalhadas.png"
34
35
  alt="Granolas Tia Sônia espalhadas"
35
36
  format="webp"
37
+ quality={75}
36
38
  width={650}
37
39
  height={540}
38
40
  fetchpriority="low"
@@ -3,33 +3,71 @@ import type { PageContext } from '@@sf/ssr-context';
3
3
  import api from '@cloudcommerce/api';
4
4
  import { Image } from '@astrojs/image/components';
5
5
  import PitchBar from '@@components/PitchBar.vue';
6
+ import HeroBanner from '@@components/HeroBanner.vue';
6
7
 
7
8
  export interface Props {
8
9
  pageContext: PageContext;
9
10
  }
10
11
 
11
- const products = (await api.get('products')).data.result;
12
+ const products = (await api.get('products?fields=name,slug,sku,price,base_price'))
13
+ .data.result;
14
+ const heroBanners = [{
15
+ src: '/img/uploads/hero-acai-granola.jpg',
16
+ alt: 'Açaí com morango, banana, manga e granola Tia Sônia',
17
+ pointers: [{
18
+ product: products.find(({ sku }) => sku === 'PA285'),
19
+ position: { x: 20, y: 35 },
20
+ }],
21
+ blogPost: {
22
+ title: 'Granola: 10 Benefícios para sua Saúde',
23
+ link: '/posts/10-beneficios-da-granola-para-a-sua-saude-2020-05-22',
24
+ description: `A granola é uma opção na alimentação saudável que acompanha a dieta
25
+ de pessoas ao redor de todo o mundo, saiba mais sobre o assunto em nosso blog!`,
26
+ }
27
+ }, {
28
+ src: '/img/uploads/hero-piquenique-snack-cookies.jpg',
29
+ alt: 'Piquenique com frutas, pães com pasta de amendoim, snacks e cookies Tia Sônia',
30
+ pointers: [{
31
+ product: products.find(({ sku }) => sku === 'PA588'),
32
+ position: { x: 21, y: 50 },
33
+ }, {
34
+ product: products.find(({ sku }) => sku === 'PA358'),
35
+ position: { x: 24, y: 80 },
36
+ }, {
37
+ product: products.find(({ sku }) => sku === 'PA352'),
38
+ position: { x: 84, y: 20 },
39
+ }, {
40
+ product: products.find(({ sku }) => sku === 'PA291'),
41
+ position: { x: 74, y: 46 },
42
+ }],
43
+ }];
44
+ const { pageContext: { apiState } } = Astro.props as Props;
12
45
  ---
13
46
 
14
47
  <section class="relative">
15
- <PitchBar class="absolute top-0 left-0" client:idle />
16
- <div class="grid grid-cols-2">
17
- <Image
18
- src="/img/uploads/acai-com-granola.jpg"
19
- alt="Açaí com morango, banana, manga e granola Tia Sônia"
20
- format={'webp'}
21
- width={1080}
22
- height={1080}
23
- />
24
- <Image
25
- src="/img/uploads/cafe-com-tapioca-e-aveia.jpg"
26
- alt="Açaí com morango, banana, manga e granola Tia Sônia"
27
- format={'webp'}
28
- width={1080}
29
- height={1080}
30
- />
48
+ <PitchBar class="absolute top-0 left-0 z-10" client:load />
49
+ <div class="bg-white grid grid-cols-2">
50
+ {heroBanners.map(({ src, alt, pointers, blogPost }) => (
51
+ <HeroBanner client:visible {pointers} {blogPost}>
52
+ <Image
53
+ src={src}
54
+ alt={alt}
55
+ format={'webp'}
56
+ quality={75}
57
+ width={1080}
58
+ height={1080}
59
+ />
60
+ </HeroBanner>
61
+ ))}
31
62
  </div>
32
63
  </section>
64
+ <section class="bg-base-100 py-9">
65
+ <ul role="list" class="mt-3 fs-20">
66
+ {apiState.categories?.map((category) => <li>
67
+ <a href={`/${category.slug}`}>{category.name} ({category.icon?.url})</a>
68
+ </li>)}
69
+ </ul>
70
+ </section>
33
71
  <article class="bg-white p-6">
34
72
  <h1 class="font-brand">
35
73
  Welcome to