cloudcommerce 0.26.6 → 0.26.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 (231) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  4. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeader.vue +4 -1
  5. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  6. package/ecomplus-stores/barra-doce/package.json +2 -2
  7. package/ecomplus-stores/barra-doce/scripts/install.sh +12 -2
  8. package/ecomplus-stores/iluminim/scripts/install.sh +12 -2
  9. package/ecomplus-stores/monocard/.firebaserc +1 -1
  10. package/ecomplus-stores/monocard/.github/build-and-deploy +1 -0
  11. package/ecomplus-stores/monocard/.github/workflows/build-and-deploy.yml +1 -0
  12. package/ecomplus-stores/monocard/README.md +11 -82
  13. package/ecomplus-stores/monocard/SETUP.md +129 -0
  14. package/ecomplus-stores/monocard/{README.pt-BR.md → SETUP.pt-BR.md} +39 -12
  15. package/ecomplus-stores/monocard/functions/config.json +1 -1
  16. package/ecomplus-stores/monocard/functions/{passport → many}/index.js +5 -0
  17. package/ecomplus-stores/monocard/functions/{events → many}/package.json +4 -3
  18. package/ecomplus-stores/monocard/functions/ssr/.eslintrc.cjs +1 -1
  19. package/ecomplus-stores/monocard/functions/ssr/content/blog/.gitkeep +0 -0
  20. package/ecomplus-stores/monocard/functions/ssr/content/extra-pages/contato.json +11 -0
  21. package/ecomplus-stores/monocard/functions/ssr/content/extra-pages/terms.json +11 -0
  22. package/ecomplus-stores/monocard/functions/ssr/content/extra-pages/trocas.json +11 -0
  23. package/ecomplus-stores/monocard/functions/ssr/content/layout.json +25 -10
  24. package/ecomplus-stores/monocard/functions/ssr/content/pages/home.json +63 -0
  25. package/ecomplus-stores/monocard/functions/ssr/content/pages/products.json +19 -0
  26. package/ecomplus-stores/monocard/functions/ssr/content/settings.json +22 -2
  27. package/ecomplus-stores/monocard/functions/ssr/package.json +8 -9
  28. package/ecomplus-stores/monocard/functions/ssr/public/admin/.gitkeep +0 -0
  29. package/ecomplus-stores/monocard/functions/ssr/public/img/uploads/ecom-icon.png +0 -0
  30. package/ecomplus-stores/monocard/functions/ssr/src/assets/card.css +99 -0
  31. package/ecomplus-stores/monocard/functions/ssr/src/assets/style.css +74 -0
  32. package/ecomplus-stores/monocard/functions/ssr/src/components/AccountMenu.vue +5 -14
  33. package/ecomplus-stores/monocard/functions/ssr/src/components/Banner.vue +59 -0
  34. package/ecomplus-stores/monocard/functions/ssr/src/components/BannersGrid.astro +25 -0
  35. package/ecomplus-stores/monocard/functions/ssr/src/components/Breadcrumbs.astro +44 -0
  36. package/ecomplus-stores/monocard/functions/ssr/src/components/CartItem.vue +64 -0
  37. package/ecomplus-stores/monocard/functions/ssr/src/components/CartSidebar.vue +66 -0
  38. package/ecomplus-stores/monocard/functions/ssr/src/components/DemoVideo.vue +8 -3
  39. package/ecomplus-stores/monocard/functions/ssr/src/components/DocDescription.astro +30 -0
  40. package/ecomplus-stores/monocard/functions/ssr/src/components/FeatureTabs.vue +2 -2
  41. package/ecomplus-stores/monocard/functions/ssr/src/components/LottiePhoneNFC.vue +12 -9
  42. package/ecomplus-stores/monocard/functions/ssr/src/components/MonocardCustomizer.vue +8 -105
  43. package/ecomplus-stores/monocard/functions/ssr/src/components/Prices.vue +10 -27
  44. package/ecomplus-stores/monocard/functions/ssr/src/components/ProductCard.vue +117 -0
  45. package/ecomplus-stores/monocard/functions/ssr/src/components/ProductShelf.vue +57 -0
  46. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopFooter.vue +123 -0
  47. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopHeader.vue +85 -32
  48. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopHeaderMenu.vue +1 -1
  49. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopSidenav.vue +3 -3
  50. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopSidenavCategory.vue +2 -2
  51. package/ecomplus-stores/monocard/functions/ssr/src/env.d.ts +9 -1
  52. package/ecomplus-stores/monocard/functions/ssr/src/layouts/Base.astro +9 -44
  53. package/ecomplus-stores/monocard/functions/ssr/src/layouts/PageFooter.astro +52 -0
  54. package/ecomplus-stores/monocard/functions/ssr/src/layouts/PageHeader.astro +35 -0
  55. package/ecomplus-stores/monocard/functions/ssr/src/main/Fallback.astro +0 -5
  56. package/ecomplus-stores/monocard/functions/ssr/src/main/Home.astro +6 -12
  57. package/ecomplus-stores/monocard/functions/ssr/src/main/Sections.astro +38 -0
  58. package/ecomplus-stores/monocard/functions/ssr/src/main/Wildcard.astro +4 -18
  59. package/ecomplus-stores/monocard/functions/ssr/src/pages/[...slug].astro +15 -9
  60. package/ecomplus-stores/monocard/functions/ssr/src/pages/comprar/index.astro +19 -9
  61. package/ecomplus-stores/monocard/functions/ssr/src/pages/index.astro +16 -10
  62. package/ecomplus-stores/monocard/functions/ssr/src/pages/~fallback.astro +25 -0
  63. package/ecomplus-stores/monocard/functions/ssr/src/scripts/InlineScripts.astro +6 -6
  64. package/ecomplus-stores/monocard/functions/ssr/tailwind.config.cjs +1 -11
  65. package/ecomplus-stores/monocard/functions/{modules → with-apps}/index.js +3 -0
  66. package/ecomplus-stores/monocard/functions/{modules → with-apps}/package.json +4 -3
  67. package/ecomplus-stores/monocard/package.json +4 -1
  68. package/ecomplus-stores/monocard/scripts/install.sh +12 -2
  69. package/ecomplus-stores/tia-sonia/scripts/install.sh +12 -2
  70. package/package.json +4 -4
  71. package/packages/api/package.json +1 -1
  72. package/packages/apps/affilate-program/package.json +1 -1
  73. package/packages/apps/correios/package.json +1 -1
  74. package/packages/apps/custom-payment/package.json +1 -1
  75. package/packages/apps/custom-shipping/package.json +1 -1
  76. package/packages/apps/datafrete/package.json +1 -1
  77. package/packages/apps/discounts/package.json +1 -1
  78. package/packages/apps/emails/package.json +1 -1
  79. package/packages/apps/fb-conversions/package.json +2 -2
  80. package/packages/apps/flash-courier/package.json +1 -1
  81. package/packages/apps/frenet/package.json +1 -1
  82. package/packages/apps/galaxpay/package.json +1 -1
  83. package/packages/apps/google-analytics/package.json +1 -1
  84. package/packages/apps/jadlog/package.json +1 -1
  85. package/packages/apps/loyalty-points/package.json +1 -1
  86. package/packages/apps/melhor-envio/package.json +1 -1
  87. package/packages/apps/mercadopago/package.json +1 -1
  88. package/packages/apps/pagarme/package.json +2 -2
  89. package/packages/apps/paghiper/package.json +1 -1
  90. package/packages/apps/pix/package.json +1 -1
  91. package/packages/apps/tiny-erp/package.json +1 -1
  92. package/packages/apps/webhooks/package.json +1 -1
  93. package/packages/cli/package.json +2 -2
  94. package/packages/config/package.json +1 -1
  95. package/packages/emails/package.json +1 -1
  96. package/packages/eslint/package.json +3 -3
  97. package/packages/events/package.json +1 -1
  98. package/packages/feeds/package.json +1 -1
  99. package/packages/firebase/package.json +2 -2
  100. package/packages/i18n/package.json +1 -1
  101. package/packages/modules/package.json +1 -1
  102. package/packages/passport/package.json +1 -1
  103. package/packages/ssr/lib/firebase/serve-storefront.js +23 -8
  104. package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
  105. package/packages/ssr/package.json +2 -2
  106. package/packages/ssr/src/firebase/serve-storefront.ts +24 -8
  107. package/packages/storefront/dist/client/_astro/{Carousel.9ad2e1dc.js → Carousel.4bf71bce.js} +1 -1
  108. package/packages/storefront/dist/client/_astro/{CartSidebar.a6c6a885.js → CartSidebar.05b12b39.js} +1 -1
  109. package/packages/storefront/dist/client/_astro/{HeroSlider.ee1e6200.js → HeroSlider.fe108a14.js} +1 -1
  110. package/packages/storefront/dist/client/_astro/{PitchBar.6111676e.js → PitchBar.2c821b77.js} +1 -1
  111. package/packages/storefront/dist/client/_astro/{Prices.04ff8fce.js → Prices.78eb0a61.js} +1 -1
  112. package/packages/storefront/dist/client/_astro/{ProductShelf.085721d6.js → ProductShelf.46d8a51c.js} +1 -1
  113. package/packages/storefront/dist/client/_astro/ShopHeader.3694a82b.js +4 -0
  114. package/packages/storefront/dist/client/_astro/_...slug_.a4a7a874.css +1 -0
  115. package/packages/storefront/dist/client/_astro/ecom-icon_CDmhA.png +0 -0
  116. package/packages/storefront/dist/client/_astro/ecom-icon_Z27EX9f.png +0 -0
  117. package/packages/storefront/dist/client/_astro/ecom-icon_Zo1CLq.png +0 -0
  118. package/packages/storefront/dist/client/_astro/{firebase-app.8c541cce.js → firebase-app.3f59f3c7.js} +3 -3
  119. package/packages/storefront/dist/client/_astro/headphone_1Ekzdh.avif +0 -0
  120. package/packages/storefront/dist/client/_astro/headphone_Z1GbHcH.webp +0 -0
  121. package/packages/storefront/dist/client/_astro/{hoisted.85fdcf03.js → hoisted.648beb9d.js} +1 -1
  122. package/packages/storefront/dist/client/_astro/index.fadf28bd.js +1 -0
  123. package/packages/storefront/dist/client/_astro/logo_144owC.webp +0 -0
  124. package/packages/storefront/dist/client/_astro/logo_1ug3XF.png +0 -0
  125. package/packages/storefront/dist/client/_astro/logo_Z1EIN1I.avif +0 -0
  126. package/packages/storefront/dist/client/_astro/{modules-info.e5d77bf3.js → modules-info.df822732.js} +1 -1
  127. package/packages/storefront/dist/client/_astro/passion_1LvKlp.webp +0 -0
  128. package/packages/storefront/dist/client/_astro/passion_2PSWs.avif +0 -0
  129. package/packages/storefront/dist/client/_astro/rect8589_1A8K2Q.webp +0 -0
  130. package/packages/storefront/dist/client/_astro/rect8589_1ND0he.png +0 -0
  131. package/packages/storefront/dist/client/_astro/rect8589_1mIaKd.png +0 -0
  132. package/packages/storefront/dist/client/_astro/rect8589_LhopI.avif +0 -0
  133. package/packages/storefront/dist/client/_astro/rect8589_Z1NFjiR.avif +0 -0
  134. package/packages/storefront/dist/client/_astro/rect8589_Z2a06Gx.png +0 -0
  135. package/packages/storefront/dist/client/_astro/rect8589_Z2nulUU.webp +0 -0
  136. package/packages/storefront/dist/client/_astro/rect8589_ZH7hsH.avif +0 -0
  137. package/packages/storefront/dist/client/_astro/rect8589_ZorpIx.webp +0 -0
  138. package/packages/storefront/dist/client/_astro/rect859_1CcLjM.avif +0 -0
  139. package/packages/storefront/dist/client/_astro/rect859_1IVKep.png +0 -0
  140. package/packages/storefront/dist/client/_astro/rect859_1zkdb4.webp +0 -0
  141. package/packages/storefront/dist/client/_astro/rect859_299fN7.avif +0 -0
  142. package/packages/storefront/dist/client/_astro/rect859_CnIof.png +0 -0
  143. package/packages/storefront/dist/client/_astro/rect859_Z1OtQaE.avif +0 -0
  144. package/packages/storefront/dist/client/_astro/rect859_flB3g.png +0 -0
  145. package/packages/storefront/dist/client/_astro/rect859_rsWaw.webp +0 -0
  146. package/packages/storefront/dist/client/_astro/rect859_sLbkT.webp +0 -0
  147. package/packages/storefront/dist/client/_astro/rect89_1yf5jS.avif +0 -0
  148. package/packages/storefront/dist/client/_astro/rect89_GQBli.webp +0 -0
  149. package/packages/storefront/dist/client/~fallback.html +67 -0
  150. package/packages/storefront/dist/client/~index.html +113 -0
  151. package/packages/storefront/dist/server/chunks/{CartSidebar.41b20543.mjs → CartSidebar.4179ad81.mjs} +4 -12
  152. package/packages/storefront/dist/server/chunks/{SearchModal.5f5e6a15.mjs → SearchModal.146ce2f7.mjs} +4 -11
  153. package/packages/storefront/dist/server/chunks/{endpoint@_@js.11be892a.mjs → _...05c626ea.mjs} +3 -10
  154. package/packages/storefront/dist/server/chunks/{account@_@astro.204fba92.mjs → account@_@astro.5eaddaf8.mjs} +2 -9
  155. package/packages/storefront/dist/server/chunks/{index@_@astro.19e0f502.mjs → index@_@astro.25a343cc.mjs} +3 -10
  156. package/packages/storefront/dist/server/chunks/{index@_@astro.b37a6ac9.mjs → index@_@astro.2d2f2e33.mjs} +3 -10
  157. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.36e8882b.mjs → _...slug_.astro.0808946e.mjs} +1836 -450
  158. package/packages/storefront/dist/server/chunks/pages/index.astro.d4145872.mjs +186 -0
  159. package/packages/storefront/dist/server/chunks/pages/{~fallback.astro.ba4c2475.mjs → ~fallback.astro.84d4765b.mjs} +6 -23
  160. package/packages/storefront/dist/server/chunks/{~fallback@_@astro.6bb4c4b4.mjs → ~fallback@_@astro.86d710c3.mjs} +3 -10
  161. package/packages/storefront/dist/server/entry.mjs +7 -14
  162. package/packages/storefront/dist/server/images.dist.csv +30 -0
  163. package/packages/storefront/dist/server/images.src.csv +11 -0
  164. package/packages/storefront/dist/server/renderers.mjs +2 -9
  165. package/packages/storefront/dist/server/static-builds.csv +51 -0
  166. package/packages/storefront/package.json +3 -3
  167. package/packages/storefront/scripts/build-prod.sh +3 -2
  168. package/packages/storefront/server.d.ts +1 -0
  169. package/packages/storefront/src/lib/assets/base.css +8 -0
  170. package/packages/storefront/src/lib/assets/reset.css +11 -2
  171. package/packages/storefront/src/lib/components/ContentClearfix.astro +4 -1
  172. package/packages/storefront/src/lib/components/Drawer.vue +1 -1
  173. package/packages/storefront/src/lib/layouts/BaseBody.astro +3 -1
  174. package/packages/storefront/src/lib/layouts/BaseHead.astro +8 -3
  175. package/packages/storefront/src/lib/layouts/use-page-header.ts +2 -2
  176. package/packages/test-base/package.json +1 -1
  177. package/packages/types/package.json +1 -1
  178. package/pnpm-workspace.yaml +2 -0
  179. package/ecomplus-stores/monocard/functions/core/index.js +0 -9
  180. package/ecomplus-stores/monocard/functions/core/package.json +0 -20
  181. package/ecomplus-stores/monocard/functions/events/index.js +0 -9
  182. package/ecomplus-stores/monocard/functions/passport/package.json +0 -21
  183. package/ecomplus-stores/monocard/functions/ssr/content/blog.json +0 -18
  184. package/ecomplus-stores/monocard/functions/ssr/content/brands.json +0 -24
  185. package/ecomplus-stores/monocard/functions/ssr/content/categories.json +0 -24
  186. package/ecomplus-stores/monocard/functions/ssr/content/collections.json +0 -24
  187. package/ecomplus-stores/monocard/functions/ssr/content/home.json +0 -45
  188. package/ecomplus-stores/monocard/functions/ssr/content/maintenance.json +0 -6
  189. package/ecomplus-stores/monocard/functions/ssr/content/pages/contato.json +0 -6
  190. package/ecomplus-stores/monocard/functions/ssr/content/pages/entrega.json +0 -6
  191. package/ecomplus-stores/monocard/functions/ssr/content/pages/faq.json +0 -6
  192. package/ecomplus-stores/monocard/functions/ssr/content/pages/pagamentos.json +0 -6
  193. package/ecomplus-stores/monocard/functions/ssr/content/pages/privacidade.json +0 -6
  194. package/ecomplus-stores/monocard/functions/ssr/content/pages/sobre-nos.json +0 -6
  195. package/ecomplus-stores/monocard/functions/ssr/content/pages/termos.json +0 -6
  196. package/ecomplus-stores/monocard/functions/ssr/content/pages/trocas.json +0 -6
  197. package/ecomplus-stores/monocard/functions/ssr/content/posts/esta-loja-e-um-pwa.json +0 -9
  198. package/ecomplus-stores/monocard/functions/ssr/content/products.json +0 -32
  199. package/ecomplus-stores/monocard/functions/ssr/content/search.json +0 -8
  200. package/ecomplus-stores/monocard/functions/ssr/content/widgets/analytics.json +0 -11
  201. package/ecomplus-stores/monocard/functions/ssr/content/widgets/compre-confie.json +0 -11
  202. package/ecomplus-stores/monocard/functions/ssr/content/widgets/ebit.json +0 -11
  203. package/ecomplus-stores/monocard/functions/ssr/content/widgets/fb-pixel.json +0 -12
  204. package/ecomplus-stores/monocard/functions/ssr/content/widgets/gmc-ratings.json +0 -12
  205. package/ecomplus-stores/monocard/functions/ssr/content/widgets/minicart.json +0 -6
  206. package/ecomplus-stores/monocard/functions/ssr/content/widgets/offers-notification.json +0 -11
  207. package/ecomplus-stores/monocard/functions/ssr/content/widgets/opinioes-verificadas.json +0 -18
  208. package/ecomplus-stores/monocard/functions/ssr/content/widgets/product-card.json +0 -10
  209. package/ecomplus-stores/monocard/functions/ssr/content/widgets/product.json +0 -13
  210. package/ecomplus-stores/monocard/functions/ssr/content/widgets/search-engine.json +0 -8
  211. package/ecomplus-stores/monocard/functions/ssr/content/widgets/search.json +0 -6
  212. package/ecomplus-stores/monocard/functions/ssr/content/widgets/tag-manager.json +0 -12
  213. package/ecomplus-stores/monocard/functions/ssr/content/widgets/tawkto.json +0 -12
  214. package/ecomplus-stores/monocard/functions/ssr/content/widgets/trustvox.json +0 -15
  215. package/ecomplus-stores/monocard/functions/ssr/content/widgets/user.json +0 -5
  216. package/ecomplus-stores/monocard/functions/ssr/public/admin/config.json +0 -1
  217. package/ecomplus-stores/monocard/functions/ssr/public/assets/cms-preview.css +0 -274
  218. package/ecomplus-stores/monocard/functions/ssr/public/assets/cms.css +0 -114
  219. package/ecomplus-stores/monocard/functions/ssr/public/assets/cvv.png +0 -0
  220. package/ecomplus-stores/monocard/functions/ssr/public/assets/fonts/FavoritPro-Regular.woff2 +0 -0
  221. package/ecomplus-stores/monocard/functions/ssr/public/assets/fonts/MyriadPro-Regular.woff2 +0 -0
  222. package/ecomplus-stores/monocard/functions/ssr/public/assets/ssl-safe.png +0 -0
  223. package/ecomplus-stores/monocard/functions/ssr/src/layouts/Pages.astro +0 -50
  224. package/ecomplus-stores/monocard/functions/ssr/src/pages/fallback.astro +0 -21
  225. package/packages/storefront/dist/client/_astro/ShopHeader.7e485e35.js +0 -4
  226. package/packages/storefront/dist/client/_astro/_...slug_.b693913e.css +0 -1
  227. package/packages/storefront/dist/client/_astro/index.ea57babe.js +0 -1
  228. package/packages/storefront/dist/server/chunks/_...4a2548d2.mjs +0 -35
  229. package/packages/storefront/dist/server/chunks/pages/endpoint.js.f7a896a1.mjs +0 -119
  230. package/packages/storefront/dist/server/chunks/pages/index.astro.3145bd93.mjs +0 -1649
  231. /package/ecomplus-stores/monocard/functions/ssr/src/components/{FeatureTabs.astro → FeaturesSection.astro} +0 -0
