cloudcommerce 0.20.2 → 0.22.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 (198) hide show
  1. package/.gitmodules +3 -0
  2. package/.nvmrc +1 -0
  3. package/.vscode/settings.json +2 -1
  4. package/CHANGELOG.md +44 -0
  5. package/action.yml +37 -13
  6. package/ecomplus-stores/iluminim/.devcontainer/devcontainer.json +30 -0
  7. package/ecomplus-stores/iluminim/.eslintrc.cjs +3 -0
  8. package/ecomplus-stores/iluminim/.firebaserc +5 -0
  9. package/ecomplus-stores/iluminim/.github/renovate.json +5 -0
  10. package/ecomplus-stores/iluminim/.github/workflows/build-and-deploy.yml +36 -0
  11. package/ecomplus-stores/iluminim/.github/workflows/calibreapp-image-actions.yml +23 -0
  12. package/ecomplus-stores/iluminim/.gitpod.yml +12 -0
  13. package/ecomplus-stores/iluminim/.nvmrc +1 -0
  14. package/ecomplus-stores/iluminim/.vscode/extensions.json +8 -0
  15. package/ecomplus-stores/iluminim/.vscode/launch.json +11 -0
  16. package/ecomplus-stores/iluminim/.vscode/settings.json +10 -0
  17. package/ecomplus-stores/iluminim/README.md +113 -0
  18. package/ecomplus-stores/iluminim/README.pt-BR.md +113 -0
  19. package/ecomplus-stores/iluminim/functions/config.json +3 -0
  20. package/ecomplus-stores/iluminim/functions/example.env +10 -0
  21. package/ecomplus-stores/iluminim/functions/many/index.js +14 -0
  22. package/ecomplus-stores/iluminim/functions/many/package.json +22 -0
  23. package/ecomplus-stores/iluminim/functions/ssr/.eslintrc.cjs +6 -0
  24. package/ecomplus-stores/iluminim/functions/ssr/astro.config.mjs +4 -0
  25. package/ecomplus-stores/iluminim/functions/ssr/content/blog/.gitkeep +0 -0
  26. package/ecomplus-stores/iluminim/functions/ssr/content/extra-pages/.gitkeep +0 -0
  27. package/ecomplus-stores/iluminim/functions/ssr/content/layout.json +33 -0
  28. package/ecomplus-stores/iluminim/functions/ssr/content/pages/home.json +70 -0
  29. package/ecomplus-stores/iluminim/functions/ssr/content/settings.json +49 -0
  30. package/ecomplus-stores/iluminim/functions/ssr/index.js +18 -0
  31. package/ecomplus-stores/iluminim/functions/ssr/package.json +31 -0
  32. package/ecomplus-stores/iluminim/functions/ssr/public/admin/.gitkeep +2 -0
  33. package/ecomplus-stores/iluminim/functions/ssr/public/assets/cms-preview.css +274 -0
  34. package/ecomplus-stores/iluminim/functions/ssr/public/assets/cms.css +114 -0
  35. package/ecomplus-stores/iluminim/functions/ssr/public/assets/cvv.png +0 -0
  36. package/ecomplus-stores/iluminim/functions/ssr/public/assets/img-placeholder.png +0 -0
  37. package/ecomplus-stores/iluminim/functions/ssr/public/assets/payments.png +0 -0
  38. package/ecomplus-stores/iluminim/functions/ssr/public/assets/ssl-safe.png +0 -0
  39. package/ecomplus-stores/iluminim/functions/ssr/public/img/icon.png +0 -0
  40. package/ecomplus-stores/iluminim/functions/ssr/public/img/large-icon.png +0 -0
  41. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/banner-chamada-desktop-9x81zmd91q.webp +0 -0
  42. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/banner2.webp +0 -0
  43. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/chamada-mobile-q1c6om6jx4.webp +0 -0
  44. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/ecom-icon.png +0 -0
  45. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/headphone.webp +0 -0
  46. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/logo.webp +0 -0
  47. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/og-image.png +0 -0
  48. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/passion.webp +0 -0
  49. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/rect8589.png +0 -0
  50. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/rect859.png +0 -0
  51. package/ecomplus-stores/iluminim/functions/ssr/public/img/uploads/rect89.webp +0 -0
  52. package/ecomplus-stores/iluminim/functions/ssr/public/robots.txt +8 -0
  53. package/ecomplus-stores/iluminim/functions/ssr/scripts/build.sh +14 -0
  54. package/ecomplus-stores/iluminim/functions/ssr/src/assets/style.css +65 -0
  55. package/ecomplus-stores/iluminim/functions/ssr/src/components/AccountMenu.vue +104 -0
  56. package/ecomplus-stores/iluminim/functions/ssr/src/components/Banner.vue +59 -0
  57. package/ecomplus-stores/iluminim/functions/ssr/src/components/BannersGrid.astro +25 -0
  58. package/ecomplus-stores/iluminim/functions/ssr/src/components/CartSidebar.vue +35 -0
  59. package/ecomplus-stores/iluminim/functions/ssr/src/components/Countdown.vue +79 -0
  60. package/ecomplus-stores/iluminim/functions/ssr/src/components/HeroSlider.vue +52 -0
  61. package/ecomplus-stores/iluminim/functions/ssr/src/components/PitchBar.vue +57 -0
  62. package/ecomplus-stores/iluminim/functions/ssr/src/components/Prices.vue +96 -0
  63. package/ecomplus-stores/iluminim/functions/ssr/src/components/ProductCard.vue +118 -0
  64. package/ecomplus-stores/iluminim/functions/ssr/src/components/ProductShelf.vue +60 -0
  65. package/ecomplus-stores/iluminim/functions/ssr/src/components/ProductsCountdown.vue +20 -0
  66. package/ecomplus-stores/iluminim/functions/ssr/src/components/SearchModal.vue +6 -0
  67. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopHeader.vue +137 -0
  68. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopHeaderMenu.vue +58 -0
  69. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopHeaderSubmenu.vue +88 -0
  70. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopSidenav.vue +61 -0
  71. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopSidenavCategory.vue +78 -0
  72. package/ecomplus-stores/iluminim/functions/ssr/src/env.d.ts +13 -0
  73. package/ecomplus-stores/iluminim/functions/ssr/src/layouts/Base.astro +16 -0
  74. package/ecomplus-stores/iluminim/functions/ssr/src/layouts/Checkout.astro +0 -0
  75. package/ecomplus-stores/iluminim/functions/ssr/src/layouts/PageHeader.astro +33 -0
  76. package/ecomplus-stores/iluminim/functions/ssr/src/main/Fallback.astro +10 -0
  77. package/ecomplus-stores/iluminim/functions/ssr/src/main/Home.astro +49 -0
  78. package/ecomplus-stores/iluminim/functions/ssr/src/main/Sections.astro +42 -0
  79. package/ecomplus-stores/iluminim/functions/ssr/src/main/Wildcard.astro +18 -0
  80. package/ecomplus-stores/iluminim/functions/ssr/src/pages/[...slug].astro +40 -0
  81. package/ecomplus-stores/iluminim/functions/ssr/src/pages/_vue.ts +3 -0
  82. package/ecomplus-stores/iluminim/functions/ssr/src/pages/app/account.astro +0 -0
  83. package/ecomplus-stores/iluminim/functions/ssr/src/pages/app/index.astro +0 -0
  84. package/ecomplus-stores/iluminim/functions/ssr/src/pages/fallback.astro +25 -0
  85. package/ecomplus-stores/iluminim/functions/ssr/src/pages/index.astro +35 -0
  86. package/ecomplus-stores/iluminim/functions/ssr/src/scripts/InlineScripts.astro +10 -0
  87. package/ecomplus-stores/iluminim/functions/ssr/tailwind.config.cjs +13 -0
  88. package/ecomplus-stores/iluminim/functions/ssr/tsconfig.json +12 -0
  89. package/ecomplus-stores/iluminim/functions/ssr/uno.config.cjs +5 -0
  90. package/ecomplus-stores/iluminim/functions/with-apps/index.js +12 -0
  91. package/ecomplus-stores/iluminim/functions/with-apps/package.json +22 -0
  92. package/ecomplus-stores/iluminim/package.json +28 -0
  93. package/ecomplus-stores/iluminim/scripts/install.sh +14 -0
  94. package/ecomplus-stores/monocard/.eslintrc.cjs +3 -0
  95. package/ecomplus-stores/monocard/.nvmrc +1 -0
  96. package/ecomplus-stores/tia-sonia/.eslintrc.cjs +3 -0
  97. package/ecomplus-stores/tia-sonia/.nvmrc +1 -0
  98. package/package.json +4 -4
  99. package/packages/api/package.json +1 -1
  100. package/packages/api/types.d.ts +1 -1
  101. package/packages/apps/affilate-program/package.json +1 -1
  102. package/packages/apps/correios/package.json +1 -1
  103. package/packages/apps/custom-payment/package.json +1 -1
  104. package/packages/apps/custom-shipping/package.json +1 -1
  105. package/packages/apps/datafrete/package.json +1 -1
  106. package/packages/apps/discounts/package.json +1 -1
  107. package/packages/apps/emails/package.json +1 -1
  108. package/packages/apps/fb-conversions/package.json +1 -1
  109. package/packages/apps/flash-courier/package.json +1 -1
  110. package/packages/apps/frenet/package.json +1 -1
  111. package/packages/apps/galaxpay/package.json +1 -1
  112. package/packages/apps/google-analytics/package.json +1 -1
  113. package/packages/apps/jadlog/package.json +1 -1
  114. package/packages/apps/loyalty-points/package.json +1 -1
  115. package/packages/apps/melhor-envio/package.json +1 -1
  116. package/packages/apps/mercadopago/package.json +1 -1
  117. package/packages/apps/pagarme/package.json +1 -1
  118. package/packages/apps/paghiper/package.json +1 -1
  119. package/packages/apps/pix/package.json +1 -1
  120. package/packages/apps/tiny-erp/package.json +1 -1
  121. package/packages/apps/webhooks/package.json +1 -1
  122. package/packages/cli/config/firebase.json +10 -0
  123. package/packages/cli/package.json +1 -1
  124. package/packages/config/package.json +1 -1
  125. package/packages/emails/package.json +2 -2
  126. package/packages/events/package.json +1 -1
  127. package/packages/feeds/package.json +1 -1
  128. package/packages/firebase/package.json +1 -1
  129. package/packages/i18n/lib/en_us/i19hour.txt +1 -0
  130. package/packages/i18n/lib/en_us/i19hours.txt +1 -0
  131. package/packages/i18n/lib/en_us/i19milliseconds.txt +1 -0
  132. package/packages/i18n/lib/en_us/i19minute.txt +1 -0
  133. package/packages/i18n/lib/en_us/i19minutes.txt +1 -0
  134. package/packages/i18n/lib/en_us/i19second.txt +1 -0
  135. package/packages/i18n/lib/en_us/i19seconds.txt +1 -0
  136. package/packages/i18n/lib/en_us.d.ts +7 -0
  137. package/packages/i18n/lib/en_us.js +7 -0
  138. package/packages/i18n/lib/en_us.js.map +1 -1
  139. package/packages/i18n/lib/pt_br/i19home.txt +1 -1
  140. package/packages/i18n/lib/pt_br/i19hour.txt +1 -0
  141. package/packages/i18n/lib/pt_br/i19hours.txt +1 -0
  142. package/packages/i18n/lib/pt_br/i19milliseconds.txt +1 -0
  143. package/packages/i18n/lib/pt_br/i19minute.txt +1 -0
  144. package/packages/i18n/lib/pt_br/i19minutes.txt +1 -0
  145. package/packages/i18n/lib/pt_br/i19second.txt +1 -0
  146. package/packages/i18n/lib/pt_br/i19seconds.txt +1 -0
  147. package/packages/i18n/lib/pt_br.d.ts +8 -1
  148. package/packages/i18n/lib/pt_br.js +8 -1
  149. package/packages/i18n/lib/pt_br.js.map +1 -1
  150. package/packages/i18n/package.json +1 -1
  151. package/packages/i18n/src/en_us.ts +7 -0
  152. package/packages/i18n/src/pt_br.ts +8 -1
  153. package/packages/modules/package.json +1 -1
  154. package/packages/passport/package.json +1 -1
  155. package/packages/ssr/lib/firebase/serve-storefront.js +24 -18
  156. package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
  157. package/packages/ssr/package.json +2 -2
  158. package/packages/ssr/src/firebase/serve-storefront.ts +25 -18
  159. package/packages/storefront/.eslintrc.cjs +8 -1
  160. package/packages/storefront/client.d.ts +1 -19
  161. package/packages/storefront/dist/client/_astro/HeroSlider.0890631f.js +1 -0
  162. package/packages/storefront/dist/client/_astro/{ShopHeader.0c884bbe.js → ShopHeader.82ae97a5.js} +1 -1
  163. package/packages/storefront/dist/client/_astro/_...slug_.c85b8978.css +1 -0
  164. package/packages/storefront/dist/client/_astro/{client.8035a95a.js → client.0fb6b44e.js} +1 -1
  165. package/packages/storefront/dist/client/_astro/{hoisted.9d9d7ac4.js → hoisted.572313d6.js} +1 -1
  166. package/packages/storefront/dist/client/sw.js +1 -1
  167. package/packages/storefront/dist/server/chunks/_...7e1df40a.mjs +34 -0
  168. package/packages/storefront/dist/server/chunks/{account@_@astro.89e4cf60.mjs → account@_@astro.5f1dba7a.mjs} +7 -8
  169. package/packages/storefront/dist/server/chunks/{astro.45d3047f.mjs → astro.2d3ebf0f.mjs} +560 -511
  170. package/packages/storefront/dist/server/chunks/{endpoint@_@js.f880a152.mjs → endpoint@_@js.80de0568.mjs} +7 -8
  171. package/packages/storefront/dist/server/chunks/{fallback@_@astro.89538855.mjs → fallback@_@astro.02a45b47.mjs} +7 -8
  172. package/packages/storefront/dist/server/chunks/{index@_@astro.56fdd6da.mjs → index@_@astro.23b50301.mjs} +7 -8
  173. package/packages/storefront/dist/server/chunks/{index@_@astro.548cf7ad.mjs → index@_@astro.7cb07e52.mjs} +7 -8
  174. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.bde9380b.mjs → _...slug_.astro.4358f614.mjs} +92 -104
  175. package/packages/storefront/dist/server/chunks/pages/{account.astro.f07cf19e.mjs → account.astro.afae5a12.mjs} +6 -6
  176. package/packages/storefront/dist/server/chunks/pages/{endpoint.js.d4e37801.mjs → endpoint.js.60fd21aa.mjs} +1 -1
  177. package/packages/storefront/dist/server/chunks/pages/{fallback.astro.e2e8a0e4.mjs → fallback.astro.e5566925.mjs} +10 -10
  178. package/packages/storefront/dist/server/chunks/pages/{index.astro.3760ebe3.mjs → index.astro.5bc6b9d8.mjs} +34 -32
  179. package/packages/storefront/dist/server/entry.mjs +13 -12
  180. package/packages/storefront/dist/server/renderers.mjs +7 -8
  181. package/packages/storefront/package.json +2 -2
  182. package/packages/storefront/server.d.ts +3 -27
  183. package/packages/storefront/src/lib/$storefront.d.ts +28 -0
  184. package/packages/storefront/src/lib/assets/base.css +2 -0
  185. package/packages/storefront/src/lib/layouts/Base.astro +1 -9
  186. package/packages/storefront/src/lib/layouts/BaseHead.astro +73 -2
  187. package/packages/storefront/src/lib/layouts/use-page-main.ts +18 -5
  188. package/packages/storefront/src/lib/pages/_vue.ts +1 -1
  189. package/packages/storefront/src/lib/server-data.ts +1 -1
  190. package/packages/storefront/src/lib/ssr-context.ts +46 -36
  191. package/packages/storefront/src/vue-globals.d.ts +3 -3
  192. package/packages/types/package.json +1 -1
  193. package/pnpm-workspace.yaml +2 -2
  194. package/packages/storefront/dist/client/_astro/HeroSlider.eb156f18.js +0 -1
  195. package/packages/storefront/dist/client/_astro/_...slug_.c2da43fb.css +0 -1
  196. package/packages/storefront/dist/server/chunks/_...9e22b578.mjs +0 -35
  197. package/packages/storefront/src/lib/composables/use-hero-slider.ts +0 -26
  198. package/packages/storefront/src/lib/layouts/BaseStateJson.astro +0 -68
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <section class="ui-section">
3
+ <Countdown />
4
+ <article v-for="product in products" :key="product._id">
5
+ <ProductCard :product="product" />
6
+ </article>
7
+ </section>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import type { ProductItem } from '@@sf/composables/use-product-card';
12
+ import ProductCard from '~/components/ProductCard.vue';
13
+ import Countdown from '~/components/Countdown.vue';
14
+
15
+ export interface Props {
16
+ products: ProductItem[];
17
+ }
18
+
19
+ defineProps<Props>();
20
+ </script>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <div class="w-full h-40 bg-base-300"></div>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ </script>
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <header
3
+ ref="header"
4
+ class="relative top-0 z-50 transition-colors"
5
+ :class="[
6
+ isSticky && !isSidenavOpen ? 'bg-white/80' : 'bg-white',
7
+ isSticky ? 'backdrop-blur-md shadow py-2 md:py-3' : 'py-3 sm:py-4 md:py-5',
8
+ ]"
9
+ >
10
+ <div class="container 2xl:max-w-7xl
11
+ mx-auto px-1 lg:pr-3 lg:pl-5 xl:pr-7 xl:pl-9 2xl:pr-0 2xl:pl-2
12
+ flex md:grid grid-flow-col grid-cols-3 lg:grid-cols-none lg:auto-cols-max
13
+ justify-between items-center">
14
+ <div class="basis-1/4 lg:hidden">
15
+ <button
16
+ class="px-2 my-1"
17
+ :aria-label="$t.i19toggleMenu"
18
+ @click="isSidenavOpen = !isSidenavOpen"
19
+ >
20
+ <i
21
+ class="text-base-500 text-3xl"
22
+ :class="isSidenavOpen ? 'i-close' : 'i-bars-3-bottom-left'"
23
+ ></i>
24
+ </button>
25
+ </div>
26
+ <slot name="logo" />
27
+ <ShopHeaderMenu class="hidden lg:block" v-bind="{ inlineMenuTrees }" />
28
+ <div class="basis-1/4 px-2
29
+ flex justify-end items-center gap-3 lg:gap-4 text-base-800">
30
+ <button
31
+ :aria-label="$t.i19searchProducts"
32
+ @click="isSearchOpen = !isSearchOpen"
33
+ >
34
+ <i class="i-magnifying-glass w-7 h-7
35
+ hover:text-primary hover:scale-110 active:scale-125"></i>
36
+ </button>
37
+ <AccountMenu
38
+ class="hidden sm:block"
39
+ :aria-label="$t.i19myAccount"
40
+ :service-links="serviceLinks"
41
+ >
42
+ <template #button="{ open }">
43
+ <i
44
+ class="i-user-circle w-7 h-7
45
+ hover:text-primary hover:scale-110 active:scale-125"
46
+ :class="open ? 'text-black scale-110' : null"
47
+ ></i>
48
+ </template>
49
+ </AccountMenu>
50
+ <button
51
+ :aria-label="$t.i19openCart"
52
+ @click="isCartOpen = !isCartOpen"
53
+ class="relative group"
54
+ >
55
+ <i class="i-carbon:shopping-cart w-7 h-7 group-hover:text-primary
56
+ text-secondary-900 group-hover:scale-110 group-active:scale-125"></i>
57
+ <span
58
+ v-if="delayedTotalItems"
59
+ class="ui-badge-pill-sm absolute -top-1 -right-1.5"
60
+ >
61
+ {{ delayedTotalItems }}
62
+ </span>
63
+ </button>
64
+ </div>
65
+ </div>
66
+ <Drawer
67
+ v-model="isSidenavOpen"
68
+ :has-close-button="false"
69
+ position="absolute"
70
+ :class="isSticky ? 'mt-2 md:mt-3' : 'mt-3 sm:mt-4 md:mt-5'"
71
+ :style="{ height: `calc(100vh - ${positionY}px + .5rem)` }"
72
+ >
73
+ <ShopSidenav class="bg-white pt-6" v-bind="{ categoryTrees }" />
74
+ </Drawer>
75
+ <Drawer
76
+ v-model="isSearchOpen"
77
+ :has-close-button="false"
78
+ placement="top"
79
+ >
80
+ <SearchModal />
81
+ </Drawer>
82
+ <Teleport v-if="isMounted" to="#teleported-overlap">
83
+ <Drawer
84
+ v-model="isCartOpen"
85
+ placement="end"
86
+ backdrop-target="#teleported-overlap"
87
+ >
88
+ <CartSidebar />
89
+ </Drawer>
90
+ </Teleport>
91
+ </header>
92
+ </template>
93
+
94
+ <script setup lang="ts">
95
+ import { ref, watch, onMounted } from 'vue';
96
+ import { totalItems } from '@@sf/state/shopping-cart';
97
+ import {
98
+ type Props as UseShopHeaderProps,
99
+ useShopHeader,
100
+ } from '@@sf/composables/use-shop-header';
101
+ import Drawer from '@@sf/components/Drawer.vue';
102
+ import ShopSidenav from '~/components/ShopSidenav.vue';
103
+ import ShopHeaderMenu from '~/components/ShopHeaderMenu.vue';
104
+ import SearchModal from '~/components/SearchModal.vue';
105
+ import AccountMenu from '~/components/AccountMenu.vue';
106
+ import CartSidebar from '~/components/CartSidebar.vue';
107
+
108
+ export interface Props extends Omit<UseShopHeaderProps, 'header'> {
109
+ serviceLinks?: Array<{
110
+ title: string;
111
+ href: string;
112
+ }>;
113
+ }
114
+
115
+ const props = defineProps<Props>();
116
+ const header = ref<HTMLElement | null>(null);
117
+ const {
118
+ isSticky,
119
+ positionY,
120
+ categoryTrees,
121
+ inlineMenuTrees,
122
+ } = useShopHeader({ ...props, header });
123
+ const isSidenavOpen = ref(false);
124
+ const isSearchOpen = ref(false);
125
+ const isCartOpen = ref(false);
126
+ const isMounted = ref(false);
127
+ const delayedTotalItems = ref(0);
128
+ onMounted(() => {
129
+ isMounted.value = true;
130
+ watch(totalItems, (newTotalItems, prevTotalItems) => {
131
+ if (prevTotalItems && prevTotalItems < newTotalItems) {
132
+ isCartOpen.value = true;
133
+ }
134
+ delayedTotalItems.value = newTotalItems;
135
+ }, { immediate: true });
136
+ });
137
+ </script>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <nav>
3
+ <ul
4
+ class="flex gap-4 xl:gap-5 text-base-700"
5
+ :class="inlineMenuTrees.length < 7 ? 'text-base' : 'text-sm'"
6
+ >
7
+ <li v-for="(categoryTree, i) in inlineMenuTrees" :key="i">
8
+ <ShopHeaderSubmenu
9
+ v-if="categoryTree.subcategories.length"
10
+ :category-tree="categoryTree"
11
+ >
12
+ <template #button="{ open }">
13
+ <span class="hover:text-primary group">
14
+ <h3
15
+ class="group-hover:underline inline"
16
+ :class="[
17
+ inlineMenuTrees.length < 7 ? 'decoration-2' : null,
18
+ open ? 'underline' : null,
19
+ ]"
20
+ >
21
+ {{ categoryTree.name }}
22
+ </h3>
23
+ <i
24
+ v-if="hasOneLevelSubcategories"
25
+ class="i-chevron-down ml-1 transition-transform
26
+ text-base-400 group-hover:text-primary-subtle"
27
+ :class="open ? 'rotate-180' : null"
28
+ ></i>
29
+ </span>
30
+ </template>
31
+ </ShopHeaderSubmenu>
32
+ <a
33
+ v-else
34
+ :href="`/${categoryTree.slug}`"
35
+ class="hover:text-primary hover:underline"
36
+ :class="inlineMenuTrees.length < 7 ? 'decoration-2' : null"
37
+ >
38
+ <h3 class="inline">{{ categoryTree.name }}</h3>
39
+ </a>
40
+ </li>
41
+ </ul>
42
+ </nav>
43
+ </template>
44
+
45
+ <script setup lang="ts">
46
+ import type { CategoryTree } from '@@sf/composables/use-shop-header';
47
+ import { computed } from 'vue';
48
+ import ShopHeaderSubmenu from '~/components/ShopHeaderSubmenu.vue';
49
+
50
+ export interface Props {
51
+ inlineMenuTrees: CategoryTree[];
52
+ }
53
+
54
+ const props = defineProps<Props>();
55
+ const hasOneLevelSubcategories = computed(() => {
56
+ return !!props.inlineMenuTrees.find(({ subcategories }) => !subcategories.length);
57
+ });
58
+ </script>
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <Popover v-slot="{ open }">
3
+ <PopoverButton class="outline-none">
4
+ <slot name="button" v-bind="{ open }" />
5
+ </PopoverButton>
6
+ <div class="relative">
7
+ <Fade>
8
+ <PopoverPanel
9
+ class="absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform
10
+ px-6 py-4 rounded backdrop-blur-md shadow bg-white/80
11
+ text-base text-base-700"
12
+ :class="countMenuCols === 1 ? 'w-60'
13
+ : countMenuCols === 2 ? `w-screen ${(categoryPicture ? 'max-w-lg' : 'max-w-sm')}`
14
+ : countMenuCols === 3 ? `w-screen ${(categoryPicture ? 'max-w-xl' : 'max-w-md')}`
15
+ : countMenuCols < 6 ? 'w-screen max-w-3xl' : 'w-screen max-w-5xl'"
16
+ >
17
+ <div class="flex gap-6 w-full">
18
+ <ul v-if="subcategoryLinks.length" class="flex-1">
19
+ <li
20
+ v-for="(subcategory, i) in subcategoryLinks"
21
+ :key="`link-${i}`"
22
+ :class="subcategoryLinks.length > 10 ? 'text-sm mb-1' : 'mb-2'"
23
+ >
24
+ <a :href="`/${subcategory.slug}`" class="hover:text-primary">
25
+ <h3>{{ subcategory.name }}</h3>
26
+ </a>
27
+ </li>
28
+ </ul>
29
+ <div
30
+ v-for="(subcategory, i) in subcategoryCols"
31
+ :key="subcategory._id"
32
+ class="flex-1"
33
+ >
34
+ <a :href="`/${subcategory.slug}`" class="hover:text-primary">
35
+ <h3>{{ subcategory.name }}</h3>
36
+ </a>
37
+ <ul class="text-sm text-base-600 mt-1 mb-1.5">
38
+ <li
39
+ v-for="(nestedSubcategory, ii) in subcategory.subcategories"
40
+ :key="`${i}-${ii}`"
41
+ class="mb-0.5"
42
+ >
43
+ <a
44
+ :href="`/${nestedSubcategory.slug}`"
45
+ class="hover:text-primary hover:underline"
46
+ >
47
+ <h3>{{ nestedSubcategory.name }}</h3>
48
+ </a>
49
+ </li>
50
+ </ul>
51
+ </div>
52
+ <div
53
+ v-if="categoryPicture"
54
+ :class="countMenuCols === 2 ? 'basis-1/2'
55
+ : countMenuCols < 5 ? 'basis-2/5' : 'basis-1/3'"
56
+ >
57
+ <AImg :picture="categoryPicture" class="ml-auto rounded" />
58
+ </div>
59
+ </div>
60
+ <a
61
+ :href="`/${categoryTree.slug}`"
62
+ class="block mt-1 text-xs text-base-600 leading-snug underline"
63
+ >
64
+ {{ $t.i19seeAll$1Category.replace('$1', categoryTree.name) }}
65
+ </a>
66
+ </PopoverPanel>
67
+ </Fade>
68
+ </div>
69
+ </Popover>
70
+ </template>
71
+
72
+ <script setup lang="ts">
73
+ import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue';
74
+ import {
75
+ type Props as UseShopHeaderSubmenuProps,
76
+ useShopHeaderSubmenu,
77
+ } from '@@sf/composables/use-shop-header-submenu';
78
+
79
+ export interface Props extends UseShopHeaderSubmenuProps {}
80
+
81
+ const props = defineProps<Props>();
82
+ const {
83
+ categoryPicture,
84
+ subcategoryLinks,
85
+ subcategoryCols,
86
+ countMenuCols,
87
+ } = useShopHeaderSubmenu(props);
88
+ </script>
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <aside class="flex flex-col h-full">
3
+ <nav class="py-4 grow">
4
+ <ul class="relative h-full">
5
+ <ShopSidenavCategory
6
+ v-for="categoryTree in categoryTrees"
7
+ :key="categoryTree._id"
8
+ :category-tree="categoryTree"
9
+ />
10
+ </ul>
11
+ </nav>
12
+ <footer class="text-base">
13
+ <div class="flex items-center px-2 py-4 bg-base-100">
14
+ <AccountLink class="p-2 grow flex items-center gap-3">
15
+ <i class="i-user-circle text-4xl text-base-500 m-0"></i>
16
+ <span class="leading-tight">
17
+ {{ `${$t.i19hello} ${customerName || $t.i19visitor}` }}
18
+ <small class="block lowercase font-semibold text-primary">
19
+ {{ $t.i19myOrders }}, {{ $t.i19myAccount }}
20
+ </small>
21
+ </span>
22
+ </AccountLink>
23
+ <button
24
+ v-if="isLogged"
25
+ @click="logout"
26
+ class="p-2 text-right text-base-800"
27
+ >
28
+ <span class="text-base-600">{{ $t.i19logout }}</span>
29
+ <i class="i-arrow-right-on-rectangle text-lg ml-1"></i>
30
+ </button>
31
+ </div>
32
+ <ul class="flex gap-3 p-4 bg-base-200 text-xl text-base-700">
33
+ <li v-for="(href, network) in socialNetworks" :key="network">
34
+ <SocialNetworkLink :network="network" class="p-1 active:text-primary" />
35
+ </li>
36
+ </ul>
37
+ </footer>
38
+ </aside>
39
+ </template>
40
+
41
+ <script setup lang="ts">
42
+ import type { CategoryTree } from '@@sf/composables/use-shop-header';
43
+ import { onMounted } from 'vue';
44
+ import {
45
+ customerName,
46
+ initializeFirebaseAuth,
47
+ isLogged,
48
+ logout,
49
+ } from '@@sf/state/customer-session';
50
+ import { socialNetworks } from '@@sf/server-data';
51
+ import AccountLink from '@@sf/components/AccountLink.vue';
52
+ import SocialNetworkLink from '@@sf/components/SocialNetworkLink.vue';
53
+ import ShopSidenavCategory from '~/components/ShopSidenavCategory.vue';
54
+
55
+ export interface Props {
56
+ categoryTrees: CategoryTree[];
57
+ }
58
+
59
+ defineProps<Props>();
60
+ onMounted(() => initializeFirebaseAuth());
61
+ </script>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <li class="text-lg text-base-800">
3
+ <details
4
+ v-if="categoryTree.subcategories.length"
5
+ class="bg-white overflow-y-auto overflow-x-hidden z-10
6
+ open:absolute open:top-0 open:left-0 open:w-full open:h-full"
7
+ @toggle="isOpen = !isOpen"
8
+ >
9
+ <summary
10
+ class="cursor-pointer list-none px-6 py-3 active:bg-base-100 transition-colors"
11
+ :class="isOpen ? 'bg-base-100' : null"
12
+ >
13
+ <i :class="!isOpen
14
+ ? 'i-arrow-right float-right mb-0 mt-1 text-xl text-base-500'
15
+ : 'i-arrow-left text-lg'"></i>
16
+ <AImg
17
+ v-if="!isOpen && categoryTree.icon"
18
+ :picture="categoryTree.icon"
19
+ class="w-auto h-5 inline mr-3"
20
+ />
21
+ <h3 class="inline" :class="isOpen ? 'ml-4 text-base' : null">
22
+ {{ categoryTree.name }}
23
+ </h3>
24
+ </summary>
25
+ <ul
26
+ class="mt-2 transition-opacity"
27
+ :class="isFaded ? 'opacity-20' : 'opacity-100'"
28
+ tabindex="-1"
29
+ >
30
+ <ShopSidenavCategory
31
+ v-for="subcategoryTree in categoryTree.subcategories"
32
+ :key="subcategoryTree._id"
33
+ :category-tree="subcategoryTree"
34
+ />
35
+ <li>
36
+ <a
37
+ :href="`/${categoryTree.slug}`"
38
+ class="block px-6 py-3 text-base underline active:bg-base-200"
39
+ >
40
+ {{ $t.i19seeAll$1Category.replace('$1', categoryTree.name) }}
41
+ </a>
42
+ </li>
43
+ </ul>
44
+ </details>
45
+ <a
46
+ v-else
47
+ :href="`/${categoryTree.slug}`"
48
+ class="block px-6 py-3 active:bg-base-200"
49
+ >
50
+ <AImg
51
+ v-if="!isOpen && categoryTree.icon"
52
+ :picture="categoryTree.icon"
53
+ class="w-auto h-5 inline mr-3"
54
+ />
55
+ <h3 class="inline">{{ categoryTree.name }}</h3>
56
+ </a>
57
+ </li>
58
+ </template>
59
+
60
+ <script setup lang="ts">
61
+ import type { CategoryTree, SubcategoryTree } from '@@sf/composables/use-shop-header';
62
+ import { ref, watch } from 'vue';
63
+
64
+ export interface Props {
65
+ categoryTree: CategoryTree | SubcategoryTree;
66
+ }
67
+
68
+ defineProps<Props>();
69
+ const isOpen = ref(false);
70
+ const isFaded = ref(true);
71
+ watch(isOpen, (_isOpen) => {
72
+ if (_isOpen) {
73
+ setTimeout(() => { isFaded.value = false; }, 25);
74
+ } else {
75
+ isFaded.value = true;
76
+ }
77
+ });
78
+ </script>
@@ -0,0 +1,13 @@
1
+ /// <reference types="@astrojs/image/client" />
2
+ /// <reference types="vite-plugin-pwa/client" />
3
+ /// <reference types="vue/ref-macros" />
4
+ /// <reference types="@cloudcommerce/storefront/client" />
5
+ /// <reference types="@cloudcommerce/storefront/server" />
6
+
7
+ /* eslint-disable import/newline-after-import */
8
+
9
+ declare module '*.vue' {
10
+ import { type DefineComponent } from 'vue';
11
+ const component: DefineComponent<{}, {}, any>;
12
+ export default component;
13
+ }
@@ -0,0 +1,16 @@
1
+ ---
2
+ import SfBase from '@@sf/layouts/Base.astro';
3
+ import InlineScripts from '~/scripts/InlineScripts.astro';
4
+ import '~/assets/style.css';
5
+ import 'uno.css';
6
+ // Supports weights 100-900
7
+ import '@fontsource-variable/heebo/index.css';
8
+ ---
9
+
10
+ <SfBase>
11
+ <Fragment slot="base-head">
12
+ <slot name="base-head" />
13
+ </Fragment>
14
+ <InlineScripts slot="before-head-end" />
15
+ <slot />
16
+ </SfBase>
@@ -0,0 +1,33 @@
1
+ ---
2
+ import usePageHeader from '@@sf/layouts/use-page-header';
3
+ import Picture from '@@sf/components/Picture.astro';
4
+ import PitchBar from '~/components/PitchBar.vue';
5
+ import ShopHeader from '~/components/ShopHeader.vue';
6
+
7
+ const { routeContext } = Astro.locals;
8
+ const { settings, isHomepage } = routeContext;
9
+ const LogoHeading = isHomepage ? 'h1' : 'h2';
10
+ const { pitchBar, shopHeader } = await usePageHeader({ routeContext });
11
+ ---
12
+
13
+ <slot name="pitch-bar">
14
+ {pitchBar.slides.length > 1 && <PitchBar {...pitchBar} client:idle />}
15
+ {pitchBar.slides.length === 1 && <PitchBar {...pitchBar} />}
16
+ </slot>
17
+ <ShopHeader {...shopHeader} client:load>
18
+ <Fragment slot="logo">
19
+ <a href="/">
20
+ <LogoHeading>
21
+ <Picture
22
+ slot="logo-picture"
23
+ src={settings.logo}
24
+ alt={settings.name}
25
+ widths={[300]}
26
+ fetchpriority="high"
27
+ loading="eager"
28
+ class="hover:drop-shadow-sm max-w-[150px] mx-auto"
29
+ />
30
+ </LogoHeading>
31
+ </a>
32
+ </Fragment>
33
+ </ShopHeader>
@@ -0,0 +1,10 @@
1
+ ---
2
+ ---
3
+
4
+ <main>
5
+ <h1>Error :/</h1>
6
+ <p class="instructions">
7
+ Check out the <code>src/pages</code> directory to get started.<br/>
8
+ <strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
9
+ </p>
10
+ </main>
@@ -0,0 +1,49 @@
1
+ ---
2
+ import api from '@cloudcommerce/api';
3
+ import { usePageHero } from '@@sf/layouts/use-page-main';
4
+ import BannerPictures from '@@sf/components/BannerPictures.astro';
5
+ import HeroSlider from '~/components/HeroSlider.vue';
6
+ import Sections from '~/main/Sections.astro';
7
+ import Countdown from '~/components/Countdown.vue';
8
+
9
+ const { routeContext } = Astro.locals;
10
+ const { heroSlider } = await usePageHero({ routeContext });
11
+ const heroSlides = heroSlider.slides;
12
+ const {
13
+ data: {
14
+ result: products,
15
+ },
16
+ } = await api.get('products', {
17
+ limit: 500,
18
+ fields: ['sku', 'name', 'pictures'] as const,
19
+ });
20
+ ---
21
+
22
+ <main>
23
+ {heroSlider.slides.length &&
24
+ <HeroSlider {...heroSlider} client:load>
25
+ {heroSlides[0] && <BannerPictures slot="picture-0" {...heroSlides[0]} index={0} />}
26
+ {heroSlides[1] && <BannerPictures slot="picture-1" {...heroSlides[1]} index={1} />}
27
+ {heroSlides[2] && <BannerPictures slot="picture-2" {...heroSlides[2]} index={2} />}
28
+ {heroSlides[3] && <BannerPictures slot="picture-3" {...heroSlides[3]} index={3} />}
29
+ {heroSlides[4] && <BannerPictures slot="picture-4" {...heroSlides[4]} index={4} />}
30
+ {heroSlides[5] && <BannerPictures slot="picture-5" {...heroSlides[5]} index={5} />}
31
+ {heroSlides[6] && <BannerPictures slot="picture-6" {...heroSlides[6]} index={6} />}
32
+ {heroSlides[7] && <BannerPictures slot="picture-7" {...heroSlides[7]} index={7} />}
33
+ {heroSlides[8] && <BannerPictures slot="picture-8" {...heroSlides[8]} index={8} />}
34
+ {heroSlides[9] && <BannerPictures slot="picture-9" {...heroSlides[9]} index={9} />}
35
+ <!-- https://github.com/withastro/astro/issues/5066#issuecomment-1277998365 -->
36
+ </HeroSlider>
37
+ }
38
+ <Sections />
39
+ <div class="container mx-auto py-4">
40
+ <Countdown client:visible />
41
+ </div>
42
+ <article class="container">
43
+ {products.map((product) => (
44
+ <span>{product.sku}</span>
45
+ <span> {product.name}</span>
46
+ <br>
47
+ ))}
48
+ </article>
49
+ </main>
@@ -0,0 +1,42 @@
1
+ ---
2
+ import api from '@cloudcommerce/api';
3
+ import { usePageSections } from '@@sf/layouts/use-page-main';
4
+ import BannersGrid from '~/components/BannersGrid.astro';
5
+ import ProductShelf from '~/components/ProductShelf.vue';
6
+ import ProductsCountdown, { type Props as ProductsCountdownProps }
7
+ from '~/components/ProductsCountdown.vue';
8
+
9
+ const { routeContext } = Astro.locals;
10
+ const { sections } = await usePageSections({
11
+ routeContext,
12
+ handleCustomSection: async (type, content) => {
13
+ if (type === 'c:products-countdown') {
14
+ const {
15
+ data: {
16
+ result: products,
17
+ },
18
+ } = await api.get('search/v1', {
19
+ params: { sku: content.skus },
20
+ });
21
+ const props: ProductsCountdownProps = { products };
22
+ return { props };
23
+ }
24
+ return { props: content };
25
+ },
26
+ });
27
+ ---
28
+
29
+ <article class="my-9 md:my-12">
30
+ {sections.map(({ type, props }) => {
31
+ switch (type) {
32
+ case 'product-shelf':
33
+ return <ProductShelf {...props} client:visible />
34
+ case 'banners-grid':
35
+ return <BannersGrid {...props} />
36
+ case 'c:products-countdown':
37
+ return <ProductsCountdown {...props} />
38
+ default:
39
+ return <div data-section={type}></div>
40
+ }
41
+ })}
42
+ </article>
@@ -0,0 +1,18 @@
1
+ ---
2
+ const { fetchingApiContext, apiContext } = Astro.locals.routeContext;
3
+
4
+ await fetchingApiContext;
5
+ const apiDoc = apiContext.doc;
6
+ ---
7
+
8
+ <main>
9
+ {apiDoc &&
10
+ <h1>Hello <span class="text-gradient">{apiDoc.name}</span></h1>
11
+ <hr>
12
+ <div class="mt-3">
13
+ <mark>{apiDoc._id}</mark> from <i>{apiContext.resource}</i>
14
+ <p>{Math.random()}</p>
15
+ <em>Lorem ipsum dolor sit amet</em>
16
+ </div>
17
+ }
18
+ </main>