cloudcommerce 0.26.2 → 0.26.3

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 (132) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barra-doce/functions/ssr/index.js +0 -1
  4. package/ecomplus-stores/barra-doce/functions/ssr/package.json +8 -8
  5. package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartItem.vue +64 -0
  6. package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartSidebar.vue +38 -7
  7. package/ecomplus-stores/barra-doce/functions/ssr/src/components/Prices.vue +2 -3
  8. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeader.vue +8 -4
  9. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  10. package/ecomplus-stores/barra-doce/package.json +2 -2
  11. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  12. package/ecomplus-stores/iluminim/functions/ssr/package.json +8 -8
  13. package/ecomplus-stores/iluminim/functions/ssr/src/components/CartItem.vue +64 -0
  14. package/ecomplus-stores/iluminim/functions/ssr/src/components/CartSidebar.vue +37 -6
  15. package/ecomplus-stores/iluminim/functions/ssr/src/components/Prices.vue +2 -3
  16. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopHeader.vue +6 -2
  17. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  18. package/ecomplus-stores/iluminim/package.json +2 -2
  19. package/package.json +3 -3
  20. package/packages/api/package.json +1 -1
  21. package/packages/apps/affilate-program/package.json +1 -1
  22. package/packages/apps/correios/package.json +1 -1
  23. package/packages/apps/custom-payment/package.json +1 -1
  24. package/packages/apps/custom-shipping/package.json +1 -1
  25. package/packages/apps/datafrete/package.json +1 -1
  26. package/packages/apps/discounts/package.json +1 -1
  27. package/packages/apps/emails/package.json +2 -2
  28. package/packages/apps/fb-conversions/package.json +1 -1
  29. package/packages/apps/flash-courier/package.json +1 -1
  30. package/packages/apps/frenet/package.json +1 -1
  31. package/packages/apps/galaxpay/package.json +1 -1
  32. package/packages/apps/google-analytics/package.json +1 -1
  33. package/packages/apps/jadlog/package.json +1 -1
  34. package/packages/apps/loyalty-points/package.json +1 -1
  35. package/packages/apps/melhor-envio/package.json +1 -1
  36. package/packages/apps/mercadopago/package.json +1 -1
  37. package/packages/apps/pagarme/package.json +1 -1
  38. package/packages/apps/paghiper/package.json +1 -1
  39. package/packages/apps/pix/package.json +1 -1
  40. package/packages/apps/tiny-erp/package.json +1 -1
  41. package/packages/apps/webhooks/package.json +1 -1
  42. package/packages/cli/package.json +1 -1
  43. package/packages/config/package.json +1 -1
  44. package/packages/emails/package.json +1 -1
  45. package/packages/eslint/package.json +3 -3
  46. package/packages/events/package.json +1 -1
  47. package/packages/feeds/package.json +1 -1
  48. package/packages/firebase/package.json +1 -1
  49. package/packages/i18n/package.json +1 -1
  50. package/packages/modules/lib/firebase/functions-checkout/request-to-module.js +2 -2
  51. package/packages/modules/lib/firebase/functions-checkout/request-to-module.js.map +1 -1
  52. package/packages/modules/lib/firebase/functions-checkout/utils.js +21 -9
  53. package/packages/modules/lib/firebase/functions-checkout/utils.js.map +1 -1
  54. package/packages/modules/package.json +2 -2
  55. package/packages/modules/schemas/@checkout.cjs +0 -1
  56. package/packages/modules/src/firebase/functions-checkout/request-to-module.ts +2 -2
  57. package/packages/modules/src/firebase/functions-checkout/utils.ts +23 -9
  58. package/packages/passport/package.json +1 -1
  59. package/packages/ssr/package.json +2 -2
  60. package/packages/storefront/dist/client/_astro/{Carousel.926668f2.js → Carousel.0b24e2cb.js} +1 -1
  61. package/packages/storefront/dist/client/_astro/CartSidebar.2731d333.js +1 -0
  62. package/packages/storefront/dist/client/_astro/{HeroSlider.1f0524aa.js → HeroSlider.a70b2582.js} +1 -1
  63. package/packages/storefront/dist/client/_astro/{PitchBar.7407eeaf.js → PitchBar.13991988.js} +1 -1
  64. package/packages/storefront/dist/client/_astro/{Prices.562a32ab.js → Prices.cdfa346a.js} +1 -1
  65. package/packages/storefront/dist/client/_astro/{ProductShelf.763cd2ca.js → ProductShelf.619c56a5.js} +1 -1
  66. package/packages/storefront/dist/client/_astro/SearchModal.117a477d.js +1 -0
  67. package/packages/storefront/dist/client/_astro/{ShopHeader.126900a6.js → ShopHeader.2c2fded7.js} +2 -2
  68. package/packages/storefront/dist/client/_astro/_...slug_.b693913e.css +1 -0
  69. package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.ee681fa8.js → _plugin-vue_export-helper.fc5e2f5b.js} +1 -1
  70. package/packages/storefront/dist/client/_astro/{api.a2eda23e.js → api.39f40cd8.js} +1 -1
  71. package/packages/storefront/dist/client/_astro/client.a5d2898b.js +1 -0
  72. package/packages/storefront/dist/client/_astro/{firebase-app.93857bfb.js → firebase-app.8c541cce.js} +3 -3
  73. package/packages/storefront/dist/client/_astro/{format-money.923559cc.js → format-money.86f14860.js} +1 -1
  74. package/packages/storefront/dist/client/_astro/hoisted.d90361ee.js +1 -0
  75. package/packages/storefront/dist/client/_astro/{img.ec6ba316.js → img.d4891d80.js} +1 -1
  76. package/packages/storefront/dist/client/_astro/index.33801818.js +1 -0
  77. package/packages/storefront/dist/client/_astro/{modules-info.48980668.js → modules-info.ec412b24.js} +1 -1
  78. package/packages/storefront/dist/client/_empty-middleware.mjs +3 -0
  79. package/packages/storefront/dist/client/chunks/CartSidebar.0ce1e999.mjs +382 -0
  80. package/packages/storefront/dist/client/chunks/SearchModal.f603145b.mjs +32 -0
  81. package/packages/storefront/dist/client/chunks/astro.11be33ee.mjs +1424 -0
  82. package/packages/storefront/dist/{server/chunks/pages/_...slug_.astro.fd8a229f.mjs → client/chunks/pages/_...slug_.astro.ec6517ba.mjs} +360 -274
  83. package/packages/storefront/dist/{server/chunks/pages/account.astro.3b21bff8.mjs → client/chunks/pages/account.astro.3d2605e6.mjs} +2 -10
  84. package/packages/storefront/dist/{server/chunks/pages/index.astro.dab642f5.mjs → client/chunks/pages/index.astro.8ad03206.mjs} +167 -17
  85. package/packages/storefront/dist/{server/chunks/pages/~fallback.astro.7630c0d6.mjs → client/chunks/pages/~fallback.astro.d31d20b4.mjs} +8 -20
  86. package/packages/storefront/dist/client/chunks/sharp.3f154e38.mjs +74 -0
  87. package/packages/storefront/dist/client/manifest.e39eb543.mjs +79 -0
  88. package/packages/storefront/dist/client/pages/_---slug_.astro.mjs +23 -0
  89. package/packages/storefront/dist/client/pages/app/account.astro.mjs +23 -0
  90. package/packages/storefront/dist/client/pages/app.astro.mjs +23 -0
  91. package/packages/storefront/dist/client/pages/index.astro.mjs +23 -0
  92. package/packages/storefront/dist/client/pages/~fallback.astro.mjs +23 -0
  93. package/packages/storefront/dist/client/registerSW.js +1 -0
  94. package/packages/storefront/dist/client/renderers.mjs +369 -0
  95. package/packages/storefront/dist/client/sw.js +1 -1
  96. package/packages/storefront/dist/server/chunks/{CartSidebar.2b555408.mjs → CartSidebar.cca9fdd3.mjs} +14 -24
  97. package/packages/storefront/dist/server/chunks/{SearchModal.f418e188.mjs → SearchModal.a680efae.mjs} +8 -19
  98. package/packages/storefront/dist/server/chunks/_...f7cdc954.mjs +24 -0
  99. package/packages/storefront/dist/server/chunks/account@_@astro.fa8b921b.mjs +24 -0
  100. package/packages/storefront/dist/server/chunks/{astro.bb5b7191.mjs → astro.440a2e08.mjs} +149 -1859
  101. package/packages/storefront/dist/server/chunks/image-endpoint@_@js.802bf648.mjs +24 -0
  102. package/packages/storefront/dist/server/chunks/index@_@astro.a122f091.mjs +24 -0
  103. package/packages/storefront/dist/server/chunks/index@_@astro.da98dcbe.mjs +24 -0
  104. package/packages/storefront/dist/server/chunks/pages/_...slug_.astro.08ba5973.mjs +3930 -0
  105. package/packages/storefront/dist/server/chunks/pages/account.astro.f11f26f3.mjs +15 -0
  106. package/packages/storefront/dist/server/chunks/pages/image-endpoint.js.a9374d3e.mjs +238 -0
  107. package/packages/storefront/dist/server/chunks/pages/index.astro.079f316a.mjs +1650 -0
  108. package/packages/storefront/dist/server/chunks/pages/~fallback.astro.01594623.mjs +55 -0
  109. package/packages/storefront/dist/server/chunks/sharp.52841bb4.mjs +75 -0
  110. package/packages/storefront/dist/server/chunks/~fallback@_@astro.876a97c5.mjs +24 -0
  111. package/packages/storefront/dist/server/entry.mjs +1167 -2360
  112. package/packages/storefront/dist/server/manifest.12e7a10c.mjs +561 -0
  113. package/packages/storefront/dist/server/renderers.mjs +10 -21
  114. package/packages/storefront/package.json +6 -6
  115. package/packages/storefront/src/lib/layouts/BaseHead.astro +3 -2
  116. package/packages/test-base/package.json +1 -1
  117. package/packages/types/modules/@checkout:params.d.ts +1 -1
  118. package/packages/types/package.json +1 -1
  119. package/ecomplus-stores/iluminim/.ecomplus.cd.json +0 -5
  120. package/packages/storefront/dist/client/_astro/CartSidebar.eadba34f.js +0 -1
  121. package/packages/storefront/dist/client/_astro/SearchModal.cffd4c2d.js +0 -1
  122. package/packages/storefront/dist/client/_astro/_...slug_.36cd433d.css +0 -1
  123. package/packages/storefront/dist/client/_astro/client.e6d9439a.js +0 -1
  124. package/packages/storefront/dist/client/_astro/hoisted.572313d6.js +0 -1
  125. package/packages/storefront/dist/client/_astro/index.709ac149.js +0 -1
  126. package/packages/storefront/dist/server/chunks/_...d32bcc0c.mjs +0 -35
  127. package/packages/storefront/dist/server/chunks/account@_@astro.0106855f.mjs +0 -35
  128. package/packages/storefront/dist/server/chunks/endpoint@_@js.35807882.mjs +0 -35
  129. package/packages/storefront/dist/server/chunks/index@_@astro.477f5af1.mjs +0 -35
  130. package/packages/storefront/dist/server/chunks/index@_@astro.e5a61d6e.mjs +0 -35
  131. package/packages/storefront/dist/server/chunks/pages/endpoint.js.247079ba.mjs +0 -119
  132. package/packages/storefront/dist/server/chunks/~fallback@_@astro.65227dd7.mjs +0 -35