@@ -1,22 +1,14 @@
1
- import 'kleur/colors';
2
- import 'node:fs/promises';
3
- import { resolve, join } from 'node:path';
4
- import 'node:url';
5
- import 'http-cache-semantics';
6
- import 'node:os';
7
- import sizeOf from 'image-size';
8
- import 'magic-string';
9
- import mime from 'mime';
10
- import 'node:stream';
11
1
  import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, d as renderComponent, u as unescapeHTML, F as Fragment, s as spreadAttributes, e as renderSlotToString, f as renderAllHeadContent, m as maybeRenderHead, g as renderSlot } from '../astro.708269c6.mjs';
12
2
  import api from '@cloudcommerce/api';
13
3
  import { EventEmitter } from 'node:events';
14
- import fs from 'node:fs';
4
+ import fs, { readFileSync } from 'node:fs';
5
+ import { resolve, join } from 'node:path';
15
6
  import config from '@cloudcommerce/config';
16
- import { img, price, formatMoney, randomObjectId, nickname } from '@ecomplus/utils';
7
+ import { img, price, formatMoney, randomObjectId, nickname, inStock, name, onPromotion, categoriesList } from '@ecomplus/utils';
17
8
  import { renderSync, parse, walkSync, ELEMENT_NODE } from 'ultrahtml';
18
- /* empty css */import { reactive, computed, shallowRef, useSSRContext, defineComponent, inject, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, resolveComponent, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, withModifiers, Teleport, createTextVNode, toDisplayString, defineAsyncComponent, Suspense } from 'vue';
19
- import { useScroll, useElementHover, useDebounceFn, useTimeout, watchDebounced, promiseTimeout, watchOnce } from '@vueuse/core';
9
+ /* empty css */import mime from 'mime';
10
+ import { reactive, computed, shallowRef, useSSRContext, defineComponent, inject, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, resolveComponent, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, withModifiers, Teleport, createTextVNode, toDisplayString, defineAsyncComponent, Suspense, createSlots, shallowReactive, withAsyncContext } from 'vue';
11
+ import { useScroll, useElementHover, useDebounceFn, useTimeout, watchDebounced, promiseTimeout, onClickOutside, watchOnce } from '@vueuse/core';
20
12
  import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrIncludeBooleanAttr, ssrRenderAttr, ssrRenderTeleport, ssrInterpolate, ssrRenderSuspense } from 'vue/server-renderer';
21
13
  import { Popover, PopoverButton, PopoverPanel, Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue';
22
14
 
@@ -28,108 +20,6 @@ const _export_sfc = (sfc, props) => {
28
20
  return target;
29
21
  };
30
22
 
31
- function isOutputFormat(value) {
32
- return ["avif", "jpeg", "jpg", "png", "webp", "svg"].includes(value);
33
- }
34
- function isOutputFormatSupportsAlpha(value) {
35
- return ["avif", "png", "webp"].includes(value);
36
- }
37
- function isAspectRatioString(value) {
38
- return /^\d*:\d*$/.test(value);
39
- }
40
- function parseAspectRatio(aspectRatio) {
41
- if (!aspectRatio) {
42
- return void 0;
43
- }
44
- if (typeof aspectRatio === "number") {
45
- return aspectRatio;
46
- } else {
47
- const [width, height] = aspectRatio.split(":");
48
- return parseInt(width) / parseInt(height);
49
- }
50
- }
51
- function isSSRService(service) {
52
- return "transform" in service;
53
- }
54
- class BaseSSRService {
55
- async getImageAttributes(transform) {
56
- const { width, height, src, format, quality, aspectRatio, ...rest } = transform;
57
- return {
58
- ...rest,
59
- width,
60
- height
61
- };
62
- }
63
- serializeTransform(transform) {
64
- const searchParams = new URLSearchParams();
65
- if (transform.quality) {
66
- searchParams.append("q", transform.quality.toString());
67
- }
68
- if (transform.format) {
69
- searchParams.append("f", transform.format);
70
- }
71
- if (transform.width) {
72
- searchParams.append("w", transform.width.toString());
73
- }
74
- if (transform.height) {
75
- searchParams.append("h", transform.height.toString());
76
- }
77
- if (transform.aspectRatio) {
78
- searchParams.append("ar", transform.aspectRatio.toString());
79
- }
80
- if (transform.fit) {
81
- searchParams.append("fit", transform.fit);
82
- }
83
- if (transform.background) {
84
- searchParams.append("bg", transform.background);
85
- }
86
- if (transform.position) {
87
- searchParams.append("p", encodeURI(transform.position));
88
- }
89
- searchParams.append("href", transform.src);
90
- return { searchParams };
91
- }
92
- parseTransform(searchParams) {
93
- if (!searchParams.has("href")) {
94
- return void 0;
95
- }
96
- let transform = { src: searchParams.get("href") };
97
- if (searchParams.has("q")) {
98
- transform.quality = parseInt(searchParams.get("q"));
99
- }
100
- if (searchParams.has("f")) {
101
- const format = searchParams.get("f");
102
- if (isOutputFormat(format)) {
103
- transform.format = format;
104
- }
105
- }
106
- if (searchParams.has("w")) {
107
- transform.width = parseInt(searchParams.get("w"));
108
- }
109
- if (searchParams.has("h")) {
110
- transform.height = parseInt(searchParams.get("h"));
111
- }
112
- if (searchParams.has("ar")) {
113
- const ratio = searchParams.get("ar");
114
- if (isAspectRatioString(ratio)) {
115
- transform.aspectRatio = ratio;
116
- } else {
117
- transform.aspectRatio = parseFloat(ratio);
118
- }
119
- }
120
- if (searchParams.has("fit")) {
121
- transform.fit = searchParams.get("fit");
122
- }
123
- if (searchParams.has("p")) {
124
- transform.position = decodeURI(searchParams.get("p"));
125
- }
126
- if (searchParams.has("bg")) {
127
- transform.background = searchParams.get("bg");
128
- }
129
- return transform;
130
- }
131
- }
132
-
133
23
  global.__storefrontCMS = (fs, resolvePath) => {
134
24
  const { STOREFRONT_BASE_DIR } = process.env;
135
25
  let baseDir;
@@ -308,7 +198,7 @@ const loadRouteContext = async (Astro, {
308
198
  const isHomepage = urlPath === "/";
309
199
  const config = getConfig();
310
200
  globalThis.$storefront.settings = config.settings;
311
- let cmsContent;
201
+ let cmsContent = { sections: [] };
312
202
  const apiState = {};
313
203
  const apiPrefetchings = [
314
204
  ...apiPrefetchEndpoints.map((endpoint) => {
@@ -338,6 +228,11 @@ const loadRouteContext = async (Astro, {
338
228
  api.get(`slugs/${slug}`).then((response) => {
339
229
  Object.assign(apiContext, response.data);
340
230
  const apiResource = apiContext.resource;
231
+ config.getContent(`pages/${apiResource}`).then((_cmsContent) => {
232
+ if (cmsContent && _cmsContent) {
233
+ Object.assign(cmsContent, _cmsContent);
234
+ }
235
+ }).catch(console.warn);
341
236
  const apiDoc = apiContext.doc;
342
237
  apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
343
238
  globalThis.$storefront.apiContext = {
@@ -419,23 +314,21 @@ const loadRouteContext = async (Astro, {
419
314
 
420
315
  const pwaInfo = {"pwaInDevEnvironment":false,"webManifest":{"href":"/manifest.webmanifest","useCredentials":false,"linkTag":"<link rel=\"manifest\" href=\"/manifest.webmanifest\">"}};
421
316
 
422
- const $$Astro$9 = createAstro("https://ecom2-demo.web.app");
317
+ const $$Astro$g = createAstro("https://ecom2-demo.web.app");
423
318
  const $$ViewTransitions = createComponent(async ($$result, $$props, $$slots) => {
424
- const Astro2 = $$result.createAstro($$Astro$9, $$props, $$slots);
319
+ const Astro2 = $$result.createAstro($$Astro$g, $$props, $$slots);
425
320
  Astro2.self = $$ViewTransitions;
426
321
  const { fallback = "animate" } = Astro2.props;
427
- return renderTemplate`<meta name="astro-view-transitions-enabled" content="true">
428
- <meta name="astro-view-transitions-fallback"${addAttribute(fallback, "content")}>
429
- `;
322
+ return renderTemplate`<meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback"${addAttribute(fallback, "content")}>`;
430
323
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/astro/components/ViewTransitions.astro", void 0);
431
324
 
432
- var __freeze$2 = Object.freeze;
433
- var __defProp$2 = Object.defineProperty;
434
- var __template$2 = (cooked, raw) => __freeze$2(__defProp$2(cooked, "raw", { value: __freeze$2(raw || cooked.slice()) }));
435
- var _a$2;
436
- const $$Astro$8 = createAstro("https://ecom2-demo.web.app");
325
+ var __freeze$4 = Object.freeze;
326
+ var __defProp$4 = Object.defineProperty;
327
+ var __template$4 = (cooked, raw) => __freeze$4(__defProp$4(cooked, "raw", { value: __freeze$4(raw || cooked.slice()) }));
328
+ var _a$4;
329
+ const $$Astro$f = createAstro("https://ecom2-demo.web.app");
437
330
  const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
438
- const Astro2 = $$result.createAstro($$Astro$8, $$props, $$slots);
331
+ const Astro2 = $$result.createAstro($$Astro$f, $$props, $$slots);
439
332
  Astro2.self = $$BaseHead;
440
333
  const deployRand = ({}).DEPLOY_RAND || "_";
441
334
  const getIconUrl = (size) => {
@@ -517,13 +410,18 @@ setTimeout(() => {
517
410
  }
518
411
  return nestedDoc;
519
412
  };
520
- inlineClientJS += `
521
- window.$storefront.apiContext = ${JSON.stringify({
413
+ Astro2.locals.contextInlineClientJS = `
414
+ $storefront.apiContext = ${JSON.stringify({
522
415
  resource: apiContext.resource,
523
416
  doc: minifyApiDoc({ ...apiDoc }),
524
417
  timestamp: Date.now()
525
418
  })};
526
- window.$storefront.context /* DEPRECATED */ = window.$storefront.apiContext`;
419
+ $storefront.context /* DEPRECATED */ = $storefront.apiContext`;
420
+ } else {
421
+ Astro2.locals.contextInlineClientJS = `
422
+ $storefront.apiContext = null;
423
+ delete $storefront.apiContext;
424
+ delete $storefront.context;`;
527
425
  }
528
426
  if (isPreview) {
529
427
  inlineClientJS += `
@@ -536,7 +434,7 @@ window.$isCmsPreview = true;`;
536
434
  url: `https://${domain}/`,
537
435
  logo: `https://${domain}${settings.logo}`
538
436
  });
539
- return renderTemplate(_a$2 || (_a$2 = __template$2(['<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width">\n<meta name="theme-color"', '>\n<link rel="icon" type="image/png"', ' sizes="32x32">\n', "\n<title>", '</title>\n<meta name="description"', '>\n<meta name="author"', '>\n<meta name="generator"', '>\n<link rel="canonical"', ">\n", '\n<meta name="apple-mobile-web-app-capable" content="yes">\n<meta name="apple-mobile-web-app-status-bar-style" content="default">\n<meta property="og:site_name"', '>\n<meta property="og:url"', '>\n<meta property="og:title"', '>\n<meta property="og:description"', '>\n<meta property="og:type" content="website">\n<meta property="og:locale"', ">\n", "\n", '\n<meta name="twitter:card" content="summary">\n', '\n<meta name="ecom-store-id"', ">\n\n\n", "\n", "\n\n<script>", '<\/script>\n<script type="application/ld+json">', "<\/script>\n\n", ""])), addAttribute(primaryColor, "content"), addAttribute(favicon, "href"), shortcutIcon && renderTemplate`<link rel="icon" type="image/png"${addAttribute(shortcutIcon, "href")} sizes="192x192">`, title, addAttribute(description, "content"), addAttribute(settings.name, "content"), addAttribute(Astro2.generator, "content"), addAttribute(canonicalUrl, "href"), shortcutIcon && renderTemplate`<link rel="apple-touch-icon"${addAttribute(shortcutIcon, "href")}>`, addAttribute(settings.name, "content"), addAttribute(canonicalUrl, "content"), addAttribute(title, "content"), addAttribute(description, "content"), addAttribute(ogLocale, "content"), ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`, metatagsContent?.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(metatagsContent.fb_app_id, "content")}>`, metatagsContent?.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(metatagsContent.twitter_username, "content")}>`, addAttribute(String(storeId), "content"), pwaInfo && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(pwaInfo.webManifest.linkTag)}` })}`, !pwaInfo && !false && renderTemplate`<link rel="manifest" href="/manifest.webmanifest">`, unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd), renderComponent($$result, "ViewTransitions", $$ViewTransitions, {}));
437
+ return renderTemplate(_a$4 || (_a$4 = __template$4(['<meta charset="UTF-8"><meta name="viewport" content="width=device-width"><meta name="theme-color"', '><link rel="icon" type="image/png"', ' sizes="32x32">', "<title>", '</title><meta name="description"', '><meta name="author"', '><meta name="generator"', '><link rel="canonical"', ">", '<meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta property="og:site_name"', '><meta property="og:url"', '><meta property="og:title"', '><meta property="og:description"', '><meta property="og:type" content="website"><meta property="og:locale"', ">", "", '<meta name="twitter:card" content="summary">', '<meta name="ecom-store-id"', ">", "", "<script>", '<\/script><script type="application/ld+json">', "<\/script>", ""])), addAttribute(primaryColor, "content"), addAttribute(favicon, "href"), shortcutIcon && renderTemplate`<link rel="icon" type="image/png"${addAttribute(shortcutIcon, "href")} sizes="192x192">`, title, addAttribute(description, "content"), addAttribute(settings.name, "content"), addAttribute(Astro2.generator, "content"), addAttribute(canonicalUrl, "href"), shortcutIcon && renderTemplate`<link rel="apple-touch-icon"${addAttribute(shortcutIcon, "href")}>`, addAttribute(settings.name, "content"), addAttribute(canonicalUrl, "content"), addAttribute(title, "content"), addAttribute(description, "content"), addAttribute(ogLocale, "content"), ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`, metatagsContent?.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(metatagsContent.fb_app_id, "content")}>`, metatagsContent?.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(metatagsContent.twitter_username, "content")}>`, addAttribute(String(storeId), "content"), pwaInfo && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(pwaInfo.webManifest.linkTag)}` })}`, !pwaInfo && !false && renderTemplate`<link rel="manifest" href="/manifest.webmanifest">`, unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd), renderComponent($$result, "ViewTransitions", $$ViewTransitions, {}));
540
438
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro", void 0);
541
439
 
542
440
  function has(value) {
@@ -675,147 +573,95 @@ const Head = createComponent({
675
573
  }
676
574
  });
677
575
 
678
- function isRemoteImage(src) {
679
- return /^(https?:)?\/\//.test(src);
680
- }
576
+ const { STOREFRONT_BASE_DIR } = process.env;
577
+ const baseDir = STOREFRONT_BASE_DIR || process.cwd();
578
+ const builtImages = [];
579
+ const manifestFilepath = join(baseDir, "dist/server/images.dist.csv");
580
+ readFileSync(manifestFilepath, "utf-8").split(/\n/).forEach((line) => {
581
+ const [filename, width, height] = line.split(",");
582
+ builtImages.push({
583
+ filename,
584
+ width: Number(width),
585
+ height: Number(height)
586
+ });
587
+ });
588
+ builtImages.sort((a, b) => {
589
+ if (a.width < b.width)
590
+ return -1;
591
+ return 1;
592
+ });
593
+ const getBuiltImage = async ({ src, width, format }) => {
594
+ const filename = src.replace(/^.*\//, "").replace(/.\w+(\?.*)?$/, "");
595
+ const filenameRegExp = new RegExp(`[_.][a-z0-9]+\\.${format}$`, "i");
596
+ const matchFilename = (_builtImage) => {
597
+ return filename === _builtImage.filename.replace(filenameRegExp, "");
598
+ };
599
+ let builtImage = builtImages.find((_builtImage) => {
600
+ return _builtImage.width >= width && matchFilename(_builtImage);
601
+ });
602
+ if (!builtImage) {
603
+ builtImage = builtImages.find(matchFilename);
604
+ }
605
+ if (builtImage) {
606
+ return {
607
+ src: `/_astro/${builtImage.filename}`,
608
+ width: builtImage.width,
609
+ height: builtImage.height
610
+ };
611
+ }
612
+ console.warn(`Could not match built ${format} image for ${src} ${width}px`);
613
+ return { src, width };
614
+ };
615
+
681
616
  function removeQueryString(src) {
682
617
  const index = src.lastIndexOf("?");
683
618
  return index > 0 ? src.substring(0, index) : src;
684
619
  }
685
- function extname(src) {
620
+ function basename(src) {
621
+ return removeQueryString(src.replace(/^.*[\\\/]/, ""));
622
+ }
623
+ const extname = (src) => {
686
624
  const base = basename(src);
687
625
  const index = base.lastIndexOf(".");
688
626
  if (index <= 0) {
689
627
  return "";
690
628
  }
691
629
  return base.substring(index);
692
- }
693
- function basename(src) {
694
- return removeQueryString(src.replace(/^.*[\\\/]/, ""));
695
- }
696
-
697
- function resolveSize(transform) {
698
- if (transform.width && transform.height) {
699
- return transform;
700
- }
701
- if (!transform.width && !transform.height) {
702
- throw new Error(`"width" and "height" cannot both be undefined`);
703
- }
704
- if (!transform.aspectRatio) {
705
- throw new Error(
706
- `"aspectRatio" must be included if only "${transform.width ? "width" : "height"}" is provided`
707
- );
708
- }
709
- let aspectRatio;
710
- if (typeof transform.aspectRatio === "number") {
711
- aspectRatio = transform.aspectRatio;
712
- } else {
713
- const [width, height] = transform.aspectRatio.split(":");
714
- aspectRatio = Number.parseInt(width) / Number.parseInt(height);
715
- }
716
- if (transform.width) {
717
- return {
718
- ...transform,
719
- width: transform.width,
720
- height: Math.round(transform.width / aspectRatio)
721
- };
722
- } else if (transform.height) {
723
- return {
724
- ...transform,
725
- width: Math.round(transform.height * aspectRatio),
726
- height: transform.height
727
- };
728
- }
729
- return transform;
730
- }
731
- async function resolveTransform(input) {
732
- if (typeof input.src === "string") {
733
- return resolveSize(input);
734
- }
735
- const metadata = "then" in input.src ? (await input.src).default : input.src;
736
- let { width, height, aspectRatio, background, format = metadata.format, ...rest } = input;
737
- if (!width && !height) {
738
- width = metadata.width;
739
- height = metadata.height;
740
- } else if (width) {
741
- let ratio = parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
742
- height = height || Math.round(width / ratio);
743
- } else if (height) {
744
- let ratio = parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
745
- width = width || Math.round(height * ratio);
746
- }
747
- return {
748
- ...rest,
749
- src: metadata.src,
750
- width,
751
- height,
752
- aspectRatio,
753
- format,
754
- background
755
- };
756
- }
757
- async function getImage(transform) {
758
- var _a, _b, _c;
759
- if (!transform.src) {
760
- throw new Error("[@astrojs/image] `src` is required");
761
- }
762
- let loader = (_a = globalThis.astroImage) == null ? void 0 : _a.loader;
763
- if (!loader) {
764
- const { default: mod } = await import('./endpoint.js.f7a896a1.mjs').then(n => n.s).catch(() => {
765
- throw new Error(
766
- "[@astrojs/image] Builtin image loader not found. (Did you remember to add the integration to your Astro config?)"
767
- );
768
- });
769
- loader = mod;
770
- globalThis.astroImage = globalThis.astroImage || {};
771
- globalThis.astroImage.loader = loader;
772
- }
773
- const resolved = await resolveTransform(transform);
774
- const attributes = await loader.getImageAttributes(resolved);
775
- const isDev = (_b = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":true,"SITE":"https://ecom2-demo.web.app","ASSETS_PREFIX":undefined},{SSR:true,}))) == null ? void 0 : _b.DEV;
776
- const isLocalImage = !isRemoteImage(resolved.src);
777
- const _loader = isDev && isLocalImage ? globalThis.astroImage.defaultLoader : loader;
778
- if (!_loader) {
779
- throw new Error("@astrojs/image: loader not found!");
780
- }
781
- const { searchParams } = isSSRService(_loader) ? _loader.serializeTransform(resolved) : globalThis.astroImage.defaultLoader.serializeTransform(resolved);
782
- const imgSrc = !isLocalImage && resolved.src.startsWith("//") ? `https:${resolved.src}` : resolved.src;
783
- let src;
784
- if (/^[\/\\]?@astroimage/.test(imgSrc)) {
785
- src = `${imgSrc}?${searchParams.toString()}`;
786
- } else {
787
- searchParams.set("href", imgSrc);
788
- src = `/_image?${searchParams.toString()}`;
630
+ };
631
+ function parseAspectRatio(aspectRatio) {
632
+ if (!aspectRatio) {
633
+ return void 0;
789
634
  }
790
- if ((_c = globalThis.astroImage) == null ? void 0 : _c.addStaticImage) {
791
- src = globalThis.astroImage.addStaticImage(resolved);
635
+ if (typeof aspectRatio === "number") {
636
+ return aspectRatio;
792
637
  }
793
- return {
794
- ...attributes,
795
- src
796
- };
638
+ const [width, height] = aspectRatio.split(":");
639
+ return parseInt(width, 10) / parseInt(height, 10);
797
640
  }
798
-
799
641
  async function resolveAspectRatio({ src, aspectRatio }) {
800
642
  if (typeof src === "string") {
801
643
  return parseAspectRatio(aspectRatio);
802
- } else {
803
- const metadata = "then" in src ? (await src).default : src;
804
- return parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
805
644
  }
645
+ throw new Error('Custom (faster) `Picture.ssr.astro` works only with string ("remote") src');
806
646
  }
807
647
  async function resolveFormats({ src, formats }) {
808
648
  const unique = new Set(formats);
809
649
  if (typeof src === "string") {
810
650
  unique.add(extname(src).replace(".", ""));
811
651
  } else {
812
- const metadata = "then" in src ? (await src).default : src;
813
- unique.add(extname(metadata.src).replace(".", ""));
652
+ throw new Error("Custom `Picture.ssr.astro` works only with string src");
814
653
  }
815
654
  return Array.from(unique).filter(Boolean);
816
655
  }
817
- async function getPicture(params) {
818
- const { src, alt, widths, fit, position, background } = params;
656
+ async function getBuiltPicture(params) {
657
+ const {
658
+ src,
659
+ alt,
660
+ widths,
661
+ fit,
662
+ position,
663
+ background
664
+ } = params;
819
665
  if (!src) {
820
666
  throw new Error("[@astrojs/image] `src` is required");
821
667
  }
@@ -833,8 +679,7 @@ async function getPicture(params) {
833
679
  async function getSource(format) {
834
680
  const imgs = await Promise.all(
835
681
  widths.map(async (width) => {
836
- var _a;
837
- const img = await getImage({
682
+ const img = await getBuiltImage({
838
683
  src,
839
684
  alt,
840
685
  format,
@@ -847,7 +692,7 @@ async function getPicture(params) {
847
692
  if (format === lastFormat && width === maxWidth) {
848
693
  image = img;
849
694
  }
850
- return `${(_a = img.src) == null ? void 0 : _a.replaceAll(" ", encodeURI)} ${width}w`;
695
+ return `${img.src} ${width}w`;
851
696
  })
852
697
  );
853
698
  return {
@@ -858,7 +703,7 @@ async function getPicture(params) {
858
703
  const sources = await Promise.all(allFormats.map((format) => getSource(format)));
859
704
  return {
860
705
  sources,
861
- // @ts-expect-error image will always be defined
706
+ // @ts-ignore
862
707
  image
863
708
  };
864
709
  }
@@ -1004,22 +849,31 @@ const useSSRPicture = async (params) => {
1004
849
  };
1005
850
  };
1006
851
 
1007
- const $$Astro$7 = createAstro("https://ecom2-demo.web.app");
852
+ const $$Astro$e = createAstro("https://ecom2-demo.web.app");
1008
853
  const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
1009
- const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
854
+ const Astro2 = $$result.createAstro($$Astro$e, $$props, $$slots);
1010
855
  Astro2.self = $$Picture;
1011
- const deployRand = ({}).DEPLOY_RAND;
1012
- const versionSuffix = ({}).BUILD_OUTPUT !== "static" && deployRand ? `&V=${deployRand}` : "";
1013
- const getImageFilepath = (src) => {
1014
- return resolve(process.env.STOREFRONT_BASE_DIR, `public${src}`);
1015
- };
856
+ const { STOREFRONT_BASE_DIR } = process.env;
857
+ const baseDir = STOREFRONT_BASE_DIR || process.cwd();
858
+ const originalImages = [];
859
+ const manifestFilepath = join(baseDir, "dist/server/images.src.csv");
860
+ readFileSync(manifestFilepath, "utf-8").split(/\n/).forEach((line) => {
861
+ const [filepath, width, height] = line.split(",");
862
+ originalImages.push({
863
+ filepath,
864
+ width: Number(width),
865
+ height: Number(height)
866
+ });
867
+ });
1016
868
  const tryImageSize = (src) => {
1017
869
  let dimensions = {};
1018
870
  if (typeof src === "string" && src.startsWith("/")) {
1019
- try {
1020
- dimensions = sizeOf(getImageFilepath(src));
1021
- } catch (e) {
1022
- dimensions = {};
871
+ const originalImage = originalImages.find(({ filepath }) => {
872
+ return new RegExp(`^/${filepath}\\??.*`).test(src);
873
+ });
874
+ if (originalImage) {
875
+ const { width, height } = originalImage;
876
+ dimensions = { width, height };
1023
877
  }
1024
878
  }
1025
879
  return dimensions;
@@ -1032,77 +886,49 @@ const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
1032
886
  } = await useSSRPicture({
1033
887
  ...Astro2.props,
1034
888
  tryImageSize,
1035
- getPicture
889
+ getPicture: getBuiltPicture
1036
890
  });
1037
- if (imgAttrs) {
1038
- imgAttrs.src += versionSuffix;
1039
- }
1040
- return renderTemplate`${maybeRenderHead()}<picture${spreadAttributes(pictureAttrs)}>
1041
- ${sources.map((attrs) => {
1042
- if (versionSuffix) {
1043
- attrs.srcset = attrs.srcset.replace(/\s(\w+)$/, `${versionSuffix} $1`);
1044
- }
1045
- return renderTemplate`<source${spreadAttributes(attrs)}${addAttribute(sizes, "sizes")}>`;
1046
- })}
1047
- ${imgAttrs && renderTemplate`<img${spreadAttributes(imgAttrs)}>`}
1048
- </picture>`;
1049
- }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/Picture.astro", void 0);
891
+ return renderTemplate`${maybeRenderHead()}<picture${spreadAttributes(pictureAttrs)}>${sources.map((attrs) => renderTemplate`<source${spreadAttributes(attrs)}${addAttribute(sizes, "sizes")}>`)}${imgAttrs && renderTemplate`<img${spreadAttributes(imgAttrs)}>`}</picture>`;
892
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/images/Picture.runtime.astro", void 0);
1050
893
 
1051
- const $$Astro$6 = createAstro("https://ecom2-demo.web.app");
894
+ var __freeze$3 = Object.freeze;
895
+ var __defProp$3 = Object.defineProperty;
896
+ var __template$3 = (cooked, raw) => __freeze$3(__defProp$3(cooked, "raw", { value: __freeze$3(raw || cooked.slice()) }));
897
+ var _a$3;
898
+ const $$Astro$d = createAstro("https://ecom2-demo.web.app");
1052
899
  const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
1053
- const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
900
+ const Astro2 = $$result.createAstro($$Astro$d, $$props, $$slots);
1054
901
  Astro2.self = $$BaseBody;
1055
902
  const { settings } = Astro2.locals.routeContext;
1056
- return renderTemplate`${maybeRenderHead()}<body>
1057
- <div id="teleported-overlap" class="relative z-[59]"></div>
1058
- <div id="teleported-top" class="relative z-[19]"></div>
1059
- ${renderSlot($$result, $$slots["default"])}
1060
- ${renderSlot($$result, $$slots["before-body-end"])}
1061
- <div id="teleported-bottom" class="relative z-[19]"></div>
1062
- ${settings.icon && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": settings.icon, "alt": "Icon", "formats": ["png"], "widths": [32, 192, 512], "sizes": "32px", "class": "hidden absolute", "style": "bottom: -1000px", "hasImg": false })}`}
1063
- </body>`;
903
+ const { contextInlineClientJS } = Astro2.locals;
904
+ return renderTemplate`${maybeRenderHead()}<body style="visibility:hidden" class="!visible"><!-- Prevent FOUC -->${contextInlineClientJS && renderTemplate(_a$3 || (_a$3 = __template$3(["<script>", "<\/script>"])), unescapeHTML(contextInlineClientJS))}<div id="teleported-overlap" class="relative z-[59]"></div><div id="teleported-top" class="relative z-[19]"></div>${renderSlot($$result, $$slots["default"])}${renderSlot($$result, $$slots["before-body-end"])}<div id="teleported-bottom" class="relative z-[19]"></div>${settings.icon && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": settings.icon, "alt": "Icon", "formats": ["png"], "widths": [32, 192, 512], "sizes": "32px", "class": "hidden absolute", "style": "bottom: -1000px", "hasImg": false })}`}</body>`;
1064
905
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro", void 0);
1065
906
 
1066
- const $$Astro$5 = createAstro("https://ecom2-demo.web.app");
907
+ const $$Astro$c = createAstro("https://ecom2-demo.web.app");
1067
908
  const $$Base$1 = createComponent(async ($$result, $$props, $$slots) => {
1068
- const Astro2 = $$result.createAstro($$Astro$5, $$props, $$slots);
909
+ const Astro2 = $$result.createAstro($$Astro$c, $$props, $$slots);
1069
910
  Astro2.self = $$Base$1;
1070
911
  const { getContent } = Astro2.locals.routeContext;
1071
912
  const { custom_code: customCodeContent } = await getContent("layout");
1072
- return renderTemplate`${renderComponent($$result, "Head", Head, {}, { "default": ($$result2) => renderTemplate`
1073
- ${renderSlot($$result2, $$slots["base-head"])}
1074
- ${customCodeContent?.css && renderTemplate`<style>{customCodeContent.css}</style>`}${customCodeContent?.html_head && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCodeContent.html_head)}` })}`}${renderSlot($$result2, $$slots["base-head-scripts"])}
1075
- ${renderSlot($$result2, $$slots["before-head-end"])}
1076
- ` })}
1077
- ${renderComponent($$result, "BaseBody", $$BaseBody, {}, { "default": ($$result2) => renderTemplate`
1078
- ${renderSlot($$result2, $$slots["default"])}
1079
- ${customCodeContent?.html_body && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCodeContent.html_body)}` })}`}${renderSlot($$result2, $$slots["base-body-scripts"])}
1080
- ${renderSlot($$result2, $$slots["before-body-end"])}
1081
- ` })}`;
913
+ return renderTemplate`${renderComponent($$result, "Head", Head, {}, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["base-head"])}${customCodeContent?.css && renderTemplate`<style>{customCodeContent.css}</style>`}${customCodeContent?.html_head && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCodeContent.html_head)}` })}`}${renderSlot($$result2, $$slots["base-head-scripts"])}${renderSlot($$result2, $$slots["before-head-end"])}` })}${renderComponent($$result, "BaseBody", $$BaseBody, {}, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}${customCodeContent?.html_body && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCodeContent.html_body)}` })}`}${renderSlot($$result2, $$slots["base-body-scripts"])}${renderSlot($$result2, $$slots["before-body-end"])}` })}`;
1082
914
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro", void 0);
1083
915
 
1084
- var __freeze$1 = Object.freeze;
1085
- var __defProp$1 = Object.defineProperty;
1086
- var __template$1 = (cooked, raw) => __freeze$1(__defProp$1(cooked, "raw", { value: __freeze$1(raw || cooked.slice()) }));
1087
- var _a$1;
1088
- const $$Astro$4 = createAstro("https://ecom2-demo.web.app");
916
+ var __freeze$2 = Object.freeze;
917
+ var __defProp$2 = Object.defineProperty;
918
+ var __template$2 = (cooked, raw) => __freeze$2(__defProp$2(cooked, "raw", { value: __freeze$2(raw || cooked.slice()) }));
919
+ var _a$2;
920
+ const $$Astro$b = createAstro("https://ecom2-demo.web.app");
1089
921
  const $$InlineScripts = createComponent(async ($$result, $$props, $$slots) => {
1090
- const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
922
+ const Astro2 = $$result.createAstro($$Astro$b, $$props, $$slots);
1091
923
  Astro2.self = $$InlineScripts;
1092
- return renderTemplate(_a$1 || (_a$1 = __template$1(['<script>\n window.$firebaseConfig = {\n apiKey: "AIzaSyCnvm7QrPKzSBrUi09Z3zTgjDST0t4Yikg",\n authDomain: "ecom2-demo.firebaseapp.com",\n projectId: "ecom2-demo",\n storageBucket: "ecom2-demo.appspot.com",\n messagingSenderId: "70369627313",\n appId: "1:70369627313:web:06634033b9c6208fe7e690"\n };\n<\/script>'])));
924
+ return renderTemplate(_a$2 || (_a$2 = __template$2(['<script>\n window.$firebaseConfig = {\n apiKey: "AIzaSyCnvm7QrPKzSBrUi09Z3zTgjDST0t4Yikg",\n authDomain: "ecom2-demo.firebaseapp.com",\n projectId: "ecom2-demo",\n storageBucket: "ecom2-demo.appspot.com",\n messagingSenderId: "70369627313",\n appId: "1:70369627313:web:06634033b9c6208fe7e690"\n };\n<\/script>'])));
1093
925
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/scripts/InlineScripts.astro", void 0);
1094
926
 
1095
- const $$Astro$3 = createAstro("https://ecom2-demo.web.app");
927
+ const $$Astro$a = createAstro("https://ecom2-demo.web.app");
1096
928
  const $$Base = createComponent(async ($$result, $$props, $$slots) => {
1097
- const Astro2 = $$result.createAstro($$Astro$3, $$props, $$slots);
929
+ const Astro2 = $$result.createAstro($$Astro$a, $$props, $$slots);
1098
930
  Astro2.self = $$Base;
1099
- return renderTemplate`${renderComponent($$result, "SfBase", $$Base$1, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "base-head" }, { "default": ($$result3) => renderTemplate`
1100
- ${renderSlot($$result3, $$slots["base-head"])}
1101
- ` })}`, "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate`
1102
-
1103
-
1104
- ${renderSlot($$result2, $$slots["default"])}
1105
- ` })}`;
931
+ return renderTemplate`${renderComponent($$result, "SfBase", $$Base$1, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "base-head" }, { "default": ($$result3) => renderTemplate`${renderSlot($$result3, $$slots["base-head"])}` })}`, "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}` })}`;
1106
932
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro", void 0);
1107
933
 
1108
934
  const checkObjNotNull = (obj) => {
@@ -1268,7 +1094,7 @@ const usePageHeader = async ({ routeContext, listedCategoryFields }) => {
1268
1094
  const { header: headerContent } = layoutContent;
1269
1095
  const pitchBar = parseLayoutContent(layoutContent);
1270
1096
  let { categories } = apiState;
1271
- if (!categories) {
1097
+ if (!categories && listedCategoryFields !== null) {
1272
1098
  try {
1273
1099
  categories = (await api.get("categories", {
1274
1100
  fields: listedCategoryFields || [
@@ -1299,7 +1125,7 @@ const usePageHeader = async ({ routeContext, listedCategoryFields }) => {
1299
1125
  };
1300
1126
 
1301
1127
  const emitter = new EventEmitter();
1302
- const useSharedData = async ({ field, value }) => {
1128
+ const useSharedData = async ({ field, value, timeout = 1e3 }) => {
1303
1129
  const $data = global.$storefront.data;
1304
1130
  if (value) {
1305
1131
  $data[field] = value;
@@ -1308,7 +1134,16 @@ const useSharedData = async ({ field, value }) => {
1308
1134
  value = $data[field];
1309
1135
  } else {
1310
1136
  value = await new Promise((resolve) => {
1311
- emitter.once(field, resolve);
1137
+ const callback = (_value) => {
1138
+ resolve(_value);
1139
+ clearTimeout(timer);
1140
+ };
1141
+ const abort = () => {
1142
+ resolve(null);
1143
+ emitter.removeListener(field, callback);
1144
+ };
1145
+ const timer = setTimeout(abort, timeout);
1146
+ emitter.once(field, callback);
1312
1147
  });
1313
1148
  }
1314
1149
  return {
@@ -1318,7 +1153,7 @@ window.$storefront.data['${field}'] = ${JSON.stringify(value)};`
1318
1153
  };
1319
1154
  };
1320
1155
 
1321
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1156
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
1322
1157
  __name: "CarouselControl",
1323
1158
  props: {
1324
1159
  isPrev: { type: Boolean, default: false }
@@ -1331,7 +1166,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1331
1166
  return __returned__;
1332
1167
  }
1333
1168
  });
1334
- function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1169
+ function _sfc_ssrRender$i(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1335
1170
  _push(`<button${ssrRenderAttrs(mergeProps({
1336
1171
  type: "button",
1337
1172
  "aria-label": !$props.isPrev ? "Pr\xF3ximo" : "Anterior",
@@ -1343,16 +1178,16 @@ function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1343
1178
  }, _push, _parent);
1344
1179
  _push(`</button>`);
1345
1180
  }
1346
- const _sfc_setup$c = _sfc_main$c.setup;
1347
- _sfc_main$c.setup = (props, ctx) => {
1181
+ const _sfc_setup$i = _sfc_main$i.setup;
1182
+ _sfc_main$i.setup = (props, ctx) => {
1348
1183
  const ssrContext = useSSRContext();
1349
1184
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CarouselControl.vue");
1350
- return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
1185
+ return _sfc_setup$i ? _sfc_setup$i(props, ctx) : void 0;
1351
1186
  };
1352
- const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["ssrRender", _sfc_ssrRender$c]]);
1187
+ const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["ssrRender", _sfc_ssrRender$i]]);
1353
1188
 
1354
1189
  const carouselKey = Symbol("carousel");
1355
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
1190
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
1356
1191
  __name: "Carousel",
1357
1192
  props: {
1358
1193
  as: { default: "ul" },
@@ -1513,7 +1348,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1513
1348
  return __returned__;
1514
1349
  }
1515
1350
  });
1516
- function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1351
+ function _sfc_ssrRender$h(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1517
1352
  _push(`<div${ssrRenderAttrs(mergeProps({
1518
1353
  ref: "carousel",
1519
1354
  class: "relative",
@@ -1570,15 +1405,15 @@ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1570
1405
  }, _push, _parent);
1571
1406
  _push(`</div>`);
1572
1407
  }
1573
- const _sfc_setup$b = _sfc_main$b.setup;
1574
- _sfc_main$b.setup = (props, ctx) => {
1408
+ const _sfc_setup$h = _sfc_main$h.setup;
1409
+ _sfc_main$h.setup = (props, ctx) => {
1575
1410
  const ssrContext = useSSRContext();
1576
1411
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Carousel.vue");
1577
- return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
1412
+ return _sfc_setup$h ? _sfc_setup$h(props, ctx) : void 0;
1578
1413
  };
1579
- const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
1414
+ const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["ssrRender", _sfc_ssrRender$h]]);
1580
1415
 
1581
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
1416
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1582
1417
  __name: "PitchBar",
1583
1418
  props: {
1584
1419
  slides: {}
@@ -1595,7 +1430,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1595
1430
  return __returned__;
1596
1431
  }
1597
1432
  });
1598
- function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1433
+ function _sfc_ssrRender$g(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1599
1434
  const _component_ALink = resolveComponent("ALink");
1600
1435
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "bg-base-100 relative z-20" }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
1601
1436
  _push(ssrRenderComponent($setup["Carousel"], {
@@ -1686,13 +1521,13 @@ function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1686
1521
  }, _parent));
1687
1522
  _push(`</div></div>`);
1688
1523
  }
1689
- const _sfc_setup$a = _sfc_main$a.setup;
1690
- _sfc_main$a.setup = (props, ctx) => {
1524
+ const _sfc_setup$g = _sfc_main$g.setup;
1525
+ _sfc_main$g.setup = (props, ctx) => {
1691
1526
  const ssrContext = useSSRContext();
1692
1527
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PitchBar.vue");
1693
- return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
1528
+ return _sfc_setup$g ? _sfc_setup$g(props, ctx) : void 0;
1694
1529
  };
1695
- const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
1530
+ const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["ssrRender", _sfc_ssrRender$g]]);
1696
1531
 
1697
1532
  const useStorage = (key, initialValue, storage = globalThis.localStorage) => {
1698
1533
  if (!storage) {
@@ -2002,7 +1837,7 @@ const useShopHeader = (props) => {
2002
1837
  };
2003
1838
  };
2004
1839
 
2005
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1840
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2006
1841
  __name: "Drawer",
2007
1842
  props: {
2008
1843
  modelValue: { type: Boolean, default: false },
@@ -2069,7 +1904,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2069
1904
  return __returned__;
2070
1905
  }
2071
1906
  });
2072
- function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1907
+ function _sfc_ssrRender$f(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2073
1908
  const _component_Fade = resolveComponent("Fade");
2074
1909
  _push(ssrRenderComponent(_component_Fade, mergeProps({
2075
1910
  slide: $setup.slideTo,
@@ -2081,7 +1916,7 @@ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2081
1916
  if ($props.modelValue) {
2082
1917
  _push2(`<dialog class="${ssrRenderClass([[
2083
1918
  $props.position,
2084
- $setup.isFixed ? `top-0 ${$setup.isPlacementX ? "h-screen" : ""}` : null,
1919
+ $setup.isFixed ? `top-0 ${$setup.isPlacementX ? "h-screen" : "max-h-screen"}` : null,
2085
1920
  $setup.isFixed && $props.placement !== "end" ? "left-0" : null,
2086
1921
  $setup.isFixed && $props.placement === "end" ? "left-auto right-0" : null,
2087
1922
  $setup.isPlacementX ? "max-w-sm" : null
@@ -2132,7 +1967,7 @@ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2132
1967
  ref: "drawer",
2133
1968
  class: ["w-screen shadow p-0 m-0 z-50", [
2134
1969
  $props.position,
2135
- $setup.isFixed ? `top-0 ${$setup.isPlacementX ? "h-screen" : ""}` : null,
1970
+ $setup.isFixed ? `top-0 ${$setup.isPlacementX ? "h-screen" : "max-h-screen"}` : null,
2136
1971
  $setup.isFixed && $props.placement !== "end" ? "left-0" : null,
2137
1972
  $setup.isFixed && $props.placement === "end" ? "left-auto right-0" : null,
2138
1973
  $setup.isPlacementX ? "max-w-sm" : null
@@ -2177,13 +2012,13 @@ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2177
2012
  _: 3
2178
2013
  }, _parent));
2179
2014
  }
2180
- const _sfc_setup$9 = _sfc_main$9.setup;
2181
- _sfc_main$9.setup = (props, ctx) => {
2015
+ const _sfc_setup$f = _sfc_main$f.setup;
2016
+ _sfc_main$f.setup = (props, ctx) => {
2182
2017
  const ssrContext = useSSRContext();
2183
2018
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
2184
- return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
2019
+ return _sfc_setup$f ? _sfc_setup$f(props, ctx) : void 0;
2185
2020
  };
2186
- const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
2021
+ const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["ssrRender", _sfc_ssrRender$f]]);
2187
2022
 
2188
2023
  const storageKey = "ecomSession";
2189
2024
  const emptySession = {
@@ -2222,7 +2057,7 @@ const initializeFirebaseAuth = (canWaitIdle = !window.location.pathname.startsWi
2222
2057
  return;
2223
2058
  };
2224
2059
 
2225
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2060
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2226
2061
  __name: "AccountLink",
2227
2062
  props: {
2228
2063
  to: {},
@@ -2257,20 +2092,20 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2257
2092
  return __returned__;
2258
2093
  }
2259
2094
  });
2260
- function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2095
+ function _sfc_ssrRender$e(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2261
2096
  _push(`<a${ssrRenderAttrs(mergeProps({ href: $setup.href }, _attrs))}>`);
2262
2097
  ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
2263
2098
  _push(`</a>`);
2264
2099
  }
2265
- const _sfc_setup$8 = _sfc_main$8.setup;
2266
- _sfc_main$8.setup = (props, ctx) => {
2100
+ const _sfc_setup$e = _sfc_main$e.setup;
2101
+ _sfc_main$e.setup = (props, ctx) => {
2267
2102
  const ssrContext = useSSRContext();
2268
2103
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/AccountLink.vue");
2269
- return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
2104
+ return _sfc_setup$e ? _sfc_setup$e(props, ctx) : void 0;
2270
2105
  };
2271
- const AccountLink = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
2106
+ const AccountLink = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["ssrRender", _sfc_ssrRender$e]]);
2272
2107
 
2273
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2108
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2274
2109
  __name: "SocialNetworkIcon",
2275
2110
  props: {
2276
2111
  as: { default: "i" },
@@ -2306,18 +2141,18 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2306
2141
  return __returned__;
2307
2142
  }
2308
2143
  });
2309
- function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2144
+ function _sfc_ssrRender$d(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2310
2145
  ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
2311
2146
  }
2312
- const _sfc_setup$7 = _sfc_main$7.setup;
2313
- _sfc_main$7.setup = (props, ctx) => {
2147
+ const _sfc_setup$d = _sfc_main$d.setup;
2148
+ _sfc_main$d.setup = (props, ctx) => {
2314
2149
  const ssrContext = useSSRContext();
2315
2150
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkIcon.vue");
2316
- return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
2151
+ return _sfc_setup$d ? _sfc_setup$d(props, ctx) : void 0;
2317
2152
  };
2318
- const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
2153
+ const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["ssrRender", _sfc_ssrRender$d]]);
2319
2154
 
2320
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2155
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2321
2156
  __name: "SocialNetworkLink",
2322
2157
  props: {
2323
2158
  network: {},
@@ -2343,7 +2178,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2343
2178
  return __returned__;
2344
2179
  }
2345
2180
  });
2346
- function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2181
+ function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2347
2182
  const _component_ALink = resolveComponent("ALink");
2348
2183
  _push(ssrRenderComponent(_component_ALink, mergeProps({ href: $setup.fixedHref }, _attrs), {
2349
2184
  default: withCtx((_, _push2, _parent2, _scopeId) => {
@@ -2364,15 +2199,15 @@ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2364
2199
  _: 3
2365
2200
  }, _parent));
2366
2201
  }
2367
- const _sfc_setup$6 = _sfc_main$6.setup;
2368
- _sfc_main$6.setup = (props, ctx) => {
2202
+ const _sfc_setup$c = _sfc_main$c.setup;
2203
+ _sfc_main$c.setup = (props, ctx) => {
2369
2204
  const ssrContext = useSSRContext();
2370
2205
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkLink.vue");
2371
- return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
2206
+ return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
2372
2207
  };
2373
- const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
2208
+ const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["ssrRender", _sfc_ssrRender$c]]);
2374
2209
 
2375
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2210
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2376
2211
  __name: "ShopSidenavCategory",
2377
2212
  props: {
2378
2213
  categoryTree: {}
@@ -2395,7 +2230,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2395
2230
  return __returned__;
2396
2231
  }
2397
2232
  });
2398
- function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2233
+ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2399
2234
  const _component_AImg = resolveComponent("AImg");
2400
2235
  const _component_ShopSidenavCategory = resolveComponent("ShopSidenavCategory", true);
2401
2236
  _push(`<li${ssrRenderAttrs(mergeProps({ class: "text-lg text-base-800" }, _attrs))}>`);
@@ -2433,15 +2268,15 @@ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2433
2268
  }
2434
2269
  _push(`</li>`);
2435
2270
  }
2436
- const _sfc_setup$5 = _sfc_main$5.setup;
2437
- _sfc_main$5.setup = (props, ctx) => {
2271
+ const _sfc_setup$b = _sfc_main$b.setup;
2272
+ _sfc_main$b.setup = (props, ctx) => {
2438
2273
  const ssrContext = useSSRContext();
2439
2274
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenavCategory.vue");
2440
- return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
2275
+ return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
2441
2276
  };
2442
- const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
2277
+ const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
2443
2278
 
2444
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2279
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2445
2280
  __name: "ShopSidenav",
2446
2281
  props: {
2447
2282
  categoryTrees: {}
@@ -2462,7 +2297,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2462
2297
  return __returned__;
2463
2298
  }
2464
2299
  });
2465
- function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2300
+ function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2466
2301
  _push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-full" }, _attrs))}><nav class="py-4 grow"><ul class="relative h-full"><!--[-->`);
2467
2302
  ssrRenderList($props.categoryTrees, (categoryTree, i) => {
2468
2303
  _push(ssrRenderComponent($setup["ShopSidenavCategory"], {
@@ -2503,13 +2338,13 @@ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2503
2338
  });
2504
2339
  _push(`<!--]--></ul></footer></aside>`);
2505
2340
  }
2506
- const _sfc_setup$4 = _sfc_main$4.setup;
2507
- _sfc_main$4.setup = (props, ctx) => {
2341
+ const _sfc_setup$a = _sfc_main$a.setup;
2342
+ _sfc_main$a.setup = (props, ctx) => {
2508
2343
  const ssrContext = useSSRContext();
2509
2344
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenav.vue");
2510
- return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
2345
+ return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
2511
2346
  };
2512
- const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
2347
+ const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
2513
2348
 
2514
2349
  const useShopHeaderSubmenu = (props) => {
2515
2350
  const categoryPicture = computed(() => {
@@ -2558,7 +2393,7 @@ const useShopHeaderSubmenu = (props) => {
2558
2393
  };
2559
2394
  };
2560
2395
 
2561
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2396
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2562
2397
  __name: "ShopHeaderSubmenu",
2563
2398
  props: {
2564
2399
  categoryTree: {},
@@ -2573,7 +2408,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2573
2408
  subcategoryCols,
2574
2409
  countMenuCols
2575
2410
  } = useShopHeaderSubmenu(props);
2576
- const __returned__ = { props, categoryPicture, subcategoryLinks, subcategoryCols, countMenuCols, get Popover() {
2411
+ const panel = ref(null);
2412
+ const close = ref(null);
2413
+ onClickOutside(panel, () => close.value?.click());
2414
+ const __returned__ = { props, categoryPicture, subcategoryLinks, subcategoryCols, countMenuCols, panel, close, get Popover() {
2577
2415
  return Popover;
2578
2416
  }, get PopoverButton() {
2579
2417
  return PopoverButton;
@@ -2584,7 +2422,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2584
2422
  return __returned__;
2585
2423
  }
2586
2424
  });
2587
- function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2425
+ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2588
2426
  const _component_Fade = resolveComponent("Fade");
2589
2427
  const _component_AImg = resolveComponent("AImg");
2590
2428
  _push(ssrRenderComponent($setup["Popover"], _attrs, {
@@ -2607,9 +2445,9 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2607
2445
  default: withCtx((_, _push3, _parent3, _scopeId2) => {
2608
2446
  if (_push3) {
2609
2447
  _push3(ssrRenderComponent($setup["PopoverPanel"], {
2610
- class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded backdrop-blur-md shadow bg-white/80 text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2448
+ class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2611
2449
  }, {
2612
- default: withCtx((_2, _push4, _parent4, _scopeId3) => {
2450
+ default: withCtx(({ close }, _push4, _parent4, _scopeId3) => {
2613
2451
  if (_push4) {
2614
2452
  _push4(`<div class="flex gap-6 w-full"${_scopeId3}>`);
2615
2453
  if ($setup.subcategoryLinks.length) {
@@ -2640,7 +2478,7 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2640
2478
  } else {
2641
2479
  _push4(`<!---->`);
2642
2480
  }
2643
- _push4(`</div><a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block mt-1 text-xs text-base-600 leading-snug underline"${_scopeId3}>${ssrInterpolate("Ver toda a categoria $1".replace("$1", $props.categoryTree.name))}</a>`);
2481
+ _push4(`</div><a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block mt-1 text-xs text-base-600 leading-snug underline"${_scopeId3}>${ssrInterpolate("Ver toda a categoria $1".replace("$1", $props.categoryTree.name))}</a><button class="hidden"${_scopeId3}></button>`);
2644
2482
  } else {
2645
2483
  return [
2646
2484
  createVNode("div", { class: "flex gap-6 w-full" }, [
@@ -2703,7 +2541,12 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2703
2541
  createVNode("a", {
2704
2542
  href: `/${$props.categoryTree.slug}`,
2705
2543
  class: "block mt-1 text-xs text-base-600 leading-snug underline"
2706
- }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
2544
+ }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"]),
2545
+ createVNode("button", {
2546
+ ref: "close",
2547
+ onClick: withModifiers(close, ["stop"]),
2548
+ class: "hidden"
2549
+ }, null, 8, ["onClick"])
2707
2550
  ];
2708
2551
  }
2709
2552
  }),
@@ -2712,9 +2555,9 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2712
2555
  } else {
2713
2556
  return [
2714
2557
  createVNode($setup["PopoverPanel"], {
2715
- class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded backdrop-blur-md shadow bg-white/80 text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2558
+ class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2716
2559
  }, {
2717
- default: withCtx(() => [
2560
+ default: withCtx(({ close }) => [
2718
2561
  createVNode("div", { class: "flex gap-6 w-full" }, [
2719
2562
  $setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
2720
2563
  key: 0,
@@ -2775,7 +2618,12 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2775
2618
  createVNode("a", {
2776
2619
  href: `/${$props.categoryTree.slug}`,
2777
2620
  class: "block mt-1 text-xs text-base-600 leading-snug underline"
2778
- }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
2621
+ }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"]),
2622
+ createVNode("button", {
2623
+ ref: "close",
2624
+ onClick: withModifiers(close, ["stop"]),
2625
+ class: "hidden"
2626
+ }, null, 8, ["onClick"])
2779
2627
  ]),
2780
2628
  _: 1
2781
2629
  }, 8, ["class"])
@@ -2793,13 +2641,16 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2793
2641
  ]),
2794
2642
  _: 2
2795
2643
  }, 1024),
2796
- createVNode("div", { class: "relative" }, [
2644
+ createVNode("div", {
2645
+ class: "relative",
2646
+ ref: "panel"
2647
+ }, [
2797
2648
  createVNode(_component_Fade, null, {
2798
2649
  default: withCtx(() => [
2799
2650
  createVNode($setup["PopoverPanel"], {
2800
- class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded backdrop-blur-md shadow bg-white/80 text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2651
+ class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
2801
2652
  }, {
2802
- default: withCtx(() => [
2653
+ default: withCtx(({ close }) => [
2803
2654
  createVNode("div", { class: "flex gap-6 w-full" }, [
2804
2655
  $setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
2805
2656
  key: 0,
@@ -2860,29 +2711,34 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2860
2711
  createVNode("a", {
2861
2712
  href: `/${$props.categoryTree.slug}`,
2862
2713
  class: "block mt-1 text-xs text-base-600 leading-snug underline"
2863
- }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
2714
+ }, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"]),
2715
+ createVNode("button", {
2716
+ ref: "close",
2717
+ onClick: withModifiers(close, ["stop"]),
2718
+ class: "hidden"
2719
+ }, null, 8, ["onClick"])
2864
2720
  ]),
2865
2721
  _: 1
2866
2722
  }, 8, ["class"])
2867
2723
  ]),
2868
2724
  _: 1
2869
2725
  })
2870
- ])
2726
+ ], 512)
2871
2727
  ];
2872
2728
  }
2873
2729
  }),
2874
2730
  _: 3
2875
2731
  }, _parent));
2876
2732
  }
2877
- const _sfc_setup$3 = _sfc_main$3.setup;
2878
- _sfc_main$3.setup = (props, ctx) => {
2733
+ const _sfc_setup$9 = _sfc_main$9.setup;
2734
+ _sfc_main$9.setup = (props, ctx) => {
2879
2735
  const ssrContext = useSSRContext();
2880
2736
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderSubmenu.vue");
2881
- return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
2737
+ return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
2882
2738
  };
2883
- const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
2739
+ const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
2884
2740
 
2885
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2741
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2886
2742
  __name: "ShopHeaderMenu",
2887
2743
  props: {
2888
2744
  inlineMenuTrees: {}
@@ -2898,7 +2754,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2898
2754
  return __returned__;
2899
2755
  }
2900
2756
  });
2901
- function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2757
+ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2902
2758
  _push(`<nav${ssrRenderAttrs(_attrs)}><ul class="${ssrRenderClass([$props.inlineMenuTrees.length < 7 ? "text-base" : "text-sm", "flex gap-4 xl:gap-5 text-base-700"])}"><!--[-->`);
2903
2759
  ssrRenderList($props.inlineMenuTrees, (categoryTree, i) => {
2904
2760
  _push(`<li>`);
@@ -2942,15 +2798,15 @@ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2942
2798
  });
2943
2799
  _push(`<!--]--></ul></nav>`);
2944
2800
  }
2945
- const _sfc_setup$2 = _sfc_main$2.setup;
2946
- _sfc_main$2.setup = (props, ctx) => {
2801
+ const _sfc_setup$8 = _sfc_main$8.setup;
2802
+ _sfc_main$8.setup = (props, ctx) => {
2947
2803
  const ssrContext = useSSRContext();
2948
2804
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderMenu.vue");
2949
- return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
2805
+ return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
2950
2806
  };
2951
- const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
2807
+ const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
2952
2808
 
2953
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2809
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2954
2810
  __name: "AccountMenu",
2955
2811
  setup(__props, { expose: __expose }) {
2956
2812
  __expose();
@@ -2977,7 +2833,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2977
2833
  return __returned__;
2978
2834
  }
2979
2835
  });
2980
- function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2836
+ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2981
2837
  const _component_Fade = resolveComponent("Fade");
2982
2838
  const _component_ALink = resolveComponent("ALink");
2983
2839
  _push(ssrRenderComponent($setup["Menu"], mergeProps({
@@ -3569,15 +3425,15 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
3569
3425
  _: 3
3570
3426
  }, _parent));
3571
3427
  }
3572
- const _sfc_setup$1 = _sfc_main$1.setup;
3573
- _sfc_main$1.setup = (props, ctx) => {
3428
+ const _sfc_setup$7 = _sfc_main$7.setup;
3429
+ _sfc_main$7.setup = (props, ctx) => {
3574
3430
  const ssrContext = useSSRContext();
3575
3431
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/AccountMenu.vue");
3576
- return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
3432
+ return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
3577
3433
  };
3578
- const AccountMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
3434
+ const AccountMenu = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
3579
3435
 
3580
- const _sfc_main = /* @__PURE__ */ defineComponent({
3436
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3581
3437
  __name: "ShopHeader",
3582
3438
  props: {
3583
3439
  categories: {},
@@ -3588,8 +3444,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3588
3444
  setup(__props, { expose: __expose }) {
3589
3445
  __expose();
3590
3446
  const props = __props;
3591
- const SearchModal = defineAsyncComponent(() => import('../SearchModal.5f5e6a15.mjs'));
3592
- const CartSidebar = defineAsyncComponent(() => import('../CartSidebar.41b20543.mjs'));
3447
+ const SearchModal = defineAsyncComponent(() => import('../SearchModal.146ce2f7.mjs'));
3448
+ const CartSidebar = defineAsyncComponent(() => import('../CartSidebar.4179ad81.mjs'));
3593
3449
  const header = ref(null);
3594
3450
  const {
3595
3451
  isSticky,
@@ -3628,7 +3484,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3628
3484
  return __returned__;
3629
3485
  }
3630
3486
  });
3631
- function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3487
+ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3632
3488
  const _component_Skeleton = resolveComponent("Skeleton");
3633
3489
  _push(`<header${ssrRenderAttrs(mergeProps({
3634
3490
  ref: "header",
@@ -3667,7 +3523,10 @@ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $op
3667
3523
  "has-close-button": false,
3668
3524
  position: "absolute",
3669
3525
  class: $setup.isSticky ? "mt-2 md:mt-3" : "mt-3 sm:mt-4 md:mt-5",
3670
- style: { height: `calc(100vh - ${$setup.positionY}px + .5rem)` }
3526
+ style: {
3527
+ height: `calc(100vh - ${$setup.positionY}px + .5rem)`,
3528
+ maxHeight: `calc(100dvh - ${$setup.positionY}px + .5rem)`
3529
+ }
3671
3530
  }, {
3672
3531
  default: withCtx((_, _push2, _parent2, _scopeId) => {
3673
3532
  if (_push2) {
@@ -3783,21 +3642,21 @@ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $op
3783
3642
  }
3784
3643
  _push(`</header>`);
3785
3644
  }
3786
- const _sfc_setup = _sfc_main.setup;
3787
- _sfc_main.setup = (props, ctx) => {
3645
+ const _sfc_setup$6 = _sfc_main$6.setup;
3646
+ _sfc_main$6.setup = (props, ctx) => {
3788
3647
  const ssrContext = useSSRContext();
3789
3648
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeader.vue");
3790
- return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
3649
+ return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
3791
3650
  };
3792
- const ShopHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
3651
+ const ShopHeader = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
3793
3652
 
3794
- var __freeze = Object.freeze;
3795
- var __defProp = Object.defineProperty;
3796
- var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
3797
- var _a;
3798
- const $$Astro$2 = createAstro("https://ecom2-demo.web.app");
3799
- const $$PageHeader = createComponent(async ($$result, $$props, $$slots) => {
3800
- const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
3653
+ var __freeze$1 = Object.freeze;
3654
+ var __defProp$1 = Object.defineProperty;
3655
+ var __template$1 = (cooked, raw) => __freeze$1(__defProp$1(cooked, "raw", { value: __freeze$1(raw || cooked.slice()) }));
3656
+ var _a$1;
3657
+ const $$Astro$9 = createAstro("https://ecom2-demo.web.app");
3658
+ const $$PageHeader = createComponent(async ($$result, $$props, $$slots) => {
3659
+ const Astro2 = $$result.createAstro($$Astro$9, $$props, $$slots);
3801
3660
  Astro2.self = $$PageHeader;
3802
3661
  const { routeContext } = Astro2.locals;
3803
3662
  const { settings, isHomepage } = routeContext;
@@ -3810,29 +3669,1563 @@ const $$PageHeader = createComponent(async ($$result, $$props, $$slots) => {
3810
3669
  field: "categories",
3811
3670
  value: categories?.map(({ _id, ...c }) => c)
3812
3671
  });
3813
- return renderTemplate`${renderSlot($$result, $$slots["pitch-bar"], renderTemplate(_a || (_a = __template(["\n ", "\n ", "\n\n<script>", "<\/script>\n", ""])), pitchBar.slides.length > 1 && renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar, "client:idle": true, "client:component-hydration": "idle", "client:component-path": "~/components/PitchBar.vue", "client:component-export": "default" })}`, pitchBar.slides.length === 1 && renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar })}`, unescapeHTML(inlineClientJS), renderComponent($$result, "ShopHeader", ShopHeader, { ...shopHeader, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate`
3814
- ${maybeRenderHead()}<a href="/">
3815
- ${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate`
3816
- ${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "fetchpriority": "high", "loading": "eager", "class": "hover:drop-shadow-sm max-w-[150px] mx-auto" })}
3817
- ` })}
3818
- </a>
3819
- ` })}` })))}`;
3672
+ return renderTemplate`${renderSlot($$result, $$slots["pitch-bar"], renderTemplate(_a$1 || (_a$1 = __template$1(["", "", "<script>", "<\/script>", ""])), pitchBar.slides.length > 1 && renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar, "client:idle": true, "client:component-hydration": "idle", "client:component-path": "~/components/PitchBar.vue", "client:component-export": "default" })}`, pitchBar.slides.length === 1 && renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar })}`, unescapeHTML(inlineClientJS), renderComponent($$result, "ShopHeader", ShopHeader, { ...shopHeader, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate`${maybeRenderHead()}<a href="/">${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate`${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "fetchpriority": "high", "loading": "eager", "class": "hover:drop-shadow-sm max-w-[150px] mx-auto" })}` })}</a>` })}` })))}`;
3820
3673
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/PageHeader.astro", void 0);
3821
3674
 
3822
- const $$Astro$1 = createAstro("https://ecom2-demo.web.app");
3823
- const $$Wildcard = createComponent(async ($$result, $$props, $$slots) => {
3824
- const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
3825
- Astro2.self = $$Wildcard;
3826
- const { fetchingApiContext, apiContext } = Astro2.locals.routeContext;
3827
- await fetchingApiContext;
3828
- const apiDoc = apiContext.doc;
3829
- return renderTemplate`${maybeRenderHead()}<main>
3830
- ${apiDoc && renderTemplate`<h1>Hello <span class="text-gradient">${apiDoc.name}</span></h1><hr><div class="mt-3">
3831
- <mark>${apiDoc._id}</mark> from <i>${apiContext.resource}</i>
3832
- <p>${Math.random()}</p>
3833
- <em>Lorem ipsum dolor sit amet</em>
3834
- </div>`}
3835
- </main>`;
3675
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3676
+ __name: "PaymentMethodFlag",
3677
+ props: {
3678
+ as: { default: "i" },
3679
+ flag: {}
3680
+ },
3681
+ setup(__props, { expose: __expose }) {
3682
+ __expose();
3683
+ const props = __props;
3684
+ const iconClassName = computed(() => {
3685
+ switch (props.flag) {
3686
+ case "pix":
3687
+ return "i-pix text-[#77B6A8]";
3688
+ case "visa":
3689
+ return "i-visa";
3690
+ case "mastercard":
3691
+ return "i-mastercard";
3692
+ case "elo":
3693
+ return "i-elo";
3694
+ case "amex":
3695
+ return "i-amex";
3696
+ case "hipercard":
3697
+ return "i-hipercard";
3698
+ case "diners":
3699
+ return "i-dinersclub";
3700
+ case "discover":
3701
+ return "i-discover";
3702
+ default:
3703
+ return "";
3704
+ }
3705
+ });
3706
+ const __returned__ = { props, iconClassName };
3707
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3708
+ return __returned__;
3709
+ }
3710
+ });
3711
+ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3712
+ if (!$setup.iconClassName) {
3713
+ _push(`<b${ssrRenderAttrs(mergeProps({ class: "tracking-tighter leading-none mb-1 text-black text-[57%]" }, _attrs))}>${ssrInterpolate($setup.props.flag)}</b>`);
3714
+ } else {
3715
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
3716
+ }
3717
+ }
3718
+ const _sfc_setup$5 = _sfc_main$5.setup;
3719
+ _sfc_main$5.setup = (props, ctx) => {
3720
+ const ssrContext = useSSRContext();
3721
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/PaymentMethodFlag.vue");
3722
+ return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
3723
+ };
3724
+ const PaymentMethodFlag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
3725
+
3726
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3727
+ __name: "ShopFooter",
3728
+ props: {
3729
+ stamps: {},
3730
+ categories: {},
3731
+ categoriesColTitle: {},
3732
+ pageLinks: {},
3733
+ pagesColTitle: {}
3734
+ },
3735
+ setup(__props, { expose: __expose }) {
3736
+ __expose();
3737
+ const __returned__ = { get socialNetworks() {
3738
+ return socialNetworks;
3739
+ }, SocialNetworkLink, PaymentMethodFlag };
3740
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3741
+ return __returned__;
3742
+ }
3743
+ });
3744
+ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3745
+ const _component_ALink = resolveComponent("ALink");
3746
+ _push(`<footer${ssrRenderAttrs(mergeProps({ class: "w-screen bg-base-50 border-t border-base-100 py-2" }, _attrs))}><div class="ui-section"><div class="pb-7 border-b border-base-200 flex justify-between flex-wrap lg:flex-nowrap sm:gap-x-10 gap-y-5"><div class="shrink">`);
3747
+ ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
3748
+ if (_ctx.$settings.description) {
3749
+ _push(`<div class="prose"><p>${ssrInterpolate(_ctx.$settings.description)}</p></div>`);
3750
+ } else {
3751
+ _push(`<!---->`);
3752
+ }
3753
+ _push(`<div class="flex gap-2 text-base-500"><!--[-->`);
3754
+ ssrRenderList($setup.socialNetworks, (href, network) => {
3755
+ _push(`<span>`);
3756
+ _push(ssrRenderComponent($setup["SocialNetworkLink"], {
3757
+ network,
3758
+ class: "p-1 hover:text-primary"
3759
+ }, createSlots({ _: 2 }, [
3760
+ network === "whatsapp" ? {
3761
+ name: "append",
3762
+ fn: withCtx((_, _push2, _parent2, _scopeId) => {
3763
+ if (_push2) {
3764
+ _push2(`<span class="ml-1 text-sm text-base-600"${_scopeId}>${ssrInterpolate(_ctx.$settings.whatsapp)}</span>`);
3765
+ } else {
3766
+ return [
3767
+ createVNode("span", { class: "ml-1 text-sm text-base-600" }, toDisplayString(_ctx.$settings.whatsapp), 1)
3768
+ ];
3769
+ }
3770
+ }),
3771
+ key: "0"
3772
+ } : void 0
3773
+ ]), _parent));
3774
+ _push(`</span>`);
3775
+ });
3776
+ _push(`<!--]--></div>`);
3777
+ if (_ctx.$settings.address || _ctx.$settings.phone) {
3778
+ _push(`<div class="mt-3 text-base-700">`);
3779
+ if (_ctx.$settings.address) {
3780
+ _push(`<address class="inline-block mr-4">${ssrInterpolate(_ctx.$settings.address)}</address>`);
3781
+ } else {
3782
+ _push(`<!---->`);
3783
+ }
3784
+ if (_ctx.$settings.phone) {
3785
+ _push(ssrRenderComponent(_component_ALink, {
3786
+ href: `tel:${_ctx.$settings.phone.replace(/\D/g, "")}`,
3787
+ class: "hover:text-primary"
3788
+ }, {
3789
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3790
+ if (_push2) {
3791
+ _push2(`<i class="i-phone mr-0.5"${_scopeId}></i> ${ssrInterpolate(_ctx.$settings.phone)}`);
3792
+ } else {
3793
+ return [
3794
+ createVNode("i", { class: "i-phone mr-0.5" }),
3795
+ createTextVNode(" " + toDisplayString(_ctx.$settings.phone), 1)
3796
+ ];
3797
+ }
3798
+ }),
3799
+ _: 1
3800
+ }, _parent));
3801
+ } else {
3802
+ _push(`<!---->`);
3803
+ }
3804
+ _push(`</div>`);
3805
+ } else {
3806
+ _push(`<!---->`);
3807
+ }
3808
+ _push(`</div>`);
3809
+ if ($props.categories?.length) {
3810
+ _push(`<div class="basis-1/2 sm:basis-auto"><div class="text-lg font-medium mb-2.5">${ssrInterpolate($props.categoriesColTitle || "Categorias")}</div><ul class="${ssrRenderClass([$props.categories.length > 4 ? "grid md:grid-cols-2 gap-x-5 gap-y-1.5" : "space-y-1.5", "text-sm"])}"><!--[-->`);
3811
+ ssrRenderList($props.categories, ({ name, slug }, i) => {
3812
+ _push(`<li>`);
3813
+ _push(ssrRenderComponent(_component_ALink, {
3814
+ href: `/${slug}`,
3815
+ class: "ui-link text-base-600"
3816
+ }, {
3817
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3818
+ if (_push2) {
3819
+ _push2(`${ssrInterpolate(name)}`);
3820
+ } else {
3821
+ return [
3822
+ createTextVNode(toDisplayString(name), 1)
3823
+ ];
3824
+ }
3825
+ }),
3826
+ _: 2
3827
+ }, _parent));
3828
+ _push(`</li>`);
3829
+ });
3830
+ _push(`<!--]--><li>`);
3831
+ _push(ssrRenderComponent(_component_ALink, {
3832
+ href: "/s",
3833
+ class: "ui-link text-base-900"
3834
+ }, {
3835
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3836
+ if (_push2) {
3837
+ _push2(`${ssrInterpolate("Todos os produtos")}`);
3838
+ } else {
3839
+ return [
3840
+ createTextVNode(toDisplayString("Todos os produtos"))
3841
+ ];
3842
+ }
3843
+ }),
3844
+ _: 1
3845
+ }, _parent));
3846
+ _push(`</li></ul></div>`);
3847
+ } else {
3848
+ _push(`<!---->`);
3849
+ }
3850
+ if ($props.pageLinks?.length) {
3851
+ _push(`<div class="basis-1/2 sm:basis-auto"><div class="text-lg font-medium mb-2.5">${ssrInterpolate($props.pagesColTitle || "Institucional")}</div><ul class="${ssrRenderClass([$props.pageLinks.length > 5 ? "grid md:grid-cols-2 gap-x-5 gap-y-1.5" : "space-y-1.5", "text-sm"])}"><!--[-->`);
3852
+ ssrRenderList($props.pageLinks, ({ title, href }, i) => {
3853
+ _push(`<li>`);
3854
+ _push(ssrRenderComponent(_component_ALink, {
3855
+ href,
3856
+ class: "ui-link text-base-600"
3857
+ }, {
3858
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3859
+ if (_push2) {
3860
+ _push2(`${ssrInterpolate(title)}`);
3861
+ } else {
3862
+ return [
3863
+ createTextVNode(toDisplayString(title), 1)
3864
+ ];
3865
+ }
3866
+ }),
3867
+ _: 2
3868
+ }, _parent));
3869
+ _push(`</li>`);
3870
+ });
3871
+ _push(`<!--]--></ul></div>`);
3872
+ } else {
3873
+ _push(`<!---->`);
3874
+ }
3875
+ _push(`</div></div><div class="ui-section"><div class="flex flex-wrap lg:flex-nowrap justify-between items-start gap-5"><ul class="flex gap-y-3 gap-x-6 lg:gap-x-8 items-center md:flex-wrap mx-auto md:mx-0 overflow-x-auto md:overflow-hidden"><!--[-->`);
3876
+ ssrRenderList($props.stamps, (stamp, i) => {
3877
+ _push(`<li>`);
3878
+ _push(ssrRenderComponent(_component_ALink, {
3879
+ href: stamp.href?.replace("{domain}", _ctx.$settings.domain || "")
3880
+ }, {
3881
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3882
+ if (_push2) {
3883
+ ssrRenderSlot(_ctx.$slots, `picture-${i}`, {}, null, _push2, _parent2, _scopeId);
3884
+ if (!stamp.img) {
3885
+ _push2(`<span class="flex items-center"${_scopeId}>`);
3886
+ if (stamp.icon) {
3887
+ _push2(`<span class="text-4xl mr-2 [&amp;&gt;*]:bg-gradient-to-br [&amp;&gt;*]:from-success-200 [&amp;&gt;*]:to-success-700"${_scopeId}>`);
3888
+ if (stamp.icon === "lock") {
3889
+ _push2(`<i class="i-lock-closed"${_scopeId}></i>`);
3890
+ } else if (stamp.icon === "check") {
3891
+ _push2(`<i class="i-check-badge"${_scopeId}></i>`);
3892
+ } else {
3893
+ _push2(`<i class="i-arrow-path-rounded-square"${_scopeId}></i>`);
3894
+ }
3895
+ _push2(`</span>`);
3896
+ } else {
3897
+ _push2(`<!---->`);
3898
+ }
3899
+ _push2(`<span class="text-sm font-medium text-base-600 max-w-[140px]"${_scopeId}>${ssrInterpolate(stamp.alt)} `);
3900
+ if (stamp.href && stamp.href.charAt(0) !== "/") {
3901
+ _push2(`<i class="bg-base-400 ml-0.5 i-arrow-top-right-on-square"${_scopeId}></i>`);
3902
+ } else {
3903
+ _push2(`<!---->`);
3904
+ }
3905
+ _push2(`</span></span>`);
3906
+ } else {
3907
+ _push2(`<!---->`);
3908
+ }
3909
+ } else {
3910
+ return [
3911
+ renderSlot$1(_ctx.$slots, `picture-${i}`),
3912
+ !stamp.img ? (openBlock(), createBlock("span", {
3913
+ key: 0,
3914
+ class: "flex items-center"
3915
+ }, [
3916
+ stamp.icon ? (openBlock(), createBlock("span", {
3917
+ key: 0,
3918
+ class: "text-4xl mr-2 [&>*]:bg-gradient-to-br [&>*]:from-success-200 [&>*]:to-success-700"
3919
+ }, [
3920
+ stamp.icon === "lock" ? (openBlock(), createBlock("i", {
3921
+ key: 0,
3922
+ class: "i-lock-closed"
3923
+ })) : stamp.icon === "check" ? (openBlock(), createBlock("i", {
3924
+ key: 1,
3925
+ class: "i-check-badge"
3926
+ })) : (openBlock(), createBlock("i", {
3927
+ key: 2,
3928
+ class: "i-arrow-path-rounded-square"
3929
+ }))
3930
+ ])) : createCommentVNode("", true),
3931
+ createVNode("span", { class: "text-sm font-medium text-base-600 max-w-[140px]" }, [
3932
+ createTextVNode(toDisplayString(stamp.alt) + " ", 1),
3933
+ stamp.href && stamp.href.charAt(0) !== "/" ? (openBlock(), createBlock("i", {
3934
+ key: 0,
3935
+ class: "bg-base-400 ml-0.5 i-arrow-top-right-on-square"
3936
+ })) : createCommentVNode("", true)
3937
+ ])
3938
+ ])) : createCommentVNode("", true)
3939
+ ];
3940
+ }
3941
+ }),
3942
+ _: 2
3943
+ }, _parent));
3944
+ _push(`</li>`);
3945
+ });
3946
+ _push(`<!--]--></ul><div class="flex flex-wrap md:flex-nowrap justify-end items-center gap-4 text-2xl mx-auto md:mx-0 overflow-x-auto md:overflow-hidden"><!--[-->`);
3947
+ ssrRenderList(_ctx.$settings.payment_methods, (paymentMethod) => {
3948
+ _push(ssrRenderComponent($setup["PaymentMethodFlag"], {
3949
+ key: paymentMethod,
3950
+ flag: paymentMethod
3951
+ }, null, _parent));
3952
+ });
3953
+ _push(`<!--]--></div></div><div class="mt-7 text-xs text-center md:text-left md:flex justify-between gap-4"><div class="mb-3 md:mb-0"> @ ${ssrInterpolate(( new Date()).getFullYear())} ${ssrInterpolate(_ctx.$settings.corporate_name)} ${ssrInterpolate(_ctx.$settings.address ? `/ ${_ctx.$settings.address}` : "")} / ${ssrInterpolate(_ctx.$settings.doc_number)}</div>`);
3954
+ _push(ssrRenderComponent(_component_ALink, {
3955
+ href: "https://www.ecomplus.io/",
3956
+ class: "italic text-[#37003c]"
3957
+ }, {
3958
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3959
+ if (_push2) {
3960
+ _push2(` powered by <b${_scopeId}>E-Com Plus</b>`);
3961
+ } else {
3962
+ return [
3963
+ createTextVNode(" powered by "),
3964
+ createVNode("b", null, "E-Com Plus")
3965
+ ];
3966
+ }
3967
+ }),
3968
+ _: 1
3969
+ }, _parent));
3970
+ _push(`</div></div></footer>`);
3971
+ }
3972
+ const _sfc_setup$4 = _sfc_main$4.setup;
3973
+ _sfc_main$4.setup = (props, ctx) => {
3974
+ const ssrContext = useSSRContext();
3975
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopFooter.vue");
3976
+ return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
3977
+ };
3978
+ const ShopFooter = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
3979
+
3980
+ const $$Astro$8 = createAstro("https://ecom2-demo.web.app");
3981
+ const $$PageFooter = createComponent(async ($$result, $$props, $$slots) => {
3982
+ const Astro2 = $$result.createAstro($$Astro$8, $$props, $$slots);
3983
+ Astro2.self = $$PageFooter;
3984
+ const { routeContext } = Astro2.locals;
3985
+ const { settings, getContent, isHomepage } = routeContext;
3986
+ const LogoHeading = isHomepage ? "h2" : "h3";
3987
+ const layoutContent = await getContent("layout");
3988
+ const {
3989
+ footer: {
3990
+ stamps,
3991
+ categories_list: categoriesList,
3992
+ pages_list: pagesList
3993
+ }
3994
+ } = layoutContent;
3995
+ let mainCategories;
3996
+ let pageLinks;
3997
+ if (categoriesList?.enabled) {
3998
+ if (categoriesList.categories?.length) {
3999
+ mainCategories = categoriesList.categories;
4000
+ } else {
4001
+ const { value: categories } = await useSharedData({ field: "categories" });
4002
+ if (categories) {
4003
+ mainCategories = filterMainCategories(categories);
4004
+ }
4005
+ }
4006
+ }
4007
+ if (pagesList?.enabled) {
4008
+ if (pagesList.links?.length) {
4009
+ pageLinks = pagesList.links;
4010
+ } else {
4011
+ pageLinks = [];
4012
+ const pageSlugs = await getContent("extra-pages/");
4013
+ for (let i = 0; i < pageSlugs.length; i++) {
4014
+ const { title } = await getContent(`extra-pages/${pageSlugs[i]}`);
4015
+ if (title) {
4016
+ pageLinks.push({ title, href: `/p/${pageSlugs[i]}` });
4017
+ }
4018
+ }
4019
+ }
4020
+ }
4021
+ return renderTemplate`${renderComponent($$result, "ShopFooter", ShopFooter, { "stamps": stamps, "categories": mainCategories, "categoriesColTitle": categoriesList?.title, "pageLinks": pageLinks, "pagesColTitle": pagesList?.title }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate`${maybeRenderHead()}<a href="/">${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate`${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "loading": "lazy", "class": "max-w-[150px]" })}` })}</a>` })}` })}`;
4022
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/PageFooter.astro", void 0);
4023
+
4024
+ const useProductShelf = (props) => {
4025
+ const title = ref(props.title || "");
4026
+ const titleLink = ref(props.titleLink || "");
4027
+ const isFetching = ref(false);
4028
+ let fetching = null;
4029
+ const fetchError = ref(null);
4030
+ const products = shallowReactive(props.products || []);
4031
+ if (!props.products) {
4032
+ isFetching.value = true;
4033
+ fetching = (async () => {
4034
+ let searchQuery = props.searchQuery || "";
4035
+ let collection;
4036
+ if (props.collectionId) {
4037
+ try {
4038
+ const { data } = await api.get(`collections/${props.collectionId}`);
4039
+ collection = data;
4040
+ } catch (err) {
4041
+ console.error(err);
4042
+ fetchError.value = err;
4043
+ }
4044
+ const productIds = collection?.products;
4045
+ if (Array.isArray(productIds) && productIds.length) {
4046
+ searchQuery += `&_id=${productIds.slice(0, 60).join(",")}`;
4047
+ }
4048
+ if (!title.value && title.value !== null && collection?.name) {
4049
+ title.value = collection?.name;
4050
+ }
4051
+ }
4052
+ const limit = props.limit || 24;
4053
+ const offset = props.page ? (props.page - 1) * limit : 0;
4054
+ let endpointQuery = `offset=${offset}&limit=${limit}`;
4055
+ if (props.sort) {
4056
+ endpointQuery += `&sort=${props.sort}`;
4057
+ }
4058
+ endpointQuery += searchQuery;
4059
+ try {
4060
+ const { data } = await api.get(`search/v1?${endpointQuery}`);
4061
+ if (props.isShuffle) {
4062
+ let m = data.result.filter((item) => {
4063
+ return item.available && inStock(item);
4064
+ }).length;
4065
+ let t;
4066
+ let i;
4067
+ while (m) {
4068
+ i = Math.floor(Math.random() * m--);
4069
+ t = data.result[m];
4070
+ data.result[m] = data.result[i];
4071
+ data.result[i] = t;
4072
+ }
4073
+ }
4074
+ data.result.forEach((item) => products.push(item));
4075
+ } catch (err) {
4076
+ console.error(err);
4077
+ fetchError.value = err;
4078
+ }
4079
+ isFetching.value = false;
4080
+ })();
4081
+ }
4082
+ return {
4083
+ title,
4084
+ titleLink,
4085
+ isFetching,
4086
+ fetching,
4087
+ fetchError,
4088
+ products
4089
+ };
4090
+ };
4091
+
4092
+ const now = Date.now();
4093
+ const parseBanners = (banners) => {
4094
+ const validBanners = [];
4095
+ banners.forEach(({
4096
+ img,
4097
+ start,
4098
+ end,
4099
+ mobile_img: mobileImg,
4100
+ button_link: buttonLink,
4101
+ button_text: buttonText,
4102
+ ...rest
4103
+ }) => {
4104
+ if (start && new Date(start).getTime() < now)
4105
+ return;
4106
+ if (end && new Date(end).getTime() > now)
4107
+ return;
4108
+ validBanners.push({
4109
+ ...rest,
4110
+ img,
4111
+ mobileImg,
4112
+ buttonLink,
4113
+ buttonText
4114
+ });
4115
+ });
4116
+ return validBanners;
4117
+ };
4118
+ const usePageHero = async ({ routeContext }) => {
4119
+ const { cmsContent } = routeContext;
4120
+ const heroSlider = { slides: [] };
4121
+ const heroContent = cmsContent?.hero;
4122
+ if (heroContent) {
4123
+ heroSlider.autoplay = heroContent.autoplay;
4124
+ if (heroContent.slides) {
4125
+ heroSlider.slides = parseBanners(heroContent.slides);
4126
+ }
4127
+ }
4128
+ return { heroSlider };
4129
+ };
4130
+ const usePageSections = async ({ routeContext, handleCustomSection }) => {
4131
+ const sectionsContent = routeContext.cmsContent?.sections;
4132
+ const sections = [];
4133
+ if (sectionsContent) {
4134
+ await Promise.all(sectionsContent.map(async ({ type, ...sectionContent }, index) => {
4135
+ if (type === "product-shelf") {
4136
+ const {
4137
+ collection_id: collectionIdAndInfo,
4138
+ headless: isHeadless,
4139
+ shuffle: isShuffle,
4140
+ ...rest
4141
+ } = sectionContent;
4142
+ let { sort, title } = sectionContent;
4143
+ switch (sort) {
4144
+ case "offers":
4145
+ sort = "-price_discount";
4146
+ break;
4147
+ case "news":
4148
+ sort = "-_id";
4149
+ break;
4150
+ case "lowest_price":
4151
+ sort = "price";
4152
+ break;
4153
+ case "highest_price":
4154
+ sort = "-price";
4155
+ break;
4156
+ }
4157
+ let collectionId = null;
4158
+ let searchQuery;
4159
+ let titleLink;
4160
+ if (collectionIdAndInfo) {
4161
+ const [_id, resource, name, path] = collectionIdAndInfo.split(":");
4162
+ collectionId = _id;
4163
+ if (resource === "categories") {
4164
+ searchQuery = `&categories._id=${_id}`;
4165
+ } else if (resource === "brands") {
4166
+ searchQuery = `&brands._id=${_id}`;
4167
+ }
4168
+ if (!title && title !== null && name) {
4169
+ title = name;
4170
+ }
4171
+ titleLink = path;
4172
+ }
4173
+ const props = {
4174
+ ...rest,
4175
+ collectionId,
4176
+ searchQuery,
4177
+ sort,
4178
+ title: isHeadless ? null : title,
4179
+ titleLink,
4180
+ isShuffle
4181
+ };
4182
+ const { fetching, products } = useProductShelf(props);
4183
+ await fetching;
4184
+ sections[index] = {
4185
+ type,
4186
+ props: {
4187
+ ...rest,
4188
+ collectionId,
4189
+ searchQuery,
4190
+ sort,
4191
+ title: isHeadless ? null : title,
4192
+ titleLink,
4193
+ isShuffle,
4194
+ products
4195
+ }
4196
+ };
4197
+ return;
4198
+ }
4199
+ if (type === "banners-grid") {
4200
+ sections[index] = {
4201
+ type,
4202
+ props: {
4203
+ banners: parseBanners(sectionContent.banners || [])
4204
+ }
4205
+ };
4206
+ return;
4207
+ }
4208
+ switch (type) {
4209
+ case "breadcrumbs":
4210
+ case "product-details":
4211
+ case "related-products":
4212
+ case "doc-description":
4213
+ case "product-specifications":
4214
+ sections[index] = {
4215
+ type,
4216
+ props: {}
4217
+ };
4218
+ return;
4219
+ }
4220
+ if (typeof handleCustomSection === "function") {
4221
+ const { props } = await handleCustomSection(
4222
+ type,
4223
+ sectionContent
4224
+ );
4225
+ sections[index] = { type, props };
4226
+ }
4227
+ }));
4228
+ }
4229
+ return {
4230
+ sections
4231
+ };
4232
+ };
4233
+
4234
+ const $$Astro$7 = createAstro("https://ecom2-demo.web.app");
4235
+ const $$BannerPictures = createComponent(async ($$result, $$props, $$slots) => {
4236
+ const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
4237
+ Astro2.self = $$BannerPictures;
4238
+ const {
4239
+ img,
4240
+ alt,
4241
+ mobileImg,
4242
+ title,
4243
+ subtitle,
4244
+ buttonText,
4245
+ index,
4246
+ class: className = "max-w-screen-sm sm:max-w-[828px] md:max-w-screen-2xl",
4247
+ mobileClass = "max-w-screen-sm sm:max-w-screen-lg"
4248
+ } = Astro2.props;
4249
+ const hasHeader = title || subtitle || buttonText;
4250
+ let { widths, mobileWidths } = Astro2.props;
4251
+ if (!widths?.length) {
4252
+ if (mobileImg) {
4253
+ widths = [1536, 2048];
4254
+ } else {
4255
+ widths = [640, 828, 1536, 2048];
4256
+ if (hasHeader) {
4257
+ widths = widths.map((w) => w / 2);
4258
+ }
4259
+ }
4260
+ }
4261
+ if (!mobileWidths?.length) {
4262
+ mobileWidths = [640, 1024];
4263
+ }
4264
+ return renderTemplate`${img && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": img, "alt": alt || "", "widths": widths, "fetchpriority": index === 0 ? "high" : "low", "loading": index === 0 ? "eager" : "lazy", "class": `${mobileImg ? "hidden md:block " : ""}mx-auto text-sm text-opacity-70 ${className}` })}`}${mobileImg && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": mobileImg, "alt": alt || "", "widths": mobileWidths, "fetchpriority": index === 0 ? "high" : "low", "loading": index === 0 ? "eager" : "lazy", "class": `md:hidden mx-auto text-sm text-opacity-70 ${mobileClass}` })}`}`;
4265
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/BannerPictures.astro", void 0);
4266
+
4267
+ const useBanner = (props) => {
4268
+ const parsedTitle = computed(() => {
4269
+ return props.title ? parseShippingPhrase(props.title).value : "";
4270
+ });
4271
+ const parsedSubtitle = computed(() => {
4272
+ return props.subtitle ? parseShippingPhrase(props.subtitle).value : "";
4273
+ });
4274
+ const parsedButtonText = computed(() => {
4275
+ return props.buttonText ? parseShippingPhrase(props.buttonText).value : "";
4276
+ });
4277
+ const hasHeader = computed(() => {
4278
+ return Boolean(parsedTitle.value || parsedSubtitle.value || parsedButtonText.value);
4279
+ });
4280
+ return {
4281
+ parsedTitle,
4282
+ parsedSubtitle,
4283
+ parsedButtonText,
4284
+ hasHeader
4285
+ };
4286
+ };
4287
+
4288
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
4289
+ __name: "Banner",
4290
+ props: {
4291
+ img: {},
4292
+ alt: {},
4293
+ mobileImg: {},
4294
+ href: {},
4295
+ title: {},
4296
+ subtitle: {},
4297
+ buttonLink: {},
4298
+ buttonText: {},
4299
+ headingTag: { default: "h3" }
4300
+ },
4301
+ setup(__props, { expose: __expose }) {
4302
+ __expose();
4303
+ const props = __props;
4304
+ const {
4305
+ hasHeader,
4306
+ parsedTitle,
4307
+ parsedSubtitle,
4308
+ parsedButtonText
4309
+ } = useBanner(props);
4310
+ const __returned__ = { props, hasHeader, parsedTitle, parsedSubtitle, parsedButtonText };
4311
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
4312
+ return __returned__;
4313
+ }
4314
+ });
4315
+ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
4316
+ const _component_ALink = resolveComponent("ALink");
4317
+ _push(`<div${ssrRenderAttrs(mergeProps({
4318
+ class: ["mx-auto overflow-x-hidden", $setup.hasHeader ? "grid grid-cols-1 sm:grid-cols-2 items-center" : null]
4319
+ }, _attrs))}>`);
4320
+ _push(ssrRenderComponent(_component_ALink, {
4321
+ href: $props.href,
4322
+ class: $setup.hasHeader ? "sm:order-last [&_img]:max-w-full sm:[&_img]:max-w-none [&_img]:aspect-video sm:[&_img]:aspect-[2.5] [&_img]:object-cover" : "[&_img]:max-w-full"
4323
+ }, {
4324
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4325
+ if (_push2) {
4326
+ ssrRenderSlot(_ctx.$slots, "picture", {}, null, _push2, _parent2, _scopeId);
4327
+ } else {
4328
+ return [
4329
+ renderSlot$1(_ctx.$slots, "picture")
4330
+ ];
4331
+ }
4332
+ }),
4333
+ _: 3
4334
+ }, _parent));
4335
+ if ($setup.hasHeader) {
4336
+ _push(`<div class="p-12 xl:ps-32 mb-3 sm:mb-0">`);
4337
+ if ($setup.parsedTitle) {
4338
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.headingTag), { class: "ui-title mt-1" }, {
4339
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4340
+ if (_push2) {
4341
+ _push2(`${ssrInterpolate($setup.parsedTitle)}`);
4342
+ } else {
4343
+ return [
4344
+ createTextVNode(toDisplayString($setup.parsedTitle), 1)
4345
+ ];
4346
+ }
4347
+ }),
4348
+ _: 1
4349
+ }), _parent);
4350
+ } else {
4351
+ _push(`<!---->`);
4352
+ }
4353
+ if ($setup.parsedSubtitle) {
4354
+ _push(`<p class="text-lg mt-4 md:mt-6">${ssrInterpolate($setup.parsedSubtitle)}</p>`);
4355
+ } else {
4356
+ _push(`<!---->`);
4357
+ }
4358
+ if ($setup.parsedButtonText) {
4359
+ _push(ssrRenderComponent(_component_ALink, {
4360
+ href: $props.buttonLink,
4361
+ class: "ui-btn-lg ui-btn-contrast min-w-[150px] mt-7 md:mt-10"
4362
+ }, {
4363
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4364
+ if (_push2) {
4365
+ _push2(`${ssrInterpolate($setup.parsedButtonText)}`);
4366
+ } else {
4367
+ return [
4368
+ createTextVNode(toDisplayString($setup.parsedButtonText), 1)
4369
+ ];
4370
+ }
4371
+ }),
4372
+ _: 1
4373
+ }, _parent));
4374
+ } else {
4375
+ _push(`<!---->`);
4376
+ }
4377
+ _push(`</div>`);
4378
+ } else {
4379
+ _push(`<!---->`);
4380
+ }
4381
+ _push(`</div>`);
4382
+ }
4383
+ const _sfc_setup$3 = _sfc_main$3.setup;
4384
+ _sfc_main$3.setup = (props, ctx) => {
4385
+ const ssrContext = useSSRContext();
4386
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Banner.vue");
4387
+ return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
4388
+ };
4389
+ const Banner = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
4390
+
4391
+ const $$Astro$6 = createAstro("https://ecom2-demo.web.app");
4392
+ const $$BannersGrid = createComponent(async ($$result, $$props, $$slots) => {
4393
+ const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
4394
+ Astro2.self = $$BannersGrid;
4395
+ const { banners } = Astro2.props;
4396
+ return renderTemplate`${maybeRenderHead()}<section class="ui-section"><ul class="flex flex-wrap lg:flex-nowrap gap-4">${banners.map((banner) => renderTemplate`<li class="lg:flex-1 [&_img]:w-full [&_img]:object-cover">${renderComponent($$result, "Banner", Banner, { ...banner }, { "picture": ($$result2) => renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { ...banner, "slot": "picture" })}` })}</li>`)}</ul></section>`;
4397
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/components/BannersGrid.astro", void 0);
4398
+
4399
+ const useProductCard = (props) => {
4400
+ const isFetching = ref(false);
4401
+ let fetching = null;
4402
+ const fetchError = ref(null);
4403
+ const { productId } = props;
4404
+ const product = shallowReactive({
4405
+ ...props.product,
4406
+ _id: props.product?._id || productId,
4407
+ price: price(props.product || {})
4408
+ });
4409
+ if (!props.product && productId) {
4410
+ isFetching.value = true;
4411
+ fetching = (async () => {
4412
+ try {
4413
+ const { data } = await api.get(`products/${productId}`);
4414
+ Object.assign(product, data);
4415
+ } catch (err) {
4416
+ console.error(err);
4417
+ fetchError.value = err;
4418
+ }
4419
+ isFetching.value = false;
4420
+ })();
4421
+ }
4422
+ const title = computed(() => {
4423
+ return name(product);
4424
+ });
4425
+ const link = computed(() => {
4426
+ const { slug } = product;
4427
+ if (typeof slug === "string") {
4428
+ return `/${slug}`;
4429
+ }
4430
+ return null;
4431
+ });
4432
+ const images = computed(() => {
4433
+ const { pictures } = product;
4434
+ const _images = [];
4435
+ if (pictures) {
4436
+ pictures.forEach((picture) => {
4437
+ const img$1 = img(picture);
4438
+ if (img$1)
4439
+ _images.push(img$1);
4440
+ });
4441
+ }
4442
+ return _images;
4443
+ });
4444
+ const isInStock = computed(() => {
4445
+ return inStock(product);
4446
+ });
4447
+ const isActive = computed(() => {
4448
+ return isInStock.value && product.available && product.visible;
4449
+ });
4450
+ const discountPercentage = computed(() => {
4451
+ if (onPromotion(product)) {
4452
+ const basePrice = product.base_price;
4453
+ return Math.round((basePrice - price(product)) * 100 / basePrice);
4454
+ }
4455
+ return 0;
4456
+ });
4457
+ const hasVariations = computed(() => {
4458
+ if (product.has_variations)
4459
+ return true;
4460
+ return Boolean(product.variations?.length);
4461
+ });
4462
+ return {
4463
+ isFetching,
4464
+ fetching,
4465
+ fetchError,
4466
+ product,
4467
+ title,
4468
+ link,
4469
+ images,
4470
+ isInStock,
4471
+ isActive,
4472
+ discountPercentage,
4473
+ hasVariations
4474
+ };
4475
+ };
4476
+
4477
+ const getPriceWithDiscount = (price, discount) => {
4478
+ const { type, value } = discount;
4479
+ let priceWithDiscount;
4480
+ if (value) {
4481
+ if (type === "percentage") {
4482
+ priceWithDiscount = price * ((100 - value) / 100);
4483
+ } else {
4484
+ priceWithDiscount = price - value;
4485
+ }
4486
+ return priceWithDiscount > 0 ? priceWithDiscount : 0;
4487
+ }
4488
+ return price;
4489
+ };
4490
+ const usePrices = (props) => {
4491
+ const _product = computed(() => {
4492
+ return props.product || {
4493
+ price: props.price || 0,
4494
+ base_price: props.basePrice
4495
+ };
4496
+ });
4497
+ const hasVariedPrices = computed(() => {
4498
+ const { variations } = _product.value;
4499
+ if (variations) {
4500
+ const productPrice = price(_product.value);
4501
+ for (let i = 0; i < variations.length; i++) {
4502
+ const price$1 = price({
4503
+ ..._product.value,
4504
+ ...variations[i]
4505
+ });
4506
+ if (price$1 > productPrice) {
4507
+ return true;
4508
+ }
4509
+ }
4510
+ }
4511
+ return false;
4512
+ });
4513
+ const salePrice = computed(() => {
4514
+ const price$1 = price(_product.value);
4515
+ const discount = availableExtraDiscount.value;
4516
+ if (discount && (!discount.min_amount || price$1 > discount.min_amount)) {
4517
+ return getPriceWithDiscount(price$1, discount);
4518
+ }
4519
+ return price$1;
4520
+ });
4521
+ const comparePrice = computed(() => {
4522
+ if (onPromotion(_product.value)) {
4523
+ return _product.value.base_price;
4524
+ }
4525
+ const price$1 = price(_product.value);
4526
+ if (price$1 > salePrice.value) {
4527
+ return price$1;
4528
+ }
4529
+ return 0;
4530
+ });
4531
+ const installmentsObject = computed(() => {
4532
+ return props.installmentsOption || installmentsOption.value || { max_number: 1 };
4533
+ });
4534
+ const installmentsNumber = computed(() => {
4535
+ if (installmentsObject.value.max_number <= 1) {
4536
+ return 1;
4537
+ }
4538
+ const minInstallment = installmentsObject.value.min_installment || 5;
4539
+ const maxInstallmentsNumber = Math.floor(salePrice.value / minInstallment);
4540
+ return Math.min(maxInstallmentsNumber, installmentsObject.value.max_number);
4541
+ });
4542
+ const monthlyInterest = computed(() => {
4543
+ return installmentsObject.value.monthly_interest || 0;
4544
+ });
4545
+ const installmentValue = computed(() => {
4546
+ if (installmentsNumber.value >= 2) {
4547
+ if (!monthlyInterest.value) {
4548
+ return salePrice.value / installmentsNumber.value;
4549
+ }
4550
+ const interest = monthlyInterest.value / 100;
4551
+ return salePrice.value * interest / (1 - (1 + interest) ** -installmentsNumber.value);
4552
+ }
4553
+ return 0;
4554
+ });
4555
+ const discountObject = computed(() => {
4556
+ const discount = props.discountOption || discountOption.value;
4557
+ if (discount && (!discount.min_amount || discount.min_amount <= salePrice.value) && (!props.isAmountTotal || discount.apply_at === "total")) {
4558
+ return discount;
4559
+ }
4560
+ return {};
4561
+ });
4562
+ const discountLabel = computed(() => {
4563
+ const { label } = discountObject.value;
4564
+ if (label) {
4565
+ if (label.includes(" ")) {
4566
+ return label;
4567
+ }
4568
+ return `via ${label}`;
4569
+ }
4570
+ return "";
4571
+ });
4572
+ const priceWithDiscount = computed(() => {
4573
+ return getPriceWithDiscount(salePrice.value, discountObject.value);
4574
+ });
4575
+ const pointsProgramObject = computed(() => {
4576
+ if (props.loyaltyPointsProgram) {
4577
+ return props.loyaltyPointsProgram;
4578
+ }
4579
+ const pointsPrograms = loyaltyPointsPrograms.value;
4580
+ if (pointsPrograms) {
4581
+ const programIds = Object.keys(pointsPrograms);
4582
+ for (let i = 0; i < programIds.length; i++) {
4583
+ const program = pointsPrograms[programIds[i]];
4584
+ if (program?.earn_percentage && program.earn_percentage > 0) {
4585
+ return program;
4586
+ }
4587
+ }
4588
+ }
4589
+ return { ratio: 0 };
4590
+ });
4591
+ const pointsMinPrice = computed(() => {
4592
+ return pointsProgramObject.value.min_subtotal_to_earn || 0;
4593
+ });
4594
+ const pointsProgramName = computed(() => {
4595
+ return pointsProgramObject.value.name || "";
4596
+ });
4597
+ const earnPointsPercentage = computed(() => {
4598
+ return pointsProgramObject.value.earn_percentage || 0;
4599
+ });
4600
+ const cashbackPercentage = computed(() => {
4601
+ return earnPointsPercentage.value * pointsProgramObject.value.ratio;
4602
+ });
4603
+ const cashbackValue = computed(() => {
4604
+ return cashbackPercentage.value >= 1 ? salePrice.value * (cashbackPercentage.value / 100) : 0;
4605
+ });
4606
+ return {
4607
+ hasVariedPrices,
4608
+ salePrice,
4609
+ comparePrice,
4610
+ installmentsObject,
4611
+ installmentsNumber,
4612
+ monthlyInterest,
4613
+ installmentValue,
4614
+ discountObject,
4615
+ discountLabel,
4616
+ priceWithDiscount,
4617
+ pointsProgramObject,
4618
+ pointsMinPrice,
4619
+ pointsProgramName,
4620
+ earnPointsPercentage,
4621
+ cashbackPercentage,
4622
+ cashbackValue
4623
+ };
4624
+ };
4625
+
4626
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4627
+ __name: "Prices",
4628
+ props: {
4629
+ isBig: { type: Boolean },
4630
+ isLiteral: { type: Boolean },
4631
+ hasCashback: { type: Boolean, default: true },
4632
+ hasPriceOptions: { type: Boolean, default: true },
4633
+ product: {},
4634
+ price: {},
4635
+ basePrice: {},
4636
+ isAmountTotal: { type: Boolean },
4637
+ installmentsOption: {},
4638
+ discountOption: {},
4639
+ loyaltyPointsProgram: {}
4640
+ },
4641
+ setup(__props, { expose: __expose }) {
4642
+ __expose();
4643
+ const props = __props;
4644
+ const {
4645
+ hasVariedPrices,
4646
+ salePrice,
4647
+ comparePrice,
4648
+ cashbackPercentage,
4649
+ cashbackValue,
4650
+ installmentsNumber,
4651
+ monthlyInterest,
4652
+ installmentValue,
4653
+ priceWithDiscount,
4654
+ discountLabel
4655
+ } = usePrices(props);
4656
+ const __returned__ = { props, hasVariedPrices, salePrice, comparePrice, cashbackPercentage, cashbackValue, installmentsNumber, monthlyInterest, installmentValue, priceWithDiscount, discountLabel };
4657
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
4658
+ return __returned__;
4659
+ }
4660
+ });
4661
+ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
4662
+ const _component_Fade = resolveComponent("Fade");
4663
+ _push(`<div${ssrRenderAttrs(mergeProps({
4664
+ class: ["text-base-600 [&>div]:[font-size:90%] [&_small]:[font-size:92%] [&_small]:lowercase", $props.isBig ? "text-lg" : null]
4665
+ }, _attrs))}>`);
4666
+ if ($setup.comparePrice) {
4667
+ _push(`<span class="text-base-500 mr-1 text-[87%]">`);
4668
+ if ($props.isLiteral) {
4669
+ _push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
4670
+ } else {
4671
+ _push(`<!---->`);
4672
+ }
4673
+ _push(`<s>${ssrInterpolate(_ctx.$money($setup.comparePrice))}</s>`);
4674
+ if ($props.isLiteral) {
4675
+ _push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
4676
+ } else {
4677
+ _push(`<!---->`);
4678
+ }
4679
+ _push(`</span>`);
4680
+ } else {
4681
+ _push(`<!---->`);
4682
+ }
4683
+ _push(`<strong class="${ssrRenderClass([$props.isBig ? "text-5xl block" : null, "inline-block text-base-800"])}">`);
4684
+ if ($setup.hasVariedPrices) {
4685
+ _push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
4686
+ } else {
4687
+ _push(`<!---->`);
4688
+ }
4689
+ _push(` ${ssrInterpolate(_ctx.$money($setup.salePrice))}</strong>`);
4690
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
4691
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4692
+ if (_push2) {
4693
+ if ($setup.cashbackValue && $props.hasCashback) {
4694
+ _push2(`<div class="relative z-10"${_scopeId}><span${ssrRenderAttr("data-tooltip", "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage)))}${_scopeId}><i class="i-arrow-uturn-left mr-1"${_scopeId}></i><span class="font-medium"${_scopeId}>${ssrInterpolate(_ctx.$money($setup.cashbackValue))}</span><small${_scopeId}> cashback</small></span></div>`);
4695
+ } else {
4696
+ _push2(`<!---->`);
4697
+ }
4698
+ } else {
4699
+ return [
4700
+ $setup.cashbackValue && $props.hasCashback ? (openBlock(), createBlock("div", {
4701
+ key: 0,
4702
+ class: "relative z-10"
4703
+ }, [
4704
+ createVNode("span", {
4705
+ "data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage))
4706
+ }, [
4707
+ createVNode("i", { class: "i-arrow-uturn-left mr-1" }),
4708
+ createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money($setup.cashbackValue)), 1),
4709
+ createVNode("small", null, " cashback")
4710
+ ], 8, ["data-tooltip"])
4711
+ ])) : createCommentVNode("", true)
4712
+ ];
4713
+ }
4714
+ }),
4715
+ _: 1
4716
+ }, _parent));
4717
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
4718
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4719
+ if (_push2) {
4720
+ if ($setup.installmentValue && $props.hasPriceOptions) {
4721
+ _push2(`<div${_scopeId}>`);
4722
+ if ($props.isLiteral) {
4723
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"At\xE9"} `)}</small>`);
4724
+ } else {
4725
+ _push2(`<!---->`);
4726
+ }
4727
+ _push2(` ${ssrInterpolate($setup.installmentsNumber)}x `);
4728
+ if ($props.isLiteral) {
4729
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
4730
+ } else {
4731
+ _push2(`<!---->`);
4732
+ }
4733
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.installmentValue))}</span>`);
4734
+ if (!$setup.monthlyInterest && $props.isLiteral) {
4735
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${"Sem juros"}`)}</small>`);
4736
+ } else {
4737
+ _push2(`<!---->`);
4738
+ }
4739
+ _push2(`</div>`);
4740
+ } else {
4741
+ _push2(`<!---->`);
4742
+ }
4743
+ } else {
4744
+ return [
4745
+ $setup.installmentValue && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
4746
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"At\xE9"} `))) : createCommentVNode("", true),
4747
+ createTextVNode(" " + toDisplayString($setup.installmentsNumber) + "x ", 1),
4748
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
4749
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.installmentValue)), 1),
4750
+ !$setup.monthlyInterest && $props.isLiteral ? (openBlock(), createBlock("small", { key: 2 }, toDisplayString(` ${"Sem juros"}`))) : createCommentVNode("", true)
4751
+ ])) : createCommentVNode("", true)
4752
+ ];
4753
+ }
4754
+ }),
4755
+ _: 1
4756
+ }, _parent));
4757
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
4758
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4759
+ if (_push2) {
4760
+ if ($setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions) {
4761
+ _push2(`<div${_scopeId}>`);
4762
+ if (!$setup.discountLabel) {
4763
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
4764
+ } else {
4765
+ _push2(`<!---->`);
4766
+ }
4767
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.priceWithDiscount))}</span>`);
4768
+ if ($setup.discountLabel) {
4769
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${$setup.discountLabel}`)}</small>`);
4770
+ } else {
4771
+ _push2(`<!---->`);
4772
+ }
4773
+ _push2(`</div>`);
4774
+ } else {
4775
+ _push2(`<!---->`);
4776
+ }
4777
+ } else {
4778
+ return [
4779
+ $setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
4780
+ !$setup.discountLabel ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true),
4781
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.priceWithDiscount)), 1),
4782
+ $setup.discountLabel ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${$setup.discountLabel}`), 1)) : createCommentVNode("", true)
4783
+ ])) : createCommentVNode("", true)
4784
+ ];
4785
+ }
4786
+ }),
4787
+ _: 1
4788
+ }, _parent));
4789
+ _push(`</div>`);
4790
+ }
4791
+ const _sfc_setup$2 = _sfc_main$2.setup;
4792
+ _sfc_main$2.setup = (props, ctx) => {
4793
+ const ssrContext = useSSRContext();
4794
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Prices.vue");
4795
+ return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
4796
+ };
4797
+ const Prices = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
4798
+
4799
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4800
+ __name: "ProductCard",
4801
+ props: {
4802
+ product: {},
4803
+ productId: {},
4804
+ headingTag: { default: "h3" }
4805
+ },
4806
+ setup(__props, { expose: __expose }) {
4807
+ __expose();
4808
+ const props = __props;
4809
+ const {
4810
+ product,
4811
+ title,
4812
+ link,
4813
+ images,
4814
+ isInStock,
4815
+ isActive,
4816
+ discountPercentage,
4817
+ hasVariations
4818
+ } = useProductCard(props);
4819
+ const card = ref(null);
4820
+ const isHovered = useElementHover(card);
4821
+ const wasHoveredOnce = ref(false);
4822
+ watchOnce(isHovered, () => {
4823
+ wasHoveredOnce.value = true;
4824
+ });
4825
+ const __returned__ = { props, product, title, link, images, isInStock, isActive, discountPercentage, hasVariations, card, isHovered, wasHoveredOnce, get addProductToCart() {
4826
+ return addProductToCart;
4827
+ }, Prices };
4828
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
4829
+ return __returned__;
4830
+ }
4831
+ });
4832
+ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
4833
+ const _component_ALink = resolveComponent("ALink");
4834
+ const _component_AImg = resolveComponent("AImg");
4835
+ _push(`<article${ssrRenderAttrs(mergeProps({
4836
+ ref: "card",
4837
+ "data-sku": $setup.product.sku,
4838
+ class: "relative h-full max-w-[350px] mx-auto py-3 group"
4839
+ }, _attrs))}>`);
4840
+ _push(ssrRenderComponent(_component_ALink, {
4841
+ href: $setup.link,
4842
+ class: "flex flex-col h-full rounded overflow-hidden group-hover:shadow group-hover:ring-1 ring-black/5"
4843
+ }, {
4844
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4845
+ if (_push2) {
4846
+ _push2(`<div class="aspect-square p-2 motion-safe:group-hover:scale-110 transition-transform"${_scopeId}><div class="relative w-full h-full bg-white rounded overflow-hidden group-hover:rounded-none"${_scopeId}>`);
4847
+ if ($setup.images?.length) {
4848
+ _push2(`<span class="text-xs text-opacity-70"${_scopeId}>`);
4849
+ _push2(ssrRenderComponent(_component_AImg, {
4850
+ picture: $setup.images[0],
4851
+ alt: $setup.title,
4852
+ class: "absolute top-0 left-0 block w-full h-full object-cover"
4853
+ }, null, _parent2, _scopeId));
4854
+ if ($setup.images[1] && $setup.wasHoveredOnce) {
4855
+ _push2(ssrRenderComponent(_component_AImg, {
4856
+ picture: $setup.images[1],
4857
+ alt: $setup.title,
4858
+ class: "absolute top-0 left-0 block w-full h-full object-cover opacity-0 group-hover:opacity-100 transition-opacity motion-safe:duration-300 text-transparent z-10"
4859
+ }, null, _parent2, _scopeId));
4860
+ } else {
4861
+ _push2(`<!---->`);
4862
+ }
4863
+ _push2(`</span>`);
4864
+ } else {
4865
+ _push2(`<div class="w-full h-full bg-gradient-to-br from-base-50/20 to-base-100"${_scopeId}></div>`);
4866
+ }
4867
+ _push2(`</div></div>`);
4868
+ if ($setup.discountPercentage) {
4869
+ _push2(`<span class="uno-bm03rg"${_scopeId}> -<strong${_scopeId}>${ssrInterpolate($setup.discountPercentage)}</strong>% </span>`);
4870
+ } else {
4871
+ _push2(`<!---->`);
4872
+ }
4873
+ _push2(`<div class="relative flex flex-col grow justify-between p-4 group-hover:backdrop-blur-md bg-white/40 z-10"${_scopeId}>`);
4874
+ ssrRenderVNode(_push2, createVNode(resolveDynamicComponent($props.headingTag), {
4875
+ class: ["ui-link no-underline line-clamp-2", [
4876
+ $setup.isActive ? "text-base-700" : "text-base-500",
4877
+ $setup.link ? "group-hover:underline group-hover:text-primary" : null
4878
+ ]]
4879
+ }, {
4880
+ default: withCtx((_2, _push3, _parent3, _scopeId2) => {
4881
+ if (_push3) {
4882
+ _push3(`${ssrInterpolate($setup.title)}`);
4883
+ } else {
4884
+ return [
4885
+ createTextVNode(toDisplayString($setup.title), 1)
4886
+ ];
4887
+ }
4888
+ }),
4889
+ _: 1
4890
+ }), _parent2, _scopeId);
4891
+ _push2(`<div class="pt-2"${_scopeId}>`);
4892
+ if ($setup.isActive) {
4893
+ _push2(`<div${_scopeId}>`);
4894
+ _push2(ssrRenderComponent($setup["Prices"], { product: $setup.product }, null, _parent2, _scopeId));
4895
+ _push2(`</div>`);
4896
+ } else {
4897
+ _push2(`<span class="ui-badge bg-warning-100 text-warning-700"${_scopeId}>${ssrInterpolate(!$setup.isInStock ? "Sem estoque" : "Inativo")}</span>`);
4898
+ }
4899
+ _push2(`</div>`);
4900
+ if ($setup.isActive && !$setup.hasVariations) {
4901
+ _push2(`<button class="uno-3suct9 ui-btn-sm ui-btn-primary"${_scopeId}><span class="inline-block h-4 w-4 leading-none text-base text-center bg-on-primary text-primary opacity-80 rounded-full mr-1"${_scopeId}> + </span> ${ssrInterpolate("Adicionar ao carrinho")}</button>`);
4902
+ } else {
4903
+ _push2(`<!---->`);
4904
+ }
4905
+ _push2(`</div>`);
4906
+ } else {
4907
+ return [
4908
+ createVNode("div", { class: "aspect-square p-2 motion-safe:group-hover:scale-110 transition-transform" }, [
4909
+ createVNode("div", { class: "relative w-full h-full bg-white rounded overflow-hidden group-hover:rounded-none" }, [
4910
+ $setup.images?.length ? (openBlock(), createBlock("span", {
4911
+ key: 0,
4912
+ class: "text-xs text-opacity-70"
4913
+ }, [
4914
+ createVNode(_component_AImg, {
4915
+ picture: $setup.images[0],
4916
+ alt: $setup.title,
4917
+ class: "absolute top-0 left-0 block w-full h-full object-cover"
4918
+ }, null, 8, ["picture", "alt"]),
4919
+ $setup.images[1] && $setup.wasHoveredOnce ? (openBlock(), createBlock(_component_AImg, {
4920
+ key: 0,
4921
+ picture: $setup.images[1],
4922
+ alt: $setup.title,
4923
+ class: "absolute top-0 left-0 block w-full h-full object-cover opacity-0 group-hover:opacity-100 transition-opacity motion-safe:duration-300 text-transparent z-10"
4924
+ }, null, 8, ["picture", "alt"])) : createCommentVNode("", true)
4925
+ ])) : (openBlock(), createBlock("div", {
4926
+ key: 1,
4927
+ class: "w-full h-full bg-gradient-to-br from-base-50/20 to-base-100"
4928
+ }))
4929
+ ])
4930
+ ]),
4931
+ $setup.discountPercentage ? (openBlock(), createBlock("span", {
4932
+ key: 0,
4933
+ class: "uno-bm03rg"
4934
+ }, [
4935
+ createTextVNode(" -"),
4936
+ createVNode("strong", null, toDisplayString($setup.discountPercentage), 1),
4937
+ createTextVNode("% ")
4938
+ ])) : createCommentVNode("", true),
4939
+ createVNode("div", { class: "relative flex flex-col grow justify-between p-4 group-hover:backdrop-blur-md bg-white/40 z-10" }, [
4940
+ (openBlock(), createBlock(resolveDynamicComponent($props.headingTag), {
4941
+ class: ["ui-link no-underline line-clamp-2", [
4942
+ $setup.isActive ? "text-base-700" : "text-base-500",
4943
+ $setup.link ? "group-hover:underline group-hover:text-primary" : null
4944
+ ]]
4945
+ }, {
4946
+ default: withCtx(() => [
4947
+ createTextVNode(toDisplayString($setup.title), 1)
4948
+ ]),
4949
+ _: 1
4950
+ }, 8, ["class"])),
4951
+ createVNode("div", { class: "pt-2" }, [
4952
+ $setup.isActive ? (openBlock(), createBlock("div", { key: 0 }, [
4953
+ createVNode($setup["Prices"], { product: $setup.product }, null, 8, ["product"])
4954
+ ])) : (openBlock(), createBlock("span", {
4955
+ key: 1,
4956
+ class: "ui-badge bg-warning-100 text-warning-700"
4957
+ }, toDisplayString(!$setup.isInStock ? "Sem estoque" : "Inativo"), 1))
4958
+ ]),
4959
+ $setup.isActive && !$setup.hasVariations ? (openBlock(), createBlock("button", {
4960
+ key: 0,
4961
+ class: "uno-3suct9 ui-btn-sm ui-btn-primary",
4962
+ onClick: withModifiers(($event) => $setup.addProductToCart($setup.product), ["prevent"])
4963
+ }, [
4964
+ createVNode("span", { class: "inline-block h-4 w-4 leading-none text-base text-center bg-on-primary text-primary opacity-80 rounded-full mr-1" }, " + "),
4965
+ createTextVNode(" " + toDisplayString("Adicionar ao carrinho"))
4966
+ ], 8, ["onClick"])) : createCommentVNode("", true)
4967
+ ])
4968
+ ];
4969
+ }
4970
+ }),
4971
+ _: 1
4972
+ }, _parent));
4973
+ _push(`</article>`);
4974
+ }
4975
+ const _sfc_setup$1 = _sfc_main$1.setup;
4976
+ _sfc_main$1.setup = (props, ctx) => {
4977
+ const ssrContext = useSSRContext();
4978
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ProductCard.vue");
4979
+ return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
4980
+ };
4981
+ const ProductCard = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
4982
+
4983
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4984
+ __name: "ProductShelf",
4985
+ props: {
4986
+ collectionId: {},
4987
+ searchQuery: {},
4988
+ sort: {},
4989
+ title: {},
4990
+ titleLink: {},
4991
+ isShuffle: { type: Boolean },
4992
+ limit: {},
4993
+ page: {},
4994
+ products: {}
4995
+ },
4996
+ async setup(__props, { expose: __expose }) {
4997
+ __expose();
4998
+ let __temp, __restore;
4999
+ const props = __props;
5000
+ const {
5001
+ title,
5002
+ titleLink,
5003
+ fetching,
5004
+ products
5005
+ } = useProductShelf(props);
5006
+ {
5007
+ [__temp, __restore] = withAsyncContext(() => fetching), await __temp, __restore();
5008
+ }
5009
+ const __returned__ = { props, title, titleLink, fetching, products, Carousel, CarouselControl, ProductCard };
5010
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
5011
+ return __returned__;
5012
+ }
5013
+ });
5014
+ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
5015
+ const _component_ALink = resolveComponent("ALink");
5016
+ _push(`<section${ssrRenderAttrs(mergeProps({ class: "ui-section" }, _attrs))}>`);
5017
+ if ($setup.title) {
5018
+ _push(`<div class="max-w-prose mx-auto text-center mb-2"><h2 class="ui-text-brand text-3xl">`);
5019
+ _push(ssrRenderComponent(_component_ALink, {
5020
+ href: $setup.titleLink,
5021
+ class: $setup.titleLink ? "ui-link" : "text-base-700"
5022
+ }, {
5023
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
5024
+ if (_push2) {
5025
+ _push2(`${ssrInterpolate($setup.title)}`);
5026
+ } else {
5027
+ return [
5028
+ createTextVNode(toDisplayString($setup.title), 1)
5029
+ ];
5030
+ }
5031
+ }),
5032
+ _: 1
5033
+ }, _parent));
5034
+ _push(`</h2></div>`);
5035
+ } else {
5036
+ _push(`<!---->`);
5037
+ }
5038
+ _push(ssrRenderComponent($setup["Carousel"], { class: "group/shelf" }, {
5039
+ controls: withCtx((_, _push2, _parent2, _scopeId) => {
5040
+ if (_push2) {
5041
+ _push2(`<div style="${ssrRenderStyle($setup.products.length > 2 ? null : { display: "none" })}" class="text-3xl lg:text-2xl leading-none text-primary lg:opacity-0 group-hover/shelf:opacity-90 transition-opacity"${_scopeId}>`);
5042
+ _push2(ssrRenderComponent($setup["CarouselControl"], {
5043
+ class: "!top-1/2 !-left-4 w-12 h-12 bg-transparent lg:bg-white/80 lg:hover:bg-primary-300/60 rounded-full lg:shadow-sm lg:ring-1 ring-black/5",
5044
+ "is-prev": ""
5045
+ }, null, _parent2, _scopeId));
5046
+ _push2(ssrRenderComponent($setup["CarouselControl"], { class: "!top-1/2 !-right-4 w-12 h-12 bg-transparent lg:bg-white/80 lg:hover:bg-primary-300/60 rounded-full lg:shadow-sm lg:ring-1 ring-black/5" }, null, _parent2, _scopeId));
5047
+ _push2(`</div>`);
5048
+ } else {
5049
+ return [
5050
+ withDirectives(createVNode("div", { class: "text-3xl lg:text-2xl leading-none text-primary lg:opacity-0 group-hover/shelf:opacity-90 transition-opacity" }, [
5051
+ createVNode($setup["CarouselControl"], {
5052
+ class: "!top-1/2 !-left-4 w-12 h-12 bg-transparent lg:bg-white/80 lg:hover:bg-primary-300/60 rounded-full lg:shadow-sm lg:ring-1 ring-black/5",
5053
+ "is-prev": ""
5054
+ }),
5055
+ createVNode($setup["CarouselControl"], { class: "!top-1/2 !-right-4 w-12 h-12 bg-transparent lg:bg-white/80 lg:hover:bg-primary-300/60 rounded-full lg:shadow-sm lg:ring-1 ring-black/5" })
5056
+ ], 512), [
5057
+ [vShow, $setup.products.length > 2]
5058
+ ])
5059
+ ];
5060
+ }
5061
+ }),
5062
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
5063
+ if (_push2) {
5064
+ _push2(`<!--[-->`);
5065
+ ssrRenderList($setup.products, (product) => {
5066
+ _push2(`<li class="basis-1/2 md:basis-1/3 lg:basis-1/4 shrink-0"${_scopeId}>`);
5067
+ _push2(ssrRenderComponent($setup["ProductCard"], { product }, null, _parent2, _scopeId));
5068
+ _push2(`</li>`);
5069
+ });
5070
+ _push2(`<!--]-->`);
5071
+ } else {
5072
+ return [
5073
+ (openBlock(true), createBlock(Fragment$1, null, renderList($setup.products, (product) => {
5074
+ return openBlock(), createBlock("li", {
5075
+ key: product._id,
5076
+ class: "basis-1/2 md:basis-1/3 lg:basis-1/4 shrink-0"
5077
+ }, [
5078
+ createVNode($setup["ProductCard"], { product }, null, 8, ["product"])
5079
+ ]);
5080
+ }), 128))
5081
+ ];
5082
+ }
5083
+ }),
5084
+ _: 1
5085
+ }, _parent));
5086
+ _push(`</section>`);
5087
+ }
5088
+ const _sfc_setup = _sfc_main.setup;
5089
+ _sfc_main.setup = (props, ctx) => {
5090
+ const ssrContext = useSSRContext();
5091
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ProductShelf.vue");
5092
+ return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
5093
+ };
5094
+ const ProductShelf = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
5095
+
5096
+ const useBreadcrumbs = async (props = {}) => {
5097
+ const { settings, apiContext, data } = globalThis.$storefront;
5098
+ const {
5099
+ apiDoc = apiContext?.doc,
5100
+ domain = settings.domain
5101
+ } = props;
5102
+ let categories = props.categories || data.categories;
5103
+ if (!categories) {
5104
+ categories = (await useSharedData({ field: "categories" })).value;
5105
+ }
5106
+ const breadcrumbs = [];
5107
+ if (apiDoc) {
5108
+ const productCategories = apiDoc.categories;
5109
+ if (productCategories) {
5110
+ categoriesList(apiDoc).forEach((categoryName) => {
5111
+ const findCategory = (category2) => {
5112
+ return category2.name === categoryName;
5113
+ };
5114
+ const category = productCategories && productCategories.find(findCategory) || categories?.find(findCategory);
5115
+ if (category) {
5116
+ breadcrumbs.push({
5117
+ name: name(category),
5118
+ link: `/${category.slug}`
5119
+ });
5120
+ }
5121
+ });
5122
+ }
5123
+ breadcrumbs.push({
5124
+ name: name(apiDoc),
5125
+ link: `/${apiDoc.slug}`
5126
+ });
5127
+ }
5128
+ return {
5129
+ breadcrumbs,
5130
+ inlineJSONLd: domain ? JSON.stringify({
5131
+ "@context": "https://schema.org",
5132
+ "@type": "BreadcrumbList",
5133
+ itemListElement: [
5134
+ {
5135
+ "@type": "ListItem",
5136
+ position: 1,
5137
+ item: {
5138
+ "@id": `https://${domain}/`,
5139
+ name: "Homepage"
5140
+ }
5141
+ }
5142
+ ].concat(breadcrumbs.map(({ name, link }, index) => {
5143
+ return {
5144
+ "@type": "ListItem",
5145
+ position: index + 2,
5146
+ item: {
5147
+ "@id": `https://${domain}${link}`,
5148
+ name
5149
+ }
5150
+ };
5151
+ }))
5152
+ }) : null
5153
+ };
5154
+ };
5155
+
5156
+ var __freeze = Object.freeze;
5157
+ var __defProp = Object.defineProperty;
5158
+ var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
5159
+ var _a;
5160
+ const $$Astro$5 = createAstro("https://ecom2-demo.web.app");
5161
+ const $$Breadcrumbs = createComponent(async ($$result, $$props, $$slots) => {
5162
+ const Astro2 = $$result.createAstro($$Astro$5, $$props, $$slots);
5163
+ Astro2.self = $$Breadcrumbs;
5164
+ const { breadcrumbs, inlineJSONLd } = await useBreadcrumbs(Astro2.props);
5165
+ return renderTemplate`${breadcrumbs.length > 0 && renderTemplate`${maybeRenderHead()}<section class="ui-section-slim"><nav aria-label="Breadcrumb" class="w-full overflow-hidden text-lg md:text-sm"><ol class="flex items-center gap-1 text-base-600"><li><a href="/" class="hover:text-primary"><span class="sr-only"> Home </span><i class="i-home"></i></a></li>${breadcrumbs.map(
5166
+ ({ name, link }, i) => renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${i + 1 < breadcrumbs.length ? renderTemplate`<li class="text-base-300"><i class="i-chevron-right"></i></li><li class="whitespace-nowrap"><a${addAttribute(link, "href")} class="hover:text-primary">${name}</a></li>` : renderTemplate`<li class="hidden lg:block text-base-300"><i class="i-chevron-right"></i></li><li class="hidden lg:block whitespace-nowrap overflow-hidden text-ellipsis"><span class="text-base-500">${name}</span></li>`}` })}`
5167
+ )}</ol></nav>${inlineJSONLd && renderTemplate(_a || (_a = __template(['<script type="application/ld+json">', "<\/script>"])), unescapeHTML(inlineJSONLd))}</section>`}`;
5168
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/components/Breadcrumbs.astro", void 0);
5169
+
5170
+ const i19description = "Descrição";
5171
+
5172
+ const $$Astro$4 = createAstro("https://ecom2-demo.web.app");
5173
+ const $$ContentClearfix = createComponent(async ($$result, $$props, $$slots) => {
5174
+ const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
5175
+ Astro2.self = $$ContentClearfix;
5176
+ const { html } = Astro2.props;
5177
+ const parsedHTML = html.replace(/<(img|iframe) /g, '<$1 loading="lazy" ');
5178
+ return renderTemplate`${maybeRenderHead()}<article class="overflow-x-auto lg:overflow-x-hidden prose !max-w-full"><div class="[&_table]:max-w-full [&_img]:max-w-full [&_iframe]:max-w-full">${unescapeHTML(parsedHTML)}</div></article>`;
5179
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/ContentClearfix.astro", void 0);
5180
+
5181
+ const $$Astro$3 = createAstro("https://ecom2-demo.web.app");
5182
+ const $$DocDescription = createComponent(async ($$result, $$props, $$slots) => {
5183
+ const Astro2 = $$result.createAstro($$Astro$3, $$props, $$slots);
5184
+ Astro2.self = $$DocDescription;
5185
+ const { apiDoc, title } = Astro2.props;
5186
+ const html = apiDoc.body_html || apiDoc.body_text;
5187
+ return renderTemplate`${html && renderTemplate`${maybeRenderHead()}<section class="ui-section"><p class="text-2xl font-medium lowercase text-base-700"><a href="#description" id="description"><i class="i-link text-base-400 mr-1"></i>${title || i19description}</a></p>${renderComponent($$result, "ContentClearfix", $$ContentClearfix, { "html": html })}</section>`}`;
5188
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/components/DocDescription.astro", void 0);
5189
+
5190
+ const $$Astro$2 = createAstro("https://ecom2-demo.web.app");
5191
+ const $$Sections = createComponent(async ($$result, $$props, $$slots) => {
5192
+ const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
5193
+ Astro2.self = $$Sections;
5194
+ const { routeContext } = Astro2.locals;
5195
+ const { sections } = await usePageSections({
5196
+ routeContext,
5197
+ handleCustomSection: async (type, content) => {
5198
+ if (type === "c:foo")
5199
+ return { props: { ...content, foo: "bar" } };
5200
+ return { props: content };
5201
+ }
5202
+ });
5203
+ const { apiContext: { doc: apiDoc } } = routeContext;
5204
+ return renderTemplate`${maybeRenderHead()}<article class="my-9 md:my-12">${sections.map(async ({ type, props }) => {
5205
+ switch (type) {
5206
+ case "product-shelf":
5207
+ return renderTemplate`${renderComponent($$result, "ProductShelf", ProductShelf, { ...props, "client:visible": true, "client:component-hydration": "visible", "client:component-path": "~/components/ProductShelf.vue", "client:component-export": "default" })}`;
5208
+ case "banners-grid":
5209
+ return renderTemplate`${renderComponent($$result, "BannersGrid", $$BannersGrid, { ...props })}`;
5210
+ case "breadcrumbs":
5211
+ return apiDoc && renderTemplate`${renderComponent($$result, "Breadcrumbs", $$Breadcrumbs, { ...props, "apiDoc": apiDoc })}`;
5212
+ case "doc-description":
5213
+ return apiDoc && renderTemplate`${renderComponent($$result, "DocDescription", $$DocDescription, { "apiDoc": apiDoc })}`;
5214
+ case "c:foo":
5215
+ return renderTemplate`<div${addAttribute(props.foo, "data-foo")}></div>`;
5216
+ default:
5217
+ return renderTemplate`<div${addAttribute(type, "data-section")}></div>`;
5218
+ }
5219
+ })}</article>`;
5220
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Sections.astro", void 0);
5221
+
5222
+ const $$Astro$1 = createAstro("https://ecom2-demo.web.app");
5223
+ const $$Wildcard = createComponent(async ($$result, $$props, $$slots) => {
5224
+ const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
5225
+ Astro2.self = $$Wildcard;
5226
+ const { fetchingApiContext } = Astro2.locals.routeContext;
5227
+ await fetchingApiContext;
5228
+ return renderTemplate`${maybeRenderHead()}<main>${renderComponent($$result, "Sections", $$Sections, {})}</main>`;
3836
5229
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Wildcard.astro", void 0);
3837
5230
 
3838
5231
  const $$Astro = createAstro("https://ecom2-demo.web.app");
@@ -3855,14 +5248,7 @@ const $$ = createComponent(async ($$result, $$props, $$slots) => {
3855
5248
  }
3856
5249
  loadError = err;
3857
5250
  }
3858
- return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}>
3859
- ${routeContext && renderTemplate`${renderComponent($$result, "Base", $$Base, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "BaseHead", $$BaseHead, { "slot": "base-head" })}`, "default": ($$result2) => renderTemplate`
3860
-
3861
- ${renderComponent($$result2, "PageHeader", $$PageHeader, {})}
3862
- ${renderComponent($$result2, "WildcardMain", $$Wildcard, {})}
3863
- ` })}`}
3864
- ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
3865
- </html>`;
5251
+ return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}>${routeContext && renderTemplate`${renderComponent($$result, "Base", $$Base, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "BaseHead", $$BaseHead, { "slot": "base-head" })}`, "default": ($$result2) => renderTemplate`${renderComponent($$result2, "PageHeader", $$PageHeader, {})}${renderComponent($$result2, "WildcardMain", $$Wildcard, {})}${renderComponent($$result2, "PageFooter", $$PageFooter, {})}` })}`}${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}</html>`;
3866
5252
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro", void 0);
3867
5253
 
3868
5254
  const $$file = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro";
@@ -3876,4 +5262,4 @@ const ____slug_ = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty(
3876
5262
  url: $$url
3877
5263
  }, Symbol.toStringTag, { value: 'Module' }));
3878
5264
 
3879
- export { $$Picture as $, BaseSSRService as B, Carousel as C, SocialNetworkLink as S, _export_sfc as _, CarouselControl as a, availableExtraDiscount as b, installmentsOption as c, discountOption as d, addProductToCart as e, filterMainCategories as f, loadRouteContext as g, $$BaseHead as h, isOutputFormatSupportsAlpha as i, $$PageHeader as j, $$Base as k, loyaltyPointsPrograms as l, parseProduct as m, useId as n, freeShippingFromValue as o, parseShippingPhrase as p, shoppingCart as q, removeCartItem as r, socialNetworks as s, totalItems as t, useSharedData as u, ____slug_ as v };
5265
+ export { $$BannerPictures as $, Banner as B, Carousel as C, Prices as P, _export_sfc as _, CarouselControl as a, $$Sections as b, $$BaseHead as c, $$PageHeader as d, $$PageFooter as e, $$Base as f, useId as g, freeShippingFromValue as h, ____slug_ as i, loadRouteContext as l, parseProduct as p, removeCartItem as r, shoppingCart as s, totalItems as t, usePageHero as u };