@@ -0,0 +1,1650 @@
1
+ import { c as createAstro, b as createComponent, r as renderTemplate, f as renderComponent, F as Fragment, m as maybeRenderHead, e as addAttribute, u as unescapeHTML } from '../astro.440a2e08.mjs';
2
+ import { _ as _export_sfc, s as socialNetworks, S as SocialNetworkLink, u as useSharedData, f as filterMainCategories, $ as $$Picture, p as parseShippingPhrase, C as Carousel, a as CarouselControl, b as availableExtraDiscount, c as installmentsOption, d as discountOption, l as loyaltyPointsPrograms, e as addProductToCart, g as loadRouteContext, h as $$BaseHead, j as $$PageHeader, k as $$Base } from './_...slug_.astro.08ba5973.mjs';
3
+ import 'clsx';
4
+ import { useSSRContext, defineComponent, computed, mergeProps, createVNode, resolveDynamicComponent, resolveComponent, createSlots, withCtx, toDisplayString, createTextVNode, renderSlot, openBlock, createBlock, createCommentVNode, ref, shallowReactive, withDirectives, vShow, Fragment as Fragment$1, renderList, withModifiers, withAsyncContext } from 'vue';
5
+ import { ssrRenderAttrs, ssrInterpolate, ssrRenderVNode, ssrRenderSlot, ssrRenderList, ssrRenderComponent, ssrRenderClass, ssrRenderStyle, ssrRenderAttr } from 'vue/server-renderer';
6
+ import api from '@cloudcommerce/api';
7
+ import { inStock, price, name, img, onPromotion } from '@ecomplus/utils';
8
+ import { useElementHover, watchOnce } from '@vueuse/core';
9
+
10
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
11
+ __name: "PaymentMethodFlag",
12
+ props: {
13
+ as: { default: "i" },
14
+ flag: {}
15
+ },
16
+ setup(__props, { expose: __expose }) {
17
+ __expose();
18
+ const props = __props;
19
+ const iconClassName = computed(() => {
20
+ switch (props.flag) {
21
+ case "pix":
22
+ return "i-pix text-[#77B6A8]";
23
+ case "visa":
24
+ return "i-visa";
25
+ case "mastercard":
26
+ return "i-mastercard";
27
+ case "elo":
28
+ return "i-elo";
29
+ case "amex":
30
+ return "i-amex";
31
+ case "hipercard":
32
+ return "i-hipercard";
33
+ case "diners":
34
+ return "i-dinersclub";
35
+ case "discover":
36
+ return "i-discover";
37
+ default:
38
+ return "";
39
+ }
40
+ });
41
+ const __returned__ = { props, iconClassName };
42
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
43
+ return __returned__;
44
+ }
45
+ });
46
+ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
47
+ if (!$setup.iconClassName) {
48
+ _push(`<b${ssrRenderAttrs(mergeProps({ class: "tracking-tighter leading-none mb-1 text-black text-[57%]" }, _attrs))}>${ssrInterpolate($setup.props.flag)}</b>`);
49
+ } else {
50
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
51
+ }
52
+ }
53
+ const _sfc_setup$6 = _sfc_main$6.setup;
54
+ _sfc_main$6.setup = (props, ctx) => {
55
+ const ssrContext = useSSRContext();
56
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/PaymentMethodFlag.vue");
57
+ return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
58
+ };
59
+ const PaymentMethodFlag = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
60
+
61
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
62
+ __name: "ShopFooter",
63
+ props: {
64
+ stamps: {},
65
+ categories: {},
66
+ categoriesColTitle: {},
67
+ pageLinks: {},
68
+ pagesColTitle: {}
69
+ },
70
+ setup(__props, { expose: __expose }) {
71
+ __expose();
72
+ const __returned__ = { get socialNetworks() {
73
+ return socialNetworks;
74
+ }, SocialNetworkLink, PaymentMethodFlag };
75
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
76
+ return __returned__;
77
+ }
78
+ });
79
+ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
80
+ const _component_ALink = resolveComponent("ALink");
81
+ _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">`);
82
+ ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
83
+ if (_ctx.$settings.description) {
84
+ _push(`<div class="prose"><p>${ssrInterpolate(_ctx.$settings.description)}</p></div>`);
85
+ } else {
86
+ _push(`<!---->`);
87
+ }
88
+ _push(`<div class="flex gap-2 text-base-500"><!--[-->`);
89
+ ssrRenderList($setup.socialNetworks, (href, network) => {
90
+ _push(`<span>`);
91
+ _push(ssrRenderComponent($setup["SocialNetworkLink"], {
92
+ network,
93
+ class: "p-1 hover:text-primary"
94
+ }, createSlots({ _: 2 }, [
95
+ network === "whatsapp" ? {
96
+ name: "append",
97
+ fn: withCtx((_, _push2, _parent2, _scopeId) => {
98
+ if (_push2) {
99
+ _push2(`<span class="ml-1 text-sm text-base-600"${_scopeId}>${ssrInterpolate(_ctx.$settings.whatsapp)}</span>`);
100
+ } else {
101
+ return [
102
+ createVNode("span", { class: "ml-1 text-sm text-base-600" }, toDisplayString(_ctx.$settings.whatsapp), 1)
103
+ ];
104
+ }
105
+ }),
106
+ key: "0"
107
+ } : void 0
108
+ ]), _parent));
109
+ _push(`</span>`);
110
+ });
111
+ _push(`<!--]--></div>`);
112
+ if (_ctx.$settings.address || _ctx.$settings.phone) {
113
+ _push(`<div class="mt-3 text-base-700">`);
114
+ if (_ctx.$settings.address) {
115
+ _push(`<address class="inline-block mr-4">${ssrInterpolate(_ctx.$settings.address)}</address>`);
116
+ } else {
117
+ _push(`<!---->`);
118
+ }
119
+ if (_ctx.$settings.phone) {
120
+ _push(ssrRenderComponent(_component_ALink, {
121
+ href: `tel:${_ctx.$settings.phone.replace(/\D/g, "")}`,
122
+ class: "hover:text-primary"
123
+ }, {
124
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
125
+ if (_push2) {
126
+ _push2(`<i class="i-phone mr-0.5"${_scopeId}></i> ${ssrInterpolate(_ctx.$settings.phone)}`);
127
+ } else {
128
+ return [
129
+ createVNode("i", { class: "i-phone mr-0.5" }),
130
+ createTextVNode(" " + toDisplayString(_ctx.$settings.phone), 1)
131
+ ];
132
+ }
133
+ }),
134
+ _: 1
135
+ }, _parent));
136
+ } else {
137
+ _push(`<!---->`);
138
+ }
139
+ _push(`</div>`);
140
+ } else {
141
+ _push(`<!---->`);
142
+ }
143
+ _push(`</div>`);
144
+ if ($props.categories?.length) {
145
+ _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"])}"><!--[-->`);
146
+ ssrRenderList($props.categories, ({ name, slug }, i) => {
147
+ _push(`<li>`);
148
+ _push(ssrRenderComponent(_component_ALink, {
149
+ href: `/${slug}`,
150
+ class: "ui-link text-base-600"
151
+ }, {
152
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
153
+ if (_push2) {
154
+ _push2(`${ssrInterpolate(name)}`);
155
+ } else {
156
+ return [
157
+ createTextVNode(toDisplayString(name), 1)
158
+ ];
159
+ }
160
+ }),
161
+ _: 2
162
+ }, _parent));
163
+ _push(`</li>`);
164
+ });
165
+ _push(`<!--]--><li>`);
166
+ _push(ssrRenderComponent(_component_ALink, {
167
+ href: "/s",
168
+ class: "ui-link text-base-900"
169
+ }, {
170
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
171
+ if (_push2) {
172
+ _push2(`${ssrInterpolate("Todos os produtos")}`);
173
+ } else {
174
+ return [
175
+ createTextVNode(toDisplayString("Todos os produtos"))
176
+ ];
177
+ }
178
+ }),
179
+ _: 1
180
+ }, _parent));
181
+ _push(`</li></ul></div>`);
182
+ } else {
183
+ _push(`<!---->`);
184
+ }
185
+ if ($props.pageLinks?.length) {
186
+ _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"])}"><!--[-->`);
187
+ ssrRenderList($props.pageLinks, ({ title, href }, i) => {
188
+ _push(`<li>`);
189
+ _push(ssrRenderComponent(_component_ALink, {
190
+ href,
191
+ class: "ui-link text-base-600"
192
+ }, {
193
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
194
+ if (_push2) {
195
+ _push2(`${ssrInterpolate(title)}`);
196
+ } else {
197
+ return [
198
+ createTextVNode(toDisplayString(title), 1)
199
+ ];
200
+ }
201
+ }),
202
+ _: 2
203
+ }, _parent));
204
+ _push(`</li>`);
205
+ });
206
+ _push(`<!--]--></ul></div>`);
207
+ } else {
208
+ _push(`<!---->`);
209
+ }
210
+ _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"><!--[-->`);
211
+ ssrRenderList($props.stamps, (stamp, i) => {
212
+ _push(`<li>`);
213
+ _push(ssrRenderComponent(_component_ALink, {
214
+ href: stamp.href?.replace("{domain}", _ctx.$settings.domain || "")
215
+ }, {
216
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
217
+ if (_push2) {
218
+ ssrRenderSlot(_ctx.$slots, `picture-${i}`, {}, null, _push2, _parent2, _scopeId);
219
+ if (!stamp.img) {
220
+ _push2(`<span class="flex items-center"${_scopeId}>`);
221
+ if (stamp.icon) {
222
+ _push2(`<span class="text-4xl mr-2 [&amp;&gt;*]:bg-gradient-to-br [&amp;&gt;*]:from-success-200 [&amp;&gt;*]:to-success-700"${_scopeId}>`);
223
+ if (stamp.icon === "lock") {
224
+ _push2(`<i class="i-lock-closed"${_scopeId}></i>`);
225
+ } else if (stamp.icon === "check") {
226
+ _push2(`<i class="i-check-badge"${_scopeId}></i>`);
227
+ } else {
228
+ _push2(`<i class="i-arrow-path-rounded-square"${_scopeId}></i>`);
229
+ }
230
+ _push2(`</span>`);
231
+ } else {
232
+ _push2(`<!---->`);
233
+ }
234
+ _push2(`<span class="text-sm font-medium text-base-600 max-w-[140px]"${_scopeId}>${ssrInterpolate(stamp.alt)} `);
235
+ if (stamp.href && stamp.href.charAt(0) !== "/") {
236
+ _push2(`<i class="bg-base-400 ml-0.5 i-arrow-top-right-on-square"${_scopeId}></i>`);
237
+ } else {
238
+ _push2(`<!---->`);
239
+ }
240
+ _push2(`</span></span>`);
241
+ } else {
242
+ _push2(`<!---->`);
243
+ }
244
+ } else {
245
+ return [
246
+ renderSlot(_ctx.$slots, `picture-${i}`),
247
+ !stamp.img ? (openBlock(), createBlock("span", {
248
+ key: 0,
249
+ class: "flex items-center"
250
+ }, [
251
+ stamp.icon ? (openBlock(), createBlock("span", {
252
+ key: 0,
253
+ class: "text-4xl mr-2 [&>*]:bg-gradient-to-br [&>*]:from-success-200 [&>*]:to-success-700"
254
+ }, [
255
+ stamp.icon === "lock" ? (openBlock(), createBlock("i", {
256
+ key: 0,
257
+ class: "i-lock-closed"
258
+ })) : stamp.icon === "check" ? (openBlock(), createBlock("i", {
259
+ key: 1,
260
+ class: "i-check-badge"
261
+ })) : (openBlock(), createBlock("i", {
262
+ key: 2,
263
+ class: "i-arrow-path-rounded-square"
264
+ }))
265
+ ])) : createCommentVNode("", true),
266
+ createVNode("span", { class: "text-sm font-medium text-base-600 max-w-[140px]" }, [
267
+ createTextVNode(toDisplayString(stamp.alt) + " ", 1),
268
+ stamp.href && stamp.href.charAt(0) !== "/" ? (openBlock(), createBlock("i", {
269
+ key: 0,
270
+ class: "bg-base-400 ml-0.5 i-arrow-top-right-on-square"
271
+ })) : createCommentVNode("", true)
272
+ ])
273
+ ])) : createCommentVNode("", true)
274
+ ];
275
+ }
276
+ }),
277
+ _: 2
278
+ }, _parent));
279
+ _push(`</li>`);
280
+ });
281
+ _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"><!--[-->`);
282
+ ssrRenderList(_ctx.$settings.payment_methods, (paymentMethod) => {
283
+ _push(ssrRenderComponent($setup["PaymentMethodFlag"], {
284
+ key: paymentMethod,
285
+ flag: paymentMethod
286
+ }, null, _parent));
287
+ });
288
+ _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>`);
289
+ _push(ssrRenderComponent(_component_ALink, {
290
+ href: "https://www.ecomplus.io/",
291
+ class: "italic text-[#37003c]"
292
+ }, {
293
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
294
+ if (_push2) {
295
+ _push2(` powered by <b${_scopeId}>E-Com Plus</b>`);
296
+ } else {
297
+ return [
298
+ createTextVNode(" powered by "),
299
+ createVNode("b", null, "E-Com Plus")
300
+ ];
301
+ }
302
+ }),
303
+ _: 1
304
+ }, _parent));
305
+ _push(`</div></div></footer>`);
306
+ }
307
+ const _sfc_setup$5 = _sfc_main$5.setup;
308
+ _sfc_main$5.setup = (props, ctx) => {
309
+ const ssrContext = useSSRContext();
310
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopFooter.vue");
311
+ return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
312
+ };
313
+ const ShopFooter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
314
+
315
+ const $$Astro$6 = createAstro("https://ecom2-demo.web.app");
316
+ const $$PageFooter = createComponent(async ($$result, $$props, $$slots) => {
317
+ const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
318
+ Astro2.self = $$PageFooter;
319
+ const { routeContext } = Astro2.locals;
320
+ const { settings, getContent, isHomepage } = routeContext;
321
+ const LogoHeading = isHomepage ? "h2" : "h3";
322
+ const layoutContent = await getContent("layout");
323
+ const {
324
+ footer: {
325
+ stamps,
326
+ categories_list: categoriesList,
327
+ pages_list: pagesList
328
+ }
329
+ } = layoutContent;
330
+ let mainCategories;
331
+ let pageLinks;
332
+ if (categoriesList?.enabled) {
333
+ if (categoriesList.categories?.length) {
334
+ mainCategories = categoriesList.categories;
335
+ } else {
336
+ const { value: categories } = await useSharedData({ field: "categories" });
337
+ mainCategories = filterMainCategories(categories);
338
+ }
339
+ }
340
+ if (pagesList?.enabled) {
341
+ if (pagesList.links?.length) {
342
+ pageLinks = pagesList.links;
343
+ } else {
344
+ pageLinks = [];
345
+ const pageSlugs = await getContent("extra-pages/");
346
+ for (let i = 0; i < pageSlugs.length; i++) {
347
+ const { title } = await getContent(`extra-pages/${pageSlugs[i]}`);
348
+ if (title) {
349
+ pageLinks.push({ title, href: `/p/${pageSlugs[i]}` });
350
+ }
351
+ }
352
+ }
353
+ }
354
+ 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`
355
+ ${maybeRenderHead()}<a href="/">
356
+ ${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate`
357
+ ${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "loading": "lazy", "class": "max-w-[150px]" })}
358
+ ` })}
359
+ </a>
360
+ ` })}` })}`;
361
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/PageFooter.astro", void 0);
362
+
363
+ const useProductShelf = (props) => {
364
+ const title = ref(props.title || "");
365
+ const titleLink = ref(props.titleLink || "");
366
+ const isFetching = ref(false);
367
+ let fetching = null;
368
+ const fetchError = ref(null);
369
+ const products = shallowReactive(props.products || []);
370
+ if (!props.products) {
371
+ isFetching.value = true;
372
+ fetching = (async () => {
373
+ let searchQuery = props.searchQuery || "";
374
+ let collection;
375
+ if (props.collectionId) {
376
+ try {
377
+ const { data } = await api.get(`collections/${props.collectionId}`);
378
+ collection = data;
379
+ } catch (err) {
380
+ console.error(err);
381
+ fetchError.value = err;
382
+ }
383
+ const productIds = collection?.products;
384
+ if (Array.isArray(productIds) && productIds.length) {
385
+ searchQuery += `&_id=${productIds.slice(0, 60).join(",")}`;
386
+ }
387
+ if (!title.value && title.value !== null && collection?.name) {
388
+ title.value = collection?.name;
389
+ }
390
+ }
391
+ const limit = props.limit || 24;
392
+ const offset = props.page ? (props.page - 1) * limit : 0;
393
+ let endpointQuery = `offset=${offset}&limit=${limit}`;
394
+ if (props.sort) {
395
+ endpointQuery += `&sort=${props.sort}`;
396
+ }
397
+ endpointQuery += searchQuery;
398
+ try {
399
+ const { data } = await api.get(`search/v1?${endpointQuery}`);
400
+ if (props.isShuffle) {
401
+ let m = data.result.filter((item) => {
402
+ return item.available && inStock(item);
403
+ }).length;
404
+ let t;
405
+ let i;
406
+ while (m) {
407
+ i = Math.floor(Math.random() * m--);
408
+ t = data.result[m];
409
+ data.result[m] = data.result[i];
410
+ data.result[i] = t;
411
+ }
412
+ }
413
+ data.result.forEach((item) => products.push(item));
414
+ } catch (err) {
415
+ console.error(err);
416
+ fetchError.value = err;
417
+ }
418
+ isFetching.value = false;
419
+ })();
420
+ }
421
+ return {
422
+ title,
423
+ titleLink,
424
+ isFetching,
425
+ fetching,
426
+ fetchError,
427
+ products
428
+ };
429
+ };
430
+
431
+ const now = Date.now();
432
+ const parseBanners = (banners) => {
433
+ const validBanners = [];
434
+ banners.forEach(({
435
+ img,
436
+ start,
437
+ end,
438
+ mobile_img: mobileImg,
439
+ button_link: buttonLink,
440
+ button_text: buttonText,
441
+ ...rest
442
+ }) => {
443
+ if (start && new Date(start).getTime() < now)
444
+ return;
445
+ if (end && new Date(end).getTime() > now)
446
+ return;
447
+ validBanners.push({
448
+ ...rest,
449
+ img,
450
+ mobileImg,
451
+ buttonLink,
452
+ buttonText
453
+ });
454
+ });
455
+ return validBanners;
456
+ };
457
+ const usePageHero = async ({ routeContext }) => {
458
+ const { cmsContent } = routeContext;
459
+ const heroSlider = { slides: [] };
460
+ const heroContent = cmsContent?.hero;
461
+ if (heroContent) {
462
+ heroSlider.autoplay = heroContent.autoplay;
463
+ if (heroContent.slides) {
464
+ heroSlider.slides = parseBanners(heroContent.slides);
465
+ }
466
+ }
467
+ return { heroSlider };
468
+ };
469
+ const usePageSections = async ({ routeContext, handleCustomSection }) => {
470
+ const sectionsContent = routeContext.cmsContent?.sections;
471
+ const sections = [];
472
+ if (sectionsContent) {
473
+ await Promise.all(sectionsContent.map(async ({ type, ...sectionContent }, index) => {
474
+ if (type === "product-shelf") {
475
+ const {
476
+ collection_id: collectionIdAndInfo,
477
+ headless: isHeadless,
478
+ shuffle: isShuffle,
479
+ ...rest
480
+ } = sectionContent;
481
+ let { sort, title } = sectionContent;
482
+ switch (sort) {
483
+ case "offers":
484
+ sort = "-price_discount";
485
+ break;
486
+ case "news":
487
+ sort = "-_id";
488
+ break;
489
+ case "lowest_price":
490
+ sort = "price";
491
+ break;
492
+ case "highest_price":
493
+ sort = "-price";
494
+ break;
495
+ }
496
+ let collectionId = null;
497
+ let searchQuery;
498
+ let titleLink;
499
+ if (collectionIdAndInfo) {
500
+ const [_id, resource, name, path] = collectionIdAndInfo.split(":");
501
+ collectionId = _id;
502
+ if (resource === "categories") {
503
+ searchQuery = `&categories._id=${_id}`;
504
+ } else if (resource === "brands") {
505
+ searchQuery = `&brands._id=${_id}`;
506
+ }
507
+ if (!title && title !== null && name) {
508
+ title = name;
509
+ }
510
+ titleLink = path;
511
+ }
512
+ const props = {
513
+ ...rest,
514
+ collectionId,
515
+ searchQuery,
516
+ sort,
517
+ title: isHeadless ? null : title,
518
+ titleLink,
519
+ isShuffle
520
+ };
521
+ const { fetching, products } = useProductShelf(props);
522
+ await fetching;
523
+ sections[index] = {
524
+ type,
525
+ props: {
526
+ ...rest,
527
+ collectionId,
528
+ searchQuery,
529
+ sort,
530
+ title: isHeadless ? null : title,
531
+ titleLink,
532
+ isShuffle,
533
+ products
534
+ }
535
+ };
536
+ return;
537
+ }
538
+ if (type === "banners-grid") {
539
+ sections[index] = {
540
+ type,
541
+ props: {
542
+ banners: parseBanners(sectionContent.banners || [])
543
+ }
544
+ };
545
+ return;
546
+ }
547
+ if (typeof handleCustomSection === "function") {
548
+ const { props } = await handleCustomSection(
549
+ type,
550
+ sectionContent
551
+ );
552
+ sections[index] = { type, props };
553
+ }
554
+ }));
555
+ }
556
+ return {
557
+ sections
558
+ };
559
+ };
560
+
561
+ const $$Astro$5 = createAstro("https://ecom2-demo.web.app");
562
+ const $$BannerPictures = createComponent(async ($$result, $$props, $$slots) => {
563
+ const Astro2 = $$result.createAstro($$Astro$5, $$props, $$slots);
564
+ Astro2.self = $$BannerPictures;
565
+ const {
566
+ img,
567
+ alt,
568
+ mobileImg,
569
+ title,
570
+ subtitle,
571
+ buttonText,
572
+ index,
573
+ class: className = "max-w-screen-sm sm:max-w-[828px] md:max-w-screen-2xl",
574
+ mobileClass = "max-w-screen-sm sm:max-w-screen-lg"
575
+ } = Astro2.props;
576
+ const hasHeader = title || subtitle || buttonText;
577
+ let { widths, mobileWidths } = Astro2.props;
578
+ if (!widths?.length) {
579
+ if (mobileImg) {
580
+ widths = [1536, 2048];
581
+ } else {
582
+ widths = [640, 828, 1536, 2048];
583
+ if (hasHeader) {
584
+ widths = widths.map((w) => w / 2);
585
+ }
586
+ }
587
+ }
588
+ if (!mobileWidths?.length) {
589
+ mobileWidths = [640, 1024];
590
+ }
591
+ 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}` })}`}
592
+ ${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}` })}`}`;
593
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/BannerPictures.astro", void 0);
594
+
595
+ const useBanner = (props) => {
596
+ const parsedTitle = computed(() => {
597
+ return props.title ? parseShippingPhrase(props.title).value : "";
598
+ });
599
+ const parsedSubtitle = computed(() => {
600
+ return props.subtitle ? parseShippingPhrase(props.subtitle).value : "";
601
+ });
602
+ const parsedButtonText = computed(() => {
603
+ return props.buttonText ? parseShippingPhrase(props.buttonText).value : "";
604
+ });
605
+ const hasHeader = computed(() => {
606
+ return Boolean(parsedTitle.value || parsedSubtitle.value || parsedButtonText.value);
607
+ });
608
+ return {
609
+ parsedTitle,
610
+ parsedSubtitle,
611
+ parsedButtonText,
612
+ hasHeader
613
+ };
614
+ };
615
+
616
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
617
+ __name: "Banner",
618
+ props: {
619
+ img: {},
620
+ alt: {},
621
+ mobileImg: {},
622
+ href: {},
623
+ title: {},
624
+ subtitle: {},
625
+ buttonLink: {},
626
+ buttonText: {},
627
+ headingTag: { default: "h3" }
628
+ },
629
+ setup(__props, { expose: __expose }) {
630
+ __expose();
631
+ const props = __props;
632
+ const {
633
+ hasHeader,
634
+ parsedTitle,
635
+ parsedSubtitle,
636
+ parsedButtonText
637
+ } = useBanner(props);
638
+ const __returned__ = { props, hasHeader, parsedTitle, parsedSubtitle, parsedButtonText };
639
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
640
+ return __returned__;
641
+ }
642
+ });
643
+ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
644
+ const _component_ALink = resolveComponent("ALink");
645
+ _push(`<div${ssrRenderAttrs(mergeProps({
646
+ class: ["mx-auto overflow-x-hidden", $setup.hasHeader ? "grid grid-cols-1 sm:grid-cols-2 items-center" : null]
647
+ }, _attrs))}>`);
648
+ _push(ssrRenderComponent(_component_ALink, {
649
+ href: $props.href,
650
+ 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"
651
+ }, {
652
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
653
+ if (_push2) {
654
+ ssrRenderSlot(_ctx.$slots, "picture", {}, null, _push2, _parent2, _scopeId);
655
+ } else {
656
+ return [
657
+ renderSlot(_ctx.$slots, "picture")
658
+ ];
659
+ }
660
+ }),
661
+ _: 3
662
+ }, _parent));
663
+ if ($setup.hasHeader) {
664
+ _push(`<div class="p-12 xl:ps-32 mb-3 sm:mb-0">`);
665
+ if ($setup.parsedTitle) {
666
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.headingTag), { class: "ui-title mt-1" }, {
667
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
668
+ if (_push2) {
669
+ _push2(`${ssrInterpolate($setup.parsedTitle)}`);
670
+ } else {
671
+ return [
672
+ createTextVNode(toDisplayString($setup.parsedTitle), 1)
673
+ ];
674
+ }
675
+ }),
676
+ _: 1
677
+ }), _parent);
678
+ } else {
679
+ _push(`<!---->`);
680
+ }
681
+ if ($setup.parsedSubtitle) {
682
+ _push(`<p class="text-lg mt-4 md:mt-6">${ssrInterpolate($setup.parsedSubtitle)}</p>`);
683
+ } else {
684
+ _push(`<!---->`);
685
+ }
686
+ if ($setup.parsedButtonText) {
687
+ _push(ssrRenderComponent(_component_ALink, {
688
+ href: $props.buttonLink,
689
+ class: "ui-btn-lg ui-btn-contrast min-w-[150px] mt-7 md:mt-10"
690
+ }, {
691
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
692
+ if (_push2) {
693
+ _push2(`${ssrInterpolate($setup.parsedButtonText)}`);
694
+ } else {
695
+ return [
696
+ createTextVNode(toDisplayString($setup.parsedButtonText), 1)
697
+ ];
698
+ }
699
+ }),
700
+ _: 1
701
+ }, _parent));
702
+ } else {
703
+ _push(`<!---->`);
704
+ }
705
+ _push(`</div>`);
706
+ } else {
707
+ _push(`<!---->`);
708
+ }
709
+ _push(`</div>`);
710
+ }
711
+ const _sfc_setup$4 = _sfc_main$4.setup;
712
+ _sfc_main$4.setup = (props, ctx) => {
713
+ const ssrContext = useSSRContext();
714
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Banner.vue");
715
+ return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
716
+ };
717
+ const Banner = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
718
+
719
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
720
+ __name: "HeroSlider",
721
+ props: {
722
+ autoplay: {},
723
+ slides: {}
724
+ },
725
+ setup(__props, { expose: __expose }) {
726
+ __expose();
727
+ const __returned__ = { Carousel, CarouselControl, Banner };
728
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
729
+ return __returned__;
730
+ }
731
+ });
732
+ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
733
+ _push(`<section${ssrRenderAttrs(mergeProps({ class: "relative mx-auto" }, _attrs))}>`);
734
+ _push(ssrRenderComponent($setup["Carousel"], {
735
+ autoplay: $props.autoplay,
736
+ class: "secondary [&>*]:items-center"
737
+ }, {
738
+ controls: withCtx((_, _push2, _parent2, _scopeId) => {
739
+ if (_push2) {
740
+ _push2(`<div style="${ssrRenderStyle($props.slides.length > 1 ? null : { display: "none" })}" class="absolute z-10 bottom-5 flex justify-end items-center w-screen right-5 xl:right-auto xl:max-w-screen-xl xl:left-1/2 xl:-ms-[640px]"${_scopeId}><div class="relative w-20 h-10 rounded-full bg-white/50 text-primary shadow-sm ring-1 ring-black/5"${_scopeId}>`);
741
+ _push2(ssrRenderComponent($setup["CarouselControl"], {
742
+ class: "w-10 h-10 rounded-full hover:bg-primary/10",
743
+ "is-prev": ""
744
+ }, {
745
+ default: withCtx((_2, _push3, _parent3, _scopeId2) => {
746
+ if (_push3) {
747
+ _push3(`<i class="i-arrow-left"${_scopeId2}></i>`);
748
+ } else {
749
+ return [
750
+ createVNode("i", { class: "i-arrow-left" })
751
+ ];
752
+ }
753
+ }),
754
+ _: 1
755
+ }, _parent2, _scopeId));
756
+ _push2(ssrRenderComponent($setup["CarouselControl"], { class: "w-10 h-10 rounded-full hover:bg-primary/10" }, {
757
+ default: withCtx((_2, _push3, _parent3, _scopeId2) => {
758
+ if (_push3) {
759
+ _push3(`<i class="i-arrow-right"${_scopeId2}></i>`);
760
+ } else {
761
+ return [
762
+ createVNode("i", { class: "i-arrow-right" })
763
+ ];
764
+ }
765
+ }),
766
+ _: 1
767
+ }, _parent2, _scopeId));
768
+ _push2(`</div></div>`);
769
+ } else {
770
+ return [
771
+ withDirectives(createVNode("div", { class: "absolute z-10 bottom-5 flex justify-end items-center w-screen right-5 xl:right-auto xl:max-w-screen-xl xl:left-1/2 xl:-ms-[640px]" }, [
772
+ createVNode("div", { class: "relative w-20 h-10 rounded-full bg-white/50 text-primary shadow-sm ring-1 ring-black/5" }, [
773
+ createVNode($setup["CarouselControl"], {
774
+ class: "w-10 h-10 rounded-full hover:bg-primary/10",
775
+ "is-prev": ""
776
+ }, {
777
+ default: withCtx(() => [
778
+ createVNode("i", { class: "i-arrow-left" })
779
+ ]),
780
+ _: 1
781
+ }),
782
+ createVNode($setup["CarouselControl"], { class: "w-10 h-10 rounded-full hover:bg-primary/10" }, {
783
+ default: withCtx(() => [
784
+ createVNode("i", { class: "i-arrow-right" })
785
+ ]),
786
+ _: 1
787
+ })
788
+ ])
789
+ ], 512), [
790
+ [vShow, $props.slides.length > 1]
791
+ ])
792
+ ];
793
+ }
794
+ }),
795
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
796
+ if (_push2) {
797
+ _push2(`<!--[-->`);
798
+ ssrRenderList($props.slides, (slide, i) => {
799
+ _push2(`<li class="shrink-0 basis-full"${_scopeId}>`);
800
+ _push2(ssrRenderComponent($setup["Banner"], mergeProps({ ...slide, headingTag: i === 0 ? "h2" : "h3" }, { class: "w-screen max-w-screen-2xl" }), {
801
+ picture: withCtx((_2, _push3, _parent3, _scopeId2) => {
802
+ if (_push3) {
803
+ ssrRenderSlot(_ctx.$slots, `picture-${i}`, {}, null, _push3, _parent3, _scopeId2);
804
+ } else {
805
+ return [
806
+ renderSlot(_ctx.$slots, `picture-${i}`)
807
+ ];
808
+ }
809
+ }),
810
+ _: 2
811
+ }, _parent2, _scopeId));
812
+ _push2(`</li>`);
813
+ });
814
+ _push2(`<!--]-->`);
815
+ } else {
816
+ return [
817
+ (openBlock(true), createBlock(Fragment$1, null, renderList($props.slides, (slide, i) => {
818
+ return openBlock(), createBlock("li", {
819
+ key: i,
820
+ class: "shrink-0 basis-full"
821
+ }, [
822
+ createVNode($setup["Banner"], mergeProps({ ...slide, headingTag: i === 0 ? "h2" : "h3" }, { class: "w-screen max-w-screen-2xl" }), {
823
+ picture: withCtx(() => [
824
+ renderSlot(_ctx.$slots, `picture-${i}`)
825
+ ]),
826
+ _: 2
827
+ }, 1040)
828
+ ]);
829
+ }), 128))
830
+ ];
831
+ }
832
+ }),
833
+ _: 3
834
+ }, _parent));
835
+ _push(`</section>`);
836
+ }
837
+ const _sfc_setup$3 = _sfc_main$3.setup;
838
+ _sfc_main$3.setup = (props, ctx) => {
839
+ const ssrContext = useSSRContext();
840
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/HeroSlider.vue");
841
+ return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
842
+ };
843
+ const HeroSlider = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
844
+
845
+ const $$Astro$4 = createAstro("https://ecom2-demo.web.app");
846
+ const $$BannersGrid = createComponent(async ($$result, $$props, $$slots) => {
847
+ const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
848
+ Astro2.self = $$BannersGrid;
849
+ const { banners } = Astro2.props;
850
+ return renderTemplate`${maybeRenderHead()}<section class="ui-section">
851
+ <ul class="flex flex-wrap lg:flex-nowrap gap-4">
852
+ ${banners.map((banner) => renderTemplate`<li class="lg:flex-1 [&_img]:w-full [&_img]:object-cover">
853
+ ${renderComponent($$result, "Banner", Banner, { ...banner }, { "picture": ($$result2) => renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { ...banner, "slot": "picture" })}` })}
854
+ </li>`)}
855
+ </ul>
856
+ </section>`;
857
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/components/BannersGrid.astro", void 0);
858
+
859
+ const useProductCard = (props) => {
860
+ const isFetching = ref(false);
861
+ let fetching = null;
862
+ const fetchError = ref(null);
863
+ const { productId } = props;
864
+ const product = shallowReactive({
865
+ ...props.product,
866
+ _id: props.product?._id || productId,
867
+ price: price(props.product || {})
868
+ });
869
+ if (!props.product && productId) {
870
+ isFetching.value = true;
871
+ fetching = (async () => {
872
+ try {
873
+ const { data } = await api.get(`products/${productId}`);
874
+ Object.assign(product, data);
875
+ } catch (err) {
876
+ console.error(err);
877
+ fetchError.value = err;
878
+ }
879
+ isFetching.value = false;
880
+ })();
881
+ }
882
+ const title = computed(() => {
883
+ return name(product);
884
+ });
885
+ const link = computed(() => {
886
+ const { slug } = product;
887
+ if (typeof slug === "string") {
888
+ return `/${slug}`;
889
+ }
890
+ return null;
891
+ });
892
+ const images = computed(() => {
893
+ const { pictures } = product;
894
+ const _images = [];
895
+ if (pictures) {
896
+ pictures.forEach((picture) => {
897
+ const img$1 = img(picture);
898
+ if (img$1)
899
+ _images.push(img$1);
900
+ });
901
+ }
902
+ return _images;
903
+ });
904
+ const isInStock = computed(() => {
905
+ return inStock(product);
906
+ });
907
+ const isActive = computed(() => {
908
+ return isInStock.value && product.available && product.visible;
909
+ });
910
+ const discountPercentage = computed(() => {
911
+ if (onPromotion(product)) {
912
+ const basePrice = product.base_price;
913
+ return Math.round((basePrice - price(product)) * 100 / basePrice);
914
+ }
915
+ return 0;
916
+ });
917
+ const hasVariations = computed(() => {
918
+ if (product.has_variations)
919
+ return true;
920
+ return Boolean(product.variations?.length);
921
+ });
922
+ return {
923
+ isFetching,
924
+ fetching,
925
+ fetchError,
926
+ product,
927
+ title,
928
+ link,
929
+ images,
930
+ isInStock,
931
+ isActive,
932
+ discountPercentage,
933
+ hasVariations
934
+ };
935
+ };
936
+
937
+ const getPriceWithDiscount = (price, discount) => {
938
+ const { type, value } = discount;
939
+ let priceWithDiscount;
940
+ if (value) {
941
+ if (type === "percentage") {
942
+ priceWithDiscount = price * ((100 - value) / 100);
943
+ } else {
944
+ priceWithDiscount = price - value;
945
+ }
946
+ return priceWithDiscount > 0 ? priceWithDiscount : 0;
947
+ }
948
+ return price;
949
+ };
950
+ const usePrices = (props) => {
951
+ const _product = computed(() => {
952
+ return props.product || {
953
+ price: props.price || 0,
954
+ base_price: props.basePrice
955
+ };
956
+ });
957
+ const hasVariedPrices = computed(() => {
958
+ const { variations } = _product.value;
959
+ if (variations) {
960
+ const productPrice = price(_product.value);
961
+ for (let i = 0; i < variations.length; i++) {
962
+ const price$1 = price({
963
+ ..._product.value,
964
+ ...variations[i]
965
+ });
966
+ if (price$1 > productPrice) {
967
+ return true;
968
+ }
969
+ }
970
+ }
971
+ return false;
972
+ });
973
+ const salePrice = computed(() => {
974
+ const price$1 = price(_product.value);
975
+ const discount = availableExtraDiscount.value;
976
+ if (discount && (!discount.min_amount || price$1 > discount.min_amount)) {
977
+ return getPriceWithDiscount(price$1, discount);
978
+ }
979
+ return price$1;
980
+ });
981
+ const comparePrice = computed(() => {
982
+ if (onPromotion(_product.value)) {
983
+ return _product.value.base_price;
984
+ }
985
+ const price$1 = price(_product.value);
986
+ if (price$1 > salePrice.value) {
987
+ return price$1;
988
+ }
989
+ return 0;
990
+ });
991
+ const installmentsObject = computed(() => {
992
+ return props.installmentsOption || installmentsOption.value || { max_number: 1 };
993
+ });
994
+ const installmentsNumber = computed(() => {
995
+ if (installmentsObject.value.max_number <= 1) {
996
+ return 1;
997
+ }
998
+ const minInstallment = installmentsObject.value.min_installment || 5;
999
+ const maxInstallmentsNumber = Math.floor(salePrice.value / minInstallment);
1000
+ return Math.min(maxInstallmentsNumber, installmentsObject.value.max_number);
1001
+ });
1002
+ const monthlyInterest = computed(() => {
1003
+ return installmentsObject.value.monthly_interest || 0;
1004
+ });
1005
+ const installmentValue = computed(() => {
1006
+ if (installmentsNumber.value >= 2) {
1007
+ if (!monthlyInterest.value) {
1008
+ return salePrice.value / installmentsNumber.value;
1009
+ }
1010
+ const interest = monthlyInterest.value / 100;
1011
+ return salePrice.value * interest / (1 - (1 + interest) ** -installmentsNumber.value);
1012
+ }
1013
+ return 0;
1014
+ });
1015
+ const discountObject = computed(() => {
1016
+ const discount = props.discountOption || discountOption.value;
1017
+ if (discount && (!discount.min_amount || discount.min_amount <= salePrice.value) && (!props.isAmountTotal || discount.apply_at === "total")) {
1018
+ return discount;
1019
+ }
1020
+ return {};
1021
+ });
1022
+ const discountLabel = computed(() => {
1023
+ const { label } = discountObject.value;
1024
+ if (label) {
1025
+ if (label.includes(" ")) {
1026
+ return label;
1027
+ }
1028
+ return `via ${label}`;
1029
+ }
1030
+ return "";
1031
+ });
1032
+ const priceWithDiscount = computed(() => {
1033
+ return getPriceWithDiscount(salePrice.value, discountObject.value);
1034
+ });
1035
+ const pointsProgramObject = computed(() => {
1036
+ if (props.loyaltyPointsProgram) {
1037
+ return props.loyaltyPointsProgram;
1038
+ }
1039
+ const pointsPrograms = loyaltyPointsPrograms.value;
1040
+ if (pointsPrograms) {
1041
+ const programIds = Object.keys(pointsPrograms);
1042
+ for (let i = 0; i < programIds.length; i++) {
1043
+ const program = pointsPrograms[programIds[i]];
1044
+ if (program?.earn_percentage && program.earn_percentage > 0) {
1045
+ return program;
1046
+ }
1047
+ }
1048
+ }
1049
+ return { ratio: 0 };
1050
+ });
1051
+ const pointsMinPrice = computed(() => {
1052
+ return pointsProgramObject.value.min_subtotal_to_earn || 0;
1053
+ });
1054
+ const pointsProgramName = computed(() => {
1055
+ return pointsProgramObject.value.name || "";
1056
+ });
1057
+ const earnPointsPercentage = computed(() => {
1058
+ return pointsProgramObject.value.earn_percentage || 0;
1059
+ });
1060
+ const cashbackPercentage = computed(() => {
1061
+ return earnPointsPercentage.value * pointsProgramObject.value.ratio;
1062
+ });
1063
+ const cashbackValue = computed(() => {
1064
+ return cashbackPercentage.value >= 1 ? salePrice.value * (cashbackPercentage.value / 100) : 0;
1065
+ });
1066
+ return {
1067
+ hasVariedPrices,
1068
+ salePrice,
1069
+ comparePrice,
1070
+ installmentsObject,
1071
+ installmentsNumber,
1072
+ monthlyInterest,
1073
+ installmentValue,
1074
+ discountObject,
1075
+ discountLabel,
1076
+ priceWithDiscount,
1077
+ pointsProgramObject,
1078
+ pointsMinPrice,
1079
+ pointsProgramName,
1080
+ earnPointsPercentage,
1081
+ cashbackPercentage,
1082
+ cashbackValue
1083
+ };
1084
+ };
1085
+
1086
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1087
+ __name: "Prices",
1088
+ props: {
1089
+ isBig: { type: Boolean },
1090
+ isLiteral: { type: Boolean },
1091
+ hasCashback: { type: Boolean, default: true },
1092
+ hasPriceOptions: { type: Boolean, default: true },
1093
+ product: {},
1094
+ price: {},
1095
+ basePrice: {},
1096
+ isAmountTotal: { type: Boolean },
1097
+ installmentsOption: {},
1098
+ discountOption: {},
1099
+ loyaltyPointsProgram: {}
1100
+ },
1101
+ setup(__props, { expose: __expose }) {
1102
+ __expose();
1103
+ const props = __props;
1104
+ const {
1105
+ hasVariedPrices,
1106
+ salePrice,
1107
+ comparePrice,
1108
+ cashbackPercentage,
1109
+ cashbackValue,
1110
+ installmentsNumber,
1111
+ monthlyInterest,
1112
+ installmentValue,
1113
+ priceWithDiscount,
1114
+ discountLabel
1115
+ } = usePrices(props);
1116
+ const __returned__ = { props, hasVariedPrices, salePrice, comparePrice, cashbackPercentage, cashbackValue, installmentsNumber, monthlyInterest, installmentValue, priceWithDiscount, discountLabel };
1117
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1118
+ return __returned__;
1119
+ }
1120
+ });
1121
+ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1122
+ const _component_Fade = resolveComponent("Fade");
1123
+ _push(`<div${ssrRenderAttrs(mergeProps({
1124
+ class: ["text-base-600 [&>div]:[font-size:90%] [&_small]:[font-size:92%] [&_small]:lowercase", $props.isBig ? "text-lg" : null]
1125
+ }, _attrs))}>`);
1126
+ if ($setup.comparePrice) {
1127
+ _push(`<span class="text-base-500 mr-1 text-[87%]">`);
1128
+ if ($props.isLiteral) {
1129
+ _push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
1130
+ } else {
1131
+ _push(`<!---->`);
1132
+ }
1133
+ _push(`<s>${ssrInterpolate(_ctx.$money($setup.comparePrice))}</s>`);
1134
+ if ($props.isLiteral) {
1135
+ _push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
1136
+ } else {
1137
+ _push(`<!---->`);
1138
+ }
1139
+ _push(`</span>`);
1140
+ } else {
1141
+ _push(`<!---->`);
1142
+ }
1143
+ _push(`<strong class="${ssrRenderClass([$props.isBig ? "text-5xl block" : null, "inline-block text-base-800"])}">`);
1144
+ if ($setup.hasVariedPrices) {
1145
+ _push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
1146
+ } else {
1147
+ _push(`<!---->`);
1148
+ }
1149
+ _push(` ${ssrInterpolate(_ctx.$money($setup.salePrice))}</strong>`);
1150
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
1151
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1152
+ if (_push2) {
1153
+ if ($setup.cashbackValue && $props.hasCashback) {
1154
+ _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>`);
1155
+ } else {
1156
+ _push2(`<!---->`);
1157
+ }
1158
+ } else {
1159
+ return [
1160
+ $setup.cashbackValue && $props.hasCashback ? (openBlock(), createBlock("div", {
1161
+ key: 0,
1162
+ class: "relative z-10"
1163
+ }, [
1164
+ createVNode("span", {
1165
+ "data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage))
1166
+ }, [
1167
+ createVNode("i", { class: "i-arrow-uturn-left mr-1" }),
1168
+ createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money($setup.cashbackValue)), 1),
1169
+ createVNode("small", null, " cashback")
1170
+ ], 8, ["data-tooltip"])
1171
+ ])) : createCommentVNode("", true)
1172
+ ];
1173
+ }
1174
+ }),
1175
+ _: 1
1176
+ }, _parent));
1177
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
1178
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1179
+ if (_push2) {
1180
+ if ($setup.installmentValue && $props.hasPriceOptions) {
1181
+ _push2(`<div${_scopeId}>`);
1182
+ if ($props.isLiteral) {
1183
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"At\xE9"} `)}</small>`);
1184
+ } else {
1185
+ _push2(`<!---->`);
1186
+ }
1187
+ _push2(` ${ssrInterpolate($setup.installmentsNumber)}x `);
1188
+ if ($props.isLiteral) {
1189
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
1190
+ } else {
1191
+ _push2(`<!---->`);
1192
+ }
1193
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.installmentValue))}</span>`);
1194
+ if (!$setup.monthlyInterest && $props.isLiteral) {
1195
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${"Sem juros"}`)}</small>`);
1196
+ } else {
1197
+ _push2(`<!---->`);
1198
+ }
1199
+ _push2(`</div>`);
1200
+ } else {
1201
+ _push2(`<!---->`);
1202
+ }
1203
+ } else {
1204
+ return [
1205
+ $setup.installmentValue && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
1206
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"At\xE9"} `))) : createCommentVNode("", true),
1207
+ createTextVNode(" " + toDisplayString($setup.installmentsNumber) + "x ", 1),
1208
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
1209
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.installmentValue)), 1),
1210
+ !$setup.monthlyInterest && $props.isLiteral ? (openBlock(), createBlock("small", { key: 2 }, toDisplayString(` ${"Sem juros"}`))) : createCommentVNode("", true)
1211
+ ])) : createCommentVNode("", true)
1212
+ ];
1213
+ }
1214
+ }),
1215
+ _: 1
1216
+ }, _parent));
1217
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
1218
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1219
+ if (_push2) {
1220
+ if ($setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions) {
1221
+ _push2(`<div${_scopeId}>`);
1222
+ if (!$setup.discountLabel) {
1223
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
1224
+ } else {
1225
+ _push2(`<!---->`);
1226
+ }
1227
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.priceWithDiscount))}</span>`);
1228
+ if ($setup.discountLabel) {
1229
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${$setup.discountLabel}`)}</small>`);
1230
+ } else {
1231
+ _push2(`<!---->`);
1232
+ }
1233
+ _push2(`</div>`);
1234
+ } else {
1235
+ _push2(`<!---->`);
1236
+ }
1237
+ } else {
1238
+ return [
1239
+ $setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
1240
+ !$setup.discountLabel ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true),
1241
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.priceWithDiscount)), 1),
1242
+ $setup.discountLabel ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${$setup.discountLabel}`), 1)) : createCommentVNode("", true)
1243
+ ])) : createCommentVNode("", true)
1244
+ ];
1245
+ }
1246
+ }),
1247
+ _: 1
1248
+ }, _parent));
1249
+ _push(`</div>`);
1250
+ }
1251
+ const _sfc_setup$2 = _sfc_main$2.setup;
1252
+ _sfc_main$2.setup = (props, ctx) => {
1253
+ const ssrContext = useSSRContext();
1254
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Prices.vue");
1255
+ return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
1256
+ };
1257
+ const Prices = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
1258
+
1259
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1260
+ __name: "ProductCard",
1261
+ props: {
1262
+ product: {},
1263
+ productId: {},
1264
+ headingTag: { default: "h3" }
1265
+ },
1266
+ setup(__props, { expose: __expose }) {
1267
+ __expose();
1268
+ const props = __props;
1269
+ const {
1270
+ product,
1271
+ title,
1272
+ link,
1273
+ images,
1274
+ isInStock,
1275
+ isActive,
1276
+ discountPercentage,
1277
+ hasVariations
1278
+ } = useProductCard(props);
1279
+ const card = ref(null);
1280
+ const isHovered = useElementHover(card);
1281
+ const wasHoveredOnce = ref(false);
1282
+ watchOnce(isHovered, () => {
1283
+ wasHoveredOnce.value = true;
1284
+ });
1285
+ const __returned__ = { props, product, title, link, images, isInStock, isActive, discountPercentage, hasVariations, card, isHovered, wasHoveredOnce, get addProductToCart() {
1286
+ return addProductToCart;
1287
+ }, Prices };
1288
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1289
+ return __returned__;
1290
+ }
1291
+ });
1292
+ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1293
+ const _component_ALink = resolveComponent("ALink");
1294
+ const _component_AImg = resolveComponent("AImg");
1295
+ _push(`<article${ssrRenderAttrs(mergeProps({
1296
+ ref: "card",
1297
+ "data-sku": $setup.product.sku,
1298
+ class: "relative h-full max-w-[350px] mx-auto py-3 group"
1299
+ }, _attrs))}>`);
1300
+ _push(ssrRenderComponent(_component_ALink, {
1301
+ href: $setup.link,
1302
+ class: "flex flex-col h-full rounded overflow-hidden group-hover:shadow group-hover:ring-1 ring-black/5"
1303
+ }, {
1304
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1305
+ if (_push2) {
1306
+ _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}>`);
1307
+ if ($setup.images?.length) {
1308
+ _push2(`<span class="text-xs text-opacity-70"${_scopeId}>`);
1309
+ _push2(ssrRenderComponent(_component_AImg, {
1310
+ picture: $setup.images[0],
1311
+ alt: $setup.title,
1312
+ class: "absolute top-0 left-0 block w-full h-full object-cover"
1313
+ }, null, _parent2, _scopeId));
1314
+ if ($setup.images[1] && $setup.wasHoveredOnce) {
1315
+ _push2(ssrRenderComponent(_component_AImg, {
1316
+ picture: $setup.images[1],
1317
+ alt: $setup.title,
1318
+ 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"
1319
+ }, null, _parent2, _scopeId));
1320
+ } else {
1321
+ _push2(`<!---->`);
1322
+ }
1323
+ _push2(`</span>`);
1324
+ } else {
1325
+ _push2(`<div class="w-full h-full bg-gradient-to-br from-base-50/20 to-base-100"${_scopeId}></div>`);
1326
+ }
1327
+ _push2(`</div></div>`);
1328
+ if ($setup.discountPercentage) {
1329
+ _push2(`<span class="uno-bm03rg"${_scopeId}> -<strong${_scopeId}>${ssrInterpolate($setup.discountPercentage)}</strong>% </span>`);
1330
+ } else {
1331
+ _push2(`<!---->`);
1332
+ }
1333
+ _push2(`<div class="relative flex flex-col grow justify-between p-4 group-hover:backdrop-blur-md bg-white/40 z-10"${_scopeId}>`);
1334
+ ssrRenderVNode(_push2, createVNode(resolveDynamicComponent($props.headingTag), {
1335
+ class: ["ui-link no-underline line-clamp-2", [
1336
+ $setup.isActive ? "text-base-700" : "text-base-500",
1337
+ $setup.link ? "group-hover:underline group-hover:text-primary" : null
1338
+ ]]
1339
+ }, {
1340
+ default: withCtx((_2, _push3, _parent3, _scopeId2) => {
1341
+ if (_push3) {
1342
+ _push3(`${ssrInterpolate($setup.title)}`);
1343
+ } else {
1344
+ return [
1345
+ createTextVNode(toDisplayString($setup.title), 1)
1346
+ ];
1347
+ }
1348
+ }),
1349
+ _: 1
1350
+ }), _parent2, _scopeId);
1351
+ _push2(`<div class="pt-2"${_scopeId}>`);
1352
+ if ($setup.isActive) {
1353
+ _push2(`<div${_scopeId}>`);
1354
+ _push2(ssrRenderComponent($setup["Prices"], { product: $setup.product }, null, _parent2, _scopeId));
1355
+ _push2(`</div>`);
1356
+ } else {
1357
+ _push2(`<span class="ui-badge bg-warning-100 text-warning-700"${_scopeId}>${ssrInterpolate(!$setup.isInStock ? "Sem estoque" : "Inativo")}</span>`);
1358
+ }
1359
+ _push2(`</div>`);
1360
+ if ($setup.isActive && !$setup.hasVariations) {
1361
+ _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>`);
1362
+ } else {
1363
+ _push2(`<!---->`);
1364
+ }
1365
+ _push2(`</div>`);
1366
+ } else {
1367
+ return [
1368
+ createVNode("div", { class: "aspect-square p-2 motion-safe:group-hover:scale-110 transition-transform" }, [
1369
+ createVNode("div", { class: "relative w-full h-full bg-white rounded overflow-hidden group-hover:rounded-none" }, [
1370
+ $setup.images?.length ? (openBlock(), createBlock("span", {
1371
+ key: 0,
1372
+ class: "text-xs text-opacity-70"
1373
+ }, [
1374
+ createVNode(_component_AImg, {
1375
+ picture: $setup.images[0],
1376
+ alt: $setup.title,
1377
+ class: "absolute top-0 left-0 block w-full h-full object-cover"
1378
+ }, null, 8, ["picture", "alt"]),
1379
+ $setup.images[1] && $setup.wasHoveredOnce ? (openBlock(), createBlock(_component_AImg, {
1380
+ key: 0,
1381
+ picture: $setup.images[1],
1382
+ alt: $setup.title,
1383
+ 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"
1384
+ }, null, 8, ["picture", "alt"])) : createCommentVNode("", true)
1385
+ ])) : (openBlock(), createBlock("div", {
1386
+ key: 1,
1387
+ class: "w-full h-full bg-gradient-to-br from-base-50/20 to-base-100"
1388
+ }))
1389
+ ])
1390
+ ]),
1391
+ $setup.discountPercentage ? (openBlock(), createBlock("span", {
1392
+ key: 0,
1393
+ class: "uno-bm03rg"
1394
+ }, [
1395
+ createTextVNode(" -"),
1396
+ createVNode("strong", null, toDisplayString($setup.discountPercentage), 1),
1397
+ createTextVNode("% ")
1398
+ ])) : createCommentVNode("", true),
1399
+ createVNode("div", { class: "relative flex flex-col grow justify-between p-4 group-hover:backdrop-blur-md bg-white/40 z-10" }, [
1400
+ (openBlock(), createBlock(resolveDynamicComponent($props.headingTag), {
1401
+ class: ["ui-link no-underline line-clamp-2", [
1402
+ $setup.isActive ? "text-base-700" : "text-base-500",
1403
+ $setup.link ? "group-hover:underline group-hover:text-primary" : null
1404
+ ]]
1405
+ }, {
1406
+ default: withCtx(() => [
1407
+ createTextVNode(toDisplayString($setup.title), 1)
1408
+ ]),
1409
+ _: 1
1410
+ }, 8, ["class"])),
1411
+ createVNode("div", { class: "pt-2" }, [
1412
+ $setup.isActive ? (openBlock(), createBlock("div", { key: 0 }, [
1413
+ createVNode($setup["Prices"], { product: $setup.product }, null, 8, ["product"])
1414
+ ])) : (openBlock(), createBlock("span", {
1415
+ key: 1,
1416
+ class: "ui-badge bg-warning-100 text-warning-700"
1417
+ }, toDisplayString(!$setup.isInStock ? "Sem estoque" : "Inativo"), 1))
1418
+ ]),
1419
+ $setup.isActive && !$setup.hasVariations ? (openBlock(), createBlock("button", {
1420
+ key: 0,
1421
+ class: "uno-3suct9 ui-btn-sm ui-btn-primary",
1422
+ onClick: withModifiers(($event) => $setup.addProductToCart($setup.product), ["prevent"])
1423
+ }, [
1424
+ 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" }, " + "),
1425
+ createTextVNode(" " + toDisplayString("Adicionar ao carrinho"))
1426
+ ], 8, ["onClick"])) : createCommentVNode("", true)
1427
+ ])
1428
+ ];
1429
+ }
1430
+ }),
1431
+ _: 1
1432
+ }, _parent));
1433
+ _push(`</article>`);
1434
+ }
1435
+ const _sfc_setup$1 = _sfc_main$1.setup;
1436
+ _sfc_main$1.setup = (props, ctx) => {
1437
+ const ssrContext = useSSRContext();
1438
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ProductCard.vue");
1439
+ return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
1440
+ };
1441
+ const ProductCard = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
1442
+
1443
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1444
+ __name: "ProductShelf",
1445
+ props: {
1446
+ collectionId: {},
1447
+ searchQuery: {},
1448
+ sort: {},
1449
+ title: {},
1450
+ titleLink: {},
1451
+ isShuffle: { type: Boolean },
1452
+ limit: {},
1453
+ page: {},
1454
+ products: {}
1455
+ },
1456
+ async setup(__props, { expose: __expose }) {
1457
+ __expose();
1458
+ let __temp, __restore;
1459
+ const props = __props;
1460
+ const {
1461
+ title,
1462
+ titleLink,
1463
+ fetching,
1464
+ products
1465
+ } = useProductShelf(props);
1466
+ {
1467
+ [__temp, __restore] = withAsyncContext(() => fetching), await __temp, __restore();
1468
+ }
1469
+ const __returned__ = { props, title, titleLink, fetching, products, Carousel, CarouselControl, ProductCard };
1470
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1471
+ return __returned__;
1472
+ }
1473
+ });
1474
+ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1475
+ const _component_ALink = resolveComponent("ALink");
1476
+ _push(`<section${ssrRenderAttrs(mergeProps({ class: "ui-section" }, _attrs))}>`);
1477
+ if ($setup.title) {
1478
+ _push(`<div class="max-w-prose mx-auto text-center mb-2"><h2 class="ui-text-brand text-3xl">`);
1479
+ _push(ssrRenderComponent(_component_ALink, {
1480
+ href: $setup.titleLink,
1481
+ class: $setup.titleLink ? "ui-link" : "text-base-700"
1482
+ }, {
1483
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1484
+ if (_push2) {
1485
+ _push2(`${ssrInterpolate($setup.title)}`);
1486
+ } else {
1487
+ return [
1488
+ createTextVNode(toDisplayString($setup.title), 1)
1489
+ ];
1490
+ }
1491
+ }),
1492
+ _: 1
1493
+ }, _parent));
1494
+ _push(`</h2></div>`);
1495
+ } else {
1496
+ _push(`<!---->`);
1497
+ }
1498
+ _push(ssrRenderComponent($setup["Carousel"], { class: "group/shelf" }, {
1499
+ controls: withCtx((_, _push2, _parent2, _scopeId) => {
1500
+ if (_push2) {
1501
+ _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}>`);
1502
+ _push2(ssrRenderComponent($setup["CarouselControl"], {
1503
+ 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",
1504
+ "is-prev": ""
1505
+ }, null, _parent2, _scopeId));
1506
+ _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));
1507
+ _push2(`</div>`);
1508
+ } else {
1509
+ return [
1510
+ withDirectives(createVNode("div", { class: "text-3xl lg:text-2xl leading-none text-primary lg:opacity-0 group-hover/shelf:opacity-90 transition-opacity" }, [
1511
+ createVNode($setup["CarouselControl"], {
1512
+ 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",
1513
+ "is-prev": ""
1514
+ }),
1515
+ 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" })
1516
+ ], 512), [
1517
+ [vShow, $setup.products.length > 2]
1518
+ ])
1519
+ ];
1520
+ }
1521
+ }),
1522
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1523
+ if (_push2) {
1524
+ _push2(`<!--[-->`);
1525
+ ssrRenderList($setup.products, (product) => {
1526
+ _push2(`<li class="basis-1/2 md:basis-1/3 lg:basis-1/4 shrink-0"${_scopeId}>`);
1527
+ _push2(ssrRenderComponent($setup["ProductCard"], { product }, null, _parent2, _scopeId));
1528
+ _push2(`</li>`);
1529
+ });
1530
+ _push2(`<!--]-->`);
1531
+ } else {
1532
+ return [
1533
+ (openBlock(true), createBlock(Fragment$1, null, renderList($setup.products, (product) => {
1534
+ return openBlock(), createBlock("li", {
1535
+ key: product._id,
1536
+ class: "basis-1/2 md:basis-1/3 lg:basis-1/4 shrink-0"
1537
+ }, [
1538
+ createVNode($setup["ProductCard"], { product }, null, 8, ["product"])
1539
+ ]);
1540
+ }), 128))
1541
+ ];
1542
+ }
1543
+ }),
1544
+ _: 1
1545
+ }, _parent));
1546
+ _push(`</section>`);
1547
+ }
1548
+ const _sfc_setup = _sfc_main.setup;
1549
+ _sfc_main.setup = (props, ctx) => {
1550
+ const ssrContext = useSSRContext();
1551
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ProductShelf.vue");
1552
+ return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
1553
+ };
1554
+ const ProductShelf = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
1555
+
1556
+ const $$Astro$3 = createAstro("https://ecom2-demo.web.app");
1557
+ const $$Sections = createComponent(async ($$result, $$props, $$slots) => {
1558
+ const Astro2 = $$result.createAstro($$Astro$3, $$props, $$slots);
1559
+ Astro2.self = $$Sections;
1560
+ const { routeContext } = Astro2.locals;
1561
+ const { sections } = await usePageSections({
1562
+ routeContext,
1563
+ handleCustomSection: async (type, content) => {
1564
+ if (type === "c:foo")
1565
+ return { props: { ...content, foo: "bar" } };
1566
+ return { props: content };
1567
+ }
1568
+ });
1569
+ return renderTemplate`${maybeRenderHead()}<article class="my-9 md:my-12">
1570
+ ${sections.map(({ type, props }) => {
1571
+ switch (type) {
1572
+ case "product-shelf":
1573
+ return renderTemplate`${renderComponent($$result, "ProductShelf", ProductShelf, { ...props, "client:visible": true, "client:component-hydration": "visible", "client:component-path": "~/components/ProductShelf.vue", "client:component-export": "default" })}`;
1574
+ case "banners-grid":
1575
+ return renderTemplate`${renderComponent($$result, "BannersGrid", $$BannersGrid, { ...props })}`;
1576
+ case "c:foo":
1577
+ return renderTemplate`<div${addAttribute(props.foo, "data-foo")}></div>`;
1578
+ default:
1579
+ return renderTemplate`<div${addAttribute(type, "data-section")}></div>`;
1580
+ }
1581
+ })}
1582
+ </article>`;
1583
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Sections.astro", void 0);
1584
+
1585
+ const $$Astro$2 = createAstro("https://ecom2-demo.web.app");
1586
+ const $$Home = createComponent(async ($$result, $$props, $$slots) => {
1587
+ const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
1588
+ Astro2.self = $$Home;
1589
+ const { routeContext } = Astro2.locals;
1590
+ const { heroSlider } = await usePageHero({ routeContext });
1591
+ const heroSlides = heroSlider.slides;
1592
+ return renderTemplate`${maybeRenderHead()}<main>
1593
+ ${heroSlider.slides.length && renderTemplate`${renderComponent($$result, "HeroSlider", HeroSlider, { ...heroSlider, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/HeroSlider.vue", "client:component-export": "default" }, { "picture-0": ($$result2) => renderTemplate`${heroSlides[0] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-0", ...heroSlides[0], "index": 0 })}`}`, "picture-1": ($$result2) => renderTemplate`${heroSlides[1] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-1", ...heroSlides[1], "index": 1 })}`}`, "picture-2": ($$result2) => renderTemplate`${heroSlides[2] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-2", ...heroSlides[2], "index": 2 })}`}`, "picture-3": ($$result2) => renderTemplate`${heroSlides[3] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-3", ...heroSlides[3], "index": 3 })}`}`, "picture-4": ($$result2) => renderTemplate`${heroSlides[4] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-4", ...heroSlides[4], "index": 4 })}`}`, "picture-5": ($$result2) => renderTemplate`${heroSlides[5] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-5", ...heroSlides[5], "index": 5 })}`}`, "picture-6": ($$result2) => renderTemplate`${heroSlides[6] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-6", ...heroSlides[6], "index": 6 })}`}`, "picture-7": ($$result2) => renderTemplate`${heroSlides[7] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-7", ...heroSlides[7], "index": 7 })}`}`, "picture-8": ($$result2) => renderTemplate`${heroSlides[8] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-8", ...heroSlides[8], "index": 8 })}`}`, "picture-9": ($$result2) => renderTemplate`${heroSlides[9] && renderTemplate`${renderComponent($$result2, "BannerPictures", $$BannerPictures, { "slot": "picture-9", ...heroSlides[9], "index": 9 })}`}` })}`}
1594
+ ${renderComponent($$result, "Sections", $$Sections, {})}
1595
+ </main>`;
1596
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Home.astro", void 0);
1597
+
1598
+ const $$Astro$1 = createAstro("https://ecom2-demo.web.app");
1599
+ const $$Index$1 = createComponent(async ($$result, $$props, $$slots) => {
1600
+ const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
1601
+ Astro2.self = $$Index$1;
1602
+ let routeContext;
1603
+ let loadError;
1604
+ try {
1605
+ routeContext = await loadRouteContext(Astro2);
1606
+ } catch (err) {
1607
+ if (err.astroResponse) {
1608
+ return err.astroResponse;
1609
+ }
1610
+ loadError = err;
1611
+ }
1612
+ return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}>
1613
+ ${routeContext && renderTemplate`${renderComponent($$result, "Base", $$Base, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "BaseHead", $$BaseHead, { "slot": "base-head" })}`, "default": ($$result2) => renderTemplate`
1614
+
1615
+ ${renderComponent($$result2, "PageHeader", $$PageHeader, {})}
1616
+ ${renderComponent($$result2, "HomeMain", $$Home, {})}
1617
+ ${renderComponent($$result2, "PageFooter", $$PageFooter, {})}
1618
+ ` })}`}
1619
+ ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
1620
+ </html>`;
1621
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro", void 0);
1622
+
1623
+ const $$file$1 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro";
1624
+ const $$url$1 = "";
1625
+
1626
+ const index$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1627
+ __proto__: null,
1628
+ default: $$Index$1,
1629
+ file: $$file$1,
1630
+ url: $$url$1
1631
+ }, Symbol.toStringTag, { value: 'Module' }));
1632
+
1633
+ const $$Astro = createAstro("https://ecom2-demo.web.app");
1634
+ const $$Index = createComponent(async ($$result, $$props, $$slots) => {
1635
+ const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
1636
+ Astro2.self = $$Index;
1637
+ return renderTemplate``;
1638
+ }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro", void 0);
1639
+
1640
+ const $$file = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro";
1641
+ const $$url = "/app";
1642
+
1643
+ const index = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1644
+ __proto__: null,
1645
+ default: $$Index,
1646
+ file: $$file,
1647
+ url: $$url
1648
+ }, Symbol.toStringTag, { value: 'Module' }));
1649
+
1650
+ export { Prices as P, index as a, index$1 as i };